From 38728d9cc8d956d6a1c391a2a0e99a8236923699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20=C5=81aziuk?= Date: Tue, 16 Oct 2018 13:57:01 +0200 Subject: [PATCH 001/241] description --- types/range-parser/index.d.ts | 4 ++-- types/range-parser/tsconfig.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/range-parser/index.d.ts b/types/range-parser/index.d.ts index a1bcf4c9dc..13d331041a 100644 --- a/types/range-parser/index.d.ts +++ b/types/range-parser/index.d.ts @@ -4,11 +4,11 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** - * Returns `-1` when unsatisfiable and `-2` when syntactically invalid. - * * When ranges are returned, the array has a "type" property which is the type of * range that is required (most commonly, "bytes"). Each array element is an object * with a "start" and "end" property for the portion of the range. + * + * @returns `-1` when unsatisfiable and `-2` when syntactically invalid, ranges otherwise. */ declare function RangeParser(size: number, str: string, options?: RangeParser.Options): RangeParser.Result | RangeParser.Ranges; diff --git a/types/range-parser/tsconfig.json b/types/range-parser/tsconfig.json index 15585886a9..dc6de494bf 100644 --- a/types/range-parser/tsconfig.json +++ b/types/range-parser/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "range-parser-tests.ts" ] -} \ No newline at end of file +} From 6d51909cafaad3b3634ad057bfeb2f7eac011872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomek=20=C5=81aziuk?= Date: Tue, 16 Oct 2018 14:10:42 +0200 Subject: [PATCH 002/241] --isolatedModules fix --- types/range-parser/index.d.ts | 7 +++---- types/range-parser/range-parser-tests.ts | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/types/range-parser/index.d.ts b/types/range-parser/index.d.ts index 13d331041a..e8e6ae4451 100644 --- a/types/range-parser/index.d.ts +++ b/types/range-parser/index.d.ts @@ -27,10 +27,9 @@ declare namespace RangeParser { */ combine?: boolean; } - const enum Result { - invaild = -2, - unsatisifiable = -1, - } + type ResultUnsatisfiable = -1; + type ResultInvalid = -2; + type Result = ResultUnsatisfiable | ResultInvalid; } export = RangeParser; diff --git a/types/range-parser/range-parser-tests.ts b/types/range-parser/range-parser-tests.ts index ec1ffa6e4e..2c18e3f9dc 100644 --- a/types/range-parser/range-parser-tests.ts +++ b/types/range-parser/range-parser-tests.ts @@ -2,8 +2,8 @@ import RangeParser = require('range-parser'); declare var console: { assert(b: boolean): void }; -console.assert(RangeParser(200, `malformed`) === RangeParser.Result.invaild); -console.assert(RangeParser(200, `bytes=500-20`) === RangeParser.Result.unsatisifiable); +console.assert(RangeParser(200, `malformed`) === -2); +console.assert(RangeParser(200, `bytes=500-20`) === -1); const range = RangeParser(1000, `bytes=0-499`); From 202f4ee2dd0603bc665629d5f6c1c37ae3868dd6 Mon Sep 17 00:00:00 2001 From: Jeff Held Date: Thu, 8 Nov 2018 16:49:37 -0600 Subject: [PATCH 003/241] detox: create tests folder, add test for importing Detox module --- types/detox/detox-tests.ts | 31 -------------- types/detox/tests/detox-globals-tests.ts | 40 ++++++++++++++++++ .../detox/tests/detox-import-modules-tests.ts | 42 +++++++++++++++++++ types/detox/tsconfig.json | 11 ++--- 4 files changed, 86 insertions(+), 38 deletions(-) delete mode 100644 types/detox/detox-tests.ts create mode 100644 types/detox/tests/detox-globals-tests.ts create mode 100644 types/detox/tests/detox-import-modules-tests.ts diff --git a/types/detox/detox-tests.ts b/types/detox/detox-tests.ts deleted file mode 100644 index 58fe5c1912..0000000000 --- a/types/detox/detox-tests.ts +++ /dev/null @@ -1,31 +0,0 @@ -declare var describe: (test: string, callback: () => void) => void; -declare var beforeAll: (callback: () => void) => void; -declare var afterAll: (callback: () => void) => void; -declare var test: (test: string, callback: () => void) => void; - -describe('Test', () => { - beforeAll(async () => { - await device.reloadReactNative(); - }); - - afterAll(async () => { - await element(by.id('element')).clearText(); - }); - - test('Test', async () => { - await element(by.id('element')).replaceText('text'); - await element(by.id('element')).tap(); - await element(by.id('element')).scroll(50, 'down'); - await element(by.id('scrollView')).scrollTo('bottom'); - await expect(element(by.id('element')).atIndex(0)).toNotExist(); - await element(by.id('scrollView')).swipe('down', 'fast'); - await element(by.type('UIPickerView')).setColumnToValue(1, "6"); - - await expect(element(by.id('element').withAncestor(by.id('parent_element')))).toNotExist(); - await expect(element(by.id('element').withDescendant(by.id('child_element')))).toNotExist(); - - await waitFor(element(by.id('element'))).toBeVisible().withTimeout(2000); - await device.pressBack(); - await waitFor(element(by.text('Text5'))).toBeVisible().whileElement(by.id('ScrollView630')).scroll(50, 'down'); - }); -}); diff --git a/types/detox/tests/detox-globals-tests.ts b/types/detox/tests/detox-globals-tests.ts new file mode 100644 index 0000000000..42415c548d --- /dev/null +++ b/types/detox/tests/detox-globals-tests.ts @@ -0,0 +1,40 @@ +declare var describe: (test: string, callback: () => void) => void; +declare var beforeAll: (callback: () => void) => void; +declare var afterAll: (callback: () => void) => void; +declare var test: (test: string, callback: () => void) => void; + +describe("Test", () => { + beforeAll(async () => { + await device.reloadReactNative(); + }); + + afterAll(async () => { + await element(by.id("element")).clearText(); + }); + + test("Test", async () => { + await element(by.id("element")).replaceText("text"); + await element(by.id("element")).tap(); + await element(by.id("element")).scroll(50, "down"); + await element(by.id("scrollView")).scrollTo("bottom"); + await expect(element(by.id("element")).atIndex(0)).toNotExist(); + await element(by.id("scrollView")).swipe("down", "fast"); + await element(by.type("UIPickerView")).setColumnToValue(1, "6"); + + await expect( + element(by.id("element").withAncestor(by.id("parent_element"))) + ).toNotExist(); + await expect( + element(by.id("element").withDescendant(by.id("child_element"))) + ).toNotExist(); + + await waitFor(element(by.id("element"))) + .toBeVisible() + .withTimeout(2000); + await device.pressBack(); + await waitFor(element(by.text("Text5"))) + .toBeVisible() + .whileElement(by.id("ScrollView630")) + .scroll(50, "down"); + }); +}); diff --git a/types/detox/tests/detox-import-modules-tests.ts b/types/detox/tests/detox-import-modules-tests.ts new file mode 100644 index 0000000000..318569c03d --- /dev/null +++ b/types/detox/tests/detox-import-modules-tests.ts @@ -0,0 +1,42 @@ +declare var describe: (test: string, callback: () => void) => void; +declare var beforeAll: (callback: () => void) => void; +declare var afterAll: (callback: () => void) => void; +declare var test: (test: string, callback: () => void) => void; + +import { by, device, element, expect, waitFor } from "detox"; + +describe("Test", () => { + beforeAll(async () => { + await device.reloadReactNative(); + }); + + afterAll(async () => { + await element(by.id("element")).clearText(); + }); + + test("Test", async () => { + await element(by.id("element")).replaceText("text"); + await element(by.id("element")).tap(); + await element(by.id("element")).scroll(50, "down"); + await element(by.id("scrollView")).scrollTo("bottom"); + await expect(element(by.id("element")).atIndex(0)).toNotExist(); + await element(by.id("scrollView")).swipe("down", "fast"); + await element(by.type("UIPickerView")).setColumnToValue(1, "6"); + + await expect( + element(by.id("element").withAncestor(by.id("parent_element"))) + ).toNotExist(); + await expect( + element(by.id("element").withDescendant(by.id("child_element"))) + ).toNotExist(); + + await waitFor(element(by.id("element"))) + .toBeVisible() + .withTimeout(2000); + await device.pressBack(); + await waitFor(element(by.text("Text5"))) + .toBeVisible() + .whileElement(by.id("ScrollView630")) + .scroll(50, "down"); + }); +}); diff --git a/types/detox/tsconfig.json b/types/detox/tsconfig.json index 2d1a22fb79..3eb7524be2 100644 --- a/types/detox/tsconfig.json +++ b/types/detox/tsconfig.json @@ -1,24 +1,21 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6"], "target": "ES2015", "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", - "detox-tests.ts" + "tests/detox-globals-tests.ts", + "tests/detox-import-modules-tests.ts" ] } From 45a0c57ef040ed95fa5994b05a2a5c32778706fc Mon Sep 17 00:00:00 2001 From: Jeff Held Date: Thu, 8 Nov 2018 16:49:42 -0600 Subject: [PATCH 004/241] detox: follow global-modifying dts example --- types/detox/index.d.ts | 821 +++++++++++++++++++++-------------------- 1 file changed, 416 insertions(+), 405 deletions(-) diff --git a/types/detox/index.d.ts b/types/detox/index.d.ts index 7ef085e25d..f9baa99f6e 100644 --- a/types/detox/index.d.ts +++ b/types/detox/index.d.ts @@ -3,418 +3,429 @@ // Definitions by: Tareq El-Masri , Steve Chun // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare const detox: Detox.Detox; -declare const device: Detox.Device; -declare const element: Detox.Element; -declare const waitFor: Detox.WaitFor; -declare const expect: Detox.Expect>; -declare const by: Detox.Matchers; +declare global { + const detox: Detox.Detox; + const device: Detox.Device; + const element: Detox.Element; + const waitFor: Detox.WaitFor; + const expect: Detox.Expect>; + const by: Detox.Matchers; -declare namespace Detox { - interface Detox { - /** - * The setup phase happens inside detox.init(). This is the phase where detox reads its configuration, starts a server, loads its expection library and starts a simulator - * @param config - * @param options - * @example const config = require('../package.json').detox; - * - * before(async () => { - * await detox.init(config); - * }); - */ - init(config: any, options?: DetoxInitOptions): Promise; - /** - * Artifacts currently include only logs from the app process before each task - * @param args - */ - beforeEach(...args: any[]): Promise; - /** - * Artifacts currently include only logs from the app process after each task - * @param args - */ - afterEach(...args: any[]): Promise; - /** - * The cleanup phase should happen after all the tests have finished. This is the phase where detox-server shuts down. - * @example after(async () => { - * await detox.cleanup(); - * }); - */ - cleanup(): Promise; - } - interface Device { - /** - * Launch the app - * @param config - * @example // Terminate the app and launch it again. If set to false, the simulator will try to bring app from background, - * // if the app isn't running, it will launch a new instance. default is false - * await device.launchApp({newInstance: true}); - * // Grant or deny runtime permissions for your application. - * await device.launchApp({permissions: {calendar: 'YES'}}); - * // Mock opening the app from URL to test your app's deep link handling mechanism. - * await device.launchApp({url: url}); - */ - launchApp(config: DeviceLanchAppConfig): Promise; - /** - * By default, terminateApp() with no params will terminate the app - * To terminate another app, specify its bundle id - * @param bundle - * @example await device.terminateApp('other.bundle.id'); - */ - terminateApp(bundle?: string): Promise; - /** - * Send application to background by bringing com.apple.springboard to the foreground. - * Combining sendToHome() with launchApp({newInstance: false}) will simulate app coming back from background. - * @example await device.sendToHome(); - * await device.launchApp({newInstance: false}); - */ - sendToHome(): Promise; - /** - * If this is a React Native app, reload the React Native JS bundle. This action is much faster than device.launchApp(), and can be used if you just need to reset your React Native logic. - * @example await device.reloadReactNative() - */ - reloadReactNative(): Promise; - /** - * By default, installApp() with no params will install the app file defined in the current configuration. - * To install another app, specify its path - * @param path - * @example await device.installApp('path/to/other/app'); - */ - installApp(path?: any): Promise; - /** - * By default, uninstallApp() with no params will uninstall the app defined in the current configuration. - * To uninstall another app, specify its bundle id - * @param bundle - * @example await device.installApp('other.bundle.id'); - */ - uninstallApp(bundle?: string): Promise; - /** - * Mock opening the app from URL. sourceApp is an optional parameter to specify source application bundle id. - * @param url - */ - openURL(url: {url: string, sourceApp?: string}): Promise; - /** - * Mock handling of received user notification when app is in foreground. - * @param params - */ - sendUserNotification(...params: any[]): Promise; - /** - * Mock handling of received user activity when app is in foreground. - * @param params - */ - sendUserActivity(...params: any[]): Promise; - /** - * Takes "portrait" or "landscape" and rotates the device to the given orientation. Currently only available in the iOS Simulator. - * @param orientation - */ - setOrientation(orientation: Orientation): Promise; - /** - * Note: setLocation is dependent on fbsimctl. if fbsimctl is not installed, the command will fail, it must be installed. Sets the simulator location to the given latitude and longitude. - * @param lat - * @param lon - * @example await device.setLocation(32.0853, 34.7818); - */ - setLocation(lat: number, lon: number): Promise; - /** - * Disable EarlGrey's network synchronization mechanism on preffered endpoints. Usful if you want to on skip over synchronizing on certain URLs. - * @param urls - * @example await device.setURLBlacklist(['.*127.0.0.1.*']); - */ - setURLBlacklist(urls: string[]): Promise; - /** - * Enable EarlGrey's synchronization mechanism (enabled by default). This is being reset on every new instance of the app. - * @example await device.enableSynchronization(); - */ - enableSynchronization(): Promise; - /** - * Disable EarlGrey's synchronization mechanism (enabled by default) This is being reset on every new instance of the app. - * @example await device.disableSynchronization(); - */ - disableSynchronization(): Promise; - /** - * Resets the Simulator to clean state (like the Simulator > Reset Content and Settings... menu item), especially removing previously set permissions. - * @example await device.resetContentAndSettings(); - */ - resetContentAndSettings(): Promise; - /** - * Returns the current device, ios or android. - * @example if (device.getPlatform() === 'ios') { - * await expect(loopSwitch).toHaveValue('1'); - * } - */ - getPlatform(): "ios" | "android"; - /** - * Simulate press back button (Android Only) - */ - pressBack(): Promise; - /** - * Simulate shake (iOS Only) - */ - shake(): Promise; - } + namespace Detox { + interface Detox { + /** + * The setup phase happens inside detox.init(). This is the phase where detox reads its configuration, starts a server, loads its expection library and starts a simulator + * @param config + * @param options + * @example const config = require('../package.json').detox; + * + * before(async () => { + * await detox.init(config); + * }); + */ + init(config: any, options?: DetoxInitOptions): Promise; + /** + * Artifacts currently include only logs from the app process before each task + * @param args + */ + beforeEach(...args: any[]): Promise; + /** + * Artifacts currently include only logs from the app process after each task + * @param args + */ + afterEach(...args: any[]): Promise; + /** + * The cleanup phase should happen after all the tests have finished. This is the phase where detox-server shuts down. + * @example after(async () => { + * await detox.cleanup(); + * }); + */ + cleanup(): Promise; + } + interface Device { + /** + * Launch the app + * @param config + * @example // Terminate the app and launch it again. If set to false, the simulator will try to bring app from background, + * // if the app isn't running, it will launch a new instance. default is false + * await device.launchApp({newInstance: true}); + * // Grant or deny runtime permissions for your application. + * await device.launchApp({permissions: {calendar: 'YES'}}); + * // Mock opening the app from URL to test your app's deep link handling mechanism. + * await device.launchApp({url: url}); + */ + launchApp(config: DeviceLanchAppConfig): Promise; + /** + * By default, terminateApp() with no params will terminate the app + * To terminate another app, specify its bundle id + * @param bundle + * @example await device.terminateApp('other.bundle.id'); + */ + terminateApp(bundle?: string): Promise; + /** + * Send application to background by bringing com.apple.springboard to the foreground. + * Combining sendToHome() with launchApp({newInstance: false}) will simulate app coming back from background. + * @example await device.sendToHome(); + * await device.launchApp({newInstance: false}); + */ + sendToHome(): Promise; + /** + * If this is a React Native app, reload the React Native JS bundle. This action is much faster than device.launchApp(), and can be used if you just need to reset your React Native logic. + * @example await device.reloadReactNative() + */ + reloadReactNative(): Promise; + /** + * By default, installApp() with no params will install the app file defined in the current configuration. + * To install another app, specify its path + * @param path + * @example await device.installApp('path/to/other/app'); + */ + installApp(path?: any): Promise; + /** + * By default, uninstallApp() with no params will uninstall the app defined in the current configuration. + * To uninstall another app, specify its bundle id + * @param bundle + * @example await device.installApp('other.bundle.id'); + */ + uninstallApp(bundle?: string): Promise; + /** + * Mock opening the app from URL. sourceApp is an optional parameter to specify source application bundle id. + * @param url + */ + openURL(url: { url: string; sourceApp?: string }): Promise; + /** + * Mock handling of received user notification when app is in foreground. + * @param params + */ + sendUserNotification(...params: any[]): Promise; + /** + * Mock handling of received user activity when app is in foreground. + * @param params + */ + sendUserActivity(...params: any[]): Promise; + /** + * Takes "portrait" or "landscape" and rotates the device to the given orientation. Currently only available in the iOS Simulator. + * @param orientation + */ + setOrientation(orientation: Orientation): Promise; + /** + * Note: setLocation is dependent on fbsimctl. if fbsimctl is not installed, the command will fail, it must be installed. Sets the simulator location to the given latitude and longitude. + * @param lat + * @param lon + * @example await device.setLocation(32.0853, 34.7818); + */ + setLocation(lat: number, lon: number): Promise; + /** + * Disable EarlGrey's network synchronization mechanism on preffered endpoints. Usful if you want to on skip over synchronizing on certain URLs. + * @param urls + * @example await device.setURLBlacklist(['.*127.0.0.1.*']); + */ + setURLBlacklist(urls: string[]): Promise; + /** + * Enable EarlGrey's synchronization mechanism (enabled by default). This is being reset on every new instance of the app. + * @example await device.enableSynchronization(); + */ + enableSynchronization(): Promise; + /** + * Disable EarlGrey's synchronization mechanism (enabled by default) This is being reset on every new instance of the app. + * @example await device.disableSynchronization(); + */ + disableSynchronization(): Promise; + /** + * Resets the Simulator to clean state (like the Simulator > Reset Content and Settings... menu item), especially removing previously set permissions. + * @example await device.resetContentAndSettings(); + */ + resetContentAndSettings(): Promise; + /** + * Returns the current device, ios or android. + * @example if (device.getPlatform() === 'ios') { + * await expect(loopSwitch).toHaveValue('1'); + * } + */ + getPlatform(): "ios" | "android"; + /** + * Simulate press back button (Android Only) + */ + pressBack(): Promise; + /** + * Simulate shake (iOS Only) + */ + shake(): Promise; + } - type DetoxAny = Element & Actions & WaitFor; + type DetoxAny = Element & Actions & WaitFor; - interface Element { - (by: Matchers): DetoxAny; + interface Element { + (by: Matchers): DetoxAny; - /** - * Choose from multiple elements matching the same matcher using index - * @param index - * @example await element(by.text('Product')).atIndex(2); - */ - atIndex(index: number): DetoxAny; - } - interface Matchers { - (by: Matchers): Matchers; + /** + * Choose from multiple elements matching the same matcher using index + * @param index + * @example await element(by.text('Product')).atIndex(2); + */ + atIndex(index: number): DetoxAny; + } + interface Matchers { + (by: Matchers): Matchers; - /** - * by.id will match an id that is given to the view via testID prop. - * @param id - * @example // In a React Native component add testID like so: - * - * // Then match with by.id: - * await element(by.id('tap_me')); - */ - id(id: string): Matchers; - /** - * Find an element by text, useful for text fields, buttons. - * @param text - * @example await element(by.text('Tap Me')); - */ - text(text: string): Matchers; - /** - * Find an element by accessibilityLabel on iOS, or by contentDescription on Android. - * @param label - * @example await element(by.label('Welcome')); - */ - label(label: string): Matchers; - /** - * Find an element by native view type. - * @param nativeViewType - * @example await element(by.type('RCTImageView')); - */ - type(nativeViewType: string): Matchers; - /** - * Find an element with an accessibility trait. (iOS only) - * @example await element(by.traits(['button'])); - */ - traits(traits: string[]): Matchers; - /** - * Find an element by a matcher with a parent matcher - * @param parentBy - * @example await element(by.id('Grandson883').withAncestor(by.id('Son883'))); - */ - withAncestor(parentBy: Matchers): Matchers; - /** - * Find an element by a matcher with a child matcher - * @param childBy - * @example await element(by.id('Son883').withDescendant(by.id('Grandson883'))); - */ - withDescendant(childBy: Matchers): Matchers; - /** - * Find an element by multiple matchers - * @param by - * @example await element(by.text('Product').and(by.id('product_name')); - */ - and(by: Matchers): Matchers; - } - interface Expect { - (element: Element): Expect; - /** - * Expect the view to be at least 75% visible. - * @example await expect(element(by.id('UniqueId204'))).toBeVisible(); - */ - toBeVisible(): R; - /** - * Expect the view to not be visible. - * @example await expect(element(by.id('UniqueId205'))).toBeNotVisible(); - */ - toBeNotVisible(): R; - /** - * Expect the view to exist in the UI hierarchy. - * @example await expect(element(by.id('UniqueId205'))).toExist(); - */ - toExist(): R; - /** - * Expect the view to not exist in the UI hierarchy. - * @example await expect(element(by.id('RandomJunk959'))).toNotExist(); - */ - toNotExist(): R; - /** - * In React Native apps, expect UI component of type to have text. - * In native iOS apps, expect UI elements of type UIButton, UILabel, UITextField or UITextViewIn to have inputText with text. - * @param text - * @example await expect(element(by.id('UniqueId204'))).toHaveText('I contain some text'); - */ - toHaveText(text: string): R; - /** - * It searches by accessibilityLabel on iOS, or by contentDescription on Android. - * In React Native it can be set for both platforms by defining an accessibilityLabel on the view. - * @param label - * @example await expect(element(by.id('UniqueId204'))).toHaveLabel('Done'); - */ - toHaveLabel(label: string): R; - /** - * In React Native apps, expect UI component to have testID with that id. - * In native iOS apps, expect UI element to have accesibilityIdentifier with that id. - * @param id - * @example await expect(element(by.text('I contain some text'))).toHaveId('UniqueId204'); - */ - toHaveId(id: string): R; - /** - * Expect components like a Switch to have a value ('0' for off, '1' for on). - * @param value - * @example await expect(element(by.id('UniqueId533'))).toHaveValue('0'); - */ - toHaveValue(value: any): R; - } - interface WaitFor { - /** - * This API polls using the given expectation continuously until the expectation is met. Use manual synchronization with waitFor only as a last resort. - * NOTE: Every waitFor call must set a timeout using withTimeout(). Calling waitFor without setting a timeout will do nothing. - * @example await waitFor(element(by.id('UniqueId336'))).toExist().withTimeout(2000); - */ - (element: Element): Expect; - /** - * Waits for the condition to be met until the specified time (millis) have elapsed. - * @param millis number - * @example await waitFor(element(by.id('UniqueId336'))).toExist().withTimeout(2000); - */ - withTimeout(millis: number): Promise; - /** - * Performs the action repeatedly on the element until an expectation is met - * @param by - * @example await waitFor(element(by.text('Text5'))).toBeVisible().whileElement(by.id('ScrollView630')).scroll(50, 'down'); - */ - whileElement(by: Matchers): DetoxAny; - } - interface Actions { - /** - * Simulate tap on an element - * @example await element(by.id('tappable')).tap(); - */ - tap(): Promise>; - /** - * Simulate long press on an element - * @example await element(by.id('tappable')).longPress(); - */ - longPress(): Promise>; - /** - * Simulate multiple taps on an element. - * @param times number - * @example await element(by.id('tappable')).multiTap(3); - */ - multiTap(times: number): Promise>; - /** - * Simulate tap at a specific point on an element. - * Note: The point coordinates are relative to the matched element and the element size could changes on different devices or even when changing the device font size. - * @param point - * @example await element(by.id('tappable')).tapAtPoint({ x:5, y:10 }); - */ - tapAtPoint(point: { x: number, y: number }): Promise>; - /** - * Use the builtin keyboard to type text into a text field. - * @param text - * @example await element(by.id('textField')).typeText('passcode'); - */ - typeText(text: string): Promise>; - /** - * Paste text into a text field. - * @param text - * @example await element(by.id('textField')).replaceText('passcode again'); - */ - replaceText(text: string): Promise>; - /** - * Clear text from a text field. - * @example await element(by.id('textField')).clearText(); - */ - clearText(): Promise>; - /** - * - * @param pixels - * @param direction - * @example - * await element(by.id('scrollView')).scroll(100, 'down'); - * await element(by.id('scrollView')).scroll(100, 'up'); - */ - scroll(pixels: number, direction: Direction): Promise>; - /** - * Scroll to edge. - * @param edge - * @example await element(by.id('scrollView')).scrollTo('bottom'); - * await element(by.id('scrollView')).scrollTo('top'); - */ - scrollTo(edge: Direction): Promise>; - /** - * - * @param direction - * @param speed - * @param percentage - * @example await element(by.id('scrollView')).swipe('down'); - * await element(by.id('scrollView')).swipe('down', 'fast'); - * await element(by.id('scrollView')).swipe('down', 'fast', 0.5); - */ - swipe(direction: Direction, speed?: Speed, percentage?: number): Promise>; - /** - * (iOS Only) column - number of datepicker column (starts from 0) value - string value in setted column (must be correct) - * @param column - * @param value - * @example await expect(element(by.type('UIPickerView'))).toBeVisible(); - * await element(by.type('UIPickerView')).setColumnToValue(1,"6"); - * await element(by.type('UIPickerView')).setColumnToValue(2,"34"); - */ - setColumnToValue(column: number, value: string): Promise>; - } + /** + * by.id will match an id that is given to the view via testID prop. + * @param id + * @example // In a React Native component add testID like so: + * + * // Then match with by.id: + * await element(by.id('tap_me')); + */ + id(id: string): Matchers; + /** + * Find an element by text, useful for text fields, buttons. + * @param text + * @example await element(by.text('Tap Me')); + */ + text(text: string): Matchers; + /** + * Find an element by accessibilityLabel on iOS, or by contentDescription on Android. + * @param label + * @example await element(by.label('Welcome')); + */ + label(label: string): Matchers; + /** + * Find an element by native view type. + * @param nativeViewType + * @example await element(by.type('RCTImageView')); + */ + type(nativeViewType: string): Matchers; + /** + * Find an element with an accessibility trait. (iOS only) + * @example await element(by.traits(['button'])); + */ + traits(traits: string[]): Matchers; + /** + * Find an element by a matcher with a parent matcher + * @param parentBy + * @example await element(by.id('Grandson883').withAncestor(by.id('Son883'))); + */ + withAncestor(parentBy: Matchers): Matchers; + /** + * Find an element by a matcher with a child matcher + * @param childBy + * @example await element(by.id('Son883').withDescendant(by.id('Grandson883'))); + */ + withDescendant(childBy: Matchers): Matchers; + /** + * Find an element by multiple matchers + * @param by + * @example await element(by.text('Product').and(by.id('product_name')); + */ + and(by: Matchers): Matchers; + } + interface Expect { + (element: Element): Expect; + /** + * Expect the view to be at least 75% visible. + * @example await expect(element(by.id('UniqueId204'))).toBeVisible(); + */ + toBeVisible(): R; + /** + * Expect the view to not be visible. + * @example await expect(element(by.id('UniqueId205'))).toBeNotVisible(); + */ + toBeNotVisible(): R; + /** + * Expect the view to exist in the UI hierarchy. + * @example await expect(element(by.id('UniqueId205'))).toExist(); + */ + toExist(): R; + /** + * Expect the view to not exist in the UI hierarchy. + * @example await expect(element(by.id('RandomJunk959'))).toNotExist(); + */ + toNotExist(): R; + /** + * In React Native apps, expect UI component of type to have text. + * In native iOS apps, expect UI elements of type UIButton, UILabel, UITextField or UITextViewIn to have inputText with text. + * @param text + * @example await expect(element(by.id('UniqueId204'))).toHaveText('I contain some text'); + */ + toHaveText(text: string): R; + /** + * It searches by accessibilityLabel on iOS, or by contentDescription on Android. + * In React Native it can be set for both platforms by defining an accessibilityLabel on the view. + * @param label + * @example await expect(element(by.id('UniqueId204'))).toHaveLabel('Done'); + */ + toHaveLabel(label: string): R; + /** + * In React Native apps, expect UI component to have testID with that id. + * In native iOS apps, expect UI element to have accesibilityIdentifier with that id. + * @param id + * @example await expect(element(by.text('I contain some text'))).toHaveId('UniqueId204'); + */ + toHaveId(id: string): R; + /** + * Expect components like a Switch to have a value ('0' for off, '1' for on). + * @param value + * @example await expect(element(by.id('UniqueId533'))).toHaveValue('0'); + */ + toHaveValue(value: any): R; + } + interface WaitFor { + /** + * This API polls using the given expectation continuously until the expectation is met. Use manual synchronization with waitFor only as a last resort. + * NOTE: Every waitFor call must set a timeout using withTimeout(). Calling waitFor without setting a timeout will do nothing. + * @example await waitFor(element(by.id('UniqueId336'))).toExist().withTimeout(2000); + */ + (element: Element): Expect; + /** + * Waits for the condition to be met until the specified time (millis) have elapsed. + * @param millis number + * @example await waitFor(element(by.id('UniqueId336'))).toExist().withTimeout(2000); + */ + withTimeout(millis: number): Promise; + /** + * Performs the action repeatedly on the element until an expectation is met + * @param by + * @example await waitFor(element(by.text('Text5'))).toBeVisible().whileElement(by.id('ScrollView630')).scroll(50, 'down'); + */ + whileElement(by: Matchers): DetoxAny; + } + interface Actions { + /** + * Simulate tap on an element + * @example await element(by.id('tappable')).tap(); + */ + tap(): Promise>; + /** + * Simulate long press on an element + * @example await element(by.id('tappable')).longPress(); + */ + longPress(): Promise>; + /** + * Simulate multiple taps on an element. + * @param times number + * @example await element(by.id('tappable')).multiTap(3); + */ + multiTap(times: number): Promise>; + /** + * Simulate tap at a specific point on an element. + * Note: The point coordinates are relative to the matched element and the element size could changes on different devices or even when changing the device font size. + * @param point + * @example await element(by.id('tappable')).tapAtPoint({ x:5, y:10 }); + */ + tapAtPoint(point: { x: number; y: number }): Promise>; + /** + * Use the builtin keyboard to type text into a text field. + * @param text + * @example await element(by.id('textField')).typeText('passcode'); + */ + typeText(text: string): Promise>; + /** + * Paste text into a text field. + * @param text + * @example await element(by.id('textField')).replaceText('passcode again'); + */ + replaceText(text: string): Promise>; + /** + * Clear text from a text field. + * @example await element(by.id('textField')).clearText(); + */ + clearText(): Promise>; + /** + * + * @param pixels + * @param direction + * @example + * await element(by.id('scrollView')).scroll(100, 'down'); + * await element(by.id('scrollView')).scroll(100, 'up'); + */ + scroll(pixels: number, direction: Direction): Promise>; + /** + * Scroll to edge. + * @param edge + * @example await element(by.id('scrollView')).scrollTo('bottom'); + * await element(by.id('scrollView')).scrollTo('top'); + */ + scrollTo(edge: Direction): Promise>; + /** + * + * @param direction + * @param speed + * @param percentage + * @example await element(by.id('scrollView')).swipe('down'); + * await element(by.id('scrollView')).swipe('down', 'fast'); + * await element(by.id('scrollView')).swipe('down', 'fast', 0.5); + */ + swipe( + direction: Direction, + speed?: Speed, + percentage?: number + ): Promise>; + /** + * (iOS Only) column - number of datepicker column (starts from 0) value - string value in setted column (must be correct) + * @param column + * @param value + * @example await expect(element(by.type('UIPickerView'))).toBeVisible(); + * await element(by.type('UIPickerView')).setColumnToValue(1,"6"); + * await element(by.type('UIPickerView')).setColumnToValue(2,"34"); + */ + setColumnToValue( + column: number, + value: string + ): Promise>; + } - type Direction = "left" | "right" | "top" | "bottom" | "up" | "down"; - type Orientation = "portrait" | "landscape"; - type Speed = "fast" | "slow"; + type Direction = "left" | "right" | "top" | "bottom" | "up" | "down"; + type Orientation = "portrait" | "landscape"; + type Speed = "fast" | "slow"; - interface DetoxInitOptions { - /** - * Detox exports device, expect, element, by and waitFor as globals by default, if you want to control their initialization manually, set init detox with initGlobals set to false. - * This is useful when during E2E tests you also need to run regular expectations in node. jest Expect for instance, will not be overriden by Detox when this option is used. - */ - initGlobals?: boolean; - /** - * By default await detox.init(config); will launch the installed app. If you wish to control when your app is launched, add {launchApp: false} param to your init. - */ - launchApp?: boolean; - } + interface DetoxInitOptions { + /** + * Detox exports device, expect, element, by and waitFor as globals by default, if you want to control their initialization manually, set init detox with initGlobals set to false. + * This is useful when during E2E tests you also need to run regular expectations in node. jest Expect for instance, will not be overriden by Detox when this option is used. + */ + initGlobals?: boolean; + /** + * By default await detox.init(config); will launch the installed app. If you wish to control when your app is launched, add {launchApp: false} param to your init. + */ + launchApp?: boolean; + } - interface DeviceLanchAppConfig { - /** - * Restart the app - * Terminate the app and launch it again. If set to false, the simulator will try to bring app from background, if the app isn't running, it will launch a new instance. default is false - */ - newInstance?: boolean; - /** - * Set runtime permissions - * Grant or deny runtime permissions for your application. - */ - permissions?: any; - /** - * Launch from URL - * Mock opening the app from URL to test your app's deep link handling mechanism. - */ - url?: any; - /** - * Launch with user notifications - */ - userNotification?: any; - /** - * Launch with user activity - */ - userActivity?: any; - /** - * Launch into a fresh installation - * A flag that enables relaunching into a fresh installation of the app (it will uninstall and install the binary again), default is false. - */ - delete?: boolean; - /** - * Detox can start the app with additional launch arguments - * The added launchArgs will be passed through the launch command to the device and be accessible via [[NSProcessInfo processInfo] arguments] - */ - launchArgs?: any; + interface DeviceLanchAppConfig { + /** + * Restart the app + * Terminate the app and launch it again. If set to false, the simulator will try to bring app from background, if the app isn't running, it will launch a new instance. default is false + */ + newInstance?: boolean; + /** + * Set runtime permissions + * Grant or deny runtime permissions for your application. + */ + permissions?: any; + /** + * Launch from URL + * Mock opening the app from URL to test your app's deep link handling mechanism. + */ + url?: any; + /** + * Launch with user notifications + */ + userNotification?: any; + /** + * Launch with user activity + */ + userActivity?: any; + /** + * Launch into a fresh installation + * A flag that enables relaunching into a fresh installation of the app (it will uninstall and install the binary again), default is false. + */ + delete?: boolean; + /** + * Detox can start the app with additional launch arguments + * The added launchArgs will be passed through the launch command to the device and be accessible via [[NSProcessInfo processInfo] arguments] + */ + launchArgs?: any; + } } } + +export { by, detox, device, element, expect, waitFor }; From 700298f03a177fd488245bd0d0a77212085cb0d3 Mon Sep 17 00:00:00 2001 From: Jeff Held Date: Thu, 8 Nov 2018 17:11:01 -0600 Subject: [PATCH 005/241] detox: add jest adapter definitions --- types/detox/runners/jest/adapters/index.d.ts | 9 +++++++ types/detox/tests/detox-jest-setup-tests.ts | 28 ++++++++++++++++++++ types/detox/tsconfig.json | 4 ++- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 types/detox/runners/jest/adapters/index.d.ts create mode 100644 types/detox/tests/detox-jest-setup-tests.ts diff --git a/types/detox/runners/jest/adapters/index.d.ts b/types/detox/runners/jest/adapters/index.d.ts new file mode 100644 index 0000000000..ca195ae744 --- /dev/null +++ b/types/detox/runners/jest/adapters/index.d.ts @@ -0,0 +1,9 @@ +interface DetoxJestAdapter { + detox: Detox.Detox; + beforeEach: () => Promise; + afterAll: () => Promise; +} + +declare const adapter: DetoxJestAdapter; + +export default adapter; diff --git a/types/detox/tests/detox-jest-setup-tests.ts b/types/detox/tests/detox-jest-setup-tests.ts new file mode 100644 index 0000000000..002b5605bb --- /dev/null +++ b/types/detox/tests/detox-jest-setup-tests.ts @@ -0,0 +1,28 @@ +declare var beforeAll: (callback: () => void) => void; +declare var beforeEach: (callback: () => void) => void; +declare var afterAll: (callback: () => void) => void; + +import adapter from "detox/runners/jest/adapters"; + +// Normally the Detox configuration from the project's package.json like so: +// const config = require("./package.json").detox; +declare const config: any; + +beforeAll(async () => { + await detox.init(config); + + const initOptions: Detox.DetoxInitOptions = { + initGlobals: false, + launchApp: false, + }; + await detox.init(config, initOptions); +}); + +beforeEach(async () => { + await adapter.beforeEach(); +}); + +afterAll(async () => { + await adapter.afterAll(); + await detox.cleanup(); +}); diff --git a/types/detox/tsconfig.json b/types/detox/tsconfig.json index 3eb7524be2..9440443222 100644 --- a/types/detox/tsconfig.json +++ b/types/detox/tsconfig.json @@ -15,7 +15,9 @@ }, "files": [ "index.d.ts", + "runners/jest/adapters/index.d.ts", "tests/detox-globals-tests.ts", - "tests/detox-import-modules-tests.ts" + "tests/detox-import-modules-tests.ts", + "tests/detox-jest-setup-tests.ts" ] } From f627c9caf605e2c6bd920b79d87b17fd34a21c0b Mon Sep 17 00:00:00 2001 From: Jeff Held Date: Thu, 8 Nov 2018 17:11:13 -0600 Subject: [PATCH 006/241] detox: add mocha adapter definitions --- types/detox/runners/mocha/adapters/index.d.ts | 9 ++++++ .../detox-global-tests.ts} | 0 .../{tests => test}/detox-jest-setup-tests.ts | 0 types/detox/test/detox-mocha-setup-tests.ts | 32 +++++++++++++++++++ .../detox-module-tests.ts} | 0 types/detox/tsconfig.json | 8 +++-- 6 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 types/detox/runners/mocha/adapters/index.d.ts rename types/detox/{tests/detox-globals-tests.ts => test/detox-global-tests.ts} (100%) rename types/detox/{tests => test}/detox-jest-setup-tests.ts (100%) create mode 100644 types/detox/test/detox-mocha-setup-tests.ts rename types/detox/{tests/detox-import-modules-tests.ts => test/detox-module-tests.ts} (100%) diff --git a/types/detox/runners/mocha/adapters/index.d.ts b/types/detox/runners/mocha/adapters/index.d.ts new file mode 100644 index 0000000000..8e13b3bc01 --- /dev/null +++ b/types/detox/runners/mocha/adapters/index.d.ts @@ -0,0 +1,9 @@ +interface DetoxMochaAdapter { + detox: Detox.Detox; + beforeEach: (context: any) => Promise; + afterEach: (context: any) => Promise; +} + +declare const adapter: DetoxMochaAdapter; + +export default adapter; diff --git a/types/detox/tests/detox-globals-tests.ts b/types/detox/test/detox-global-tests.ts similarity index 100% rename from types/detox/tests/detox-globals-tests.ts rename to types/detox/test/detox-global-tests.ts diff --git a/types/detox/tests/detox-jest-setup-tests.ts b/types/detox/test/detox-jest-setup-tests.ts similarity index 100% rename from types/detox/tests/detox-jest-setup-tests.ts rename to types/detox/test/detox-jest-setup-tests.ts diff --git a/types/detox/test/detox-mocha-setup-tests.ts b/types/detox/test/detox-mocha-setup-tests.ts new file mode 100644 index 0000000000..3f502d1391 --- /dev/null +++ b/types/detox/test/detox-mocha-setup-tests.ts @@ -0,0 +1,32 @@ +// tslint:disable:only-arrow-functions + +declare var before: (callback: () => void) => void; +declare var beforeEach: (callback: () => void) => void; +declare var after: (callback: () => void) => void; +declare var afterEach: (callback: () => void) => void; + +import adapter from "detox/runners/mocha/adapters"; + +// Normally the Detox configuration from the project's package.json like so: +// const config = require("./package.json").detox; +declare const config: any; + +// Normally, the beforeEach and afterEach function should take `this` as its argument, +// but `this` cannot be used since it doesn't have a type signature (and therefore always implicltly any) +declare const context: any; + +before(async function() { + await detox.init(config); +}); + +beforeEach(async function() { + await adapter.beforeEach(context); +}); + +afterEach(async function() { + await adapter.afterEach(context); +}); + +after(async function() { + await detox.cleanup(); +}); diff --git a/types/detox/tests/detox-import-modules-tests.ts b/types/detox/test/detox-module-tests.ts similarity index 100% rename from types/detox/tests/detox-import-modules-tests.ts rename to types/detox/test/detox-module-tests.ts diff --git a/types/detox/tsconfig.json b/types/detox/tsconfig.json index 9440443222..7be4d3bb9e 100644 --- a/types/detox/tsconfig.json +++ b/types/detox/tsconfig.json @@ -16,8 +16,10 @@ "files": [ "index.d.ts", "runners/jest/adapters/index.d.ts", - "tests/detox-globals-tests.ts", - "tests/detox-import-modules-tests.ts", - "tests/detox-jest-setup-tests.ts" + "runners/mocha/adapters/index.d.ts", + "test/detox-global-tests.ts", + "test/detox-module-tests.ts", + "test/detox-jest-setup-tests.ts", + "test/detox-mocha-setup-tests.ts" ] } From f18851bea8e67645232633c8c88321add78a1822 Mon Sep 17 00:00:00 2001 From: Bryan Smith Date: Fri, 16 Nov 2018 10:35:29 -0800 Subject: [PATCH 007/241] Add onBeforeInput form events. --- types/react/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 332d3ac640..2a1c7baf7b 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -808,6 +808,8 @@ declare namespace React { // Form Events onChange?: FormEventHandler; onChangeCapture?: FormEventHandler; + onBeforeInput?: FormEventHandler; + onBeforeInputCapture?: FormEventHandler; onInput?: FormEventHandler; onInputCapture?: FormEventHandler; onReset?: FormEventHandler; From 7364d8937f28c0460ff0eefd3ee1a3e7bd6393e3 Mon Sep 17 00:00:00 2001 From: HokieGeek Date: Fri, 16 Nov 2018 15:30:20 -0500 Subject: [PATCH 008/241] @types/lunr: Updated Builder functions to add new optional arguments --- types/lunr/index.d.ts | 17 +++++++++++++---- types/lunr/lunr-tests.ts | 7 +++++++ 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/types/lunr/index.d.ts b/types/lunr/index.d.ts index da87ae95d8..415c7c1d8f 100644 --- a/types/lunr/index.d.ts +++ b/types/lunr/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for lunr.js 2.1 +// Type definitions for lunr.js 2.3 // Project: https://github.com/olivernn/lunr.js -// Definitions by: Sean Tan +// Definitions by: Sean Tan , Andrés Pérez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -127,9 +127,14 @@ declare namespace lunr { * All fields should be added before adding documents to the index. Adding fields after * a document has been indexed will have no effect on already indexed documents. * + * Fields can be boosted at build time. This allows terms within that field to have more + * importance when ranking search results. Use a field boost to specify that matches + * within one field are more important than other fields. + * * @param field - The name of a field to index in all documents. + * @param attributes - Optional attributes associated with this field. */ - field(field: string): void; + field(field: string, attributes?: object): void; /** * A parameter to tune the amount of field length normalisation that is applied when @@ -160,9 +165,13 @@ declare namespace lunr { * it should have all fields defined for indexing, though null or undefined values will not * cause errors. * + * Entire documents can be boosted at build time. Applying a boost to a document indicates that + * this document should rank higher in search results than other documents. + * * @param doc - The document to add to the index. + * @param attributes - Optional attributes associated with this document. */ - add(doc: object): void; + add(doc: object, attributes?: object): void; /** * Builds the index, creating an instance of lunr.Index. diff --git a/types/lunr/lunr-tests.ts b/types/lunr/lunr-tests.ts index ade45cae64..a14fd1947f 100644 --- a/types/lunr/lunr-tests.ts +++ b/types/lunr/lunr-tests.ts @@ -4,11 +4,18 @@ function basic_test() { const index = lunr(function() { this.field("title"); this.field("body"); + this.field("content", { + boost: 2, + extractor: (doc: object) => "oof" + }); this.ref("id"); this.add({ id: 1, title: "Foo", body: "Foo foo foo!" + }, + { + boost: 2 }); this.add({ id: 2, From a7e72529b207c1529dd2ad7707f154ac0e359b86 Mon Sep 17 00:00:00 2001 From: robbywashere Date: Fri, 16 Nov 2018 22:16:01 -0500 Subject: [PATCH 009/241] Update to types/recompose package withStateHandler to give stateUpdaters typed arguments rather than --- types/recompose/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/recompose/index.d.ts b/types/recompose/index.d.ts index 6f61888954..edb8ef9415 100644 --- a/types/recompose/index.d.ts +++ b/types/recompose/index.d.ts @@ -151,7 +151,7 @@ declare module 'recompose' { [updaterName: string]: StateHandler; }; type StateUpdaters = { - [updaterName in keyof TUpdaters]: (state: TState, props: TOutter) => StateHandler; + [updaterName in keyof TUpdaters]: (state: TState, props: TOutter) => TUpdaters[updaterName]; }; export function withStateHandlers, TOutter = {}>( createProps: TState | mapper, From 8e0be6712ba2c19b495ffc32b8ffb37ff8eb21f6 Mon Sep 17 00:00:00 2001 From: denis Date: Sat, 17 Nov 2018 11:05:38 +0100 Subject: [PATCH 010/241] Fix no-angle-bracket-type-assertion --- types/d3-brush/d3-brush-tests.ts | 2 +- types/d3-drag/d3-drag-tests.ts | 6 +++--- types/d3-selection/d3-selection-tests.ts | 2 +- types/d3-selection/tslint.json | 1 - types/d3-zoom/d3-zoom-tests.ts | 8 ++++---- types/d3-zoom/tslint.json | 1 - types/d3kit/d3kit-tests.ts | 4 ++-- 7 files changed, 11 insertions(+), 13 deletions(-) diff --git a/types/d3-brush/d3-brush-tests.ts b/types/d3-brush/d3-brush-tests.ts index dc2c9a0dc8..c5a287b562 100644 --- a/types/d3-brush/d3-brush-tests.ts +++ b/types/d3-brush/d3-brush-tests.ts @@ -48,7 +48,7 @@ brush = brush.extent(function(d, i, group) { // chainable brush = brush.filter(function(d, i, group) { // Cast d3 event to D3ZoomEvent to be used in filter logic - const e = > event; + const e = event as d3Brush.D3BrushEvent; console.log('Owner SVG Element of svg group: ', this.ownerSVGElement); // this is of type SVGGElement return e.sourceEvent.type !== 'zoom' || !d.filterZoomEvent; // datum type is BrushDatum (as propagated to SVGGElement with brush event attached) diff --git a/types/d3-drag/d3-drag-tests.ts b/types/d3-drag/d3-drag-tests.ts index cf5428e7e2..5e376c003b 100644 --- a/types/d3-drag/d3-drag-tests.ts +++ b/types/d3-drag/d3-drag-tests.ts @@ -134,7 +134,7 @@ touchableFn = circleDrag.touchable(); circleCustomDrag.subject(function(d, i, g) { // Cast event type for completeness, otherwise event is of type any. - const e = > event; + const e = event as d3Drag.D3DragEvent; const that: SVGCircleElement = this; const datum: CircleDatum = d; const index: number = i; @@ -163,14 +163,14 @@ subjectAccessor = circleCustomDrag.subject(); function dragstarted(this: SVGCircleElement, d: CircleDatum) { // cast d3 event to drag event. Otherwise, d3 event is currently defined as type 'any' - const e = > event; + const e = event as d3Drag.D3DragEvent; e.sourceEvent.stopPropagation(); select(this).classed('dragging', true); } function dragged(this: SVGCircleElement, d: CircleDatum) { // cast d3 event to drag event. Otherwise, d3 event is currently defined as type 'any' - const e = > event; + const e = event as d3Drag.D3DragEvent; select(this).attr('cx', d.x = e.x).attr('cy', d.y = e.y); } diff --git a/types/d3-selection/d3-selection-tests.ts b/types/d3-selection/d3-selection-tests.ts index bafc1aeb11..092e8bfa5a 100644 --- a/types/d3-selection/d3-selection-tests.ts +++ b/types/d3-selection/d3-selection-tests.ts @@ -1060,7 +1060,7 @@ interface SuccessEvent { const successEvent = { type: 'wonEuro2016', team: 'Island' }; function customListener(this: HTMLBodyElement | null, finalOpponent: string): string { - const e = d3Selection.event; + const e = d3Selection.event as SuccessEvent; return `${e.team} defeated ${finalOpponent} in the EURO 2016 Cup. Who would have thought!!!`; } diff --git a/types/d3-selection/tslint.json b/types/d3-selection/tslint.json index c89636b4b7..26ee29cf50 100644 --- a/types/d3-selection/tslint.json +++ b/types/d3-selection/tslint.json @@ -2,7 +2,6 @@ "extends": "dtslint/dt.json", "rules": { // TODO - "no-angle-bracket-type-assertion": false, "no-this-assignment": false, "unified-signatures": false, "no-unnecessary-generics": false diff --git a/types/d3-zoom/d3-zoom-tests.ts b/types/d3-zoom/d3-zoom-tests.ts index 19a16930d6..c758e83448 100644 --- a/types/d3-zoom/d3-zoom-tests.ts +++ b/types/d3-zoom/d3-zoom-tests.ts @@ -91,7 +91,7 @@ interface GroupDatum { function zoomedCanvas(this: HTMLCanvasElement, d: CanvasDatum) { // Cast d3 event to D3ZoomEvent to be used in zoom event handler - const e = > event; + const e = event as d3Zoom.D3ZoomEvent; if (context) { context.save(); context.clearRect(0, 0, this.width, this.height); // this element @@ -112,7 +112,7 @@ canvasZoom = d3Zoom.zoom() function zoomedSVGOverlay(this: SVGRectElement) { // Cast d3 event to D3ZoomEvent to be used in zoom event handler - const e = > event; + const e = event as d3Zoom.D3ZoomEvent; g.attr('transform', e.transform.toString()); } @@ -146,7 +146,7 @@ constraintFn = svgZoom.constrain(); // chainable svgZoom = svgZoom.filter(function(d, i, group) { // Cast d3 event to D3ZoomEvent to be used in filter logic - const e = > event; + const e = event as d3Zoom.D3ZoomEvent; console.log('Overlay Rectangle width: ', this.width.baseVal.value); // this typing is SVGRectElement return e.sourceEvent.type !== 'brush' || !d.filterBrushEvent; // datum type is SVGDatum (as propagated to SVGRectElement with zoom event attached) @@ -178,7 +178,7 @@ touchableFn = svgZoom.touchable(); // chainable svgZoom = svgZoom.wheelDelta(function(d, i, group) { // Cast d3 event to D3ZoomEvent to be used in filter logic - const e = event; + const e = event as WheelEvent; const that: SVGRectElement = this; const datum: SVGDatum = d; const index: number = i; diff --git a/types/d3-zoom/tslint.json b/types/d3-zoom/tslint.json index c89636b4b7..26ee29cf50 100644 --- a/types/d3-zoom/tslint.json +++ b/types/d3-zoom/tslint.json @@ -2,7 +2,6 @@ "extends": "dtslint/dt.json", "rules": { // TODO - "no-angle-bracket-type-assertion": false, "no-this-assignment": false, "unified-signatures": false, "no-unnecessary-generics": false diff --git a/types/d3kit/d3kit-tests.ts b/types/d3kit/d3kit-tests.ts index ec3b2de1ce..705b9fcc59 100644 --- a/types/d3kit/d3kit-tests.ts +++ b/types/d3kit/d3kit-tests.ts @@ -304,7 +304,7 @@ function test_svg_chart() { * Test plate functions */ plate = new d3kit.SvgPlate(); - plate = chart.addPlate('a-plate', plate, true); // with doNotAppend + plate = chart.addPlate('a-plate', plate, true) as d3kit.SvgPlate; // with doNotAppend chart = chart.addPlate('a-plate', plate); // without doNotAppend chart = chart.removePlate('a-plate'); @@ -381,7 +381,7 @@ function test_hybrid_chart() { * Test plate functions */ plate = new d3kit.SvgPlate(); - plate = chart.addPlate('a-plate', plate, true); // with doNotAppend + plate = chart.addPlate('a-plate', plate, true) as d3kit.SvgPlate; // with doNotAppend chart = chart.addPlate('a-plate', plate); // without doNotAppend chart = chart.removePlate('a-plate'); From ead05a22eb89d1a00082c4eb62e8f6393c58399c Mon Sep 17 00:00:00 2001 From: Esteban Ibarra Date: Mon, 19 Nov 2018 08:19:12 -0500 Subject: [PATCH 011/241] Fix children type for react-native-dialog (#1) * Fix children type for react-native-dialog --- types/react-native-dialog/index.d.ts | 4 +++- .../react-native-dialog-tests.tsx | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/types/react-native-dialog/index.d.ts b/types/react-native-dialog/index.d.ts index 10e977f420..14d7458140 100644 --- a/types/react-native-dialog/index.d.ts +++ b/types/react-native-dialog/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for react-native-dialog 4.0 // Project: https://github.com/mmazzarolo/react-native-dialog // Definitions by: MrLuje +// Stack Builders +// Esteban Ibarra // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -32,7 +34,7 @@ interface ButtonProps { interface ContainerProps { blurComponentIOS?: ReactNode; - children: JSX.Element[]; + children: React.ReactNode[]; /** * default: false */ diff --git a/types/react-native-dialog/react-native-dialog-tests.tsx b/types/react-native-dialog/react-native-dialog-tests.tsx index 151ee14af5..544025051c 100644 --- a/types/react-native-dialog/react-native-dialog-tests.tsx +++ b/types/react-native-dialog/react-native-dialog-tests.tsx @@ -2,6 +2,24 @@ import Dialog from "react-native-dialog"; import { createRef, Component } from "react"; class Example extends Component { + dynamicButtons() { + const buttonFunc = () => console.log('click'); + const buttons = [ + { label: 'Button 1', action: buttonFunc }, + { label: 'Button 2', action: buttonFunc }, + ]; + return buttons.map(({ label , action }) => + + ); + } + + singleButton() { + return ( null} />); + } + render() { const ref = createRef(); @@ -23,6 +41,8 @@ class Example extends Component { label="Validate" onPress={() => console.log("test")} /> + {this.dynamicButtons()} + {this.singleButton()} ); } From 845918b6a86a6190c23da22b4d8def7ac9adeffb Mon Sep 17 00:00:00 2001 From: Esteban Ibarra Date: Tue, 20 Nov 2018 12:15:15 -0500 Subject: [PATCH 012/241] Add types for react-native-draggable-flatlist --- .../index.d.ts | 59 +++++++++++++++++++ .../react-native-draggable-flatlist-tests.tsx | 44 ++++++++++++++ .../tsconfig.json | 24 ++++++++ .../tslint.json | 1 + 4 files changed, 128 insertions(+) create mode 100644 types/react-native-draggable-flatlist/index.d.ts create mode 100644 types/react-native-draggable-flatlist/react-native-draggable-flatlist-tests.tsx create mode 100644 types/react-native-draggable-flatlist/tsconfig.json create mode 100644 types/react-native-draggable-flatlist/tslint.json diff --git a/types/react-native-draggable-flatlist/index.d.ts b/types/react-native-draggable-flatlist/index.d.ts new file mode 100644 index 0000000000..0b96f0b3cd --- /dev/null +++ b/types/react-native-draggable-flatlist/index.d.ts @@ -0,0 +1,59 @@ +// Type definitions for react-native-draggable-flatlist 1.1 +// Project: https://github.com/computerjazz/react-native-draggable-flatlist#readme +// Definitions by: Stack Builders +// Esteban Ibarra +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { VirtualizedListWithoutRenderItemProps } from "react-native"; +import { Component } from "react"; + +export interface RenderItemInfo { + item: ItemR; + index: number; + move: () => void; + moveEnd: () => void; + isActive: boolean; +} + +export interface OnMoveEndInfo { + data: ReadonlyArray | null; + to: number; + from: number; + row: ItemM; +} + +interface DraggableFlatListProps extends VirtualizedListWithoutRenderItemProps { + /** + * Items to be rendered. + */ + data: ReadonlyArray | null; + + /** + * Function that returns updated ordering of data + */ + onMoveEnd?: (info: OnMoveEndInfo) => void; + + /** + * Function that is called when row becomes active. + */ + onMoveBegin?: (index: number) => void; + + /** + * Sets where scrolling begins. + * + * Default is 5 + */ + scrollPercent?: number; + + /** + * Function that calls move when the row should become active (in an onPress, onLongPress, etc). Calls moveEnd when the gesture is complete (in onPressOut). + */ + renderItem: (info: RenderItemInfo) => React.ReactElement | null; +} + +declare class DraggableFlatList extends Component> { + constructor(props: DraggableFlatListProps); +} + +export default DraggableFlatList; diff --git a/types/react-native-draggable-flatlist/react-native-draggable-flatlist-tests.tsx b/types/react-native-draggable-flatlist/react-native-draggable-flatlist-tests.tsx new file mode 100644 index 0000000000..40d613e4ea --- /dev/null +++ b/types/react-native-draggable-flatlist/react-native-draggable-flatlist-tests.tsx @@ -0,0 +1,44 @@ +import * as React from 'react'; +import { TouchableOpacity, Text } from 'react-native'; +import DraggableFlatList, { RenderItemInfo } from 'react-native-draggable-flatlist'; + +interface Item { + name: string; + mail: string; +} + +class Example extends React.Component { + state = { + data: [ + { name: 'Esteban', mail: 'foo@foo.com' }, + { name: 'Xavier', mail: 'foo2@foo.com' }, + ] + }; + + renderItem({ item, index, move, moveEnd, isActive }: RenderItemInfo) { + return ( + + {index} + {item.name} + {item.mail} + + ); + } + + render() { + const { data } = this.state; + return ( + `draggable-item-${index}`} + scrollPercent={10} + onMoveEnd={({ data }) => this.setState({ data })} + ListFooterComponent={{'Hello'}} + /> + ); + } +} diff --git a/types/react-native-draggable-flatlist/tsconfig.json b/types/react-native-draggable-flatlist/tsconfig.json new file mode 100644 index 0000000000..b3c009feac --- /dev/null +++ b/types/react-native-draggable-flatlist/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react-native" + }, + "files": [ + "index.d.ts", + "react-native-draggable-flatlist-tests.tsx" + ] +} diff --git a/types/react-native-draggable-flatlist/tslint.json b/types/react-native-draggable-flatlist/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-draggable-flatlist/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From ca53c065a52c288b7d8d3fb3bde5709c6d496f7c Mon Sep 17 00:00:00 2001 From: Esteban Ibarra Date: Tue, 20 Nov 2018 15:18:30 -0500 Subject: [PATCH 013/241] Revert changes of react-native-draggable-flatlist --- .../index.d.ts | 59 ------------------- .../react-native-draggable-flatlist-tests.tsx | 44 -------------- .../tsconfig.json | 24 -------- .../tslint.json | 1 - 4 files changed, 128 deletions(-) delete mode 100644 types/react-native-draggable-flatlist/index.d.ts delete mode 100644 types/react-native-draggable-flatlist/react-native-draggable-flatlist-tests.tsx delete mode 100644 types/react-native-draggable-flatlist/tsconfig.json delete mode 100644 types/react-native-draggable-flatlist/tslint.json diff --git a/types/react-native-draggable-flatlist/index.d.ts b/types/react-native-draggable-flatlist/index.d.ts deleted file mode 100644 index 0b96f0b3cd..0000000000 --- a/types/react-native-draggable-flatlist/index.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -// Type definitions for react-native-draggable-flatlist 1.1 -// Project: https://github.com/computerjazz/react-native-draggable-flatlist#readme -// Definitions by: Stack Builders -// Esteban Ibarra -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 - -import { VirtualizedListWithoutRenderItemProps } from "react-native"; -import { Component } from "react"; - -export interface RenderItemInfo { - item: ItemR; - index: number; - move: () => void; - moveEnd: () => void; - isActive: boolean; -} - -export interface OnMoveEndInfo { - data: ReadonlyArray | null; - to: number; - from: number; - row: ItemM; -} - -interface DraggableFlatListProps extends VirtualizedListWithoutRenderItemProps { - /** - * Items to be rendered. - */ - data: ReadonlyArray | null; - - /** - * Function that returns updated ordering of data - */ - onMoveEnd?: (info: OnMoveEndInfo) => void; - - /** - * Function that is called when row becomes active. - */ - onMoveBegin?: (index: number) => void; - - /** - * Sets where scrolling begins. - * - * Default is 5 - */ - scrollPercent?: number; - - /** - * Function that calls move when the row should become active (in an onPress, onLongPress, etc). Calls moveEnd when the gesture is complete (in onPressOut). - */ - renderItem: (info: RenderItemInfo) => React.ReactElement | null; -} - -declare class DraggableFlatList extends Component> { - constructor(props: DraggableFlatListProps); -} - -export default DraggableFlatList; diff --git a/types/react-native-draggable-flatlist/react-native-draggable-flatlist-tests.tsx b/types/react-native-draggable-flatlist/react-native-draggable-flatlist-tests.tsx deleted file mode 100644 index 40d613e4ea..0000000000 --- a/types/react-native-draggable-flatlist/react-native-draggable-flatlist-tests.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import * as React from 'react'; -import { TouchableOpacity, Text } from 'react-native'; -import DraggableFlatList, { RenderItemInfo } from 'react-native-draggable-flatlist'; - -interface Item { - name: string; - mail: string; -} - -class Example extends React.Component { - state = { - data: [ - { name: 'Esteban', mail: 'foo@foo.com' }, - { name: 'Xavier', mail: 'foo2@foo.com' }, - ] - }; - - renderItem({ item, index, move, moveEnd, isActive }: RenderItemInfo) { - return ( - - {index} - {item.name} - {item.mail} - - ); - } - - render() { - const { data } = this.state; - return ( - `draggable-item-${index}`} - scrollPercent={10} - onMoveEnd={({ data }) => this.setState({ data })} - ListFooterComponent={{'Hello'}} - /> - ); - } -} diff --git a/types/react-native-draggable-flatlist/tsconfig.json b/types/react-native-draggable-flatlist/tsconfig.json deleted file mode 100644 index b3c009feac..0000000000 --- a/types/react-native-draggable-flatlist/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, - "jsx": "react-native" - }, - "files": [ - "index.d.ts", - "react-native-draggable-flatlist-tests.tsx" - ] -} diff --git a/types/react-native-draggable-flatlist/tslint.json b/types/react-native-draggable-flatlist/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/react-native-draggable-flatlist/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From 4d312320c106bc1a3af3fb1cf88bd0fd11ad3757 Mon Sep 17 00:00:00 2001 From: danford Date: Thu, 22 Nov 2018 11:13:10 +1100 Subject: [PATCH 014/241] react-css-collapse --- types/react-css-collapse/index.d.ts | 18 +++++ .../react-css-collapse-tests.tsx | 14 ++++ types/react-css-collapse/tsconfig.json | 25 ++++++ types/react-css-collapse/tslint.json | 79 +++++++++++++++++++ 4 files changed, 136 insertions(+) create mode 100644 types/react-css-collapse/index.d.ts create mode 100644 types/react-css-collapse/react-css-collapse-tests.tsx create mode 100644 types/react-css-collapse/tsconfig.json create mode 100644 types/react-css-collapse/tslint.json diff --git a/types/react-css-collapse/index.d.ts b/types/react-css-collapse/index.d.ts new file mode 100644 index 0000000000..aa17200367 --- /dev/null +++ b/types/react-css-collapse/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for react-css-collapse 3.6.0 +// Project: https://github.com/SparebankenVest/react-css-collapse; +// Definitions by: Daniel Ford +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +declare module 'react-css-collapse' { + interface Props { + isOpen: boolean; + className?: string | null; + onRest?: () => void; + transition?: string | null; + } + class Collapse extends React.Component { + public render(): React.ReactElement; + } + export default Collapse; +} diff --git a/types/react-css-collapse/react-css-collapse-tests.tsx b/types/react-css-collapse/react-css-collapse-tests.tsx new file mode 100644 index 0000000000..3b699b530d --- /dev/null +++ b/types/react-css-collapse/react-css-collapse-tests.tsx @@ -0,0 +1,14 @@ +import * as React from "react"; +import { SFC } from "react"; +import { render } from "react-dom"; +import Collapse from "react-css-collapse"; + +const TestOpen: SFC = () => ( + +
+ i am open +
+
+); + +render(, document.getElementById("main")); diff --git a/types/react-css-collapse/tsconfig.json b/types/react-css-collapse/tsconfig.json new file mode 100644 index 0000000000..4af49b9769 --- /dev/null +++ b/types/react-css-collapse/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-css-collapse-tests.tsx" + ] +} diff --git a/types/react-css-collapse/tslint.json b/types/react-css-collapse/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/react-css-collapse/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 6922a35f4b9905b7a75a94859ffab134565a6378 Mon Sep 17 00:00:00 2001 From: Jussi Kinnula Date: Thu, 22 Nov 2018 10:25:50 +0200 Subject: [PATCH 015/241] Change gl-react subpackages callback props & gl-react Node "uniforms" prop optional & add tests for subpackages --- types/gl-react-dom/GLViewDOM.d.ts | 8 +++--- types/gl-react-dom/gl-react-dom-tests.tsx | 27 +++++++++++++++++++ types/gl-react-dom/tsconfig.json | 3 ++- types/gl-react-expo/GLViewNative.d.ts | 2 +- types/gl-react-expo/gl-react-expo-tests.tsx | 27 +++++++++++++++++++ types/gl-react-expo/tsconfig.json | 3 ++- types/gl-react-headless/GLViewHeadless.d.ts | 8 +++--- .../gl-react-headless-tests.tsx | 27 +++++++++++++++++++ types/gl-react-headless/tsconfig.json | 3 ++- types/gl-react-native/GLViewNative.d.ts | 4 +-- .../gl-react-native/gl-react-native-tests.tsx | 27 +++++++++++++++++++ types/gl-react-native/tsconfig.json | 3 ++- types/gl-react/index.d.ts | 2 +- 13 files changed, 128 insertions(+), 16 deletions(-) create mode 100644 types/gl-react-dom/gl-react-dom-tests.tsx create mode 100644 types/gl-react-expo/gl-react-expo-tests.tsx create mode 100644 types/gl-react-headless/gl-react-headless-tests.tsx create mode 100644 types/gl-react-native/gl-react-native-tests.tsx diff --git a/types/gl-react-dom/GLViewDOM.d.ts b/types/gl-react-dom/GLViewDOM.d.ts index 8450a16a00..5ceef51ec8 100644 --- a/types/gl-react-dom/GLViewDOM.d.ts +++ b/types/gl-react-dom/GLViewDOM.d.ts @@ -4,10 +4,10 @@ export type SupportedImage = 'image/png' | 'image/jpeg' | 'image/bmp' | 'image/w export type ValidQuality = 0.0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1.0; export interface GLViewDOMProps { - onContextCreate: (gl: WebGLRenderingContext) => void; - onContextFailure: (e: Error) => void; - onContextLost: () => void; - onContextRestored: (gl: WebGLRenderingContext) => void; + onContextCreate?: (gl: WebGLRenderingContext) => void; + onContextFailure?: (e: Error) => void; + onContextLost?: () => void; + onContextRestored?: (gl: WebGLRenderingContext) => void; webglContextAttributes?: WebGLContextAttributes; pixelRatio?: number; width: number; diff --git a/types/gl-react-dom/gl-react-dom-tests.tsx b/types/gl-react-dom/gl-react-dom-tests.tsx new file mode 100644 index 0000000000..6d3852a156 --- /dev/null +++ b/types/gl-react-dom/gl-react-dom-tests.tsx @@ -0,0 +1,27 @@ +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import { Surface } from 'gl-react-dom'; +import { Shaders, GLSL, Node } from 'gl-react'; + +const shaders = Shaders.create({ + Test: { + frag: GLSL` + precision highp float; + varying vec2 uv; + void main() { + gl_FragColor = vec4(uv.x, uv.y, 0.5, 1.0); + }` + } +}); + +const App = () => ( +
+ + + +
+); + +const element = document.createElement('div'); +document.body.appendChild(element); +ReactDOM.render(, element); diff --git a/types/gl-react-dom/tsconfig.json b/types/gl-react-dom/tsconfig.json index 9c4d38ca44..49a1ee91ff 100644 --- a/types/gl-react-dom/tsconfig.json +++ b/types/gl-react-dom/tsconfig.json @@ -1,6 +1,7 @@ { "files": [ - "index.d.ts" + "index.d.ts", + "gl-react-dom-tests.tsx" ], "compilerOptions": { "module": "commonjs", diff --git a/types/gl-react-expo/GLViewNative.d.ts b/types/gl-react-expo/GLViewNative.d.ts index 4f0270dd68..5320ccaaa2 100644 --- a/types/gl-react-expo/GLViewNative.d.ts +++ b/types/gl-react-expo/GLViewNative.d.ts @@ -3,7 +3,7 @@ import * as React from 'react'; // import { GLView as EXGLView } from 'expo'; export interface GLViewNativeProps { - onContextCreate: (gl: WebGLRenderingContext) => void; + onContextCreate?: (gl: WebGLRenderingContext) => void; style?: any; children?: any; } diff --git a/types/gl-react-expo/gl-react-expo-tests.tsx b/types/gl-react-expo/gl-react-expo-tests.tsx new file mode 100644 index 0000000000..2eb1fee9a9 --- /dev/null +++ b/types/gl-react-expo/gl-react-expo-tests.tsx @@ -0,0 +1,27 @@ +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import { Surface } from 'gl-react-expo'; +import { Shaders, GLSL, Node } from 'gl-react'; + +const shaders = Shaders.create({ + Test: { + frag: GLSL` + precision highp float; + varying vec2 uv; + void main() { + gl_FragColor = vec4(uv.x, uv.y, 0.5, 1.0); + }` + } +}); + +const App = () => ( +
+ + + +
+); + +const element = document.createElement('div'); +document.body.appendChild(element); +ReactDOM.render(, element); diff --git a/types/gl-react-expo/tsconfig.json b/types/gl-react-expo/tsconfig.json index 9c4d38ca44..95487128f4 100644 --- a/types/gl-react-expo/tsconfig.json +++ b/types/gl-react-expo/tsconfig.json @@ -1,6 +1,7 @@ { "files": [ - "index.d.ts" + "index.d.ts", + "gl-react-expo-tests.tsx" ], "compilerOptions": { "module": "commonjs", diff --git a/types/gl-react-headless/GLViewHeadless.d.ts b/types/gl-react-headless/GLViewHeadless.d.ts index a94c1f9769..9b90b25958 100644 --- a/types/gl-react-headless/GLViewHeadless.d.ts +++ b/types/gl-react-headless/GLViewHeadless.d.ts @@ -1,10 +1,10 @@ import * as React from 'react'; export interface GLViewHeadlessProps { - onContextCreate: (gl: WebGLRenderingContext) => void; - onContextFailure: (e: Error) => void; - onContextLost: () => void; - onContextRestored: (gl: WebGLRenderingContext) => void; + onContextCreate?: (gl: WebGLRenderingContext) => void; + onContextFailure?: (e: Error) => void; + onContextLost?: () => void; + onContextRestored?: (gl: WebGLRenderingContext) => void; webglContextAttributes?: WebGLContextAttributes; pixelRatio?: number; width: number; diff --git a/types/gl-react-headless/gl-react-headless-tests.tsx b/types/gl-react-headless/gl-react-headless-tests.tsx new file mode 100644 index 0000000000..58f0cbc13b --- /dev/null +++ b/types/gl-react-headless/gl-react-headless-tests.tsx @@ -0,0 +1,27 @@ +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import { Surface } from 'gl-react-headless'; +import { Shaders, GLSL, Node } from 'gl-react'; + +const shaders = Shaders.create({ + Test: { + frag: GLSL` + precision highp float; + varying vec2 uv; + void main() { + gl_FragColor = vec4(uv.x, uv.y, 0.5, 1.0); + }` + } +}); + +const App = () => ( +
+ + + +
+); + +const element = document.createElement('div'); +document.body.appendChild(element); +ReactDOM.render(, element); diff --git a/types/gl-react-headless/tsconfig.json b/types/gl-react-headless/tsconfig.json index 9c4d38ca44..8a7f2a4b22 100644 --- a/types/gl-react-headless/tsconfig.json +++ b/types/gl-react-headless/tsconfig.json @@ -1,6 +1,7 @@ { "files": [ - "index.d.ts" + "index.d.ts", + "gl-react-headless-tests.tsx" ], "compilerOptions": { "module": "commonjs", diff --git a/types/gl-react-native/GLViewNative.d.ts b/types/gl-react-native/GLViewNative.d.ts index 0a780d3aa7..b4a4c75bc1 100644 --- a/types/gl-react-native/GLViewNative.d.ts +++ b/types/gl-react-native/GLViewNative.d.ts @@ -1,8 +1,8 @@ import * as React from 'react'; export interface GLViewNativeProps { - onContextCreate: (gl: WebGLRenderingContext) => void; - onContextFailure: (e: Error) => void; + onContextCreate?: (gl: WebGLRenderingContext) => void; + onContextFailure?: (e: Error) => void; style?: any; children?: any; } diff --git a/types/gl-react-native/gl-react-native-tests.tsx b/types/gl-react-native/gl-react-native-tests.tsx new file mode 100644 index 0000000000..f74c9dc926 --- /dev/null +++ b/types/gl-react-native/gl-react-native-tests.tsx @@ -0,0 +1,27 @@ +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import { Surface } from 'gl-react-native'; +import { Shaders, GLSL, Node } from 'gl-react'; + +const shaders = Shaders.create({ + Test: { + frag: GLSL` + precision highp float; + varying vec2 uv; + void main() { + gl_FragColor = vec4(uv.x, uv.y, 0.5, 1.0); + }` + } +}); + +const App = () => ( +
+ + + +
+); + +const element = document.createElement('div'); +document.body.appendChild(element); +ReactDOM.render(, element); diff --git a/types/gl-react-native/tsconfig.json b/types/gl-react-native/tsconfig.json index 9c4d38ca44..0ffab2bab3 100644 --- a/types/gl-react-native/tsconfig.json +++ b/types/gl-react-native/tsconfig.json @@ -1,6 +1,7 @@ { "files": [ - "index.d.ts" + "index.d.ts", + "gl-react-native-tests.tsx" ], "compilerOptions": { "module": "commonjs", diff --git a/types/gl-react/index.d.ts b/types/gl-react/index.d.ts index e1332fd964..84b82ddd2d 100644 --- a/types/gl-react/index.d.ts +++ b/types/gl-react/index.d.ts @@ -124,7 +124,7 @@ export interface Framebuffer { export interface NodeProps { shader: ShaderIdentifier | ShaderDefinition; uniformsOptions?: any; - uniforms: { [key: string]: any }; + uniforms?: { [key: string]: any }; ignoreUnusedUniforms?: string[] | boolean; sync?: boolean; width?: number; From 5d4421790f435864c13dde0750333c6818de7db4 Mon Sep 17 00:00:00 2001 From: Alex Deas Date: Thu, 22 Nov 2018 16:30:31 +0000 Subject: [PATCH 016/241] Allow type parameters for cond --- types/ramda/index.d.ts | 2 +- types/ramda/ramda-tests.ts | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index a3bc51c8ca..77dcdb05a0 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -776,7 +776,7 @@ declare namespace R { * point fn returns the result of applying its arguments to the corresponding transformer. If none of the predicates * matches, fn returns undefined. */ - cond(fns: ReadonlyArray<[Pred, (...a: any[]) => any]>): (...a: any[]) => any; + cond(fns: ReadonlyArray<[SafePred, (a: A) => B]>): (a: A) => B; /** * Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 2f68808d17..61f09c1f40 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1306,14 +1306,19 @@ type Pair = KeyValuePair; }; () => { - const fn = R.cond([ - [R.equals(0), R.always("water freezes at 0°C")], - [R.equals(100), R.always("water boils at 100°C")], - [R.T, (temp: number) => `nothing special happens at ${temp}°C`] + const f = R.cond([ + [x => x === 0, () => "a"], + [() => true, () => "b"], ]); - const a: string = fn(0); // => 'water freezes at 0°C' - const b: string = fn(50); // => 'nothing special happens at 50°C' - const c: string = fn(100); // => 'water boils at 100°C' + f(0); // $ExpectType string + f(""); // $ExpectError + + const g = R.cond([ + [x => x === 0, () => "a"], + [() => true, () => "b"], + ]); + g(0); + g(""); }; () => { From 756349c67c53c76888b575abe1c7e545378b72fe Mon Sep 17 00:00:00 2001 From: Boris Sergeyev Date: Thu, 22 Nov 2018 21:43:51 +0100 Subject: [PATCH 017/241] [react-redux] fixed mistreating of action thunk creator parameters --- types/react-redux/index.d.ts | 11 +++++++--- types/react-redux/react-redux-tests.tsx | 27 ++++++++++++++++--------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 2f919581f4..1cccae6d01 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -13,7 +13,7 @@ // Anatoli Papirovski // Boris Sergeyev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 // Known Issue: // There is a known issue in TypeScript, which doesn't allow decorators to change the signature of the classes @@ -112,9 +112,14 @@ export type InferableComponentEnhancerWithProps = export type InferableComponentEnhancer = InferableComponentEnhancerWithProps; +export type WrappedThunkActionCreator any> = + TActionCreator extends (...args: infer TParams) => (...args: any[]) => infer TReturn + ? (...args: TParams) => TReturn + : TActionCreator; + export type HandleThunkActionCreator = - TActionCreator extends (...args: any[]) => (...args: any[]) => any - ? ReturnType + TActionCreator extends (...args: any[]) => any + ? WrappedThunkActionCreator : TActionCreator; // redux-thunk middleware returns thunk's return value from dispatch call diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index aff8515e87..f47683047e 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -102,20 +102,27 @@ function MapDispatch() { } function MapDispatchWithThunkActionCreators() { - class TestComponent extends React.Component<{ - foo: string, - onClick(): void, - thunkAction(): Promise - }> {} - - const mapDispatchToProps = () => ({ - onClick: () => {}, - thunkAction: () => async () => {} + const simpleAction = (payload: boolean) => ({ + type: 'SIMPLE_ACTION', + payload, }); + const thunkAction = (param1: number, param2: string) => ( + async (dispatch: Dispatch, { foo }: OwnProps) => { + return foo; + } + ); + interface OwnProps { + foo: string; + } + interface TestComponentProps extends OwnProps { + simpleAction: typeof simpleAction; + thunkAction(param1: number, param2: string): Promise; + } + class TestComponent extends React.Component {} const Test = connect( null, - mapDispatchToProps, + ({ simpleAction, thunkAction }), )(TestComponent); const verify = ; From 35d989dce077cdd42be9943a53895eeebf569fb8 Mon Sep 17 00:00:00 2001 From: Boris Sergeyev Date: Thu, 22 Nov 2018 22:16:23 +0100 Subject: [PATCH 018/241] [react-redux] bumped TS versions of packages dependent on react-redux --- types/mirrorx/index.d.ts | 2 +- types/next-redux-saga/index.d.ts | 2 +- types/next-redux-wrapper/index.d.ts | 2 +- types/react-intl-redux/index.d.ts | 2 +- types/react-lifecycle-component/index.d.ts | 2 +- types/react-redux-toastr/index.d.ts | 2 +- types/react-router-redux/index.d.ts | 2 +- types/redux-auth-wrapper/index.d.ts | 2 +- types/redux-devtools/index.d.ts | 2 +- types/redux-form/index.d.ts | 2 +- types/redux-form/v6/index.d.ts | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/types/mirrorx/index.d.ts b/types/mirrorx/index.d.ts index 443712c325..e2fa0ee465 100644 --- a/types/mirrorx/index.d.ts +++ b/types/mirrorx/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mirrorjs/mirror // Definitions by: Aaronphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 import * as H from 'history'; diff --git a/types/next-redux-saga/index.d.ts b/types/next-redux-saga/index.d.ts index b7575fba16..0366868d97 100644 --- a/types/next-redux-saga/index.d.ts +++ b/types/next-redux-saga/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/bmealhouse/next-redux-saga // Definitions by: Leo Cavalcante // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 import { ComponentType } from "react"; diff --git a/types/next-redux-wrapper/index.d.ts b/types/next-redux-wrapper/index.d.ts index 16af858743..cbf56579d5 100644 --- a/types/next-redux-wrapper/index.d.ts +++ b/types/next-redux-wrapper/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Steve // Jungwoo-An // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 /// diff --git a/types/react-intl-redux/index.d.ts b/types/react-intl-redux/index.d.ts index 9d9e805df9..4410e7c019 100644 --- a/types/react-intl-redux/index.d.ts +++ b/types/react-intl-redux/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ratson/react-intl-redux // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 import { Action, AnyAction } from "redux" import { Provider as ReduxProvider } from "react-redux" diff --git a/types/react-lifecycle-component/index.d.ts b/types/react-lifecycle-component/index.d.ts index 315d04f7fb..bb6dc65dd8 100644 --- a/types/react-lifecycle-component/index.d.ts +++ b/types/react-lifecycle-component/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/JamieDixon/react-lifecycle-component // Definitions by: Alexander Fisher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 import { ComponentLifecycle, Component, ComponentClass } from 'react'; import { Connect } from 'react-redux'; diff --git a/types/react-redux-toastr/index.d.ts b/types/react-redux-toastr/index.d.ts index fc11da9c43..9a7a115725 100644 --- a/types/react-redux-toastr/index.d.ts +++ b/types/react-redux-toastr/index.d.ts @@ -4,7 +4,7 @@ // Artyom Stukans // Mika Kuitunen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 import { Component } from 'react'; import { Action, Reducer } from 'redux'; diff --git a/types/react-router-redux/index.d.ts b/types/react-router-redux/index.d.ts index 9dfbd58c11..7abdc88505 100644 --- a/types/react-router-redux/index.d.ts +++ b/types/react-router-redux/index.d.ts @@ -4,7 +4,7 @@ // Shoya Tanaka // Mykolas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 import { Store, diff --git a/types/redux-auth-wrapper/index.d.ts b/types/redux-auth-wrapper/index.d.ts index 728be4a54b..3ec88b50dc 100644 --- a/types/redux-auth-wrapper/index.d.ts +++ b/types/redux-auth-wrapper/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mjrussell/redux-auth-wrapper // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 import { ComponentClass, StatelessComponent, ComponentType, ReactType } from "react"; diff --git a/types/redux-devtools/index.d.ts b/types/redux-devtools/index.d.ts index 234fb9a4bb..ddead025ff 100644 --- a/types/redux-devtools/index.d.ts +++ b/types/redux-devtools/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gaearon/redux-devtools // Definitions by: Petryshyn Sergii // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 import * as React from 'react'; import { GenericStoreEnhancer } from 'redux'; diff --git a/types/redux-form/index.d.ts b/types/redux-form/index.d.ts index e80c196c0a..5851728369 100644 --- a/types/redux-form/index.d.ts +++ b/types/redux-form/index.d.ts @@ -12,7 +12,7 @@ // Maddi Joyce // Kamil Wojcik // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.9 +// TypeScript Version: 3.0 import { ComponentClass, StatelessComponent, diff --git a/types/redux-form/v6/index.d.ts b/types/redux-form/v6/index.d.ts index a8209a7643..5127457884 100644 --- a/types/redux-form/v6/index.d.ts +++ b/types/redux-form/v6/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/erikras/redux-form // Definitions by: Carson Full , Daniel Lytkin , Karol Janyst , Luka Zakrajsek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.0 import { ComponentClass, From 2d5a8af9f819fad592387f8b4ce3731643125b05 Mon Sep 17 00:00:00 2001 From: Boris Sergeyev Date: Thu, 22 Nov 2018 22:18:01 +0100 Subject: [PATCH 019/241] [react-redux] used whitespace consistently (no tabs) --- types/react-redux/index.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 1cccae6d01..bf65d89fd5 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -65,11 +65,11 @@ export type AdvancedComponentDecorator = * DecorationTargetProps[P] definition, its definition will be that of InjectedProps[P] */ export type Matching = { - [P in keyof DecorationTargetProps]: P extends keyof InjectedProps - ? InjectedProps[P] extends DecorationTargetProps[P] - ? DecorationTargetProps[P] - : InjectedProps[P] - : DecorationTargetProps[P]; + [P in keyof DecorationTargetProps]: P extends keyof InjectedProps + ? InjectedProps[P] extends DecorationTargetProps[P] + ? DecorationTargetProps[P] + : InjectedProps[P] + : DecorationTargetProps[P]; }; /** @@ -95,16 +95,16 @@ export type GetProps = C extends ComponentType ? P : never; // Applies LibraryManagedAttributes (proper handling of defaultProps // and propTypes), as well as defines WrappedComponent. export type ConnectedComponentClass = ComponentClass> & { - WrappedComponent: C; + WrappedComponent: C; }; // Injects props and removes them from the prop requirements. // Will not pass through the injected props if they are passed in during // render. Also adds new prop requirements from TNeedsProps. export type InferableComponentEnhancerWithProps = - >>>( - component: C - ) => ConnectedComponentClass, keyof Shared>> & TNeedsProps>; + >>>( + component: C + ) => ConnectedComponentClass, keyof Shared>> & TNeedsProps>; // Injects props and removes them from the prop requirements. // Will not pass through the injected props if they are passed in during From c0df17945ec4488f75c6eb4cc121926601e901fc Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Sat, 24 Nov 2018 02:11:50 +0100 Subject: [PATCH 020/241] Added ldap-filters@2.2 --- types/ldap-filters/index.d.ts | 60 ++++++++++++++++++++++++ types/ldap-filters/ldap-filters-tests.ts | 28 +++++++++++ types/ldap-filters/tsconfig.json | 16 +++++++ types/ldap-filters/tslint.json | 1 + 4 files changed, 105 insertions(+) create mode 100644 types/ldap-filters/index.d.ts create mode 100644 types/ldap-filters/ldap-filters-tests.ts create mode 100644 types/ldap-filters/tsconfig.json create mode 100644 types/ldap-filters/tslint.json diff --git a/types/ldap-filters/index.d.ts b/types/ldap-filters/index.d.ts new file mode 100644 index 0000000000..46e1c24fa8 --- /dev/null +++ b/types/ldap-filters/index.d.ts @@ -0,0 +1,60 @@ +// Type definitions for ldap-filters 2.2 +// Project: https://github.com/tapmodo/node-ldap-filters +// Definitions by: Alan Plum +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +interface Filter { + toString(indent?: boolean | number): string; + simplify(): Filter; + match(data: object): boolean; +} + +declare namespace Filter { + let escape_chars: string[]; + let indent: number; + let indent_char: string; + let collapse_not: boolean; + + function escape(value: string): string; + function unescape(value: string): string; + function parse(input: string): Filter; + function matchString(data: string | string[], filter: Filter): boolean; + function matchSubstring(data: string | string[], filter: Filter): boolean; + function matchApprox(data: string | string[], filter: Filter): boolean; + function matchGTE(data: string | string[], filter: Filter): boolean; + function matchLTE(data: string | string[], filter: Filter): boolean; + function attribute(name: string): Attribute; + function AND(filters: Filter[]): Group; + function OR(filters: Filter[]): Group; + function NOT(filter: Filter): GroupNot; + + interface Group { + type: string; + comp: string; + filters: Filter[]; + toString(indent?: boolean | number): string; + match(data: object): boolean; + } + + interface GroupNot extends Group { + simplify(): Filter; + } + + interface Attribute { + name: string; + escapeChars: string[]; + escape(value: string): string; + present(): Filter; + raw(value: string): Filter; + equalTo(value: string): Filter; + endsWith(value: string): Filter; + startsWith(value: string): Filter; + contains(value: string): Filter; + approx(value: string): Filter; + lte(value: string): Filter; + gte(value: string): Filter; + } +} + +export = Filter; diff --git a/types/ldap-filters/ldap-filters-tests.ts b/types/ldap-filters/ldap-filters-tests.ts new file mode 100644 index 0000000000..5111af785e --- /dev/null +++ b/types/ldap-filters/ldap-filters-tests.ts @@ -0,0 +1,28 @@ +/// + +import Filter = require("ldap-filters"); + +Filter.collapse_not = false; + +const output = Filter.AND([ + Filter.attribute("givenName").equalTo("jenny"), + Filter.attribute("sn").equalTo("jensen") +]); + +console.log(output.toString()); + +Filter.parse("(&(givenName=jenny)(sn=jensen))"); + +Filter.parse("(&(uid=jenny))").simplify(); + +const filter = Filter.parse( + "(&(givenName=jenny)(sn=jensen)(|(c=us)(st=ontario)))" +); + +filter.toString(); +filter.toString(true); +filter.toString(2); + +const parsed = Filter.parse("(&(givenName~=jeni)(sn=jensen))"); +const data = { givenName: "Jenny", sn: "Jensen" }; +console.log(parsed.match(data)); diff --git a/types/ldap-filters/tsconfig.json b/types/ldap-filters/tsconfig.json new file mode 100644 index 0000000000..9d4f5aa560 --- /dev/null +++ b/types/ldap-filters/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "ldap-filters-tests.ts"] +} diff --git a/types/ldap-filters/tslint.json b/types/ldap-filters/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ldap-filters/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From da0630fa320071bbd5713ea86c11de6a50725b43 Mon Sep 17 00:00:00 2001 From: Hiroshi Ioka Date: Sat, 24 Nov 2018 13:51:49 +0900 Subject: [PATCH 021/241] @types/mockingoose: add new package --- types/mockingoose/index.d.ts | 40 ++++++++++++++++++++++++++ types/mockingoose/mockingoose-tests.ts | 9 ++++++ types/mockingoose/tsconfig.json | 23 +++++++++++++++ types/mockingoose/tslint.json | 1 + 4 files changed, 73 insertions(+) create mode 100644 types/mockingoose/index.d.ts create mode 100644 types/mockingoose/mockingoose-tests.ts create mode 100644 types/mockingoose/tsconfig.json create mode 100644 types/mockingoose/tslint.json diff --git a/types/mockingoose/index.d.ts b/types/mockingoose/index.d.ts new file mode 100644 index 0000000000..a1597bd4e5 --- /dev/null +++ b/types/mockingoose/index.d.ts @@ -0,0 +1,40 @@ +// Type definitions for mockingoose 2.11 +// Project: https://github.com/alonronin/mockingoose#readme +// Definitions by: Hiroshi Ioka +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +type Op = + | 'find' + | 'findOne' + | 'count' + | 'countDocuments' + | 'estimatedDocumentCount' + | 'distinct' + | 'findOneAndUpdate' + | 'findOneAndRemove' + | 'remove' + | 'update' + | 'deleteOne' + | 'deleteMany' + | 'save'; + +declare class Mock { + toReturn(expected: any, op?: Op): this; + reset(op: Op): this; + toJSON(): any; +} + +interface Target { + __mocks: any; + resetAll(): void; + toJSON(): any; +} + +type Proxy = Target & { + [index: string]: Mock; +}; + +declare const mockingoose: Proxy; + +export default mockingoose; diff --git a/types/mockingoose/mockingoose-tests.ts b/types/mockingoose/mockingoose-tests.ts new file mode 100644 index 0000000000..09a00ad274 --- /dev/null +++ b/types/mockingoose/mockingoose-tests.ts @@ -0,0 +1,9 @@ +import mockingoose from 'mockingoose'; + +mockingoose.User + .toReturn({ name: 'name' }) + .toReturn({ name: 'a name too' }, 'findOne') + .toReturn({ name: 'another name' }, 'save') + .reset('find'); + +mockingoose.resetAll(); diff --git a/types/mockingoose/tsconfig.json b/types/mockingoose/tsconfig.json new file mode 100644 index 0000000000..a6f171944a --- /dev/null +++ b/types/mockingoose/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", + "mockingoose-tests.ts" + ] +} diff --git a/types/mockingoose/tslint.json b/types/mockingoose/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mockingoose/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From dcda399637f7d78d7a7dd1c6ed1f5ccf01693a28 Mon Sep 17 00:00:00 2001 From: BamButz Date: Sun, 25 Nov 2018 12:25:56 +0100 Subject: [PATCH 022/241] Adding types for "hyper-aws4" --- types/hyper-aws4/hyper-aws4-tests.ts | 12 ++++++++++++ types/hyper-aws4/index.d.ts | 25 +++++++++++++++++++++++++ types/hyper-aws4/tsconfig.json | 23 +++++++++++++++++++++++ types/hyper-aws4/tslint.json | 1 + 4 files changed, 61 insertions(+) create mode 100644 types/hyper-aws4/hyper-aws4-tests.ts create mode 100644 types/hyper-aws4/index.d.ts create mode 100644 types/hyper-aws4/tsconfig.json create mode 100644 types/hyper-aws4/tslint.json diff --git a/types/hyper-aws4/hyper-aws4-tests.ts b/types/hyper-aws4/hyper-aws4-tests.ts new file mode 100644 index 0000000000..14caa34a9f --- /dev/null +++ b/types/hyper-aws4/hyper-aws4-tests.ts @@ -0,0 +1,12 @@ +import { sign, Request } from "hyper-aws4"; + +const signOption: Request = { + url: "https://us-west-1.hyper.sh/version", + method: "GET", + credential: { + accessKey: "6DPLADBPWYXDUVXLX34EJXBL", + secretKey: "2ldD1Yz0nzATl9vvagBwYTjglXBjVOWU8gV8aMm5" + } +}; + +sign(signOption); diff --git a/types/hyper-aws4/index.d.ts b/types/hyper-aws4/index.d.ts new file mode 100644 index 0000000000..bf2a0fafa8 --- /dev/null +++ b/types/hyper-aws4/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for hyper-aws4 1.1 +// Project: https://github.com/Tim-Zhang/hyper-aws4#readme +// Definitions by: BamButz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface Credentials { + accessKey: string; + secretKey: string; +} + +export interface Header { + [header: string]: string; +} + +export type HttpMethods = "GET" | "POST" | "PUT" | "DELETE" | "PATCH"; + +export interface Request { + url: string; + method?: HttpMethods; + body?: string; + headers?: Header; + credential?: Credentials; +} + +export function sign(request: Request, credential?: Credentials): Header; diff --git a/types/hyper-aws4/tsconfig.json b/types/hyper-aws4/tsconfig.json new file mode 100644 index 0000000000..6df2d811c1 --- /dev/null +++ b/types/hyper-aws4/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", + "hyper-aws4-tests.ts" + ] +} diff --git a/types/hyper-aws4/tslint.json b/types/hyper-aws4/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/hyper-aws4/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f26696ad1980206be1efc54f1f407b067801a5a7 Mon Sep 17 00:00:00 2001 From: Daan Boerlage Date: Mon, 26 Nov 2018 15:32:07 +0100 Subject: [PATCH 023/241] add typings for open-apifactory --- types/openapi-factory/index.d.ts | 49 +++++++++++++++++++ .../openapi-factory/openapi-factory-tests.ts | 25 ++++++++++ types/openapi-factory/tsconfig.json | 23 +++++++++ types/openapi-factory/tslint.json | 3 ++ 4 files changed, 100 insertions(+) create mode 100644 types/openapi-factory/index.d.ts create mode 100644 types/openapi-factory/openapi-factory-tests.ts create mode 100644 types/openapi-factory/tsconfig.json create mode 100644 types/openapi-factory/tslint.json diff --git a/types/openapi-factory/index.d.ts b/types/openapi-factory/index.d.ts new file mode 100644 index 0000000000..6cb22f7194 --- /dev/null +++ b/types/openapi-factory/index.d.ts @@ -0,0 +1,49 @@ +// Type definitions for openapi-factory 4.2 +// Project: https://github.com/wparad/openapi-factory.js +// Definitions by: Daan Boerlage +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare namespace OpenApi { + interface OpenApiOptions { + requestMiddleware?: () => any; + responseMiddleware?: () => any; + errorMiddleware?: () => any; + } +} + +declare class OpenApi { + constructor(options: OpenApi.OpenApiOptions, overrideLogger?: () => void); + + setAuthorizer(authorizerFunc: (req?: any) => any): void; + onEvent(onEventFunc: (req?: any) => any): void; + onSchedule(onScheduleFunc: (req?: any) => any): void; + + head(route: string, p0: (req?: any) => any): void; + head(route: string, p0: object, p1: (req?: any) => any): void; + + get(route: string, p0: (req?: any) => any): void; + get(route: string, p0: object, p1: (req?: any) => any): void; + + post(route: string, p0: (req?: any) => any): void; + post(route: string, p0: object, p1: (req?: any) => any): void; + + put(route: string, p0: (req?: any) => any): void; + put(route: string, p0: object, p1: (req?: any) => any): void; + + patch(route: string, p0: (req?: any) => any): void; + patch(route: string, p0: object, p1: (req?: any) => any): void; + + delete(route: string, p0: (req?: any) => any): void; + delete(route: string, p0: object, p1: (req?: any) => any): void; + + options(route: string, p0: (req?: any) => any): void; + options(route: string, p0: object, p1: (req?: any) => any): void; + + any(route: string, p0: (req?: any) => any): void; + any(route: string, p0: object, p1: (req?: any) => any): void; + + handler(event: object, context: object): Promise; +} + +export = OpenApi; diff --git a/types/openapi-factory/openapi-factory-tests.ts b/types/openapi-factory/openapi-factory-tests.ts new file mode 100644 index 0000000000..13e1e0e7cc --- /dev/null +++ b/types/openapi-factory/openapi-factory-tests.ts @@ -0,0 +1,25 @@ +import * as OpenApiFactory from 'openapi-factory'; + +const api = new OpenApiFactory({}); + +api.setAuthorizer((req: any) => req); +api.onEvent((req: any) => req); +api.onSchedule((req: any) => req); + +api.head('/v1/test', () => 'success'); +api.get('/v1/test', () => 'success'); +api.post('/v1/test', () => 'success'); +api.put('/v1/test', () => 'success'); +api.patch('/v1/test', () => 'success'); +api.delete('/v1/test', () => 'success'); +api.options('/v1/test', () => 'success'); +api.any('/v1/test2', () => 'success'); + +api.head('/v2/test', {test: true}, () => 'success'); +api.get('/v2/test', {test: true}, () => 'success'); +api.post('/v2/test', {test: true}, () => 'success'); +api.put('/v2/test', {test: true}, () => 'success'); +api.patch('/v2/test', {test: true}, () => 'success'); +api.delete('/v2/test', {test: true}, () => 'success'); +api.options('/v2/test', {test: true}, () => 'success'); +api.any('/v2/test2', {test: true}, () => 'success'); diff --git a/types/openapi-factory/tsconfig.json b/types/openapi-factory/tsconfig.json new file mode 100644 index 0000000000..e8528e8e84 --- /dev/null +++ b/types/openapi-factory/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "openapi-factory-tests.ts" + ] +} diff --git a/types/openapi-factory/tslint.json b/types/openapi-factory/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/openapi-factory/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 7bba952b5759fceb1b6307c807482380600047b5 Mon Sep 17 00:00:00 2001 From: Daan Boerlage Date: Mon, 26 Nov 2018 18:29:53 +0100 Subject: [PATCH 024/241] [openapi-factory] fix http methods param typings --- types/openapi-factory/index.d.ts | 52 +++++++++++-------- .../openapi-factory/openapi-factory-tests.ts | 36 +++++++------ 2 files changed, 51 insertions(+), 37 deletions(-) diff --git a/types/openapi-factory/index.d.ts b/types/openapi-factory/index.d.ts index 6cb22f7194..e41958e6df 100644 --- a/types/openapi-factory/index.d.ts +++ b/types/openapi-factory/index.d.ts @@ -5,43 +5,53 @@ // TypeScript Version: 2.2 declare namespace OpenApi { - interface OpenApiOptions { + interface ApiOptions { requestMiddleware?: () => any; responseMiddleware?: () => any; errorMiddleware?: () => any; } + + interface HttpMethodOptions { + rawBody?: boolean; + } + + interface HttpResponse { + statusCode?: number; + headers?: object; + body?: (object | string); + } } declare class OpenApi { - constructor(options: OpenApi.OpenApiOptions, overrideLogger?: () => void); + constructor(options: OpenApi.ApiOptions, overrideLogger?: () => void); - setAuthorizer(authorizerFunc: (req?: any) => any): void; - onEvent(onEventFunc: (req?: any) => any): void; - onSchedule(onScheduleFunc: (req?: any) => any): void; + setAuthorizer(authorizerFunc: (req?: any) => Promise): void; + onEvent(onEventFunc: (req?: any) => Promise): void; + onSchedule(onScheduleFunc: (req?: any) => Promise): void; - head(route: string, p0: (req?: any) => any): void; - head(route: string, p0: object, p1: (req?: any) => any): void; + head(route: string, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; + head(route: string, options: OpenApi.HttpMethodOptions, handler: (req?: any) => any): void; - get(route: string, p0: (req?: any) => any): void; - get(route: string, p0: object, p1: (req?: any) => any): void; + get(route: string, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; + get(route: string, options: OpenApi.HttpMethodOptions, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; - post(route: string, p0: (req?: any) => any): void; - post(route: string, p0: object, p1: (req?: any) => any): void; + post(route: string, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; + post(route: string, options: OpenApi.HttpMethodOptions, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; - put(route: string, p0: (req?: any) => any): void; - put(route: string, p0: object, p1: (req?: any) => any): void; + put(route: string, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; + put(route: string, options: OpenApi.HttpMethodOptions, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; - patch(route: string, p0: (req?: any) => any): void; - patch(route: string, p0: object, p1: (req?: any) => any): void; + patch(route: string, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; + patch(route: string, options: OpenApi.HttpMethodOptions, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; - delete(route: string, p0: (req?: any) => any): void; - delete(route: string, p0: object, p1: (req?: any) => any): void; + delete(route: string, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; + delete(route: string, options: OpenApi.HttpMethodOptions, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; - options(route: string, p0: (req?: any) => any): void; - options(route: string, p0: object, p1: (req?: any) => any): void; + options(route: string, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; + options(route: string, options: OpenApi.HttpMethodOptions, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; - any(route: string, p0: (req?: any) => any): void; - any(route: string, p0: object, p1: (req?: any) => any): void; + any(route: string, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; + any(route: string, options: OpenApi.HttpMethodOptions, handler: (req?: object) => (OpenApi.HttpResponse | Promise)): void; handler(event: object, context: object): Promise; } diff --git a/types/openapi-factory/openapi-factory-tests.ts b/types/openapi-factory/openapi-factory-tests.ts index 13e1e0e7cc..ad24a5021d 100644 --- a/types/openapi-factory/openapi-factory-tests.ts +++ b/types/openapi-factory/openapi-factory-tests.ts @@ -6,20 +6,24 @@ api.setAuthorizer((req: any) => req); api.onEvent((req: any) => req); api.onSchedule((req: any) => req); -api.head('/v1/test', () => 'success'); -api.get('/v1/test', () => 'success'); -api.post('/v1/test', () => 'success'); -api.put('/v1/test', () => 'success'); -api.patch('/v1/test', () => 'success'); -api.delete('/v1/test', () => 'success'); -api.options('/v1/test', () => 'success'); -api.any('/v1/test2', () => 'success'); +const testReponse = { + statusCode: 200 +}; -api.head('/v2/test', {test: true}, () => 'success'); -api.get('/v2/test', {test: true}, () => 'success'); -api.post('/v2/test', {test: true}, () => 'success'); -api.put('/v2/test', {test: true}, () => 'success'); -api.patch('/v2/test', {test: true}, () => 'success'); -api.delete('/v2/test', {test: true}, () => 'success'); -api.options('/v2/test', {test: true}, () => 'success'); -api.any('/v2/test2', {test: true}, () => 'success'); +api.head('/v1/test', () => testReponse); +api.get('/v1/test', () => testReponse); +api.post('/v1/test', () => testReponse); +api.put('/v1/test', () => testReponse); +api.patch('/v1/test', () => testReponse); +api.delete('/v1/test', () => testReponse); +api.options('/v1/test', () => testReponse); +api.any('/v1/test2', () => testReponse); + +api.head('/v2/test', { rawBody: true }, () => testReponse); +api.get('/v2/test', { rawBody: true }, () => testReponse); +api.post('/v2/test', { rawBody: true }, () => testReponse); +api.put('/v2/test', { rawBody: true }, () => testReponse); +api.patch('/v2/test', { rawBody: true }, () => testReponse); +api.delete('/v2/test', { rawBody: true }, () => testReponse); +api.options('/v2/test', { rawBody: true }, () => testReponse); +api.any('/v2/test2', { rawBody: true }, () => testReponse); From 9fa2b6599f6309a7e33e5b5ab1387537ed68d9df Mon Sep 17 00:00:00 2001 From: Boris Sergeyev Date: Mon, 26 Nov 2018 22:18:35 +0100 Subject: [PATCH 025/241] [react-redux] extended ThunkActionCreator testsuite to check all overloads --- types/react-redux/react-redux-tests.tsx | 59 ++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index f47683047e..554ace09ff 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -120,12 +120,61 @@ function MapDispatchWithThunkActionCreators() { } class TestComponent extends React.Component {} - const Test = connect( - null, - ({ simpleAction, thunkAction }), - )(TestComponent); + const mapStateToProps = ({ foo }: { foo: string }) => ({ foo }); + const mapDispatchToProps = { simpleAction, thunkAction }; - const verify = ; + const Test1 = connect(null, mapDispatchToProps)(TestComponent); + const Test2 = connect(mapStateToProps, mapDispatchToProps)(TestComponent); + const Test3 = connect( + null, mapDispatchToProps, null, { storeKey: 'somekey' } + )(TestComponent); + const Test4 = connect( + mapStateToProps, mapDispatchToProps, null, { storeKey: 'somekey' } + )(TestComponent); + const verify =
+ ; + + ; + +
; +} + +function MapManualDispatchThatLooksLikeThunk() { + interface OwnProps { + foo: string; + } + interface TestComponentProps extends OwnProps { + remove: (item: string) => () => object; + } + class TestComponent extends React.Component { + render() { + return
; + } + } + + const mapStateToProps = ({ foo }: { foo: string }) => ({ foo }); + function mapDispatchToProps(dispatch: Dispatch) { + return { + remove(item: string) { + return () => dispatch({ type: 'REMOVE_ITEM', item }); + } + }; + } + + const Test1 = connect(null, mapDispatchToProps)(TestComponent); + const Test2 = connect(mapStateToProps, mapDispatchToProps)(TestComponent); + const Test3 = connect( + null, mapDispatchToProps, null, { storeKey: 'somekey' } + )(TestComponent); + const Test4 = connect( + mapStateToProps, mapDispatchToProps, null, { storeKey: 'somekey' } + )(TestComponent); + const verify =
+ ; + + ; + +
; } function MapStateAndDispatchObject() { From 8cbf6d938de2e838a4f3cc9695576958ed55f4c3 Mon Sep 17 00:00:00 2001 From: Boris Sergeyev Date: Mon, 26 Nov 2018 22:19:18 +0100 Subject: [PATCH 026/241] [react-redux] fixed type definitions to pass extended tests --- types/react-redux/index.d.ts | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index bf65d89fd5..dc8a9af912 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -160,7 +160,12 @@ export interface Connect { ( mapStateToProps: null | undefined, - mapDispatchToProps: MapDispatchToPropsParam + mapDispatchToProps: MapDispatchToPropsNonObject + ): InferableComponentEnhancerWithProps; + + ( + mapStateToProps: null | undefined, + mapDispatchToProps: TDispatchProps, ): InferableComponentEnhancerWithProps< WithThunkActionCreators, TOwnProps @@ -168,7 +173,12 @@ export interface Connect { ( mapStateToProps: MapStateToPropsParam, - mapDispatchToProps: MapDispatchToPropsParam + mapDispatchToProps: MapDispatchToPropsNonObject + ): InferableComponentEnhancerWithProps; + + ( + mapStateToProps: MapStateToPropsParam, + mapDispatchToProps: TDispatchProps, ): InferableComponentEnhancerWithProps< TStateProps & WithThunkActionCreators, TOwnProps @@ -208,7 +218,14 @@ export interface Connect { ( mapStateToProps: null | undefined, - mapDispatchToProps: MapDispatchToPropsParam, + mapDispatchToProps: MapDispatchToPropsNonObject, + mergeProps: null | undefined, + options: Options<{}, TStateProps, TOwnProps> + ): InferableComponentEnhancerWithProps; + + ( + mapStateToProps: null | undefined, + mapDispatchToProps: TDispatchProps, mergeProps: null | undefined, options: Options<{}, TStateProps, TOwnProps> ): InferableComponentEnhancerWithProps< @@ -218,7 +235,14 @@ export interface Connect { ( mapStateToProps: MapStateToPropsParam, - mapDispatchToProps: MapDispatchToPropsParam, + mapDispatchToProps: MapDispatchToPropsNonObject, + mergeProps: null | undefined, + options: Options + ): InferableComponentEnhancerWithProps; + + ( + mapStateToProps: MapStateToPropsParam, + mapDispatchToProps: TDispatchProps, mergeProps: null | undefined, options: Options ): InferableComponentEnhancerWithProps< @@ -248,10 +272,12 @@ export type MapDispatchToProps = MapDispatchToPropsFunction | TDispatchProps; export type MapDispatchToPropsFactory = - (dispatch: Dispatch, ownProps: TOwnProps) => MapDispatchToProps; + (dispatch: Dispatch, ownProps: TOwnProps) => MapDispatchToPropsFunction; export type MapDispatchToPropsParam = MapDispatchToPropsFactory | MapDispatchToProps; +export type MapDispatchToPropsNonObject = MapDispatchToPropsFactory | MapDispatchToPropsFunction; + export type MergeProps = (stateProps: TStateProps, dispatchProps: TDispatchProps, ownProps: TOwnProps) => TMergedProps; From 84bc355df06ea07679ab0634483c08f76ac4bb7c Mon Sep 17 00:00:00 2001 From: Boris Sergeyev Date: Tue, 27 Nov 2018 07:18:16 +0100 Subject: [PATCH 027/241] [react-redux] improved naming of higher-order-type that handles thunks --- types/react-redux/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index dc8a9af912..bcbcced0bd 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -112,19 +112,19 @@ export type InferableComponentEnhancerWithProps = export type InferableComponentEnhancer = InferableComponentEnhancerWithProps; -export type WrappedThunkActionCreator any> = +export type InferThunkActionCreatorType any> = TActionCreator extends (...args: infer TParams) => (...args: any[]) => infer TReturn ? (...args: TParams) => TReturn : TActionCreator; export type HandleThunkActionCreator = TActionCreator extends (...args: any[]) => any - ? WrappedThunkActionCreator + ? InferThunkActionCreatorType : TActionCreator; // redux-thunk middleware returns thunk's return value from dispatch call // https://github.com/reduxjs/redux-thunk#composition -export type WithThunkActionCreators = +export type ResolveThunks = TDispatchProps extends { [key: string]: any } ? { [C in keyof TDispatchProps]: HandleThunkActionCreator @@ -167,7 +167,7 @@ export interface Connect { mapStateToProps: null | undefined, mapDispatchToProps: TDispatchProps, ): InferableComponentEnhancerWithProps< - WithThunkActionCreators, + ResolveThunks, TOwnProps >; @@ -180,7 +180,7 @@ export interface Connect { mapStateToProps: MapStateToPropsParam, mapDispatchToProps: TDispatchProps, ): InferableComponentEnhancerWithProps< - TStateProps & WithThunkActionCreators, + TStateProps & ResolveThunks, TOwnProps >; @@ -229,7 +229,7 @@ export interface Connect { mergeProps: null | undefined, options: Options<{}, TStateProps, TOwnProps> ): InferableComponentEnhancerWithProps< - WithThunkActionCreators, + ResolveThunks, TOwnProps >; @@ -246,7 +246,7 @@ export interface Connect { mergeProps: null | undefined, options: Options ): InferableComponentEnhancerWithProps< - TStateProps & WithThunkActionCreators, + TStateProps & ResolveThunks, TOwnProps >; // tslint:enable:no-unnecessary-generics From c7f49bd2d0d3e9f5cd066b6e340db5f404a0d212 Mon Sep 17 00:00:00 2001 From: dasimple Date: Tue, 27 Nov 2018 18:47:12 +0200 Subject: [PATCH 028/241] First typings for gdal package --- types/gdal/gdal-tests.ts | 78 ++++ types/gdal/index.d.ts | 764 +++++++++++++++++++++++++++++++++++++++ types/gdal/tsconfig.json | 22 ++ types/gdal/tslint.json | 1 + 4 files changed, 865 insertions(+) create mode 100644 types/gdal/gdal-tests.ts create mode 100644 types/gdal/index.d.ts create mode 100644 types/gdal/tsconfig.json create mode 100644 types/gdal/tslint.json diff --git a/types/gdal/gdal-tests.ts b/types/gdal/gdal-tests.ts new file mode 100644 index 0000000000..d30c83d571 --- /dev/null +++ b/types/gdal/gdal-tests.ts @@ -0,0 +1,78 @@ +import * as gdal from 'gdal'; + +// gdal.checksumImage(srcRasterBand, 0, 0, 512, 512); + +gdal.config.get('GDAL_DATA'); +gdal.config.set('GDAL_DATA', 'C:\\warmerda\\bld\\data'); + +/*gdal.contourGenerate({ + src: srcRasterBand, + dst: dstRasterBand +});*/ + +gdal.decToDMS(60, 'lat'); +gdal.decToDMS(60, 'lat', 2); + +/*gdal.fillNodata({ + +});*/ + +let creationOptionsArray: string[]; +creationOptionsArray = ['VRT_CREATION_OPTION=...']; +let creationOptionsObject: object; +creationOptionsObject = { + VRT_CREATION_OPTION: '...' +}; +gdal.open('C:\\datasets\\ogr.shp'); +gdal.open('C:\\datasets\\ogr.shp', 'r'); +gdal.open('C:\\datasets\\ogr.shp', 'r', 'ESRI Shapefile'); +gdal.open('C:\\datasets\\ogr.shp', 'r', ['ESRI Shapefile']); +gdal.open('C:\\datasets\\ogr.shp', 'r+'); +gdal.open('C:\\datasets\\ogr.shp', 'r+', 'ESRI Shapefile'); +gdal.open('C:\\datasets\\ogr.shp', 'r+', ['ESRI Shapefile']); +gdal.open('C:\\datasets\\raster.vrt', 'w', 'VRT'); +gdal.open('C:\\datasets\\raster.vrt', 'w', 'VRT', 512, 512, 3, 1, creationOptionsArray); +gdal.open('C:\\datasets\\raster.vrt', 'w', 'VRT', 512, 512, 3, 1, creationOptionsObject); +gdal.open('C:\\datasets\\raster.vrt', 'w', ['VRT']); +gdal.open('C:\\datasets\\raster.vrt', 'w', ['VRT'], 512, 512, 3, 1, creationOptionsArray); +gdal.open('C:\\datasets\\raster.vrt', 'w', ['VRT'], 512, 512, 3, 1, creationOptionsObject); + +/*let polygonizeOptions: gdal.PolygonizeOptions; +polygonizeOptions = { + src: srcRasterBand, + dst: dstRasterBand, + connectedness: 1, + mask: maskRasterBand, + pixValField: 1, + useFloats: true +}; +gdal.polygonize(polygonizeOptions); +gdal.polygonize({ + src: srcRasterBand, + dst: dstRasterBand, + pixValField: 1 +});*/ + +gdal.quiet(); + +/*let reprojectImageOptions: gdal.ReprojectImageOptions; +reprojectImageOptions = { + src: srcRasterBand, + dst: dstRasterBand, + s_srs: sourceSRS, + t_srs: targetSRS +}; +gdal.reprojectImage(reprojectImageOptions); +gdal.reprojectImage({ + +}); + +gdal.sieveFilter({ + +}); + +gdal.suggestedWarpOutput({ + +});*/ + +gdal.verbose(); diff --git a/types/gdal/index.d.ts b/types/gdal/index.d.ts new file mode 100644 index 0000000000..50280cff3d --- /dev/null +++ b/types/gdal/index.d.ts @@ -0,0 +1,764 @@ +// Type definitions for gdal 0.9 +// Project: https://github.com/naturalatlas/node-gdal#readme +// Definitions by: Andrei Digori +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +export as namespace gdal; + +/* Internal interfaces */ + +export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array; +export type Resampling = 'NEAREST' | 'GAUSS' | 'CUBIC' | 'AVERAGE' | 'MODE' | 'AVERAGE_MAGPHASE' | 'NONE'; + +export interface XY +{ + x: number; + y: number; +} + +export interface XYZ extends XY +{ + z: number; +} + +export interface EnvelopeBounds +{ + minX: number, + maxX: number, + minY: number, + maxY: number +} + +export interface Envelope3DBounds extends EnvelopeBounds +{ + minZ: number, + maxZ: number +} + +export interface RasterBandStatistics +{ + min: number; + max: number; + mean: number; + std_dev: number; +} + +export interface RasterBandPixelsWriteOptions +{ + buffer_width?: number; + buffer_height?: number; + pixel_space?: number; + line_space?: number; +} + +export interface RasterBandPixelsReadOptions +{ + buffer_width?: number; + buffer_height?: number; + pixel_space?: number; + line_space?: number; + data_type?: string; +} + +export interface ContourGenerateOptions +{ + src: RasterBand; + dst: Layer; + offset?: number; + interval?: number; + fixedLevels?: number[]; + nodata?: number; + idField?: number; + elevField?: number; +} + +export interface FillNoDataOptions +{ + src: RasterBand; + mask?: RasterBand; + searchDist: number; + smoothingIterations?: number; +} + +export interface PolygonizeOptions +{ + src: RasterBand; + dst: Layer; + mask?: RasterBand; + pixValField: number; + connectedness?: number; + useFloats?: boolean; +} + +export interface ReprojectImageOptions +{ + src: Dataset; + dst: Dataset; + s_srs: SpatialReference; + t_srs: SpatialReference; + resampling?: string; + cutline?: Geometry; + srcBands?: number[]; + dstBands?: number[]; + srcAlphaBand?: number; + dstAlphaBand?: number; + srcNodata?: number; + dstNodata?: number; + memoryLimit?: number; + maxError?: number; + multi?: boolean; + options?: string[] | object; +} + +export interface SieveFilterOptions +{ + src: RasterBand; + dst: RasterBand; + mask?: RasterBand; + threshold: number; + connectedness?: number; +} + +export interface SuggestedWarpOutputOptions +{ + src: Dataset; + s_srs: SpatialReference; + t_srs: SpatialReference; + maxError?: number; +} + +/* From API: https://naturalatlas.github.io/node-gdal/ */ + +/* Constants */ + +// CPL Error Codes +export const CPLE_AppDefined: number; +export const CPLE_AssertionFailed: number; +export const CPLE_FileIO: number; +export const CPLE_IllegalArg: number; +export const CPLE_None: number; +export const CPLE_NotSupported: number; +export const CPLE_NoWriteAccess: number; +export const CPLE_ObjectNull: number; +export const CPLE_OpenFailed: number; +export const CPLE_OutOfMemory: number; +export const CPLE_UserInterrupt: number; + +// CPL Error Levels +export const CE_Debug: number; +export const CE_Failure: number; +export const CE_Fatal: number; +export const CE_None: number; +export const CE_Warning: number; + +// DCAP +export const DCAP_CREATE: string; +export const DCAP_CREATECOPY: string; +export const DCAP_VIRTUALIO: string; + +// DMD +export const DMD_CREATIONDATATYPES: string; +export const DMD_CREATIONOPTIONLIST: string; +export const DMD_EXTENSION: string; +export const DMD_HELPTOPIC: string; +export const DMD_LONGNAME: string; +export const DMD_MIMETYPE: string; + +// GCI +export const GCI_AlphaBand: string; +export const GCI_BlackBand: string; +export const GCI_BlueBand: string; +export const GCI_CyanBand: string; +export const GCI_GrayIndex: string; +export const GCI_GreenBand: string; +export const GCI_HueBand: string; +export const GCI_LightnessBand: string; +export const GCI_MagentaBand: string; +export const GCI_PaletteIndex: string; +export const GCI_RedBand: string; +export const GCI_SaturationBand: string; +export const GCI_Undefined: string; +export const GCI_YCbCr_CbBand: string; +export const GCI_YCbCr_CrBand: string; +export const GCI_YCbCr_YBand: string; +export const GCI_YellowBand: string; + +// GDT +export const GDT_Byte: string; +export const GDT_CFloat32: string; +export const GDT_CFloat64: string; +export const GDT_CInt16: string; +export const GDT_CInt32: string; +export const GDT_Float32: string; +export const GDT_Float64: string; +export const GDT_Int16: string; +export const GDT_Int32: string; +export const GDT_UInt16: string; +export const GDT_UInt32: string; +export const GDT_Unknown: string; + +// GRA +export const GRA_Average: string; +export const GRA_Bilinear: string; +export const GRA_Cubic: string; +export const GRA_CubicSpline: string; +export const GRA_Lanczos: string; +export const GRA_Mode: string; +export const GRA_NearestNeighbor: string; + +// ODsC +export const ODrCCreateDataSource: string; +export const ODrCDeleteDataSource: string; +export const ODsCCreateGeomFieldAfterCreateLayer: string; +export const ODsCCreateLayer: string; +export const ODsCDeleteLayer: string; + +// OFT +export const OFTBinary: string; +export const OFTDate: string; +export const OFTDateTime: string; +export const OFTInteger: string; +export const OFTIntegerList: string; +export const OFTReal: string; +export const OFTRealList: string; +export const OFTString: string; +export const OFTStringList: string; +export const OFTTime: string; +export const OFTWideString: string; +export const OFTWideStringList: string; + +// OJ +export const OJLeft: string; +export const OJRight: string; +export const OJUndefined: string; + +// OLC +export const OLCAlterFieldDefn: string; +export const OLCCreateField: string; +export const OLCCreateGeomField: string; +export const OLCDeleteFeature: string; +export const OLCDeleteField: string; +export const OLCFastFeatureCount: string; +export const OLCFastGetExtent: string; +export const OLCFastSetNextByIndex: string; +export const OLCFastSpatialFilter: string; +export const OLCIgnoreFields: string; +export const OLCRandomRead: string; +export const OLCRandomWrite: string; +export const OLCReorderFields: string; +export const OLCSequentialWrite: string; +export const OLCStringsAsUTF8: string; +export const OLCTransactions: string; + +// wkbByteOrder +export const wkbNDR: string; +export const wkbXDR: string; + +// wkbGeometryType +export const wkb25DBit: number; +export const wkbGeometryCollection: number; +export const wkbGeometryCollection25D: number; +export const wkbLinearRing: string; +export const wkbLinearRing25D: number; +export const wkbLineString: number; +export const wkbLineString25D: number; +export const wkbMultiLineString: number; +export const wkbMultiLineString25D: number; +export const wkbMultiPoint: number; +export const wkbMultiPoint25D: number; +export const wkbMultiPolygon: number; +export const wkbMultiPolygon25D: number; +export const wkbNone: number; +export const wkbPoint: number; +export const wkbPoint25D: number; +export const wkbPolygon: number; +export const wkbPolygon25D: number; +export const wkbUnknown: number; + +// wkbVariant +export const wkbVariantIso: string; +export const wkbVariantOgc: string; +export const wkbVariantOldOgc: string; + +/* Classes and interfaces */ + +export class CoordinateTransformation +{ + constructor(source: SpatialReference, target: SpatialReference | Dataset); + transformPoint(x: number, y: number, z?: number): XYZ; +} + +export interface Dataset +{ + buildOverviews(resampling: Resampling, overviews: number[], bands?: number[]): void; + close(): void; + executeSQL(statement: string, spatial_filter?: Geometry, dialect?: string): Layer; + flush(): void; + getFileList(): string[]; + getGCPProjection(): string; + getGCPs(): object[]; + getMetadata(domain?: string): object; + setGCPs(gcps: object[], projection: string): void; + testCapability(capability: string): boolean; + + readonly bands: DatasetBands; + readonly description: string; + readonly driver: Driver; + geoTransform: number[]; + readonly layers: DatasetLayers; + readonly rasterSize: XY; + srs: SpatialReference; +} + +export interface DatasetBands +{ + count(): number; + create(dataType: number): RasterBand; + forEach(callback: (band: RasterBand, i: number) => void): void; + get(id: number): RasterBand; + map(callback: (band: RasterBand, i: number) => T): T[]; + + readonly ds: Dataset; +} + +export interface DatasetLayers +{ + copy(src_lyr_name: string, dst_lyr_name: string, options?: object | string[]): Layer; + count(): number; + create(name: string, srs: SpatialReference, geomType: number | Function, creation_options: string[] | object): Layer; + forEach(callback: (layer: Layer, i: number) => void): void; + get(key: string | number): Layer; + map(callback: (layer: Layer, i: number) => T): T[]; + remove(index: number): void; + + readonly ds: Dataset; +} + +export interface Driver +{ + copyFiles(name_old: string, name_new: string): void; + create(filename: string, x_size?: number, y_size?: number, band_count?: number, data_type?: number, creation_options?: string[] | object): Dataset; + createCopy(filename: string, src: Dataset, strict?: boolean, options?: string[] | object): Dataset; + deleteDataset(filename: string): void; + getMetadata(domain?: string): object; + open(path: string, mode?: 'r' | 'r+'): Dataset; + rename(new_name: string, old_name: string): void; + + readonly description: string; +} + +export class Envelope +{ + constructor(bounds: EnvelopeBounds); + contains(envelope: Envelope): boolean; + intersect(envelope: Envelope): void; + intersects(envelope: Envelope): boolean; + isEmpty(): boolean; + merge(envelope: Envelope): void; + toPolygon(): Polygon; +} + +export class Envelope3D extends Envelope +{ + constructor(bounds: Envelope3DBounds); +} + +export class Feature +{ + constructor(definition: Layer | FeatureDefn); + clone(): Feature; + destroy(): void; + equals(feature: Feature): boolean; + getFieldDefn(index: number): FieldDefn; + getGeometry(): Geometry; + setFrom(feature: Feature, index_map?: number[], forgiving?: boolean): void; + setGeometry(geometry: Geometry): void; + + readonly defn: FeatureDefn; + fid: number; + readonly fields: FeatureFields; +} + +export class FeatureDefn +{ + constructor(); + clone(): FeatureDefn; + + readonly fields: FeatureDefnFields; + geomIgnored: boolean; + geomType: number; + readonly name: string; + styleIgnored: boolean; +} + +export interface FeatureDefnFields +{ + add(field: FieldDefn | FieldDefn[]): void; + count(): number; + forEach(callback: (field: FieldDefn, i: number) => void): void; + get(key: string | number): FieldDefn; + getNames(): string[]; + indexOf(name: string): number; + map(callback: (field: FieldDefn, i: number) => T): T[]; + remove(key: string | number): void; + reorder(map: number[]): void; + + readonly featureDefn: FeatureDefn; +} + +export interface FeatureFields +{ + count(): number; + forEach(callback: (value: any, key: string) => void): void; + get(key: string | number): any; + getNames(): string[]; + indexOf(name: string): number; + map(callback: (value: any, key: string) => T): T[]; + reset(values: object, value: any): void; + set(key: string | number, value: any): void; + toArray(): any[]; + toJSON(): string; + toObject(): object; + + readonly feature: Feature; +} + +export class FieldDefn +{ + constructor(name: string, type: string); + + ignored: boolean; + justification: string; + name: string; + precision: number; + type: string; + width: number; +} + +export interface GDALDrivers +{ + count(): number; + forEach(callback: (driver: Driver, i: number) => void): void; + get(index: number | string): Driver; + getNames(): string[]; + map(callback: (driver: Driver, i: number) => T): T[]; +} + +export abstract class Geometry +{ + static create(type: number): Geometry; + static fromWKB(wkb: number, srs?: SpatialReference): Geometry; + static fromWKT(wkt: string, srs?: SpatialReference): Geometry; + static getConstructor(type: number): Function; + static getName(type: number): string; + + boundary(): Geometry; + buffer(distance: number, segments: number): Geometry; + centroid(): Point; + clone(): Geometry; + closeRings(): void; + contains(geometry: Geometry): boolean; + convexHull(): Geometry; + crosses(geometry: Geometry): boolean; + difference(geometry: Geometry): Geometry; + disjoint(geometry: Geometry): boolean; + distance(geometry: Geometry): number; + empty(): void; + equals(geometry: Geometry): boolean; + getEnvelope(): Envelope; + getEnvelope3D(): Envelope3D; + intersection(geometry: Geometry): Geometry; + intersects(geometry: Geometry): boolean; + isEmpty(): boolean; + isRing(): boolean; + isSimple(): boolean; + isValid(): boolean; + overlaps(geometry: Geometry): boolean; + segmentize(segment_length: number): number; + simplify(tolerance: number): Geometry; + simplifyPreserveTopology(tolerance: number): Geometry; + swapXY(): void; + symDifference(geometry: Geometry): Geometry; + toGML(): Geometry; + toJSON(): Geometry; + toKML(): Geometry; + toObject(): object; + touches(geometry: Geometry): boolean; + toWKB(byte_order?: string, variant?: string): Geometry; + toWKT(): Geometry; + transform(transformation: CoordinateTransformation): void; + transformTo(srs: SpatialReference): void; + union(geometry: Geometry): Geometry; + within(geometry: Geometry): boolean; + + readonly coordinateDimension: number; + readonly dimension: number; + readonly name: string; + srs: SpatialReference; + readonly wkbSize: number; + readonly wkbType: number; +} + +export class GeometryCollection extends Geometry +{ + getArea(): number; + getLength(): number; + + children: GeometryCollectionChildren; +} + +export interface GeometryCollectionChildren +{ + add(geometry: Geometry | Geometry[]): void; + count(): number; + forEach(callback: (geometry: Geometry, i: number) => void): void; + get(index: number): Geometry; + map(callback: (geometry: Geometry, i: number) => T): T[]; + remove(index: number): void; + toArray(): Geometry[]; + + readonly layer: Layer; +} + +export interface Layer +{ + flush(): void; + getExtent(force?: boolean): Envelope; + getSpatialFilter(): Geometry; + setAttributeFilter(filter: string): void; + setSpatialFilter(filter: Geometry): void; + setSpatialFilter(minX: number, maxX: number, minY: number, maxY: number): void; + testCapability(capability: string): boolean; + + readonly ds: Dataset; + readonly features: LayerFeatures; + readonly fidColumn: string; + readonly fields: LayerFields; + readonly geomColumn: string; + readonly geomType: number; + readonly name: string; + readonly srs: SpatialReference; +} + +export interface LayerFeatures +{ + add(feature: Feature): void; + count(force?: boolean): number; + first(): Feature; + forEach(callback: (feature: Feature, i: number) => void): void; + get(id: number): Feature; + map(callback: (feature: Feature, i: number) => T): T[]; + next(): Feature; + remove(id: number): void; + set(id: number, feature: Feature): void; + + readonly layer: Layer; +} + +export interface LayerFields +{ + add(def: FieldDefn | FieldDefn[], approx?: boolean): void; + count(): number; + forEach(callback: (field: FieldDefn, i: number) => void): void; + fromJSON(object: object, approx_ok?: boolean): LayerFields; + get(field: string | number): FieldDefn; + getNames(): string[]; + indexOf(field: string): number; + map(callback: (field: FieldDefn, i: number) => T): T[]; + remove(field: string | number): void; + reorder(map: number[]): void; + + readonly layer: Layer; +} + +export class LinearRing extends LineString +{ + getArea(): number; +} + +export class LineString extends Geometry +{ + addSubLineString(line: LineString, start?: number, end?: number): void; + getLength(): number; + value(distance: number): Point; + + readonly points: LineStringPoints; +} + +export interface LineStringPoints +{ + add(point: Point | Point[]): void; + count(): number; + forEach(callback: (point: Point, i: number) => void): void; + get(index: number): Point; + map(callback: (point: Point, i: number) => T): T[]; + remove(index: number): void; + resize(count: number): void; + reverse(): void; + set(index: number, point: Point): void; + toArray(): Point[]; +} + +export class MultiLineString extends GeometryCollection +{ + polygonize(): Polygon; +} + +export class MultiPoint extends GeometryCollection +{ + +} + +export class MultiPolygon extends GeometryCollection +{ + getArea(): number; + unionCascaded(): Geometry; +} + +export class Point extends Geometry +{ + constructor(x: number, y: number, z?: number); + + x: number; + y: number; + z: number; +} + +export class Polygon extends Geometry +{ + getArea(): number; + + rings: PolygonRings; +} + +export interface PolygonRings +{ + add(ring: LinearRing | LinearRing[]): void; + count(): number; + forEach(callback: (ring: LinearRing, i: number) => void): void; + get(index: number): LinearRing; + map(callback: (ring: LinearRing, i: number) => T): T[]; + remove(index: number): void; + toArray(): LinearRing[]; + + readonly layer: Layer; +} + +export interface RasterBand +{ + computeStatistics(allow_approximation: boolean): RasterBandStatistics; + createMaskBand(flags: number): void; + fill(real_value: number, imaginary_value?: number): void; + flush(): void; + getMaskBand(): RasterBand; + getMaskFlags(): number; + getMetadata(domain?: string): object; + getStatistics(allow_approximation: boolean, force: boolean): RasterBandStatistics; + setStatistics(min: number, max: number, mean: number, std_dev: number): void; + + readonly blockSize: XY; + categoryNames: string[]; + colorInterpretation: string; + readonly dataType: string; + readonly description: string; + readonly ds: Dataset; + readonly hasArbitraryOverviews: boolean; + readonly id: number; + readonly maximum: number; + readonly minimum: number; + noDataValue: number; + offset: number; + readonly overviews: RasterBandOverviews; + readonly pixels: RasterBandPixels; + readonly readOnly: boolean; + scale: number; + readonly size: XY; + unitType: string; +} + +export interface RasterBandOverviews +{ + count(): number; + forEach(callback: (overviewBand: RasterBand, i: number) => void): void; + get(index: number): RasterBand; + getBySampleCount(samples: number): RasterBand; + map(callback: (overviewBand: RasterBand, i: number) => T): T[]; +} + +export interface RasterBandPixels +{ + get(x: number, y: number): number; + read(x: number, y: number, width: number, height: number, data?: TypedArray, options?: RasterBandPixelsReadOptions): TypedArray; + readBlock(x: number, y: number, data?: TypedArray): TypedArray; + set(x: number, y: number, value: number): void; + write(x: number, y: number, width: number, height: number, data: TypedArray, options?: RasterBandPixelsWriteOptions): void; + writeBlock(x: number, y: number, data: TypedArray): void; +} + +export class SpatialReference +{ + constructor(wkt?: string); + autoIdentifyEPSG(): void; + clone(): SpatialReference; + cloneGeogCS(): SpatialReference; + EPSGTreatsAsLatLong(): boolean; + EPSGTreatsAsNorthingEasting(): boolean; + getAngularUnits(): { value: any, unit: any }; + getAttrValue(node_name: string, attr_index?: number): string; + getAuthorityCode(target_key: string): string; + getAuthorityName(target_key: string): string; + getLinearUnits(): { value: any, unit: any }; + isCompound(): boolean; + isGeocentric(): boolean; + isGeographic(): boolean; + isLocal(): boolean; + isProjected(): boolean; + isSame(srs: SpatialReference): boolean; + isSameGeogCS(srs: SpatialReference): boolean; + isSameVertCS(srs: SpatialReference): boolean; + isVertical(): boolean; + morphFromESRI(): void; + morphToESRI(): void; + setWellKnownGeogCS(name: string): void; + toPrettyWKT(simplify?: boolean): string; + toProj4(): string; + toWKT(): string; + toXML(): string; + validate(): string; + + static fromCRSURL(input: string): SpatialReference; + static fromEPSG(input: string): SpatialReference; + static fromEPSGA(input: number): SpatialReference; + static fromESRI(input: string[]): SpatialReference; + static fromMICoordSys(input: string): SpatialReference; + static fromProj4(input: string): SpatialReference; + static fromURL(url: string): SpatialReference; + static fromURN(input: string): SpatialReference; + static fromUserInput(input: string): SpatialReference; + static fromWKT(wkt: string): SpatialReference; + static fromWMSAUTO(input: string): SpatialReference; + static fromXML(input: string): SpatialReference; +} + +export namespace config +{ + function get(key: string): string; + function set(key: string, value: string): void; +} + +export const drivers: GDALDrivers; +export const lastError: { number: any, message: any, type: any }; +export const version: string; + +export function checksumImage(src: RasterBand, x?: number, y?: number, w?: number, h?: number): number; +export function contourGenerate(options: ContourGenerateOptions): void; +export function decToDMS(angle: number, axis: 'lat' | 'long', precision?: number): string; +export function fillNodata(options: FillNoDataOptions): void; +export function open(path: string, mode?: 'r' | 'r+' | 'w', drivers?: string | string[], x_size?: number, y_size?: number, band_count?: number, data_type?: number, creation_options?: string[] | object): Dataset; +export function polygonize(options: PolygonizeOptions): void; +export function quiet(): void; +export function reprojectImage(options: ReprojectImageOptions): void; +export function sieveFilter(options: SieveFilterOptions): void; +export function suggestedWarpOutput(options: SuggestedWarpOutputOptions): { rasterSize: any, geoTransform: any }; +export function verbose(): void; \ No newline at end of file diff --git a/types/gdal/tsconfig.json b/types/gdal/tsconfig.json new file mode 100644 index 0000000000..a7bd1cf386 --- /dev/null +++ b/types/gdal/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", + "gdal-tests.ts" + ] +} diff --git a/types/gdal/tslint.json b/types/gdal/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/gdal/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a104ee185677834365ba69b74bd14cd14723d5e7 Mon Sep 17 00:00:00 2001 From: andreidigori <45198612+andreidigori@users.noreply.github.com> Date: Tue, 27 Nov 2018 19:05:34 +0200 Subject: [PATCH 029/241] Update tsconfig.json Set "strictFunctionTypes": false, --- types/gdal/tsconfig.json | 1 + 1 file changed, 1 insertion(+) diff --git a/types/gdal/tsconfig.json b/types/gdal/tsconfig.json index a7bd1cf386..3a5bfaf917 100644 --- a/types/gdal/tsconfig.json +++ b/types/gdal/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": false, "baseUrl": "../", "typeRoots": [ "../" From 08b098667ad9ab2e6ff405662be41b947af7e04f Mon Sep 17 00:00:00 2001 From: andreidigori <45198612+andreidigori@users.noreply.github.com> Date: Tue, 27 Nov 2018 19:20:57 +0200 Subject: [PATCH 030/241] Update index.d.ts TsLint check --- types/gdal/index.d.ts | 138 ++++++++++++++---------------------------- 1 file changed, 46 insertions(+), 92 deletions(-) diff --git a/types/gdal/index.d.ts b/types/gdal/index.d.ts index 50280cff3d..41a89ff72f 100644 --- a/types/gdal/index.d.ts +++ b/types/gdal/index.d.ts @@ -11,49 +11,42 @@ export as namespace gdal; export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array; export type Resampling = 'NEAREST' | 'GAUSS' | 'CUBIC' | 'AVERAGE' | 'MODE' | 'AVERAGE_MAGPHASE' | 'NONE'; -export interface XY -{ +export interface XY { x: number; y: number; } -export interface XYZ extends XY -{ +export interface XYZ extends XY { z: number; } -export interface EnvelopeBounds -{ +export interface EnvelopeBounds { minX: number, maxX: number, minY: number, maxY: number } -export interface Envelope3DBounds extends EnvelopeBounds -{ +export interface Envelope3DBounds extends EnvelopeBounds { minZ: number, maxZ: number } -export interface RasterBandStatistics -{ +export interface RasterBandStatistics { min: number; max: number; mean: number; std_dev: number; } -export interface RasterBandPixelsWriteOptions -{ +export interface RasterBandPixelsWriteOptions { buffer_width?: number; buffer_height?: number; pixel_space?: number; line_space?: number; } -export interface RasterBandPixelsReadOptions -{ +export interface RasterBandPixelsReadOptions { buffer_width?: number; buffer_height?: number; pixel_space?: number; @@ -61,8 +54,7 @@ export interface RasterBandPixelsReadOptions data_type?: string; } -export interface ContourGenerateOptions -{ +export interface ContourGenerateOptions { src: RasterBand; dst: Layer; offset?: number; @@ -73,16 +65,14 @@ export interface ContourGenerateOptions elevField?: number; } -export interface FillNoDataOptions -{ +export interface FillNoDataOptions { src: RasterBand; mask?: RasterBand; searchDist: number; smoothingIterations?: number; } -export interface PolygonizeOptions -{ +export interface PolygonizeOptions { src: RasterBand; dst: Layer; mask?: RasterBand; @@ -91,8 +81,7 @@ export interface PolygonizeOptions useFloats?: boolean; } -export interface ReprojectImageOptions -{ +export interface ReprojectImageOptions { src: Dataset; dst: Dataset; s_srs: SpatialReference; @@ -111,8 +100,7 @@ export interface ReprojectImageOptions options?: string[] | object; } -export interface SieveFilterOptions -{ +export interface SieveFilterOptions { src: RasterBand; dst: RasterBand; mask?: RasterBand; @@ -120,8 +108,7 @@ export interface SieveFilterOptions connectedness?: number; } -export interface SuggestedWarpOutputOptions -{ +export interface SuggestedWarpOutputOptions { src: Dataset; s_srs: SpatialReference; t_srs: SpatialReference; @@ -283,14 +270,12 @@ export const wkbVariantOldOgc: string; /* Classes and interfaces */ -export class CoordinateTransformation -{ +export class CoordinateTransformation { constructor(source: SpatialReference, target: SpatialReference | Dataset); transformPoint(x: number, y: number, z?: number): XYZ; } -export interface Dataset -{ +export interface Dataset { buildOverviews(resampling: Resampling, overviews: number[], bands?: number[]): void; close(): void; executeSQL(statement: string, spatial_filter?: Geometry, dialect?: string): Layer; @@ -311,8 +296,7 @@ export interface Dataset srs: SpatialReference; } -export interface DatasetBands -{ +export interface DatasetBands { count(): number; create(dataType: number): RasterBand; forEach(callback: (band: RasterBand, i: number) => void): void; @@ -322,8 +306,7 @@ export interface DatasetBands readonly ds: Dataset; } -export interface DatasetLayers -{ +export interface DatasetLayers { copy(src_lyr_name: string, dst_lyr_name: string, options?: object | string[]): Layer; count(): number; create(name: string, srs: SpatialReference, geomType: number | Function, creation_options: string[] | object): Layer; @@ -335,8 +318,7 @@ export interface DatasetLayers readonly ds: Dataset; } -export interface Driver -{ +export interface Driver { copyFiles(name_old: string, name_new: string): void; create(filename: string, x_size?: number, y_size?: number, band_count?: number, data_type?: number, creation_options?: string[] | object): Dataset; createCopy(filename: string, src: Dataset, strict?: boolean, options?: string[] | object): Dataset; @@ -348,8 +330,7 @@ export interface Driver readonly description: string; } -export class Envelope -{ +export class Envelope { constructor(bounds: EnvelopeBounds); contains(envelope: Envelope): boolean; intersect(envelope: Envelope): void; @@ -359,13 +340,11 @@ export class Envelope toPolygon(): Polygon; } -export class Envelope3D extends Envelope -{ +export class Envelope3D extends Envelope { constructor(bounds: Envelope3DBounds); } -export class Feature -{ +export class Feature { constructor(definition: Layer | FeatureDefn); clone(): Feature; destroy(): void; @@ -380,8 +359,7 @@ export class Feature readonly fields: FeatureFields; } -export class FeatureDefn -{ +export class FeatureDefn { constructor(); clone(): FeatureDefn; @@ -392,8 +370,7 @@ export class FeatureDefn styleIgnored: boolean; } -export interface FeatureDefnFields -{ +export interface FeatureDefnFields { add(field: FieldDefn | FieldDefn[]): void; count(): number; forEach(callback: (field: FieldDefn, i: number) => void): void; @@ -407,8 +384,7 @@ export interface FeatureDefnFields readonly featureDefn: FeatureDefn; } -export interface FeatureFields -{ +export interface FeatureFields { count(): number; forEach(callback: (value: any, key: string) => void): void; get(key: string | number): any; @@ -424,8 +400,7 @@ export interface FeatureFields readonly feature: Feature; } -export class FieldDefn -{ +export class FieldDefn { constructor(name: string, type: string); ignored: boolean; @@ -436,8 +411,7 @@ export class FieldDefn width: number; } -export interface GDALDrivers -{ +export interface GDALDrivers { count(): number; forEach(callback: (driver: Driver, i: number) => void): void; get(index: number | string): Driver; @@ -445,8 +419,7 @@ export interface GDALDrivers map(callback: (driver: Driver, i: number) => T): T[]; } -export abstract class Geometry -{ +export abstract class Geometry { static create(type: number): Geometry; static fromWKB(wkb: number, srs?: SpatialReference): Geometry; static fromWKT(wkt: string, srs?: SpatialReference): Geometry; @@ -500,16 +473,14 @@ export abstract class Geometry readonly wkbType: number; } -export class GeometryCollection extends Geometry -{ +export class GeometryCollection extends Geometry { getArea(): number; getLength(): number; children: GeometryCollectionChildren; } -export interface GeometryCollectionChildren -{ +export interface GeometryCollectionChildren { add(geometry: Geometry | Geometry[]): void; count(): number; forEach(callback: (geometry: Geometry, i: number) => void): void; @@ -521,8 +492,7 @@ export interface GeometryCollectionChildren readonly layer: Layer; } -export interface Layer -{ +export interface Layer { flush(): void; getExtent(force?: boolean): Envelope; getSpatialFilter(): Geometry; @@ -541,8 +511,7 @@ export interface Layer readonly srs: SpatialReference; } -export interface LayerFeatures -{ +export interface LayerFeatures { add(feature: Feature): void; count(force?: boolean): number; first(): Feature; @@ -556,8 +525,7 @@ export interface LayerFeatures readonly layer: Layer; } -export interface LayerFields -{ +export interface LayerFields { add(def: FieldDefn | FieldDefn[], approx?: boolean): void; count(): number; forEach(callback: (field: FieldDefn, i: number) => void): void; @@ -572,13 +540,11 @@ export interface LayerFields readonly layer: Layer; } -export class LinearRing extends LineString -{ +export class LinearRing extends LineString { getArea(): number; } -export class LineString extends Geometry -{ +export class LineString extends Geometry { addSubLineString(line: LineString, start?: number, end?: number): void; getLength(): number; value(distance: number): Point; @@ -586,8 +552,7 @@ export class LineString extends Geometry readonly points: LineStringPoints; } -export interface LineStringPoints -{ +export interface LineStringPoints { add(point: Point | Point[]): void; count(): number; forEach(callback: (point: Point, i: number) => void): void; @@ -600,24 +565,20 @@ export interface LineStringPoints toArray(): Point[]; } -export class MultiLineString extends GeometryCollection -{ +export class MultiLineString extends GeometryCollection { polygonize(): Polygon; } -export class MultiPoint extends GeometryCollection -{ +export class MultiPoint extends GeometryCollection { } -export class MultiPolygon extends GeometryCollection -{ +export class MultiPolygon extends GeometryCollection { getArea(): number; unionCascaded(): Geometry; } -export class Point extends Geometry -{ +export class Point extends Geometry { constructor(x: number, y: number, z?: number); x: number; @@ -625,15 +586,13 @@ export class Point extends Geometry z: number; } -export class Polygon extends Geometry -{ +export class Polygon extends Geometry { getArea(): number; rings: PolygonRings; } -export interface PolygonRings -{ +export interface PolygonRings { add(ring: LinearRing | LinearRing[]): void; count(): number; forEach(callback: (ring: LinearRing, i: number) => void): void; @@ -645,8 +604,7 @@ export interface PolygonRings readonly layer: Layer; } -export interface RasterBand -{ +export interface RasterBand { computeStatistics(allow_approximation: boolean): RasterBandStatistics; createMaskBand(flags: number): void; fill(real_value: number, imaginary_value?: number): void; @@ -677,8 +635,7 @@ export interface RasterBand unitType: string; } -export interface RasterBandOverviews -{ +export interface RasterBandOverviews { count(): number; forEach(callback: (overviewBand: RasterBand, i: number) => void): void; get(index: number): RasterBand; @@ -686,8 +643,7 @@ export interface RasterBandOverviews map(callback: (overviewBand: RasterBand, i: number) => T): T[]; } -export interface RasterBandPixels -{ +export interface RasterBandPixels { get(x: number, y: number): number; read(x: number, y: number, width: number, height: number, data?: TypedArray, options?: RasterBandPixelsReadOptions): TypedArray; readBlock(x: number, y: number, data?: TypedArray): TypedArray; @@ -696,8 +652,7 @@ export interface RasterBandPixels writeBlock(x: number, y: number, data: TypedArray): void; } -export class SpatialReference -{ +export class SpatialReference { constructor(wkt?: string); autoIdentifyEPSG(): void; clone(): SpatialReference; @@ -741,8 +696,7 @@ export class SpatialReference static fromXML(input: string): SpatialReference; } -export namespace config -{ +export namespace config { function get(key: string): string; function set(key: string, value: string): void; } From 2de6fbab6151900dba10d85f9a6268ac13a88d1b Mon Sep 17 00:00:00 2001 From: huan086 Date: Tue, 27 Nov 2018 14:37:15 +0800 Subject: [PATCH 031/241] [radix64] Add Typescript definitions. --- types/radix64/index.d.ts | 23 +++++++++++++++++++++++ types/radix64/radix64-tests.ts | 11 +++++++++++ types/radix64/tsconfig.json | 23 +++++++++++++++++++++++ types/radix64/tslint.json | 1 + 4 files changed, 58 insertions(+) create mode 100644 types/radix64/index.d.ts create mode 100644 types/radix64/radix64-tests.ts create mode 100644 types/radix64/tsconfig.json create mode 100644 types/radix64/tslint.json diff --git a/types/radix64/index.d.ts b/types/radix64/index.d.ts new file mode 100644 index 0000000000..f376184fce --- /dev/null +++ b/types/radix64/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for radix64 1.1 +// Project: https://github.com/maxired/radix64 +// Definitions by: Jeow Li Huan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type MethodsString = 'base64' | 'base64URL' | 'base64URLNaturalSort' | 'base64URLASCIISort'; + +interface MethodsEnum { + BASE64: MethodsString; + BASE64URL: MethodsString; + BASE64NATURAL: MethodsString; + BASE64ASCII: MethodsString; + DEFAULT: MethodsString; +} + +interface Radix { + radix64: (number: number, method?: MethodsString) => string; + ascii64: (number: number, pad?: number) => string; + methods: MethodsEnum; +} + +declare const radix: Radix; +export = radix; diff --git a/types/radix64/radix64-tests.ts b/types/radix64/radix64-tests.ts new file mode 100644 index 0000000000..a77554c238 --- /dev/null +++ b/types/radix64/radix64-tests.ts @@ -0,0 +1,11 @@ +import radix64 = require("radix64"); + +const num: string = radix64.radix64(42); + +const numAndEnum: string = radix64.radix64(1337, radix64.methods.BASE64NATURAL); + +const numAndString: string = radix64.radix64(1337, 'base64URL'); + +const asciiNum: string = radix64.ascii64(42); + +const asciiNumAndPad: string = radix64.ascii64(42, 25); diff --git a/types/radix64/tsconfig.json b/types/radix64/tsconfig.json new file mode 100644 index 0000000000..362ad6d26e --- /dev/null +++ b/types/radix64/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", + "radix64-tests.ts" + ] +} diff --git a/types/radix64/tslint.json b/types/radix64/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/radix64/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From acd8209e0673bf6e558e8342706c7b5809b9e7c5 Mon Sep 17 00:00:00 2001 From: andreidigori <45198612+andreidigori@users.noreply.github.com> Date: Tue, 27 Nov 2018 19:29:25 +0200 Subject: [PATCH 032/241] Update index.d.ts Linting --- types/gdal/index.d.ts | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/types/gdal/index.d.ts b/types/gdal/index.d.ts index 41a89ff72f..6aca0120de 100644 --- a/types/gdal/index.d.ts +++ b/types/gdal/index.d.ts @@ -21,15 +21,15 @@ export interface XYZ extends XY { } export interface EnvelopeBounds { - minX: number, - maxX: number, - minY: number, - maxY: number + minX: number; + maxX: number; + minY: number; + maxY: number; } export interface Envelope3DBounds extends EnvelopeBounds { - minZ: number, - maxZ: number + minZ: number; + maxZ: number; } export interface RasterBandStatistics { @@ -309,7 +309,7 @@ export interface DatasetBands { export interface DatasetLayers { copy(src_lyr_name: string, dst_lyr_name: string, options?: object | string[]): Layer; count(): number; - create(name: string, srs: SpatialReference, geomType: number | Function, creation_options: string[] | object): Layer; + create(name: string, srs: SpatialReference, geomType: number | Geometry, creation_options: string[] | object): Layer; forEach(callback: (layer: Layer, i: number) => void): void; get(key: string | number): Layer; map(callback: (layer: Layer, i: number) => T): T[]; @@ -423,7 +423,7 @@ export abstract class Geometry { static create(type: number): Geometry; static fromWKB(wkb: number, srs?: SpatialReference): Geometry; static fromWKT(wkt: string, srs?: SpatialReference): Geometry; - static getConstructor(type: number): Function; + static getConstructor(type: number): Geometry; static getName(type: number): string; boundary(): Geometry; @@ -488,7 +488,6 @@ export interface GeometryCollectionChildren { map(callback: (geometry: Geometry, i: number) => T): T[]; remove(index: number): void; toArray(): Geometry[]; - readonly layer: Layer; } @@ -500,7 +499,6 @@ export interface Layer { setSpatialFilter(filter: Geometry): void; setSpatialFilter(minX: number, maxX: number, minY: number, maxY: number): void; testCapability(capability: string): boolean; - readonly ds: Dataset; readonly features: LayerFeatures; readonly fidColumn: string; @@ -521,7 +519,6 @@ export interface LayerFeatures { next(): Feature; remove(id: number): void; set(id: number, feature: Feature): void; - readonly layer: Layer; } @@ -536,7 +533,6 @@ export interface LayerFields { map(callback: (field: FieldDefn, i: number) => T): T[]; remove(field: string | number): void; reorder(map: number[]): void; - readonly layer: Layer; } @@ -548,7 +544,6 @@ export class LineString extends Geometry { addSubLineString(line: LineString, start?: number, end?: number): void; getLength(): number; value(distance: number): Point; - readonly points: LineStringPoints; } @@ -580,7 +575,6 @@ export class MultiPolygon extends GeometryCollection { export class Point extends Geometry { constructor(x: number, y: number, z?: number); - x: number; y: number; z: number; @@ -588,7 +582,6 @@ export class Point extends Geometry { export class Polygon extends Geometry { getArea(): number; - rings: PolygonRings; } @@ -600,7 +593,6 @@ export interface PolygonRings { map(callback: (ring: LinearRing, i: number) => T): T[]; remove(index: number): void; toArray(): LinearRing[]; - readonly layer: Layer; } @@ -614,7 +606,6 @@ export interface RasterBand { getMetadata(domain?: string): object; getStatistics(allow_approximation: boolean, force: boolean): RasterBandStatistics; setStatistics(min: number, max: number, mean: number, std_dev: number): void; - readonly blockSize: XY; categoryNames: string[]; colorInterpretation: string; @@ -681,7 +672,6 @@ export class SpatialReference { toWKT(): string; toXML(): string; validate(): string; - static fromCRSURL(input: string): SpatialReference; static fromEPSG(input: string): SpatialReference; static fromEPSGA(input: number): SpatialReference; @@ -709,10 +699,11 @@ export function checksumImage(src: RasterBand, x?: number, y?: number, w?: numbe export function contourGenerate(options: ContourGenerateOptions): void; export function decToDMS(angle: number, axis: 'lat' | 'long', precision?: number): string; export function fillNodata(options: FillNoDataOptions): void; -export function open(path: string, mode?: 'r' | 'r+' | 'w', drivers?: string | string[], x_size?: number, y_size?: number, band_count?: number, data_type?: number, creation_options?: string[] | object): Dataset; +export function open(path: string, mode?: 'r' | 'r+' | 'w', drivers?: string | string[]): Dataset; +export function open(path: string, mode?: 'w', drivers?: string | string[], x_size?: number, y_size?: number, band_count?: number, data_type?: number, creation_options?: string[] | object): Dataset; export function polygonize(options: PolygonizeOptions): void; export function quiet(): void; export function reprojectImage(options: ReprojectImageOptions): void; export function sieveFilter(options: SieveFilterOptions): void; export function suggestedWarpOutput(options: SuggestedWarpOutputOptions): { rasterSize: any, geoTransform: any }; -export function verbose(): void; \ No newline at end of file +export function verbose(): void; From d076418dc2fb9748a78bb49a4a585b577703d158 Mon Sep 17 00:00:00 2001 From: andreidigori <45198612+andreidigori@users.noreply.github.com> Date: Tue, 27 Nov 2018 19:33:23 +0200 Subject: [PATCH 033/241] Update index.d.ts Linting --- types/gdal/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/gdal/index.d.ts b/types/gdal/index.d.ts index 6aca0120de..d6c76ba226 100644 --- a/types/gdal/index.d.ts +++ b/types/gdal/index.d.ts @@ -564,9 +564,7 @@ export class MultiLineString extends GeometryCollection { polygonize(): Polygon; } -export class MultiPoint extends GeometryCollection { - -} +export class MultiPoint extends GeometryCollection {} export class MultiPolygon extends GeometryCollection { getArea(): number; From 422ae215527764ce90c03fe262b401bdae07c17d Mon Sep 17 00:00:00 2001 From: Kamontat Chantrachirathumrong Date: Wed, 28 Nov 2018 15:06:11 +0100 Subject: [PATCH 034/241] Update index.d.ts --- types/wikidata-sdk/index.d.ts | 243 ++++++++++++++++++++++++++-------- 1 file changed, 185 insertions(+), 58 deletions(-) diff --git a/types/wikidata-sdk/index.d.ts b/types/wikidata-sdk/index.d.ts index 5810bcc9de..79620ac623 100644 --- a/types/wikidata-sdk/index.d.ts +++ b/types/wikidata-sdk/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for wikidata-sdk 5.15 +// Type definitions for wikidata-sdk 5.15.9 // Project: https://github.com/maxlath/wikidata-sdk // Definitions by: Kamontat Chantrachirathumrong // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,20 +7,36 @@ import { WikidataLanguage } from "./def/type/language"; import { WikidataProperty } from "./def/type/property"; import { WikidataSite } from "./def/type/site"; +import { WikidataSiteLink, WikidataSiteLinkSimplify, WikidataSiteLinkWithUrlSimplify } from "./def/object/sitelink"; import { UrlResultFormat } from "./def/type/format"; +import { + WikidataLanguageBaseString, + WikidataLanguageBaseStringSimplify, + WikidataLanguageBaseArrayString, + WikidataLanguageBaseArrayStringSimplify +} from "wikidata-sdk/def/object/language-base-string"; -import { Claim, MainSnak, TimeDataValue, EntityDataValue } from "./def/object/claim"; +import { WikidataClaim, WikidataMainSnak, WikidataTimeDataValue, WikidataEntityDataValue } from "./def/object/claim"; -export type WikidataLanguage = WikidataLanguage; -export type WikidataProperty = WikidataProperty; -export type WikidataSite = WikidataSite; +// ----------------------------------- // +// Export session // +// ----------------------------------- // -export type UrlResultFormat = UrlResultFormat; +export { WikidataLanguage, WikidataProperty, WikidataSite }; -export type Claim = Claim; -export type MainSnak = MainSnak; -export type TimeDataValue = TimeDataValue; -export type EntityDataValue = EntityDataValue; +export { + WikidataLanguageBaseString, + WikidataLanguageBaseStringSimplify, + WikidataLanguageBaseArrayString, + WikidataLanguageBaseArrayStringSimplify, + WikidataSiteLink, + WikidataSiteLinkSimplify, + WikidataSiteLinkWithUrlSimplify +}; + +export { UrlResultFormat }; + +export { WikidataClaim, WikidataMainSnak, WikidataTimeDataValue, WikidataEntityDataValue }; export as namespace sdk; @@ -42,22 +58,22 @@ export as namespace sdk; * @see {@link https://www.wikidata.org/w/api.php?action=help&modules=wbsearchentities | Wikidata[wbsearchentities] } */ export function searchEntities( - search: string, - language?: WikidataLanguage, - limit?: string | number, - format?: UrlResultFormat, - uselang?: WikidataLanguage + search: string, + language?: WikidataLanguage, + limit?: string | number, + format?: UrlResultFormat, + uselang?: WikidataLanguage ): string; /** * @alias searchEntities */ export function searchEntities(opt: { - search: string; - language?: WikidataLanguage; - limit?: string | number; - format?: UrlResultFormat; - uselang?: WikidataLanguage; + search: string; + language?: WikidataLanguage; + limit?: string | number; + format?: UrlResultFormat; + uselang?: WikidataLanguage; }): string; /* ********** @@ -79,20 +95,20 @@ export function searchEntities(opt: { * @see {@link https://www.wikidata.org/w/api.php?action=help&modules=wbgetentities | Wikidata[wbgetentities] } */ export function getEntities( - ids: string | string[], - languages?: WikidataLanguage | WikidataLanguage[], - props?: WikidataProperty | WikidataProperty[], - format?: UrlResultFormat + ids: string | string[], + languages?: WikidataLanguage | WikidataLanguage[], + props?: WikidataProperty | WikidataProperty[], + format?: UrlResultFormat ): string; /** * @alias getEntities */ export function getEntities(a: { - ids: string | string[]; - languages?: WikidataLanguage | WikidataLanguage[]; - props?: WikidataProperty | WikidataProperty[]; - format?: UrlResultFormat; + ids: string | string[]; + languages?: WikidataLanguage | WikidataLanguage[]; + props?: WikidataProperty | WikidataProperty[]; + format?: UrlResultFormat; }): string; /** @@ -101,20 +117,20 @@ export function getEntities(a: { * Without id limitation and return the array of url instead. */ export function getManyEntities( - ids: string | string[], - languages?: WikidataLanguage | WikidataLanguage[], - props?: WikidataProperty | WikidataProperty[], - format?: UrlResultFormat + ids: string | string[], + languages?: WikidataLanguage | WikidataLanguage[], + props?: WikidataProperty | WikidataProperty[], + format?: UrlResultFormat ): string[]; /** * @alias getManyEntities */ export function getManyEntities(a: { - ids: string | string[]; - languages?: WikidataLanguage | WikidataLanguage[]; - props?: WikidataProperty | WikidataProperty[]; - format?: UrlResultFormat; + ids: string | string[]; + languages?: WikidataLanguage | WikidataLanguage[]; + props?: WikidataProperty | WikidataProperty[]; + format?: UrlResultFormat; }): string[]; /** @@ -131,22 +147,22 @@ export function getManyEntities(a: { * @see {@link https://github.com/maxlath/wikidata-sdk/blob/6b0673b9bf0fcaab19db65e2cc77e33c901ef35d/docs/get_entities.md#by-wikipedia-titles | Github[get_entities.md#by-wikipedia-titles] } */ export function getWikidataIdsFromWikipediaTitles( - titles: string | string[], - sites?: string, - languages?: WikidataLanguage | WikidataLanguage[], - props?: WikidataProperty | WikidataProperty[], - format?: UrlResultFormat + titles: string | string[], + sites?: WikidataSite, + languages?: WikidataLanguage | WikidataLanguage[], + props?: WikidataProperty | WikidataProperty[], + format?: UrlResultFormat ): string; /** * @alias getWikidataIdsFromWikipediaTitles */ export function getWikidataIdsFromWikipediaTitles(a: { - titles: string | string[]; - sites?: string; - languages?: WikidataLanguage | WikidataLanguage[]; - props?: WikidataProperty | WikidataProperty[]; - format?: UrlResultFormat; + titles: string | string[]; + sites?: WikidataSite; + languages?: WikidataLanguage | WikidataLanguage[]; + props?: WikidataProperty | WikidataProperty[]; + format?: UrlResultFormat; }): string; /** @@ -167,13 +183,13 @@ export function getWikidataIdsFromWikipediaTitles(a: { * {@link https://github.com/maxlath/wikidata-sdk/blob/6b0673b9bf0fcaab19db65e2cc77e33c901ef35d/docs/get_entities_reverse_claims.md#get-entities-reverse-claims | Github[get-entities-reverse-claims] } */ export function getReverseClaims( - property: string | string[], - value: string | string[], - options?: { - limit?: number; - keepProperties?: boolean; - caseInsensitive?: boolean; - } + property: string | string[], + value: string | string[], + options?: { + limit?: number; + keepProperties?: boolean; + caseInsensitive?: boolean; + } ): string; /** @@ -241,7 +257,7 @@ export function truthyClaims(claims: object): object; * * @see {@link https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format#Truthy_statements | Truthy} */ -export function truthyPropertyClaims(claims: Claim[]): Claim[]; +export function truthyPropertyClaims(claims: WikidataClaim[]): WikidataClaim[]; /** * This will get the link that represent the site of the title. @@ -252,16 +268,16 @@ export function truthyPropertyClaims(claims: Claim[]): Claim[]; * * @see {@link https://github.com/maxlath/wikidata-sdk/blob/6b0673b9bf0fcaab19db65e2cc77e33c901ef35d/docs/general_helpers.md#getsitelinkurl | Github[getsitelinkurl] } */ -export function getSitelinkUrl(site: string, title: string): string; +export function getSitelinkUrl(site: WikidataSite, title: string): string; /** * @alias getSitelinkUrl */ -export function getSitelinkUrl(a: { site: string; title: string }): string; +export function getSitelinkUrl(a: { site: WikidataSite; title: string }): string; export interface SitelinkData { - lang: string; - project: string; + lang: string; + project: string; } /** * Get the sitelink on english language and the lang of it. @@ -335,3 +351,114 @@ export function wikidataTimeToSimpleDay(a: string | object): string; * @returns URL from a wikimedia commons filename */ export function getImageUrl(a: string, width?: number): string; + +export type SimplifyOption = { + // claims + entityPrefix?: string; + propertyPrefix?: string; + keepRichValues?: boolean; + keepQualifiers?: boolean; + keepReferences?: boolean; + keepIds?: boolean; + keepHashes?: boolean; + keepNonTruthy?: boolean; + // sitelinks + addUrl?: boolean; +}; + +/** + * Helper method, for simplify result object more reasonable + */ +export namespace simplify { + /** + * Applying all simplifiers at once: labels, descriptions, aliases, claims, sitelinks. See next sections for details. + * You can also pass options as a second argument, that will then be passed the subfunctions: + * + * @param entity the entity that receive from {@link getEntities} APIs + * @param opt simlify option. currently only simplify claims and simplify sitelinks. + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-entity | Github[simplify-entity]} + */ + export function entity(entity: T, opt?: SimplifyOption): T; + + /** + * This is a same of {@link entity} method except this input as multiple array of entities. + * + * @param entities entities from {@link getEntities} APIs + * @param opt simlify option. currently only simplify claims and simplify sitelinks. + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-entities | Github[simplify-entities]} + */ + export function entities(entities: T[], opt?: SimplifyOption): T[]; + + /** + * Make label simplifier and easier to understand + * + * @param labels label object, you will receive this from getEntities method + * + * @example + * + * const label = simplify.labels("{ pl: { language: 'pl', value: 'książka' } }"); + * console.log(label) // { pl: 'książka' } + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-labels | Github[simplify-labels]} + */ + export function labels(labels: WikidataLanguageBaseString): WikidataLanguageBaseStringSimplify; + + /** + * Make description simplifier and easier to understand + * + * @param descriptions description object, you will receive this from getEntities method + * + * @example + * + * const desc = simplify.descriptions("{ pl: { language: 'pl', value: 'dokument piśmienniczy [...]' } }"); + * console.log(desc) // { pl: 'dokument piśmienniczy [...]' } + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-descriptions | Github[simplify-descriptions]} + */ + export function descriptions(descriptions: WikidataLanguageBaseString): WikidataLanguageBaseStringSimplify; + + /** + * Make alias simplifier and easier to understand + * + * @param aliases alias object, you will receive this from getEntities method + * + * @example + * + * const alias = simplify.aliases("{ pl: [ { language: 'pl', value: 'Tom' }, { language: 'pl', value: 'Tomik' } ] }"); + * console.log(alias) // { pl: [ 'Tom', 'Tomik' ] } + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-aliases | Github[simplify-aliases]} + */ + export function aliases(aliases: WikidataLanguageBaseArrayString): WikidataLanguageBaseArrayStringSimplify; + + /** + * Make sitelink simplifier and easier to understand + * + * @param sitelinks sitelink object, you will receive this from getEntities method + * + * @example + * + * const site = simplify.sitelinks("{ plwiki: { site: 'plwiki', title: 'Książka', badges: [] } }"); + * console.log(site) // { plwiki: 'Książka' } + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-sitelinks | Github[simplify-sitelinks]} + */ + export function sitelinks(sitelinks: WikidataSiteLink): WikidataSiteLinkSimplify; + + /** + * Make sitelink simplifier and easier to understand. include URL in the result. + * + * @param sitelinks sitelink object, you will receive this from getEntities method + * @param options add url to a result + * + * @example + * + * const site = simplify.sitelinks("{ plwiki: { site: 'plwiki', title: 'Książka', badges: [] } }", {addUrl: true}); + * console.log(site) // { plwiki: { title: 'Książka', url: 'https://pl.wikipedia.org/wiki/Książka' } } + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#add-sitelinks-urls | Github[simplify-sitelinks-with-url]} + */ + export function sitelinks(sitelinks: WikidataSiteLink, options: { addUrl: true }): WikidataSiteLinkWithUrlSimplify; +} From d284105dcadcce897d96a1d38a5040e396095f35 Mon Sep 17 00:00:00 2001 From: Kamontat Chantrachirathumrong Date: Wed, 28 Nov 2018 15:08:33 +0100 Subject: [PATCH 035/241] Update claim name --- types/wikidata-sdk/def/object/claim.d.ts | 54 ++++++++++++------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/types/wikidata-sdk/def/object/claim.d.ts b/types/wikidata-sdk/def/object/claim.d.ts index c397fcb0df..99ed8bf52c 100644 --- a/types/wikidata-sdk/def/object/claim.d.ts +++ b/types/wikidata-sdk/def/object/claim.d.ts @@ -1,34 +1,34 @@ -export interface TimeDataValue { - type: "time"; - value: { - time: string; - timezone: number; - before: number; - after: number; - precision: number; - calendermodel: string; - }; +export interface WikidataTimeDataValue { + type: "time"; + value: { + time: string; + timezone: number; + before: number; + after: number; + precision: number; + calendermodel: string; + }; } -export interface EntityDataValue { - type: "wikibase-entityid"; - value: { - "numeric-id": number; - "entity-type": string; - }; +export interface WikidataEntityDataValue { + type: "wikibase-entityid"; + value: { + "numeric-id": number; + "entity-type": string; + }; } -export interface MainSnak { - datatype: string; - snaktype: string; - property: string; - hash: string; - datavalue: TimeDataValue | EntityDataValue; +export interface WikidataMainSnak { + datatype: string; + snaktype: string; + property: string; + hash: string; + datavalue: WikidataTimeDataValue | WikidataEntityDataValue; } -export interface Claim { - rank: string; - id: string; - type: string; - mainsnak: MainSnak; +export interface WikidataClaim { + rank: string; + id: string; + type: string; + mainsnak: WikidataMainSnak; } From d5acd49750e454a5ab7f35a452a2f2cd61ea12ea Mon Sep 17 00:00:00 2001 From: Kamontat Chantrachirathumrong Date: Wed, 28 Nov 2018 15:09:17 +0100 Subject: [PATCH 036/241] Add language base string object type --- .../def/object/language-base-string.d.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 types/wikidata-sdk/def/object/language-base-string.d.ts diff --git a/types/wikidata-sdk/def/object/language-base-string.d.ts b/types/wikidata-sdk/def/object/language-base-string.d.ts new file mode 100644 index 0000000000..9f35d4bd8e --- /dev/null +++ b/types/wikidata-sdk/def/object/language-base-string.d.ts @@ -0,0 +1,19 @@ +import { WikidataLanguage } from "wikidata-sdk"; + +export type WikidataLanguageBaseString = { + [Key in WikidataLanguage]?: { + language: Key; + value: string; + } +}; + +export type WikidataLanguageBaseStringSimplify = { [key in WikidataLanguage]?: string }; + +export type WikidataLanguageBaseArrayString = { + [Key in WikidataLanguage]: { + language: Key; + value: string; + }[] +}; + +export type WikidataLanguageBaseArrayStringSimplify = { [key in WikidataLanguage]: string[] }; From 22e936663027c8f82280ce4a3883fe42ea30e8ee Mon Sep 17 00:00:00 2001 From: Kamontat Chantrachirathumrong Date: Wed, 28 Nov 2018 15:09:40 +0100 Subject: [PATCH 037/241] Add sitelink object --- types/wikidata-sdk/def/object/sitelink.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 types/wikidata-sdk/def/object/sitelink.d.ts diff --git a/types/wikidata-sdk/def/object/sitelink.d.ts b/types/wikidata-sdk/def/object/sitelink.d.ts new file mode 100644 index 0000000000..4b6aeee23d --- /dev/null +++ b/types/wikidata-sdk/def/object/sitelink.d.ts @@ -0,0 +1,12 @@ +import { WikidataSite } from "wikidata-sdk"; + +export type WikidataSiteLink = { [Key in WikidataSite]: { site: Key; title: string; badges: string[] } }; + +export type WikidataSiteLinkSimplify = { [key in WikidataSite]: string }; + +export type WikidataSiteLinkWithUrlSimplify = { + [key in WikidataSite]: { + title: string; + url: string; + } +}; From 3e65f7972871d987b69b60a2b63587a89e5dbb6f Mon Sep 17 00:00:00 2001 From: feinoujc Date: Wed, 28 Nov 2018 09:10:50 -0500 Subject: [PATCH 038/241] [@pollyjs/core] updates for 1.3 config options --- types/pollyjs__core/index.d.ts | 28 +++++---- types/pollyjs__core/pollyjs__core-tests.ts | 69 +++++++++++++++++++++- 2 files changed, 83 insertions(+), 14 deletions(-) diff --git a/types/pollyjs__core/index.d.ts b/types/pollyjs__core/index.d.ts index 83b6b933b9..4f6d308d0d 100644 --- a/types/pollyjs__core/index.d.ts +++ b/types/pollyjs__core/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for @pollyjs/core 1.2 +// Type definitions for @pollyjs/core 1.3 // Project: https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/core // Definitions by: feinoujc // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,8 +12,10 @@ export const Timing: { fixed(ms: number): () => Promise; relative(ratio: number): (ms: number) => Promise; }; + +export type MatchBy = (input: T) => R; export interface PollyConfig { - mode?: MODES; + mode?: MODES | string; adapters?: Array; adapterOptions?: any; @@ -34,20 +36,20 @@ export interface PollyConfig { timing?: ((ms: number) => Promise) | (() => Promise); matchRequestsBy?: { - method?: boolean; - headers?: any; - body?: boolean; + method?: boolean | MatchBy; + headers?: boolean | { exclude: string[] } | MatchBy>; + body?: boolean | MatchBy; order?: boolean; url?: { - protocol?: boolean; - username?: boolean; - password?: boolean; - hostname?: boolean; - port?: boolean; - pathname?: boolean; - query?: boolean; - hash?: boolean; + protocol?: boolean | MatchBy; + username?: boolean | MatchBy; + password?: boolean | MatchBy; + hostname?: boolean | MatchBy; + port?: boolean | MatchBy; + pathname?: boolean | MatchBy; + query?: boolean | MatchBy; + hash?: boolean | MatchBy; }; }; } diff --git a/types/pollyjs__core/pollyjs__core-tests.ts b/types/pollyjs__core/pollyjs__core-tests.ts index 22f5516646..0644eff7f4 100644 --- a/types/pollyjs__core/pollyjs__core-tests.ts +++ b/types/pollyjs__core/pollyjs__core-tests.ts @@ -6,7 +6,74 @@ const polly = new Polly('test recording', { recordFailedRequests: true, adapters: ['xhr', 'fetch'], persister: 'rest', - timing: Timing.relative(3) + timing: Timing.relative(3), + matchRequestsBy: { + method: true, + headers: true, + body: true, + order: true, + + url: { + protocol: true, + username: true, + password: true, + hostname: true, + port: true, + pathname: true, + query: true, + hash: false + } + } +}); + +new Polly('test recording', { + mode: 'replay', + recordFailedRequests: true, + adapters: ['xhr', 'fetch'], + persister: 'rest', + timing: Timing.relative(3), + matchRequestsBy: { + method(method) { + return method.toLowerCase(); + }, + headers: 1 === 1 ? { exclude: ['X-Auth'] } : (headers) => { + delete headers['X-Auth']; + return headers; + }, + body(body) { + const json = JSON.parse(body); + + delete json.email; + return JSON.stringify(json); + }, + + url: { + protocol(protocol) { + return protocol === 'http' ? 'https:' : protocol; + }, + username(username) { + return username === 'johndoe' ? 'username' : username; + }, + password(password) { + return password || 'password'; + }, + hostname(hostname) { + return hostname.replace('.com', '.net'); + }, + port(port) { + return port > 80 ? 3000 : 433; + }, + pathname(pathname) { + return pathname.replace('/api/v1', '/api'); + }, + query(query) { + return { ...query, token: '' }; + }, + hash(hash) { + return hash.replace(/token=[0-9]+/, ''); + } + } + } }); function log(_: string) { From 091bd02a320f8984ff9b7045efab32737d631b93 Mon Sep 17 00:00:00 2001 From: Kamontat Chantrachirathumrong Date: Wed, 28 Nov 2018 15:14:48 +0100 Subject: [PATCH 039/241] Fix error --- types/wikidata-sdk/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/wikidata-sdk/index.d.ts b/types/wikidata-sdk/index.d.ts index 79620ac623..98eb893d0c 100644 --- a/types/wikidata-sdk/index.d.ts +++ b/types/wikidata-sdk/index.d.ts @@ -14,7 +14,7 @@ import { WikidataLanguageBaseStringSimplify, WikidataLanguageBaseArrayString, WikidataLanguageBaseArrayStringSimplify -} from "wikidata-sdk/def/object/language-base-string"; +} from "./def/object/language-base-string"; import { WikidataClaim, WikidataMainSnak, WikidataTimeDataValue, WikidataEntityDataValue } from "./def/object/claim"; From 265766df3dfefc749ecd229354e8ca884c8cf818 Mon Sep 17 00:00:00 2001 From: Kamontat Chantrachirathumrong Date: Wed, 28 Nov 2018 15:32:28 +0100 Subject: [PATCH 040/241] [fix] Fix a lot of linter error --- .../def/object/language-base-string.d.ts | 18 +- types/wikidata-sdk/def/object/sitelink.d.ts | 10 +- types/wikidata-sdk/index.d.ts | 320 +++++++++--------- 3 files changed, 176 insertions(+), 172 deletions(-) diff --git a/types/wikidata-sdk/def/object/language-base-string.d.ts b/types/wikidata-sdk/def/object/language-base-string.d.ts index 9f35d4bd8e..8f9606dbb1 100644 --- a/types/wikidata-sdk/def/object/language-base-string.d.ts +++ b/types/wikidata-sdk/def/object/language-base-string.d.ts @@ -1,19 +1,19 @@ -import { WikidataLanguage } from "wikidata-sdk"; +import { WikidataLanguage } from "../type/language"; export type WikidataLanguageBaseString = { - [Key in WikidataLanguage]?: { - language: Key; - value: string; - } + [Key in WikidataLanguage]?: { + language: Key; + value: string; + } }; export type WikidataLanguageBaseStringSimplify = { [key in WikidataLanguage]?: string }; export type WikidataLanguageBaseArrayString = { - [Key in WikidataLanguage]: { - language: Key; - value: string; - }[] + [Key in WikidataLanguage]: Array<{ + language: Key; + value: string; + }> }; export type WikidataLanguageBaseArrayStringSimplify = { [key in WikidataLanguage]: string[] }; diff --git a/types/wikidata-sdk/def/object/sitelink.d.ts b/types/wikidata-sdk/def/object/sitelink.d.ts index 4b6aeee23d..d0eea713e5 100644 --- a/types/wikidata-sdk/def/object/sitelink.d.ts +++ b/types/wikidata-sdk/def/object/sitelink.d.ts @@ -1,12 +1,12 @@ -import { WikidataSite } from "wikidata-sdk"; +import { WikidataSite } from "../type/site"; export type WikidataSiteLink = { [Key in WikidataSite]: { site: Key; title: string; badges: string[] } }; export type WikidataSiteLinkSimplify = { [key in WikidataSite]: string }; export type WikidataSiteLinkWithUrlSimplify = { - [key in WikidataSite]: { - title: string; - url: string; - } + [key in WikidataSite]: { + title: string; + url: string; + } }; diff --git a/types/wikidata-sdk/index.d.ts b/types/wikidata-sdk/index.d.ts index 98eb893d0c..6ed81883cc 100644 --- a/types/wikidata-sdk/index.d.ts +++ b/types/wikidata-sdk/index.d.ts @@ -1,8 +1,8 @@ -// Type definitions for wikidata-sdk 5.15.9 +// Type definitions for wikidata-sdk 5.15 // Project: https://github.com/maxlath/wikidata-sdk // Definitions by: Kamontat Chantrachirathumrong // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.1 import { WikidataLanguage } from "./def/type/language"; import { WikidataProperty } from "./def/type/property"; @@ -10,10 +10,10 @@ import { WikidataSite } from "./def/type/site"; import { WikidataSiteLink, WikidataSiteLinkSimplify, WikidataSiteLinkWithUrlSimplify } from "./def/object/sitelink"; import { UrlResultFormat } from "./def/type/format"; import { - WikidataLanguageBaseString, - WikidataLanguageBaseStringSimplify, - WikidataLanguageBaseArrayString, - WikidataLanguageBaseArrayStringSimplify + WikidataLanguageBaseString, + WikidataLanguageBaseStringSimplify, + WikidataLanguageBaseArrayString, + WikidataLanguageBaseArrayStringSimplify } from "./def/object/language-base-string"; import { WikidataClaim, WikidataMainSnak, WikidataTimeDataValue, WikidataEntityDataValue } from "./def/object/claim"; @@ -25,19 +25,23 @@ import { WikidataClaim, WikidataMainSnak, WikidataTimeDataValue, WikidataEntityD export { WikidataLanguage, WikidataProperty, WikidataSite }; export { - WikidataLanguageBaseString, - WikidataLanguageBaseStringSimplify, - WikidataLanguageBaseArrayString, - WikidataLanguageBaseArrayStringSimplify, - WikidataSiteLink, - WikidataSiteLinkSimplify, - WikidataSiteLinkWithUrlSimplify + WikidataLanguageBaseString, + WikidataLanguageBaseStringSimplify, + WikidataLanguageBaseArrayString, + WikidataLanguageBaseArrayStringSimplify, + WikidataSiteLink, + WikidataSiteLinkSimplify, + WikidataSiteLinkWithUrlSimplify }; export { UrlResultFormat }; export { WikidataClaim, WikidataMainSnak, WikidataTimeDataValue, WikidataEntityDataValue }; +export interface Json { + [key: string]: any; +} + export as namespace sdk; /* ********** @@ -58,22 +62,22 @@ export as namespace sdk; * @see {@link https://www.wikidata.org/w/api.php?action=help&modules=wbsearchentities | Wikidata[wbsearchentities] } */ export function searchEntities( - search: string, - language?: WikidataLanguage, - limit?: string | number, - format?: UrlResultFormat, - uselang?: WikidataLanguage + search: string, + language?: WikidataLanguage, + limit?: string | number, + format?: UrlResultFormat, + uselang?: WikidataLanguage ): string; /** * @alias searchEntities */ export function searchEntities(opt: { - search: string; - language?: WikidataLanguage; - limit?: string | number; - format?: UrlResultFormat; - uselang?: WikidataLanguage; + search: string; + language?: WikidataLanguage; + limit?: string | number; + format?: UrlResultFormat; + uselang?: WikidataLanguage; }): string; /* ********** @@ -95,20 +99,20 @@ export function searchEntities(opt: { * @see {@link https://www.wikidata.org/w/api.php?action=help&modules=wbgetentities | Wikidata[wbgetentities] } */ export function getEntities( - ids: string | string[], - languages?: WikidataLanguage | WikidataLanguage[], - props?: WikidataProperty | WikidataProperty[], - format?: UrlResultFormat + ids: string | string[], + languages?: WikidataLanguage | WikidataLanguage[], + props?: WikidataProperty | WikidataProperty[], + format?: UrlResultFormat ): string; /** * @alias getEntities */ export function getEntities(a: { - ids: string | string[]; - languages?: WikidataLanguage | WikidataLanguage[]; - props?: WikidataProperty | WikidataProperty[]; - format?: UrlResultFormat; + ids: string | string[]; + languages?: WikidataLanguage | WikidataLanguage[]; + props?: WikidataProperty | WikidataProperty[]; + format?: UrlResultFormat; }): string; /** @@ -117,20 +121,20 @@ export function getEntities(a: { * Without id limitation and return the array of url instead. */ export function getManyEntities( - ids: string | string[], - languages?: WikidataLanguage | WikidataLanguage[], - props?: WikidataProperty | WikidataProperty[], - format?: UrlResultFormat + ids: string | string[], + languages?: WikidataLanguage | WikidataLanguage[], + props?: WikidataProperty | WikidataProperty[], + format?: UrlResultFormat ): string[]; /** * @alias getManyEntities */ export function getManyEntities(a: { - ids: string | string[]; - languages?: WikidataLanguage | WikidataLanguage[]; - props?: WikidataProperty | WikidataProperty[]; - format?: UrlResultFormat; + ids: string | string[]; + languages?: WikidataLanguage | WikidataLanguage[]; + props?: WikidataProperty | WikidataProperty[]; + format?: UrlResultFormat; }): string[]; /** @@ -147,22 +151,22 @@ export function getManyEntities(a: { * @see {@link https://github.com/maxlath/wikidata-sdk/blob/6b0673b9bf0fcaab19db65e2cc77e33c901ef35d/docs/get_entities.md#by-wikipedia-titles | Github[get_entities.md#by-wikipedia-titles] } */ export function getWikidataIdsFromWikipediaTitles( - titles: string | string[], - sites?: WikidataSite, - languages?: WikidataLanguage | WikidataLanguage[], - props?: WikidataProperty | WikidataProperty[], - format?: UrlResultFormat + titles: string | string[], + sites?: WikidataSite, + languages?: WikidataLanguage | WikidataLanguage[], + props?: WikidataProperty | WikidataProperty[], + format?: UrlResultFormat ): string; /** * @alias getWikidataIdsFromWikipediaTitles */ export function getWikidataIdsFromWikipediaTitles(a: { - titles: string | string[]; - sites?: WikidataSite; - languages?: WikidataLanguage | WikidataLanguage[]; - props?: WikidataProperty | WikidataProperty[]; - format?: UrlResultFormat; + titles: string | string[]; + sites?: WikidataSite; + languages?: WikidataLanguage | WikidataLanguage[]; + props?: WikidataProperty | WikidataProperty[]; + format?: UrlResultFormat; }): string; /** @@ -183,13 +187,13 @@ export function getWikidataIdsFromWikipediaTitles(a: { * {@link https://github.com/maxlath/wikidata-sdk/blob/6b0673b9bf0fcaab19db65e2cc77e33c901ef35d/docs/get_entities_reverse_claims.md#get-entities-reverse-claims | Github[get-entities-reverse-claims] } */ export function getReverseClaims( - property: string | string[], - value: string | string[], - options?: { - limit?: number; - keepProperties?: boolean; - caseInsensitive?: boolean; - } + property: string | string[], + value: string | string[], + options?: { + limit?: number; + keepProperties?: boolean; + caseInsensitive?: boolean; + } ): string; /** @@ -248,7 +252,7 @@ export function isSitelinkKey(a: string): boolean; * * @see {@link https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format#Truthy_statements | Truthy} */ -export function truthyClaims(claims: object): object; +export function truthyClaims(claims: WikidataClaim): WikidataClaim; /** * Filter-out non-truthy claims from an entity.claims[prop] array @@ -276,8 +280,8 @@ export function getSitelinkUrl(site: WikidataSite, title: string): string; export function getSitelinkUrl(a: { site: WikidataSite; title: string }): string; export interface SitelinkData { - lang: string; - project: string; + lang: string; + project: string; } /** * Get the sitelink on english language and the lang of it. @@ -340,7 +344,7 @@ export function wikidataTimeToDateObject(a: string): Date; * @see {@link https://github.com/maxlath/wikidata-sdk/blob/6b0673b9bf0fcaab19db65e2cc77e33c901ef35d/docs/general_helpers.md#wikidatatimetosimpleday | Github[wikidatatimetosimpleday] } * */ -export function wikidataTimeToSimpleDay(a: string | object): string; +export function wikidataTimeToSimpleDay(a: string | Json): string; /** * Get an image URL from a Wikimedia Commons filename @@ -352,113 +356,113 @@ export function wikidataTimeToSimpleDay(a: string | object): string; */ export function getImageUrl(a: string, width?: number): string; -export type SimplifyOption = { - // claims - entityPrefix?: string; - propertyPrefix?: string; - keepRichValues?: boolean; - keepQualifiers?: boolean; - keepReferences?: boolean; - keepIds?: boolean; - keepHashes?: boolean; - keepNonTruthy?: boolean; - // sitelinks - addUrl?: boolean; -}; +export interface SimplifyOption { + // claims + entityPrefix?: string; + propertyPrefix?: string; + keepRichValues?: boolean; + keepQualifiers?: boolean; + keepReferences?: boolean; + keepIds?: boolean; + keepHashes?: boolean; + keepNonTruthy?: boolean; + // sitelinks + addUrl?: boolean; +} /** * Helper method, for simplify result object more reasonable */ export namespace simplify { - /** - * Applying all simplifiers at once: labels, descriptions, aliases, claims, sitelinks. See next sections for details. - * You can also pass options as a second argument, that will then be passed the subfunctions: - * - * @param entity the entity that receive from {@link getEntities} APIs - * @param opt simlify option. currently only simplify claims and simplify sitelinks. - * - * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-entity | Github[simplify-entity]} - */ - export function entity(entity: T, opt?: SimplifyOption): T; + /** + * Applying all simplifiers at once: labels, descriptions, aliases, claims, sitelinks. See next sections for details. + * You can also pass options as a second argument, that will then be passed the subfunctions: + * + * @param entity the entity that receive from {@link getEntities} APIs + * @param opt simlify option. currently only simplify claims and simplify sitelinks. + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-entity | Github[simplify-entity]} + */ + function entity(entity: T, opt?: SimplifyOption): T; - /** - * This is a same of {@link entity} method except this input as multiple array of entities. - * - * @param entities entities from {@link getEntities} APIs - * @param opt simlify option. currently only simplify claims and simplify sitelinks. - * - * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-entities | Github[simplify-entities]} - */ - export function entities(entities: T[], opt?: SimplifyOption): T[]; + /** + * This is a same of {@link entity} method except this input as multiple array of entities. + * + * @param entities entities from {@link getEntities} APIs + * @param opt simlify option. currently only simplify claims and simplify sitelinks. + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-entities | Github[simplify-entities]} + */ + function entities(entities: T[], opt?: SimplifyOption): T[]; - /** - * Make label simplifier and easier to understand - * - * @param labels label object, you will receive this from getEntities method - * - * @example - * - * const label = simplify.labels("{ pl: { language: 'pl', value: 'książka' } }"); - * console.log(label) // { pl: 'książka' } - * - * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-labels | Github[simplify-labels]} - */ - export function labels(labels: WikidataLanguageBaseString): WikidataLanguageBaseStringSimplify; + /** + * Make label simplifier and easier to understand + * + * @param labels label object, you will receive this from getEntities method + * + * @example + * + * const label = simplify.labels("{ pl: { language: 'pl', value: 'książka' } }"); + * console.log(label) // { pl: 'książka' } + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-labels | Github[simplify-labels]} + */ + function labels(labels: WikidataLanguageBaseString): WikidataLanguageBaseStringSimplify; - /** - * Make description simplifier and easier to understand - * - * @param descriptions description object, you will receive this from getEntities method - * - * @example - * - * const desc = simplify.descriptions("{ pl: { language: 'pl', value: 'dokument piśmienniczy [...]' } }"); - * console.log(desc) // { pl: 'dokument piśmienniczy [...]' } - * - * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-descriptions | Github[simplify-descriptions]} - */ - export function descriptions(descriptions: WikidataLanguageBaseString): WikidataLanguageBaseStringSimplify; + /** + * Make description simplifier and easier to understand + * + * @param descriptions description object, you will receive this from getEntities method + * + * @example + * + * const desc = simplify.descriptions("{ pl: { language: 'pl', value: 'dokument piśmienniczy [...]' } }"); + * console.log(desc) // { pl: 'dokument piśmienniczy [...]' } + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-descriptions | Github[simplify-descriptions]} + */ + function descriptions(descriptions: WikidataLanguageBaseString): WikidataLanguageBaseStringSimplify; - /** - * Make alias simplifier and easier to understand - * - * @param aliases alias object, you will receive this from getEntities method - * - * @example - * - * const alias = simplify.aliases("{ pl: [ { language: 'pl', value: 'Tom' }, { language: 'pl', value: 'Tomik' } ] }"); - * console.log(alias) // { pl: [ 'Tom', 'Tomik' ] } - * - * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-aliases | Github[simplify-aliases]} - */ - export function aliases(aliases: WikidataLanguageBaseArrayString): WikidataLanguageBaseArrayStringSimplify; + /** + * Make alias simplifier and easier to understand + * + * @param aliases alias object, you will receive this from getEntities method + * + * @example + * + * const alias = simplify.aliases("{ pl: [ { language: 'pl', value: 'Tom' }, { language: 'pl', value: 'Tomik' } ] }"); + * console.log(alias) // { pl: [ 'Tom', 'Tomik' ] } + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-aliases | Github[simplify-aliases]} + */ + function aliases(aliases: WikidataLanguageBaseArrayString): WikidataLanguageBaseArrayStringSimplify; - /** - * Make sitelink simplifier and easier to understand - * - * @param sitelinks sitelink object, you will receive this from getEntities method - * - * @example - * - * const site = simplify.sitelinks("{ plwiki: { site: 'plwiki', title: 'Książka', badges: [] } }"); - * console.log(site) // { plwiki: 'Książka' } - * - * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-sitelinks | Github[simplify-sitelinks]} - */ - export function sitelinks(sitelinks: WikidataSiteLink): WikidataSiteLinkSimplify; + /** + * Make sitelink simplifier and easier to understand + * + * @param sitelinks sitelink object, you will receive this from getEntities method + * + * @example + * + * const site = simplify.sitelinks("{ plwiki: { site: 'plwiki', title: 'Książka', badges: [] } }"); + * console.log(site) // { plwiki: 'Książka' } + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#simplify-sitelinks | Github[simplify-sitelinks]} + */ + function sitelinks(sitelinks: WikidataSiteLink): WikidataSiteLinkSimplify; - /** - * Make sitelink simplifier and easier to understand. include URL in the result. - * - * @param sitelinks sitelink object, you will receive this from getEntities method - * @param options add url to a result - * - * @example - * - * const site = simplify.sitelinks("{ plwiki: { site: 'plwiki', title: 'Książka', badges: [] } }", {addUrl: true}); - * console.log(site) // { plwiki: { title: 'Książka', url: 'https://pl.wikipedia.org/wiki/Książka' } } - * - * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#add-sitelinks-urls | Github[simplify-sitelinks-with-url]} - */ - export function sitelinks(sitelinks: WikidataSiteLink, options: { addUrl: true }): WikidataSiteLinkWithUrlSimplify; + /** + * Make sitelink simplifier and easier to understand. include URL in the result. + * + * @param sitelinks sitelink object, you will receive this from getEntities method + * @param options add url to a result + * + * @example + * + * const site = simplify.sitelinks("{ plwiki: { site: 'plwiki', title: 'Książka', badges: [] } }", {addUrl: true}); + * console.log(site) // { plwiki: { title: 'Książka', url: 'https://pl.wikipedia.org/wiki/Książka' } } + * + * @see {@link https://github.com/maxlath/wikidata-sdk/blob/master/docs/simplify_entities_data.md#add-sitelinks-urls | Github[simplify-sitelinks-with-url]} + */ + function sitelinks(sitelinks: WikidataSiteLink, options: { addUrl: true }): WikidataSiteLinkWithUrlSimplify; } From 900a8f162194c33518842b97477a4992963953a7 Mon Sep 17 00:00:00 2001 From: pawkrol Date: Thu, 29 Nov 2018 15:17:52 +0100 Subject: [PATCH 041/241] Add import function --- types/mathjs/index.d.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/types/mathjs/index.d.ts b/types/mathjs/index.d.ts index 6cb49323fa..09b4a9d27c 100644 --- a/types/mathjs/index.d.ts +++ b/types/mathjs/index.d.ts @@ -7,6 +7,7 @@ // TypeScript Version: 2.2 import { Decimal } from "decimal.js"; +import { ImportOptions } from "mathjs"; declare const math: math.MathJsStatic; export as namespace math; @@ -2571,6 +2572,18 @@ declare namespace math { * ‘string’, ‘Array’, ‘Date’. */ typeof(x: any): string; + + /** + * Import functions from an object or a module + * @param object An object with functions to be imported. + * @param options An object with import options. + */ + import(object: object | Array, options: ImportOptions); + + /** + * It may not exists - this is _only_ for import functionality. + */ + [key: string]: any; } interface Matrix { @@ -4542,4 +4555,10 @@ declare namespace math { */ typeof(): MathJsChain; } + + interface ImportOptions { + override?: boolean; + silent?: boolean; + wrap?: boolean; + } } From f6e24ebb8e2b2971102c1203dba773d9cffd1ec1 Mon Sep 17 00:00:00 2001 From: pawkrol Date: Thu, 29 Nov 2018 15:19:50 +0100 Subject: [PATCH 042/241] Remove import and add author --- types/mathjs/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mathjs/index.d.ts b/types/mathjs/index.d.ts index 09b4a9d27c..7917ce417e 100644 --- a/types/mathjs/index.d.ts +++ b/types/mathjs/index.d.ts @@ -3,11 +3,11 @@ // Definitions by: Ilya Shestakov , // Andy Patterson , // Brad Besserman +// Pawel Krol // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 import { Decimal } from "decimal.js"; -import { ImportOptions } from "mathjs"; declare const math: math.MathJsStatic; export as namespace math; From 2100292089ba9dee0667b756c02774108b5f696e Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Thu, 29 Nov 2018 21:07:23 +0100 Subject: [PATCH 043/241] [socket.io] add overload for origins method As seen in https://socket.io/docs/server-api/#server-origins-fn --- types/socket.io/index.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/types/socket.io/index.d.ts b/types/socket.io/index.d.ts index f5e6c5fd00..d32fcaade6 100644 --- a/types/socket.io/index.d.ts +++ b/types/socket.io/index.d.ts @@ -143,6 +143,17 @@ declare namespace SocketIO { origins( v: string|string[] ): Server; /** + * Provides a function taking two arguments origin:String + * and callback(error, success), where success is a boolean + * value indicating whether origin is allowed or not. If + * success is set to false, error must be provided as a string + * value that will be appended to the server response, e.g. “Origin not allowed”. + * @param fn The function that will be called to check the origin + * return This Server + */ + origins( fn: ( origin: string, callback: ( error: string | null, success: boolean ) => void ) => void ): Server; + + /** * Attaches socket.io to a server * @param srv The http.Server that we want to attach to * @param opts An optional parameters object From 70368743cc57f09eb5496e417014b260e2517418 Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Thu, 29 Nov 2018 21:10:45 +0100 Subject: [PATCH 044/241] fixed indentation --- types/socket.io/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/socket.io/index.d.ts b/types/socket.io/index.d.ts index d32fcaade6..792fb85167 100644 --- a/types/socket.io/index.d.ts +++ b/types/socket.io/index.d.ts @@ -144,10 +144,10 @@ declare namespace SocketIO { /** * Provides a function taking two arguments origin:String - * and callback(error, success), where success is a boolean - * value indicating whether origin is allowed or not. If - * success is set to false, error must be provided as a string - * value that will be appended to the server response, e.g. “Origin not allowed”. + * and callback(error, success), where success is a boolean + * value indicating whether origin is allowed or not. If + * success is set to false, error must be provided as a string + * value that will be appended to the server response, e.g. “Origin not allowed”. * @param fn The function that will be called to check the origin * return This Server */ From 8cdfef9948972883fe751a3fcb2c5d0badc29a76 Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Thu, 29 Nov 2018 21:11:28 +0100 Subject: [PATCH 045/241] fixed indentation again --- types/socket.io/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/socket.io/index.d.ts b/types/socket.io/index.d.ts index 792fb85167..1a2fb802e6 100644 --- a/types/socket.io/index.d.ts +++ b/types/socket.io/index.d.ts @@ -153,7 +153,7 @@ declare namespace SocketIO { */ origins( fn: ( origin: string, callback: ( error: string | null, success: boolean ) => void ) => void ): Server; - /** + /** * Attaches socket.io to a server * @param srv The http.Server that we want to attach to * @param opts An optional parameters object From b3461ed26b0f4c6bc3d99fa4d1919eba4635a27d Mon Sep 17 00:00:00 2001 From: Javier Gonzalez Date: Thu, 29 Nov 2018 21:12:16 +0100 Subject: [PATCH 046/241] and fixed indentation once more --- types/socket.io/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/socket.io/index.d.ts b/types/socket.io/index.d.ts index 1a2fb802e6..e0abb6e972 100644 --- a/types/socket.io/index.d.ts +++ b/types/socket.io/index.d.ts @@ -153,7 +153,7 @@ declare namespace SocketIO { */ origins( fn: ( origin: string, callback: ( error: string | null, success: boolean ) => void ) => void ): Server; - /** + /** * Attaches socket.io to a server * @param srv The http.Server that we want to attach to * @param opts An optional parameters object From 86e80e4f78aee19a33d0864e5e18403b0a881f86 Mon Sep 17 00:00:00 2001 From: David Brett Date: Fri, 30 Nov 2018 14:12:07 -0500 Subject: [PATCH 047/241] Adding ProgressBarOptions to exports for progress --- types/progress/index.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/types/progress/index.d.ts b/types/progress/index.d.ts index 74596c4c13..6f6e2ea33d 100644 --- a/types/progress/index.d.ts +++ b/types/progress/index.d.ts @@ -10,22 +10,22 @@ /** * These are keys in the options object you can pass to the progress bar along with total as seen in the example above. */ -interface ProgressBarOptions { +export interface ProgressBarOptions { /** * Total number of ticks to complete. */ total: number; - + /** * current completed index */ - curr?: number; - + curr?: number; + /** * head character defaulting to complete character */ - head?: string; - + head?: string; + /** * The displayed width of the progress bar defaulting to total. */ @@ -120,7 +120,7 @@ declare class ProgressBar { * overall completion to. */ update(ratio: number, tokens?: any): void; - + /** * "interrupt" the progress bar and write a message above it. */ @@ -128,7 +128,7 @@ declare class ProgressBar { /** * Terminates a progress bar. - */ + */ terminate(): void; /** @@ -138,4 +138,4 @@ declare class ProgressBar { } declare namespace ProgressBar { } -export = ProgressBar; +export default ProgressBar; From c2cf09838355de2914d34c4b83a22388004274ff Mon Sep 17 00:00:00 2001 From: David Brett Date: Fri, 30 Nov 2018 15:13:16 -0500 Subject: [PATCH 048/241] Adding types for multi-progress --- types/multi-progress/index.d.ts | 42 +++++++++++ types/multi-progress/multi-progress-tests.ts | 18 +++++ types/multi-progress/tsconfig.json | 23 ++++++ types/multi-progress/tslint.json | 79 ++++++++++++++++++++ 4 files changed, 162 insertions(+) create mode 100644 types/multi-progress/index.d.ts create mode 100644 types/multi-progress/multi-progress-tests.ts create mode 100644 types/multi-progress/tsconfig.json create mode 100644 types/multi-progress/tslint.json diff --git a/types/multi-progress/index.d.ts b/types/multi-progress/index.d.ts new file mode 100644 index 0000000000..e1ae12a4e0 --- /dev/null +++ b/types/multi-progress/index.d.ts @@ -0,0 +1,42 @@ +// Type definitions for multi-progress v2.0.0 +// Project: https://github.com/pitaj/multi-progress +// Definitions by: David Brett +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import ProgressBar, { ProgressBarOptions } from '../progress' +import { Stream } from 'stream'; + +declare class MultiProgress { + /** + * Create a new @see MultiProgress with the given stream, or stderr by default + * @param stream A stream to write the progress bars to + */ + constructor(stream?: Stream) + + /** + * Add a new bar + */ + newBar: (format: string, options: ProgressBarOptions) => ProgressBar; + + /** + * Close all bars + */ + terminate: () => void; + + /** + * Render the given progress bar + */ + move: (index: number) => void; + + /** + * Move the bar indicated by index forward the number of steps indicated by value + */ + tick: (index: number, value: number, options?: any) => void; + + /** + * Update the bar indicated by index to the value given + */ + update: (index: number, value: number, options?: any) => void; +} diff --git a/types/multi-progress/multi-progress-tests.ts b/types/multi-progress/multi-progress-tests.ts new file mode 100644 index 0000000000..3397a48428 --- /dev/null +++ b/types/multi-progress/multi-progress-tests.ts @@ -0,0 +1,18 @@ +/** + * Example from https://github.com/pitaj/multi-progress + */ + +// require the library +var MultiProgress = require("multi-progress"); + +// spawn an instance with the optional stream to write to +// use of `new` is optional +var multi = new MultiProgress(process.stderr); + +// create a progress bar +var bar = multi.newBar(' downloading [:bar] :percent :etas', { + complete: '=', + incomplete: ' ', + width: 30, + total: 20 +}); diff --git a/types/multi-progress/tsconfig.json b/types/multi-progress/tsconfig.json new file mode 100644 index 0000000000..72100a32f7 --- /dev/null +++ b/types/multi-progress/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", + "multi-progress-tests.ts" + ] +} \ No newline at end of file diff --git a/types/multi-progress/tslint.json b/types/multi-progress/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/multi-progress/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 37bcddb3e7247ada9dceca821eaaecfbc5cbde4f Mon Sep 17 00:00:00 2001 From: Yu Shimura Date: Sat, 1 Dec 2018 11:55:06 +0900 Subject: [PATCH 049/241] Parsed result now statically typed --- types/binary-parser/binary-parser-tests.ts | 25 +++ types/binary-parser/index.d.ts | 187 ++++++++++++--------- 2 files changed, 133 insertions(+), 79 deletions(-) diff --git a/types/binary-parser/binary-parser-tests.ts b/types/binary-parser/binary-parser-tests.ts index d0d09e5ef7..9eca89211c 100644 --- a/types/binary-parser/binary-parser-tests.ts +++ b/types/binary-parser/binary-parser-tests.ts @@ -93,3 +93,28 @@ const parser5 = new Parser() length: '4', formatter: (arr) => { } }); + +const parser6 = new Parser() + .nest("nested", { + type: new Parser() + .array("points", { + type: new Parser() + .uint8("x") + .uint8("y"), + length: 2 + }) + }) + .choice("optional", { + tag: "nested.points[0].x", + choices: { + 1: new Parser() + .uint8("number") + } + }); + +const result = parser6.parse(Buffer.from([0x01, 0x02, 0x03, 0x04, 0x05])); + +// See the inferred static types on the IntelliSense. +result.nested.points[0].x; +result.nested.points[1].y; +result.optional.number; diff --git a/types/binary-parser/index.d.ts b/types/binary-parser/index.d.ts index 657996bd8d..b16f433e55 100644 --- a/types/binary-parser/index.d.ts +++ b/types/binary-parser/index.d.ts @@ -1,88 +1,117 @@ // Type definitions for binary-parser 1.3 // Project: https://github.com/keichi/binary-parser -// Definitions by: Benjamin Riggs , Dolan Miu +// Definitions by: Benjamin Riggs , +// Dolan Miu , +// Yu Shimura // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 /// -export interface Parser { - parse(buffer: Buffer, callback?: (err?: Error, result?: any) => void): Parser.Parsed; +export interface Parser { + parse(buffer: Buffer, callback?: (err?: Error, result?: any) => void): Parser.Parsed; create(constructorFunction: ObjectConstructor): Parser; - int8(name: string, options?: Parser.Options): Parser; - uint8(name: string, options?: Parser.Options): Parser; + int8(name: N, options?: Parser.Options): Parser.Next; + uint8(name: N, options?: Parser.Options): Parser.Next; - int16(name: string, options?: Parser.Options): Parser; - uint16(name: string, options?: Parser.Options): Parser; - int16le(name: string, options?: Parser.Options): Parser; - int16be(name: string, options?: Parser.Options): Parser; - uint16le(name: string, options?: Parser.Options): Parser; - uint16be(name: string, options?: Parser.Options): Parser; + int16(name: N, options?: Parser.Options): Parser.Next; + uint16(name: N, options?: Parser.Options): Parser.Next; + int16le(name: N, options?: Parser.Options): Parser.Next; + int16be(name: N, options?: Parser.Options): Parser.Next; + uint16le(name: N, options?: Parser.Options): Parser.Next; + uint16be(name: N, options?: Parser.Options): Parser.Next; - int32(name: string, options?: Parser.Options): Parser; - uint32(name: string, options?: Parser.Options): Parser; - int32le(name: string, options?: Parser.Options): Parser; - int32be(name: string, options?: Parser.Options): Parser; - uint32le(name: string, options?: Parser.Options): Parser; - uint32be(name: string, options?: Parser.Options): Parser; + int32(name: N, options?: Parser.Options): Parser.Next; + uint32(name: N, options?: Parser.Options): Parser.Next; + int32le(name: N, options?: Parser.Options): Parser.Next; + int32be(name: N, options?: Parser.Options): Parser.Next; + uint32le(name: N, options?: Parser.Options): Parser.Next; + uint32be(name: N, options?: Parser.Options): Parser.Next; - bit1(name: string, options?: Parser.Options): Parser; - bit2(name: string, options?: Parser.Options): Parser; - bit3(name: string, options?: Parser.Options): Parser; - bit4(name: string, options?: Parser.Options): Parser; - bit5(name: string, options?: Parser.Options): Parser; - bit6(name: string, options?: Parser.Options): Parser; - bit7(name: string, options?: Parser.Options): Parser; - bit8(name: string, options?: Parser.Options): Parser; - bit9(name: string, options?: Parser.Options): Parser; - bit10(name: string, options?: Parser.Options): Parser; - bit11(name: string, options?: Parser.Options): Parser; - bit12(name: string, options?: Parser.Options): Parser; - bit13(name: string, options?: Parser.Options): Parser; - bit14(name: string, options?: Parser.Options): Parser; - bit15(name: string, options?: Parser.Options): Parser; - bit16(name: string, options?: Parser.Options): Parser; - bit17(name: string, options?: Parser.Options): Parser; - bit18(name: string, options?: Parser.Options): Parser; - bit19(name: string, options?: Parser.Options): Parser; - bit20(name: string, options?: Parser.Options): Parser; - bit21(name: string, options?: Parser.Options): Parser; - bit22(name: string, options?: Parser.Options): Parser; - bit23(name: string, options?: Parser.Options): Parser; - bit24(name: string, options?: Parser.Options): Parser; - bit25(name: string, options?: Parser.Options): Parser; - bit26(name: string, options?: Parser.Options): Parser; - bit27(name: string, options?: Parser.Options): Parser; - bit28(name: string, options?: Parser.Options): Parser; - bit29(name: string, options?: Parser.Options): Parser; - bit30(name: string, options?: Parser.Options): Parser; - bit31(name: string, options?: Parser.Options): Parser; - bit32(name: string, options?: Parser.Options): Parser; + bit1(name: N, options?: Parser.Options): Parser.Next; + bit2(name: N, options?: Parser.Options): Parser.Next; + bit3(name: N, options?: Parser.Options): Parser.Next; + bit4(name: N, options?: Parser.Options): Parser.Next; + bit5(name: N, options?: Parser.Options): Parser.Next; + bit6(name: N, options?: Parser.Options): Parser.Next; + bit7(name: N, options?: Parser.Options): Parser.Next; + bit8(name: N, options?: Parser.Options): Parser.Next; + bit9(name: N, options?: Parser.Options): Parser.Next; + bit10(name: N, options?: Parser.Options): Parser.Next; + bit11(name: N, options?: Parser.Options): Parser.Next; + bit12(name: N, options?: Parser.Options): Parser.Next; + bit13(name: N, options?: Parser.Options): Parser.Next; + bit14(name: N, options?: Parser.Options): Parser.Next; + bit15(name: N, options?: Parser.Options): Parser.Next; + bit16(name: N, options?: Parser.Options): Parser.Next; + bit17(name: N, options?: Parser.Options): Parser.Next; + bit18(name: N, options?: Parser.Options): Parser.Next; + bit19(name: N, options?: Parser.Options): Parser.Next; + bit20(name: N, options?: Parser.Options): Parser.Next; + bit21(name: N, options?: Parser.Options): Parser.Next; + bit22(name: N, options?: Parser.Options): Parser.Next; + bit23(name: N, options?: Parser.Options): Parser.Next; + bit24(name: N, options?: Parser.Options): Parser.Next; + bit25(name: N, options?: Parser.Options): Parser.Next; + bit26(name: N, options?: Parser.Options): Parser.Next; + bit27(name: N, options?: Parser.Options): Parser.Next; + bit28(name: N, options?: Parser.Options): Parser.Next; + bit29(name: N, options?: Parser.Options): Parser.Next; + bit30(name: N, options?: Parser.Options): Parser.Next; + bit31(name: N, options?: Parser.Options): Parser.Next; + bit32(name: N, options?: Parser.Options): Parser.Next; - float(name: string, options?: Parser.Options): Parser; - floatle(name: string, options?: Parser.Options): Parser; - floatbe(name: string, options?: Parser.Options): Parser; + float(name: N, options?: Parser.Options): Parser.Next; + floatle(name: N, options?: Parser.Options): Parser.Next; + floatbe(name: N, options?: Parser.Options): Parser.Next; - double(name: string, options?: Parser.Options): Parser; - doublele(name: string, options?: Parser.Options): Parser; - doublebe(name: string, options?: Parser.Options): Parser; + double(name: N, options?: Parser.Options): Parser.Next; + doublele(name: N, options?: Parser.Options): Parser.Next; + doublebe(name: N, options?: Parser.Options): Parser.Next; - string(name: string, options?: Parser.StringOptions): Parser; + string(name: N, options?: Parser.StringOptions): Parser.Next; - buffer(name: string, options: Parser.BufferOptions): Parser; + buffer(name: N, options: Parser.BufferOptions): Parser.Next; - array(name: string, options: Parser.ArrayOptions): Parser; + array(name: N, options: Q): Parser.Next + ? O extends undefined ? Array<{}> : O[] + : T extends string + ? number[] + : never + : never + >; - choice(name: string, options: Parser.ChoiceOptions): Parser; + choice(name: N, options: Q): Parser.Next + ? O extends undefined ? {} : O + : T extends string ? any : never + : never + : never + >; - nest(name: string, options: Parser.NestOptions): Parser; + nest(name: N, options: Q): Parser.Next + ? O extends undefined ? {} : O + : never + : never + >; - skip(length: number): Parser; + skip(length: number): Parser; - endianess(endianess: Parser.Endianness): Parser; /* [sic] */ + endianess(endianess: Parser.Endianness): Parser; /* [sic] */ - namely(alias: string): Parser; + namely(alias: string): Parser; compile(): void; @@ -96,10 +125,8 @@ export interface ParserConstructor { export const Parser: ParserConstructor; export namespace Parser { - type Data = number | string | Array | Parsed | Buffer; - interface Parsed { - [name: string]: Data; - } + type Data = number | string | Array> | Parser | Buffer; + type Parsed = O extends undefined ? {} : O; interface Options { formatter?: ((value: Data) => any); @@ -108,7 +135,7 @@ export namespace Parser { interface StringOptions extends Options { encoding?: string; - length?: number | string | ((this: Parsed) => number); + length?: number | string | ((this: Parser) => number); zeroTerminated?: boolean; greedy?: boolean; stripNull?: boolean; @@ -116,32 +143,34 @@ export namespace Parser { interface BufferOptions extends Options { clone?: boolean; - length?: number | string | ((this: Parsed) => number); + length?: number | string | ((this: Parser) => number); readUntil?: string | ((item: number, buffer: Buffer) => boolean); } interface ArrayOptions extends Options { - type: string | Parser; - length?: number | string | ((this: Parsed) => number); - lengthInBytes?: number | string | ((this: Parsed) => number); + type: string | Parser; + length?: number | string | ((this: Parser) => number); + lengthInBytes?: number | string | ((this: Parser) => number); readUntil?: string | ((item: number, buffer: Buffer) => boolean); } interface ChoiceOptions extends Options { - tag: string | ((this: Parsed) => number); - choices: { [item: number]: Parser | string }; - defaultChoice?: Parser | string; + tag: string | ((this: Parser) => number); + choices: { [item: number]: Parser | string }; + defaultChoice?: Parser | string; } interface NestOptions extends Options { - type: Parser | string; + type: Parser; } type Endianness = 'little' | 'big'; - interface Context { - [name: string]: Parsed; - } + type Valid = + O extends undefined ? P : O & P; + + type Next = + Parser>; } From 1aa8969874dbfcba59ec66cebd97a8c51bac9c19 Mon Sep 17 00:00:00 2001 From: Nikola Malovic Date: Sun, 2 Dec 2018 12:29:37 +0100 Subject: [PATCH 050/241] Options id i snot a number only --- types/react-data-grid/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-data-grid/index.d.ts b/types/react-data-grid/index.d.ts index b41c2c2501..94d8af72d9 100644 --- a/types/react-data-grid/index.d.ts +++ b/types/react-data-grid/index.d.ts @@ -583,7 +583,7 @@ declare namespace AdazzleReactDataGrid { declare namespace AdazzleReactDataGridPlugins { interface AutoCompleteEditorProps { onCommit?: () => void; - options?: Array<{ id: number; title: string }>; + options?: Array<{ id: any; title: string }>; label?: any; value?: any; height?: number; From 76d38d894f396cf0084f70d88c6ff1bc3ad79eaf Mon Sep 17 00:00:00 2001 From: Glen Date: Sun, 2 Dec 2018 14:05:33 +0200 Subject: [PATCH 051/241] hoverBackgroundColor and hoverBorderColor should accept Color/Color[] --- types/chart.js/chart.js-tests.ts | 6 +++++- types/chart.js/index.d.ts | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/types/chart.js/chart.js-tests.ts b/types/chart.js/chart.js-tests.ts index 705392baed..fd5ed53e80 100644 --- a/types/chart.js/chart.js-tests.ts +++ b/types/chart.js/chart.js-tests.ts @@ -9,7 +9,9 @@ const plugin = { } }; -const chart: Chart = new Chart(new CanvasRenderingContext2D(), { +const ctx = new CanvasRenderingContext2D(); + +const chart: Chart = new Chart(ctx, { type: "bar", plugins: [plugin, plugin], data: { @@ -17,6 +19,8 @@ const chart: Chart = new Chart(new CanvasRenderingContext2D(), { datasets: [ { backgroundColor: "#000000", + hoverBackgroundColor: ctx.createLinearGradient(0, 0, 0, 100), + hoverBorderColor: ctx.createLinearGradient(0, 0, 0, 100), borderWidth: 1, label: "test", data: [1, null, 3] diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 884ddaa760..2803def896 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -554,8 +554,8 @@ declare namespace Chart { borderSkipped?: PositionType; data?: Array | ChartPoint[]; fill?: boolean | number | string; - hoverBackgroundColor?: string | string[]; - hoverBorderColor?: string | string[]; + hoverBackgroundColor?: ChartColor | ChartColor[]; + hoverBorderColor?: ChartColor | ChartColor[]; hoverBorderWidth?: number | number[]; label?: string; lineTension?: number; From dc80f4fdbb210e70c3ba2b8c4e02b50c501bd027 Mon Sep 17 00:00:00 2001 From: Dima Smirnov Date: Sun, 2 Dec 2018 15:32:55 +0300 Subject: [PATCH 052/241] added fn type for order --- types/sequelize/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index f25aacc3e4..4ab0ee11a8 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3330,7 +3330,7 @@ declare namespace sequelize { * first element is the column / function to order by, the second is the direction. For example: * `order: [['name', 'DESC']]`. In this way the column will be escaped, but the direction will not. */ - order?: string | col | literal | Array | { model: Model, as?: string }> | Array | { model: Model, as?: string }>>; + order?: string | col | literal | Array | { model: Model, as?: string } | fn> | fn | Array | { model: Model, as?: string }| fn>| fn>; /** * Limit the results @@ -5240,13 +5240,13 @@ declare namespace sequelize { * `this.constructor.prototype.find.apply(this, arguments)` */ classMethods?: Object; - + /** * Change the database schema. PG only feature, but also works with other dialects. */ schema?: string; - - + + /** * Change the database schema delimiter. Defaults to "." on PG but for other dialects can be also changed to "_". */ From c8b9249b2b51ecb7920617e8ddf101633bb90f91 Mon Sep 17 00:00:00 2001 From: Dima Smirnov Date: Sun, 2 Dec 2018 15:35:40 +0300 Subject: [PATCH 053/241] added tests for order with order --- types/sequelize/sequelize-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 6b7ea6ea0a..4f0520ff84 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -946,6 +946,8 @@ User.findAll( { where : { user_id : 1 }, attributes : ['a', 'b'], include : [{ m User.findAll( { order : s.literal( 'email =' ) } ); User.findAll( { order : [s.literal( 'email = ' + s.escape( 'test@sequelizejs.com' ) )] } ); User.findAll( { order : [['id', ';DELETE YOLO INJECTIONS']] } ); +User.findAll( { order : Sequelize.random() } ); +User.findAll( { order : [Sequelize.random()] } ); User.findAll( { include : [User], order : [[User, 'id', ';DELETE YOLO INJECTIONS']] } ); User.findAll( { include : [User], order : [['id', 'ASC NULLS LAST'], [User, 'id', 'DESC NULLS FIRST']] } ); User.findAll( { include : [{ model : User, where : { title : 'DoDat' }, include : [{ model : User }] }] } ); From dcbe9083a25abff7d02ed78d64f7bc056db4f849 Mon Sep 17 00:00:00 2001 From: Dima Smirnov Date: Sun, 2 Dec 2018 15:39:14 +0300 Subject: [PATCH 054/241] updated tests to use s. --- types/sequelize/sequelize-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 4f0520ff84..943fed79e3 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -946,8 +946,8 @@ User.findAll( { where : { user_id : 1 }, attributes : ['a', 'b'], include : [{ m User.findAll( { order : s.literal( 'email =' ) } ); User.findAll( { order : [s.literal( 'email = ' + s.escape( 'test@sequelizejs.com' ) )] } ); User.findAll( { order : [['id', ';DELETE YOLO INJECTIONS']] } ); -User.findAll( { order : Sequelize.random() } ); -User.findAll( { order : [Sequelize.random()] } ); +User.findAll( { order : s.random() } ); +User.findAll( { order : [s.random()] } ); User.findAll( { include : [User], order : [[User, 'id', ';DELETE YOLO INJECTIONS']] } ); User.findAll( { include : [User], order : [['id', 'ASC NULLS LAST'], [User, 'id', 'DESC NULLS FIRST']] } ); User.findAll( { include : [{ model : User, where : { title : 'DoDat' }, include : [{ model : User }] }] } ); From cefa24199f09265e6dec5b0ddddc0bd0b229ab82 Mon Sep 17 00:00:00 2001 From: Dima Smirnov Date: Sun, 2 Dec 2018 15:50:21 +0300 Subject: [PATCH 055/241] increased the version number in the header --- types/sequelize/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 4ab0ee11a8..06f27421cb 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Sequelize 4.27.10 +// Type definitions for Sequelize 4.27.11 // Project: http://sequelizejs.com // Definitions by: samuelneff // Peter Harris @@ -15,6 +15,7 @@ // Nick Schultz // Thomas Breleur // Antoine Boisadam +// Dima Smirnov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 From 25db1d4746951c960276b85740fe375f83c5629b Mon Sep 17 00:00:00 2001 From: Ivan Fernandes Date: Sun, 2 Dec 2018 19:13:47 -0200 Subject: [PATCH 056/241] adding missing options from option type --- types/passport-bnet/index.d.ts | 21 ++++++++++----------- types/passport-oauth2/index.d.ts | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/types/passport-bnet/index.d.ts b/types/passport-bnet/index.d.ts index 86255c782d..c8e6dd923c 100644 --- a/types/passport-bnet/index.d.ts +++ b/types/passport-bnet/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import { Strategy as OAuth2Strategy, VerifyFunction, VerifyFunctionWithRequest } from 'passport-oauth2'; +import { Strategy as OAuth2Strategy, VerifyFunction, VerifyFunctionWithRequest, _StrategyOptionsBase } from 'passport-oauth2'; declare class BnetStrategy extends OAuth2Strategy { constructor(options: BnetStrategy.StrategyOptions, verify: VerifyFunction); @@ -12,17 +12,16 @@ declare class BnetStrategy extends OAuth2Strategy { } declare namespace BnetStrategy { - interface _BaseBnetOptions { - region?: string; - scopeSeparator?: string; - customHeaders?: object; - authorizationURL?: string; - tokenURL?: string; - scope?: string; - clientID: string; - clientSecret: string; - callbackURL?: string; + //Utility types for excluding properties from interfaces + type Diff = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; + type Omit = Pick>; + + // passport--bnet accepts any options that passport-oauth2 accepts, but add the option region and makes authorizationURL and tokenURL optional + interface _BaseBnetOptions + extends Partial>, Omit<_StrategyOptionsBase, 'authorizationURL' | 'tokenURL'> { + + region?: string; } interface StrategyOptions extends _BaseBnetOptions { diff --git a/types/passport-oauth2/index.d.ts b/types/passport-oauth2/index.d.ts index d985852bd6..c3723b50b7 100644 --- a/types/passport-oauth2/index.d.ts +++ b/types/passport-oauth2/index.d.ts @@ -9,6 +9,7 @@ import { Request } from 'express'; import { Strategy } from 'passport'; import { OAuth2 } from 'oauth'; +import { OutgoingHttpHeaders } from 'http'; declare class OAuth2Strategy extends Strategy { name: string; @@ -32,6 +33,23 @@ declare class OAuth2Strategy extends Strategy { } declare namespace OAuth2Strategy { + interface Metadata { + authorizationURL: string; + tokenURL: string; + clientID: string; + } + + type StateStoreStoreCallback = (err: Error | null, state: any) => void; + type StateStoreVerifyCallback = (err: Error, ok: boolean, state: any) => void + + interface StateStore { + store(req: Request, callback: StateStoreStoreCallback): void; + store(req: Request, meta: Metadata, callback: StateStoreStoreCallback): void; + + verify(req: Request, state: string, callback: StateStoreVerifyCallback): void; + verify(req: Request, state: string, meta: Metadata, callback: StateStoreVerifyCallback): void; + } + type VerifyCallback = (err?: Error | null, user?: object, info?: object) => void; type VerifyFunction = @@ -47,6 +65,11 @@ declare namespace OAuth2Strategy { clientID: string; clientSecret: string; callbackURL?: string; + customHeaders?: OutgoingHttpHeaders; + scope?: string | string[]; + sessionKey?: string; + store?: StateStore; + state?: any; } interface StrategyOptions extends _StrategyOptionsBase { passReqToCallback?: false; From b5ca615a9891b341dc8e8511fd1b1992578d587d Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Sun, 2 Dec 2018 22:35:24 +0100 Subject: [PATCH 057/241] Add json_ml --- types/json_ml/index.d.ts | 20 ++++++++++++++++++++ types/json_ml/json_ml-tests.ts | 12 ++++++++++++ types/json_ml/tsconfig.json | 16 ++++++++++++++++ types/json_ml/tslint.json | 1 + 4 files changed, 49 insertions(+) create mode 100644 types/json_ml/index.d.ts create mode 100644 types/json_ml/json_ml-tests.ts create mode 100644 types/json_ml/tsconfig.json create mode 100644 types/json_ml/tslint.json diff --git a/types/json_ml/index.d.ts b/types/json_ml/index.d.ts new file mode 100644 index 0000000000..ba53b84cb4 --- /dev/null +++ b/types/json_ml/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for json_ml 0.0 +// Project: https://github.com/59naga/json-ml +// Definitions by: Alan Plum +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export type Node = string | Element; +export type SimpleElement = [string, Attributes] | [string]; +export interface NodeList extends Array {} +export type Element = SimpleElement & NodeList; +export interface Attributes { + [key: string]: string; +} +export function parse(xml: string, trim?: boolean): Node[]; +export function stringify( + object: Node[], + replacer?: ((node: Cheerio) => any) | null, + indent?: number +): string; diff --git a/types/json_ml/json_ml-tests.ts b/types/json_ml/json_ml-tests.ts new file mode 100644 index 0000000000..ecc84d9d8b --- /dev/null +++ b/types/json_ml/json_ml-tests.ts @@ -0,0 +1,12 @@ +/// +import { Attributes, Element, Node, parse, stringify } from "json_ml"; + +const nodes: Node[] = parse("
  • hello
"); +const node1: Node = nodes[0]; +if (typeof node1 !== "string") { + const el: Element = node1; + const attrs = el[1] as Attributes; + console.log(el[0], attrs); +} + +console.log(stringify(nodes, el => (el.is("li") ? null : el), 2)); diff --git a/types/json_ml/tsconfig.json b/types/json_ml/tsconfig.json new file mode 100644 index 0000000000..951405762a --- /dev/null +++ b/types/json_ml/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "json_ml-tests.ts"] +} diff --git a/types/json_ml/tslint.json b/types/json_ml/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/json_ml/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 1184370cda953a282150eea2c4e32e14d81279f3 Mon Sep 17 00:00:00 2001 From: tassadarliu Date: Mon, 3 Dec 2018 17:52:45 +0800 Subject: [PATCH 058/241] [Convict] get autocomplete for format --- types/convict/index.d.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/types/convict/index.d.ts b/types/convict/index.d.ts index 2c3dbf0547..8be23f1547 100644 --- a/types/convict/index.d.ts +++ b/types/convict/index.d.ts @@ -37,6 +37,20 @@ declare namespace convict { parse: (content: string) => any; } + type PredefinedFormat = + | '*' + | 'int' + | 'port' + | 'windows_named_pipe' + | 'port_or_windows_named_pipe' + | 'url' + | 'email' + | 'ipaddress' + | 'duration' + | 'timestamp' + | 'nat' + | String; + interface SchemaObj { default: T; doc?: string; @@ -52,7 +66,7 @@ declare namespace convict { * If omitted, format will be set to the value of Object.prototype.toString.call * for the default value */ - format?: string | any[] | ((val: any) => void); + format?: PredefinedFormat | any[] | ((val: any) => void); env?: string; arg?: string; sensitive?: boolean; From d08aba397844405c08995fe0728d0d9c82ccf512 Mon Sep 17 00:00:00 2001 From: Jessica Date: Mon, 3 Dec 2018 20:11:17 +0900 Subject: [PATCH 059/241] Fix overly permissible first argument to css, styled() and createGlobalStyle --- types/styled-components/index.d.ts | 38 +++++------ types/styled-components/test/index.tsx | 91 ++++++++++++++++++++++++-- 2 files changed, 103 insertions(+), 26 deletions(-) diff --git a/types/styled-components/index.d.ts b/types/styled-components/index.d.ts index 2f6fa61317..ca3ff22c0e 100644 --- a/types/styled-components/index.d.ts +++ b/types/styled-components/index.d.ts @@ -73,7 +73,7 @@ export type SimpleInterpolation = | InterpolationValue | FlattenSimpleInterpolation; // must be an interface to be self-referential -interface FlattenSimpleInterpolation +export interface FlattenSimpleInterpolation extends ReadonlyArray {} export type InterpolationFunction

= (props: P) => Interpolation

; @@ -176,10 +176,9 @@ export interface ThemedStyledFunctionBase< ( first: | TemplateStringsArray - | NonNullable< - Interpolation< - ThemedStyledProps & O, T> - > + | CSSObject + | InterpolationFunction< + ThemedStyledProps & O, T> >, ...rest: Array< Interpolation< @@ -187,17 +186,12 @@ export interface ThemedStyledFunctionBase< > > ): StyledComponent; - // at least the first argument is required, whatever it is ( first: | TemplateStringsArray - | NonNullable< - Interpolation< - ThemedStyledProps< - StyledComponentPropsWithRef & O & U, - T - > - > + | CSSObject + | InterpolationFunction< + ThemedStyledProps & O & U, T> >, ...rest: Array< Interpolation< @@ -288,19 +282,21 @@ export type StyledInterface = ThemedStyledInterface; export interface BaseThemedCssFunction { ( - first: TemplateStringsArray | NonNullable, + first: TemplateStringsArray | CSSObject, ...interpolations: SimpleInterpolation[] ): FlattenSimpleInterpolation; ( first: | TemplateStringsArray - | NonNullable>>, + | CSSObject + | InterpolationFunction>, ...interpolations: Array>> ): FlattenInterpolation>;

( first: | TemplateStringsArray - | NonNullable>>, + | CSSObject + | InterpolationFunction>, ...interpolations: Array>> ): FlattenInterpolation>; } @@ -333,7 +329,8 @@ export interface ThemedStyledComponentsModule< createGlobalStyle

( first: | TemplateStringsArray - | NonNullable>>, + | CSSObject + | InterpolationFunction>, ...interpolations: Array>> ): GlobalStyleComponent; @@ -405,7 +402,8 @@ export function keyframes( export function createGlobalStyle

( first: | TemplateStringsArray - | NonNullable>>, + | CSSObject + | InterpolationFunction>, ...interpolations: Array>> ): GlobalStyleComponent; @@ -468,7 +466,7 @@ export class StyleSheetManager extends React.Component< */ // ONLY string literals and inline invocations of css`` are supported, anything else crashes the plugin export type CSSProp> = - string | - FlattenInterpolation>; + | string + | FlattenInterpolation>; export default styled; diff --git a/types/styled-components/test/index.tsx b/types/styled-components/test/index.tsx index 2d70f74106..d382b42628 100644 --- a/types/styled-components/test/index.tsx +++ b/types/styled-components/test/index.tsx @@ -14,7 +14,10 @@ import styled, { withTheme, ThemeConsumer, StyledComponent, - ThemedStyledComponentsModule + ThemedStyledComponentsModule, + FlattenSimpleInterpolation, + SimpleInterpolation, + FlattenInterpolation } from "styled-components"; import {} from "styled-components/cssprop"; @@ -101,13 +104,13 @@ const fadeIn = keyframes` `; const showAnimation = css` - opacity: 1; - transform: scale(1) translateY(0); + opacity: 1; + transform: scale(1) translateY(0); `; const hideAnimation = css` - opacity: 0; - transform: scale(0.95, 0.8) translateY(20px); + opacity: 0; + transform: scale(0.95, 0.8) translateY(20px); `; const entryAnimation = keyframes` @@ -694,6 +697,8 @@ async function typedThemes() { return props.theme.color; }}; `; + // can't use a FlattenInterpolation as the first argument, would make broken css + // $ExpectError const ThemedDiv4 = styled.div(themedCss); const themedCssWithNesting = css(props => ({ @@ -714,7 +719,6 @@ async function typedThemes() { - {theme => { // $ExpectType string @@ -867,3 +871,78 @@ function cssProp() { ); } + +function validateArgumentsAndReturns() { + const t1: FlattenSimpleInterpolation[] = [ + css({ color: "blue" }), + css` + color: blue; + `, + css` + color: ${"blue"}; + ` + ]; + const t4: FlattenInterpolation = [ + css` + color: ${() => "blue"}; + `, + css(() => ({ color: "blue" })), + css( + () => + css` + color: "blue"; + ` + ) + ]; + + // if the first argument is array-like it's always treated as a string[], this breaks things + css( + // $ExpectError + css` + ${{ color: "blue" }} + ` + ); + // _technically_ valid as styled-components doesn't look at .raw but best not to support it + // $ExpectError + css([]); + + styled.div({ color: "blue" }); + styled.div(props => ({ color: props.theme.color })); + styled.div` + color: ${"blue"}; + `; + // These don't work for the same reason css doesn't work + styled.div( + // $ExpectError + css` + ${{ color: "blue" }} + ` + ); + // $ExpectError + styled.div([]); + + createGlobalStyle({ + ":root": { + color: "blue" + } + }); + createGlobalStyle` + :root { + color: blue; + } + `; + createGlobalStyle(() => ({ + ":root": { + color: "blue" + } + })); + // these are invalid for the same reason as in styled.div + // $ExpectError + createGlobalStyle(css` + :root { + color: ${() => "blue"}; + } + `); + // $ExpectError + createGlobalStyle([]); +} From f425f279923d7409a31bbdfdf2816db13ad454f4 Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Mon, 3 Dec 2018 19:02:05 +0100 Subject: [PATCH 060/241] Changed filterBy See https://github.com/ericgio/react-bootstrap-typeahead/blob/116c5cdc7443099a0455757558108c6082b347f1/docs/Upgrading.md#v30 --- types/react-bootstrap-typeahead/index.d.ts | 13 ++++++++++++- .../react-bootstrap-typeahead-tests.tsx | 8 ++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index fa970bc5b3..d0bfcea9a7 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -3,12 +3,23 @@ // Definitions by: Guymestef // Rajab Shakirov // Paito Anderson +// Andreas Richter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 // TODO: ,

, , components import * as React from 'react'; +export interface TypeaheadFilterbyProps { + filterBy: string[]; + labelKey: (string | (() => void)); + multiple: boolean; + selected: any[]; + caseSensitive: boolean; + ignoreDiacritics: boolean; + text: string; +} + export interface TypeaheadProps { /* For localized accessibility: Should return a string indicating the number of results for screen readers. Receives the current results. */ a11yNumResults?: () => void; @@ -58,7 +69,7 @@ export interface TypeaheadProps { emptyLabel?: string; /* Either an array of fields in option to search, or a custom filtering callback. */ - filterBy?: (string[] | ((option: T | string, text: string) => boolean)); + filterBy?: (string[] | ((option: T | string, props: TypeaheadFilterbyProps) => boolean)); /* Highlights the menu item if there is only one result and allows selecting that item by hitting enter. Does not work with allowNew. */ diff --git a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx index 10237b1fa0..6c9143dfea 100644 --- a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx +++ b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx @@ -28,6 +28,14 @@ class BasicExample extends React.Component { onInputChange={(value, e) => {}} placeholder="Choose a state..." /> + (props.text.indexOf(option) !== -1) } + placeholder="Choose a state..." + /> ); } From 672ec749ab95fa2893469c2a2ebd6badb4336d58 Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Mon, 3 Dec 2018 19:12:14 +0100 Subject: [PATCH 061/241] Increase version --- types/react-bootstrap-typeahead/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index d0bfcea9a7..89188c8b86 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-bootstrap-typeahead 3.2 +// Type definitions for react-bootstrap-typeahead 3.2.2 // Project: https://github.com/ericgio/react-bootstrap-typeahead // Definitions by: Guymestef // Rajab Shakirov From 4b872aca1265d8ba44347fbdc33c204d9c123f33 Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Mon, 3 Dec 2018 19:19:10 +0100 Subject: [PATCH 062/241] Fixed version... --- types/react-bootstrap-typeahead/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 89188c8b86..9fa23ac5f5 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-bootstrap-typeahead 3.2.2 +// Type definitions for react-bootstrap-typeahead 3.3 // Project: https://github.com/ericgio/react-bootstrap-typeahead // Definitions by: Guymestef // Rajab Shakirov From d944d9c929913c6c3bce93eea1ecc485dfa2bc5d Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Mon, 3 Dec 2018 20:20:12 +0100 Subject: [PATCH 063/241] Added definitions for Highlighter, Menu and MenuItem --- types/react-bootstrap-typeahead/index.d.ts | 56 +++++++++++++++---- .../react-bootstrap-typeahead-tests.tsx | 27 ++++++++- 2 files changed, 72 insertions(+), 11 deletions(-) diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 9fa23ac5f5..2c0495ce03 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-bootstrap-typeahead 3.3 +// Type definitions for react-bootstrap-typeahead 3.4 // Project: https://github.com/ericgio/react-bootstrap-typeahead // Definitions by: Guymestef // Rajab Shakirov @@ -6,18 +6,23 @@ // Andreas Richter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -// TODO: , , , components +// TODO: components import * as React from 'react'; +import * as CSS from 'csstype'; export interface TypeaheadFilterbyProps { - filterBy: string[]; - labelKey: (string | (() => void)); - multiple: boolean; - selected: any[]; - caseSensitive: boolean; - ignoreDiacritics: boolean; - text: string; + filterBy: string[]; + labelKey: (string | (() => void)); + multiple: boolean; + selected: any[]; + caseSensitive: boolean; + ignoreDiacritics: boolean; + text: string; +} + +export interface TypeaheadMenuProps { + text: string; } export interface TypeaheadProps { @@ -149,7 +154,7 @@ export interface TypeaheadProps { renderMenu?: (results: Array, menuProps: any) => any; /* Provides a hook for customized rendering of menu item contents. */ - renderMenuItemChildren?: (option: T, props: TypeaheadProps, index: number) => any; + renderMenuItemChildren?: (option: T, props: TypeaheadMenuProps, index: number) => any; /* Provides a hook for customized rendering of tokens when multiple selections are enabled. */ renderToken?: (selectedItem: T | string, onRemove: () => void) => any; @@ -184,3 +189,34 @@ export interface AsyncTypeaheadProps extends TypeaheadProps { } export const AsyncTypeahead: React.ClassicComponentClass>; + +export interface HighligherProps { + key: string; + search: string; +} + +export const Highlighter: React.ClassicComponentClass>; + +export interface MenuProps { + id: string; + className?: string; + emptyLabel?: string; + innerRef?: string; + maxHeight?: string; + style?: CSS.Properties; +} + +export const Menu: React.ClassicComponentClass>; + +export interface MenuItemProps { + option: T; + position: number; + label?: string; + active?: boolean; + className?: string; + disabled?: boolean; + onClick?: (e: Event) => any; + onMouseDown?: (e: Event) => any; +} + +export const MenuItem: React.ClassicComponentClass>; diff --git a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx index 6c9143dfea..5fcbe15328 100644 --- a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx +++ b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Typeahead } from 'react-bootstrap-typeahead'; +import { Typeahead, Highlighter, Menu, MenuItem } from 'react-bootstrap-typeahead'; const options = [ { name: 'Alabama', population: 4780127, capital: 'Montgomery', region: 'South' }, @@ -36,6 +36,31 @@ class BasicExample extends React.Component { filterBy={(option, props) => (props.text.indexOf(option) !== -1) } placeholder="Choose a state..." /> + + + {option.name} + + } + /> + + + {options.map((o, idx) => ( + + {o.name} + + ))} + + ); } From 9240926c4bc7dfe6fb7bcf4175fb7be93f7b35ad Mon Sep 17 00:00:00 2001 From: feinoujc Date: Mon, 3 Dec 2018 14:28:35 -0500 Subject: [PATCH 064/241] bump other packages --- types/pollyjs__adapter-fetch/index.d.ts | 2 +- types/pollyjs__adapter/index.d.ts | 2 +- types/pollyjs__persister-fs/index.d.ts | 2 +- types/pollyjs__persister/index.d.ts | 2 +- types/pollyjs__utils/index.d.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/types/pollyjs__adapter-fetch/index.d.ts b/types/pollyjs__adapter-fetch/index.d.ts index 3d93435d51..d38313db9d 100644 --- a/types/pollyjs__adapter-fetch/index.d.ts +++ b/types/pollyjs__adapter-fetch/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for @pollyjs/adapter-fetch 1.2 +// Type definitions for @pollyjs/adapter-fetch 1.3 // Project: https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter-fetch // Definitions by: feinoujc // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/pollyjs__adapter/index.d.ts b/types/pollyjs__adapter/index.d.ts index b3810a67bb..0bc49fd73b 100644 --- a/types/pollyjs__adapter/index.d.ts +++ b/types/pollyjs__adapter/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for @pollyjs/adapter 1.2 +// Type definitions for @pollyjs/adapter 1.3 // Project: https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/adapter // Definitions by: feinoujc // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/pollyjs__persister-fs/index.d.ts b/types/pollyjs__persister-fs/index.d.ts index 3d97b382f7..fc7f9ad656 100644 --- a/types/pollyjs__persister-fs/index.d.ts +++ b/types/pollyjs__persister-fs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for @pollyjs/persister-fs 1.2 +// Type definitions for @pollyjs/persister-fs 1.3 // Project: https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister-fs // Definitions by: feinoujc // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/pollyjs__persister/index.d.ts b/types/pollyjs__persister/index.d.ts index 45fc1fc250..87e1c27f5b 100644 --- a/types/pollyjs__persister/index.d.ts +++ b/types/pollyjs__persister/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for @pollyjs/persister 1.2 +// Type definitions for @pollyjs/persister 1.3 // Project: https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/persister // Definitions by: feinoujc // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/pollyjs__utils/index.d.ts b/types/pollyjs__utils/index.d.ts index e87392fcee..ca3e7735ef 100644 --- a/types/pollyjs__utils/index.d.ts +++ b/types/pollyjs__utils/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for @pollyjs/utils 1.2 +// Type definitions for @pollyjs/utils 1.3 // Project: https://github.com/netflix/pollyjs/tree/master/packages/@pollyjs/utils // Definitions by: feinoujc // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 3ba1ae85e26eea8062509b406ad1baf9e5092355 Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Mon, 3 Dec 2018 20:38:16 +0100 Subject: [PATCH 065/241] Added dependencies file --- types/react-bootstrap-typeahead/package.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 types/react-bootstrap-typeahead/package.json diff --git a/types/react-bootstrap-typeahead/package.json b/types/react-bootstrap-typeahead/package.json new file mode 100644 index 0000000000..4d9ec4a338 --- /dev/null +++ b/types/react-bootstrap-typeahead/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "csstype": "^2.2.0" + } +} From dfc87fffb7ba49a1affdd1a17027dbf04a38b416 Mon Sep 17 00:00:00 2001 From: Matthew Lilley Date: Tue, 4 Dec 2018 01:30:12 +0000 Subject: [PATCH 066/241] Add missing serializeState and deserializeState options --- types/next-redux-wrapper/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/next-redux-wrapper/index.d.ts b/types/next-redux-wrapper/index.d.ts index 16af858743..835a9762ca 100644 --- a/types/next-redux-wrapper/index.d.ts +++ b/types/next-redux-wrapper/index.d.ts @@ -19,6 +19,8 @@ declare namespace nextReduxWrapper { interface Options { storeKey?: string; debug?: boolean; + serializeState: any; + deserializeState: any; } interface StoreCreatorOptions extends Options { From e3fd26e653b49682659f7441dd53996bb59afa00 Mon Sep 17 00:00:00 2001 From: Tim Trinidad Date: Mon, 3 Dec 2018 22:50:08 -0500 Subject: [PATCH 067/241] [react-qr-reader] update type declaration to use CommonJs exports --- types/react-qr-reader/index.d.ts | 13 ++++++------- types/react-qr-reader/react-qr-reader-tests.tsx | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/types/react-qr-reader/index.d.ts b/types/react-qr-reader/index.d.ts index de426667c0..908960f25c 100644 --- a/types/react-qr-reader/index.d.ts +++ b/types/react-qr-reader/index.d.ts @@ -6,11 +6,7 @@ import * as React from "react"; -export as namespace QrReader; - -export default QrReader; - -export namespace QrReader { +declare namespace QrReader { interface props { onScan: (data: string | null) => void; onError: (err: any) => void; @@ -26,5 +22,8 @@ export namespace QrReader { } } -declare class QrReader extends React.Component { -} +export as namespace QrReader; + +declare class QrReader extends React.Component {} + +export = QrReader; diff --git a/types/react-qr-reader/react-qr-reader-tests.tsx b/types/react-qr-reader/react-qr-reader-tests.tsx index 20632f8029..0a6796bfd9 100644 --- a/types/react-qr-reader/react-qr-reader-tests.tsx +++ b/types/react-qr-reader/react-qr-reader-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import QrReader from "react-qr-reader"; +import * as QrReader from "react-qr-reader"; export class Test extends React.Component { render() { From 6ca0152bcd4ea671c1e8d52c799a1cd1c1bb4b82 Mon Sep 17 00:00:00 2001 From: Ziyu Wang Date: Tue, 4 Dec 2018 19:42:08 +1100 Subject: [PATCH 068/241] fix selenium-webdriver logginng type --- types/selenium-webdriver/index.d.ts | 33 ++++++++++++++++++++++++-- types/selenium-webdriver/test/index.ts | 6 +++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/types/selenium-webdriver/index.d.ts b/types/selenium-webdriver/index.d.ts index aa8a696576..4fa0ccf7ac 100644 --- a/types/selenium-webdriver/index.d.ts +++ b/types/selenium-webdriver/index.d.ts @@ -4,7 +4,8 @@ // Yuki Kokubun , // Craig Nishina , // Simon Gellis , -// Ben Dixon +// Ben Dixon , +// Ziyu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -540,7 +541,7 @@ export namespace logging { * @param {string} name the logger's name. * @return {!Logger} the requested logger. */ - getLogger(name: string): Logger; + getLogger(name?: string): Logger; /** * Creates a new logger. @@ -552,6 +553,34 @@ export namespace logging { */ createLogger_(name: string, parent: Logger): Logger; } + + /** + * Retrieves a named logger, creating it in the process. This function will + * implicitly create the requested logger, and any of its parents, if they + * do not yet exist. + * + * @param {string} name the logger's name. + * @return {!Logger} the requested logger. + */ + function getLogger(name?: string): Logger; + + /** + * Adds the console handler to the given logger. The console handler will log + * all messages using the JavaScript Console API. + * + * @param {Logger=} opt_logger The logger to add the handler to; defaults + * to the root logger. + */ + function addConsoleHandler(opt_logger?: Logger): void; + + /** + * Removes the console log handler from the given logger. + * + * @param {Logger=} opt_logger The logger to remove the handler from; defaults + * to the root logger. + * @see exports.addConsoleHandler + */ + function removeConsoleHandler(opt_logger?: Logger): void; } export namespace promise { diff --git a/types/selenium-webdriver/test/index.ts b/types/selenium-webdriver/test/index.ts index f8decdace1..84ffc6a8c2 100644 --- a/types/selenium-webdriver/test/index.ts +++ b/types/selenium-webdriver/test/index.ts @@ -758,6 +758,12 @@ function TestLogging() { type = webdriver.logging.Type.DRIVER; type = webdriver.logging.Type.PERFORMANCE; type = webdriver.logging.Type.SERVER; + + let logger: webdriver.logging.Logger = webdriver.logging.getLogger(); + webdriver.logging.addConsoleHandler(); + webdriver.logging.addConsoleHandler(logger); + webdriver.logging.removeConsoleHandler(); + webdriver.logging.removeConsoleHandler(logger); } function TestLoggingEntry() { From 1a87973fd7debd80f99331b895d2089de1470606 Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Tue, 4 Dec 2018 13:49:24 +0100 Subject: [PATCH 069/241] Basic test with old declaration --- types/simpl-schema/index.d.ts | 158 +++++++++++++++++++++++ types/simpl-schema/simpl-schema-tests.ts | 90 +++++++++++++ types/simpl-schema/tsconfig.json | 23 ++++ types/simpl-schema/tslint.json | 1 + 4 files changed, 272 insertions(+) create mode 100644 types/simpl-schema/index.d.ts create mode 100644 types/simpl-schema/simpl-schema-tests.ts create mode 100644 types/simpl-schema/tsconfig.json create mode 100644 types/simpl-schema/tslint.json diff --git a/types/simpl-schema/index.d.ts b/types/simpl-schema/index.d.ts new file mode 100644 index 0000000000..c90d2ba93b --- /dev/null +++ b/types/simpl-schema/index.d.ts @@ -0,0 +1,158 @@ +// from https://github.com/aldeed/simple-schema-js/issues/90 + +declare module "simpl-schema" { + + export class ValidationContext { + constructor(ss: any); + addValidationErrors(errors: any): void; + clean(...args: any[]): any; + getErrorForKey(key: any, ...args: any[]): any; + isValid(): any; + keyErrorMessage(key: any, ...args: any[]): any; + keyIsInvalid(key: any, ...args: any[]): any; + reset(): void; + setValidationErrors(errors: any): void; + validate(obj: any, ...args: any[]): any; + validationErrors(): any; + } + + interface SchemaDefinition { + type: any; + label?: string | Function; + optional?: boolean | Function; + min?: number | boolean | Date | Function; + max?: number | boolean | Date | Function; + minCount?: number | Function; + maxCount?: number | Function; + allowedValues?: any[] | Function; + decimal?: boolean; + exclusiveMax?: boolean; + exclusiveMin?: boolean; + regEx?: RegExp | RegExp[]; + custom?: Function; + blackbox?: boolean; + autoValue?: Function; + defaultValue?: any; + trim?: boolean; + } + + interface CleanOption { + filter?: boolean; + autoConvert?: boolean; + removeEmptyStrings?: boolean; + trimStrings?: boolean; + getAutoValues?: boolean; + isModifier?: boolean; + extendAutoValueContext?: boolean; + } + + interface SimpleSchemaStatic { + new(schema: {[key: string]: SchemaDefinition} | any[]): SimpleSchemaStatic; + namedContext(name?: string): SimpleSchemaValidationContextStatic; + addValidator(validator: Function): any; + pick(...fields: string[]): SimpleSchemaStatic; + omit(...fields: string[]): SimpleSchemaStatic; + clean(doc: any, options?: CleanOption): any; + schema(key?: string): SchemaDefinition | SchemaDefinition[]; + getDefinition(key: string, propList?: any, functionContext?: any): any; + keyIsInBlackBox(key: string): boolean; + labels(labels: {[key: string]: string}): void; + label(key: any): any; + Integer: RegExp; + messages(messages: any): any; + messageForError(type: any, key: any, def: any, value: any): string; + allowsKey(key: any): string; + newContext(): SimpleSchemaValidationContextStatic; + objectKeys(keyPrefix: any): any[]; + validate(obj: any, options?: ValidationOption): void; + validator(options: ValidationOption): Function; + RegEx: { + Email: RegExp; + EmailWithTLD: RegExp; + Domain: RegExp; + WeakDomain: RegExp; + IP: RegExp; + IPv4: RegExp; + IPv6: RegExp; + Url: RegExp; + Id: RegExp; + ZipCode: RegExp; + Phone: RegExp; + }; + } + + interface ValidationOption { + modifier?: boolean; + upsert?: boolean; + clean?: boolean; + filter?: boolean; + upsertextendedCustomContext?: boolean; + } + + interface SimpleSchemaValidationContextStatic { + validate(obj: any, options?: ValidationOption): boolean; + validateOne(doc: any, keyName: string, options?: ValidationOption): boolean; + resetValidation(): void; + isValid(): boolean; + invalidKeys(): { name: string; type: string; value?: any; }[]; + addInvalidKeys(errors: { name: string, type: string; }[]): void; + keyIsInvalid(name: any): boolean; + keyErrorMessage(name: any): string; + getErrorObject(): any; + } + + interface MongoObjectStatic { + forEachNode(func: Function, options?: {endPointsOnly: boolean;}): void; + getValueForPosition(position: string): any; + setValueForPosition(position: string, value: any): void; + removeValueForPosition(position: string): void; + getKeyForPosition(position: string): any; + getGenericKeyForPosition(position: string): any; + getInfoForKey(key: string): any; + getPositionForKey(key: string): string; + getPositionsForGenericKey(key: string): string[]; + getValueForKey(key: string): any; + addKey(key: string, val: any, op: string): any; + removeGenericKeys(keys: string[]): void; + removeGenericKey(key: string): void; + removeKey(key: string): void; + removeKeys(keys: string[]): void; + filterGenericKeys(test: Function): void; + setValueForKey(key: string, val: any): void; + setValueForGenericKey(key: string, val: any): void; + getObject(): any; + getFlatObject(options?: {keepArrays?: boolean}): any; + affectsKey(key: string): any; + affectsGenericKey(key: string): any; + affectsGenericKeyImplicit(key: string): any; + } + + export const SimpleSchema: SimpleSchemaStatic; + export const SimpleSchemaValidationContext: SimpleSchemaValidationContextStatic; + export const MongoObject: MongoObjectStatic; + + export interface SimpleSchema { + debug: boolean; + addValidator(validator: Function): any; + extendOptions(options: {[key: string]: any}): void; + messages(messages: any): void; + RegEx: { + Email: RegExp; + Domain: RegExp; + WeakDomain: RegExp; + IP: RegExp; + IPv4: RegExp; + IPv6: RegExp; + Url: RegExp; + Id: RegExp; + ZipCode: RegExp; + Phone: RegExp; + }; + } + + export interface MongoObject { + expandKey(val: any, key: string, obj: any): void; + } + + export default SimpleSchema; +} diff --git a/types/simpl-schema/simpl-schema-tests.ts b/types/simpl-schema/simpl-schema-tests.ts new file mode 100644 index 0000000000..6081a5a11b --- /dev/null +++ b/types/simpl-schema/simpl-schema-tests.ts @@ -0,0 +1,90 @@ +import SimpleSchema from 'simpl-schema'; + +const StringSchema = new SimpleSchema({ + basicString: { + type: String + }, + limitedString: { + type: String, + allowedValues: ['pro', 'con'] + }, + regExpString: { + type: String, + regEx: SimpleSchema.RegEx.Id + }, + title: { + type: String, + label: "Argument", + custom: function () { + var text = this.value; + if(text.length > 10) return { type: SimpleSchema.ErrorTypes.MAX_STRING, max: 10 }; + } + }, +}); + +StringSchema.validate({ + basicString: "Test", + limitedString: "pro", + regExpString: "id" +}); + + /* + , + title: { + type: String, + label: "Argument", + custom: function () { + var text = this.value; + text = text.replace(/https?:\/\/(www\.)?([-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6})\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi, '$2'); + + if(text.length > MAX_ARGUMENT_LENGTH) return { type: SimpleSchema.ErrorTypes.MAX_STRING, max: MAX_ARGUMENT_LENGTH } + else if(text.length < MIN_ARGUMENT_LENGTH) return { type: SimpleSchema.ErrorTypes.MIN_STRING, min: MIN_ARGUMENT_LENGTH } + } + }, + questionId: { + type: String, + regEx: SimpleSchema.RegEx.Id + }, + side: { + type: String, + allowedValues: ['pro', 'con'] + }, + userId: { + type: String, + regEx: SimpleSchema.RegEx.Id + }, + createdAt: { + type: Date, + autoValue: () => new Date(), + }, + clapCount: { + type: SimpleSchema.Integer, + defaultValue: 0 + }, + highlight: { + type: Array, + optional: true + }, + 'highlight.$': { + type: Object + }, + 'highlight.$.start': SimpleSchema.Integer, + 'highlight.$.end': SimpleSchema.Integer, + 'highlight.$.text': { + type: String, + trim: false + } + */ + /* + , + { + clean: { + filter: true, + autoConvert: true, + removeEmptyStrings: true, + trimStrings: true, + getAutoValues: true, + removeNullsFromArrays: true, + } + } + */ diff --git a/types/simpl-schema/tsconfig.json b/types/simpl-schema/tsconfig.json new file mode 100644 index 0000000000..d079496f4e --- /dev/null +++ b/types/simpl-schema/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", + "simpl-schema-tests.ts" + ] +} diff --git a/types/simpl-schema/tslint.json b/types/simpl-schema/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/simpl-schema/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From dec806bdf66ddee26ce8e6ded3590c814946c577 Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Tue, 4 Dec 2018 13:50:26 +0100 Subject: [PATCH 070/241] Move out of module --- types/simpl-schema/index.d.ts | 307 +++++++++++++++++----------------- 1 file changed, 152 insertions(+), 155 deletions(-) diff --git a/types/simpl-schema/index.d.ts b/types/simpl-schema/index.d.ts index c90d2ba93b..97411f4463 100644 --- a/types/simpl-schema/index.d.ts +++ b/types/simpl-schema/index.d.ts @@ -1,158 +1,155 @@ // from https://github.com/aldeed/simple-schema-js/issues/90 -declare module "simpl-schema" { - - export class ValidationContext { - constructor(ss: any); - addValidationErrors(errors: any): void; - clean(...args: any[]): any; - getErrorForKey(key: any, ...args: any[]): any; - isValid(): any; - keyErrorMessage(key: any, ...args: any[]): any; - keyIsInvalid(key: any, ...args: any[]): any; - reset(): void; - setValidationErrors(errors: any): void; - validate(obj: any, ...args: any[]): any; - validationErrors(): any; - } - - interface SchemaDefinition { - type: any; - label?: string | Function; - optional?: boolean | Function; - min?: number | boolean | Date | Function; - max?: number | boolean | Date | Function; - minCount?: number | Function; - maxCount?: number | Function; - allowedValues?: any[] | Function; - decimal?: boolean; - exclusiveMax?: boolean; - exclusiveMin?: boolean; - regEx?: RegExp | RegExp[]; - custom?: Function; - blackbox?: boolean; - autoValue?: Function; - defaultValue?: any; - trim?: boolean; - } - - interface CleanOption { - filter?: boolean; - autoConvert?: boolean; - removeEmptyStrings?: boolean; - trimStrings?: boolean; - getAutoValues?: boolean; - isModifier?: boolean; - extendAutoValueContext?: boolean; - } - - interface SimpleSchemaStatic { - new(schema: {[key: string]: SchemaDefinition} | any[]): SimpleSchemaStatic; - namedContext(name?: string): SimpleSchemaValidationContextStatic; - addValidator(validator: Function): any; - pick(...fields: string[]): SimpleSchemaStatic; - omit(...fields: string[]): SimpleSchemaStatic; - clean(doc: any, options?: CleanOption): any; - schema(key?: string): SchemaDefinition | SchemaDefinition[]; - getDefinition(key: string, propList?: any, functionContext?: any): any; - keyIsInBlackBox(key: string): boolean; - labels(labels: {[key: string]: string}): void; - label(key: any): any; - Integer: RegExp; - messages(messages: any): any; - messageForError(type: any, key: any, def: any, value: any): string; - allowsKey(key: any): string; - newContext(): SimpleSchemaValidationContextStatic; - objectKeys(keyPrefix: any): any[]; - validate(obj: any, options?: ValidationOption): void; - validator(options: ValidationOption): Function; - RegEx: { - Email: RegExp; - EmailWithTLD: RegExp; - Domain: RegExp; - WeakDomain: RegExp; - IP: RegExp; - IPv4: RegExp; - IPv6: RegExp; - Url: RegExp; - Id: RegExp; - ZipCode: RegExp; - Phone: RegExp; - }; - } - - interface ValidationOption { - modifier?: boolean; - upsert?: boolean; - clean?: boolean; - filter?: boolean; - upsertextendedCustomContext?: boolean; - } - - interface SimpleSchemaValidationContextStatic { - validate(obj: any, options?: ValidationOption): boolean; - validateOne(doc: any, keyName: string, options?: ValidationOption): boolean; - resetValidation(): void; - isValid(): boolean; - invalidKeys(): { name: string; type: string; value?: any; }[]; - addInvalidKeys(errors: { name: string, type: string; }[]): void; - keyIsInvalid(name: any): boolean; - keyErrorMessage(name: any): string; - getErrorObject(): any; - } - - interface MongoObjectStatic { - forEachNode(func: Function, options?: {endPointsOnly: boolean;}): void; - getValueForPosition(position: string): any; - setValueForPosition(position: string, value: any): void; - removeValueForPosition(position: string): void; - getKeyForPosition(position: string): any; - getGenericKeyForPosition(position: string): any; - getInfoForKey(key: string): any; - getPositionForKey(key: string): string; - getPositionsForGenericKey(key: string): string[]; - getValueForKey(key: string): any; - addKey(key: string, val: any, op: string): any; - removeGenericKeys(keys: string[]): void; - removeGenericKey(key: string): void; - removeKey(key: string): void; - removeKeys(keys: string[]): void; - filterGenericKeys(test: Function): void; - setValueForKey(key: string, val: any): void; - setValueForGenericKey(key: string, val: any): void; - getObject(): any; - getFlatObject(options?: {keepArrays?: boolean}): any; - affectsKey(key: string): any; - affectsGenericKey(key: string): any; - affectsGenericKeyImplicit(key: string): any; - } - - export const SimpleSchema: SimpleSchemaStatic; - export const SimpleSchemaValidationContext: SimpleSchemaValidationContextStatic; - export const MongoObject: MongoObjectStatic; - - export interface SimpleSchema { - debug: boolean; - addValidator(validator: Function): any; - extendOptions(options: {[key: string]: any}): void; - messages(messages: any): void; - RegEx: { - Email: RegExp; - Domain: RegExp; - WeakDomain: RegExp; - IP: RegExp; - IPv4: RegExp; - IPv6: RegExp; - Url: RegExp; - Id: RegExp; - ZipCode: RegExp; - Phone: RegExp; - }; - } - - export interface MongoObject { - expandKey(val: any, key: string, obj: any): void; - } - - export default SimpleSchema; +export class ValidationContext { + constructor(ss: any); + addValidationErrors(errors: any): void; + clean(...args: any[]): any; + getErrorForKey(key: any, ...args: any[]): any; + isValid(): any; + keyErrorMessage(key: any, ...args: any[]): any; + keyIsInvalid(key: any, ...args: any[]): any; + reset(): void; + setValidationErrors(errors: any): void; + validate(obj: any, ...args: any[]): any; + validationErrors(): any; } + +interface SchemaDefinition { + type: any; + label?: string | Function; + optional?: boolean | Function; + min?: number | boolean | Date | Function; + max?: number | boolean | Date | Function; + minCount?: number | Function; + maxCount?: number | Function; + allowedValues?: any[] | Function; + decimal?: boolean; + exclusiveMax?: boolean; + exclusiveMin?: boolean; + regEx?: RegExp | RegExp[]; + custom?: Function; + blackbox?: boolean; + autoValue?: Function; + defaultValue?: any; + trim?: boolean; +} + +interface CleanOption { + filter?: boolean; + autoConvert?: boolean; + removeEmptyStrings?: boolean; + trimStrings?: boolean; + getAutoValues?: boolean; + isModifier?: boolean; + extendAutoValueContext?: boolean; +} + +interface SimpleSchemaStatic { + new(schema: {[key: string]: SchemaDefinition} | any[]): SimpleSchemaStatic; + namedContext(name?: string): SimpleSchemaValidationContextStatic; + addValidator(validator: Function): any; + pick(...fields: string[]): SimpleSchemaStatic; + omit(...fields: string[]): SimpleSchemaStatic; + clean(doc: any, options?: CleanOption): any; + schema(key?: string): SchemaDefinition | SchemaDefinition[]; + getDefinition(key: string, propList?: any, functionContext?: any): any; + keyIsInBlackBox(key: string): boolean; + labels(labels: {[key: string]: string}): void; + label(key: any): any; + Integer: RegExp; + messages(messages: any): any; + messageForError(type: any, key: any, def: any, value: any): string; + allowsKey(key: any): string; + newContext(): SimpleSchemaValidationContextStatic; + objectKeys(keyPrefix: any): any[]; + validate(obj: any, options?: ValidationOption): void; + validator(options: ValidationOption): Function; + RegEx: { + Email: RegExp; + EmailWithTLD: RegExp; + Domain: RegExp; + WeakDomain: RegExp; + IP: RegExp; + IPv4: RegExp; + IPv6: RegExp; + Url: RegExp; + Id: RegExp; + ZipCode: RegExp; + Phone: RegExp; + }; +} + +interface ValidationOption { + modifier?: boolean; + upsert?: boolean; + clean?: boolean; + filter?: boolean; + upsertextendedCustomContext?: boolean; +} + +interface SimpleSchemaValidationContextStatic { + validate(obj: any, options?: ValidationOption): boolean; + validateOne(doc: any, keyName: string, options?: ValidationOption): boolean; + resetValidation(): void; + isValid(): boolean; + invalidKeys(): { name: string; type: string; value?: any; }[]; + addInvalidKeys(errors: { name: string, type: string; }[]): void; + keyIsInvalid(name: any): boolean; + keyErrorMessage(name: any): string; + getErrorObject(): any; +} + +interface MongoObjectStatic { + forEachNode(func: Function, options?: {endPointsOnly: boolean;}): void; + getValueForPosition(position: string): any; + setValueForPosition(position: string, value: any): void; + removeValueForPosition(position: string): void; + getKeyForPosition(position: string): any; + getGenericKeyForPosition(position: string): any; + getInfoForKey(key: string): any; + getPositionForKey(key: string): string; + getPositionsForGenericKey(key: string): string[]; + getValueForKey(key: string): any; + addKey(key: string, val: any, op: string): any; + removeGenericKeys(keys: string[]): void; + removeGenericKey(key: string): void; + removeKey(key: string): void; + removeKeys(keys: string[]): void; + filterGenericKeys(test: Function): void; + setValueForKey(key: string, val: any): void; + setValueForGenericKey(key: string, val: any): void; + getObject(): any; + getFlatObject(options?: {keepArrays?: boolean}): any; + affectsKey(key: string): any; + affectsGenericKey(key: string): any; + affectsGenericKeyImplicit(key: string): any; +} + +export const SimpleSchema: SimpleSchemaStatic; +export const SimpleSchemaValidationContext: SimpleSchemaValidationContextStatic; +export const MongoObject: MongoObjectStatic; + +export interface SimpleSchema { + debug: boolean; + addValidator(validator: Function): any; + extendOptions(options: {[key: string]: any}): void; + messages(messages: any): void; + RegEx: { + Email: RegExp; + Domain: RegExp; + WeakDomain: RegExp; + IP: RegExp; + IPv4: RegExp; + IPv6: RegExp; + Url: RegExp; + Id: RegExp; + ZipCode: RegExp; + Phone: RegExp; + }; +} + +export interface MongoObject { + expandKey(val: any, key: string, obj: any): void; +} + +export default SimpleSchema; From 98c3b9c6af9d4405288399a7a6af2ab9fb7b65ae Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Tue, 4 Dec 2018 15:03:02 +0100 Subject: [PATCH 071/241] Simplify types --- types/json_ml/index.d.ts | 8 +------- types/json_ml/json_ml-tests.ts | 26 +++++++++++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/types/json_ml/index.d.ts b/types/json_ml/index.d.ts index ba53b84cb4..e2eb2c7af4 100644 --- a/types/json_ml/index.d.ts +++ b/types/json_ml/index.d.ts @@ -5,13 +5,7 @@ /// -export type Node = string | Element; -export type SimpleElement = [string, Attributes] | [string]; -export interface NodeList extends Array {} -export type Element = SimpleElement & NodeList; -export interface Attributes { - [key: string]: string; -} +export type Node = string | [string, ...any[]]; export function parse(xml: string, trim?: boolean): Node[]; export function stringify( object: Node[], diff --git a/types/json_ml/json_ml-tests.ts b/types/json_ml/json_ml-tests.ts index ecc84d9d8b..05ca64da4a 100644 --- a/types/json_ml/json_ml-tests.ts +++ b/types/json_ml/json_ml-tests.ts @@ -1,12 +1,20 @@ /// -import { Attributes, Element, Node, parse, stringify } from "json_ml"; +import { Node, parse, stringify } from "json_ml"; -const nodes: Node[] = parse("
  • hello
"); -const node1: Node = nodes[0]; -if (typeof node1 !== "string") { - const el: Element = node1; - const attrs = el[1] as Attributes; - console.log(el[0], attrs); -} +const nodes: Node[] = parse( + '
  • First Item
  • Second Item
  • ThirdItem
' +); +stringify(nodes, el => (el.is("li") ? null : el), 2); -console.log(stringify(nodes, el => (el.is("li") ? null : el), 2)); +stringify( + [ + [ + "ul", + ["li", { style: "color: red" }], + ["li", { title: "Some hover text", style: "color: green" }], + ["li", ["span", { class: "code-example-third" }]] + ] + ], + null, + 2 +); From b37be32b6890ab5e1269ba03d4cfbabb7a530848 Mon Sep 17 00:00:00 2001 From: MichaelTsafrir Date: Tue, 4 Dec 2018 16:45:20 +0200 Subject: [PATCH 072/241] Added missing blendStroke property to PieProps blendStroke property exists in the pie component, yet is not recognized by the ts definition --- types/recharts/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index 34e3cbcb88..6426e0de5f 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -447,6 +447,7 @@ export interface PieProps extends EventAttributes, Partial | ContentRenderer | boolean; activeShape?: object | ContentRenderer | React.ReactElement; activeIndex?: number | number[]; + blendStroke?: boolean; } export class Pie extends React.Component { } From e7f4d0148e3d4e7e3e60a68f83ab5c02b3f114b4 Mon Sep 17 00:00:00 2001 From: Ivan Fernandes Date: Tue, 4 Dec 2018 16:16:29 -0200 Subject: [PATCH 073/241] add missing scopeSeparator option and tests --- types/passport-oauth2/index.d.ts | 1 + .../passport-oauth2/passport-oauth2-tests.ts | 33 ++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/types/passport-oauth2/index.d.ts b/types/passport-oauth2/index.d.ts index c3723b50b7..a6d519bf6a 100644 --- a/types/passport-oauth2/index.d.ts +++ b/types/passport-oauth2/index.d.ts @@ -67,6 +67,7 @@ declare namespace OAuth2Strategy { callbackURL?: string; customHeaders?: OutgoingHttpHeaders; scope?: string | string[]; + scopeSeparator?: string; sessionKey?: string; store?: StateStore; state?: any; diff --git a/types/passport-oauth2/passport-oauth2-tests.ts b/types/passport-oauth2/passport-oauth2-tests.ts index 864b2cb9d6..57dcfa56d9 100644 --- a/types/passport-oauth2/passport-oauth2-tests.ts +++ b/types/passport-oauth2/passport-oauth2-tests.ts @@ -1,5 +1,5 @@ import OAuth2Strategy = require('passport-oauth2'); -import { Strategy, StrategyOptions, StrategyOptionsWithRequest, VerifyCallback, AuthorizationError, TokenError, InternalOAuthError } from 'passport-oauth2'; +import { Strategy, StrategyOptions, StrategyOptionsWithRequest, VerifyCallback, AuthorizationError, TokenError, InternalOAuthError, Metadata, StateStore, StateStoreStoreCallback, StateStoreVerifyCallback } from 'passport-oauth2'; import { Strategy as PassportStrategy } from 'passport'; import { Request } from 'express'; @@ -56,3 +56,34 @@ class MyStrategy extends OAuth2Strategy { this._oauth2.get('http://www.example.com/profile', 'token', (err, result, response) => response); } } + +const metadata: Metadata = { + authorizationURL: 'http://www.example.com/auth', + clientID: 'dummy', + tokenURL: 'http://www.example.com/token' +} + +class MyStore implements StateStore { + store(req: Request, meta: StateStoreStoreCallback | Metadata, callback?: StateStoreStoreCallback): void {} + verify(req: Request, state: string, meta: StateStoreVerifyCallback | Metadata, callback?: StateStoreVerifyCallback): void {} +} + +const myStore = new MyStore; + +const strategyOptions3: StrategyOptions = { + authorizationURL: 'http://www.example.com/auth', + clientID: 'dummy', + clientSecret: 'secret', + tokenURL: 'http://www.example.com/token', + callbackURL: 'http://www.example.com/callback', + customHeaders: { + 'content-type': 'text/html' + }, + scope: ['scope1', 'scope2'], + scopeSeparator: ' ', + sessionKey: 'oauth', + state: {id: 1}, + store: myStore +}; + +const strategy5: Strategy = new Strategy(strategyOptions3, verifyFunction2); From ee619a0597282ea6de017ff65ec13523dc5c9d38 Mon Sep 17 00:00:00 2001 From: Ivan Fernandes Date: Tue, 4 Dec 2018 16:19:40 -0200 Subject: [PATCH 074/241] correcting code style --- types/passport-oauth2/index.d.ts | 2 +- types/passport-oauth2/passport-oauth2-tests.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/types/passport-oauth2/index.d.ts b/types/passport-oauth2/index.d.ts index a6d519bf6a..cd78f377c2 100644 --- a/types/passport-oauth2/index.d.ts +++ b/types/passport-oauth2/index.d.ts @@ -40,7 +40,7 @@ declare namespace OAuth2Strategy { } type StateStoreStoreCallback = (err: Error | null, state: any) => void; - type StateStoreVerifyCallback = (err: Error, ok: boolean, state: any) => void + type StateStoreVerifyCallback = (err: Error, ok: boolean, state: any) => void; interface StateStore { store(req: Request, callback: StateStoreStoreCallback): void; diff --git a/types/passport-oauth2/passport-oauth2-tests.ts b/types/passport-oauth2/passport-oauth2-tests.ts index 57dcfa56d9..30faeebda0 100644 --- a/types/passport-oauth2/passport-oauth2-tests.ts +++ b/types/passport-oauth2/passport-oauth2-tests.ts @@ -1,5 +1,6 @@ import OAuth2Strategy = require('passport-oauth2'); -import { Strategy, StrategyOptions, StrategyOptionsWithRequest, VerifyCallback, AuthorizationError, TokenError, InternalOAuthError, Metadata, StateStore, StateStoreStoreCallback, StateStoreVerifyCallback } from 'passport-oauth2'; +import { Strategy, StrategyOptions, StrategyOptionsWithRequest, VerifyCallback, AuthorizationError, TokenError, + InternalOAuthError, Metadata, StateStore, StateStoreStoreCallback, StateStoreVerifyCallback } from 'passport-oauth2'; import { Strategy as PassportStrategy } from 'passport'; import { Request } from 'express'; @@ -61,14 +62,14 @@ const metadata: Metadata = { authorizationURL: 'http://www.example.com/auth', clientID: 'dummy', tokenURL: 'http://www.example.com/token' -} +}; class MyStore implements StateStore { store(req: Request, meta: StateStoreStoreCallback | Metadata, callback?: StateStoreStoreCallback): void {} verify(req: Request, state: string, meta: StateStoreVerifyCallback | Metadata, callback?: StateStoreVerifyCallback): void {} } -const myStore = new MyStore; +const myStore = new MyStore(); const strategyOptions3: StrategyOptions = { authorizationURL: 'http://www.example.com/auth', From f304573e356f9f89125ba2ef8397216e7fe1a953 Mon Sep 17 00:00:00 2001 From: Ivan Fernandes Date: Tue, 4 Dec 2018 17:06:54 -0200 Subject: [PATCH 075/241] removing type utilities in favor of a simpler solution --- types/passport-bnet/index.d.ts | 12 ++++-------- types/passport-bnet/passport-bnet-tests.ts | 2 -- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/types/passport-bnet/index.d.ts b/types/passport-bnet/index.d.ts index c8e6dd923c..e7ffaaedce 100644 --- a/types/passport-bnet/index.d.ts +++ b/types/passport-bnet/index.d.ts @@ -12,15 +12,11 @@ declare class BnetStrategy extends OAuth2Strategy { } declare namespace BnetStrategy { - - //Utility types for excluding properties from interfaces - type Diff = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; - type Omit = Pick>; - // passport--bnet accepts any options that passport-oauth2 accepts, but add the option region and makes authorizationURL and tokenURL optional - interface _BaseBnetOptions - extends Partial>, Omit<_StrategyOptionsBase, 'authorizationURL' | 'tokenURL'> { - + interface _BaseBnetOptions extends Partial<_StrategyOptionsBase> { + clientID: string; + clientSecret: string; + region?: string; } diff --git a/types/passport-bnet/passport-bnet-tests.ts b/types/passport-bnet/passport-bnet-tests.ts index 06c0ffccec..b02cf40519 100644 --- a/types/passport-bnet/passport-bnet-tests.ts +++ b/types/passport-bnet/passport-bnet-tests.ts @@ -6,11 +6,9 @@ import { Strategy as OAuth2Strategy, VerifyCallback } from "passport-oauth2"; import { Request } from "express"; const strategyOptions1: StrategyOptions = { - authorizationURL: 'http://www.example.com/auth', callbackURL: 'http://www.example.com/callback', clientID: 'dummy', clientSecret: 'secret', - tokenURL: 'http://www.example.com/token', region: 'us', scope: "email", scopeSeparator: ' ', From 074b604db4be04a98acf359069adaff1b49d8c23 Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Tue, 4 Dec 2018 20:12:29 +0100 Subject: [PATCH 076/241] Basic version of Simpl-Schema definition --- types/simpl-schema/index.d.ts | 100 ++++++++++++++++------- types/simpl-schema/simpl-schema-tests.ts | 34 ++++---- 2 files changed, 90 insertions(+), 44 deletions(-) diff --git a/types/simpl-schema/index.d.ts b/types/simpl-schema/index.d.ts index 97411f4463..32dd8d7b66 100644 --- a/types/simpl-schema/index.d.ts +++ b/types/simpl-schema/index.d.ts @@ -1,4 +1,8 @@ -// from https://github.com/aldeed/simple-schema-js/issues/90 +// Type definitions for simpl-schema 0.1 +// Project: https://github.com/aldeed/simple-schema-js +// Definitions by: Andreas Richter +// Qkramer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export class ValidationContext { constructor(ss: any); @@ -14,40 +18,45 @@ export class ValidationContext { validationErrors(): any; } +interface CustomValidationContext { + value: any; +} + interface SchemaDefinition { type: any; - label?: string | Function; - optional?: boolean | Function; - min?: number | boolean | Date | Function; - max?: number | boolean | Date | Function; - minCount?: number | Function; - maxCount?: number | Function; - allowedValues?: any[] | Function; + label?: string | (() => string); + optional?: boolean | (() => boolean); + min?: number | boolean | Date | (() => number | boolean | Date); + max?: number | boolean | Date | (() => number | boolean | Date); + minCount?: number | (() => number); + maxCount?: number | (() => number); + allowedValues?: any[] | (() => any[]); decimal?: boolean; exclusiveMax?: boolean; exclusiveMin?: boolean; regEx?: RegExp | RegExp[]; - custom?: Function; + custom?: () => any; blackbox?: boolean; - autoValue?: Function; + autoValue?: () => any; defaultValue?: any; trim?: boolean; } interface CleanOption { - filter?: boolean; - autoConvert?: boolean; - removeEmptyStrings?: boolean; - trimStrings?: boolean; - getAutoValues?: boolean; - isModifier?: boolean; - extendAutoValueContext?: boolean; + filter?: boolean; + autoConvert?: boolean; + removeEmptyStrings?: boolean; + trimStrings?: boolean; + getAutoValues?: boolean; + isModifier?: boolean; + extendAutoValueContext?: boolean; } +// ??? interface SimpleSchemaStatic { - new(schema: {[key: string]: SchemaDefinition} | any[]): SimpleSchemaStatic; + new(schema: {[key: string]: SchemaDefinition} | any[]): SimpleSchema; namedContext(name?: string): SimpleSchemaValidationContextStatic; - addValidator(validator: Function): any; + addValidator(validator: () => boolean): any; pick(...fields: string[]): SimpleSchemaStatic; omit(...fields: string[]): SimpleSchemaStatic; clean(doc: any, options?: CleanOption): any; @@ -63,7 +72,7 @@ interface SimpleSchemaStatic { newContext(): SimpleSchemaValidationContextStatic; objectKeys(keyPrefix: any): any[]; validate(obj: any, options?: ValidationOption): void; - validator(options: ValidationOption): Function; + validator(options: ValidationOption): () => boolean; RegEx: { Email: RegExp; EmailWithTLD: RegExp; @@ -77,6 +86,25 @@ interface SimpleSchemaStatic { ZipCode: RegExp; Phone: RegExp; }; + ErrorTypes: { + REQUIRED: string, + MIN_STRING: string, + MAX_STRING: string, + MIN_NUMBER: string, + MAX_NUMBER: string, + MIN_NUMBER_EXCLUSIVE: string, + MAX_NUMBER_EXCLUSIVE: string, + MIN_DATE: string, + MAX_DATE: string, + BAD_DATE: string, + MIN_COUNT: string, + MAX_COUNT: string, + MUST_BE_INTEGER: string, + VALUE_NOT_ALLOWED: string, + EXPECTED_TYPE: string, + FAILED_REGULAR_EXPRESSION: string, + KEY_NOT_IN_SCHEMA: string + }; } interface ValidationOption { @@ -87,20 +115,31 @@ interface ValidationOption { upsertextendedCustomContext?: boolean; } +interface SimpleSchemaValidationContextStaticKeys { + name: string; + type: string; + value?: any; +} + +interface SimpleSchemaError { + name: string; + type: string; +} + interface SimpleSchemaValidationContextStatic { validate(obj: any, options?: ValidationOption): boolean; validateOne(doc: any, keyName: string, options?: ValidationOption): boolean; resetValidation(): void; isValid(): boolean; - invalidKeys(): { name: string; type: string; value?: any; }[]; - addInvalidKeys(errors: { name: string, type: string; }[]): void; + invalidKeys(): SimpleSchemaValidationContextStaticKeys[]; + addInvalidKeys(errors: SimpleSchemaError[]): void; keyIsInvalid(name: any): boolean; keyErrorMessage(name: any): string; getErrorObject(): any; } interface MongoObjectStatic { - forEachNode(func: Function, options?: {endPointsOnly: boolean;}): void; + forEachNode(func: (() => void), options?: {endPointsOnly: boolean}): void; getValueForPosition(position: string): any; setValueForPosition(position: string, value: any): void; removeValueForPosition(position: string): void; @@ -115,7 +154,7 @@ interface MongoObjectStatic { removeGenericKey(key: string): void; removeKey(key: string): void; removeKeys(keys: string[]): void; - filterGenericKeys(test: Function): void; + filterGenericKeys(test: (() => boolean)): void; setValueForKey(key: string, val: any): void; setValueForGenericKey(key: string, val: any): void; getObject(): any; @@ -130,11 +169,12 @@ export const SimpleSchemaValidationContext: SimpleSchemaValidationContextStatic; export const MongoObject: MongoObjectStatic; export interface SimpleSchema { - debug: boolean; - addValidator(validator: Function): any; - extendOptions(options: {[key: string]: any}): void; - messages(messages: any): void; - RegEx: { + debug: boolean; + validate(obj: any, options?: ValidationOption): void; + addValidator(validator: () => boolean): any; + extendOptions(options: {[key: string]: any}): void; + messages(messages: any): void; + RegEx: { Email: RegExp; Domain: RegExp; WeakDomain: RegExp; @@ -145,7 +185,7 @@ export interface SimpleSchema { Id: RegExp; ZipCode: RegExp; Phone: RegExp; - }; + }; } export interface MongoObject { diff --git a/types/simpl-schema/simpl-schema-tests.ts b/types/simpl-schema/simpl-schema-tests.ts index 6081a5a11b..3c40f0c4bb 100644 --- a/types/simpl-schema/simpl-schema-tests.ts +++ b/types/simpl-schema/simpl-schema-tests.ts @@ -2,24 +2,30 @@ import SimpleSchema from 'simpl-schema'; const StringSchema = new SimpleSchema({ basicString: { - type: String + type: String }, limitedString: { - type: String, - allowedValues: ['pro', 'con'] + type: String, + allowedValues: ['pro', 'con'] }, regExpString: { - type: String, - regEx: SimpleSchema.RegEx.Id - }, - title: { - type: String, - label: "Argument", - custom: function () { - var text = this.value; - if(text.length > 10) return { type: SimpleSchema.ErrorTypes.MAX_STRING, max: 10 }; - } - }, + type: String, + regEx: SimpleSchema.RegEx.Id + }, + createdAt: { + type: Date, + autoValue: () => new Date(), + }, + title: { + type: String, + label: "Argument", + /* TODO, this does not work: "The containing arrow function captures the global value of 'this' which implicitly has type 'any'." + custom: () => { + const text = this.value; + if (text.length > 10) return { type: SimpleSchema.ErrorTypes.MAX_STRING, max: 10 }; + } + */ + }, }); StringSchema.validate({ From 3863ea9f8d4b67f002c6faeb64ab54be8d27361a Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Tue, 4 Dec 2018 20:45:23 +0100 Subject: [PATCH 077/241] Remove simpl-schema from master PR, and move to new one --- types/simpl-schema/index.d.ts | 195 ----------------------- types/simpl-schema/simpl-schema-tests.ts | 96 ----------- types/simpl-schema/tsconfig.json | 23 --- types/simpl-schema/tslint.json | 1 - 4 files changed, 315 deletions(-) delete mode 100644 types/simpl-schema/index.d.ts delete mode 100644 types/simpl-schema/simpl-schema-tests.ts delete mode 100644 types/simpl-schema/tsconfig.json delete mode 100644 types/simpl-schema/tslint.json diff --git a/types/simpl-schema/index.d.ts b/types/simpl-schema/index.d.ts deleted file mode 100644 index 32dd8d7b66..0000000000 --- a/types/simpl-schema/index.d.ts +++ /dev/null @@ -1,195 +0,0 @@ -// Type definitions for simpl-schema 0.1 -// Project: https://github.com/aldeed/simple-schema-js -// Definitions by: Andreas Richter -// Qkramer -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export class ValidationContext { - constructor(ss: any); - addValidationErrors(errors: any): void; - clean(...args: any[]): any; - getErrorForKey(key: any, ...args: any[]): any; - isValid(): any; - keyErrorMessage(key: any, ...args: any[]): any; - keyIsInvalid(key: any, ...args: any[]): any; - reset(): void; - setValidationErrors(errors: any): void; - validate(obj: any, ...args: any[]): any; - validationErrors(): any; -} - -interface CustomValidationContext { - value: any; -} - -interface SchemaDefinition { - type: any; - label?: string | (() => string); - optional?: boolean | (() => boolean); - min?: number | boolean | Date | (() => number | boolean | Date); - max?: number | boolean | Date | (() => number | boolean | Date); - minCount?: number | (() => number); - maxCount?: number | (() => number); - allowedValues?: any[] | (() => any[]); - decimal?: boolean; - exclusiveMax?: boolean; - exclusiveMin?: boolean; - regEx?: RegExp | RegExp[]; - custom?: () => any; - blackbox?: boolean; - autoValue?: () => any; - defaultValue?: any; - trim?: boolean; -} - -interface CleanOption { - filter?: boolean; - autoConvert?: boolean; - removeEmptyStrings?: boolean; - trimStrings?: boolean; - getAutoValues?: boolean; - isModifier?: boolean; - extendAutoValueContext?: boolean; -} - -// ??? -interface SimpleSchemaStatic { - new(schema: {[key: string]: SchemaDefinition} | any[]): SimpleSchema; - namedContext(name?: string): SimpleSchemaValidationContextStatic; - addValidator(validator: () => boolean): any; - pick(...fields: string[]): SimpleSchemaStatic; - omit(...fields: string[]): SimpleSchemaStatic; - clean(doc: any, options?: CleanOption): any; - schema(key?: string): SchemaDefinition | SchemaDefinition[]; - getDefinition(key: string, propList?: any, functionContext?: any): any; - keyIsInBlackBox(key: string): boolean; - labels(labels: {[key: string]: string}): void; - label(key: any): any; - Integer: RegExp; - messages(messages: any): any; - messageForError(type: any, key: any, def: any, value: any): string; - allowsKey(key: any): string; - newContext(): SimpleSchemaValidationContextStatic; - objectKeys(keyPrefix: any): any[]; - validate(obj: any, options?: ValidationOption): void; - validator(options: ValidationOption): () => boolean; - RegEx: { - Email: RegExp; - EmailWithTLD: RegExp; - Domain: RegExp; - WeakDomain: RegExp; - IP: RegExp; - IPv4: RegExp; - IPv6: RegExp; - Url: RegExp; - Id: RegExp; - ZipCode: RegExp; - Phone: RegExp; - }; - ErrorTypes: { - REQUIRED: string, - MIN_STRING: string, - MAX_STRING: string, - MIN_NUMBER: string, - MAX_NUMBER: string, - MIN_NUMBER_EXCLUSIVE: string, - MAX_NUMBER_EXCLUSIVE: string, - MIN_DATE: string, - MAX_DATE: string, - BAD_DATE: string, - MIN_COUNT: string, - MAX_COUNT: string, - MUST_BE_INTEGER: string, - VALUE_NOT_ALLOWED: string, - EXPECTED_TYPE: string, - FAILED_REGULAR_EXPRESSION: string, - KEY_NOT_IN_SCHEMA: string - }; -} - -interface ValidationOption { - modifier?: boolean; - upsert?: boolean; - clean?: boolean; - filter?: boolean; - upsertextendedCustomContext?: boolean; -} - -interface SimpleSchemaValidationContextStaticKeys { - name: string; - type: string; - value?: any; -} - -interface SimpleSchemaError { - name: string; - type: string; -} - -interface SimpleSchemaValidationContextStatic { - validate(obj: any, options?: ValidationOption): boolean; - validateOne(doc: any, keyName: string, options?: ValidationOption): boolean; - resetValidation(): void; - isValid(): boolean; - invalidKeys(): SimpleSchemaValidationContextStaticKeys[]; - addInvalidKeys(errors: SimpleSchemaError[]): void; - keyIsInvalid(name: any): boolean; - keyErrorMessage(name: any): string; - getErrorObject(): any; -} - -interface MongoObjectStatic { - forEachNode(func: (() => void), options?: {endPointsOnly: boolean}): void; - getValueForPosition(position: string): any; - setValueForPosition(position: string, value: any): void; - removeValueForPosition(position: string): void; - getKeyForPosition(position: string): any; - getGenericKeyForPosition(position: string): any; - getInfoForKey(key: string): any; - getPositionForKey(key: string): string; - getPositionsForGenericKey(key: string): string[]; - getValueForKey(key: string): any; - addKey(key: string, val: any, op: string): any; - removeGenericKeys(keys: string[]): void; - removeGenericKey(key: string): void; - removeKey(key: string): void; - removeKeys(keys: string[]): void; - filterGenericKeys(test: (() => boolean)): void; - setValueForKey(key: string, val: any): void; - setValueForGenericKey(key: string, val: any): void; - getObject(): any; - getFlatObject(options?: {keepArrays?: boolean}): any; - affectsKey(key: string): any; - affectsGenericKey(key: string): any; - affectsGenericKeyImplicit(key: string): any; -} - -export const SimpleSchema: SimpleSchemaStatic; -export const SimpleSchemaValidationContext: SimpleSchemaValidationContextStatic; -export const MongoObject: MongoObjectStatic; - -export interface SimpleSchema { - debug: boolean; - validate(obj: any, options?: ValidationOption): void; - addValidator(validator: () => boolean): any; - extendOptions(options: {[key: string]: any}): void; - messages(messages: any): void; - RegEx: { - Email: RegExp; - Domain: RegExp; - WeakDomain: RegExp; - IP: RegExp; - IPv4: RegExp; - IPv6: RegExp; - Url: RegExp; - Id: RegExp; - ZipCode: RegExp; - Phone: RegExp; - }; -} - -export interface MongoObject { - expandKey(val: any, key: string, obj: any): void; -} - -export default SimpleSchema; diff --git a/types/simpl-schema/simpl-schema-tests.ts b/types/simpl-schema/simpl-schema-tests.ts deleted file mode 100644 index 3c40f0c4bb..0000000000 --- a/types/simpl-schema/simpl-schema-tests.ts +++ /dev/null @@ -1,96 +0,0 @@ -import SimpleSchema from 'simpl-schema'; - -const StringSchema = new SimpleSchema({ - basicString: { - type: String - }, - limitedString: { - type: String, - allowedValues: ['pro', 'con'] - }, - regExpString: { - type: String, - regEx: SimpleSchema.RegEx.Id - }, - createdAt: { - type: Date, - autoValue: () => new Date(), - }, - title: { - type: String, - label: "Argument", - /* TODO, this does not work: "The containing arrow function captures the global value of 'this' which implicitly has type 'any'." - custom: () => { - const text = this.value; - if (text.length > 10) return { type: SimpleSchema.ErrorTypes.MAX_STRING, max: 10 }; - } - */ - }, -}); - -StringSchema.validate({ - basicString: "Test", - limitedString: "pro", - regExpString: "id" -}); - - /* - , - title: { - type: String, - label: "Argument", - custom: function () { - var text = this.value; - text = text.replace(/https?:\/\/(www\.)?([-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6})\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi, '$2'); - - if(text.length > MAX_ARGUMENT_LENGTH) return { type: SimpleSchema.ErrorTypes.MAX_STRING, max: MAX_ARGUMENT_LENGTH } - else if(text.length < MIN_ARGUMENT_LENGTH) return { type: SimpleSchema.ErrorTypes.MIN_STRING, min: MIN_ARGUMENT_LENGTH } - } - }, - questionId: { - type: String, - regEx: SimpleSchema.RegEx.Id - }, - side: { - type: String, - allowedValues: ['pro', 'con'] - }, - userId: { - type: String, - regEx: SimpleSchema.RegEx.Id - }, - createdAt: { - type: Date, - autoValue: () => new Date(), - }, - clapCount: { - type: SimpleSchema.Integer, - defaultValue: 0 - }, - highlight: { - type: Array, - optional: true - }, - 'highlight.$': { - type: Object - }, - 'highlight.$.start': SimpleSchema.Integer, - 'highlight.$.end': SimpleSchema.Integer, - 'highlight.$.text': { - type: String, - trim: false - } - */ - /* - , - { - clean: { - filter: true, - autoConvert: true, - removeEmptyStrings: true, - trimStrings: true, - getAutoValues: true, - removeNullsFromArrays: true, - } - } - */ diff --git a/types/simpl-schema/tsconfig.json b/types/simpl-schema/tsconfig.json deleted file mode 100644 index d079496f4e..0000000000 --- a/types/simpl-schema/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", - "simpl-schema-tests.ts" - ] -} diff --git a/types/simpl-schema/tslint.json b/types/simpl-schema/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/simpl-schema/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } From e2a4a22af587be3c8b0e885a6bd6aa39ef580970 Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Tue, 4 Dec 2018 20:58:56 +0100 Subject: [PATCH 078/241] Revert "Added dependencies file" This reverts commit 3ba1ae85e26eea8062509b406ad1baf9e5092355. --- types/react-bootstrap-typeahead/package.json | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 types/react-bootstrap-typeahead/package.json diff --git a/types/react-bootstrap-typeahead/package.json b/types/react-bootstrap-typeahead/package.json deleted file mode 100644 index 4d9ec4a338..0000000000 --- a/types/react-bootstrap-typeahead/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "private": true, - "dependencies": { - "csstype": "^2.2.0" - } -} From 1d261238349a1013a4495654a1dd187bbfa64a1d Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Tue, 4 Dec 2018 21:00:21 +0100 Subject: [PATCH 079/241] Revert "Added definitions for Highlighter, Menu and MenuItem" This reverts commit d944d9c929913c6c3bce93eea1ecc485dfa2bc5d. --- types/react-bootstrap-typeahead/index.d.ts | 56 ++++--------------- .../react-bootstrap-typeahead-tests.tsx | 27 +-------- 2 files changed, 11 insertions(+), 72 deletions(-) diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 2c0495ce03..9fa23ac5f5 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-bootstrap-typeahead 3.4 +// Type definitions for react-bootstrap-typeahead 3.3 // Project: https://github.com/ericgio/react-bootstrap-typeahead // Definitions by: Guymestef // Rajab Shakirov @@ -6,23 +6,18 @@ // Andreas Richter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -// TODO: components +// TODO: , , , components import * as React from 'react'; -import * as CSS from 'csstype'; export interface TypeaheadFilterbyProps { - filterBy: string[]; - labelKey: (string | (() => void)); - multiple: boolean; - selected: any[]; - caseSensitive: boolean; - ignoreDiacritics: boolean; - text: string; -} - -export interface TypeaheadMenuProps { - text: string; + filterBy: string[]; + labelKey: (string | (() => void)); + multiple: boolean; + selected: any[]; + caseSensitive: boolean; + ignoreDiacritics: boolean; + text: string; } export interface TypeaheadProps { @@ -154,7 +149,7 @@ export interface TypeaheadProps { renderMenu?: (results: Array, menuProps: any) => any; /* Provides a hook for customized rendering of menu item contents. */ - renderMenuItemChildren?: (option: T, props: TypeaheadMenuProps, index: number) => any; + renderMenuItemChildren?: (option: T, props: TypeaheadProps, index: number) => any; /* Provides a hook for customized rendering of tokens when multiple selections are enabled. */ renderToken?: (selectedItem: T | string, onRemove: () => void) => any; @@ -189,34 +184,3 @@ export interface AsyncTypeaheadProps extends TypeaheadProps { } export const AsyncTypeahead: React.ClassicComponentClass>; - -export interface HighligherProps { - key: string; - search: string; -} - -export const Highlighter: React.ClassicComponentClass>; - -export interface MenuProps { - id: string; - className?: string; - emptyLabel?: string; - innerRef?: string; - maxHeight?: string; - style?: CSS.Properties; -} - -export const Menu: React.ClassicComponentClass>; - -export interface MenuItemProps { - option: T; - position: number; - label?: string; - active?: boolean; - className?: string; - disabled?: boolean; - onClick?: (e: Event) => any; - onMouseDown?: (e: Event) => any; -} - -export const MenuItem: React.ClassicComponentClass>; diff --git a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx index 5fcbe15328..6c9143dfea 100644 --- a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx +++ b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { Typeahead, Highlighter, Menu, MenuItem } from 'react-bootstrap-typeahead'; +import { Typeahead } from 'react-bootstrap-typeahead'; const options = [ { name: 'Alabama', population: 4780127, capital: 'Montgomery', region: 'South' }, @@ -36,31 +36,6 @@ class BasicExample extends React.Component { filterBy={(option, props) => (props.text.indexOf(option) !== -1) } placeholder="Choose a state..." /> - - - {option.name} - - } - /> - - - {options.map((o, idx) => ( - - {o.name} - - ))} - - ); } From 66aa94c11c723e0409ac274b4f62a0d4f3d20dab Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Tue, 4 Dec 2018 21:00:59 +0100 Subject: [PATCH 080/241] Revert "Fixed version..." This reverts commit 4b872aca1265d8ba44347fbdc33c204d9c123f33. --- types/react-bootstrap-typeahead/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 9fa23ac5f5..89188c8b86 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-bootstrap-typeahead 3.3 +// Type definitions for react-bootstrap-typeahead 3.2.2 // Project: https://github.com/ericgio/react-bootstrap-typeahead // Definitions by: Guymestef // Rajab Shakirov From bc6d1691571d6e8fe6808fe075d3249e3b5fd185 Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Tue, 4 Dec 2018 21:01:03 +0100 Subject: [PATCH 081/241] Revert "Increase version" This reverts commit 672ec749ab95fa2893469c2a2ebd6badb4336d58. --- types/react-bootstrap-typeahead/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 89188c8b86..d0bfcea9a7 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-bootstrap-typeahead 3.2.2 +// Type definitions for react-bootstrap-typeahead 3.2 // Project: https://github.com/ericgio/react-bootstrap-typeahead // Definitions by: Guymestef // Rajab Shakirov From 40dac65f4ed3e1cd7151714a2a9c88d44b7bbc00 Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Tue, 4 Dec 2018 21:01:06 +0100 Subject: [PATCH 082/241] Revert "Changed filterBy" This reverts commit f425f279923d7409a31bbdfdf2816db13ad454f4. --- types/react-bootstrap-typeahead/index.d.ts | 13 +------------ .../react-bootstrap-typeahead-tests.tsx | 8 -------- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index d0bfcea9a7..fa970bc5b3 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -3,23 +3,12 @@ // Definitions by: Guymestef // Rajab Shakirov // Paito Anderson -// Andreas Richter // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 // TODO: , , , components import * as React from 'react'; -export interface TypeaheadFilterbyProps { - filterBy: string[]; - labelKey: (string | (() => void)); - multiple: boolean; - selected: any[]; - caseSensitive: boolean; - ignoreDiacritics: boolean; - text: string; -} - export interface TypeaheadProps { /* For localized accessibility: Should return a string indicating the number of results for screen readers. Receives the current results. */ a11yNumResults?: () => void; @@ -69,7 +58,7 @@ export interface TypeaheadProps { emptyLabel?: string; /* Either an array of fields in option to search, or a custom filtering callback. */ - filterBy?: (string[] | ((option: T | string, props: TypeaheadFilterbyProps) => boolean)); + filterBy?: (string[] | ((option: T | string, text: string) => boolean)); /* Highlights the menu item if there is only one result and allows selecting that item by hitting enter. Does not work with allowNew. */ diff --git a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx index 6c9143dfea..10237b1fa0 100644 --- a/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx +++ b/types/react-bootstrap-typeahead/react-bootstrap-typeahead-tests.tsx @@ -28,14 +28,6 @@ class BasicExample extends React.Component { onInputChange={(value, e) => {}} placeholder="Choose a state..." /> - (props.text.indexOf(option) !== -1) } - placeholder="Choose a state..." - /> ); } From d01679afa6d11acd93f6adaa914d2ab74cf52afd Mon Sep 17 00:00:00 2001 From: arichter83 <36486293+arichter83@users.noreply.github.com> Date: Tue, 4 Dec 2018 21:02:19 +0100 Subject: [PATCH 083/241] Basic version of Simpl-Schema definition --- types/simpl-schema/index.d.ts | 195 +++++++++++++++++++++++ types/simpl-schema/simpl-schema-tests.ts | 96 +++++++++++ types/simpl-schema/tsconfig.json | 23 +++ types/simpl-schema/tslint.json | 1 + 4 files changed, 315 insertions(+) create mode 100644 types/simpl-schema/index.d.ts create mode 100644 types/simpl-schema/simpl-schema-tests.ts create mode 100644 types/simpl-schema/tsconfig.json create mode 100644 types/simpl-schema/tslint.json diff --git a/types/simpl-schema/index.d.ts b/types/simpl-schema/index.d.ts new file mode 100644 index 0000000000..32dd8d7b66 --- /dev/null +++ b/types/simpl-schema/index.d.ts @@ -0,0 +1,195 @@ +// Type definitions for simpl-schema 0.1 +// Project: https://github.com/aldeed/simple-schema-js +// Definitions by: Andreas Richter +// Qkramer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export class ValidationContext { + constructor(ss: any); + addValidationErrors(errors: any): void; + clean(...args: any[]): any; + getErrorForKey(key: any, ...args: any[]): any; + isValid(): any; + keyErrorMessage(key: any, ...args: any[]): any; + keyIsInvalid(key: any, ...args: any[]): any; + reset(): void; + setValidationErrors(errors: any): void; + validate(obj: any, ...args: any[]): any; + validationErrors(): any; +} + +interface CustomValidationContext { + value: any; +} + +interface SchemaDefinition { + type: any; + label?: string | (() => string); + optional?: boolean | (() => boolean); + min?: number | boolean | Date | (() => number | boolean | Date); + max?: number | boolean | Date | (() => number | boolean | Date); + minCount?: number | (() => number); + maxCount?: number | (() => number); + allowedValues?: any[] | (() => any[]); + decimal?: boolean; + exclusiveMax?: boolean; + exclusiveMin?: boolean; + regEx?: RegExp | RegExp[]; + custom?: () => any; + blackbox?: boolean; + autoValue?: () => any; + defaultValue?: any; + trim?: boolean; +} + +interface CleanOption { + filter?: boolean; + autoConvert?: boolean; + removeEmptyStrings?: boolean; + trimStrings?: boolean; + getAutoValues?: boolean; + isModifier?: boolean; + extendAutoValueContext?: boolean; +} + +// ??? +interface SimpleSchemaStatic { + new(schema: {[key: string]: SchemaDefinition} | any[]): SimpleSchema; + namedContext(name?: string): SimpleSchemaValidationContextStatic; + addValidator(validator: () => boolean): any; + pick(...fields: string[]): SimpleSchemaStatic; + omit(...fields: string[]): SimpleSchemaStatic; + clean(doc: any, options?: CleanOption): any; + schema(key?: string): SchemaDefinition | SchemaDefinition[]; + getDefinition(key: string, propList?: any, functionContext?: any): any; + keyIsInBlackBox(key: string): boolean; + labels(labels: {[key: string]: string}): void; + label(key: any): any; + Integer: RegExp; + messages(messages: any): any; + messageForError(type: any, key: any, def: any, value: any): string; + allowsKey(key: any): string; + newContext(): SimpleSchemaValidationContextStatic; + objectKeys(keyPrefix: any): any[]; + validate(obj: any, options?: ValidationOption): void; + validator(options: ValidationOption): () => boolean; + RegEx: { + Email: RegExp; + EmailWithTLD: RegExp; + Domain: RegExp; + WeakDomain: RegExp; + IP: RegExp; + IPv4: RegExp; + IPv6: RegExp; + Url: RegExp; + Id: RegExp; + ZipCode: RegExp; + Phone: RegExp; + }; + ErrorTypes: { + REQUIRED: string, + MIN_STRING: string, + MAX_STRING: string, + MIN_NUMBER: string, + MAX_NUMBER: string, + MIN_NUMBER_EXCLUSIVE: string, + MAX_NUMBER_EXCLUSIVE: string, + MIN_DATE: string, + MAX_DATE: string, + BAD_DATE: string, + MIN_COUNT: string, + MAX_COUNT: string, + MUST_BE_INTEGER: string, + VALUE_NOT_ALLOWED: string, + EXPECTED_TYPE: string, + FAILED_REGULAR_EXPRESSION: string, + KEY_NOT_IN_SCHEMA: string + }; +} + +interface ValidationOption { + modifier?: boolean; + upsert?: boolean; + clean?: boolean; + filter?: boolean; + upsertextendedCustomContext?: boolean; +} + +interface SimpleSchemaValidationContextStaticKeys { + name: string; + type: string; + value?: any; +} + +interface SimpleSchemaError { + name: string; + type: string; +} + +interface SimpleSchemaValidationContextStatic { + validate(obj: any, options?: ValidationOption): boolean; + validateOne(doc: any, keyName: string, options?: ValidationOption): boolean; + resetValidation(): void; + isValid(): boolean; + invalidKeys(): SimpleSchemaValidationContextStaticKeys[]; + addInvalidKeys(errors: SimpleSchemaError[]): void; + keyIsInvalid(name: any): boolean; + keyErrorMessage(name: any): string; + getErrorObject(): any; +} + +interface MongoObjectStatic { + forEachNode(func: (() => void), options?: {endPointsOnly: boolean}): void; + getValueForPosition(position: string): any; + setValueForPosition(position: string, value: any): void; + removeValueForPosition(position: string): void; + getKeyForPosition(position: string): any; + getGenericKeyForPosition(position: string): any; + getInfoForKey(key: string): any; + getPositionForKey(key: string): string; + getPositionsForGenericKey(key: string): string[]; + getValueForKey(key: string): any; + addKey(key: string, val: any, op: string): any; + removeGenericKeys(keys: string[]): void; + removeGenericKey(key: string): void; + removeKey(key: string): void; + removeKeys(keys: string[]): void; + filterGenericKeys(test: (() => boolean)): void; + setValueForKey(key: string, val: any): void; + setValueForGenericKey(key: string, val: any): void; + getObject(): any; + getFlatObject(options?: {keepArrays?: boolean}): any; + affectsKey(key: string): any; + affectsGenericKey(key: string): any; + affectsGenericKeyImplicit(key: string): any; +} + +export const SimpleSchema: SimpleSchemaStatic; +export const SimpleSchemaValidationContext: SimpleSchemaValidationContextStatic; +export const MongoObject: MongoObjectStatic; + +export interface SimpleSchema { + debug: boolean; + validate(obj: any, options?: ValidationOption): void; + addValidator(validator: () => boolean): any; + extendOptions(options: {[key: string]: any}): void; + messages(messages: any): void; + RegEx: { + Email: RegExp; + Domain: RegExp; + WeakDomain: RegExp; + IP: RegExp; + IPv4: RegExp; + IPv6: RegExp; + Url: RegExp; + Id: RegExp; + ZipCode: RegExp; + Phone: RegExp; + }; +} + +export interface MongoObject { + expandKey(val: any, key: string, obj: any): void; +} + +export default SimpleSchema; diff --git a/types/simpl-schema/simpl-schema-tests.ts b/types/simpl-schema/simpl-schema-tests.ts new file mode 100644 index 0000000000..3c40f0c4bb --- /dev/null +++ b/types/simpl-schema/simpl-schema-tests.ts @@ -0,0 +1,96 @@ +import SimpleSchema from 'simpl-schema'; + +const StringSchema = new SimpleSchema({ + basicString: { + type: String + }, + limitedString: { + type: String, + allowedValues: ['pro', 'con'] + }, + regExpString: { + type: String, + regEx: SimpleSchema.RegEx.Id + }, + createdAt: { + type: Date, + autoValue: () => new Date(), + }, + title: { + type: String, + label: "Argument", + /* TODO, this does not work: "The containing arrow function captures the global value of 'this' which implicitly has type 'any'." + custom: () => { + const text = this.value; + if (text.length > 10) return { type: SimpleSchema.ErrorTypes.MAX_STRING, max: 10 }; + } + */ + }, +}); + +StringSchema.validate({ + basicString: "Test", + limitedString: "pro", + regExpString: "id" +}); + + /* + , + title: { + type: String, + label: "Argument", + custom: function () { + var text = this.value; + text = text.replace(/https?:\/\/(www\.)?([-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6})\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi, '$2'); + + if(text.length > MAX_ARGUMENT_LENGTH) return { type: SimpleSchema.ErrorTypes.MAX_STRING, max: MAX_ARGUMENT_LENGTH } + else if(text.length < MIN_ARGUMENT_LENGTH) return { type: SimpleSchema.ErrorTypes.MIN_STRING, min: MIN_ARGUMENT_LENGTH } + } + }, + questionId: { + type: String, + regEx: SimpleSchema.RegEx.Id + }, + side: { + type: String, + allowedValues: ['pro', 'con'] + }, + userId: { + type: String, + regEx: SimpleSchema.RegEx.Id + }, + createdAt: { + type: Date, + autoValue: () => new Date(), + }, + clapCount: { + type: SimpleSchema.Integer, + defaultValue: 0 + }, + highlight: { + type: Array, + optional: true + }, + 'highlight.$': { + type: Object + }, + 'highlight.$.start': SimpleSchema.Integer, + 'highlight.$.end': SimpleSchema.Integer, + 'highlight.$.text': { + type: String, + trim: false + } + */ + /* + , + { + clean: { + filter: true, + autoConvert: true, + removeEmptyStrings: true, + trimStrings: true, + getAutoValues: true, + removeNullsFromArrays: true, + } + } + */ diff --git a/types/simpl-schema/tsconfig.json b/types/simpl-schema/tsconfig.json new file mode 100644 index 0000000000..d079496f4e --- /dev/null +++ b/types/simpl-schema/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", + "simpl-schema-tests.ts" + ] +} diff --git a/types/simpl-schema/tslint.json b/types/simpl-schema/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/simpl-schema/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 4ca42304a5ea6ce7429dce947b65be1459083811 Mon Sep 17 00:00:00 2001 From: Justin Francos Date: Tue, 4 Dec 2018 16:54:53 -0500 Subject: [PATCH 084/241] update MongoStore to include close() as per: https://github.com/jdesboeufs/connect-mongo/blob/9cbc56d5c35ce0a169ba4290549793979955433e/src/index.js#L315 --- types/connect-mongo/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/connect-mongo/index.d.ts b/types/connect-mongo/index.d.ts index ea39a13f42..7173cb50dc 100644 --- a/types/connect-mongo/index.d.ts +++ b/types/connect-mongo/index.d.ts @@ -110,6 +110,7 @@ declare namespace connectMongo { length: (callback: (err: any, length: number) => void) => void; clear: (callback?: (err?: any) => void) => void; touch: (sid: string, session: Express.SessionData, callback?: (err: any) => void) => void; + close: () => void; } } From 734b931c87758515eac1db3dab4f53a826db5aff Mon Sep 17 00:00:00 2001 From: TeamworkGuy2 Date: Tue, 4 Dec 2018 22:06:53 +0000 Subject: [PATCH 085/241] [shasum] Add shasum@1.0 definition --- types/shasum/index.d.ts | 14 ++++++++++++++ types/shasum/shasum-tests.ts | 7 +++++++ types/shasum/tsconfig.json | 23 +++++++++++++++++++++++ types/shasum/tslint.json | 1 + 4 files changed, 45 insertions(+) create mode 100644 types/shasum/index.d.ts create mode 100644 types/shasum/shasum-tests.ts create mode 100644 types/shasum/tsconfig.json create mode 100644 types/shasum/tslint.json diff --git a/types/shasum/index.d.ts b/types/shasum/index.d.ts new file mode 100644 index 0000000000..500c811d07 --- /dev/null +++ b/types/shasum/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for shasum 1.0 +// Project: https://github.com/dominictarr/shasum +// Definitions by: TeamworkGuy2 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Single function that return the sha1sum. Installing this is just a little bit quicker than reading the crypto documentation. + * var shasum = require('shasum') + * shasum(string || buffer || object) + * It also works in the browser with browserify. + */ +declare function shasum(str: any, alg?: string | null, format?: "hex" | "latin1" | "base64"): string; + +export = shasum; diff --git a/types/shasum/shasum-tests.ts b/types/shasum/shasum-tests.ts new file mode 100644 index 0000000000..01c0ba32fc --- /dev/null +++ b/types/shasum/shasum-tests.ts @@ -0,0 +1,7 @@ +import shasum = require("shasum"); + +function test(): string { + const res1 = shasum("source"); + const res2 = shasum({ prop: "source" }, null, "hex"); + return res1 || res2; +} diff --git a/types/shasum/tsconfig.json b/types/shasum/tsconfig.json new file mode 100644 index 0000000000..a0be2a9c4b --- /dev/null +++ b/types/shasum/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", + "shasum-tests.ts" + ] +} \ No newline at end of file diff --git a/types/shasum/tslint.json b/types/shasum/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/shasum/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f24094176065b5757b817f420b86f86729ae9fd9 Mon Sep 17 00:00:00 2001 From: Ivan Fernandes Date: Tue, 4 Dec 2018 20:10:08 -0200 Subject: [PATCH 086/241] changing github2 customHeaders option to correct type --- types/passport-github2/index.d.ts | 6 ++++-- types/passport-oauth2/index.d.ts | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/passport-github2/index.d.ts b/types/passport-github2/index.d.ts index 0b2c1f6a5d..4ca8e93124 100644 --- a/types/passport-github2/index.d.ts +++ b/types/passport-github2/index.d.ts @@ -3,12 +3,14 @@ // Definitions by: Yasunori Ohoka // Maarten Mulders // Christoph Werner +// Ivan Fernandes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import passport = require('passport'); import oauth2 = require('passport-oauth2'); import express = require('express'); +import { OutgoingHttpHeaders } from 'http'; export interface Profile extends passport.Profile { profileUrl: string; @@ -25,7 +27,7 @@ export interface StrategyOption extends passport.AuthenticateOptions { authorizationURL?: string; tokenURL?: string; scopeSeparator?: string; - customHeaders?: string; + customHeaders?: OutgoingHttpHeaders; userProfileURL?: string; } @@ -46,7 +48,7 @@ export interface _StrategyOptionsBase extends OAuth2StrategyOptionsWithoutRequir authorizationURL?: string; tokenURL?: string; scopeSeparator?: string; - customHeaders?: string; + customHeaders?: OutgoingHttpHeaders; userProfileURL?: string; } diff --git a/types/passport-oauth2/index.d.ts b/types/passport-oauth2/index.d.ts index cd78f377c2..28a1a06348 100644 --- a/types/passport-oauth2/index.d.ts +++ b/types/passport-oauth2/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Pasi Eronen // Wang Zishi // Eduardo AC +// Ivan Fernandes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 9be998dd15a67fbae8b3abe19ec8ef6d64775803 Mon Sep 17 00:00:00 2001 From: tassadarliu Date: Wed, 5 Dec 2018 10:05:27 +0800 Subject: [PATCH 087/241] add other ctors --- types/convict/index.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/convict/index.d.ts b/types/convict/index.d.ts index 8be23f1547..fd605f5077 100644 --- a/types/convict/index.d.ts +++ b/types/convict/index.d.ts @@ -49,7 +49,11 @@ declare namespace convict { | 'duration' | 'timestamp' | 'nat' - | String; + | String + | Object + | Number + | RegExp + | Boolean; interface SchemaObj { default: T; From 3c1d73bddbe0f8b771798a2ce355846425b6f3e5 Mon Sep 17 00:00:00 2001 From: Minjie Shen Date: Wed, 5 Dec 2018 16:57:56 +1100 Subject: [PATCH 088/241] Add typing for netease-captcha package --- types/netease-captcha/index.d.ts | 72 +++++++++++++++++++ .../netease-captcha/netease-captcha-tests.ts | 21 ++++++ types/netease-captcha/tsconfig.json | 22 ++++++ types/netease-captcha/tslint.json | 1 + 4 files changed, 116 insertions(+) create mode 100644 types/netease-captcha/index.d.ts create mode 100644 types/netease-captcha/netease-captcha-tests.ts create mode 100644 types/netease-captcha/tsconfig.json create mode 100644 types/netease-captcha/tslint.json diff --git a/types/netease-captcha/index.d.ts b/types/netease-captcha/index.d.ts new file mode 100644 index 0000000000..7a199b6d85 --- /dev/null +++ b/types/netease-captcha/index.d.ts @@ -0,0 +1,72 @@ +// Type definitions for netease-captcha x.x +// Project: https://cstaticdun.126.net/load.min.js +// Definitions by: Minjie Shen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + +declare interface Window { + initNECaptcha?: NeteaseCaptcha.InitFunction; +} + +declare namespace NeteaseCaptcha { + declare type InitFunction = (config: Config, onLoad?: onLoad, onError?: onError) => void; + + declare type Config = { + /** + * Verification code id + */ + captchaId: string, + + /** + * Selector string or HTMLElement to render widget into + */ + element: string | HTMLElement, + + /** + * Defaults to 'float' on desktop, and 'popup' on mobile + */ + mode?: 'float' | 'embed' | 'popup', + + /** + * Defaults to page protocol + */ + protocol?: 'http' | 'https', + + /** + * Defaults to 'auto' + */ + width?: number | string, + + /** + * Defaults to 'zh-CN' + */ + lang?: 'zh-CN' | 'en'; + + onReady?(instance: Instance): void; + + onVerify?(error: any, data: Data): void; + }; + + type Instance = { + /** + * Refresh the instance to get new verification information + */ + refresh(): void; + + /** + * Destroy the current instance + */ + destroy(): void; + + /** + * Available when the mode is set to 'popup' - opens the popup to accept verification + */ + popUp?(): void; + }; + + type Data = { validate: string }; + + type onLoad = (instance: Instance) => void; + + type onError = (error: any) => void; +} diff --git a/types/netease-captcha/netease-captcha-tests.ts b/types/netease-captcha/netease-captcha-tests.ts new file mode 100644 index 0000000000..05ed51c2bb --- /dev/null +++ b/types/netease-captcha/netease-captcha-tests.ts @@ -0,0 +1,21 @@ +const config : NeteaseCaptcha.Config = { + captchaId: 'FAKE ID', + element: '#captcha', + mode: 'popup', + protocol: 'https', + width: '200px', + lang: 'en', + onVerify: (error: any, data?: NeteaseCaptcha.Data) => { + console.log(error, data); + } + }; + +const onLoad : NeteaseCaptcha.onLoad = (instance : NeteaseCaptcha.Instance) => void { + instance.refresh(); + instance.destroy(); +} + +function init(initNECaptcha : NeteaseCaptcha.InitFunction) => void { + initNECaptcha(config, onLoad); +} + diff --git a/types/netease-captcha/tsconfig.json b/types/netease-captcha/tsconfig.json new file mode 100644 index 0000000000..67a7f5dd64 --- /dev/null +++ b/types/netease-captcha/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", + "netease-captcha-tests.ts" + ] +} diff --git a/types/netease-captcha/tslint.json b/types/netease-captcha/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/netease-captcha/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 1b11a2dd3567606a25656c3a32137515127290b7 Mon Sep 17 00:00:00 2001 From: Ben Talbot Date: Tue, 4 Dec 2018 22:10:35 -0800 Subject: [PATCH 089/241] Add types for @google-cloud/kms --- .../google-cloud__kms-tests.ts | 117 ++++++++ types/google-cloud__kms/index.d.ts | 275 ++++++++++++++++++ types/google-cloud__kms/tsconfig.json | 28 ++ types/google-cloud__kms/tslint.json | 7 + 4 files changed, 427 insertions(+) create mode 100644 types/google-cloud__kms/google-cloud__kms-tests.ts create mode 100644 types/google-cloud__kms/index.d.ts create mode 100644 types/google-cloud__kms/tsconfig.json create mode 100644 types/google-cloud__kms/tslint.json diff --git a/types/google-cloud__kms/google-cloud__kms-tests.ts b/types/google-cloud__kms/google-cloud__kms-tests.ts new file mode 100644 index 0000000000..e3f6648310 --- /dev/null +++ b/types/google-cloud__kms/google-cloud__kms-tests.ts @@ -0,0 +1,117 @@ +import kms = require('@google-cloud/kms'); + +let kmsClientV1: kms.v1.KeyManagementServiceClient; +kmsClientV1 = new kms.v1.KeyManagementServiceClient(); + +const credentials = { + type: 'service_account', + project_id: '****', + private_key_id: '****', + private_key: '****', + client_email: '****', + client_id: '****', + auth_uri: 'https://accounts.google.com/o/oauth2/auth', + token_uri: 'https://oauth2.googleapis.com/token', + auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs', + client_x509_cert_url: '****' +}; + +let kmsClient: kms.KeyManagementServiceClient; +kmsClient = new kms.KeyManagementServiceClient({ credentials }); + +async function exampleListKeyRings() { + const locationPath = kmsClient.locationPath('[PROJECT_ID]', '[LOCATION]'); + const [ asyncKeyRings ] = await kmsClient.listKeyRings({parent: locationPath}); + if (asyncKeyRings.length > 0) { + const keyRing = asyncKeyRings[ 0 ]; + console.log(`KeyRing: ${keyRing.name}`); + } + + kmsClient.listKeyRings({parent: locationPath}, (err, [ callbackKeyRings ]) => { + if (callbackKeyRings.length > 0) { + const keyRing = callbackKeyRings[ 0 ]; + console.log(`KeyRing: ${keyRing.name}`); + } + }); + + kmsClient.listKeyRings({parent: locationPath}, { timeout: 1000 }, (err, [ callbackWithOptionsKeyRings ]) => { + if (callbackWithOptionsKeyRings.length > 0) { + const keyRing = callbackWithOptionsKeyRings[ 0 ]; + console.log(`KeyRing: ${keyRing.name}`); + } + }); +} + +async function exampleListCryptoKeys() { + const keyRingPath = kmsClient.keyRingPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]'); + const [ asyncKeys ] = await kmsClient.listCryptoKeys({parent: keyRingPath}); + if (asyncKeys.length > 0) { + const key = asyncKeys[ 0 ]; + console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`); + } + + kmsClient.listCryptoKeys({parent: keyRingPath}, (err, [ callbackKeys ]) => { + if (callbackKeys.length > 0) { + const key = callbackKeys[ 0 ]; + console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`); + } + }); + + kmsClient.listCryptoKeys({parent: keyRingPath}, { timeout: 1000 }, (err, [ callbackWithOptionsKeys ]) => { + if (callbackWithOptionsKeys.length > 0) { + const key = callbackWithOptionsKeys[ 0 ]; + console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`); + } + }); +} + +async function exampleEncrypt() { + const formattedName = kmsClient.cryptoKeyPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]', '[KEY_ID]'); + const unencryptedText = new Buffer('Hello World'); + + const [ asyncEncryptResult ] = await kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') }); + if (asyncEncryptResult != null) { + console.log(`Encrypted: ${asyncEncryptResult.ciphertext.toString('base64')}`); + } + + kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') }, (err, [ callbackEncryptResult ]) => { + if (callbackEncryptResult != null) { + console.log(`Encrypted: ${callbackEncryptResult.ciphertext.toString('base64')}`); + } + }); + + kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') }, { timeout: 1000 }, (err, [ callbackWithOptionsEncryptResult ]) => { + if (callbackWithOptionsEncryptResult != null) { + console.log(`Encrypted: ${callbackWithOptionsEncryptResult.ciphertext.toString('base64')}`); + } + }); +} + +async function exampleDecrypt() { + // Example pulling a file from Cloud Storage + // const secretsStorage = new Storage({ credentials }); + // const bucket = secretsStorage.bucket('[KMS_STORAGE_BUCKET]'); + // const filePath = '[PATH_TO_KMS_ENCRYPTED_FILE'; + // const file = bucket.file(filePath); + // const buffers = await file.download(); + // const buffer = buffers[ 0 ]; + + const buffer = new Buffer('[ENCRYPTED_SOURCE_BUFFER]'); + const formattedName = kmsClient.cryptoKeyPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]', '[KEY_ID]'); + const [ asyncDecryptResult ] = await kmsClient.decrypt({name: formattedName, ciphertext: buffer.toString('base64') }); + if (asyncDecryptResult != null) { + console.log(`Decrypted: ${asyncDecryptResult.plaintext}`); + } + + kmsClient.decrypt({ name: formattedName, ciphertext: buffer.toString('base64') }, (err, [ callbackDecryptResult ]) => { + if (callbackDecryptResult != null) { + console.log(`Decrypted: ${callbackDecryptResult.plaintext}`); + } + }); + + kmsClient.decrypt({ name: formattedName, ciphertext: buffer.toString('base64') }, (err, [ callbackWithOptionsDecryptResult ]) => { + if (callbackWithOptionsDecryptResult != null) { + console.log(`Decrypted: ${callbackWithOptionsDecryptResult.plaintext}`); + } + }); +} diff --git a/types/google-cloud__kms/index.d.ts b/types/google-cloud__kms/index.d.ts new file mode 100644 index 0000000000..7f14a731bd --- /dev/null +++ b/types/google-cloud__kms/index.d.ts @@ -0,0 +1,275 @@ +// Type definitions for @google-cloud/kms 0.2 +// Project: https://github.com/googleapis/nodejs-kms +// Definitions by: Ben Talbot +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; + +declare module '@google-cloud/kms' { + namespace v1 { + enum CryptoKeyVersionAlgorithm { + // Not specified. + CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED = 0, + + // Creates symmetric encryption keys. + GOOGLE_SYMMETRIC_ENCRYPTION = 1, + + // RSASSA-PSS 2048 bit key with a SHA256 digest. + RSA_SIGN_PSS_2048_SHA256 = 2, + + // RSASSA-PSS 3072 bit key with a SHA256 digest. + RSA_SIGN_PSS_3072_SHA256 = 3, + + // RSASSA-PSS 4096 bit key with a SHA256 digest. + RSA_SIGN_PSS_4096_SHA256 = 4, + + // RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest. + RSA_SIGN_PKCS1_2048_SHA256 = 5, + + // RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest. + RSA_SIGN_PKCS1_3072_SHA256 = 6, + + // RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest. + RSA_SIGN_PKCS1_4096_SHA256 = 7, + + // RSAES-OAEP 2048 bit key with a SHA256 digest. + RSA_DECRYPT_OAEP_2048_SHA256 = 8, + + // RSAES-OAEP 3072 bit key with a SHA256 digest. + RSA_DECRYPT_OAEP_3072_SHA256 = 9, + + // RSAES-OAEP 4096 bit key with a SHA256 digest. + RSA_DECRYPT_OAEP_4096_SHA256 = 10, + + // ECDSA on the NIST P-256 curve with a SHA256 digest. + EC_SIGN_P256_SHA256 = 12, + + // ECDSA on the NIST P-384 curve with a SHA384 digest. + EC_SIGN_P384_SHA384 = 13, + } + + enum CryptoKeyVersionState { + // Not specified. + CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0, + + // This version is still being generated. It may not be used, enabled, + // disabled, or destroyed yet. Cloud KMS will automatically mark this + // version [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] as soon as the version is ready. + PENDING_GENERATION = 5, + + // This version may be used for cryptographic operations. + ENABLED = 1, + + // This version may not be used, but the key material is still available, + // and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state. + DISABLED = 2, + + // This version is destroyed, and the key material is no longer stored. + // A version may not leave this state once entered. + DESTROYED = 3, + + // This version is scheduled for destruction, and will be destroyed soon. + // Call + // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] + // to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state. + DESTROY_SCHEDULED = 4, + } + + enum CryptoKeyVersionView { + // Default view for each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not include + // the [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field. + CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0, + + // Provides all fields in each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the + // [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation]. + FULL = 1, + } + + enum ProtectionLevel { + // Not specified. + PROTECTION_LEVEL_UNSPECIFIED = 0, + + // Crypto operations are performed in software. + SOFTWARE = 1, + + // Crypto operations are performed in a Hardware Security Module. + HSM = 2, + } + + enum AttestationFormat { + ATTESTATION_FORMAT_UNSPECIFIED = 0, + + // Cavium HSM attestation compressed with gzip. Note that this format is + // defined by Cavium and subject to change at any time. + CAVIUM_V1_COMPRESSED = 3, + } + + interface KeyOperationAttestation { + format: AttestationFormat; + } + + interface CryptoKeyVersion { + name: string; + state: CryptoKeyVersionState; + protectionLevel: ProtectionLevel; + algorithm: CryptoKeyVersionAlgorithm; + attestation?: KeyOperationAttestation; + createTime: google_protobuf_timestamp_pb.Timestamp.AsObject; + generateTime: google_protobuf_timestamp_pb.Timestamp.AsObject; + destroyTime?: google_protobuf_timestamp_pb.Timestamp.AsObject; + destroyEventTime?: google_protobuf_timestamp_pb.Timestamp.AsObject; + } + + interface CryptoKeyVersionTemplate { + protectionLevel: ProtectionLevel; + algorithm: CryptoKeyVersionAlgorithm; + } + + enum CryptoKeyPurpose { + // Not specified. + CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0, + + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with + // [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and + // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. + ENCRYPT_DECRYPT = 1, + + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with + // [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign] and + // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. + ASYMMETRIC_SIGN = 5, + + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with + // [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt] and + // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. + ASYMMETRIC_DECRYPT = 6, + } + + interface CryptoKey { + name: string; + primary: CryptoKeyVersion; + purpose: CryptoKeyPurpose; + createTime: google_protobuf_timestamp_pb.Timestamp.AsObject; + nextRotationTime?: google_protobuf_timestamp_pb.Timestamp.AsObject; + versionTemplate: CryptoKeyVersionTemplate; + labels: { [s: string]: string; }; + } + + interface KeyRing { + name: string; + createTime: google_protobuf_timestamp_pb.Timestamp.AsObject; + } + + namespace KeyManagementServiceClient { + interface ConfigurationObject { + credentials?: { + client_email?: string; + private_key?: string + }; + email?: string; + keyFilename?: string; + port?: number; + projectId?: string; + promise?: any; + servicePath?: string; + } + + interface EncryptRequest { + name: string; + plaintext: string; + additionalAuthenticatedData?: string; + } + interface EncryptResponse { + name: string; + ciphertext: Buffer; + } + type EncryptCallback = (err: Error | null, apiResponse: [EncryptResponse, any, any]) => void; + + interface DecryptRequest { + name: string; + ciphertext: string; + additionalAuthenticatedData?: string; + } + interface DecryptResponse { + plaintext: Buffer; + } + type DecryptCallback = (err: Error | null, apiResponse: [DecryptResponse, any, any]) => void; + + interface ListKeyRingsRequest { + parent: string; + page_size?: number; + page_token?: string; + } + type ListKeyRingsCallback = (err: Error | null, apiResponse: [KeyRing[], any, any]) => void; + + interface ListCryptoKeysRequest { + parent: string; + page_size?: number; + page_token?: string; + } + type ListCryptoKeysCallback = (err: Error | null, apiResponse: [CryptoKey[], any, any]) => void; + } + + class KeyManagementServiceClient { + constructor(options?: KeyManagementServiceClient.ConfigurationObject); + + keyRingPath(project: string, location: string, keyRing: string): string; + cryptoKeyPathPath(project: string, location: string, keyRing: string, cryptoKeyPath: string): string; + locationPath(project: string, location: string): string; + cryptoKeyPath(project: string, location: string, keyRing: string, cryptoKey: string): string; + cryptoKeyVersionPath(project: string, location: string, keyRing: string, cryptoKey: string, cryptoKeyVersion: string): string; + + encrypt(request: KeyManagementServiceClient.EncryptRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyManagementServiceClient.EncryptResponse, any, any]>; + encrypt(request: KeyManagementServiceClient.EncryptRequest, callback: KeyManagementServiceClient.EncryptCallback): void; + encrypt(request: KeyManagementServiceClient.EncryptRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.EncryptCallback): void; + + decrypt(request: KeyManagementServiceClient.DecryptRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyManagementServiceClient.DecryptResponse, any, any]>; + decrypt(request: KeyManagementServiceClient.DecryptRequest, callback: KeyManagementServiceClient.DecryptCallback): void; + decrypt(request: KeyManagementServiceClient.DecryptRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.DecryptCallback): void; + + listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyRing[], any, any]>; + listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, callback: KeyManagementServiceClient.ListKeyRingsCallback): void; + listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.ListKeyRingsCallback): void; + + listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, gaxOpts?: GAX.CallOptions): Promise<[CryptoKey[], any, any]>; + listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, callback: KeyManagementServiceClient.ListCryptoKeysCallback): void; + listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.ListCryptoKeysCallback): void; + } + } + + class KeyManagementServiceClient extends v1.KeyManagementServiceClient { + constructor(options?: v1.KeyManagementServiceClient.ConfigurationObject); + } + + namespace GAX { + /** https://googleapis.github.io/gax-nodejs/global.html#CallOptions */ + interface CallOptions { + timeout?: number; + retry?: RetryOptions; + autoPaginate?: boolean; + pageToken?: object; + isBundling?: boolean; + longrunning?: BackoffSettings; + promise?: PromiseConstructor; // FIXME Unsure if this is the correct type; remove this comment if it is + } + + /** https://googleapis.github.io/gax-nodejs/global.html#RetryOptions */ + interface RetryOptions { + retryCodes: string[]; + backoffSettings: BackoffSettings; + } + + /** https://googleapis.github.io/gax-nodejs/global.html#BackoffSettings */ + interface BackoffSettings { + initialRetryDelayMillis: number; + retryDelayMultiplier: number; + maxRetryDelayMillis: number; + initialRpcTimeoutMillis: number; + maxRpcTimeoutMillis: number; + totalTimeoutMillis: number; + } + } +} diff --git a/types/google-cloud__kms/tsconfig.json b/types/google-cloud__kms/tsconfig.json new file mode 100644 index 0000000000..bb1ba097cc --- /dev/null +++ b/types/google-cloud__kms/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "paths": { + "@google-cloud/kms": [ + "google-cloud__kms" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "google-cloud__kms-tests.ts" + ] +} \ No newline at end of file diff --git a/types/google-cloud__kms/tslint.json b/types/google-cloud__kms/tslint.json new file mode 100644 index 0000000000..1f75469243 --- /dev/null +++ b/types/google-cloud__kms/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "indent": [true, "tabs"], + "no-single-declare-module": false + } +} From 6f7086044fba04f62991fcbf961911f746d15b62 Mon Sep 17 00:00:00 2001 From: Ben Talbot Date: Tue, 4 Dec 2018 22:21:22 -0800 Subject: [PATCH 090/241] Remove "no-single-declare-module": false from tslint.json --- types/google-cloud__kms/tslint.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/google-cloud__kms/tslint.json b/types/google-cloud__kms/tslint.json index 1f75469243..ffaae9bd46 100644 --- a/types/google-cloud__kms/tslint.json +++ b/types/google-cloud__kms/tslint.json @@ -1,7 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "indent": [true, "tabs"], - "no-single-declare-module": false + "indent": [true, "tabs"] } } From f225c53dc1ac9c8b10cf69fa6ce74c623246c9ab Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Sun, 25 Nov 2018 23:56:28 +0100 Subject: [PATCH 091/241] Add types for sasl-anonymous --- types/sasl-anonymous/index.d.ts | 29 ++++++++++++++++++++ types/sasl-anonymous/sasl-anonymous-tests.ts | 22 +++++++++++++++ types/sasl-anonymous/tsconfig.json | 23 ++++++++++++++++ types/sasl-anonymous/tslint.json | 1 + 4 files changed, 75 insertions(+) create mode 100644 types/sasl-anonymous/index.d.ts create mode 100644 types/sasl-anonymous/sasl-anonymous-tests.ts create mode 100644 types/sasl-anonymous/tsconfig.json create mode 100644 types/sasl-anonymous/tslint.json diff --git a/types/sasl-anonymous/index.d.ts b/types/sasl-anonymous/index.d.ts new file mode 100644 index 0000000000..b438a411d7 --- /dev/null +++ b/types/sasl-anonymous/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for sasl-anonymous 0.1 +// Project: https://github.com/jaredhanson/js-sasl-anonymous +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Mechanism } from 'saslmechanisms'; + +export = AnonymousMechanism; + +declare class AnonymousMechanism implements Mechanism { + static Mechanism: typeof AnonymousMechanism; + static prototype: { + name: 'ANONYMOUS'; + clientFirst: true; + }; + + name: 'ANONYMOUS'; + clientFirst: true; + + response(cred: AnonymousMechanism.Credentials): string; + + challenge(chal: string): void; +} + +declare namespace AnonymousMechanism { + interface Credentials { + trace?: string; + } +} diff --git a/types/sasl-anonymous/sasl-anonymous-tests.ts b/types/sasl-anonymous/sasl-anonymous-tests.ts new file mode 100644 index 0000000000..dd993fa49d --- /dev/null +++ b/types/sasl-anonymous/sasl-anonymous-tests.ts @@ -0,0 +1,22 @@ +import AnonymousMechanism = require('sasl-anonymous'); +import { Mechanism } from 'sasl-anonymous'; +import { Factory } from 'saslmechanisms'; + +new Factory().use(AnonymousMechanism); +new Factory().use(Mechanism); + +// $ExpectType "ANONYMOUS" +AnonymousMechanism.prototype.name; +// $ExpectType true +AnonymousMechanism.prototype.clientFirst; + +const m = new AnonymousMechanism(); + +// $ExpectType "ANONYMOUS" +m.name; +// $ExpectType true +m.clientFirst; +// $ExpectType string +m.response({ trace: 't' }); +// $ExpectType void +m.challenge('challenge'); diff --git a/types/sasl-anonymous/tsconfig.json b/types/sasl-anonymous/tsconfig.json new file mode 100644 index 0000000000..5a9ebd2f35 --- /dev/null +++ b/types/sasl-anonymous/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", + "sasl-anonymous-tests.ts" + ] +} diff --git a/types/sasl-anonymous/tslint.json b/types/sasl-anonymous/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sasl-anonymous/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 0eebf91a2d2ac25a45eeeb8e60dbff0c8c8059cd Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Sun, 25 Nov 2018 23:57:42 +0100 Subject: [PATCH 092/241] Add types for sasl-digest-md5 --- types/sasl-digest-md5/index.d.ts | 41 +++++++++++++++++++ .../sasl-digest-md5/sasl-digest-md5-tests.ts | 30 ++++++++++++++ types/sasl-digest-md5/tsconfig.json | 23 +++++++++++ types/sasl-digest-md5/tslint.json | 1 + 4 files changed, 95 insertions(+) create mode 100644 types/sasl-digest-md5/index.d.ts create mode 100644 types/sasl-digest-md5/sasl-digest-md5-tests.ts create mode 100644 types/sasl-digest-md5/tsconfig.json create mode 100644 types/sasl-digest-md5/tslint.json diff --git a/types/sasl-digest-md5/index.d.ts b/types/sasl-digest-md5/index.d.ts new file mode 100644 index 0000000000..001875f330 --- /dev/null +++ b/types/sasl-digest-md5/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for sasl-digest-md5 0.1 +// Project: https://github.com/jaredhanson/js-sasl-digest-md5 +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Mechanism } from 'saslmechanisms'; + +export = DigestMd5Mechanism; + +declare class DigestMd5Mechanism implements Mechanism { + static Mechanism: typeof DigestMd5Mechanism; + static prototype: { + name: 'DIGEST-MD5'; + clientFirst: false; + }; + + name: 'DIGEST-MD5'; + clientFirst: false; + + constructor(options?: DigestMd5Mechanism.Options); + + response(cred: DigestMd5Mechanism.Credentials): string; + + challenge(chal: string): this; +} + +declare namespace DigestMd5Mechanism { + interface Options { + genNonce?: () => number; + } + + interface Credentials { + serviceType: string; + host: string; + username: string; + password: string; + serviceName?: string; + realm?: string; + authzid?: string; + } +} diff --git a/types/sasl-digest-md5/sasl-digest-md5-tests.ts b/types/sasl-digest-md5/sasl-digest-md5-tests.ts new file mode 100644 index 0000000000..f63c4b7359 --- /dev/null +++ b/types/sasl-digest-md5/sasl-digest-md5-tests.ts @@ -0,0 +1,30 @@ +import DigestMd5Mechanism = require('sasl-digest-md5'); +import { Mechanism } from 'sasl-digest-md5'; +import { Factory } from 'saslmechanisms'; + +new Factory().use(DigestMd5Mechanism); +new Factory().use(Mechanism); + +// $ExpectType "DIGEST-MD5" +DigestMd5Mechanism.prototype.name; +// $ExpectType false +DigestMd5Mechanism.prototype.clientFirst; + +const m = new DigestMd5Mechanism(); +new DigestMd5Mechanism({ + genNonce() { + return 1; + }, +}); + +// $ExpectType "DIGEST-MD5" +m.name; +// $ExpectType false +m.clientFirst; +// $ExpectType string +m.response({ serviceType: 's', host: 'h', username: 'u', password: 'p' }); +m.response({ serviceType: 's', host: 'h', username: 'u', password: 'p', serviceName: 'sn' }); +m.response({ serviceType: 's', host: 'h', username: 'u', password: 'p', realm: 'r' }); +m.response({ serviceType: 's', host: 'h', username: 'u', password: 'p', authzid: 'a' }); +// $ExpectType DigestMd5Mechanism +m.challenge('challenge'); diff --git a/types/sasl-digest-md5/tsconfig.json b/types/sasl-digest-md5/tsconfig.json new file mode 100644 index 0000000000..84059391b2 --- /dev/null +++ b/types/sasl-digest-md5/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", + "sasl-digest-md5-tests.ts" + ] +} diff --git a/types/sasl-digest-md5/tslint.json b/types/sasl-digest-md5/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sasl-digest-md5/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 2133ee8e4c24f7c242f77d1680e77073a6e0b771 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Sun, 25 Nov 2018 23:58:42 +0100 Subject: [PATCH 093/241] Add types for sasl-external --- types/sasl-external/index.d.ts | 29 ++++++++++++++++++++++ types/sasl-external/sasl-external-tests.ts | 22 ++++++++++++++++ types/sasl-external/tsconfig.json | 23 +++++++++++++++++ types/sasl-external/tslint.json | 1 + 4 files changed, 75 insertions(+) create mode 100644 types/sasl-external/index.d.ts create mode 100644 types/sasl-external/sasl-external-tests.ts create mode 100644 types/sasl-external/tsconfig.json create mode 100644 types/sasl-external/tslint.json diff --git a/types/sasl-external/index.d.ts b/types/sasl-external/index.d.ts new file mode 100644 index 0000000000..06a90ce3a4 --- /dev/null +++ b/types/sasl-external/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for sasl-external 0.1 +// Project: https://github.com/jaredhanson/js-sasl-external +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Mechanism } from 'saslmechanisms'; + +export = ExternalMechanism; + +declare class ExternalMechanism implements Mechanism { + static Mechanism: typeof ExternalMechanism; + static prototype: { + name: 'EXTERNAL'; + clientFirst: true; + }; + + name: 'EXTERNAL'; + clientFirst: true; + + response(cred: ExternalMechanism.Credentials): string; + + challenge(chal: string): void; +} + +declare namespace ExternalMechanism { + interface Credentials { + authzid?: string; + } +} diff --git a/types/sasl-external/sasl-external-tests.ts b/types/sasl-external/sasl-external-tests.ts new file mode 100644 index 0000000000..919721aec5 --- /dev/null +++ b/types/sasl-external/sasl-external-tests.ts @@ -0,0 +1,22 @@ +import ExternalMechanism = require('sasl-external'); +import { Mechanism } from 'sasl-external'; +import { Factory } from 'saslmechanisms'; + +new Factory().use(ExternalMechanism); +new Factory().use(Mechanism); + +// $ExpectType "EXTERNAL" +ExternalMechanism.prototype.name; +// $ExpectType true +ExternalMechanism.prototype.clientFirst; + +const m = new ExternalMechanism(); + +// $ExpectType "EXTERNAL" +m.name; +// $ExpectType true +m.clientFirst; +// $ExpectType string +m.response({ authzid: 'a' }); +// $ExpectType void +m.challenge('challenge'); diff --git a/types/sasl-external/tsconfig.json b/types/sasl-external/tsconfig.json new file mode 100644 index 0000000000..b319008559 --- /dev/null +++ b/types/sasl-external/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", + "sasl-external-tests.ts" + ] +} diff --git a/types/sasl-external/tslint.json b/types/sasl-external/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sasl-external/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 0b80d92a10d2e643ec871e8ba80a0ab18ebd2a8e Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Sun, 25 Nov 2018 23:59:27 +0100 Subject: [PATCH 094/241] Add types for sasl-plain --- types/sasl-plain/index.d.ts | 31 ++++++++++++++++++++++++++++ types/sasl-plain/sasl-plain-tests.ts | 23 +++++++++++++++++++++ types/sasl-plain/tsconfig.json | 23 +++++++++++++++++++++ types/sasl-plain/tslint.json | 1 + 4 files changed, 78 insertions(+) create mode 100644 types/sasl-plain/index.d.ts create mode 100644 types/sasl-plain/sasl-plain-tests.ts create mode 100644 types/sasl-plain/tsconfig.json create mode 100644 types/sasl-plain/tslint.json diff --git a/types/sasl-plain/index.d.ts b/types/sasl-plain/index.d.ts new file mode 100644 index 0000000000..a1c5f61467 --- /dev/null +++ b/types/sasl-plain/index.d.ts @@ -0,0 +1,31 @@ +// Type definitions for sasl-plain 0.1 +// Project: https://github.com/jaredhanson/js-sasl-plain +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Mechanism } from 'saslmechanisms'; + +export = PlainMechanism; + +declare class PlainMechanism implements Mechanism { + static Mechanism: typeof PlainMechanism; + static prototype: { + name: 'PLAIN'; + clientFirst: true; + }; + + name: 'PLAIN'; + clientFirst: true; + + response(cred: PlainMechanism.Credentials): string; + + challenge(chal: string): this; +} + +declare namespace PlainMechanism { + interface Credentials { + authzid?: string; + username: string; + password: string; + } +} diff --git a/types/sasl-plain/sasl-plain-tests.ts b/types/sasl-plain/sasl-plain-tests.ts new file mode 100644 index 0000000000..144d21451f --- /dev/null +++ b/types/sasl-plain/sasl-plain-tests.ts @@ -0,0 +1,23 @@ +import PlainMechanism = require('sasl-plain'); +import { Mechanism } from 'sasl-plain'; +import { Factory } from 'saslmechanisms'; + +new Factory().use(PlainMechanism); +new Factory().use(Mechanism); + +// $ExpectType "PLAIN" +PlainMechanism.prototype.name; +// $ExpectType true +PlainMechanism.prototype.clientFirst; + +const m = new PlainMechanism(); + +// $ExpectType "PLAIN" +m.name; +// $ExpectType true +m.clientFirst; +// $ExpectType string +m.response({ username: 'u', password: 'pw' }); +m.response({ username: 'u', password: 'pw', authzid: 'a' }); +// $ExpectType PlainMechanism +m.challenge('challenge'); diff --git a/types/sasl-plain/tsconfig.json b/types/sasl-plain/tsconfig.json new file mode 100644 index 0000000000..3e33152c74 --- /dev/null +++ b/types/sasl-plain/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", + "sasl-plain-tests.ts" + ] +} diff --git a/types/sasl-plain/tslint.json b/types/sasl-plain/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sasl-plain/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 2e722d3138e0103158de95c755376085e01a030f Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Mon, 26 Nov 2018 00:01:17 +0100 Subject: [PATCH 095/241] Add types for sasl-scram-sha-1 --- types/sasl-scram-sha-1/index.d.ts | 41 +++++++++++++++++++ .../sasl-scram-sha-1-tests.ts | 33 +++++++++++++++ types/sasl-scram-sha-1/tsconfig.json | 23 +++++++++++ types/sasl-scram-sha-1/tslint.json | 1 + 4 files changed, 98 insertions(+) create mode 100644 types/sasl-scram-sha-1/index.d.ts create mode 100644 types/sasl-scram-sha-1/sasl-scram-sha-1-tests.ts create mode 100644 types/sasl-scram-sha-1/tsconfig.json create mode 100644 types/sasl-scram-sha-1/tslint.json diff --git a/types/sasl-scram-sha-1/index.d.ts b/types/sasl-scram-sha-1/index.d.ts new file mode 100644 index 0000000000..d332b6126a --- /dev/null +++ b/types/sasl-scram-sha-1/index.d.ts @@ -0,0 +1,41 @@ +// Type definitions for sasl-scram-sha-1 1.2 +// Project: https://github.com/legastero/js-sasl-scram-sha-1 +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { Mechanism } from 'saslmechanisms'; + +export = ScramSha1Mechanism; + +declare class ScramSha1Mechanism implements Mechanism { + static Mechanism: typeof ScramSha1Mechanism; + static prototype: { + name: 'SCRAM-SHA-1'; + clientFirst: true; + }; + + name: 'SCRAM-SHA-1'; + clientFirst: true; + + constructor(options?: ScramSha1Mechanism.Options); + + response(cred: ScramSha1Mechanism.Credentials): string; + + challenge(chal: string): this; +} + +declare namespace ScramSha1Mechanism { + interface Options { + genNonce?: () => number; + } + + interface Credentials { + authzid?: string; + username?: string; + password?: string; + salt?: string; + saltedPassword?: string; + clientKey?: string; + serverKey?: string; + } +} diff --git a/types/sasl-scram-sha-1/sasl-scram-sha-1-tests.ts b/types/sasl-scram-sha-1/sasl-scram-sha-1-tests.ts new file mode 100644 index 0000000000..85eb648193 --- /dev/null +++ b/types/sasl-scram-sha-1/sasl-scram-sha-1-tests.ts @@ -0,0 +1,33 @@ +import ScramSha1Mechanism = require('sasl-scram-sha-1'); +import { Mechanism } from 'sasl-scram-sha-1'; +import { Factory } from 'saslmechanisms'; + +new Factory().use(ScramSha1Mechanism); +new Factory().use(Mechanism); + +// $ExpectType "SCRAM-SHA-1" +ScramSha1Mechanism.prototype.name; +// $ExpectType true +ScramSha1Mechanism.prototype.clientFirst; + +const m = new ScramSha1Mechanism(); +new ScramSha1Mechanism({ + genNonce() { + return 1; + }, +}); + +// $ExpectType "SCRAM-SHA-1" +m.name; +// $ExpectType true +m.clientFirst; +// $ExpectType string +m.response({ authzid: 'a' }); +m.response({ username: 'u' }); +m.response({ password: 'pw' }); +m.response({ salt: 's' }); +m.response({ saltedPassword: 'sp' }); +m.response({ clientKey: 'ck' }); +m.response({ serverKey: 'sk' }); +// $ExpectType ScramSha1Mechanism +m.challenge('challenge'); diff --git a/types/sasl-scram-sha-1/tsconfig.json b/types/sasl-scram-sha-1/tsconfig.json new file mode 100644 index 0000000000..80181379ea --- /dev/null +++ b/types/sasl-scram-sha-1/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", + "sasl-scram-sha-1-tests.ts" + ] +} diff --git a/types/sasl-scram-sha-1/tslint.json b/types/sasl-scram-sha-1/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sasl-scram-sha-1/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f3ba892a8346f8d5b2c69206d7eb195dbdc216da Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Wed, 5 Dec 2018 18:06:30 +0900 Subject: [PATCH 096/241] Add unist-util-is --- types/unist-util-is/index.d.ts | 36 ++++++++++++++++++++++ types/unist-util-is/tsconfig.json | 23 ++++++++++++++ types/unist-util-is/tslint.json | 1 + types/unist-util-is/unist-util-is-tests.ts | 34 ++++++++++++++++++++ 4 files changed, 94 insertions(+) create mode 100644 types/unist-util-is/index.d.ts create mode 100644 types/unist-util-is/tsconfig.json create mode 100644 types/unist-util-is/tslint.json create mode 100644 types/unist-util-is/unist-util-is-tests.ts diff --git a/types/unist-util-is/index.d.ts b/types/unist-util-is/index.d.ts new file mode 100644 index 0000000000..831b06f0e4 --- /dev/null +++ b/types/unist-util-is/index.d.ts @@ -0,0 +1,36 @@ +// Type definitions for unist-util-is 2.1 +// Project: https://github.com/syntax-tree/unist-util-is#readme +// Definitions by: Junyoung Choi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +/// + +import * as Unist from 'unist'; + +declare namespace unistUtilIs { + /** + * @param node Node to test + * @param index Position of node in parent + * @param parent Parent of node + */ + type TestFunction = (this: C, node: unknown, index: number, parent: Unist.Parent) => boolean | void; + type Test = TestFunction | Partial | string | null; +} + +/** + * Unist utility to check if a node passes a test. + * + * @param test When not given, checks if `node` is a `Node`. + * When `string`, works like passing `function (node) {return node.type === test}`. + * When `array`, checks any one of the subtests pass. + * When `object`, checks that all keys in test are in node, and that they have (strictly) equal values + * @param node Node to check. `false` is returned + * @param index Position of `node` in `parent` + * @param parent Parent of `node` + * @param context Context object to invoke `test` with + * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). + */ +declare function unistUtilIs(test: unistUtilIs.Test | Array>, node: unknown, index?: number, parent?: Unist.Parent, context?: any): boolean; + +export = unistUtilIs; diff --git a/types/unist-util-is/tsconfig.json b/types/unist-util-is/tsconfig.json new file mode 100644 index 0000000000..dbe499fef0 --- /dev/null +++ b/types/unist-util-is/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", + "unist-util-is-tests.ts" + ] +} diff --git a/types/unist-util-is/tslint.json b/types/unist-util-is/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/unist-util-is/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/unist-util-is/unist-util-is-tests.ts b/types/unist-util-is/unist-util-is-tests.ts new file mode 100644 index 0000000000..430d58746d --- /dev/null +++ b/types/unist-util-is/unist-util-is-tests.ts @@ -0,0 +1,34 @@ +import is = require('unist-util-is'); + +const node = {type: 'strong'}; +const parent = {type: 'paragraph', children: [node]}; + +function test(node: unknown, n: number) { + return n === 5; +} + +is(null, {children: []}); +is(null, node); +is('strong', node); +is('emphasis', node); + +is(node, node); +is({type: 'paragraph'}, parent); +is({type: 'strong'}, parent); + +is(test, node); +is(test, node, 4, parent); +is(test, node, 5, parent); + +interface TestContext { + some: string; +} +function testWithContext(this: TestContext, node: unknown) {} +is(testWithContext, node); + +const wrongTestFunc: is.TestFunction = (node: unknown, n: string) => {}; // $ExpectError + +interface OtherTestContext { + some: number; +} +is(testWithContext, node); // $ExpectError From 8a416301e43da9cdb89db2b7c1d17ac8c6389f24 Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Wed, 5 Dec 2018 18:17:45 +0900 Subject: [PATCH 097/241] Make index and parent optional --- types/unist-util-is/index.d.ts | 2 +- types/unist-util-is/unist-util-is-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/unist-util-is/index.d.ts b/types/unist-util-is/index.d.ts index 831b06f0e4..ae92217c6e 100644 --- a/types/unist-util-is/index.d.ts +++ b/types/unist-util-is/index.d.ts @@ -14,7 +14,7 @@ declare namespace unistUtilIs { * @param index Position of node in parent * @param parent Parent of node */ - type TestFunction = (this: C, node: unknown, index: number, parent: Unist.Parent) => boolean | void; + type TestFunction = (this: C, node: unknown, index?: number, parent?: Unist.Parent) => boolean | void; type Test = TestFunction | Partial | string | null; } diff --git a/types/unist-util-is/unist-util-is-tests.ts b/types/unist-util-is/unist-util-is-tests.ts index 430d58746d..4d355c90ec 100644 --- a/types/unist-util-is/unist-util-is-tests.ts +++ b/types/unist-util-is/unist-util-is-tests.ts @@ -3,7 +3,7 @@ import is = require('unist-util-is'); const node = {type: 'strong'}; const parent = {type: 'paragraph', children: [node]}; -function test(node: unknown, n: number) { +function test(node: unknown, n?: number) { return n === 5; } From b3ae835f65271d63ca326e287b419b6a2d08d234 Mon Sep 17 00:00:00 2001 From: arichter83 Date: Wed, 5 Dec 2018 10:44:07 +0100 Subject: [PATCH 098/241] Extended test case --- types/simpl-schema/index.d.ts | 13 ++++- types/simpl-schema/simpl-schema-tests.ts | 73 +++++++----------------- 2 files changed, 31 insertions(+), 55 deletions(-) diff --git a/types/simpl-schema/index.d.ts b/types/simpl-schema/index.d.ts index 32dd8d7b66..d5527b0697 100644 --- a/types/simpl-schema/index.d.ts +++ b/types/simpl-schema/index.d.ts @@ -50,11 +50,20 @@ interface CleanOption { getAutoValues?: boolean; isModifier?: boolean; extendAutoValueContext?: boolean; + removeNullsFromArrays?: boolean; +} + +interface SimpleSchemaOptions { + check?: boolean; + clean?: CleanOption; + defaultLabel?: string; + humanizeAutoLabels?: boolean; + requiredByDefault?: boolean; + tracker?: any; } -// ??? interface SimpleSchemaStatic { - new(schema: {[key: string]: SchemaDefinition} | any[]): SimpleSchema; + new(schema: {[key: string]: SchemaDefinition} | any[], options?: SimpleSchemaOptions): SimpleSchema; namedContext(name?: string): SimpleSchemaValidationContextStatic; addValidator(validator: () => boolean): any; pick(...fields: string[]): SimpleSchemaStatic; diff --git a/types/simpl-schema/simpl-schema-tests.ts b/types/simpl-schema/simpl-schema-tests.ts index 3c40f0c4bb..49c166070d 100644 --- a/types/simpl-schema/simpl-schema-tests.ts +++ b/types/simpl-schema/simpl-schema-tests.ts @@ -34,63 +34,30 @@ StringSchema.validate({ regExpString: "id" }); - /* - , - title: { - type: String, - label: "Argument", - custom: function () { - var text = this.value; - text = text.replace(/https?:\/\/(www\.)?([-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6})\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/gi, '$2'); - - if(text.length > MAX_ARGUMENT_LENGTH) return { type: SimpleSchema.ErrorTypes.MAX_STRING, max: MAX_ARGUMENT_LENGTH } - else if(text.length < MIN_ARGUMENT_LENGTH) return { type: SimpleSchema.ErrorTypes.MIN_STRING, min: MIN_ARGUMENT_LENGTH } - } +const StringSchemaWithOptions = new SimpleSchema({ + basicString: { + type: String }, - questionId: { - type: String, - regEx: SimpleSchema.RegEx.Id - }, - side: { - type: String, - allowedValues: ['pro', 'con'] + limitedString: { + type: String, + allowedValues: ['pro', 'con'] }, userId: { - type: String, - regEx: SimpleSchema.RegEx.Id + type: String, + regEx: SimpleSchema.RegEx.Id }, createdAt: { - type: Date, - autoValue: () => new Date(), + type: Date, + autoValue: () => new Date(), }, - clapCount: { - type: SimpleSchema.Integer, - defaultValue: 0 - }, - highlight: { - type: Array, - optional: true - }, - 'highlight.$': { - type: Object - }, - 'highlight.$.start': SimpleSchema.Integer, - 'highlight.$.end': SimpleSchema.Integer, - 'highlight.$.text': { - type: String, - trim: false +}, +{ + clean: { + filter: true, + autoConvert: true, + removeEmptyStrings: true, + trimStrings: true, + getAutoValues: true, + removeNullsFromArrays: true, } - */ - /* - , - { - clean: { - filter: true, - autoConvert: true, - removeEmptyStrings: true, - trimStrings: true, - getAutoValues: true, - removeNullsFromArrays: true, - } - } - */ +}); From 334c888710c049fcef0a362b3993e24fb3cffd36 Mon Sep 17 00:00:00 2001 From: Jonas Kugelmann Date: Wed, 5 Dec 2018 11:09:31 +0100 Subject: [PATCH 099/241] Made StepProps augmentable according to docs --- types/react-albus/index.d.ts | 13 ++++++++++++- types/react-albus/react-albus-tests.tsx | 8 ++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/types/react-albus/index.d.ts b/types/react-albus/index.d.ts index be546011d4..371a50cca7 100644 --- a/types/react-albus/index.d.ts +++ b/types/react-albus/index.d.ts @@ -47,8 +47,19 @@ export interface StepsProps { export const Steps: React.ComponentType; -export type StepProps = { id: string } & ( +export type StepProps = WizardStepObject & ( | { render?: (wizard: WizardContext) => React.ReactNode } | { children: (wizard: WizardContext) => React.ReactNode }); +/** + * In addition to id, any additional props added to will be available on each step object. + * This can be used to add names, descriptions, or other metadata to each step. + * To use this feature generally you need to augment the WizardStepObject + * @example + * declare module "react-albus" { + * interface WizardStepObject { + * propName: string; + * } + * } + */ export const Step: React.ComponentType; diff --git a/types/react-albus/react-albus-tests.tsx b/types/react-albus/react-albus-tests.tsx index 2f31733b1d..f03e57cc2e 100644 --- a/types/react-albus/react-albus-tests.tsx +++ b/types/react-albus/react-albus-tests.tsx @@ -1,6 +1,12 @@ import * as React from "react"; import { Wizard, Step, Steps, withWizard } from "react-albus"; +declare module "react-albus" { + interface WizardStepObject { + quote?: string; + } +} + const Example = () => ( ( (

Merlin

@@ -28,6 +35,7 @@ const Example = () => ( /> (

Gandalf

From 250e3e9de236d4c4d74a8c3ce5f08aff00b13f60 Mon Sep 17 00:00:00 2001 From: arichter83 Date: Wed, 5 Dec 2018 12:31:05 +0100 Subject: [PATCH 100/241] Further test cases, short hand support --- types/simpl-schema/index.d.ts | 15 ++++++++++++++- types/simpl-schema/simpl-schema-tests.ts | 13 +++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/types/simpl-schema/index.d.ts b/types/simpl-schema/index.d.ts index d5527b0697..1317b50d45 100644 --- a/types/simpl-schema/index.d.ts +++ b/types/simpl-schema/index.d.ts @@ -4,6 +4,8 @@ // Qkramer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +declare module 'simpl-schema' { + export class ValidationContext { constructor(ss: any); addValidationErrors(errors: any): void; @@ -63,7 +65,16 @@ interface SimpleSchemaOptions { } interface SimpleSchemaStatic { - new(schema: {[key: string]: SchemaDefinition} | any[], options?: SimpleSchemaOptions): SimpleSchema; + new( + schema: { + [key: string]: SchemaDefinition + | BooleanConstructor | StringConstructor | NumberConstructor | DateConstructor + | ArrayConstructor + | string | RegExp + | SimpleSchema + } | any[], + options?: SimpleSchemaOptions + ): SimpleSchema; namedContext(name?: string): SimpleSchemaValidationContextStatic; addValidator(validator: () => boolean): any; pick(...fields: string[]): SimpleSchemaStatic; @@ -202,3 +213,5 @@ export interface MongoObject { } export default SimpleSchema; + +} diff --git a/types/simpl-schema/simpl-schema-tests.ts b/types/simpl-schema/simpl-schema-tests.ts index 49c166070d..50181c373f 100644 --- a/types/simpl-schema/simpl-schema-tests.ts +++ b/types/simpl-schema/simpl-schema-tests.ts @@ -42,6 +42,9 @@ const StringSchemaWithOptions = new SimpleSchema({ type: String, allowedValues: ['pro', 'con'] }, + subschema: { + type: StringSchema + }, userId: { type: String, regEx: SimpleSchema.RegEx.Id @@ -61,3 +64,13 @@ const StringSchemaWithOptions = new SimpleSchema({ removeNullsFromArrays: true, } }); + +new SimpleSchema({ + shortBoolean: Boolean, + shortString: String, + shortNumber: Number, + shortInteger: SimpleSchema.Integer, + shortDate: Date, + shortArray: Array, + subSchema: StringSchemaWithOptions +}); From 84f45b6af38fa445a3fcf6099121e7e253fb69c2 Mon Sep 17 00:00:00 2001 From: pawkrol Date: Wed, 5 Dec 2018 12:59:45 +0100 Subject: [PATCH 101/241] Fix tests --- types/mathjs/index.d.ts | 7 ++++++- types/mathjs/mathjs-tests.ts | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/types/mathjs/index.d.ts b/types/mathjs/index.d.ts index 7917ce417e..e335421701 100644 --- a/types/mathjs/index.d.ts +++ b/types/mathjs/index.d.ts @@ -2578,7 +2578,8 @@ declare namespace math { * @param object An object with functions to be imported. * @param options An object with import options. */ - import(object: object | Array, options: ImportOptions); + import(object: ImportObject | ImportObject[], options: ImportOptions): void; + // TypeScript Version: 2.4 /** * It may not exists - this is _only_ for import functionality. @@ -4561,4 +4562,8 @@ declare namespace math { silent?: boolean; wrap?: boolean; } + + interface ImportObject { + [key: string]: any; + } } diff --git a/types/mathjs/mathjs-tests.ts b/types/mathjs/mathjs-tests.ts index babfa3ff37..c5eadb82a5 100644 --- a/types/mathjs/mathjs-tests.ts +++ b/types/mathjs/mathjs-tests.ts @@ -392,3 +392,21 @@ JSON serialization/deserialization const parsed = JSON.parse(stringified, math.json.reviver); parsed.bigNumber === math.bignumber('1.5'); // true } + +/* +Extend functionality with import + */ +{ + const testFun = function() { + return 5; + }; + + math.import({ + testFun, + value: 10 + }, {}); + + math.testFun(); + + const a = math.value * 2; +} From 237b96f0783ee45dc9d82d3b121e1f01e59c7aab Mon Sep 17 00:00:00 2001 From: arichter83 Date: Wed, 5 Dec 2018 13:11:30 +0100 Subject: [PATCH 102/241] Fixes validate(..., {keys: []}) with keys selection --- types/simpl-schema/index.d.ts | 17 ++--------------- types/simpl-schema/simpl-schema-tests.ts | 2 +- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/types/simpl-schema/index.d.ts b/types/simpl-schema/index.d.ts index 1317b50d45..b3445ed2d3 100644 --- a/types/simpl-schema/index.d.ts +++ b/types/simpl-schema/index.d.ts @@ -5,7 +5,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'simpl-schema' { - export class ValidationContext { constructor(ss: any); addValidationErrors(errors: any): void; @@ -133,6 +132,7 @@ interface ValidationOption { clean?: boolean; filter?: boolean; upsertextendedCustomContext?: boolean; + keys?: string[]; } interface SimpleSchemaValidationContextStaticKeys { @@ -188,24 +188,12 @@ export const SimpleSchema: SimpleSchemaStatic; export const SimpleSchemaValidationContext: SimpleSchemaValidationContextStatic; export const MongoObject: MongoObjectStatic; -export interface SimpleSchema { +export interface SimpleSchema extends SimpleSchemaStatic { debug: boolean; validate(obj: any, options?: ValidationOption): void; addValidator(validator: () => boolean): any; extendOptions(options: {[key: string]: any}): void; messages(messages: any): void; - RegEx: { - Email: RegExp; - Domain: RegExp; - WeakDomain: RegExp; - IP: RegExp; - IPv4: RegExp; - IPv6: RegExp; - Url: RegExp; - Id: RegExp; - ZipCode: RegExp; - Phone: RegExp; - }; } export interface MongoObject { @@ -213,5 +201,4 @@ export interface MongoObject { } export default SimpleSchema; - } diff --git a/types/simpl-schema/simpl-schema-tests.ts b/types/simpl-schema/simpl-schema-tests.ts index 50181c373f..6373107aa3 100644 --- a/types/simpl-schema/simpl-schema-tests.ts +++ b/types/simpl-schema/simpl-schema-tests.ts @@ -32,7 +32,7 @@ StringSchema.validate({ basicString: "Test", limitedString: "pro", regExpString: "id" -}); +}, {keys: ['basicString']}); const StringSchemaWithOptions = new SimpleSchema({ basicString: { From 2837928c08099a1a520fd27bb26ab0bb6bdee711 Mon Sep 17 00:00:00 2001 From: arichter83 Date: Wed, 5 Dec 2018 13:59:13 +0100 Subject: [PATCH 103/241] Worked on ValidationContext --- types/simpl-schema/index.d.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/types/simpl-schema/index.d.ts b/types/simpl-schema/index.d.ts index b3445ed2d3..54d0a5665d 100644 --- a/types/simpl-schema/index.d.ts +++ b/types/simpl-schema/index.d.ts @@ -4,18 +4,13 @@ // Qkramer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module 'simpl-schema' { -export class ValidationContext { - constructor(ss: any); +export interface ValidationContext extends SimpleSchemaValidationContextStatic { + // constructor(ss: any); addValidationErrors(errors: any): void; clean(...args: any[]): any; getErrorForKey(key: any, ...args: any[]): any; - isValid(): any; - keyErrorMessage(key: any, ...args: any[]): any; - keyIsInvalid(key: any, ...args: any[]): any; reset(): void; setValidationErrors(errors: any): void; - validate(obj: any, ...args: any[]): any; validationErrors(): any; } @@ -88,7 +83,7 @@ interface SimpleSchemaStatic { messages(messages: any): any; messageForError(type: any, key: any, def: any, value: any): string; allowsKey(key: any): string; - newContext(): SimpleSchemaValidationContextStatic; + newContext(): ValidationContext; objectKeys(keyPrefix: any): any[]; validate(obj: any, options?: ValidationOption): void; validator(options: ValidationOption): () => boolean; @@ -201,4 +196,3 @@ export interface MongoObject { } export default SimpleSchema; -} From d5106d2476ef23245b736d3cee33886dd1af43db Mon Sep 17 00:00:00 2001 From: Silas Rech Date: Wed, 5 Dec 2018 15:31:15 +0100 Subject: [PATCH 104/241] =?UTF-8?q?[sass]=20add=20missing=20=E2=80=98forma?= =?UTF-8?q?tted=E2=80=99=20property?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/sass/dart-sass/blob/f914c390676b97fc8de86a24072e0112095dd4ce/lib/src/node.dart#L384 --- types/sass/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/sass/index.d.ts b/types/sass/index.d.ts index 0131836143..bd416d9718 100644 --- a/types/sass/index.d.ts +++ b/types/sass/index.d.ts @@ -136,6 +136,11 @@ export interface SassException extends Error { */ message: string; + /** + * The formatted error. + */ + formatted: string; + /** * The line number of error. */ From 2ef5b8cb2dea6a9baa53d62f10ce10a4d84dc3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20J=2E=20Over=C3=A5?= Date: Wed, 5 Dec 2018 16:36:34 +0100 Subject: [PATCH 105/241] Update eureka-js-client to 4.4 typing --- .../eureka-js-client-tests.ts | 24 +++++++++++++++++++ types/eureka-js-client/index.d.ts | 11 ++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/types/eureka-js-client/eureka-js-client-tests.ts b/types/eureka-js-client/eureka-js-client-tests.ts index 109dab0278..b4b5c5f54e 100644 --- a/types/eureka-js-client/eureka-js-client-tests.ts +++ b/types/eureka-js-client/eureka-js-client-tests.ts @@ -19,3 +19,27 @@ const client = new Eureka({ port: 32768, } }); + +// example configuration against newer Eureka (https://www.npmjs.com/package/eureka-js-client#400-bad-request-errors-from-eureka-server) +const newerClient = new Eureka({ + // application instance information + instance: { + app: 'jqservice', + hostName: 'localhost', + ipAddr: '127.0.0.1', + port: { + $: 443, + '@enabled': true + }, + vipAddress: 'jq.test.something.com', + dataCenterInfo: { + '@class': 'com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo', + name: 'MyOwn', + }, + }, + eureka: { + // eureka server host / port + host: '192.168.99.100', + port: 32768, + } +}); diff --git a/types/eureka-js-client/index.d.ts b/types/eureka-js-client/index.d.ts index bfd9f10666..693e1b8ec8 100644 --- a/types/eureka-js-client/index.d.ts +++ b/types/eureka-js-client/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for eureka-js-client 4.3 +// Type definitions for eureka-js-client 4.4 // Project: https://github.com/jquatier/eureka-js-client -// Definitions by: Ilko Hoffmann +// Definitions by: Ilko Hoffmann , Karl O. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export class Eureka { @@ -26,7 +26,7 @@ export namespace EurekaClient { ipAddr: string; vipAddress: string; dataCenterInfo: DataCenterInfo; - port?: number; + port?: number | LegacyPortWrapper; instanceId?: string; appGroupName?: string; sid?: string; @@ -61,6 +61,10 @@ export namespace EurekaClient { useLocalMetadata?: boolean; preferIpAddress?: boolean; } + interface LegacyPortWrapper { + '$': number; + '@enabled': boolean; + } interface PortWrapper { enabled: boolean; port: number; @@ -71,5 +75,6 @@ export namespace EurekaClient { } interface DataCenterInfo { name: DataCenterName; + '@class'?: string; } } From 0e0d9592b38a2a7ae549b61435e233bc5fb87312 Mon Sep 17 00:00:00 2001 From: Dmitry Guketlev Date: Wed, 5 Dec 2018 17:34:04 +0300 Subject: [PATCH 106/241] Typings for punycode package --- types/punycode/index.d.ts | 16 ++++++++++++++++ types/punycode/punycode-tests.ts | 11 +++++++++++ types/punycode/tsconfig.json | 23 +++++++++++++++++++++++ types/punycode/tslint.json | 1 + 4 files changed, 51 insertions(+) create mode 100644 types/punycode/index.d.ts create mode 100644 types/punycode/punycode-tests.ts create mode 100644 types/punycode/tsconfig.json create mode 100644 types/punycode/tslint.json diff --git a/types/punycode/index.d.ts b/types/punycode/index.d.ts new file mode 100644 index 0000000000..a3048a5e28 --- /dev/null +++ b/types/punycode/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for punycode 2.1 +// Project: https://mths.be/punycode +// Definitions by: Dmitry Guketlev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function decode(input: string): string; +export function encode(input: string): string; +export function toUnicode(input: string): string; +export function toASCII(input: string): string; + +export namespace ucs2 { + function decode(string: string): number[]; + function encode(array: ReadonlyArray): string; +} + +export const version: string; diff --git a/types/punycode/punycode-tests.ts b/types/punycode/punycode-tests.ts new file mode 100644 index 0000000000..4de954fbc7 --- /dev/null +++ b/types/punycode/punycode-tests.ts @@ -0,0 +1,11 @@ +import punycode = require('punycode'); + +const result1: string = punycode.decode('x'); +const result2: string = punycode.encode('x'); +const result3: string = punycode.toASCII('x'); +const result4: string = punycode.toUnicode('x'); + +const ucs2result1: number[] = punycode.ucs2.decode('x'); +const ucs2result2: string = punycode.ucs2.encode([1, 2, 3]); + +const version: string = punycode.version; diff --git a/types/punycode/tsconfig.json b/types/punycode/tsconfig.json new file mode 100644 index 0000000000..0474c0a874 --- /dev/null +++ b/types/punycode/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", + "punycode-tests.ts" + ] +} diff --git a/types/punycode/tslint.json b/types/punycode/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/punycode/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 8b75a98c101dc69ca2ccfbe8c195c25e9f300e9c Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Wed, 5 Dec 2018 19:08:30 +0100 Subject: [PATCH 107/241] Update types for common-tags to v1.8 --- types/common-tags/common-tags-tests.ts | 333 +++++++++++++++---------- types/common-tags/index.d.ts | 271 +++++++++++++++----- types/common-tags/tslint.json | 78 +----- 3 files changed, 417 insertions(+), 265 deletions(-) diff --git a/types/common-tags/common-tags-tests.ts b/types/common-tags/common-tags-tests.ts index e504624943..37a1fba789 100644 --- a/types/common-tags/common-tags-tests.ts +++ b/types/common-tags/common-tags-tests.ts @@ -1,167 +1,242 @@ -import * as commonTags from 'common-tags'; +import { + html, + safeHtml, + oneLine, + oneLineTrim, + stripIndent, + stripIndents, + inlineLists, + oneLineInlineLists, + commaLists, + commaListsOr, + commaListsAnd, + oneLineCommaLists, + oneLineCommaListsOr, + oneLineCommaListsAnd, + id, + TemplateTag, + trimResultTransformer, + stripIndentTransformer, + replaceResultTransformer, + replaceSubstitutionTransformer, + inlineArrayTransformer, + splitStringTransformer, + createTag, + TemplateTransformer, + replaceStringTransformer, +} from 'common-tags'; -/* Test Built-in Tags */ - -commonTags.commaLists ` - I like ${['apples', 'bananas', 'watermelons']} - They're good! +const userMessages = ['hi', 'what are you up to?', '']; +html` +
+
    + ${userMessages.map(message => safeHtml`
  • ${message}
  • `)} +
+
`; -commonTags.commaListsAnd` - I like ${['apples', 'bananas', 'watermelons']} - They're good! -`; - -commonTags.commaListsOr` - I like ${['apples', 'bananas', 'watermelons']} - They're good! -`; - -let fruits = ['apple', 'orange', 'watermelon']; - -commonTags.html` -
-
    - ${fruits.map(fruit => `
  • ${fruit}
  • `)} - ${'
  • kiwi
  • \n
  • guava
  • '} -
-
-`; - -commonTags.codeBlock` -
-
    - ${fruits.map(fruit => `
  • ${fruit}
  • `)} - ${'
  • kiwi
  • \n
  • guava
  • '} -
-
-`; - -commonTags.source` -
-
    - ${fruits.map(fruit => `
  • ${fruit}
  • `)} - ${'
  • kiwi
  • \n
  • guava
  • '} -
-
-`; - -let userMessages = ['hi', 'what are you up to?', ''] -commonTags.html` -
-
    - ${userMessages.map(message => commonTags.safeHtml`
  • ${message}
  • `)} -
-
-` - -commonTags.oneLine` +oneLine` foo bar baz `; -commonTags.oneLineTrim` +oneLineTrim` https://news.com/article ?utm_source=designernews.co `; -commonTags.oneLineCommaLists` - I like ${['apples', 'bananas', 'watermelons']} - They're good! -`; - -commonTags.oneLineCommaListsOr` - I like ${['apples', 'bananas', 'watermelons']} - They're good! -`; - -commonTags.oneLineCommaListsAnd` - I like ${['apples', 'bananas', 'watermelons']} - They're good! -`; - -commonTags.inlineLists` - I like ${['apples', 'bananas', 'watermelons']} - They're good! -`; - -commonTags.oneLineInlineLists` - I like ${['apples', 'bananas', 'watermelons']} - They're good! -`; - -let verb = 'notice'; - -commonTags.stripIndent` +const verb = 'notice'; +stripIndent` This is a multi-line string. You'll ${verb} that it is indented. We don't want to output this indentation. But we do want to keep this line indented. `; -commonTags.stripIndents` +stripIndents` This is a multi-line string. You'll ${verb} that it is indented. We don't want to output this indentation. We don't want to keep this line indented either. `; -/* Test Tag Constructor */ +inlineLists` + I like ${['apples', 'bananas', 'watermelons']} + They're good! +`; -new commonTags.TemplateTag(); +oneLineInlineLists` + I like ${['apples', 'bananas', 'watermelons']} + They're good! +`; -const substitutionReplacer = (oldValue : string, newValue : string) => ({ - onSubstitution(substitution : string, resultSoFar : string) { +commaLists` + I like ${['apples', 'bananas', 'watermelons']} + They're good! +`; + +commaListsOr` + I like ${['apples', 'bananas', 'watermelons']} + They're good! +`; + +commaListsAnd` + I like ${['apples', 'bananas', 'watermelons']} + They're good! +`; + +oneLineCommaLists` + I like ${['apples', 'bananas', 'watermelons']} + They're good! +`; + +oneLineCommaListsOr` + I like ${['apples', 'bananas', 'watermelons']} + They're good! +`; + +oneLineCommaListsAnd` + I like ${['apples', 'bananas', 'watermelons']} + They're good! +`; + +id`hello ${'world'}`; + +oneLine(String.raw)` + foo + bar\nbaz +`; + +stripIndent(' foo\n bar'); + +const doNothing = createTag(); +doNothing`foo bar`; + +const substitutionReplacer = (oldValue: string, newValue: string): TemplateTransformer => ({ + onSubstitution(substitution, resultSoFar) { if (substitution === oldValue) { return newValue; } return substitution; - } + }, }); -new commonTags.TemplateTag(substitutionReplacer('fizz', 'buzz')); +const replaceFizzWithBuzz = createTag(substitutionReplacer('fizz', 'buzz')); +replaceFizzWithBuzz`foo bar ${'fizz'}`; -new commonTags.TemplateTag( - substitutionReplacer('fizz', 'buzz'), - substitutionReplacer('foo', 'bar') +createTag(); +createTag(substitutionReplacer('fizz', 'buzz')); +createTag(substitutionReplacer('fizz', 'buzz'), substitutionReplacer('foo', 'bar')); +createTag([substitutionReplacer('fizz', 'buzz'), substitutionReplacer('foo', 'bar')]); +new TemplateTag(); +new TemplateTag(substitutionReplacer('fizz', 'buzz')); +new TemplateTag(substitutionReplacer('fizz', 'buzz'), substitutionReplacer('foo', 'bar')); +new TemplateTag([substitutionReplacer('fizz', 'buzz'), substitutionReplacer('foo', 'bar')]); + +const tt: TemplateTransformer<{ foo: string }> = { + getInitialContext() { + return { foo: 'bar' }; + }, + onString(str, context) { + // $ExpectType string + str; + // $ExpectType { foo: string; } + context; + return ''; + }, + onSubstitution(substitution, resultSoFar, context) { + // $ExpectType string + substitution; + // $ExpectType string + resultSoFar; + // $ExpectType { foo: string; } + context; + return ''; + }, + onEndResult(endResult, context) { + // $ExpectType string + endResult; + // $ExpectType { foo: string; } + context; + return ''; + }, +}; + +createTag({}); +createTag(tt); +createTag({ + onString: str => `${str}!`, +}); +createTag({ + onSubstitution: substitution => `${substitution}!`, +}); +createTag({ + onEndResult: endResult => `${endResult}!`, +}); +new TemplateTag({}); +new TemplateTag(tt); +new TemplateTag({ + onString: str => `${str}!`, +}); +new TemplateTag({ + onSubstitution: substitution => `${substitution}!`, +}); +new TemplateTag({ + onEndResult: endResult => `${endResult}!`, +}); + +createTag(trimResultTransformer()); +createTag(trimResultTransformer('')); +createTag(trimResultTransformer('start')); +createTag(trimResultTransformer('end')); +createTag(trimResultTransformer('left')); +createTag(trimResultTransformer('right')); + +createTag(stripIndentTransformer()); +createTag(stripIndentTransformer('initial')); +createTag(stripIndentTransformer('all')); + +createTag(replaceResultTransformer('foo', 'bar')); +createTag(replaceResultTransformer(/baz/g, 'bar')); +createTag( + replaceResultTransformer(/baz/g, (substring, ...matches) => { + // $ExpectType string + substring; + // $ExpectType any[] + matches; + return ''; + }) ); -new commonTags.TemplateTag([ - substitutionReplacer('fizz', 'buzz'), - substitutionReplacer('foo', 'bar') -]); +createTag(replaceSubstitutionTransformer('foo', 'bar')); +createTag(replaceSubstitutionTransformer(/baz/g, 'bar')); +createTag( + replaceSubstitutionTransformer(/baz/g, (substring, ...matches) => { + // $ExpectType string + substring; + // $ExpectType any[] + matches; + return ''; + }) +); -new commonTags.TemplateTag({}); +createTag(replaceStringTransformer('foo', 'bar')); +createTag(replaceStringTransformer(/baz/g, 'bar')); +createTag( + replaceStringTransformer(/baz/g, (substring, ...matches) => { + // $ExpectType string + substring; + // $ExpectType any[] + matches; + return ''; + }) +); -new commonTags.TemplateTag({ - onEndResult: endResult => `${endResult}!` -}); +createTag(inlineArrayTransformer()); +createTag(inlineArrayTransformer({})); +createTag(inlineArrayTransformer({ separator: 'foo' })); +createTag(inlineArrayTransformer({ conjunction: 'bar' })); +createTag(inlineArrayTransformer({ serial: true })); -new commonTags.TemplateTag({ - onSubstitution: substitution => `${substitution}!`, - onEndResult: endResult => `${endResult}!` -}); - -/* Tests Built-in Transformers */ - -new commonTags.TemplateTag(commonTags.trimResultTransformer()); -new commonTags.TemplateTag(commonTags.trimResultTransformer('left')); -new commonTags.TemplateTag(commonTags.trimResultTransformer('right')); - -new commonTags.TemplateTag(commonTags.stripIndentTransformer()); -new commonTags.TemplateTag(commonTags.stripIndentTransformer('initial')); -new commonTags.TemplateTag(commonTags.stripIndentTransformer('all')); - -new commonTags.TemplateTag(commonTags.replaceResultTransformer('foo', 'bar')); -new commonTags.TemplateTag(commonTags.replaceSubstitutionTransformer(/baz/g, 'bar')); - -new commonTags.TemplateTag(commonTags.replaceSubstitutionTransformer('foo', 'bar')); -new commonTags.TemplateTag(commonTags.replaceSubstitutionTransformer(/baz/g, 'bar')); - -new commonTags.TemplateTag(commonTags.inlineArrayTransformer()); -new commonTags.TemplateTag(commonTags.inlineArrayTransformer({})); -new commonTags.TemplateTag(commonTags.inlineArrayTransformer({separator: 'foo'})); -new commonTags.TemplateTag(commonTags.inlineArrayTransformer({conjunction: 'bar'})); - -new commonTags.TemplateTag(commonTags.splitStringTransformer('foo')); +createTag(splitStringTransformer('foo')); diff --git a/types/common-tags/index.d.ts b/types/common-tags/index.d.ts index 65f0b61673..3a12c91109 100644 --- a/types/common-tags/index.d.ts +++ b/types/common-tags/index.d.ts @@ -1,67 +1,220 @@ -// Type definitions for common-tags v1.4.0 +// Type definitions for common-tags 1.8 // Project: https://github.com/declandewet/common-tags // Definitions by: Viktor Zozuliak // Paul Wang +// BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -declare module 'common-tags' { - type TemplateTag = (literals: TemplateStringsArray, ...placeholders: any[]) => string; +export as namespace commonTags; - type TemplateTransformer = { - onSubstitution?: (substitution: string, resultSoFar: string) => string; - onEndResult?: (endResult : string) => string; - } +export type JSTag = (literals: TemplateStringsArray, ...placeholders: any[]) => string; - /* Built-in Tags */ - export var commaLists: TemplateTag; - - export var commaListsAnd: TemplateTag; - - export var commaListsOr: TemplateTag; - - export var html: TemplateTag; - - export var codeBlock: TemplateTag; - - export var source: TemplateTag; - - export var safeHtml: TemplateTag; - - export var oneLine: TemplateTag; - - export var oneLineTrim: TemplateTag; - - export var oneLineCommaLists: TemplateTag; - - export var oneLineCommaListsOr: TemplateTag; - - export var oneLineCommaListsAnd: TemplateTag; - - export var inlineLists: TemplateTag; - - export var oneLineInlineLists: TemplateTag; - - export var stripIndent: TemplateTag; - - export var stripIndents: TemplateTag; - - /* New Tag Constructor */ - export var TemplateTag: { - new(): TemplateTag; - new(...transformers: TemplateTransformer[]): TemplateTag; - new(transformers: TemplateTransformer[]): TemplateTag; - }; - - /* Built-in Transformers */ - export var trimResultTransformer: (side?: 'left'|'right') => TemplateTransformer; - - export var stripIndentTransformer: (type?: 'initial'|'all') => TemplateTransformer; - - export var replaceResultTransformer: (replaceWhat: string|RegExp, replaceWith: string) => TemplateTransformer; - - export var replaceSubstitutionTransformer: (replaceWhat: string|RegExp, replaceWith: string) => TemplateTransformer; - - export var inlineArrayTransformer: (opts?: {separator?: string, conjunction?: string}) => TemplateTransformer; - - export var splitStringTransformer: (splitBy: string) => TemplateTransformer; +export interface TemplateTag { + (str: string): string; + (tag: JSTag): TemplateTag; + (literals: TemplateStringsArray, ...placeholders: any[]): string; } + +/** + * You'll often find that you might want to include an array in a template. + * Typically, doing something like `${array.join(', ')}` would work - but what if you're printing a list of items + * in an HTML template and want to maintain the indentation? You'd have to count the spaces manually and include + * them in the `.join()` call - which is a bit ugly for my taste. + * This tag properly indents arrays, as well as newline characters in string substitutions, + * by converting them to an array split by newline and re-using the same array inclusion logic. + */ +export const html: TemplateTag; + +/** + * alias for `html` + */ +export const codeBlock: TemplateTag; + +/** + * alias for `html` + */ +export const source: TemplateTag; + +/** + * A tag very similar to `html` but it does safe HTML escaping for strings coming from substitutions. + * When combined with regular `html` tag, you can do basic HTML templating that is safe from + * XSS (Cross-Site Scripting) attacks. + */ +export const safeHtml: TemplateTag; + +/** + * Allows you to keep your single-line strings under 80 characters without resorting to crazy string concatenation. + */ +export const oneLine: TemplateTag; + +/** + * Allows you to keep your single-line strings under 80 characters while trimming the new lines. + */ +export const oneLineTrim: TemplateTag; + +/** + * If you want to strip the initial indentation from the beginning of each line in a multiline string. + * Important note: this tag will not indent multiline strings coming from the substitutions. + * If you want that behavior, use the `html` tag (aliases: `source`, `codeBlock`). + */ +export const stripIndent: TemplateTag; + +/** + * If you want to strip *all* of the indentation from the beginning of each line in a multiline string. + */ +export const stripIndents: TemplateTag; + +/** + * Allows you to inline an array substitution as a list. + */ +export const inlineLists: TemplateTag; + +/** + * Allows you to inline an array substitution as a list, rendered out on a single line. + */ +export const oneLineInlineLists: TemplateTag; + +/** + * Allows you to inline an array substitution as a comma-separated list. + */ +export const commaLists: TemplateTag; + +/** + * Allows you to inline an array substitution as a comma-separated list, the last of which is preceded by the word "or". + */ +export const commaListsOr: TemplateTag; + +/** + * Allows you to inline an array substitution as a comma-separated list, the last of which is preceded by the word "and". + */ +export const commaListsAnd: TemplateTag; + +/** + * Allows you to inline an array substitution as a comma-separated list, and is rendered out on to a single line. + */ +export const oneLineCommaLists: TemplateTag; + +/** + * Allows you to inline an array substitution as a comma-separated list, the last of which is preceded by the word "or", and is rendered out on to a single line. + */ +export const oneLineCommaListsOr: TemplateTag; + +/** + * Allows you to inline an array substitution as a comma-separated list, the last of which is preceded by the word "and", and is rendered out on to a single line. + */ +export const oneLineCommaListsAnd: TemplateTag; + +/** + * A no-op tag that might come in useful in some scenarios, e.g. mocking. + */ +export const id: TemplateTag; + +export interface TemplateTransformer { + /** + * Called before everything else. + * The result of this hook will be passed to other hooks as `context`. + * If omitted, `context` will be an empty object. + */ + getInitialContext?: () => TCtx; + /** + * Called when the tag encounters a string. + * (a string is whatever's not inside "${}" in your template literal) + * `str` is the value of the current string + */ + onString?: (str: string, context: TCtx) => string; + /** + * Called when the tag encounters a substitution. + * (a substitution is whatever's inside "${}" in your template literal) + * `substitution` is the value of the current substitution + * `resultSoFar` is the end result up to the point of this substitution + */ + onSubstitution?: (substitution: string, resultSoFar: string, context: TCtx) => string; + /** + * Called when all substitutions have been parsed + * `endResult` is the final value. + */ + onEndResult?: (endResult: string, context: TCtx) => string; +} + +export type PluginFunction = (oldValue: string, newValue: string) => TemplateTransformer; + +/** + * New Tag factory + */ +export function createTag(transformers?: Array>): TemplateTag; +export function createTag(...transformers: Array>): TemplateTag; +export function createTag(...pluginFunctions: PluginFunction[]): TemplateTag; + +export const TemplateTag: { + /** + * New Tag Constructor + * @deprecated + */ + new (transformers?: Array>): TemplateTag; + new (...transformers: Array>): TemplateTag; + new (...pluginFunctions: PluginFunction[]): TemplateTag; +}; + +/** + * TemplateTag transformer that trims whitespace on the end result of a tagged template + * @param [side=''] The side of the string to trim. Can be 'start' or 'end' (alternatively 'left' or 'right') + * @return a TemplateTag transformer + */ +export function trimResultTransformer( + side?: 'start' | 'end' | 'left' | 'right' | '' +): TemplateTransformer; + +/** + * strips indentation from a template literal + * @param [type='initial'] whether to remove all indentation or just leading indentation. can be 'all' or 'initial' + * @return a TemplateTag transformer + */ +export function stripIndentTransformer(type?: 'initial' | 'all'): TemplateTransformer; + +/** + * Replaces a value or pattern in the end result with a new value. + * @param replaceWhat the value or pattern that should be replaced + * @param replaceWith the replacement value + * @return a TemplateTag transformer + */ +export function replaceResultTransformer( + replaceWhat: string | RegExp, + replaceWith: string | ((substring: string, ...args: any[]) => string) +): TemplateTransformer; + +/** + * Replaces the result of all substitutions (results of calling ${ ... }) with a new value. + * Same as for `replaceResultTransformer`, replaceWhat can be a string or regular expression and replaceWith is the new value. + */ +export function replaceSubstitutionTransformer( + replaceWhat: string | RegExp, + replaceWith: string | ((substring: string, ...args: any[]) => string) +): TemplateTransformer; + +/** + * Replaces the result of all strings (what's not in ${ ... }) with a new value. + * Same as for `replaceResultTransformer`, replaceWhat can be a string or regular expression and replaceWith is the new value. + */ +export function replaceStringTransformer( + replaceWhat: string | RegExp, + replaceWith: string | ((substring: string, ...args: any[]) => string) +): TemplateTransformer; + +/** + * Converts an array substitution to a string containing a list + * @param [opts.separator=''] what to separate each item with (always followed by a space) + * @param [opts.conjunction=''] replace the last separator with this value + * @param [opts.serial=false] should the separator be included before the conjunction? As in the case of serial/oxford commas + * @return a TemplateTag transformer + */ +export function inlineArrayTransformer(opts?: { + separator?: string; + conjunction?: string; + serial?: boolean; +}): TemplateTransformer; + +/** + * Splits a string substitution into an array by the provided splitBy substring, only if the string contains the splitBy substring. + */ +export function splitStringTransformer(splitBy: string): TemplateTransformer; diff --git a/types/common-tags/tslint.json b/types/common-tags/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/common-tags/tslint.json +++ b/types/common-tags/tslint.json @@ -1,79 +1,3 @@ { - "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 - } + "extends": "dtslint/dt.json" } From 56218fdbce266c90154f8f9934e25305cc1563b2 Mon Sep 17 00:00:00 2001 From: Gordon Date: Wed, 5 Dec 2018 12:58:37 -0600 Subject: [PATCH 108/241] Define connectCurrentRefinements --- types/react-instantsearch-core/index.d.ts | 44 ++++++++++++++++++- .../react-instantsearch-core-tests.tsx | 19 +++++++- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/types/react-instantsearch-core/index.d.ts b/types/react-instantsearch-core/index.d.ts index e76be4ee08..71305a2406 100644 --- a/types/react-instantsearch-core/index.d.ts +++ b/types/react-instantsearch-core/index.d.ts @@ -128,7 +128,49 @@ export class Configure extends React.Component {} export function connectAutoComplete(Composed: React.ComponentType): React.ComponentClass; export function connectBreadcrumb(Composed: React.ComponentType): React.ComponentClass; export function connectConfigure(Composed: React.ComponentType): React.ComponentClass; -export function connectCurrentRefinements(Composed: React.ComponentType): React.ComponentClass; + +export interface Refinement { + label: string; + attribute: string; + currentRefinement: string | object; + items?: Array<{ label: string, value: RefinementValue }>; + index: string; + id: string; + value: RefinementValue; +} + +type RefinementValue = (searchState: SearchState) => SearchState; + +export interface CurrentRefinementsExposed { + /** + * Function to modify the items being displayed, e.g. for filtering or sorting them. + * Takes an items as parameter and expects it back in return. + */ + transformItems?: (...args: any[]) => any; + /** Pass true to also clear the search query */ + clearsQuery?: boolean; +} + +export interface CurrentRefinementsProvided { + /** a function to remove a single filter */ + refine: (refinement: RefinementValue | RefinementValue[]) => void; + /** + * all the filters, the value is to pass to the refine function for removing all currentrefinements, + * label is for the display. When existing several refinements for the same atribute name, then you + * get a nested items object that contains a label and a value function to use to remove a single filter. + * attribute and currentRefinement are metadata containing row values. + */ + items: Refinement[]; + /** the search query */ + query: string; +} + +export function connectCurrentRefinements( + stateless: React.StatelessComponent, +): React.ComponentClass; +export function connectCurrentRefinements>( + Composed: React.ComponentType, +): ConnectedComponentClass; export interface NESW { northEast: { lat: number, lng: number }; diff --git a/types/react-instantsearch-core/react-instantsearch-core-tests.tsx b/types/react-instantsearch-core/react-instantsearch-core-tests.tsx index 62bf99e3d4..d18e5a78e6 100644 --- a/types/react-instantsearch-core/react-instantsearch-core-tests.tsx +++ b/types/react-instantsearch-core/react-instantsearch-core-tests.tsx @@ -7,7 +7,9 @@ import { connectStateResults, SearchBoxProvided, connectSearchBox, - connectRefinementList + connectRefinementList, + CurrentRefinementsProvided, + connectCurrentRefinements } from 'react-instantsearch-core'; () => { @@ -153,3 +155,18 @@ import { // reading and manipulating the current query of the search. const ConnectedSearchBox = connectSearchBox(MySearchBox); }; + +() => { + const MyCurrentRefinements = ({refine, items, query}: CurrentRefinementsProvided) => + <> + {items.map((refinement) => ( +
refine(refinement.value) }> + +
+ ))} + ; + + const ConnectedCurrentRefinements = connectCurrentRefinements(MyCurrentRefinements); + + item} />; +}; From 30e6b2c00df6d694dab9d7f0315caf41b0eb1dbd Mon Sep 17 00:00:00 2001 From: Gordon Date: Wed, 5 Dec 2018 13:02:29 -0600 Subject: [PATCH 109/241] Improve _highlightResult on Hit --- types/react-instantsearch-core/index.d.ts | 8 +++++++- .../react-instantsearch-core-tests.tsx | 6 ++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/types/react-instantsearch-core/index.d.ts b/types/react-instantsearch-core/index.d.ts index 71305a2406..af86139fde 100644 --- a/types/react-instantsearch-core/index.d.ts +++ b/types/react-instantsearch-core/index.d.ts @@ -497,12 +497,18 @@ export interface SearchResults { */ export type Hit = TDoc & { objectID: string; + /** + * Contains the searchable attributes within the document and shows which part of the + * attribute was matched by the search terms. Note that if the index has defined + * any searchable attributes, this object will only contain those keys and others + * will not exist. + */ '_highlightResult': HighlightResult; }; export type HighlightResult = TDoc extends { [k: string]: any } ? - { [K in keyof TDoc]: HighlightResultField } : + { [K in keyof TDoc]?: HighlightResultField } : never; type HighlightResultField = diff --git a/types/react-instantsearch-core/react-instantsearch-core-tests.tsx b/types/react-instantsearch-core/react-instantsearch-core-tests.tsx index d18e5a78e6..1ced5dee69 100644 --- a/types/react-instantsearch-core/react-instantsearch-core-tests.tsx +++ b/types/react-instantsearch-core/react-instantsearch-core-tests.tsx @@ -102,9 +102,7 @@ import {

{additionalProp}

{searchResults.hits.map((h) => { // $ExpectType string - const compound = h._highlightResult.field3.compound.value; - // $ExpectType never - const field2 = h._highlightResult.field2; + const compound = h._highlightResult.field3!.compound!.value; return {compound}; })} ; @@ -121,7 +119,7 @@ import {

{additionalProp}

{searchResults.hits.map((h) => { // $ExpectType string[] - const words = h._highlightResult.field3.compound.matchedWords; + const words = h._highlightResult.field3!.compound!.matchedWords; return {h.field2}: {words.join(',')}; })} ; From 4801f891a4e5ea41cfa8aa246e3a45e9a6fcfff1 Mon Sep 17 00:00:00 2001 From: Gordon Date: Wed, 5 Dec 2018 13:03:20 -0600 Subject: [PATCH 110/241] Improve events on SearchBox --- types/react-instantsearch-dom/index.d.ts | 5 +++-- .../react-instantsearch-dom-tests.tsx | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/types/react-instantsearch-dom/index.d.ts b/types/react-instantsearch-dom/index.d.ts index f1dec59118..6ecb03c981 100644 --- a/types/react-instantsearch-dom/index.d.ts +++ b/types/react-instantsearch-dom/index.d.ts @@ -118,8 +118,9 @@ export interface SearchBoxProps extends CommonWidgetProps { reset?: JSX.Element; loadingIndicator?: JSX.Element; - onSubmit?: (...args: any[]) => any; - onReset?: (...args: any[]) => any; + onSubmit?: (event: React.SyntheticEvent) => any; + onReset?: (event: React.SyntheticEvent) => any; + onChange?: (event: React.SyntheticEvent) => any; } /** * The SearchBox component displays a search box that lets the user search for a specific query. diff --git a/types/react-instantsearch-dom/react-instantsearch-dom-tests.tsx b/types/react-instantsearch-dom/react-instantsearch-dom-tests.tsx index 6d9b7b55f8..e10d3fde08 100644 --- a/types/react-instantsearch-dom/react-instantsearch-dom-tests.tsx +++ b/types/react-instantsearch-dom/react-instantsearch-dom-tests.tsx @@ -216,6 +216,21 @@ import { Hit, connectRefinementList, connectMenu } from 'react-instantsearch-cor ; }; +(() => { + function onSearchBoxChange(event: React.SyntheticEvent) { + } + + function onSearchBoxReset(event: React.SyntheticEvent) { + } + + function onSearchBoxSubmit(event: React.SyntheticEvent) { + } + + } />; +}); + import { createInstantSearch } from 'react-instantsearch-dom/server'; // import { createServer } from 'http'; declare function createServer(handler: (req: any, res: any) => any): any; From 622559c8f6adfaf6f2c469e3bb856500f196d42d Mon Sep 17 00:00:00 2001 From: Michael Utech Date: Wed, 5 Dec 2018 17:51:24 +0100 Subject: [PATCH 111/241] add types for caniuse-lite --- types/caniuse-lite/caniuse-lite-tests.ts | 48 +++++++ types/caniuse-lite/index.d.ts | 159 +++++++++++++++++++++++ types/caniuse-lite/tsconfig.json | 23 ++++ types/caniuse-lite/tslint.json | 1 + 4 files changed, 231 insertions(+) create mode 100644 types/caniuse-lite/caniuse-lite-tests.ts create mode 100644 types/caniuse-lite/index.d.ts create mode 100644 types/caniuse-lite/tsconfig.json create mode 100644 types/caniuse-lite/tslint.json diff --git a/types/caniuse-lite/caniuse-lite-tests.ts b/types/caniuse-lite/caniuse-lite-tests.ts new file mode 100644 index 0000000000..38b09230de --- /dev/null +++ b/types/caniuse-lite/caniuse-lite-tests.ts @@ -0,0 +1,48 @@ +import { + agents, features, feature, Agent, Feature, PackedFeature, StatsByAgentID, SupportStatusByVersion, SupportStatus +} from "caniuse-lite"; + +const chrome: Agent | undefined = agents.chrome; +if (chrome !== undefined) { + const browser: string = chrome.browser; + const prefix: string = chrome.prefix; + const prefixExceptions: any = chrome.prefix_exceptions; + const usageGlobal: { [version: string]: number | undefined } = chrome.usage_global; + const releaseDate: { [version: string]: number | undefined } = chrome.release_date; + const versions: Array = chrome.versions; + consume(browser, prefix, prefixExceptions, usageGlobal, releaseDate, versions); +} + +const unpackedFeatures = Object.keys(features).map((id: string) => { + const packed: PackedFeature = features[id]; + const unpacked: Feature = feature(packed); + + const status: string = unpacked.status; + const title: string = unpacked.title; + const stats: StatsByAgentID = unpacked.stats; + Object.keys(stats).forEach((agentID: string) => { + const byVersion: SupportStatusByVersion = stats[agentID]; + Object.keys(byVersion).forEach(version => { + const supportStatus: SupportStatus = byVersion[version]; + consume(supportStatus); + }); + + const supportStatusByVersion: SupportStatusByVersion = stats[agentID]; + const agent: Agent = agents[agentID]!; + return { + feature: unpacked, + agent, + versions: Object.keys(supportStatusByVersion).map(version => { + return { + version, + releaseDate: agent.release_date[version], + [`feature_${id}`]: supportStatusByVersion[version] + }; + }) + }; + }); +}); + +function consume(...anything: any[]): void { + // ... +} diff --git a/types/caniuse-lite/index.d.ts b/types/caniuse-lite/index.d.ts new file mode 100644 index 0000000000..ce4f91a35f --- /dev/null +++ b/types/caniuse-lite/index.d.ts @@ -0,0 +1,159 @@ +// Type definitions for caniuse-lite 1.0 +// Project: https://github.com/ben-eb/caniuse-lite#readme +// Definitions by: Michael Utech +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/** + * Information about user agents (browsers, platforms) indexed by their ID. + */ +export const agents: AgentsByID; + +/** + * Features index by their ID. The feature ID is a human readable identifier. The + * associated value is a packed version of information about the feature that + * can be unpacked using the function `feature(packed)` + */ +export const features: { [featureID: string]: PackedFeature; }; + +/** + * @param packedFeature a packed feature obtained from `features[key]` for some valid key. + * @return the unpacked information as `Feature`. + */ +export function feature(packedFeature: PackedFeature): Feature; + +/** + * @param packedRegion a packed version of regional usage data by agent OD. + * @return the unpacked usage data indexed by agent ID and then version. + */ +export function region(packedRegion: PackedRegion): { [agentID: string]: UsageByVersion }; + +/** + * Agents indexed by their ID. . + */ +export type AgentsByID = Readonly<{ [id: string]: Readonly | undefined }>; + +/** + * Feature support status by version indexed by agent ID. + */ +export type StatsByAgentID = Readonly<{ [agentID: string]: SupportStatusByVersion }>; + +/** + * Feature support status indexed by an agent's versions. + */ +export type SupportStatusByVersion = Readonly<{ [version: string]: SupportStatus }>; + +/** + * Usage (percentage/market share) indexed by an agent's versions. + */ +export type UsageByVersion = Readonly<{ [version: string]: number | undefined }>; + +/** + * The standardization status of a feature: + * * ls - WHATWG living standard + * * rec - W3C recommendation + * * pr - W3C proposed recommendation + * * cr - W3C candidate recommendation + * * wd - W3C working draft + * * other - Non-W3C, but reputable + * * unoff - Unofficial + */ +export type FeatureStatus = "ls" | "rec" | "pr" | "cr" | "wd" | "other" | "unoff" | string; + +/** + * Encoded support status: + * * `n` - not supported + * * `p` - not supported, polyfill available + * * `u` - unknown + * * `a x` - partially supported, vendor prefix + * * `a` - partially supported + * * `y x` - fully supported, vendor prefix + * * `y` - fully supported + * + * The support status can additionally have one or more footnote references as `#`, f.e. + * `a x #1 #3`. + */ +export type SupportStatus = 'n' | 'p' | 'u' | "a x" | 'a' | "y x" | 'y' | string; + +/** + * Provides information about the Agent. + */ +export interface Agent { + /** + * Global agent usage by version + */ + usage_global: UsageByVersion; + + /** + * The agents vendor prefix + */ + prefix: string; + + /** + * Version matrix. See [caniuse](https://caniuse.com) + */ + versions: [ // Tuple of 70 version slots: + string|null, string|null, string|null, string|null, string|null, + string|null, string|null, string|null, string|null, string|null, + string|null, string|null, string|null, string|null, string|null, + string|null, string|null, string|null, string|null, string|null, + string|null, string|null, string|null, string|null, string|null, + string|null, string|null, string|null, string|null, string|null, + string|null, string|null, string|null, string|null, string|null, + string|null, string|null, string|null, string|null, string|null, + string|null, string|null, string|null, string|null, string|null, + string|null, string|null, string|null, string|null, string|null, + string|null, string|null, string|null, string|null, string|null, + string|null, string|null, string|null, string|null, string|null, + string|null, string|null, string|null, string|null, string|null, + string|null, string|null, string|null, string|null, string|null ]; + + /** + * The agent's name + */ + browser: string; + + /** + * Release dates as seconds since epoch by version. + */ + release_date: { [version: string]: number | undefined }; + + /** + * Exceptions to vendor prefix use. + */ + prefix_exceptions?: { [version: string]: string | undefined }; +} + +/** + * Specifies a feature and its support status in all known agent versions. + */ +export interface Feature { + /** + * Specification status of the feature. + */ + status: FeatureStatus; + + /** + * Descriptive title of the feature. + */ + title: string; + + /** + * Agent support matrix for this feature. + */ + stats: StatsByAgentID; +} + +/** + * A space optimized version of Feature that can be unpacked using `feature(PackedFeature)`. + */ +export interface PackedFeature { + [encodedKey: string]: any; +} + +/** + * A space optimized version of Region that can be unpacked using `region(PackedFeature)`. + */ +export interface PackedRegion { + [encodedKey: string]: any; +} diff --git a/types/caniuse-lite/tsconfig.json b/types/caniuse-lite/tsconfig.json new file mode 100644 index 0000000000..adcea4d555 --- /dev/null +++ b/types/caniuse-lite/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", + "caniuse-lite-tests.ts" + ] +} diff --git a/types/caniuse-lite/tslint.json b/types/caniuse-lite/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/caniuse-lite/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 36e268033babcc716200192c72ba839daa43d7f9 Mon Sep 17 00:00:00 2001 From: jeremy Date: Wed, 5 Dec 2018 23:21:11 +0100 Subject: [PATCH 112/241] Add types for json-server --- types/json-server/index.d.ts | 72 ++++++++++++++++++++++++++ types/json-server/json-server-tests.ts | 41 +++++++++++++++ types/json-server/tsconfig.json | 16 ++++++ types/json-server/tslint.json | 1 + 4 files changed, 130 insertions(+) create mode 100644 types/json-server/index.d.ts create mode 100644 types/json-server/json-server-tests.ts create mode 100644 types/json-server/tsconfig.json create mode 100644 types/json-server/tslint.json diff --git a/types/json-server/index.d.ts b/types/json-server/index.d.ts new file mode 100644 index 0000000000..c52a4b220e --- /dev/null +++ b/types/json-server/index.d.ts @@ -0,0 +1,72 @@ +// Type definitions for json-server 0.14 +// Project: https://github.com/typicode/json-server +// Definitions by: Jeremy Bensimon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import { NextHandleFunction } from 'connect'; +import { Application, RequestHandler, Router } from 'express'; + +/** + * Returns an Express server. + */ +export function create(): Application; + +/** + * Returns middlewares used by JSON Server. + */ +export function defaults(options?: MiddlewaresOptions): RequestHandler[]; + +/** + * Returns JSON Server router. + * @param source Either a path to a json file (e.g. `'db.json'`) or an object in memory + * @param options Set foreign key suffix (default: `'Id'`) + */ +export function router(source: string | object, options?: { foreignKeySuffix: string }): Router; + +/** + * Add custom rewrite rules. + */ +export function rewriter(rules: { [rule: string]: string }): Router; + +/** + * Returns body-parser middleware used by JSON Server router. + * + * @returns + * ``` + * [bodyParser.json({ limit: '10mb', extended: false }), bodyParser.urlencoded({ extended: false })] + * ``` + */ +export const bodyParser: [NextHandleFunction, NextHandleFunction]; + +export interface MiddlewaresOptions { + /** + * Path to static files + * @default "public" (if folder exists) + */ + static?: string; + + /** + * Enable logger middleware + * @default true + */ + logger?: boolean; + + /** + * Enable body-parser middleware + * @default true + */ + bodyParser?: boolean; + + /** + * Disable CORS + * @default false + */ + noCors?: boolean; + + /** + * Accept only GET requests + * @default false + */ + readOnly?: boolean; +} diff --git a/types/json-server/json-server-tests.ts b/types/json-server/json-server-tests.ts new file mode 100644 index 0000000000..d68484b1ff --- /dev/null +++ b/types/json-server/json-server-tests.ts @@ -0,0 +1,41 @@ +import * as jsonServer from 'json-server'; + +const server = jsonServer.create(); + +const inMemoryDbRouter = jsonServer.router({ todos: [] as any[], users: [] as any[] }); + +const router = jsonServer.router('db.json', { foreignKeySuffix: '_id' }); + +const middlewaresOptions: jsonServer.MiddlewaresOptions = { + bodyParser: true, + logger: false, + noCors: true, + readOnly: true, + static: 'assets', +}; + +const middlewares = jsonServer.defaults(middlewaresOptions); + +const rewriter = jsonServer.rewriter({ + '/api/*': '/$1', + '/blog/:resource/:id/show': '/:resource/:id', +}); + +server.use(jsonServer.bodyParser); + +server.use((req, res, next) => { + if (req.method === 'POST') { + req.body.createdAt = Date.now(); + } + next(); +}); + +server.use(rewriter); + +server.use(middlewares); + +server.use(router); + +server.listen(3000, () => { + console.log('JSON Server is running'); +}); diff --git a/types/json-server/tsconfig.json b/types/json-server/tsconfig.json new file mode 100644 index 0000000000..e923ac1d7a --- /dev/null +++ b/types/json-server/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "json-server-tests.ts"] +} diff --git a/types/json-server/tslint.json b/types/json-server/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/json-server/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b95a55fbe079cbd34adf870f68b4780a9373bde5 Mon Sep 17 00:00:00 2001 From: Minjie Shen Date: Thu, 6 Dec 2018 09:36:54 +1100 Subject: [PATCH 113/241] Update style according to linter --- types/netease-captcha/index.d.ts | 29 ++++++++++--------- .../netease-captcha/netease-captcha-tests.ts | 9 +++--- types/netease-captcha/tsconfig.json | 5 ++-- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/types/netease-captcha/index.d.ts b/types/netease-captcha/index.d.ts index 7a199b6d85..fbdfb03e7d 100644 --- a/types/netease-captcha/index.d.ts +++ b/types/netease-captcha/index.d.ts @@ -1,41 +1,40 @@ -// Type definitions for netease-captcha x.x +// Type definitions for netease-captcha 2.1 // Project: https://cstaticdun.126.net/load.min.js // Definitions by: Minjie Shen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare interface Window { +interface Window { initNECaptcha?: NeteaseCaptcha.InitFunction; } declare namespace NeteaseCaptcha { - declare type InitFunction = (config: Config, onLoad?: onLoad, onError?: onError) => void; + type InitFunction = (config: Config, onLoad?: onLoad, onError?: onError) => void; - declare type Config = { + interface Config { /** * Verification code id */ - captchaId: string, + captchaId: string; /** * Selector string or HTMLElement to render widget into */ - element: string | HTMLElement, + element: string | HTMLElement; /** * Defaults to 'float' on desktop, and 'popup' on mobile */ - mode?: 'float' | 'embed' | 'popup', + mode?: 'float' | 'embed' | 'popup'; /** * Defaults to page protocol */ - protocol?: 'http' | 'https', + protocol?: 'http' | 'https'; /** * Defaults to 'auto' */ - width?: number | string, + width?: number | string; /** * Defaults to 'zh-CN' @@ -45,9 +44,9 @@ declare namespace NeteaseCaptcha { onReady?(instance: Instance): void; onVerify?(error: any, data: Data): void; - }; + } - type Instance = { + interface Instance { /** * Refresh the instance to get new verification information */ @@ -62,9 +61,11 @@ declare namespace NeteaseCaptcha { * Available when the mode is set to 'popup' - opens the popup to accept verification */ popUp?(): void; - }; + } - type Data = { validate: string }; + interface Data { + validate: string; + } type onLoad = (instance: Instance) => void; diff --git a/types/netease-captcha/netease-captcha-tests.ts b/types/netease-captcha/netease-captcha-tests.ts index 05ed51c2bb..c174affdf0 100644 --- a/types/netease-captcha/netease-captcha-tests.ts +++ b/types/netease-captcha/netease-captcha-tests.ts @@ -1,4 +1,4 @@ -const config : NeteaseCaptcha.Config = { +const config: NeteaseCaptcha.Config = { captchaId: 'FAKE ID', element: '#captcha', mode: 'popup', @@ -10,12 +10,11 @@ const config : NeteaseCaptcha.Config = { } }; -const onLoad : NeteaseCaptcha.onLoad = (instance : NeteaseCaptcha.Instance) => void { +const onLoad: NeteaseCaptcha.onLoad = (instance: NeteaseCaptcha.Instance) => { instance.refresh(); instance.destroy(); -} +}; -function init(initNECaptcha : NeteaseCaptcha.InitFunction) => void { +function init(initNECaptcha: NeteaseCaptcha.InitFunction): void { initNECaptcha(config, onLoad); } - diff --git a/types/netease-captcha/tsconfig.json b/types/netease-captcha/tsconfig.json index 67a7f5dd64..11afad945f 100644 --- a/types/netease-captcha/tsconfig.json +++ b/types/netease-captcha/tsconfig.json @@ -1,12 +1,11 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6", "dom"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 8b5e6afb2fee6cb6ae8b31845d18e4ff85bc49ba Mon Sep 17 00:00:00 2001 From: Alan Plum Date: Wed, 5 Dec 2018 23:39:57 +0100 Subject: [PATCH 114/241] Unbreak the build --- types/json_ml/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/json_ml/index.d.ts b/types/json_ml/index.d.ts index e2eb2c7af4..7cab812880 100644 --- a/types/json_ml/index.d.ts +++ b/types/json_ml/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/59naga/json-ml // Definitions by: Alan Plum // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 /// From 5d5e47bc5aa15e8f499bd35b033ec297dabda48b Mon Sep 17 00:00:00 2001 From: Minjie Shen Date: Thu, 6 Dec 2018 10:59:44 +1100 Subject: [PATCH 115/241] Add test for window attribute --- types/netease-captcha/netease-captcha-tests.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/types/netease-captcha/netease-captcha-tests.ts b/types/netease-captcha/netease-captcha-tests.ts index c174affdf0..ee73302cc1 100644 --- a/types/netease-captcha/netease-captcha-tests.ts +++ b/types/netease-captcha/netease-captcha-tests.ts @@ -13,8 +13,11 @@ const config: NeteaseCaptcha.Config = { const onLoad: NeteaseCaptcha.onLoad = (instance: NeteaseCaptcha.Instance) => { instance.refresh(); instance.destroy(); + if (instance.popUp) { + instance.popUp(); + } }; -function init(initNECaptcha: NeteaseCaptcha.InitFunction): void { - initNECaptcha(config, onLoad); +if (window.initNECaptcha) { + window.initNECaptcha(config, onLoad); } From 83a6d98e96ae9f8c173e40592b4f6e3cf2d071f1 Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Wed, 5 Dec 2018 18:51:54 -0800 Subject: [PATCH 116/241] Update types for Electron Packager to 13.0 --- .../electron-packager-tests.ts | 37 ++++++----------- types/electron-packager/index.d.ts | 41 +++++++++---------- 2 files changed, 33 insertions(+), 45 deletions(-) diff --git a/types/electron-packager/electron-packager-tests.ts b/types/electron-packager/electron-packager-tests.ts index 06cadf97f0..6b10ea4bf3 100644 --- a/types/electron-packager/electron-packager-tests.ts +++ b/types/electron-packager/electron-packager-tests.ts @@ -13,25 +13,6 @@ function ignoreFunction(path: string) { return true; } -// this is the obsolete API and will be removed in a future version - -packager({ - dir: ".", - name: "myapplication", - platform: "win32", - arch: "all", - electronVersion: "0.34.0", - win32metadata: { - CompanyName: "Acme CO", - FileDescription: "My application", - OriginalFilename: "myapp.exe", - ProductName: "Application", - InternalName: "roadrunner", - "requested-execution-level": "highestAvailable", - "application-manifest": "manifest.xml" - } -}, callback); - function onCompleted(appPaths: string | string[]) { } @@ -102,7 +83,7 @@ packager({ afterExtract: [ completeFunction ], - afterPrune: [ + afterPrune: [ completeFunction ], appCopyright: "Copyright", @@ -122,7 +103,6 @@ packager({ ignore: /ab+c/, out: "out", overwrite: true, - packageManager: false, prune: true, quiet: true, tmpdir: "/tmp", @@ -157,7 +137,6 @@ packager({ new RegExp('abc') ], overwrite: false, - packageManager: "npm", platform: "darwin", prune: false, quiet: false, @@ -184,7 +163,14 @@ packager({ strictSSL: false }, ignore: ignoreFunction, - packageManager: "cnpm", + platform: "linux" +}).then(onCompleted).catch(onError); + +packager({ + dir: ".", + arch: "mips64el", + electronVersion: "1.8.8", + prebuiltAsar: "prebuilt.asar", platform: "linux" }).then(onCompleted).catch(onError); @@ -200,11 +186,14 @@ packager({ quiet: true, strictSSL: false }, - packageManager: "yarn", platform: "mas", extendInfo: { foo: "bar" }, + osxNotarize: { + appleId: "My ID", + appleIdPassword: "Bad Password" + }, osxSign: { identity: "myidentity", entitlements: "path/to/my.entitlements", diff --git a/types/electron-packager/index.d.ts b/types/electron-packager/index.d.ts index 0e438ebc6e..04e62a28b5 100644 --- a/types/electron-packager/index.d.ts +++ b/types/electron-packager/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for electron-packager 12.0 +// Type definitions for electron-packager 13.0 // Project: https://github.com/electron-userland/electron-packager // Definitions by: Maxime LUCE // Juan Jimenez-Anca // John Kleinschmidt // Brendan Forster +// Mark Lee // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -23,20 +24,6 @@ export = electronPackager; */ declare function electronPackager(opts: electronPackager.Options): Promise; -/** - * This will: - * - Find or download the correct release of Electron - * - Use that version of electron to create a app in /-- - * - * You should be able to launch the app on the platform you built for. If not, check your settings and try again. - * - * @param opts - Options to configure packaging. - * @param callback - Callback which is called when packaging is done or an error occured. - * - * @deprecated since version 12.0 - */ -declare function electronPackager(opts: electronPackager.Options, callback: electronPackager.finalCallback): void; - declare namespace electronPackager { /** * Callback which is called when electron-packager is done. @@ -48,8 +35,7 @@ declare namespace electronPackager { type ignoreFunction = (path: string) => boolean; type onCompleteFn = (buildPath: string, electronVersion: string, platform: string, arch: string, callbackFn: () => void) => void; - type arch = "ia32" | "x64" | "armv7l" | "arm64" |"all"; - type packageManager = "npm" | "cnpm" | "yarn" | false; + type arch = "ia32" | "x64" | "armv7l" | "arm64" | "mips64el" | "all"; type platform = "linux" | "win32" | "darwin" | "mas" | "all"; interface AsarOptions { @@ -65,6 +51,11 @@ declare namespace electronPackager { strictSSL?: boolean; } + interface ElectronNotarizeOptions { + appleId: string; + appleIdPassword: string; + } + interface ElectronOsXSignOptions { identity?: string; entitlements?: string; @@ -116,6 +107,10 @@ declare namespace electronPackager { * Whether to package the application's source code into an archive, using Electron's archive format */ asar?: boolean | AsarOptions; + /** + * The path to a prebuilt ASAR file. + */ + prebuiltAsar?: string; /** * The build version of the application. Defaults to the value of appVersion. * Maps to the FileVersion metadata property on Windows, and CFBundleVersion on OS X. @@ -160,10 +155,6 @@ declare namespace electronPackager { * Whether to replace an already existing output directory for a given platform (true) or skip recreating it (false). */ overwrite?: boolean; - /** - * The package manager used to prune devDependencies modules from the outputted Electron app - */ - packageManager?: packageManager; /** * The target platform(s) to build for. Not required if the all option is set. */ @@ -202,6 +193,14 @@ declare namespace electronPackager { * The bundle identifier to use in the application helper's plist. */ helperBundleId?: string; + /** + * Forces support for Mojave (macOS 10.14) dark mode in the packaged app. + */ + darwinDarkModeSupport?: boolean; + /** + * If present, notarizes OS X target apps when the host platform is OS X and XCode is installed. + */ + osxNotarize?: ElectronNotarizeOptions; /** * If present, signs OS X target apps when the host platform is OS X and XCode is installed. */ From fa958ebb69b88685129d6f7fc8f081ed6f3485ab Mon Sep 17 00:00:00 2001 From: danford Date: Thu, 6 Dec 2018 15:50:48 +1100 Subject: [PATCH 117/241] remove stray semicolon --- types/react-css-collapse/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-css-collapse/index.d.ts b/types/react-css-collapse/index.d.ts index aa17200367..0fb568beef 100644 --- a/types/react-css-collapse/index.d.ts +++ b/types/react-css-collapse/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for react-css-collapse 3.6.0 -// Project: https://github.com/SparebankenVest/react-css-collapse; +// Project: https://github.com/SparebankenVest/react-css-collapse // Definitions by: Daniel Ford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 From 4facac46480208ba90e13d2c5f27beca147e5107 Mon Sep 17 00:00:00 2001 From: danford Date: Thu, 6 Dec 2018 15:51:13 +1100 Subject: [PATCH 118/241] Re-enforce nullchecks --- types/react-css-collapse/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-css-collapse/tsconfig.json b/types/react-css-collapse/tsconfig.json index 4af49b9769..efb2921718 100644 --- a/types/react-css-collapse/tsconfig.json +++ b/types/react-css-collapse/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ From f75ae9b0aede62bef173d5fa6de0ed94fbbd8fa4 Mon Sep 17 00:00:00 2001 From: danford Date: Thu, 6 Dec 2018 15:51:45 +1100 Subject: [PATCH 119/241] Only disable necessary lint rule --- types/react-css-collapse/tslint.json | 75 +--------------------------- 1 file changed, 1 insertion(+), 74 deletions(-) diff --git a/types/react-css-collapse/tslint.json b/types/react-css-collapse/tslint.json index a41bf5d19a..9ce242b768 100644 --- a/types/react-css-collapse/tslint.json +++ b/types/react-css-collapse/tslint.json @@ -1,79 +1,6 @@ { "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 + "no-duplicate-imports": false } } From 3f45d4caeb3ac5da6c74f4065c810da141df8b45 Mon Sep 17 00:00:00 2001 From: danford Date: Thu, 6 Dec 2018 16:24:18 +1100 Subject: [PATCH 120/241] lint adjustments --- types/react-css-collapse/index.d.ts | 4 ++-- types/react-css-collapse/tslint.json | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/types/react-css-collapse/index.d.ts b/types/react-css-collapse/index.d.ts index 0fb568beef..e454d5946b 100644 --- a/types/react-css-collapse/index.d.ts +++ b/types/react-css-collapse/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-css-collapse 3.6.0 +// Type definitions for react-css-collapse 3.6 // Project: https://github.com/SparebankenVest/react-css-collapse // Definitions by: Daniel Ford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,7 +12,7 @@ declare module 'react-css-collapse' { transition?: string | null; } class Collapse extends React.Component { - public render(): React.ReactElement; + render(): React.ReactElement; } export default Collapse; } diff --git a/types/react-css-collapse/tslint.json b/types/react-css-collapse/tslint.json index 9ce242b768..9e934cc4fe 100644 --- a/types/react-css-collapse/tslint.json +++ b/types/react-css-collapse/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "no-duplicate-imports": false + "no-single-declare-module": false, + "no-declare-current-package": false, + "no-duplicate-imports": false } } From 951ef11442daac4b5873e84bcfac1b262e75299d Mon Sep 17 00:00:00 2001 From: Leko Date: Thu, 6 Dec 2018 16:29:51 +0900 Subject: [PATCH 121/241] Add type definitions for ghauth 3.2 --- types/ghauth/ghauth-tests.ts | 27 ++++++++++++++++++++++ types/ghauth/index.d.ts | 45 ++++++++++++++++++++++++++++++++++++ types/ghauth/tsconfig.json | 23 ++++++++++++++++++ types/ghauth/tslint.json | 1 + 4 files changed, 96 insertions(+) create mode 100644 types/ghauth/ghauth-tests.ts create mode 100644 types/ghauth/index.d.ts create mode 100644 types/ghauth/tsconfig.json create mode 100644 types/ghauth/tslint.json diff --git a/types/ghauth/ghauth-tests.ts b/types/ghauth/ghauth-tests.ts new file mode 100644 index 0000000000..7757cf24dd --- /dev/null +++ b/types/ghauth/ghauth-tests.ts @@ -0,0 +1,27 @@ +import ghauth, { AuthOptions, TokenData } from "ghauth"; + +// Full +const authOptions1: AuthOptions = { + configName: "awesome", + noSave: true, + authUrl: "https://api.github.com/authorizations", + promptName: "GitHub", + scopes: ["user"], + note: "This token is for my awesome app", + userAgent: "My Awesome App", +}; + +ghauth(authOptions1, (err: Error, authData: TokenData) => { + authData.user; + authData.token; +}); + +// Required +const authOptions2: AuthOptions = { + configName: "awesome", +}; + +ghauth(authOptions2, (err: Error, authData: TokenData) => { + authData.user; + authData.token; +}); diff --git a/types/ghauth/index.d.ts b/types/ghauth/index.d.ts new file mode 100644 index 0000000000..e21afdf3fa --- /dev/null +++ b/types/ghauth/index.d.ts @@ -0,0 +1,45 @@ +// Type definitions for ghauth 3.2 +// Project: https://github.com/rvagg/ghauth +// Definitions by: Leko +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface AuthOptions { + configName: string; + + /** + * @default false + */ + noSave?: boolean; + + /** + * @default "https://api.github.com/authorizations" + */ + authUrl?: string; + + /** + * @default "GitHub" + */ + promptName?: string; + + /** + * @default [] + */ + scopes?: ReadonlyArray; + + /** + * @default "Node.js command-line app with ghauth" + */ + note?: string; + + /** + * @default "Magic Node.js application that does magic things with ghauth" + */ + userAgent?: string; +} + +export interface TokenData { + user: string; + token: string; +} + +export default function ghauth(authOptions: AuthOptions, callback: (err: Error, tokenData: TokenData) => void): void; diff --git a/types/ghauth/tsconfig.json b/types/ghauth/tsconfig.json new file mode 100644 index 0000000000..0b946b4ae8 --- /dev/null +++ b/types/ghauth/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", + "ghauth-tests.ts" + ] +} diff --git a/types/ghauth/tslint.json b/types/ghauth/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ghauth/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 0df59a63921c700104afd1b1baeb0c07e3707aa3 Mon Sep 17 00:00:00 2001 From: pawkrol Date: Thu, 6 Dec 2018 09:11:42 +0100 Subject: [PATCH 122/241] Change semantics for import --- types/mathjs/index.d.ts | 16 ++++++++++------ types/mathjs/mathjs-tests.ts | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/types/mathjs/index.d.ts b/types/mathjs/index.d.ts index e335421701..a8ec6114eb 100644 --- a/types/mathjs/index.d.ts +++ b/types/mathjs/index.d.ts @@ -2575,16 +2575,20 @@ declare namespace math { /** * Import functions from an object or a module + * To avoid errors when using one of the imported functions extend module like this: + * + * @example + * // imported_math_functions.ts + * declare module 'mathjs' { + * interface MathJsStatic { + * hello(a: number): number; + * } + * } + * * @param object An object with functions to be imported. * @param options An object with import options. */ import(object: ImportObject | ImportObject[], options: ImportOptions): void; - // TypeScript Version: 2.4 - - /** - * It may not exists - this is _only_ for import functionality. - */ - [key: string]: any; } interface Matrix { diff --git a/types/mathjs/mathjs-tests.ts b/types/mathjs/mathjs-tests.ts index c5eadb82a5..0d21be817e 100644 --- a/types/mathjs/mathjs-tests.ts +++ b/types/mathjs/mathjs-tests.ts @@ -1,3 +1,6 @@ +// Import needed for mathjs.import functionality (declaring/extending module) +import * as math from 'mathjs'; + /* Basic usage examples */ @@ -396,10 +399,16 @@ JSON serialization/deserialization /* Extend functionality with import */ + +declare module 'mathjs' { + interface MathJsStatic { + testFun(): number; + value: number; + } +} + { - const testFun = function() { - return 5; - }; + const testFun = () => 5; math.import({ testFun, From 3458e059eb3bc46ae19f6486e2899bbb93edbdf0 Mon Sep 17 00:00:00 2001 From: Jonas Kugelmann Date: Thu, 6 Dec 2018 09:18:05 +0100 Subject: [PATCH 123/241] Adjusted naming of WizardStepObject to StepObject --- types/react-albus/index.d.ts | 14 +++++++------- types/react-albus/react-albus-tests.tsx | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/types/react-albus/index.d.ts b/types/react-albus/index.d.ts index 371a50cca7..ccc0ac8582 100644 --- a/types/react-albus/index.d.ts +++ b/types/react-albus/index.d.ts @@ -9,13 +9,13 @@ import * as React from "react"; import { History } from "history"; -export interface WizardStepObject { +export interface StepObject { id: string; } export interface WizardContext { - step: WizardStepObject; - steps: WizardStepObject[]; + step: StepObject; + steps: StepObject[]; history: History; next: () => void; previous: () => void; @@ -42,22 +42,22 @@ export interface WizardProps { export const Wizard: React.ComponentType; export interface StepsProps { - step?: WizardStepObject; + step?: StepObject; } export const Steps: React.ComponentType; -export type StepProps = WizardStepObject & ( +export type StepProps = StepObject & ( | { render?: (wizard: WizardContext) => React.ReactNode } | { children: (wizard: WizardContext) => React.ReactNode }); /** * In addition to id, any additional props added to will be available on each step object. * This can be used to add names, descriptions, or other metadata to each step. - * To use this feature generally you need to augment the WizardStepObject + * To use this feature globally in your project you need to augment the StepObject * @example * declare module "react-albus" { - * interface WizardStepObject { + * interface StepObject { * propName: string; * } * } diff --git a/types/react-albus/react-albus-tests.tsx b/types/react-albus/react-albus-tests.tsx index f03e57cc2e..57fe8147d1 100644 --- a/types/react-albus/react-albus-tests.tsx +++ b/types/react-albus/react-albus-tests.tsx @@ -2,7 +2,7 @@ import * as React from "react"; import { Wizard, Step, Steps, withWizard } from "react-albus"; declare module "react-albus" { - interface WizardStepObject { + interface StepObject { quote?: string; } } From 5536ed5c7108a7a5baac3e283fcc636c45529183 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Wed, 5 Dec 2018 01:49:38 +0100 Subject: [PATCH 124/241] Add types for liftoff --- types/fined/index.d.ts | 2 +- types/liftoff/index.d.ts | 203 +++++++++++++++++++++++++++++++++ types/liftoff/liftoff-tests.ts | 182 +++++++++++++++++++++++++++++ types/liftoff/tsconfig.json | 23 ++++ types/liftoff/tslint.json | 1 + 5 files changed, 410 insertions(+), 1 deletion(-) create mode 100644 types/liftoff/index.d.ts create mode 100644 types/liftoff/liftoff-tests.ts create mode 100644 types/liftoff/tsconfig.json create mode 100644 types/liftoff/tslint.json diff --git a/types/fined/index.d.ts b/types/fined/index.d.ts index e19bad318a..107a40760c 100644 --- a/types/fined/index.d.ts +++ b/types/fined/index.d.ts @@ -11,7 +11,7 @@ declare namespace fined { interface PathSpec { path?: string; name?: string; - extensions?: string | string[] | { [extension: string]: string }; + extensions?: string | string[] | { [extension: string]: string | null }; cwd?: string; findUp?: boolean; } diff --git a/types/liftoff/index.d.ts b/types/liftoff/index.d.ts new file mode 100644 index 0000000000..91316ead82 --- /dev/null +++ b/types/liftoff/index.d.ts @@ -0,0 +1,203 @@ +// Type definitions for liftoff 2.5 +// Project: https://github.com/js-cli/js-liftoff#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { Extensions, Extension, ExtensionDescriptor } from 'interpret'; +import { PathSpec } from 'fined'; +import { EventEmitter } from 'events'; + +export = Liftoff; + +declare class Liftoff extends EventEmitter { + /** + * Create an instance of Liftoff to invoke your application. + */ + constructor(options?: Liftoff.Options); + + /** + * Launches your application with provided options, builds an environment, + * and invokes your callback, passing the calculated environment as the first argument. + */ + launch( + opts: Liftoff.LaunchOptions, + callback: (this: this, env: Liftoff.LiftoffEnv) => void + ): void; + + addListener( + event: 'require', + listener: (name: string, module: ExtensionDescriptor) => void + ): this; + addListener(event: 'requireFail', listener: (name: string, err: any) => void): this; + addListener(event: 'respawn', listener: (flags: string[], child: NodeJS.Process) => void): this; + on(event: 'require', listener: (name: string, module: ExtensionDescriptor) => void): this; + on(event: 'requireFail', listener: (name: string, err: any) => void): this; + on(event: 'respawn', listener: (flags: string[], child: NodeJS.Process) => void): this; + once(event: 'require', listener: (name: string, module: ExtensionDescriptor) => void): this; + once(event: 'requireFail', listener: (name: string, err: any) => void): this; + once(event: 'respawn', listener: (flags: string[], child: NodeJS.Process) => void): this; + prependListener( + event: 'require', + listener: (name: string, module: ExtensionDescriptor) => void + ): this; + prependListener(event: 'requireFail', listener: (name: string, err: any) => void): this; + prependListener( + event: 'respawn', + listener: (flags: string[], child: NodeJS.Process) => void + ): this; + prependOnceListener( + event: 'require', + listener: (name: string, module: ExtensionDescriptor) => void + ): this; + prependOnceListener(event: 'requireFail', listener: (name: string, err: any) => void): this; + prependOnceListener( + event: 'respawn', + listener: (flags: string[], child: NodeJS.Process) => void + ): this; + removeListener( + event: 'require', + listener: (name: string, module: ExtensionDescriptor) => void + ): this; + removeListener(event: 'requireFail', listener: (name: string, err: any) => void): this; + removeListener( + event: 'respawn', + listener: (flags: string[], child: NodeJS.Process) => void + ): this; + off(event: 'require', listener: (name: string, module: ExtensionDescriptor) => void): this; + off(event: 'requireFail', listener: (name: string, err: any) => void): this; + off(event: 'respawn', listener: (flags: string[], child: NodeJS.Process) => void): this; + removeAllListeners(event?: 'require' | 'requireFail' | 'respawn'): this; + listeners(event: 'require' | 'requireFail' | 'respawn'): Function[]; // tslint:disable-line:ban-types + rawListeners(event: 'require' | 'requireFail' | 'respawn'): Function[]; // tslint:disable-line:ban-types + emit(event: 'require', name: string, module: ExtensionDescriptor): boolean; + emit(event: 'requireFail', name: string, err: any): boolean; + emit(event: 'respawn', flags: string[], child: NodeJS.Process): boolean; + eventNames(): Array<'require' | 'requireFail' | 'respawn'>; + listenerCount(type: 'require' | 'requireFail' | 'respawn'): number; +} + +declare namespace Liftoff { + interface Options { + /** + * Sugar for setting processTitle, moduleName, configName automatically. + * @default null + */ + name?: string; + /** + * Sets which module your application expects to find locally when being run. + * @default null + */ + moduleName?: string; + /** + * Sets the name of the configuration file Liftoff will attempt to find. Case-insensitive. + * @default null + */ + configName?: string; + /** + * Set extensions to include when searching for a configuration file. + * If an external module is needed to load a given extension (e.g. .coffee), + * the module name should be specified as the value for the key. + * @default {".js":null,".json":null} + */ + extensions?: Extensions; + /** + * Any flag specified here will be applied to node, not your program. + * Useful for supporting invocations like myapp --harmony command, + * where --harmony should be passed to node, not your program. + * This functionality is implemented using flagged-respawn. + * To support all v8flags, see `v8flags`. + * @default null + */ + v8flags?: string[] | ((cb: (err: any, flags: string[]) => void) => void); + /** + * Sets what the process title will be. + * @default null + */ + processTitle?: string; + /** + * A method to handle bash/zsh/whatever completions. + * @default null + */ + completions?: (completion: string) => any; + /** + * An object of configuration files to find. Each property is keyed by the + * default basename of the file being found, and the value is an object + * of path arguments keyed by unique names. + * @default null + */ + configFiles?: { + [extension: string]: { [locationName: string]: string | PathSpec }; + }; + } + + interface LaunchOptions { + /** + * Change the current working directory for this launch. Relative paths are calculated against `process.cwd()`. + * @default process.cwd() + */ + cwd?: string; + + /** + * Don't search for a config, use the one provided. + * **Note**: Liftoff will assume the current working directory is the directory containing the config file + * unless an alternate location is explicitly specified using `cwd`. + * @default null + */ + configPath?: string; + + /** + * A string or array of modules to attempt requiring from the local + * working directory before invoking the launch callback. + * @default null + */ + require?: string | any[]; + + /** + * Allows you to force node or V8 flags during the launch. + * This is useful if you need to make sure certain flags will always be enabled + * or if you need to enable flags that don't show up in `opts.v8flags` + * (as these flags aren't validated against opts.v8flags). + * @default null + */ + forcedFlags?: string | string[] | ((env: LiftoffEnv) => string | string[]); + + completion?: string; + } + + interface LiftoffEnv { + /** + * the current working directory + */ + cwd: string; + /** + * an array of modules that liftoff tried to pre-load + */ + require: string[]; + /** + * the config files searched for + */ + configNameSearch: string[]; + /** + * the full path to your configuration file (if found) + */ + configPath: string | undefined; + /** + * the base directory of your configuration file (if found) + */ + configBase: string | undefined; + /** + * the full path to the local module your project relies on (if found) + */ + modulePath: string | undefined; + /** + * the contents of the local module's package.json (if found) + */ + modulePackage: { [key: string]: any } | undefined; + /** + * an object of filepaths for each found config file (filepath values will be null if not found) + */ + configFiles: { [extensions: string]: { [path: string]: string | null } } | undefined; + } +} diff --git a/types/liftoff/liftoff-tests.ts b/types/liftoff/liftoff-tests.ts new file mode 100644 index 0000000000..bfc960eb62 --- /dev/null +++ b/types/liftoff/liftoff-tests.ts @@ -0,0 +1,182 @@ +import Liftoff = require('liftoff'); +import v8flags = require('v8flags'); + +new Liftoff({ + name: 'hacker', + processTitle: 'hacker', + moduleName: 'hacker', + configName: 'hackerfile', + extensions: { + '.js': null, + '.json': null, + '.coffee': 'coffee-script/register', + }, + v8flags: ['--harmony'], +}); +new Liftoff({ + name: 'hacker', + processTitle: 'hacker', + moduleName: 'hacker', + configName: 'hackerfile', + extensions: { + '.js': null, + '.json': null, + '.coffee': 'coffee-script/register', + }, + v8flags, +}); +new Liftoff({ name: 'hacker' }); +new Liftoff({ + name: 'myapp', + extensions: { + '.js': null, + '.json': null, + '.coffee': 'coffee-script/register', + }, +}); +new Liftoff({ + name: 'myapp', + configName: '.myapp', + extensions: { + rc: null, + }, +}); +new Liftoff({ + name: 'myapp', + extensions: require('interpret').jsVariants, +}); +new Liftoff({ + v8flags: ['--trace-deprecation'], +}); +new Liftoff({ + v8flags(cb) { + cb(null, ['--trace-deprecation']); + }, +}); +new Liftoff({ + name: 'hacker', + configFiles: { + '.hacker': { + cwd: '.', + }, + }, +}); +new Liftoff({ + name: 'hacker', + configFiles: { + '.hacker': { + home: { + path: '~', + extensions: { + rc: null, + }, + }, + }, + }, +}); +new Liftoff({ + name: 'hacker', + configFiles: { + '.hacker': { + up: { + path: '.', + findUp: true, + }, + }, + }, +}); +new Liftoff({ + name: 'hacker', + configFiles: { + hacker: { + override: { + path: '.', + name: '.override', + }, + }, + }, +}); +new Liftoff({ + name: 'hacker', + configFiles: { + '.hacker': { + home: { + path: '.', + cwd: '~', + }, + }, + }, +}); + +new Liftoff().launch( + { + cwd: '', + configPath: '', + require: '', + completion: '', + }, + env => { + // $ExpectType LiftoffEnv + env; + + // $ExpectType string + env.cwd; + // $ExpectType string[] + env.require; + // $ExpectType string[] + env.configNameSearch; + // $ExpectType string | undefined + env.configPath; + // $ExpectType string | undefined + env.configBase; + // $ExpectType string | undefined + env.modulePath; + // $ExpectType { [key: string]: any; } | undefined + env.modulePackage; + // $ExpectType { [extensions: string]: { [path: string]: string | null; }; } | undefined + env.configFiles; + } +); +new Liftoff().launch({ cwd: '' }, () => {}); +new Liftoff().launch({ configPath: '' }, () => {}); +new Liftoff().launch({ require: '' }, () => {}); +new Liftoff().launch({ forcedFlags: ['--trace-deprecation'] }, () => {}); +new Liftoff().launch({ forcedFlags: '--trace-deprecation' }, () => {}); +new Liftoff().launch( + { + forcedFlags: env => { + // $ExpectType LiftoffEnv + env; + return ['--trace-deprecation']; + }, + }, + () => {} +); +new Liftoff().launch( + { + forcedFlags: env => { + return '--trace-deprecation'; + }, + }, + () => {} +); +new Liftoff().launch({ completion: '' }, () => {}); + +new Liftoff().on('require', (name, module) => { + // $ExpectType string + name; + // $ExpectType ExtensionDescriptor + module; +}); +new Liftoff().on('requireFail', (name, err) => { + // $ExpectType string + name; + // $ExpectType any + err; +}); +new Liftoff().on('respawn', (flags, child) => { + // $ExpectType string[] + flags; + // $ExpectType Process + child; +}); diff --git a/types/liftoff/tsconfig.json b/types/liftoff/tsconfig.json new file mode 100644 index 0000000000..771c8ce2ed --- /dev/null +++ b/types/liftoff/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", + "liftoff-tests.ts" + ] +} diff --git a/types/liftoff/tslint.json b/types/liftoff/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/liftoff/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 75d166174fbe3f62941034bd5288a450e150a65a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Thu, 6 Dec 2018 12:01:30 +0000 Subject: [PATCH 125/241] [assert] Fix passing RegEx to .throws --- types/assert/assert-tests.ts | 1 + types/assert/index.d.ts | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/assert/assert-tests.ts b/types/assert/assert-tests.ts index 22248c18bd..3f795f0552 100644 --- a/types/assert/assert-tests.ts +++ b/types/assert/assert-tests.ts @@ -5,6 +5,7 @@ assert(true, "it's working"); assert.ok(true, "inner functions work as well"); assert.throws(() => {}); +assert.throws(() => {}, /Regex test/); assert.throws(() => {}, () => {}, "works wonderfully"); assert['fail'](true, true, "works like a charm"); diff --git a/types/assert/index.d.ts b/types/assert/index.d.ts index d79805f5af..f04158bbd3 100644 --- a/types/assert/index.d.ts +++ b/types/assert/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for commonjs-assert 1.4 // Project: https://github.com/browserify/commonjs-assert // Definitions by: Nico Gallinal +// Linus Unnebäck // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare function assert(value: any, message?: string): void; @@ -23,10 +24,10 @@ declare namespace assert { function notStrictEqual(actual: any, expected: any, message?: string): void; function throws(block: () => void, message?: string): void; - function throws(block: () => void, error: () => void | ((err: any) => boolean) | RegExp, message?: string): void; + function throws(block: () => void, error: (() => void) | ((err: any) => boolean) | RegExp, message?: string): void; function doesNotThrow(block: () => void, message?: string): void; - function doesNotThrow(block: () => void, error: () => void | ((err: any) => boolean) | RegExp, message?: string): void; + function doesNotThrow(block: () => void, error: (() => void) | ((err: any) => boolean) | RegExp, message?: string): void; function ifError(value: any): void; From c05467793ee17920d4122e30bc5d6a2bdf8900ae Mon Sep 17 00:00:00 2001 From: Wu Haotian Date: Thu, 6 Dec 2018 21:11:20 +0800 Subject: [PATCH 126/241] Add type definitation for debounce-promise --- .../debounce-promise-tests.ts | 25 ++++++++++++++++++ types/debounce-promise/index.d.ts | 26 +++++++++++++++++++ types/debounce-promise/tsconfig.json | 16 ++++++++++++ types/debounce-promise/tslint.json | 1 + 4 files changed, 68 insertions(+) create mode 100644 types/debounce-promise/debounce-promise-tests.ts create mode 100644 types/debounce-promise/index.d.ts create mode 100644 types/debounce-promise/tsconfig.json create mode 100644 types/debounce-promise/tslint.json diff --git a/types/debounce-promise/debounce-promise-tests.ts b/types/debounce-promise/debounce-promise-tests.ts new file mode 100644 index 0000000000..75b53dc764 --- /dev/null +++ b/types/debounce-promise/debounce-promise-tests.ts @@ -0,0 +1,25 @@ +import debounce = require("debounce-promise"); +import { DebounceOptions } from "debounce-promise"; + +const options: DebounceOptions = {}; +const optionsA: DebounceOptions = { leading: true }; +const f = async () => 2; +const f2 = (a: string) => 2; +debounce(f, 100); +debounce(f, 0, options); +debounce(f, 100, optionsA); +debounce(f, 10, { accumulate: true }); +const foo = debounce(async () => f2, 10, { + leading: true, + accumulate: true +}); +foo().then(f => f("2")); +const bar = debounce(async () => [1, 2, 3], 100); +bar().then(ar => ar.concat()); + +// Converts the return value from the producer function to a promise +const two = debounce((a: string, b: number, c: { d: boolean }) => [4], 10, { + leading: true, + accumulate: true +}); +two("1", 2, { d: false }).then(ar => ar.pop(), () => 2); diff --git a/types/debounce-promise/index.d.ts b/types/debounce-promise/index.d.ts new file mode 100644 index 0000000000..2356d30060 --- /dev/null +++ b/types/debounce-promise/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for debounce-promise 3.1 +// Project: https://github.com/bjoerge/debounce-promise +// Definitions by: Wu Haotian +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +declare namespace debounce { + interface DebounceOptions { + leading?: boolean; + accumulate?: boolean; + } +} + +type ArgumentsType = T extends (...args: infer A) => any ? A : never; + +declare function debounce any>( + func: T, + wait?: number, + options?: debounce.DebounceOptions +): ( + ...args: ArgumentsType +) => ReturnType extends Promise + ? ReturnType + : Promise>; + +export = debounce; diff --git a/types/debounce-promise/tsconfig.json b/types/debounce-promise/tsconfig.json new file mode 100644 index 0000000000..7e41251117 --- /dev/null +++ b/types/debounce-promise/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "debounce-promise-tests.ts"] +} diff --git a/types/debounce-promise/tslint.json b/types/debounce-promise/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/debounce-promise/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 6adc4768d8b6afddc14c4f47c80bdbf314a82a36 Mon Sep 17 00:00:00 2001 From: arichter83 Date: Thu, 6 Dec 2018 14:50:37 +0100 Subject: [PATCH 127/241] Fixed SimpleSchema.custom validation Function with correct context --- types/simpl-schema/index.d.ts | 38 +++++++++++++++++++++++- types/simpl-schema/simpl-schema-tests.ts | 15 +++++----- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/types/simpl-schema/index.d.ts b/types/simpl-schema/index.d.ts index 54d0a5665d..30b33f0b94 100644 --- a/types/simpl-schema/index.d.ts +++ b/types/simpl-schema/index.d.ts @@ -15,7 +15,33 @@ export interface ValidationContext extends SimpleSchemaValidationContextStatic { } interface CustomValidationContext { + /** The name of the schema key (e.g., "addresses.0.street") */ + key: string; + + /** The generic name of the schema key (e.g., "addresses.$.street") */ + genericKey: string; + + /** The schema definition object. */ + definition: SchemaDefinition; + + /** Does the object being validated have this key set? */ + isSet: boolean; + + /** Value to validate */ value: any; + + /** The Mongo operator for which we're doing validation. Might be null. */ + operator: any; + validationContext: ValidationContext; + + /** Use this method to get information about other fields. Pass a field name (non-generic schema key) as the only argument. The return object will have isSet, value, and operator properties for that field. */ + field(): any; + + /** Use this method to get information about other fields that have the same parent object. Works the same way as field(). This is helpful when you use sub-schemas or when you're dealing with arrays of objects. */ + siblingField(): any; + + /** Call this to add validation errors for any key. In general, you should use this to add errors for other keys. To add an error for the current key, return the error type string. If you do use this to add an error for the current key, return false from your custom validation function. */ + addValidationErrors(errors: SimpleSchemaValidationError): any; } interface SchemaDefinition { @@ -31,7 +57,11 @@ interface SchemaDefinition { exclusiveMax?: boolean; exclusiveMin?: boolean; regEx?: RegExp | RegExp[]; - custom?: () => any; + + /** For custom validation function. If you use an arrow function the context + for "this" will not be available. + Use "custom: function() { return something(this.value); }" instead." */ + custom?: (this: CustomValidationContext) => undefined | string | SimpleSchemaValidationError; blackbox?: boolean; autoValue?: () => any; defaultValue?: any; @@ -58,6 +88,11 @@ interface SimpleSchemaOptions { tracker?: any; } +interface SimpleSchemaValidationError { + type: string; + [key: string]: number | string; +} + interface SimpleSchemaStatic { new( schema: { @@ -185,6 +220,7 @@ export const MongoObject: MongoObjectStatic; export interface SimpleSchema extends SimpleSchemaStatic { debug: boolean; + /** Validate a data object. Options: {keys: []} to limit */ validate(obj: any, options?: ValidationOption): void; addValidator(validator: () => boolean): any; extendOptions(options: {[key: string]: any}): void; diff --git a/types/simpl-schema/simpl-schema-tests.ts b/types/simpl-schema/simpl-schema-tests.ts index 6373107aa3..55be71ec6e 100644 --- a/types/simpl-schema/simpl-schema-tests.ts +++ b/types/simpl-schema/simpl-schema-tests.ts @@ -14,18 +14,19 @@ const StringSchema = new SimpleSchema({ }, createdAt: { type: Date, - autoValue: () => new Date(), + autoValue: () => new Date() }, title: { type: String, - label: "Argument", - /* TODO, this does not work: "The containing arrow function captures the global value of 'this' which implicitly has type 'any'." - custom: () => { + label: "Title", + /* Can't use arrow function here, else the context won't be available */ + custom: function() { const text = this.value; - if (text.length > 10) return { type: SimpleSchema.ErrorTypes.MAX_STRING, max: 10 }; + + if (text.length > 100) return { type: SimpleSchema.ErrorTypes.MAX_STRING, max: 100 }; + else if (text.length <10) return SimpleSchema.ErrorTypes.MIN_STRING } - */ - }, + } }); StringSchema.validate({ From 34bd9bc71df60692e286c4a216549ae7c29290ac Mon Sep 17 00:00:00 2001 From: arichter83 Date: Thu, 6 Dec 2018 15:00:46 +0100 Subject: [PATCH 128/241] Fix doc format --- types/simpl-schema/index.d.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/types/simpl-schema/index.d.ts b/types/simpl-schema/index.d.ts index 30b33f0b94..8ac1a04cc7 100644 --- a/types/simpl-schema/index.d.ts +++ b/types/simpl-schema/index.d.ts @@ -34,13 +34,20 @@ interface CustomValidationContext { operator: any; validationContext: ValidationContext; - /** Use this method to get information about other fields. Pass a field name (non-generic schema key) as the only argument. The return object will have isSet, value, and operator properties for that field. */ + /** Use this method to get information about other fields. Pass a field name + (non-generic schema key) as the only argument. The return object will + have isSet, value, and operator properties for that field. */ field(): any; - /** Use this method to get information about other fields that have the same parent object. Works the same way as field(). This is helpful when you use sub-schemas or when you're dealing with arrays of objects. */ + /** Use this method to get information about other fields that have the same + parent object. Works the same way as field(). This is helpful when you use + sub-schemas or when you're dealing with arrays of objects. */ siblingField(): any; - /** Call this to add validation errors for any key. In general, you should use this to add errors for other keys. To add an error for the current key, return the error type string. If you do use this to add an error for the current key, return false from your custom validation function. */ + /** Call this to add validation errors for any key. In general, you should use + this to add errors for other keys. To add an error for the current key, + return the error type string. If you do use this to add an error for the + current key, return false from your custom validation function. */ addValidationErrors(errors: SimpleSchemaValidationError): any; } @@ -59,8 +66,8 @@ interface SchemaDefinition { regEx?: RegExp | RegExp[]; /** For custom validation function. If you use an arrow function the context - for "this" will not be available. - Use "custom: function() { return something(this.value); }" instead." */ + for "this" will not be available. Use "custom: function() { return + something(this.value); }" instead. */ custom?: (this: CustomValidationContext) => undefined | string | SimpleSchemaValidationError; blackbox?: boolean; autoValue?: () => any; From 4c382097c7414d6d9d11ec32dcf9d8dcd8d7debf Mon Sep 17 00:00:00 2001 From: arichter83 Date: Thu, 6 Dec 2018 15:15:50 +0100 Subject: [PATCH 129/241] Again fixing linting need to disable object-literal-shorthand for SimpleSchema.custom --- types/simpl-schema/index.d.ts | 36 ++++++++++++++---------- types/simpl-schema/simpl-schema-tests.ts | 2 +- types/simpl-schema/tslint.json | 7 ++++- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/types/simpl-schema/index.d.ts b/types/simpl-schema/index.d.ts index 8ac1a04cc7..afd841e0c9 100644 --- a/types/simpl-schema/index.d.ts +++ b/types/simpl-schema/index.d.ts @@ -34,20 +34,25 @@ interface CustomValidationContext { operator: any; validationContext: ValidationContext; - /** Use this method to get information about other fields. Pass a field name - (non-generic schema key) as the only argument. The return object will - have isSet, value, and operator properties for that field. */ + /** + * Use this method to get information about other fields. Pass a field name + * (non-generic schema key) as the only argument. The return object will + * have isSet, value, and operator properties for that field. + */ field(): any; - - /** Use this method to get information about other fields that have the same - parent object. Works the same way as field(). This is helpful when you use - sub-schemas or when you're dealing with arrays of objects. */ + /** + * Use this method to get information about other fields that have the same + * parent object. Works the same way as field(). This is helpful when you use + * sub-schemas or when you're dealing with arrays of objects. + */ siblingField(): any; - /** Call this to add validation errors for any key. In general, you should use - this to add errors for other keys. To add an error for the current key, - return the error type string. If you do use this to add an error for the - current key, return false from your custom validation function. */ + /** + * Call this to add validation errors for any key. In general, you should use + * this to add errors for other keys. To add an error for the current key, + * return the error type string. If you do use this to add an error for the + * current key, return false from your custom validation function. + */ addValidationErrors(errors: SimpleSchemaValidationError): any; } @@ -64,10 +69,11 @@ interface SchemaDefinition { exclusiveMax?: boolean; exclusiveMin?: boolean; regEx?: RegExp | RegExp[]; - - /** For custom validation function. If you use an arrow function the context - for "this" will not be available. Use "custom: function() { return - something(this.value); }" instead. */ + /** + * For custom validation function. If you use an arrow function the context + * for "this" will not be available. Use "custom: function() { return + * something(this.value); }" instead. + */ custom?: (this: CustomValidationContext) => undefined | string | SimpleSchemaValidationError; blackbox?: boolean; autoValue?: () => any; diff --git a/types/simpl-schema/simpl-schema-tests.ts b/types/simpl-schema/simpl-schema-tests.ts index 55be71ec6e..a3555c4428 100644 --- a/types/simpl-schema/simpl-schema-tests.ts +++ b/types/simpl-schema/simpl-schema-tests.ts @@ -24,7 +24,7 @@ const StringSchema = new SimpleSchema({ const text = this.value; if (text.length > 100) return { type: SimpleSchema.ErrorTypes.MAX_STRING, max: 100 }; - else if (text.length <10) return SimpleSchema.ErrorTypes.MIN_STRING + else if (text.length < 10) return SimpleSchema.ErrorTypes.MIN_STRING; } } }); diff --git a/types/simpl-schema/tslint.json b/types/simpl-schema/tslint.json index 3db14f85ea..3043773b06 100644 --- a/types/simpl-schema/tslint.json +++ b/types/simpl-schema/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "object-literal-shorthand": false + } +} From 5f098b2d6ad61c2712e5dc8b87bf0487654cacc6 Mon Sep 17 00:00:00 2001 From: Shaun Burdick Date: Thu, 6 Dec 2018 10:33:05 -0500 Subject: [PATCH 130/241] [@types/amqp-connection-manager] Added missing `ChannelWrapper.removeSetup()` --- types/amqp-connection-manager/index.d.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/types/amqp-connection-manager/index.d.ts b/types/amqp-connection-manager/index.d.ts index ab69aadeb1..e2907b67ee 100644 --- a/types/amqp-connection-manager/index.d.ts +++ b/types/amqp-connection-manager/index.d.ts @@ -136,7 +136,16 @@ export interface ChannelWrapper extends EventEmitter { * Setup functions should, ideally, not throw errors, but if they do then the ChannelWrapper will emit an 'error' event. * @param func */ - addSetup(func: SetupFunc): Promise; + addSetup(func: SetupFunc): Promise; + + /** + * Remove a setup function added with `addSetup`. If there is currently a + * connection, `teardown(channel, [cb])` will be run immediately, and the + * returned Promise will not resolve until it completes. + * @param func + * @param [tearDown] + */ + removeSetup(func: SetupFunc, tearDown?: SetupFunc): Promise; /** * @see amqplib From e5ca27ce79a05eb554ac478f97d034cceb43324d Mon Sep 17 00:00:00 2001 From: Bradley Hill Date: Thu, 6 Dec 2018 09:46:39 -0600 Subject: [PATCH 131/241] Fabric - Cross origin is a string everywhere. Type as such so don't have to downcast as any. --- types/fabric/fabric-impl.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/fabric/fabric-impl.d.ts b/types/fabric/fabric-impl.d.ts index 39b3e45757..60ec11648f 100644 --- a/types/fabric/fabric-impl.d.ts +++ b/types/fabric/fabric-impl.d.ts @@ -4529,7 +4529,7 @@ interface IUtilMisc { * @param [context] Context to invoke callback in * @param [crossOrigin] crossOrigin value to set image element to */ - loadImage(url: string, callback: (image: HTMLImageElement) => void, context?: any, crossOrigin?: boolean): void; + loadImage(url: string, callback: (image: HTMLImageElement) => void, context?: any, crossOrigin?: string): void; /** * Creates corresponding fabric instances from their object representations From 07c66081db673014a3617144e4e8036dc0249d28 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Thu, 6 Dec 2018 16:00:23 +0100 Subject: [PATCH 132/241] Add orFail method --- types/mongoose/index.d.ts | 24 ++++++++++++++++++++++++ types/mongoose/mongoose-tests.ts | 1 + 2 files changed, 25 insertions(+) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index f08b8e0b5c..ad515a1806 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -2021,6 +2021,30 @@ declare module "mongoose" { */ or(array: any[]): this; + /** + * Make this query throw an error if no documents match the given `filter`. + * This is handy for integrating with async/await, because `orFail()` saves you + * an extra `if` statement to check if no document was found. + * + * ####Example: + * + * // Throws if no doc returned + * await Model.findOne({ foo: 'bar' }).orFail(); + * + * // Throws if no document was updated + * await Model.updateOne({ foo: 'bar' }, { name: 'test' }).orFail(); + * + * // Throws "No docs found!" error if no docs match `{ foo: 'bar' }` + * await Model.find({ foo: 'bar' }).orFail(new Error('No docs found!')); + * + * // Throws "Not found" error if no document was found + * await Model.findOneAndUpdate({ foo: 'bar' }, { name: 'test' }). + * orFail(() => Error('Not found')); + * + * @param err optional error to throw if no docs match `filter` + */ + orFail(err?: Error | (() => Error)): this; + /** Specifies a $polygon condition */ polygon(...coordinatePairs: number[][]): this; polygon(path: string, ...coordinatePairs: number[][]): this; diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index a660ce728f..f4fec31101 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -1080,6 +1080,7 @@ query.find().where('age').in([20, 21]); query.find().in('age', [20, 21]); query.nor([{ color: 'green' }, { status: 'ok' }]).nor([]); query.or([{ color: 'red' }, { status: 'emergency' }]).or([]); +query.find({ color: 'blue' }).orFail(); query.where('loc').within().polygon([10,20], [13, 25], [7,15]); query.polygon('loc', [10,20], [13, 25], [7,15]); query.findOne().populate('owner').exec(function (err, kitten) { From c95a21430b2dd21b55e3146b9940565f0fd7ef38 Mon Sep 17 00:00:00 2001 From: Ben James Date: Thu, 6 Dec 2018 17:48:58 +0000 Subject: [PATCH 133/241] Add types for @atlaskit/tree --- types/atlaskit__tree/atlaskit__tree-tests.tsx | 42 +++++ types/atlaskit__tree/index.d.ts | 153 ++++++++++++++++++ types/atlaskit__tree/tsconfig.json | 20 +++ types/atlaskit__tree/tslint.json | 1 + 4 files changed, 216 insertions(+) create mode 100644 types/atlaskit__tree/atlaskit__tree-tests.tsx create mode 100644 types/atlaskit__tree/index.d.ts create mode 100644 types/atlaskit__tree/tsconfig.json create mode 100644 types/atlaskit__tree/tslint.json diff --git a/types/atlaskit__tree/atlaskit__tree-tests.tsx b/types/atlaskit__tree/atlaskit__tree-tests.tsx new file mode 100644 index 0000000000..b99647a7c6 --- /dev/null +++ b/types/atlaskit__tree/atlaskit__tree-tests.tsx @@ -0,0 +1,42 @@ +import Tree from "@atlaskit/tree"; + +import * as React from "react"; +import { render } from "react-dom"; + +declare const container: Element; + +render( +
} + onExpand={() => {}} + onCollapse={() => {}} + onDragStart={() => {}} + onDragEnd={() => {}} + offsetPerLevel={20} + isDragEnabled + isNestingEnabled + />, + container +); + +// Check that default props work too. +render(
} />, container); diff --git a/types/atlaskit__tree/index.d.ts b/types/atlaskit__tree/index.d.ts new file mode 100644 index 0000000000..4d6a952b76 --- /dev/null +++ b/types/atlaskit__tree/index.d.ts @@ -0,0 +1,153 @@ +// Type definitions for @atlaskit/tree 4.1 +// Project: https://bitbucket.org/atlassian/atlaskit-mk-2/ +// Definitions by: Ben James +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +import { Component, ReactNode } from "react"; + +import { + DraggingStyle, + DraggableProvidedDragHandleProps, + DraggableStateSnapshot, + NotDraggingStyle +} from "react-beautiful-dnd"; + +export type ItemId = any; + +export type Path = number[]; + +export interface TreeData { + rootId: ItemId; + items: { [key: string]: TreeItem; [key: number]: TreeItem }; +} + +export type TreeItemData = any; + +export interface TreeItem { + id: ItemId; + children: ItemId[]; + hasChildren?: boolean; + isExpanded?: boolean; + isChildrenLoading?: boolean; + data?: TreeItemData; +} + +export interface TreeSourcePosition { + parentId: ItemId; + index: number; +} + +export interface TreeDestinationPosition { + parentId: ItemId; + index?: number; +} + +type Omit = Pick>; + +interface TreeDraggingStyle extends Omit { + paddingLeft: number; + transition: "none" | string; +} + +type TreeDraggableStyle = NotDraggingStyle | TreeDraggingStyle; + +interface TreeDraggableProps { + // Props that can be spread onto the element directly + // inline style + style?: TreeDraggableStyle; + // used for shared global styles + "data-react-beautiful-dnd-draggable": string; +} + +interface TreeDraggableProvided { + draggableProps: TreeDraggableProps; + // will be null if the draggable is disabled + dragHandleProps?: DraggableProvidedDragHandleProps; + // The following props will be removed once we move to react 16 + innerRef: (element?: HTMLElement) => void; +} + +export interface RenderItemParams { + item: TreeItem; + depth: number; + onExpand: (itemId: ItemId) => void; + onCollapse: (itemId: ItemId) => void; + provided: TreeDraggableProvided; + snapshot: DraggableStateSnapshot; +} + +interface TreeItemMutation { + id?: ItemId; + children?: ItemId[]; + hasChildren?: boolean; + isExpanded?: boolean; + isChildrenLoading?: boolean; + data?: TreeItemData; +} + +export function mutateTree( + tree: TreeData, + itemId: ItemId, + mutation: TreeItemMutation +): TreeData; + +export function moveItemOnTree( + tree: TreeData, + from: TreeSourcePosition, + to: TreeDestinationPosition +): TreeData; + +interface TreeProps { + /** The tree data structure. */ + tree: TreeData; + /** Function that will be called when a parent item needs to be expanded. */ + onExpand: (itemId: ItemId, path: Path) => void; + /** Function that will be called when a parent item needs to be collapsed. */ + onCollapse: (itemId: ItemId, path: Path) => void; + /** Function that will be called when the user starts dragging. */ + onDragStart: (itemId: ItemId) => void; + /** Function that will be called when the user finishes dragging. */ + onDragEnd: ( + sourcePosition: TreeSourcePosition, + destinationPosition: TreeDestinationPosition | undefined + ) => void; + /** Function that will be called to render a single item. */ + renderItem: (itemProps: RenderItemParams) => ReactNode; + /** Number of pixel is used to scaffold the tree by the consumer. */ + offsetPerLevel: number; + /** Boolean to turn on drag&drop re-ordering on the tree */ + isDragEnabled: boolean; + /** Boolean to turn on hovering while dragging */ + isNestingEnabled: boolean; +} + +interface FlattenedItem { + item: TreeItem; + path: Path; +} + +type FlattenedTree = FlattenedItem[]; + +interface TreeState { + /** The flattened tree data structure transformed from props.tree */ + flattenedTree: FlattenedTree; + // Id of the currently dragged item + draggedItemId: ItemId; +} + +declare class Tree extends Component { + static defaultProps: { + tree: { children: [] }; + onExpand: () => void; + onCollapse: () => void; + onDragStart: () => void; + onDragEnd: () => void; + renderItem: () => void; + offsetPerLevel: 35; + isDragEnabled: false; + isNestingEnabled: false; + }; +} + +export default Tree; diff --git a/types/atlaskit__tree/tsconfig.json b/types/atlaskit__tree/tsconfig.json new file mode 100644 index 0000000000..b6d581fa0d --- /dev/null +++ b/types/atlaskit__tree/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "paths": { + "@atlaskit/tree": ["atlaskit__tree"] + } + }, + "files": ["index.d.ts", "atlaskit__tree-tests.tsx"] +} diff --git a/types/atlaskit__tree/tslint.json b/types/atlaskit__tree/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/atlaskit__tree/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 0710a3b0f6f506c78ae5056403952f7a06798096 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Thu, 6 Dec 2018 19:07:31 +0100 Subject: [PATCH 134/241] Add types for empty-dir --- types/empty-dir/empty-dir-tests.ts | 25 +++++++++++++++++++++++++ types/empty-dir/index.d.ts | 22 ++++++++++++++++++++++ types/empty-dir/tsconfig.json | 23 +++++++++++++++++++++++ types/empty-dir/tslint.json | 1 + 4 files changed, 71 insertions(+) create mode 100644 types/empty-dir/empty-dir-tests.ts create mode 100644 types/empty-dir/index.d.ts create mode 100644 types/empty-dir/tsconfig.json create mode 100644 types/empty-dir/tslint.json diff --git a/types/empty-dir/empty-dir-tests.ts b/types/empty-dir/empty-dir-tests.ts new file mode 100644 index 0000000000..63700ae87b --- /dev/null +++ b/types/empty-dir/empty-dir-tests.ts @@ -0,0 +1,25 @@ +import emptyDir = require('empty-dir'); + +emptyDir('./', (err, isEmpty) => { + // $ExpectType ErrnoException + err; + // $ExpectType boolean + isEmpty; +}); + +// $ExpectType boolean +emptyDir.sync('./test/empty'); + +function filter(filepath: string) { + return !/(Thumbs\.db|\.DS_Store)$/i.test(filepath); +} + +emptyDir('./', filter, (err, isEmpty) => { + // $ExpectType ErrnoException + err; + // $ExpectType boolean + isEmpty; +}); + +// $ExpectType boolean +emptyDir.sync('./test/empty', filter); diff --git a/types/empty-dir/index.d.ts b/types/empty-dir/index.d.ts new file mode 100644 index 0000000000..0f623a991d --- /dev/null +++ b/types/empty-dir/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for empty-dir 1.0 +// Project: https://github.com/js-cli/js-empty-dir +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export = emptyDir; + +declare function emptyDir( + dir: string, + cb: (err: NodeJS.ErrnoException, isEmpty: boolean) => void +): void; +declare function emptyDir( + dir: string, + filter: (path: string) => boolean, + cb: (err: NodeJS.ErrnoException, isEmpty: boolean) => void +): void; + +declare namespace emptyDir { + function sync(dir: string, filter?: (path: string) => boolean): boolean; +} diff --git a/types/empty-dir/tsconfig.json b/types/empty-dir/tsconfig.json new file mode 100644 index 0000000000..cb73470ad8 --- /dev/null +++ b/types/empty-dir/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", + "empty-dir-tests.ts" + ] +} diff --git a/types/empty-dir/tslint.json b/types/empty-dir/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/empty-dir/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b19ba7a9a3b4f548bc350956847a5b6644c7ce8b Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Thu, 6 Dec 2018 19:27:28 +0100 Subject: [PATCH 135/241] Add types for tildify --- types/tildify/index.d.ts | 8 ++++++++ types/tildify/tildify-tests.ts | 4 ++++ types/tildify/tsconfig.json | 23 +++++++++++++++++++++++ types/tildify/tslint.json | 1 + 4 files changed, 36 insertions(+) create mode 100644 types/tildify/index.d.ts create mode 100644 types/tildify/tildify-tests.ts create mode 100644 types/tildify/tsconfig.json create mode 100644 types/tildify/tslint.json diff --git a/types/tildify/index.d.ts b/types/tildify/index.d.ts new file mode 100644 index 0000000000..a0dd100bf9 --- /dev/null +++ b/types/tildify/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for tildify 1.2 +// Project: https://github.com/sindresorhus/tildify#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = tildify; + +declare function tildify(str: string): string; diff --git a/types/tildify/tildify-tests.ts b/types/tildify/tildify-tests.ts new file mode 100644 index 0000000000..109f5f6c6e --- /dev/null +++ b/types/tildify/tildify-tests.ts @@ -0,0 +1,4 @@ +import tildify = require('tildify'); + +// $ExpectType string +tildify('/Users/sindresorhus/dev'); diff --git a/types/tildify/tsconfig.json b/types/tildify/tsconfig.json new file mode 100644 index 0000000000..4375409ba0 --- /dev/null +++ b/types/tildify/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", + "tildify-tests.ts" + ] +} diff --git a/types/tildify/tslint.json b/types/tildify/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/tildify/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 11ec8b0e410c1e83c2b6011a7aa30dddbc154c26 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 6 Dec 2018 10:41:09 -0800 Subject: [PATCH 136/241] Add shelljs/make The make utility script: 1. Adds an object named target to the global namespace. 2. Dumps the contents of shelljs into the global namespace. --- types/shelljs/make.d.ts | 41 +++++++++++++++++++++++++++++++++++++ types/shelljs/tsconfig.json | 3 ++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 types/shelljs/make.d.ts diff --git a/types/shelljs/make.d.ts b/types/shelljs/make.d.ts new file mode 100644 index 0000000000..2ebded5a99 --- /dev/null +++ b/types/shelljs/make.d.ts @@ -0,0 +1,41 @@ +import * as shelljs from './' +declare global { + type Target = { + (...args: any[]): void, + result?: any, + done?: boolean + }; + export const target: { + all?: Target; + [s: string]: Target; + }; + export const cd: typeof shelljs.cd; + export const pwd: typeof shelljs.pwd; + export const ls: typeof shelljs.ls; + export const find: typeof shelljs.find; + export const cp: typeof shelljs.cp; + export const rm: typeof shelljs.rm; + export const mv: typeof shelljs.mv; + export const mkdir: typeof shelljs.mkdir; + export const cat: typeof shelljs.cat; + export const sed: typeof shelljs.sed; + export const grep: typeof shelljs.grep; + export const echo: typeof shelljs.echo; + export const pushd: typeof shelljs.pushd; + export const popd: typeof shelljs.popd; + export const dirs: typeof shelljs.dirs; + export const ln: typeof shelljs.ln; + export const exit: typeof shelljs.exit; + export const env: typeof shelljs.env; + export const exec: typeof shelljs.exec; + export const chmod: typeof shelljs.chmod; + export const tempdir: typeof shelljs.tempdir; + export const error: typeof shelljs.error; + export const touch: typeof shelljs.touch; + export const head: typeof shelljs.head; + export const sort: typeof shelljs.sort; + export const tail: typeof shelljs.tail; + export const uniq: typeof shelljs.uniq; + export const set: typeof shelljs.set; + export const config: typeof shelljs.config; +} diff --git a/types/shelljs/tsconfig.json b/types/shelljs/tsconfig.json index 7343a42a7e..51937bc2c0 100644 --- a/types/shelljs/tsconfig.json +++ b/types/shelljs/tsconfig.json @@ -18,6 +18,7 @@ }, "files": [ "index.d.ts", + "make.d.ts", "shelljs-tests.ts" ] -} \ No newline at end of file +} From 6b035ca04e5a9cc16c5b846f7f3ea10bde4d1911 Mon Sep 17 00:00:00 2001 From: Paul Sherman Date: Thu, 6 Dec 2018 12:48:16 -0600 Subject: [PATCH 137/241] [react] Deduplicate HTMLElements in global.d.ts --- types/react/global.d.ts | 49 ++++------------------------------------- 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/types/react/global.d.ts b/types/react/global.d.ts index 0c7a24070a..2ea2b7ca91 100644 --- a/types/react/global.d.ts +++ b/types/react/global.d.ts @@ -34,6 +34,7 @@ interface HTMLBodyElement extends HTMLElement { } interface HTMLBRElement extends HTMLElement { } interface HTMLButtonElement extends HTMLElement { } interface HTMLCanvasElement extends HTMLElement { } +interface HTMLDataListElement extends HTMLElement { } interface HTMLDialogElement extends HTMLElement { } interface HTMLDivElement extends HTMLElement { } interface HTMLDListElement extends HTMLElement { } @@ -43,8 +44,6 @@ interface HTMLFormElement extends HTMLElement { } interface HTMLHeadingElement extends HTMLElement { } interface HTMLHeadElement extends HTMLElement { } interface HTMLHRElement extends HTMLElement { } -interface HTMLTableColElement extends HTMLElement { } -interface HTMLDataListElement extends HTMLElement { } interface HTMLHtmlElement extends HTMLElement { } interface HTMLIFrameElement extends HTMLElement { } interface HTMLImageElement extends HTMLElement { } @@ -71,53 +70,13 @@ interface HTMLSourceElement extends HTMLElement { } interface HTMLSpanElement extends HTMLElement { } interface HTMLStyleElement extends HTMLElement { } interface HTMLTableElement extends HTMLElement { } -interface HTMLTableSectionElement extends HTMLElement { } -interface HTMLTableDataCellElement extends HTMLElement { } -interface HTMLTextAreaElement extends HTMLElement { } -interface HTMLTableSectionElement extends HTMLElement { } -interface HTMLTableHeaderCellElement extends HTMLElement { } -interface HTMLTableSectionElement extends HTMLElement { } -interface HTMLTitleElement extends HTMLElement { } -interface HTMLTableRowElement extends HTMLElement { } -interface HTMLTrackElement extends HTMLElement { } -interface HTMLUListElement extends HTMLElement { } -interface HTMLVideoElement extends HTMLElement { } interface HTMLTableColElement extends HTMLElement { } -interface HTMLDataListElement extends HTMLElement { } -interface HTMLHtmlElement extends HTMLElement { } -interface HTMLIFrameElement extends HTMLElement { } -interface HTMLImageElement extends HTMLElement { } -interface HTMLInputElement extends HTMLElement { } -interface HTMLModElement extends HTMLElement { } -interface HTMLLabelElement extends HTMLElement { } -interface HTMLLegendElement extends HTMLElement { } -interface HTMLLIElement extends HTMLElement { } -interface HTMLLinkElement extends HTMLElement { } -interface HTMLMapElement extends HTMLElement { } -interface HTMLMetaElement extends HTMLElement { } -interface HTMLObjectElement extends HTMLElement { } -interface HTMLOListElement extends HTMLElement { } -interface HTMLOptGroupElement extends HTMLElement { } -interface HTMLOptionElement extends HTMLElement { } -interface HTMLParagraphElement extends HTMLElement { } -interface HTMLParamElement extends HTMLElement { } -interface HTMLPreElement extends HTMLElement { } -interface HTMLProgressElement extends HTMLElement { } -interface HTMLQuoteElement extends HTMLElement { } -interface HTMLScriptElement extends HTMLElement { } -interface HTMLSelectElement extends HTMLElement { } -interface HTMLSourceElement extends HTMLElement { } -interface HTMLSpanElement extends HTMLElement { } -interface HTMLStyleElement extends HTMLElement { } -interface HTMLTableElement extends HTMLElement { } -interface HTMLTableSectionElement extends HTMLElement { } interface HTMLTableDataCellElement extends HTMLElement { } -interface HTMLTextAreaElement extends HTMLElement { } -interface HTMLTableSectionElement extends HTMLElement { } interface HTMLTableHeaderCellElement extends HTMLElement { } -interface HTMLTableSectionElement extends HTMLElement { } -interface HTMLTitleElement extends HTMLElement { } interface HTMLTableRowElement extends HTMLElement { } +interface HTMLTableSectionElement extends HTMLElement { } +interface HTMLTextAreaElement extends HTMLElement { } +interface HTMLTitleElement extends HTMLElement { } interface HTMLTrackElement extends HTMLElement { } interface HTMLUListElement extends HTMLElement { } interface HTMLVideoElement extends HTMLElement { } From c9ed1594d67e7a632b308e1a483a7c667fe4c844 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 6 Dec 2018 10:50:51 -0800 Subject: [PATCH 138/241] Fix some lint --- types/shelljs/make.d.ts | 66 ++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/types/shelljs/make.d.ts b/types/shelljs/make.d.ts index 2ebded5a99..0db5320b72 100644 --- a/types/shelljs/make.d.ts +++ b/types/shelljs/make.d.ts @@ -1,41 +1,41 @@ -import * as shelljs from './' +import * as shelljs from './'; declare global { - type Target = { + interface Target { (...args: any[]): void, result?: any, done?: boolean - }; - export const target: { + } + const target: { all?: Target; [s: string]: Target; }; - export const cd: typeof shelljs.cd; - export const pwd: typeof shelljs.pwd; - export const ls: typeof shelljs.ls; - export const find: typeof shelljs.find; - export const cp: typeof shelljs.cp; - export const rm: typeof shelljs.rm; - export const mv: typeof shelljs.mv; - export const mkdir: typeof shelljs.mkdir; - export const cat: typeof shelljs.cat; - export const sed: typeof shelljs.sed; - export const grep: typeof shelljs.grep; - export const echo: typeof shelljs.echo; - export const pushd: typeof shelljs.pushd; - export const popd: typeof shelljs.popd; - export const dirs: typeof shelljs.dirs; - export const ln: typeof shelljs.ln; - export const exit: typeof shelljs.exit; - export const env: typeof shelljs.env; - export const exec: typeof shelljs.exec; - export const chmod: typeof shelljs.chmod; - export const tempdir: typeof shelljs.tempdir; - export const error: typeof shelljs.error; - export const touch: typeof shelljs.touch; - export const head: typeof shelljs.head; - export const sort: typeof shelljs.sort; - export const tail: typeof shelljs.tail; - export const uniq: typeof shelljs.uniq; - export const set: typeof shelljs.set; - export const config: typeof shelljs.config; + const cd: typeof shelljs.cd; + const pwd: typeof shelljs.pwd; + const ls: typeof shelljs.ls; + const find: typeof shelljs.find; + const cp: typeof shelljs.cp; + const rm: typeof shelljs.rm; + const mv: typeof shelljs.mv; + const mkdir: typeof shelljs.mkdir; + const cat: typeof shelljs.cat; + const sed: typeof shelljs.sed; + const grep: typeof shelljs.grep; + const echo: typeof shelljs.echo; + const pushd: typeof shelljs.pushd; + const popd: typeof shelljs.popd; + const dirs: typeof shelljs.dirs; + const ln: typeof shelljs.ln; + const exit: typeof shelljs.exit; + const env: typeof shelljs.env; + const exec: typeof shelljs.exec; + const chmod: typeof shelljs.chmod; + const tempdir: typeof shelljs.tempdir; + const error: typeof shelljs.error; + const touch: typeof shelljs.touch; + const head: typeof shelljs.head; + const sort: typeof shelljs.sort; + const tail: typeof shelljs.tail; + const uniq: typeof shelljs.uniq; + const set: typeof shelljs.set; + const config: typeof shelljs.config; } From 52aee928af894837bf24f71bb2621a710f6e804a Mon Sep 17 00:00:00 2001 From: Chris Wilcox Date: Thu, 6 Dec 2018 11:09:51 -0800 Subject: [PATCH 139/241] Remove google-cloud__storage as it is now Typescript. --- notNeededPackages.json | 6 + .../google-cloud__storage-tests.ts | 592 ------------------ types/google-cloud__storage/index.d.ts | 469 -------------- types/google-cloud__storage/tsconfig.json | 28 - types/google-cloud__storage/tslint.json | 8 - 5 files changed, 6 insertions(+), 1097 deletions(-) delete mode 100644 types/google-cloud__storage/google-cloud__storage-tests.ts delete mode 100644 types/google-cloud__storage/index.d.ts delete mode 100644 types/google-cloud__storage/tsconfig.json delete mode 100644 types/google-cloud__storage/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 53ff6a7124..c64738aa8d 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -642,6 +642,12 @@ "sourceRepoURL": "https://github.com/jdalrymple/node-gitlab", "asOfVersion": "2.0.0" }, + { + "libraryName": "Google Cloud Storage", + "typingsPackageName": "google-cloud__storage", + "sourceRepoURL": "https://github.com/googleapis/nodejs-storage", + "asOfVersion": "2.3.0" + }, { "libraryName": "graphene-pk11", "typingsPackageName": "graphene-pk11", diff --git a/types/google-cloud__storage/google-cloud__storage-tests.ts b/types/google-cloud__storage/google-cloud__storage-tests.ts deleted file mode 100644 index 1db3e73284..0000000000 --- a/types/google-cloud__storage/google-cloud__storage-tests.ts +++ /dev/null @@ -1,592 +0,0 @@ -// import file system i/o api -import * as fs from "fs"; - -// import Google Cloud Storage -import { - Acl, - Bucket, - Channel, - File, - ApiResponse, - BucketConfig, - BucketFileOptions, - BucketGetOptions, - BucketMetadata, - BucketPrivacyOptions, - BucketQuery, - ChannelConfig, - DownloadOptions, - FileMetadata, - FilePrivateOptions, - ReadStreamOptions, - ResumableUploadOptions, - SignedPolicy, - SignedPolicyOptions, - SignedUrlConfig, - WriteStreamOptions, - UploadOptions -} from "@google-cloud/storage"; -import Storage = require("@google-cloud/storage"); - -/** - * Test the storage service. - */ -export class TestStorage { - // constants - static BUCKET_CONFIG: BucketConfig = { - multiRegional: true - }; - - // import Storage class - static gcs = new Storage(); - - constructor() { - // nothing to do - } - - /** Returns the bucket. */ - bucket(name: string): Bucket { - return TestStorage.gcs.bucket(name); - } - - /** Create a new bucket. */ - createBucket(name: string, config?: BucketConfig): Promise<[Bucket, ApiResponse]> { - // overwrite default values with custom config - config = Object.assign(TestStorage.BUCKET_CONFIG, config); - - return TestStorage.gcs.createBucket(name, config); - } - - /** - * Query for buckets. - */ - getBuckets(query?: BucketQuery): Promise<[Bucket[]]> { - return TestStorage.gcs.getBuckets(query); - } -} - -/** The bucket API wrapper. */ -export class TestBucket { - // the bucket in the cloud - bucket: Bucket; - - /** Create a bucket. */ - create(config?: BucketConfig): Promise<[Bucket, ApiResponse]> { - return this.bucket.create(config); - } - - /** Create a channel that will be notified when objects in this bucket changes. */ - createChannel(id: string, config: ChannelConfig): Promise<[Channel, ApiResponse]> { - return this.bucket.createChannel(id, config); - } - - /** Delete the bucket. */ - delete(): Promise<[ApiResponse]> { - return this.bucket.delete(); - } - - /** Iterate over the bucket's files, calling file.delete() on each. */ - deleteFiles(query?: BucketQuery): Promise { - return this.bucket.deleteFiles(query); - } - - /** Check if the bucket exists. */ - exists(): Promise<[boolean]> { - return this.bucket.exists(); - } - - /** Create a File object. */ - file(name: string, options?: BucketFileOptions): File { - return this.bucket.file(name); - } - - /** Get a bucket if it exists. */ - get(options?: BucketGetOptions): Promise<[Bucket, ApiResponse]> { - return this.bucket.get(options); - } - - /** Get File objects for the files currently in the bucket */ - getFiles(query?: BucketQuery): Promise<[File[]]> { - return this.bucket.getFiles(query); - } - - /** Get File objects for the files currently in the bucket as a readable object stream. */ - getFilesStream(query?: BucketQuery): fs.ReadStream { - return this.bucket.getFilesStream(query); - } - - /** Get the bucket's metadata. */ - getMetadata(): Promise<[BucketMetadata, ApiResponse]> { - return this.bucket.getMetadata(); - } - - /** Make the bucket listing private. */ - makePrivate(options?: BucketPrivacyOptions): Promise<[File[]]> { - return this.bucket.makePrivate(options); - } - - /** Make the bucket publicly readable. */ - makePublic(options?: BucketPrivacyOptions): Promise<[File[]]> { - return this.bucket.makePublic(options); - } - - /** Set the bucket's metadata. */ - setMetadata(metadata?: BucketMetadata): Promise<[ApiResponse]> { - return this.bucket.setMetadata(metadata); - } - - /** Upload a file. */ - upload(localPath: string, options?: UploadOptions): Promise<[File]> { - return this.bucket.upload(localPath, options); - } -} - -/** The file API wrapper. */ -export class TestFile { - // the file in the cloud - file: File; - - /** - * Copy this file to another file. - * By default, this will copy the file to the same bucket, but you can choose to copy it to another - * Bucket by providing a Bucket or File object or a URL starting with "gs:// ". - */ - copy(destination: string | Bucket | File): Promise<[File, ApiResponse]> { - return this.file.copy(destination); - } - - /** Create a unique resumable upload session URI. This is the first step when performing a resumable upload. */ - createResumableUpload(options?: ResumableUploadOptions): Promise<[string]> { - return this.file.createResumableUpload(options); - } - - /** - * Create a readable stream to read the contents of the remote file. - * It can be piped to a writable stream or listened to for 'data' events to read a file's contents. - */ - createReadStream(options?: ReadStreamOptions): fs.ReadStream { - return this.file.createReadStream(options); - } - - /** Create a writable stream to overwrite the contents of the file in your bucket. */ - createWriteStream(options?: WriteStreamOptions): fs.WriteStream { - return this.file.createWriteStream(options); - } - - /** Delete the file. */ - delete(): Promise<[ApiResponse]> { - return this.file.delete(); - } - - /** Convenience method to download a file into memory or to a local destination. */ - download(options?: DownloadOptions): Promise<[Buffer]> { - return this.file.download(options); - } - - /** Check if the file exists. */ - exists(): Promise<[boolean]> { - return this.file.exists(); - } - - /** Get a file object and its metadata if it exists. */ - get(): Promise<[File, ApiResponse]> { - return this.file.get(); - } - - /** Get the file's metadata. */ - getMetadata(): Promise<[FileMetadata, ApiResponse]> { - return this.file.getMetadata(); - } - - /** Get a signed policy document to allow a user to upload data with a POST request */ - getSignedPolicy(options?: SignedPolicyOptions): Promise<[SignedPolicy]> { - return this.file.getSignedPolicy(options); - } - - /** Get a signed URL to allow limited time access to the file */ - getSignedUrl(config: SignedUrlConfig): Promise<[string]> { - return this.file.getSignedUrl(config); - } - - /** Make a file private to the project and remove all other permissions. */ - makePrivate(options?: FilePrivateOptions): Promise<[ApiResponse]> { - return this.file.makePrivate(options); - } - - /** Set a file to be publicly readable and maintain all previous permissions. */ - makePublic(): Promise<[ApiResponse]> { - return this.file.makePublic(); - } - - /** - * Move this file to another location. - * By default, this will move the file to the same bucket, but you can choose to move it to - * another Bucket by providing a Bucket or File object or a URL beginning with "gs:// ". - */ - move(destination: string | Bucket | File): Promise<[File, ApiResponse]> { - return this.file.move(destination); - } - - /** Write arbitrary data to a file. */ - save(data: string, options?: WriteStreamOptions): Promise { - return this.file.save(data); - } - - /** The Storage API allows you to use a custom key for server-side encryption. */ - setEncryptionKey(encryptionKey: string | Buffer): File { - return this.file.setEncryptionKey(encryptionKey); - } - - /** - * Merge the given metadata with the current remote file's metadata. - * This will set metadata if it was previously unset or update previously set metadata. - * To unset previously set metadata, set its value to null. - */ - setMetadata(metadata: FileMetadata): Promise<[ApiResponse]> { - return this.file.setMetadata(metadata); - } -} - -const testStorage = new TestStorage().bucket("examplebucketname"); - -testStorage.iam.getPolicy(); - -testStorage.iam.setPolicy({ - bindings: [ - { - role: "roles/storage.admin", - members: ['serviceAccount:myotherproject@appspot.gserviceaccount.com'] - } - ] - }); - -testStorage.iam.testPermissions('storage.buckets.delete'); - -testStorage.iam.testPermissions(['storage.buckets.delete', 'storage.buckets.get']); - -// Example from https://cloud.google.com/storage/docs/creating-buckets#storage-create-bucket-code_samples -{ - // Creates a client - const storage = new Storage(); - - const bucketName = 'Name of a bucket, e.g. my-bucket'; - - // Creates a new bucket - storage - .createBucket(bucketName, { - location: 'ASIA', - storageClass: 'COLDLINE', - }) - .then(() => { - console.log(`Bucket ${bucketName} created.`); - }) - .catch(err => { - console.error('ERROR:', err); - }); -} - -// Example from https://cloud.google.com/storage/docs/listing-buckets#storage-list-buckets-nodejs -{ - // Creates a client - const storage = new Storage(); - - // Lists all buckets in the current project - storage - .getBuckets() - .then(results => { - const buckets = results[0]; - - console.log('Buckets:'); - buckets.forEach(bucket => { - console.log(bucket.name); - }); - }) - .catch(err => { - console.error('ERROR:', err); - }); -} - -// Example from https://cloud.google.com/storage/docs/moving-buckets#storage-create-bucket-nodejs -{ - // Creates a client - const storage = new Storage(); - - const bucketName = 'Name of a bucket, e.g. my-bucket'; - - // Creates a new bucket - storage - .createBucket(bucketName, { - location: 'ASIA', - storageClass: 'COLDLINE', - }) - .then(() => { - console.log(`Bucket ${bucketName} created.`); - }) - .catch(err => { - console.error('ERROR:', err); - }); -} - -// Example from https://cloud.google.com/storage/docs/deleting-buckets -{ - // Creates a client - const storage = new Storage(); - - const bucketName = 'Name of a bucket, e.g. my-bucket'; - - // Deletes the bucket - storage - .bucket(bucketName) - .delete() - .then(() => { - console.log(`Bucket ${bucketName} deleted.`); - }) - .catch(err => { - console.error('ERROR:', err); - }); -} - -// Example from https://cloud.google.com/storage/docs/uploading-objects -{ - // Creates a client - const storage = new Storage(); - - const bucketName = 'Name of a bucket, e.g. my-bucket'; - const filename = 'Local file to upload, e.g. ./local/path/to/file.txt'; - - // Uploads a local file to the bucket - storage - .bucket(bucketName) - .upload(filename, { - // Support for HTTP requests made with `Accept-Encoding: gzip` - gzip: true, - metadata: { - // Enable long-lived HTTP caching headers - // Use only if the contents of the file will never change - // (If the contents will change, use cacheControl: 'no-cache') - cacheControl: 'public, max-age=31536000', - }, - }) - .then(() => { - console.log(`${filename} uploaded to ${bucketName}.`); - }) - .catch(err => { - console.error('ERROR:', err); - }); -} - -// Example from https://cloud.google.com/storage/docs/listing-objects -{ - // Creates a client - const storage = new Storage(); - - const bucketName = 'Name of a bucket, e.g. my-bucket'; - - // Lists files in the bucket - storage - .bucket(bucketName) - .getFiles() - .then(results => { - const files = results[0]; - - console.log('Files:'); - files.forEach(file => { - console.log(file.name); - }); - }) - .catch(err => { - console.error('ERROR:', err); - }); -} - -// Example from https://cloud.google.com/storage/docs/listing-objects -{ - // Creates a client - const storage = new Storage(); - - const bucketName = 'Name of a bucket, e.g. my-bucket'; - const prefix = 'Prefix by which to filter, e.g. public/'; - const delimiter = 'Delimiter to use, e.g. /'; - - /** - * This can be used to list all blobs in a "folder", e.g. "public/". - * - * The delimiter argument can be used to restrict the results to only the - * "files" in the given "folder". Without the delimiter, the entire tree under - * the prefix is returned. For example, given these blobs: - * - * /a/1.txt - * /a/b/2.txt - * - * If you just specify prefix = '/a', you'll get back: - * - * /a/1.txt - * /a/b/2.txt - * - * However, if you specify prefix='/a' and delimiter='/', you'll get back: - * - * /a/1.txt - */ - const options = { - prefix, - delimiter - }; - - // Lists files in the bucket, filtered by a prefix - storage - .bucket(bucketName) - .getFiles(options) - .then(results => { - const files = results[0]; - - console.log('Files:'); - files.forEach(file => { - console.log(file.name); - }); - }) - .catch(err => { - console.error('ERROR:', err); - }); -} - -// Example from https://cloud.google.com/storage/docs/downloading-objects#storage-download-object-nodejs -{ - // Creates a client - const storage = new Storage(); - - const bucketName = 'Name of a bucket, e.g. my-bucket'; - const srcFilename = 'Remote file to download, e.g. file.txt'; - const destFilename = 'Local destination for file, e.g. ./local/path/to/file.txt'; - - const options = { - // The path to which the file should be downloaded, e.g. "./file.txt" - destination: destFilename, - }; - - // Downloads the file - storage - .bucket(bucketName) - .file(srcFilename) - .download(options) - .then(() => { - console.log( - `gs://${bucketName}/${srcFilename} downloaded to ${destFilename}.` - ); - }) - .catch(err => { - console.error('ERROR:', err); - }); -} - -// Example from https://cloud.google.com/storage/docs/renaming-copying-moving-objects -{ - // Creates a client - const storage = new Storage(); - - const bucketName = 'Name of a bucket, e.g. my-bucket'; - const srcFilename = 'File to move, e.g. file.txt'; - const destFilename = 'Destination for file, e.g. moved.txt'; - - // Moves the file within the bucket - storage - .bucket(bucketName) - .file(srcFilename) - .move(destFilename) - .then(() => { - console.log( - `gs://${bucketName}/${srcFilename} moved to gs://${bucketName}/${destFilename}.` - ); - }) - .catch(err => { - console.error('ERROR:', err); - }); -} - -// Example from https://cloud.google.com/storage/docs/renaming-copying-moving-objects -{ - // Creates a client - const storage = new Storage(); - - const srcBucketName = 'Name of the source bucket, e.g. my-bucket'; - const srcFilename = 'Name of the source file, e.g. file.txt'; - const destBucketName = 'Name of the destination bucket, e.g. my-other-bucket'; - const destFilename = 'Destination name of file, e.g. file.txt'; - - // Copies the file to the other bucket - storage - .bucket(srcBucketName) - .file(srcFilename) - .copy(storage.bucket(destBucketName).file(destFilename)) - .then(() => { - console.log( - `gs://${srcBucketName}/${srcFilename} copied to gs://${destBucketName}/${destFilename}.` - ); - }) - .catch(err => { - console.error('ERROR:', err); - }); -} - -// Example from https://cloud.google.com/storage/docs/viewing-editing-metadata -{ - // Creates a client - const storage = new Storage(); - - const bucketName = 'Name of a bucket, e.g. my-bucket'; - const filename = 'File to access, e.g. file.txt'; - - // Gets the metadata for the file - storage - .bucket(bucketName) - .file(filename) - .getMetadata() - .then(results => { - const metadata = results[0]; - - console.log(`File: ${metadata.name}`); - console.log(`Bucket: ${metadata.bucket}`); - console.log(`Storage class: ${metadata.storageClass}`); - console.log(`Self link: ${metadata.selfLink}`); - console.log(`ID: ${metadata.id}`); - console.log(`Size: ${metadata.size}`); - console.log(`Updated: ${metadata.updated}`); - console.log(`Generation: ${metadata.generation}`); - console.log(`Metageneration: ${metadata.metageneration}`); - console.log(`Etag: ${metadata.etag}`); - console.log(`Owner: ${metadata.owner}`); - console.log(`Component count: ${metadata.component_count}`); - console.log(`Crc32c: ${metadata.crc32c}`); - console.log(`md5Hash: ${metadata.md5Hash}`); - console.log(`Cache-control: ${metadata.cacheControl}`); - console.log(`Content-type: ${metadata.contentType}`); - console.log(`Content-disposition: ${metadata.contentDisposition}`); - console.log(`Content-encoding: ${metadata.contentEncoding}`); - console.log(`Content-language: ${metadata.contentLanguage}`); - console.log(`Metadata: ${metadata.metadata}`); - console.log(`Media link: ${metadata.mediaLink}`); - }) - .catch(err => { - console.error('ERROR:', err); - }); -} - -// Example from https://cloud.google.com/storage/docs/deleting-objects -{ - // Creates a client - const storage = new Storage(); - - const bucketName = 'Name of a bucket, e.g. my-bucket'; - const filename = 'File to delete, e.g. file.txt'; - - // Deletes the file from the bucket - storage - .bucket(bucketName) - .file(filename) - .delete() - .then(() => { - console.log(`gs://${bucketName}/${filename} deleted.`); - }) - .catch(err => { - console.error('ERROR:', err); - }); -} diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts deleted file mode 100644 index 2053abcc62..0000000000 --- a/types/google-cloud__storage/index.d.ts +++ /dev/null @@ -1,469 +0,0 @@ -// Type definitions for @google-cloud/storage 1.7 -// Project: https://github.com/googleapis/nodejs-storage -// Definitions by: Brian Love -// Nathan Brooker Perry -// Matt Welke -// Futa Ogawa -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -import { ReadStream, WriteStream } from "fs"; -import { CoreOptions } from "request"; - -type PromiseLibrary = () => PromiseLike; - -declare namespace Storage { - /** - * A bucket in the cloud. - */ - class Bucket { - constructor(storage: Storage, name: string); - acl: Acl; - combine(sources: string[] | File[], destination: string | File): Promise<[File, ApiResponse]>; - create(config?: BucketConfig): Promise<[Bucket, ApiResponse]>; - createChannel(id: string, config: ChannelConfig): Promise<[Channel, ApiResponse]>; - delete(): Promise<[ApiResponse]>; - deleteFiles(query?: BucketQuery): Promise; - exists(): Promise<[boolean]>; - file(name: string, options?: BucketFileOptions): File; - get(options?: BucketGetOptions): Promise<[Bucket, ApiResponse]>; - getFiles(query?: BucketQuery): Promise<[File[]]>; - getFilesStream(query?: BucketQuery): ReadStream; - getMetadata(): Promise<[BucketMetadata, ApiResponse]>; - id: string; - iam: Iam; - makePrivate(options?: BucketPrivacyOptions): Promise<[File[]]>; - makePublic(options?: BucketPrivacyOptions): Promise<[File[]]>; - metadata: BucketMetadata; - name: string; - setMetadata(metadata?: BucketMetadata): Promise<[ApiResponse]>; - upload(localPath: string, options?: UploadOptions): Promise<[File]>; - } - - /** - * Bucket configuration. - */ - interface BucketConfig { - coldline?: boolean; - dra?: boolean; - location?: string; - multiRegional?: boolean; - nearline?: boolean; - regional?: boolean; - versioning?: { - enabled?: boolean - }; - // Note: This is not documented, but it is used in examples (https://cloud.google.com/nodejs/docs/reference/storage/1.7.x/Storage) - storageClass?: 'COLDLINE' | 'DURABLE_REDUCED_AVAILABILITY' | 'MULTI_REGIONAL' | 'NEARLINE' | 'REGIONAL'; - } - - /** - * Options for getting a file. - */ - interface BucketFileOptions { - generation?: string | number; - } - - /** - * Options for getting a bucket. - */ - interface BucketGetOptions { - autoCreate?: boolean; - } - - /** - * Bucket metadata. - */ - interface BucketMetadata { - etag?: string; - id?: string; - kind?: string; - location?: string; - metageneration?: string; - name?: string; - projectNumber?: string; - selfLink?: string; - storageClass?: string; - timeCreated?: string; - updated?: string; - } - - /** - * The options for making the bucket private. - */ - interface BucketPrivacyOptions { - includeFiles?: boolean; - force?: boolean; - } - - /** - * Query a bucket. - */ - interface BucketQuery { - autoPaginate?: boolean; - delimiter?: string; - directory?: string; - prefix?: string; - maxApiCalls?: number; - maxResults?: number; - pageToken?: string; - userProject?: string; - versions?: boolean; - } - - /** - * Options for specifying the content length range. - */ - interface ContentLengthRange { - max?: number; - min?: number; - } - - /** - * A file in the cloud. - */ - class File { - constructor(bucket: Bucket, name: string, options?: BucketFileOptions); - acl: Acl; - copy(destination: string | Bucket | File): Promise<[File, ApiResponse]>; - createReadStream(options?: ReadStreamOptions): ReadStream; - createResumableUpload(options?: ResumableUploadOptions): Promise<[string]>; - createWriteStream(options?: WriteStreamOptions): WriteStream; - delete(): Promise<[ApiResponse]>; - download(options?: DownloadOptions): Promise<[Buffer]>; - exists(): Promise<[boolean]>; - get(): Promise<[File, ApiResponse]>; - getMetadata(): Promise<[FileMetadata, ApiResponse]>; - getSignedPolicy(options?: SignedPolicyOptions): Promise<[SignedPolicy]>; - getSignedUrl(config: SignedUrlConfig): Promise<[string]>; - makePrivate(options?: FilePrivateOptions): Promise<[ApiResponse]>; - makePublic(): Promise<[ApiResponse]>; - move(destination: string | Bucket | File): Promise<[File, ApiResponse]>; - name: string; - save(data: string | Buffer, options?: WriteStreamOptions): Promise; - setEncryptionKey(encryptionKey: string | Buffer): File; - setMetadata(metadata: FileMetadata): Promise<[ApiResponse]>; - metadata?: FileMetadata; - } - - /** - * Access controls on the object, containing one or more objectAccessControls Resources. - */ - interface AclFileMetadata { - bucket?: string; - domain?: string; - email?: string; - entity?: string; - entityId?: string; - etag?: string; - generation?: number; - id?: string; - kind?: string; - object?: string; - projectTeam?: ProjectTeam; - role?: string; - selfLink?: string; - } - - /** - * The project team associated with the entity, if any. - */ - interface ProjectTeam { - projectNumber?: string; - team?: string; - } - - /** - * Metadata of customer-supplied encryption key, if the object is encrypted by such a key. - */ - interface CustomerEncryption { - encryptionAlgorithm?: string; - keySha256?: string; - } - - /** - * User-defined metadata. - */ - interface CustomFileMetadata { - [key: string]: string; - } - - /** - * The owner of the object. This will always be the uploader of the object. - */ - interface Owner { - entity?: string; - entityId?: string; - } - - /** - * File metadata. - */ - interface FileMetadata { - acl?: AclFileMetadata[]; - bucket?: string; - cacheControl?: string; - componentCount?: number; - // Note: this property is accessed in one of the examples - component_count?: number; - contentDisposition?: string; - contentEncoding?: string; - contentLanguage?: string; - contentType?: string; - crc32c?: string; - customerEncryption?: CustomerEncryption; - etag?: string; - generation?: number; - id?: string; - kind?: string; - kmsKeyName?: string; - md5Hash?: string; - mediaLink?: string; - metadata?: CustomFileMetadata; - metageneration?: number; - name?: string; - owner?: Owner; - selfLink?: string; - size?: null | number; - storageClass?: string; - timeCreated?: string; - timeDeleted?: string; - timeStorageClassUpdated?: string; - updated?: string; - } - - /** - * Options when setting the file as private. - */ - interface FilePrivateOptions { - strict?: boolean; - } - - /** - * A signed policy allowing a user to upload a file with a POST. - */ - interface SignedPolicy { - base64?: string; - signature?: string; - string?: string; - } - - /** - * Options when obtaining the signed policy. - */ - interface SignedPolicyOptions { - acl?: string; - contentLengthRange?: ContentLengthRange; - equals?: string[] | [string[]]; - expires?: number | string; - max?: number; - min?: number; - startsWith?: string[] | [string[]]; - successRedirect?: string; - successStatus?: string; - } - - /** - * Options when obtaining a temporary signed URL for a file. - */ - interface SignedUrlConfig { - action: string; - cname?: string; - contentMd5?: string; - contentType?: string; - expires: any; - extensionHeaders?: { [key: string]: string }; - promptSaveAs?: string; - responseDisposition?: string; - responseType?: string; - } - - /** - * Options when obtaining a resumable upload URI. - */ - interface ResumableUploadOptions { - metadata?: FileMetadata; - origin?: string; - predefinedAcl?: string; - private?: boolean; - public?: boolean; - } - - /** - * Access control list for storage buckets and files. - */ - interface Acl extends AclActions { - default: AclEntity; - owners: AclEntity; - readers: AclEntity; - writers: AclEntity; - } - - /** - * Actions that can be performed on all ACL entities, including the root Acl. - */ - interface AclActions { - add(options: AclOptions): Promise<[Acl, ApiResponse]>; - delete(options: AclOptions): Promise<[Acl, ApiResponse]>; - get(options: AclOptions): Promise<[Acl, ApiResponse]>; - update(options: AclOptions): Promise<[Acl, ApiResponse]>; - } - - /** - * An object of convenience methods to add or delete reader ACL permissions for a given entity. - */ - interface AclEntity extends AclActions { - addAllAuthenticatedUsers(): Promise<[Acl, ApiResponse]>; - addAllUsers(): Promise<[Acl, ApiResponse]>; - addDomain(entity: string): Promise<[Acl, ApiResponse]>; - addGroup(entity: string): Promise<[Acl, ApiResponse]>; - addProject(entity: string): Promise<[Acl, ApiResponse]>; - addUser(entity: string): Promise<[Acl, ApiResponse]>; - deleteAllAuthenticatedUsers(): Promise<[Acl, ApiResponse]>; - deleteAllUsers(): Promise<[Acl, ApiResponse]>; - deleteDomain(entity: string): Promise<[Acl, ApiResponse]>; - deleteGroup(entity: string): Promise<[Acl, ApiResponse]>; - deleteProject(entity: string): Promise<[Acl, ApiResponse]>; - deleteUser(entity: string): Promise<[Acl, ApiResponse]>; - } - - /** - * ACL options. - */ - interface AclOptions { - entity?: string; - role?: string; - generation?: number; - } - - /** - * The response object. - */ - interface ApiResponse { - etag?: string; - id?: string; - kind?: string; - location?: string; - metageneration?: string; - name?: string; - projectNumber?: string; - selfLink?: string; - storageClass?: string; - timeCreated?: string; - updated?: string; - } - - interface Credentials { - client_email?: string; - private_key?: string; - } - - interface ConfigurationObject { - autoRetry?: boolean; - credentials?: Credentials; - email?: string; - keyFilename?: string; - maxRetries?: number; - projectId?: string; - promise?: PromiseLibrary; - } - - /** - * The options when downloading a file. - */ - interface DownloadOptions extends ReadStreamOptions { - destination?: string; - } - - /** - * Options when reading a file stream. - */ - interface ReadStreamOptions { - end?: number; - start?: number; - validation?: string | boolean; - } - - /** - * Options when uploading file to bucket. - */ - interface UploadOptions extends WriteStreamOptions { - destination?: string | File; - encryptionKey?: string; - kmsKeyName?: string; - requestOptions?: CoreOptions; - } - - /** - * Options when writing to a file stream. - */ - interface WriteStreamOptions { - contentType?: string; - gzip?: string | boolean; - metadata?: FileMetadata; - offset?: string; - predefinedAcl?: string; - private?: boolean; - public?: boolean; - resumable?: boolean; - uri?: string; - userProject?: string; - validation?: string | boolean; - } - - /** - * This class allows you interact with Google Cloud Storage. - */ - class Channel { - constructor(storage: Storage, id: string, resourceId: string); - stop(): Promise<[ApiResponse]>; - } - - /** - * Channel configuration. - */ - interface ChannelConfig { - address: string; - } - - /** - * This class allows you to get Identity Access Management information. - */ - class Iam { - getPolicy(): Promise; - setPolicy(policy: IamPolicy): Promise<[IamPolicy, ApiResponse]>; - testPermissions(permission: string | string[]): Promise<[{[key: string]: boolean}, ApiResponse]>; - } - - /** - * IAM policy - */ - interface IamPolicy { - bindings: IamBinding[]; - } - - interface IamBinding { - role: string; - members: string[]; - } -} - -/** - * The Storage class allows you interact with Google Cloud Storage. - */ -declare class Storage { - constructor(config?: Storage.ConfigurationObject); - acl: Storage.Acl; - bucket(name: string | Storage.Bucket): Storage.Bucket; - channel(id: string, resourceId: string): Storage.Channel; - createBucket(name: string, metadata?: Storage.BucketConfig): Promise<[Storage.Bucket, Storage.ApiResponse]>; - getBuckets(query?: Storage.BucketQuery): Promise<[Storage.Bucket[]]>; - getBucketsStream(query?: Storage.BucketQuery): Promise<[ReadStream]>; - Channel: (storage: Storage, id: string, resourceId: string) => Storage.Channel; - File: (bucket: Storage.Bucket, name: string, opts: Storage.BucketFileOptions) => Storage.File; - Bucket: (storage: Storage, name: string) => Storage.Bucket; -} - -export = Storage; diff --git a/types/google-cloud__storage/tsconfig.json b/types/google-cloud__storage/tsconfig.json deleted file mode 100644 index fe05cce995..0000000000 --- a/types/google-cloud__storage/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "paths": { - "@google-cloud/storage": [ - "google-cloud__storage" - ] - }, - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "google-cloud__storage-tests.ts" - ] -} \ No newline at end of file diff --git a/types/google-cloud__storage/tslint.json b/types/google-cloud__storage/tslint.json deleted file mode 100644 index b3dfb39122..0000000000 --- a/types/google-cloud__storage/tslint.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - // TODOs - "no-duplicate-imports": false, - "prefer-object-spread": false - } -} From d00ce6dfdf92472f320222dab32d8a8eb149b402 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 6 Dec 2018 11:39:44 -0800 Subject: [PATCH 140/241] Add semi-colons --- types/shelljs/make.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/shelljs/make.d.ts b/types/shelljs/make.d.ts index 0db5320b72..ca4c2b6135 100644 --- a/types/shelljs/make.d.ts +++ b/types/shelljs/make.d.ts @@ -1,9 +1,9 @@ import * as shelljs from './'; declare global { interface Target { - (...args: any[]): void, - result?: any, - done?: boolean + (...args: any[]): void; + result?: any; + done?: boolean; } const target: { all?: Target; From 225b004f4a13bfde2ce2e847aeda60262a8d9f65 Mon Sep 17 00:00:00 2001 From: Esteban Ibarra Date: Thu, 6 Dec 2018 15:01:57 -0500 Subject: [PATCH 141/241] Revert "Revert changes of react-native-draggable-flatlist" This reverts commit ca53c065a52c288b7d8d3fb3bde5709c6d496f7c. --- .../index.d.ts | 59 +++++++++++++++++++ .../react-native-draggable-flatlist-tests.tsx | 44 ++++++++++++++ .../tsconfig.json | 24 ++++++++ .../tslint.json | 1 + 4 files changed, 128 insertions(+) create mode 100644 types/react-native-draggable-flatlist/index.d.ts create mode 100644 types/react-native-draggable-flatlist/react-native-draggable-flatlist-tests.tsx create mode 100644 types/react-native-draggable-flatlist/tsconfig.json create mode 100644 types/react-native-draggable-flatlist/tslint.json diff --git a/types/react-native-draggable-flatlist/index.d.ts b/types/react-native-draggable-flatlist/index.d.ts new file mode 100644 index 0000000000..0b96f0b3cd --- /dev/null +++ b/types/react-native-draggable-flatlist/index.d.ts @@ -0,0 +1,59 @@ +// Type definitions for react-native-draggable-flatlist 1.1 +// Project: https://github.com/computerjazz/react-native-draggable-flatlist#readme +// Definitions by: Stack Builders +// Esteban Ibarra +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import { VirtualizedListWithoutRenderItemProps } from "react-native"; +import { Component } from "react"; + +export interface RenderItemInfo { + item: ItemR; + index: number; + move: () => void; + moveEnd: () => void; + isActive: boolean; +} + +export interface OnMoveEndInfo { + data: ReadonlyArray | null; + to: number; + from: number; + row: ItemM; +} + +interface DraggableFlatListProps extends VirtualizedListWithoutRenderItemProps { + /** + * Items to be rendered. + */ + data: ReadonlyArray | null; + + /** + * Function that returns updated ordering of data + */ + onMoveEnd?: (info: OnMoveEndInfo) => void; + + /** + * Function that is called when row becomes active. + */ + onMoveBegin?: (index: number) => void; + + /** + * Sets where scrolling begins. + * + * Default is 5 + */ + scrollPercent?: number; + + /** + * Function that calls move when the row should become active (in an onPress, onLongPress, etc). Calls moveEnd when the gesture is complete (in onPressOut). + */ + renderItem: (info: RenderItemInfo) => React.ReactElement | null; +} + +declare class DraggableFlatList extends Component> { + constructor(props: DraggableFlatListProps); +} + +export default DraggableFlatList; diff --git a/types/react-native-draggable-flatlist/react-native-draggable-flatlist-tests.tsx b/types/react-native-draggable-flatlist/react-native-draggable-flatlist-tests.tsx new file mode 100644 index 0000000000..40d613e4ea --- /dev/null +++ b/types/react-native-draggable-flatlist/react-native-draggable-flatlist-tests.tsx @@ -0,0 +1,44 @@ +import * as React from 'react'; +import { TouchableOpacity, Text } from 'react-native'; +import DraggableFlatList, { RenderItemInfo } from 'react-native-draggable-flatlist'; + +interface Item { + name: string; + mail: string; +} + +class Example extends React.Component { + state = { + data: [ + { name: 'Esteban', mail: 'foo@foo.com' }, + { name: 'Xavier', mail: 'foo2@foo.com' }, + ] + }; + + renderItem({ item, index, move, moveEnd, isActive }: RenderItemInfo) { + return ( + + {index} + {item.name} + {item.mail} + + ); + } + + render() { + const { data } = this.state; + return ( + `draggable-item-${index}`} + scrollPercent={10} + onMoveEnd={({ data }) => this.setState({ data })} + ListFooterComponent={{'Hello'}} + /> + ); + } +} diff --git a/types/react-native-draggable-flatlist/tsconfig.json b/types/react-native-draggable-flatlist/tsconfig.json new file mode 100644 index 0000000000..b3c009feac --- /dev/null +++ b/types/react-native-draggable-flatlist/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react-native" + }, + "files": [ + "index.d.ts", + "react-native-draggable-flatlist-tests.tsx" + ] +} diff --git a/types/react-native-draggable-flatlist/tslint.json b/types/react-native-draggable-flatlist/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-draggable-flatlist/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 57229d3354ac1b10b5b4e1d0799729e82691cfbe Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Thu, 6 Dec 2018 16:15:32 -0500 Subject: [PATCH 142/241] Add fill-extrusion-vertical-gradient --- types/mapbox-gl/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index f3389876b9..384cea55b6 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -1319,6 +1319,7 @@ declare namespace mapboxgl { 'fill-extrusion-height-transition'?: Transition; 'fill-extrusion-base'?: number | StyleFunction | Expression; 'fill-extrusion-base-transition'?: Transition; + 'fill-extrusion-vertical-gradient'?: boolean; } export interface LineLayout { From 83f02a128bbc3fb2752af6861233fdfc93fb10fb Mon Sep 17 00:00:00 2001 From: Gordon Date: Thu, 6 Dec 2018 16:07:45 -0600 Subject: [PATCH 143/241] Improve react-instantsearch Refinements --- types/react-instantsearch-core/index.d.ts | 22 +++++--- .../react-instantsearch-core-tests.tsx | 53 ++++++++++++++++++- .../react-instantsearch-tests.tsx | 2 +- 3 files changed, 67 insertions(+), 10 deletions(-) diff --git a/types/react-instantsearch-core/index.d.ts b/types/react-instantsearch-core/index.d.ts index af86139fde..bceb91ca85 100644 --- a/types/react-instantsearch-core/index.d.ts +++ b/types/react-instantsearch-core/index.d.ts @@ -129,17 +129,20 @@ export function connectAutoComplete(Composed: React.ComponentType): React.C export function connectBreadcrumb(Composed: React.ComponentType): React.ComponentClass; export function connectConfigure(Composed: React.ComponentType): React.ComponentClass; -export interface Refinement { +export type Refinement = { label: string; attribute: string; - currentRefinement: string | object; - items?: Array<{ label: string, value: RefinementValue }>; index: string; id: string; value: RefinementValue; -} +} & ({ + currentRefinement: string; +} | { + items: Array<{ label: string, value: RefinementValue }>; + currentRefinement: string[]; +}); -type RefinementValue = (searchState: SearchState) => SearchState; +export type RefinementValue = (searchState: SearchState) => SearchState; export interface CurrentRefinementsExposed { /** @@ -305,13 +308,16 @@ export function connectRange(Composed: React.ComponentType): React.Componen export interface RefinementListProvided { /** a function to toggle a refinement */ - refine: (...args: any[]) => any; + refine: (value: string[]) => any; /** a function to generate a URL for the corresponding search state */ createURL: (...args: any[]) => any; /** the refinement currently applied */ currentRefinement: string[]; - /** the list of items the RefinementList can display. */ - items: Array>; + /** + * The list of items the RefinementList can display. + * If isFromSearch is false, the hit properties like _highlightResult are undefined + */ + items: Array>; /** a function to toggle a search inside items values */ searchForItems: (...args: any[]) => any; /** a boolean that says if the items props contains facet values from the global search or from the search inside items. */ diff --git a/types/react-instantsearch-core/react-instantsearch-core-tests.tsx b/types/react-instantsearch-core/react-instantsearch-core-tests.tsx index 1ced5dee69..e39a9f53e6 100644 --- a/types/react-instantsearch-core/react-instantsearch-core-tests.tsx +++ b/types/react-instantsearch-core/react-instantsearch-core-tests.tsx @@ -9,7 +9,9 @@ import { connectSearchBox, connectRefinementList, CurrentRefinementsProvided, - connectCurrentRefinements + connectCurrentRefinements, + RefinementListProvided, + Refinement } from 'react-instantsearch-core'; () => { @@ -168,3 +170,52 @@ import { item} />; }; + +() => { + function renderRefinement( + label: string, + value: Refinement['value'], + refine: CurrentRefinementsProvided['refine'], + ) { + return ; + } + + const MyCurrentRefinements = connectCurrentRefinements(({refine, items, query}: CurrentRefinementsProvided) => { + return <> + {items.map((refinement) => { + let str: string = refinement.currentRefinement; // $ExpectError + /* + * When existing several refinements for the same atribute name, then you get a + * nested items object that contains a label and a value function to use to remove a single filter. + * https://community.algolia.com/react-instantsearch/connectors/connectCurrentRefinements.html + */ + if ('items' in refinement) { + str = refinement.currentRefinement; // $ExpectError + return <> + {refinement.items.map((i) => renderRefinement(i.label, i.value, refine))} + ; + } + + console.log(refinement.items); // $ExpectError + return renderRefinement(refinement.currentRefinement, refinement.value, refine); + })} + ; + }); +}; + +() => { + const MyRefinementList = ({items, refine}: RefinementListProvided) => + <> + {items.map((item) => ( + + ))} + ; + const ConnectedRefinementList = connectRefinementList(MyRefinementList); + + ; +}; diff --git a/types/react-instantsearch/react-instantsearch-tests.tsx b/types/react-instantsearch/react-instantsearch-tests.tsx index 82672b7a60..9abf91c0ef 100644 --- a/types/react-instantsearch/react-instantsearch-tests.tsx +++ b/types/react-instantsearch/react-instantsearch-tests.tsx @@ -348,7 +348,7 @@ import { createInstantSearch } from "react-instantsearch-core"; : item.label; return ( -
  • +
  • props.refine(item.value)}> {label} {item.isRefined ? '- selected' : ''} From 8cfbfbf4be20e8dfe1288d1cf5d7879815882e4e Mon Sep 17 00:00:00 2001 From: Alex Deas Date: Thu, 6 Dec 2018 22:10:03 +0000 Subject: [PATCH 144/241] Support infinitary functions in cond type type def --- types/ramda/index.d.ts | 3 ++- types/ramda/ramda-tests.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 77dcdb05a0..48888c6ee5 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -776,7 +776,8 @@ declare namespace R { * point fn returns the result of applying its arguments to the corresponding transformer. If none of the predicates * matches, fn returns undefined. */ - cond(fns: ReadonlyArray<[SafePred, (a: A) => B]>): (a: A) => B; + cond(fns: ReadonlyArray<[Pred, (...a: any[]) => any]>): (...a: any[]) => any; + cond(fns: ReadonlyArray<[SafePred, (...a: A[]) => B]>): (...a: A[]) => B; /** * Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 61f09c1f40..2bd9a55d2f 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1312,13 +1312,15 @@ type Pair = KeyValuePair; ]); f(0); // $ExpectType string f(""); // $ExpectError + f(1, 2); // $ExpectType string const g = R.cond([ - [x => x === 0, () => "a"], + [(a, b) => a === b, () => "a"], [() => true, () => "b"], ]); g(0); g(""); + g(1, ""); }; () => { From 7a8e5bafe41890916d50d37ea3c34c6890449569 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Thu, 6 Dec 2018 23:22:53 +0100 Subject: [PATCH 145/241] Add types for command-exists --- types/command-exists/command-exists-tests.ts | 14 ++++++++++++ types/command-exists/index.d.ts | 16 ++++++++++++++ types/command-exists/tsconfig.json | 23 ++++++++++++++++++++ types/command-exists/tslint.json | 1 + 4 files changed, 54 insertions(+) create mode 100644 types/command-exists/command-exists-tests.ts create mode 100644 types/command-exists/index.d.ts create mode 100644 types/command-exists/tsconfig.json create mode 100644 types/command-exists/tslint.json diff --git a/types/command-exists/command-exists-tests.ts b/types/command-exists/command-exists-tests.ts new file mode 100644 index 0000000000..60efc1e0e5 --- /dev/null +++ b/types/command-exists/command-exists-tests.ts @@ -0,0 +1,14 @@ +import commandExists = require('command-exists'); + +commandExists('ls', (err, commandExists) => { + // $ExpectType boolean + commandExists; +}); + +commandExists('ls').then(command => { + // $ExpectType string + command; +}); + +// $ExpectType boolean +commandExists.sync('ls'); diff --git a/types/command-exists/index.d.ts b/types/command-exists/index.d.ts new file mode 100644 index 0000000000..634d2a035e --- /dev/null +++ b/types/command-exists/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for command-exists 1.2 +// Project: https://github.com/mathisonian/command-exists +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = commandExists; + +declare function commandExists(commandName: string): Promise; +declare function commandExists( + commandName: string, + cb: (error: null, exists: boolean) => void +): void; + +declare namespace commandExists { + function sync(commandName: string): boolean; +} diff --git a/types/command-exists/tsconfig.json b/types/command-exists/tsconfig.json new file mode 100644 index 0000000000..9782cd2715 --- /dev/null +++ b/types/command-exists/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", + "command-exists-tests.ts" + ] +} diff --git a/types/command-exists/tslint.json b/types/command-exists/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/command-exists/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 3027a7b01e9fbf82b7c0fc7cdeaf05a6ff4da7d4 Mon Sep 17 00:00:00 2001 From: Roman Rogowski Date: Thu, 6 Dec 2018 17:48:12 -0500 Subject: [PATCH 146/241] added @types/cryptr --- types/cryptr/cryptr-tests.ts | 10 ++++++++++ types/cryptr/index.d.ts | 20 ++++++++++++++++++++ types/cryptr/tsconfig.json | 23 +++++++++++++++++++++++ types/cryptr/tslint.json | 1 + 4 files changed, 54 insertions(+) create mode 100644 types/cryptr/cryptr-tests.ts create mode 100644 types/cryptr/index.d.ts create mode 100644 types/cryptr/tsconfig.json create mode 100644 types/cryptr/tslint.json diff --git a/types/cryptr/cryptr-tests.ts b/types/cryptr/cryptr-tests.ts new file mode 100644 index 0000000000..3c655d7288 --- /dev/null +++ b/types/cryptr/cryptr-tests.ts @@ -0,0 +1,10 @@ +import Cryptr = require('cryptr'); + +// $ExpectType Cryptr +const cryptr = new Cryptr('myTotallySecretKey'); + +// $ExpectType string +const encrypted_string = cryptr.encrypt('bacon'); + +// $ExpectType string +cryptr.decrypt(encrypted_string); diff --git a/types/cryptr/index.d.ts b/types/cryptr/index.d.ts new file mode 100644 index 0000000000..4aec15c419 --- /dev/null +++ b/types/cryptr/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for cryptr 4.0 +// Project: https://github.com/MauriceButler/cryptr +// Definitions by: Roman Rogowski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class Cryptr { + /** + * Cryptr provides a mechanism for aes-256-ctr encryption/decryption. + * @param secret key used for encryption/decryption + */ + constructor(secret: string); + + /** Encrypt a string. */ + encrypt(value: string): string; + + /** Decrypt a string. */ + decrypt(value: string): string; +} + +export = Cryptr; diff --git a/types/cryptr/tsconfig.json b/types/cryptr/tsconfig.json new file mode 100644 index 0000000000..2727c48e08 --- /dev/null +++ b/types/cryptr/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", + "cryptr-tests.ts" + ] +} diff --git a/types/cryptr/tslint.json b/types/cryptr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cryptr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 894be3cb10fbcb232d788f57efd2bb0c6f994e8a Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Thu, 6 Dec 2018 15:26:02 -0800 Subject: [PATCH 147/241] Update types-publisher dependency --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 09fe064d48..caf101cbc6 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,6 @@ }, "devDependencies": { "dtslint": "github:Microsoft/dtslint#production", - "types-publisher": "Microsoft/types-publisher#production" + "types-publisher": "github:Microsoft/types-publisher#production" } } From a92893734238656a2defff936d017a33e39a9b11 Mon Sep 17 00:00:00 2001 From: Kylie Stewart Date: Thu, 6 Dec 2018 17:29:35 -0700 Subject: [PATCH 148/241] Update Spectacle types to reflect latest API, remove the 'any's --- types/spectacle/index.d.ts | 377 +++++++++++++++------- types/spectacle/package.json | 6 + types/spectacle/spectacle-tests.tsx | 484 +++++++++++++++++++++------- 3 files changed, 637 insertions(+), 230 deletions(-) create mode 100644 types/spectacle/package.json diff --git a/types/spectacle/index.d.ts b/types/spectacle/index.d.ts index e00b5dd3c0..285ed6cbe4 100644 --- a/types/spectacle/index.d.ts +++ b/types/spectacle/index.d.ts @@ -1,164 +1,321 @@ // Type definitions for Spectacle 1.2.0 -// Project: https://github.com/FormidableLabs/victory +// Project: https://github.com/FormidableLabs/spectacle // Definitions by: Zachary Maybury +// Kylie Stewart // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 /// declare module "spectacle" { - import * as React from "react"; + import * as React from "react"; + import * as CSS from "csstype"; + /** + * Alignment Types for Spectacle + */ + type alignType = + | "flex-start flex-start" + | "flex-start center" + | "flex-start flex-end" + | "center flex-start" + | "center center" + | "center flex-end" + | "flex-end flex-start" + | "flex-end center" + | "flex-end flex-end"; - /** - * Transition Types for Spectacle - */ - type transitionType = "slide"|"zoom"|"fade"|"spin"; + /** + * Animation Types for Spectacle + */ + type easeType = + | "back" + | "backIn" + | "backOut" + | "backInOut" + | "bounce" + | "bounceIn" + | "bounceOut" + | "bounceInOut" + | "circle" + | "circleIn" + | "circleOut" + | "circleInOut" + | "linear" + | "linearIn" + | "linearOut" + | "linearInOut" + | "cubic" + | "cubicIn" + | "cubicOut" + | "cubicInOut" + | "elastic" + | "elasticIn" + | "elasticOut" + | "elasticInOut" + | "exp" + | "expIn" + | "expOut" + | "expInOut" + | "poly" + | "polyIn" + | "polyOut" + | "polyInOut" + | "quad" + | "quadIn" + | "quadOut" + | "quadInOut" + | "sin" + | "sinIn" + | "sinOut" + | "sinInOut"; - /** - * Progress Types for Spectacle - */ - type progressType = "pacman"|"bar"|"number"|"none"; + /** + * Progress Types for Spectacle + */ + type progressType = "pacman" | "bar" | "number" | "none"; - /** - * Alignment Types for Spectacle - */ - type alignType = - "flex-start flex-start"|"flex-start center"|"flex-start flex-end"| - "center flex-start"|"center center"|"center flex-end"| - "flex-end flex-start"|"flex-end center"|"flex-end flex-end"; + /** + * S Types for StyledS in Spectacle + */ + type sType = "italic" | "bold" | "line-through" | "underline"; - /** - * Base props for many Spectacle components - */ - export interface BaseProps { - italic?:boolean, - bold?:boolean, - caps?:boolean, - margin?:number|string, - padding?:number|string, - textColor?:string, - textSize?:string, - textAlign?:string, - textFont?:string, - bgColor?:string, - bgImage?:string, - bgDarken?:number - } + /** + * Target Types for links + */ + type targetType = "_blank" | "_self" | "_parent" | "_top"; - export type Theme = { [key: string ]: string | number } + /** + * Theme Types for CodePane in Spectacle + */ + type themeType = "dark" | "light" | "external"; - export interface SpectacleProps { - theme?: Theme - } + /** + * Transition Types for Spectacle + */ + type transitionType = "slide" | "zoom" | "fade" | "spin"; - export interface DeckProps { - transition?:transitionType[], - transitionDuration?:number, - progress?:progressType, - controls?:boolean, - theme?: Theme - } + /** + * All available DOM style properties and their types + * https://www.npmjs.com/package/csstype + */ + export interface CSSProperties extends CSS.Properties {} - export interface SlideProps extends BaseProps { - align?:alignType, - transition?:transitionType[], - transitionDuration?:number, - notes?:string, - id?:string - } + export interface AnimProps { + easing: easeType; + fromStyle: CSSProperties | CSSProperties[]; + onAnim?: (forwards?: boolean, animIndex?: number) => void; + order?: number; + route?: object; + style?: CSSProperties; + toStyle: CSSProperties | CSSProperties[]; + transitionDuration: number; + } - export interface MarkdownProps { - source?:string, - mdastConfig?:{ [key: string ]: string | number } - } + export interface AppearProps { + easing?: easeType; + endValue?: object; + fid?: string; + order?: number; + startValue?: object; + style?: BaseProps["style"]; + transitionDuration?: number; + } - export interface CodePaneProps extends BaseProps { - lang?:string, - source?:string - } + /** + * Base props for many Spectacle components + */ + export interface BaseProps { + bgColor?: string; + bgDarken?: number; + bgImage?: string; + bold?: boolean; + caps?: boolean; + className?: string; + italic?: boolean; + margin?: number | string; + padding?: number | string; + style?: CSSProperties; + textAlign?: string; + textColor?: string; + textFont?: string; + textSize?: string; + } + export interface CodePaneProps { + className?: BaseProps["className"]; + contentEditable?: boolean; + lang?: string; + source?: string; + style?: BaseProps["style"]; + theme?: themeType; + } - export interface HeadingProps extends BaseProps { - fit?:boolean, - lineHeight?:number - size?:number; - } + export interface ComponentPlaygroundProps { + code?: string; + previewBackgroundColor?: string; + scope?: object; + theme?: themeType; + transformCode?: (code: string) => string; + } - export interface ImageProps extends BaseProps { - display?:string, - height?:number, - src?:string, - width?:number|string - } + export interface DeckProps { + autoplay?: boolean; + autoplayDuration?: number; + autoplayLoop?: boolean; + controls?: boolean; + globalStyles?: boolean; + history?: any; // Needs a type, see https://github.com/ReactTraining/history + progress?: progressType; + theme?: Theme; + transition?: transitionType[]; + transitionDuration?: number; + } - export interface LinkProps extends BaseProps { - href?:string - } + export interface FillProps { + className?: string; + style?: CSSProperties; + } - export interface SProps extends BaseProps { - type?:string - } + export interface FitProps extends FillProps {} - export interface TextProps extends BaseProps { - fit?:boolean, - lineHeight?:number - } + export interface GoToActionProps { + margin?: BaseProps["margin"]; + padding?: BaseProps["padding"]; + render?: (goToSlide?: (slide: number | string) => void) => void; + slide?: number | string; + style?: BaseProps["style"]; + } - export class Spectacle extends React.Component {} + export interface HeadingProps extends BaseProps { + fit?: boolean; + lineHeight?: number; + size?: number; + } - export class Deck extends React.Component {} + export interface ImageProps { + alt?: string; + className?: BaseProps["className"]; + display?: string; + height?: number | string; + margin?: BaseProps["margin"]; + padding?: BaseProps["padding"]; + src?: string; + width?: number | string; + } - export class Slide extends React.Component {} + export interface LayoutProps { + style?: CSSProperties; + } - export class Layout extends React.Component {} + export interface LinkProps extends BaseProps { + href?: string; + target?: targetType; + } - export class Fit extends React.Component {} + export interface MarkdownProps { + mdastConfig?: { [key: string]: number | string }; + source?: string; + } - export class Fill extends React.Component {} + export interface SlideProps extends BaseProps { + align?: alignType; + contentStyles?: CSSProperties; + controlColor?: string; + dispatch?: () => void; + hash?: number | string; + progressColor?: string; + history?: any; // Needs a type, see https://github.com/ReactTraining/history + id?: string; + lastSlideIndex?: number; + notes?: string; + onActive?: (slideIndex: string | number) => void; + slideIndex?: number; + transition?: transitionType[]; + transitionDuration?: number; + transitionIn?: transitionType[]; + transitionOut?: transitionType[]; + } - export class Markdown extends React.Component {} + export interface SProps extends BaseProps { + type?: sType | sType[]; + } - export class Appear extends React.Component {} + export interface TextProps extends BaseProps { + fit?: boolean; + lineHeight?: number; + } - export class BlockQuote extends React.Component {} + export type Theme = { [key: string]: number | string }; - export class Quote extends React.Component {} + export class Anim extends React.Component {} - export class Cite extends React.Component {} + export class Appear extends React.Component {} - export class CodePane extends React.Component {} + export class BlockQuote extends React.Component {} - export class Code extends React.Component {} + export class Cite extends React.Component {} - export class Heading extends React.Component {} + export class Code extends React.Component {} - export class Image extends React.Component {} + export class CodePane extends React.Component {} - export class Link extends React.Component {} + export class ComponentPlayground extends React.Component< + ComponentPlaygroundProps + > {} - export class List extends React.Component {} + export class Deck extends React.Component {} - export class ListItem extends React.Component {} + export class Fill extends React.Component {} - export class S extends React.Component {} + export class Fit extends React.Component {} - export class Table extends React.Component {} + export class GoToAction extends React.Component {} - export class TableRow extends React.Component {} + export class Heading extends React.Component {} - export class TableHeaderItem extends React.Component {} + export class Image extends React.Component {} - export class TableItem extends React.Component {} + export class Layout extends React.Component {} - export class Text extends React.Component {} + export class Link extends React.Component {} + + export class List extends React.Component {} + + export class ListItem extends React.Component {} + + export class Markdown extends React.Component {} + + export class Notes extends React.Component {} + + export class Quote extends React.Component {} + + export class S extends React.Component {} + + export class Slide extends React.Component {} + + export class SlideSet extends React.Component {} + + export class Table extends React.Component {} + + export class TableBody extends React.Component {} + + export class TableHeader extends React.Component {} + + export class TableHeaderItem extends React.Component {} + + export class TableItem extends React.Component {} + + export class TableRow extends React.Component {} + + export class Text extends React.Component {} } declare module "spectacle/lib/utils/preloader" { - const preloader: (obj: object) => void; - export default preloader; + const preloader: (obj: object) => void; + export default preloader; } declare module "spectacle/lib/themes/default" { - import { Theme } from "spectacle"; - const createTheme: (...args: object[]) => Theme; - export default createTheme; + import { Theme } from "spectacle"; + const createTheme: (...args: object[]) => Theme; + export default createTheme; } diff --git a/types/spectacle/package.json b/types/spectacle/package.json new file mode 100644 index 0000000000..9de3dd17fa --- /dev/null +++ b/types/spectacle/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "csstype": "^2.2.0" + } + } diff --git a/types/spectacle/spectacle-tests.tsx b/types/spectacle/spectacle-tests.tsx index f0a0b65e5a..04c3403f41 100644 --- a/types/spectacle/spectacle-tests.tsx +++ b/types/spectacle/spectacle-tests.tsx @@ -1,133 +1,377 @@ -/** - * Spectacle Test Examples - * - */ - -import * as React from 'react'; +import * as React from "react"; import { - Appear, - BlockQuote, - Cite, - Deck, - Fill, - Heading, - Layout, - Link, - ListItem, - List, - Quote, - Slide, - Spectacle, - Text + Anim, + Appear, + BlockQuote, + Cite, + CodePane, + ComponentPlayground, + Deck, + Fill, + GoToAction, + Heading, + Image, + Layout, + Link, + List, + ListItem, + Markdown, + Notes, + Quote, + Slide, + SlideSet, + Table, + TableBody, + TableHeader, + TableHeaderItem, + TableItem, + TableRow, + Text } from "spectacle"; // Import image preloader util -import preloader from 'spectacle/lib/utils/preloader' +import preloader from "spectacle/lib/utils/preloader"; // Import theme -import createTheme from 'spectacle/lib/themes/default' +import createTheme from "spectacle/lib/themes/default"; const images = { - city: 'a-url' -} + city: "a-url", + logo: "another-url" +}; -preloader(images) +preloader(images); -const theme = createTheme({ - primary: 'white', - secondary: '#1F2022', - tertiary: '#03A9FC', - quartenary: '#CECECE' -}, { - primary: 'Montserrat', - secondary: 'Helvetica' -}) +const theme = createTheme( + { + primary: "white", + secondary: "#1F2022", + tertiary: "#03A9FC", + quartenary: "#CECECE" + }, + { + primary: "Montserrat", + secondary: "Helvetica" + } +); export class SpectacleTest extends React.Component { - callback() { - alert('Callback: ' + JSON.stringify(arguments)); - } - - public render() { - return ( - - - - Spectacle - - - A ReactJS Presentation Library - - - Where You Can Write Your Decks In JSX - - - View on Github - - Hit Your Right Arrow To Begin! - - - - Wait what? - - - - - - Full Width - - - - - Adjustable Darkness - - - - - Background Imagery - - - - - Flexible Layouts - - - - Left - - - - - Right - - - - - -
    - Wonderfully formatted quotes - Ken Wheeler -
    -
    - - - Smooth - - - Combinable Transitions - - - - - Inline style based theme system - Autofit text - Flexbox layout system - React-Router navigation - PDF export - And... - - -
    -
    ); - } + public render() { + return ( + + + + Spectacle + + + A ReactJS Presentation Library + + + Where You Can Write Your Decks In JSX + + + + View on Github + + + + Hit Your Right Arrow To Begin! + + + + + Wait what? + + + + + + Full Width + + + + + Adjustable Darkness + + + + + Background Imagery + + + + + + + + + This is a component playground + + + + Flexible Layouts + + + + + Left + + + + + Right + + + + + + + Inline Markdown + + + {` + You can write inline images, [Markdown Links](http://commonmark.org), paragraph text and most other markdown syntax + * Lists too! + * With ~~strikethrough~~ and _italic_ + * And let's not forget **bold** + * Add some \`inline code\` to your sldes! + `} + + + + { + /* eslint-disable */ + console.log("forwards ", forwards); + console.log("animIndex ", animIndex); + /* eslint-enable */ + }} + fromStyle={{ + opacity: 0, + transform: + "translate3d(0px, -100px, 0px) scale(1) rotate(0deg)" + }} + toStyle={[ + { + opacity: 1, + transform: + "translate3d(0px, 0px, 0px) scale(1) rotate(0deg)" + }, + { + opacity: 1, + transform: + "translate3d(0px, 0px, 0px) scale(1.6) rotate(-15deg)" + }, + { + opacity: 1, + transform: + "translate3d(0px, 0px, 0px) scale(0.8) rotate(0deg)" + } + ]} + easing={"bounceOut"} + transitionDuration={500} + > + + + Flexible +
    + animations +
    +
    +
    +
    + + + Mix it up! + + + You can even jump to different slides with a standard + button or custom component! + + + Jump to Slide 8 + + ( + + )} + /> + + +
    + Wonderfully formatted quotes + Ken Wheeler +
    +
    + +
    + Wonderfully formatted quotes + Ken Wheeler +
    +
    + + + + + + Inline style based theme system + + + + Autofit text + + + Flexbox layout system + + + PDF export + + + And... + + + + + + You can even share styles with SlideSet + + + + + + Pizza Toppings + + + + + + + 2011 + 2013 + 2015 + + + + + None + 61.8% + 39.6% + 35.0% + + + Pineapple + 28.3% + 54.5% + 61.5% + + + Pepperoni + + 50.2% + 77.2% + + + Olives + + 24.9% + 55.9% + + +
    +
    +
    + + + Made with love in Seattle by + + + + + +
    + ); + } } From 42a5abdf16075d754a8532601a3ee4539d12536b Mon Sep 17 00:00:00 2001 From: Kylie Stewart Date: Thu, 6 Dec 2018 17:35:02 -0700 Subject: [PATCH 149/241] Bump Spectacle version to latest --- types/spectacle/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/spectacle/index.d.ts b/types/spectacle/index.d.ts index 285ed6cbe4..621f08f67e 100644 --- a/types/spectacle/index.d.ts +++ b/types/spectacle/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Spectacle 1.2.0 +// Type definitions for Spectacle 5.2.2 // Project: https://github.com/FormidableLabs/spectacle // Definitions by: Zachary Maybury // Kylie Stewart From e009d1c3c0747b1147c077e1b1ac6ef4a91f01ea Mon Sep 17 00:00:00 2001 From: Kent Wong Date: Thu, 6 Dec 2018 16:43:14 -0800 Subject: [PATCH 150/241] Typings for cli-box (https://github.com/IonicaBizau/node-cli-box). --- types/cli-box/cli-box-tests.ts | 47 +++++++++++++++++++++++ types/cli-box/index.d.ts | 70 ++++++++++++++++++++++++++++++++++ types/cli-box/tsconfig.json | 23 +++++++++++ types/cli-box/tslint.json | 1 + 4 files changed, 141 insertions(+) create mode 100644 types/cli-box/cli-box-tests.ts create mode 100644 types/cli-box/index.d.ts create mode 100644 types/cli-box/tsconfig.json create mode 100644 types/cli-box/tslint.json diff --git a/types/cli-box/cli-box-tests.ts b/types/cli-box/cli-box-tests.ts new file mode 100644 index 0000000000..a26b436e21 --- /dev/null +++ b/types/cli-box/cli-box-tests.ts @@ -0,0 +1,47 @@ +import Box = require('cli-box'); + +// Create a simple box +const b1: Box = Box("20x10"); +// console.log(b1.toString()); + +// Set custom marks +const b2: Box = new Box({ + w: 10 + , h: 10 + , stringify: false + , marks: { + nw: "╔" + , n: "══" + , ne: "╗" + , e: "║" + , se: "╝" + , s: "══" + , sw: "╚" + , w: "║" + , b: "░░" + } +}); +// console.log(b2.stringify()); + +// Box with text and use the stringify +const b3: Box = Box("20x10", "I will be \u001b[31mdis\u001b[0mplayed inside! \n A\u001b[34mnd I'm in a\u001b[0m new line!"); +// console.log(b3); + +// Box with aligned text to top-right +const b4: Box = Box("30x20", { + text: "Box content" + , stretch: true + , autoEOL: true + , vAlign: "top" + , hAlign: "right" +}); +// console.log(b4); + +// Full screen box +const b5: Box = Box({fullscreen: true, marks: {}}, "Hello World!"); +// console.log(b5.toString()); + +const b5s: string = Box({stringify: true, fullscreen: true, marks: {}}, "Hello World!"); +const b5ns: Box = Box({stringify: false, fullscreen: true, marks: {}}, "Hello World!"); + +const defaults = Box.defaults; diff --git a/types/cli-box/index.d.ts b/types/cli-box/index.d.ts new file mode 100644 index 0000000000..c2466853a6 --- /dev/null +++ b/types/cli-box/index.d.ts @@ -0,0 +1,70 @@ +// Type definitions for cli-box 6.0 +// Project: https://github.com/IonicaBizau/node-cli-box +// Definitions by: Kent Wong +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/*~ Note that ES6 modules cannot directly export callable functions. + *~ This file should be imported using the CommonJS-style: + *~ import x = require('someLibrary'); + *~ + *~ Refer to the documentation to understand common + *~ workarounds for this limitation of ES6 modules. + */ + +/*~ This declaration specifies that the function + *~ is the exported object from the file + */ +export = Box; + +type MarksKeys = 'nw' | 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'b'; +type Marks = Record; + +interface Options { + w?: number; + width?: number; + h?: number; + height?: number; + fullscreen?: boolean; + stringify?: boolean; + marks?: Partial; +} + +interface Text { + text?: string; + stretch?: boolean; + autoEOL?: boolean; + hAlign?: 'left' | 'middle' | 'right'; + vAlign?: 'top' | 'center' | 'bottom'; +} + +interface Box { + stringify(): string; + settings: { + width: number; + height: number; + marks: Marks; + lines: Array<{ + text: string; + offset: { + y: number; + } + }> + }; + options: { + width: number; + height: number; + marks: Marks; + fullscreen: boolean; + stringify: boolean; + }; +} + +interface BoxConstructor { + new(options: Options | string, text?: Text | string): Box; + (options: (Exclude & { stringify: true }), text?: Text | string): string; + (options: Options | string, text?: Text | string): Box; + defaults: { marks: Marks }; +} + +declare const Box: BoxConstructor; diff --git a/types/cli-box/tsconfig.json b/types/cli-box/tsconfig.json new file mode 100644 index 0000000000..d9a3d38876 --- /dev/null +++ b/types/cli-box/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cli-box-tests.ts" + ] +} diff --git a/types/cli-box/tslint.json b/types/cli-box/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/cli-box/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 2b5740f7d28b9acf379c75e79ae857dae1534e5d Mon Sep 17 00:00:00 2001 From: Matthew Lilley Date: Fri, 7 Dec 2018 02:05:09 +0000 Subject: [PATCH 151/241] Make serializeState and deserializeState options, optional. --- types/next-redux-wrapper/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/next-redux-wrapper/index.d.ts b/types/next-redux-wrapper/index.d.ts index 835a9762ca..84d71b46c1 100644 --- a/types/next-redux-wrapper/index.d.ts +++ b/types/next-redux-wrapper/index.d.ts @@ -19,8 +19,8 @@ declare namespace nextReduxWrapper { interface Options { storeKey?: string; debug?: boolean; - serializeState: any; - deserializeState: any; + serializeState?: any; + deserializeState?: any; } interface StoreCreatorOptions extends Options { From e8127e09dfdaeaf1f7995f9a5ada2bfdfac936a7 Mon Sep 17 00:00:00 2001 From: Leko Date: Fri, 7 Dec 2018 11:35:23 +0900 Subject: [PATCH 152/241] Move types into a namespace --- types/ghauth/ghauth-tests.ts | 4 ++- types/ghauth/index.d.ts | 68 +++++++++++++++++++----------------- 2 files changed, 39 insertions(+), 33 deletions(-) diff --git a/types/ghauth/ghauth-tests.ts b/types/ghauth/ghauth-tests.ts index 7757cf24dd..56bc0cd1b0 100644 --- a/types/ghauth/ghauth-tests.ts +++ b/types/ghauth/ghauth-tests.ts @@ -1,4 +1,6 @@ -import ghauth, { AuthOptions, TokenData } from "ghauth"; +/// +import ghauth = require("ghauth"); +import { AuthOptions, TokenData } from "ghauth"; // Full const authOptions1: AuthOptions = { diff --git a/types/ghauth/index.d.ts b/types/ghauth/index.d.ts index e21afdf3fa..3d91ab8ef5 100644 --- a/types/ghauth/index.d.ts +++ b/types/ghauth/index.d.ts @@ -3,43 +3,47 @@ // Definitions by: Leko // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export interface AuthOptions { - configName: string; +declare function ghauth(authOptions: ghauth.AuthOptions, callback: (err: Error, tokenData: ghauth.TokenData) => void): void; - /** - * @default false - */ - noSave?: boolean; +declare namespace ghauth { + interface AuthOptions { + configName: string; - /** - * @default "https://api.github.com/authorizations" - */ - authUrl?: string; + /** + * @default false + */ + noSave?: boolean; - /** - * @default "GitHub" - */ - promptName?: string; + /** + * @default "https://api.github.com/authorizations" + */ + authUrl?: string; - /** - * @default [] - */ - scopes?: ReadonlyArray; + /** + * @default "GitHub" + */ + promptName?: string; - /** - * @default "Node.js command-line app with ghauth" - */ - note?: string; + /** + * @default [] + */ + scopes?: ReadonlyArray; - /** - * @default "Magic Node.js application that does magic things with ghauth" - */ - userAgent?: string; + /** + * @default "Node.js command-line app with ghauth" + */ + note?: string; + + /** + * @default "Magic Node.js application that does magic things with ghauth" + */ + userAgent?: string; + } + + interface TokenData { + user: string; + token: string; + } } -export interface TokenData { - user: string; - token: string; -} - -export default function ghauth(authOptions: AuthOptions, callback: (err: Error, tokenData: TokenData) => void): void; +export = ghauth; From 0920b0ca86aa58a6513d69ee80e89634a2034369 Mon Sep 17 00:00:00 2001 From: Wu Haotian Date: Fri, 7 Dec 2018 15:53:43 +0800 Subject: [PATCH 153/241] use Parameters --- types/debounce-promise/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/debounce-promise/index.d.ts b/types/debounce-promise/index.d.ts index 2356d30060..905ca7fc50 100644 --- a/types/debounce-promise/index.d.ts +++ b/types/debounce-promise/index.d.ts @@ -11,14 +11,12 @@ declare namespace debounce { } } -type ArgumentsType = T extends (...args: infer A) => any ? A : never; - declare function debounce any>( func: T, wait?: number, options?: debounce.DebounceOptions ): ( - ...args: ArgumentsType + ...args: Parameters ) => ReturnType extends Promise ? ReturnType : Promise>; From 6ef208779f54941e7bce5900ba37e6f8ca3d15ef Mon Sep 17 00:00:00 2001 From: Meno Abels Date: Fri, 7 Dec 2018 09:35:08 +0100 Subject: [PATCH 154/241] add typings for resolve-pkg --- types/resolve-pkg/index.d.ts | 14 ++++++++++++++ types/resolve-pkg/resolve-pkg-tests.ts | 5 +++++ types/resolve-pkg/tsconfig.json | 23 +++++++++++++++++++++++ types/resolve-pkg/tslint.json | 1 + 4 files changed, 43 insertions(+) create mode 100644 types/resolve-pkg/index.d.ts create mode 100644 types/resolve-pkg/resolve-pkg-tests.ts create mode 100644 types/resolve-pkg/tsconfig.json create mode 100644 types/resolve-pkg/tslint.json diff --git a/types/resolve-pkg/index.d.ts b/types/resolve-pkg/index.d.ts new file mode 100644 index 0000000000..06a706acbe --- /dev/null +++ b/types/resolve-pkg/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for resolve-pkg 1.0 +// Project: https://github.com/sindresorhus/resolve-pkg +// Definitions by: Meno Abels +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.9 + +interface ResolvePkgOptions { + cwd?: boolean; +} + +type ResolveFunction = (moduleId: string, options?: ResolvePkgOptions) => string; +declare const resolveFunction: ResolveFunction; + +export = resolveFunction; diff --git a/types/resolve-pkg/resolve-pkg-tests.ts b/types/resolve-pkg/resolve-pkg-tests.ts new file mode 100644 index 0000000000..8794b0cc03 --- /dev/null +++ b/types/resolve-pkg/resolve-pkg-tests.ts @@ -0,0 +1,5 @@ +import * as rpkg from 'resolve-pkg'; + +const test1 = rpkg('hello'); +const test2 = rpkg('hello', {}); +const test3 = rpkg('hello', { cwd: true }); diff --git a/types/resolve-pkg/tsconfig.json b/types/resolve-pkg/tsconfig.json new file mode 100644 index 0000000000..04c11fa02f --- /dev/null +++ b/types/resolve-pkg/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", + "resolve-pkg-tests.ts" + ] +} diff --git a/types/resolve-pkg/tslint.json b/types/resolve-pkg/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/resolve-pkg/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e8cf8f320760d232858101a0be4b2b6f7f1865dc Mon Sep 17 00:00:00 2001 From: Vincent Date: Fri, 7 Dec 2018 12:12:31 +0100 Subject: [PATCH 155/241] react-syntax-highlighter styles moved to dist/ See https://github.com/conorhastings/react-syntax-highlighter/blob/master/CHANGELOG.MD#1000 --- types/react-syntax-highlighter/index.d.ts | 412 +++++++++--------- .../react-syntax-highlighter-tests.tsx | 4 +- 2 files changed, 208 insertions(+), 208 deletions(-) diff --git a/types/react-syntax-highlighter/index.d.ts b/types/react-syntax-highlighter/index.d.ts index c631dea9f7..825608fe92 100644 --- a/types/react-syntax-highlighter/index.d.ts +++ b/types/react-syntax-highlighter/index.d.ts @@ -42,626 +42,626 @@ declare module 'react-syntax-highlighter/prism-light' { export default class SyntaxHighlighter extends React.Component {} } -declare module 'react-syntax-highlighter/styles/hljs' { - export { default as agate } from 'react-syntax-highlighter/styles/hljs/agate'; - export { default as androidstudio } from 'react-syntax-highlighter/styles/hljs/androidstudio'; - export { default as arduinoLight } from 'react-syntax-highlighter/styles/hljs/arduino-light'; - export { default as arta } from 'react-syntax-highlighter/styles/hljs/arta'; - export { default as ascetic } from 'react-syntax-highlighter/styles/hljs/ascetic'; - export { default as atelierCaveDark } from 'react-syntax-highlighter/styles/hljs/atelier-cave-dark'; - export { default as atelierCaveLight } from 'react-syntax-highlighter/styles/hljs/atelier-cave-light'; - export { default as atelierDuneDark } from 'react-syntax-highlighter/styles/hljs/atelier-dune-dark'; - export { default as atelierDuneLight } from 'react-syntax-highlighter/styles/hljs/atelier-dune-light'; - export { default as atelierEstuaryDark } from 'react-syntax-highlighter/styles/hljs/atelier-estuary-dark'; - export { default as atelierEstuaryLight } from 'react-syntax-highlighter/styles/hljs/atelier-estuary-light'; - export { default as atelierForestDark } from 'react-syntax-highlighter/styles/hljs/atelier-forest-dark'; - export { default as atelierForestLight } from 'react-syntax-highlighter/styles/hljs/atelier-forest-light'; - export { default as atelierHeathDark } from 'react-syntax-highlighter/styles/hljs/atelier-heath-dark'; - export { default as atelierHeathLight } from 'react-syntax-highlighter/styles/hljs/atelier-heath-light'; - export { default as atelierLakesideDark } from 'react-syntax-highlighter/styles/hljs/atelier-lakeside-dark'; - export { default as atelierLakesideLight } from 'react-syntax-highlighter/styles/hljs/atelier-lakeside-light'; - export { default as atelierPlateauDark } from 'react-syntax-highlighter/styles/hljs/atelier-plateau-dark'; - export { default as atelierPlateauLight } from 'react-syntax-highlighter/styles/hljs/atelier-plateau-light'; - export { default as atelierSavannaDark } from 'react-syntax-highlighter/styles/hljs/atelier-savanna-dark'; - export { default as atelierSavannaLight } from 'react-syntax-highlighter/styles/hljs/atelier-savanna-light'; - export { default as atelierSeasideDark } from 'react-syntax-highlighter/styles/hljs/atelier-seaside-dark'; - export { default as atelierSeasideLight } from 'react-syntax-highlighter/styles/hljs/atelier-seaside-light'; - export { default as atelierSulphurpoolDark } from 'react-syntax-highlighter/styles/hljs/atelier-sulphurpool-dark'; - export { default as atelierSulphurpoolLight } from 'react-syntax-highlighter/styles/hljs/atelier-sulphurpool-light'; - export { default as atomOneDark } from 'react-syntax-highlighter/styles/hljs/atom-one-dark'; - export { default as atomOneLight } from 'react-syntax-highlighter/styles/hljs/atom-one-light'; - export { default as brownPaper } from 'react-syntax-highlighter/styles/hljs/brown-paper'; - export { default as codepenEmbed } from 'react-syntax-highlighter/styles/hljs/codepen-embed'; - export { default as colorBrewer } from 'react-syntax-highlighter/styles/hljs/color-brewer'; - export { default as darcula } from 'react-syntax-highlighter/styles/hljs/darcula'; - export { default as dark } from 'react-syntax-highlighter/styles/hljs/dark'; - export { default as darkula } from 'react-syntax-highlighter/styles/hljs/darkula'; - export { default as defaultStyle } from 'react-syntax-highlighter/styles/hljs/default-style'; - export { default as docco } from 'react-syntax-highlighter/styles/hljs/docco'; - export { default as dracula } from 'react-syntax-highlighter/styles/hljs/dracula'; - export { default as far } from 'react-syntax-highlighter/styles/hljs/far'; - export { default as foundation } from 'react-syntax-highlighter/styles/hljs/foundation'; - export { default as githubGist } from 'react-syntax-highlighter/styles/hljs/github-gist'; - export { default as github } from 'react-syntax-highlighter/styles/hljs/github'; - export { default as googlecode } from 'react-syntax-highlighter/styles/hljs/googlecode'; - export { default as grayscale } from 'react-syntax-highlighter/styles/hljs/grayscale'; - export { default as gruvboxDark } from 'react-syntax-highlighter/styles/hljs/gruvbox-dark'; - export { default as gruvboxLight } from 'react-syntax-highlighter/styles/hljs/gruvbox-light'; - export { default as hopscotch } from 'react-syntax-highlighter/styles/hljs/hopscotch'; - export { default as hybrid } from 'react-syntax-highlighter/styles/hljs/hybrid'; - export { default as idea } from 'react-syntax-highlighter/styles/hljs/idea'; - export { default as irBlack } from 'react-syntax-highlighter/styles/hljs/ir-black'; - export { default as kimbieDark } from 'react-syntax-highlighter/styles/hljs/kimbie.dark'; - export { default as kimbieLight } from 'react-syntax-highlighter/styles/hljs/kimbie.light'; - export { default as magula } from 'react-syntax-highlighter/styles/hljs/magula'; - export { default as monoBlue } from 'react-syntax-highlighter/styles/hljs/mono-blue'; - export { default as monokaiSublime } from 'react-syntax-highlighter/styles/hljs/monokai-sublime'; - export { default as monokai } from 'react-syntax-highlighter/styles/hljs/monokai'; - export { default as obsidian } from 'react-syntax-highlighter/styles/hljs/obsidian'; - export { default as ocean } from 'react-syntax-highlighter/styles/hljs/ocean'; - export { default as paraisoDark } from 'react-syntax-highlighter/styles/hljs/paraiso-dark'; - export { default as paraisoLight } from 'react-syntax-highlighter/styles/hljs/paraiso-light'; - export { default as pojoaque } from 'react-syntax-highlighter/styles/hljs/pojoaque'; - export { default as purebasic } from 'react-syntax-highlighter/styles/hljs/purebasic'; - export { default as qtcreatorDark } from 'react-syntax-highlighter/styles/hljs/qtcreator_dark'; - export { default as qtcreatorLight } from 'react-syntax-highlighter/styles/hljs/qtcreator_light'; - export { default as railscasts } from 'react-syntax-highlighter/styles/hljs/railscasts'; - export { default as rainbow } from 'react-syntax-highlighter/styles/hljs/rainbow'; - export { default as routeros } from 'react-syntax-highlighter/styles/hljs/routeros'; - export { default as schoolBook } from 'react-syntax-highlighter/styles/hljs/school-book'; - export { default as solarizedDark } from 'react-syntax-highlighter/styles/hljs/solarized-dark'; - export { default as solarizedLight } from 'react-syntax-highlighter/styles/hljs/solarized-light'; - export { default as sunburst } from 'react-syntax-highlighter/styles/hljs/sunburst'; - export { default as tomorrowNightBlue } from 'react-syntax-highlighter/styles/hljs/tomorrow-night-blue'; - export { default as tomorrowNightBright } from 'react-syntax-highlighter/styles/hljs/tomorrow-night-bright'; - export { default as tomorrowNightEighties } from 'react-syntax-highlighter/styles/hljs/tomorrow-night-eighties'; - export { default as tomorrowNight } from 'react-syntax-highlighter/styles/hljs/tomorrow-night'; - export { default as tomorrow } from 'react-syntax-highlighter/styles/hljs/tomorrow'; - export { default as vs } from 'react-syntax-highlighter/styles/hljs/vs'; - export { default as vs2015 } from 'react-syntax-highlighter/styles/hljs/vs2015'; - export { default as xcode } from 'react-syntax-highlighter/styles/hljs/xcode'; - export { default as xt256 } from 'react-syntax-highlighter/styles/hljs/xt256'; - export { default as zenburn } from 'react-syntax-highlighter/styles/hljs/zenburn'; +declare module 'react-syntax-highlighter/dist/styles/hljs' { + export { default as agate } from 'react-syntax-highlighter/dist/styles/hljs/agate'; + export { default as androidstudio } from 'react-syntax-highlighter/dist/styles/hljs/androidstudio'; + export { default as arduinoLight } from 'react-syntax-highlighter/dist/styles/hljs/arduino-light'; + export { default as arta } from 'react-syntax-highlighter/dist/styles/hljs/arta'; + export { default as ascetic } from 'react-syntax-highlighter/dist/styles/hljs/ascetic'; + export { default as atelierCaveDark } from 'react-syntax-highlighter/dist/styles/hljs/atelier-cave-dark'; + export { default as atelierCaveLight } from 'react-syntax-highlighter/dist/styles/hljs/atelier-cave-light'; + export { default as atelierDuneDark } from 'react-syntax-highlighter/dist/styles/hljs/atelier-dune-dark'; + export { default as atelierDuneLight } from 'react-syntax-highlighter/dist/styles/hljs/atelier-dune-light'; + export { default as atelierEstuaryDark } from 'react-syntax-highlighter/dist/styles/hljs/atelier-estuary-dark'; + export { default as atelierEstuaryLight } from 'react-syntax-highlighter/dist/styles/hljs/atelier-estuary-light'; + export { default as atelierForestDark } from 'react-syntax-highlighter/dist/styles/hljs/atelier-forest-dark'; + export { default as atelierForestLight } from 'react-syntax-highlighter/dist/styles/hljs/atelier-forest-light'; + export { default as atelierHeathDark } from 'react-syntax-highlighter/dist/styles/hljs/atelier-heath-dark'; + export { default as atelierHeathLight } from 'react-syntax-highlighter/dist/styles/hljs/atelier-heath-light'; + export { default as atelierLakesideDark } from 'react-syntax-highlighter/dist/styles/hljs/atelier-lakeside-dark'; + export { default as atelierLakesideLight } from 'react-syntax-highlighter/dist/styles/hljs/atelier-lakeside-light'; + export { default as atelierPlateauDark } from 'react-syntax-highlighter/dist/styles/hljs/atelier-plateau-dark'; + export { default as atelierPlateauLight } from 'react-syntax-highlighter/dist/styles/hljs/atelier-plateau-light'; + export { default as atelierSavannaDark } from 'react-syntax-highlighter/dist/styles/hljs/atelier-savanna-dark'; + export { default as atelierSavannaLight } from 'react-syntax-highlighter/dist/styles/hljs/atelier-savanna-light'; + export { default as atelierSeasideDark } from 'react-syntax-highlighter/dist/styles/hljs/atelier-seaside-dark'; + export { default as atelierSeasideLight } from 'react-syntax-highlighter/dist/styles/hljs/atelier-seaside-light'; + export { default as atelierSulphurpoolDark } from 'react-syntax-highlighter/dist/styles/hljs/atelier-sulphurpool-dark'; + export { default as atelierSulphurpoolLight } from 'react-syntax-highlighter/dist/styles/hljs/atelier-sulphurpool-light'; + export { default as atomOneDark } from 'react-syntax-highlighter/dist/styles/hljs/atom-one-dark'; + export { default as atomOneLight } from 'react-syntax-highlighter/dist/styles/hljs/atom-one-light'; + export { default as brownPaper } from 'react-syntax-highlighter/dist/styles/hljs/brown-paper'; + export { default as codepenEmbed } from 'react-syntax-highlighter/dist/styles/hljs/codepen-embed'; + export { default as colorBrewer } from 'react-syntax-highlighter/dist/styles/hljs/color-brewer'; + export { default as darcula } from 'react-syntax-highlighter/dist/styles/hljs/darcula'; + export { default as dark } from 'react-syntax-highlighter/dist/styles/hljs/dark'; + export { default as darkula } from 'react-syntax-highlighter/dist/styles/hljs/darkula'; + export { default as defaultStyle } from 'react-syntax-highlighter/dist/styles/hljs/default-style'; + export { default as docco } from 'react-syntax-highlighter/dist/styles/hljs/docco'; + export { default as dracula } from 'react-syntax-highlighter/dist/styles/hljs/dracula'; + export { default as far } from 'react-syntax-highlighter/dist/styles/hljs/far'; + export { default as foundation } from 'react-syntax-highlighter/dist/styles/hljs/foundation'; + export { default as githubGist } from 'react-syntax-highlighter/dist/styles/hljs/github-gist'; + export { default as github } from 'react-syntax-highlighter/dist/styles/hljs/github'; + export { default as googlecode } from 'react-syntax-highlighter/dist/styles/hljs/googlecode'; + export { default as grayscale } from 'react-syntax-highlighter/dist/styles/hljs/grayscale'; + export { default as gruvboxDark } from 'react-syntax-highlighter/dist/styles/hljs/gruvbox-dark'; + export { default as gruvboxLight } from 'react-syntax-highlighter/dist/styles/hljs/gruvbox-light'; + export { default as hopscotch } from 'react-syntax-highlighter/dist/styles/hljs/hopscotch'; + export { default as hybrid } from 'react-syntax-highlighter/dist/styles/hljs/hybrid'; + export { default as idea } from 'react-syntax-highlighter/dist/styles/hljs/idea'; + export { default as irBlack } from 'react-syntax-highlighter/dist/styles/hljs/ir-black'; + export { default as kimbieDark } from 'react-syntax-highlighter/dist/styles/hljs/kimbie.dark'; + export { default as kimbieLight } from 'react-syntax-highlighter/dist/styles/hljs/kimbie.light'; + export { default as magula } from 'react-syntax-highlighter/dist/styles/hljs/magula'; + export { default as monoBlue } from 'react-syntax-highlighter/dist/styles/hljs/mono-blue'; + export { default as monokaiSublime } from 'react-syntax-highlighter/dist/styles/hljs/monokai-sublime'; + export { default as monokai } from 'react-syntax-highlighter/dist/styles/hljs/monokai'; + export { default as obsidian } from 'react-syntax-highlighter/dist/styles/hljs/obsidian'; + export { default as ocean } from 'react-syntax-highlighter/dist/styles/hljs/ocean'; + export { default as paraisoDark } from 'react-syntax-highlighter/dist/styles/hljs/paraiso-dark'; + export { default as paraisoLight } from 'react-syntax-highlighter/dist/styles/hljs/paraiso-light'; + export { default as pojoaque } from 'react-syntax-highlighter/dist/styles/hljs/pojoaque'; + export { default as purebasic } from 'react-syntax-highlighter/dist/styles/hljs/purebasic'; + export { default as qtcreatorDark } from 'react-syntax-highlighter/dist/styles/hljs/qtcreator_dark'; + export { default as qtcreatorLight } from 'react-syntax-highlighter/dist/styles/hljs/qtcreator_light'; + export { default as railscasts } from 'react-syntax-highlighter/dist/styles/hljs/railscasts'; + export { default as rainbow } from 'react-syntax-highlighter/dist/styles/hljs/rainbow'; + export { default as routeros } from 'react-syntax-highlighter/dist/styles/hljs/routeros'; + export { default as schoolBook } from 'react-syntax-highlighter/dist/styles/hljs/school-book'; + export { default as solarizedDark } from 'react-syntax-highlighter/dist/styles/hljs/solarized-dark'; + export { default as solarizedLight } from 'react-syntax-highlighter/dist/styles/hljs/solarized-light'; + export { default as sunburst } from 'react-syntax-highlighter/dist/styles/hljs/sunburst'; + export { default as tomorrowNightBlue } from 'react-syntax-highlighter/dist/styles/hljs/tomorrow-night-blue'; + export { default as tomorrowNightBright } from 'react-syntax-highlighter/dist/styles/hljs/tomorrow-night-bright'; + export { default as tomorrowNightEighties } from 'react-syntax-highlighter/dist/styles/hljs/tomorrow-night-eighties'; + export { default as tomorrowNight } from 'react-syntax-highlighter/dist/styles/hljs/tomorrow-night'; + export { default as tomorrow } from 'react-syntax-highlighter/dist/styles/hljs/tomorrow'; + export { default as vs } from 'react-syntax-highlighter/dist/styles/hljs/vs'; + export { default as vs2015 } from 'react-syntax-highlighter/dist/styles/hljs/vs2015'; + export { default as xcode } from 'react-syntax-highlighter/dist/styles/hljs/xcode'; + export { default as xt256 } from 'react-syntax-highlighter/dist/styles/hljs/xt256'; + export { default as zenburn } from 'react-syntax-highlighter/dist/styles/hljs/zenburn'; } -declare module 'react-syntax-highlighter/styles/hljs/agate' { +declare module 'react-syntax-highlighter/dist/styles/hljs/agate' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/androidstudio' { +declare module 'react-syntax-highlighter/dist/styles/hljs/androidstudio' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/arduino-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/arduino-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/arta' { +declare module 'react-syntax-highlighter/dist/styles/hljs/arta' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/ascetic' { +declare module 'react-syntax-highlighter/dist/styles/hljs/ascetic' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-cave-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-cave-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-cave-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-cave-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-dune-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-dune-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-dune-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-dune-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-estuary-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-estuary-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-estuary-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-estuary-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-forest-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-forest-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-forest-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-forest-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-heath-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-heath-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-heath-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-heath-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-lakeside-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-lakeside-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-lakeside-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-lakeside-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-plateau-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-plateau-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-plateau-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-plateau-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-savanna-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-savanna-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-savanna-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-savanna-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-seaside-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-seaside-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-seaside-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-seaside-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-sulphurpool-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-sulphurpool-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atelier-sulphurpool-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atelier-sulphurpool-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atom-one-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atom-one-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/atom-one-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/atom-one-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/brown-paper' { +declare module 'react-syntax-highlighter/dist/styles/hljs/brown-paper' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/codepen-embed' { +declare module 'react-syntax-highlighter/dist/styles/hljs/codepen-embed' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/color-brewer' { +declare module 'react-syntax-highlighter/dist/styles/hljs/color-brewer' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/darcula' { +declare module 'react-syntax-highlighter/dist/styles/hljs/darcula' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/darkula' { +declare module 'react-syntax-highlighter/dist/styles/hljs/darkula' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/default-style' { +declare module 'react-syntax-highlighter/dist/styles/hljs/default-style' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/docco' { +declare module 'react-syntax-highlighter/dist/styles/hljs/docco' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/dracula' { +declare module 'react-syntax-highlighter/dist/styles/hljs/dracula' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/far' { +declare module 'react-syntax-highlighter/dist/styles/hljs/far' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/foundation' { +declare module 'react-syntax-highlighter/dist/styles/hljs/foundation' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/github-gist' { +declare module 'react-syntax-highlighter/dist/styles/hljs/github-gist' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/github' { +declare module 'react-syntax-highlighter/dist/styles/hljs/github' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/googlecode' { +declare module 'react-syntax-highlighter/dist/styles/hljs/googlecode' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/grayscale' { +declare module 'react-syntax-highlighter/dist/styles/hljs/grayscale' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/gruvbox-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/gruvbox-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/gruvbox-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/gruvbox-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/hopscotch' { +declare module 'react-syntax-highlighter/dist/styles/hljs/hopscotch' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/hybrid' { +declare module 'react-syntax-highlighter/dist/styles/hljs/hybrid' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/idea' { +declare module 'react-syntax-highlighter/dist/styles/hljs/idea' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/ir-black' { +declare module 'react-syntax-highlighter/dist/styles/hljs/ir-black' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/kimbie.dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/kimbie.dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/kimbie.light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/kimbie.light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/magula' { +declare module 'react-syntax-highlighter/dist/styles/hljs/magula' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/mono-blue' { +declare module 'react-syntax-highlighter/dist/styles/hljs/mono-blue' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/monokai-sublime' { +declare module 'react-syntax-highlighter/dist/styles/hljs/monokai-sublime' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/monokai' { +declare module 'react-syntax-highlighter/dist/styles/hljs/monokai' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/obsidian' { +declare module 'react-syntax-highlighter/dist/styles/hljs/obsidian' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/ocean' { +declare module 'react-syntax-highlighter/dist/styles/hljs/ocean' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/paraiso-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/paraiso-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/paraiso-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/paraiso-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/pojoaque' { +declare module 'react-syntax-highlighter/dist/styles/hljs/pojoaque' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/purebasic' { +declare module 'react-syntax-highlighter/dist/styles/hljs/purebasic' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/qtcreator_dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/qtcreator_dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/qtcreator_light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/qtcreator_light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/railscasts' { +declare module 'react-syntax-highlighter/dist/styles/hljs/railscasts' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/rainbow' { +declare module 'react-syntax-highlighter/dist/styles/hljs/rainbow' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/routeros' { +declare module 'react-syntax-highlighter/dist/styles/hljs/routeros' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/school-book' { +declare module 'react-syntax-highlighter/dist/styles/hljs/school-book' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/solarized-dark' { +declare module 'react-syntax-highlighter/dist/styles/hljs/solarized-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/solarized-light' { +declare module 'react-syntax-highlighter/dist/styles/hljs/solarized-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/sunburst' { +declare module 'react-syntax-highlighter/dist/styles/hljs/sunburst' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/tomorrow-night-blue' { +declare module 'react-syntax-highlighter/dist/styles/hljs/tomorrow-night-blue' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/tomorrow-night-bright' { +declare module 'react-syntax-highlighter/dist/styles/hljs/tomorrow-night-bright' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/tomorrow-night-eighties' { +declare module 'react-syntax-highlighter/dist/styles/hljs/tomorrow-night-eighties' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/tomorrow-night' { +declare module 'react-syntax-highlighter/dist/styles/hljs/tomorrow-night' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/tomorrow' { +declare module 'react-syntax-highlighter/dist/styles/hljs/tomorrow' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/vs' { +declare module 'react-syntax-highlighter/dist/styles/hljs/vs' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/vs2015' { +declare module 'react-syntax-highlighter/dist/styles/hljs/vs2015' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/xcode' { +declare module 'react-syntax-highlighter/dist/styles/hljs/xcode' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/xt256' { +declare module 'react-syntax-highlighter/dist/styles/hljs/xt256' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/hljs/zenburn' { +declare module 'react-syntax-highlighter/dist/styles/hljs/zenburn' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism' { - export { default as atomDark } from 'react-syntax-highlighter/styles/prism/atom-dark'; - export { default as base16AteliersulphurpoolLight } from 'react-syntax-highlighter/styles/prism/base16-ateliersulphurpool.light'; - export { default as cb } from 'react-syntax-highlighter/styles/prism/cb'; - export { default as coy } from 'react-syntax-highlighter/styles/prism/coy'; - export { default as darcula } from 'react-syntax-highlighter/styles/prism/darcula'; - export { default as dark } from 'react-syntax-highlighter/styles/prism/dark'; - export { default as duotoneDark } from 'react-syntax-highlighter/styles/prism/duotone-dark'; - export { default as duotoneEarth } from 'react-syntax-highlighter/styles/prism/duotone-earth'; - export { default as duotoneForest } from 'react-syntax-highlighter/styles/prism/duotone-forest'; - export { default as duotoneLight } from 'react-syntax-highlighter/styles/prism/duotone-light'; - export { default as duotoneSea } from 'react-syntax-highlighter/styles/prism/duotone-sea'; - export { default as duotoneSpace } from 'react-syntax-highlighter/styles/prism/duotone-space'; - export { default as funky } from 'react-syntax-highlighter/styles/prism/funky'; - export { default as ghcolors } from 'react-syntax-highlighter/styles/prism/ghcolors'; - export { default as hopscotch } from 'react-syntax-highlighter/styles/prism/hopscotch'; - export { default as okaidia } from 'react-syntax-highlighter/styles/prism/okaidia'; - export { default as pojoaque } from 'react-syntax-highlighter/styles/prism/pojoaque'; - export { default as prism } from 'react-syntax-highlighter/styles/prism/prism'; - export { default as solarizedlight } from 'react-syntax-highlighter/styles/prism/solarizedlight'; - export { default as tomorrow } from 'react-syntax-highlighter/styles/prism/tomorrow'; - export { default as twilight } from 'react-syntax-highlighter/styles/prism/twilight'; - export { default as vs } from 'react-syntax-highlighter/styles/prism/vs'; - export { default as xonokai } from 'react-syntax-highlighter/styles/prism/xonokai'; +declare module 'react-syntax-highlighter/dist/styles/prism' { + export { default as atomDark } from 'react-syntax-highlighter/dist/styles/prism/atom-dark'; + export { default as base16AteliersulphurpoolLight } from 'react-syntax-highlighter/dist/styles/prism/base16-ateliersulphurpool.light'; + export { default as cb } from 'react-syntax-highlighter/dist/styles/prism/cb'; + export { default as coy } from 'react-syntax-highlighter/dist/styles/prism/coy'; + export { default as darcula } from 'react-syntax-highlighter/dist/styles/prism/darcula'; + export { default as dark } from 'react-syntax-highlighter/dist/styles/prism/dark'; + export { default as duotoneDark } from 'react-syntax-highlighter/dist/styles/prism/duotone-dark'; + export { default as duotoneEarth } from 'react-syntax-highlighter/dist/styles/prism/duotone-earth'; + export { default as duotoneForest } from 'react-syntax-highlighter/dist/styles/prism/duotone-forest'; + export { default as duotoneLight } from 'react-syntax-highlighter/dist/styles/prism/duotone-light'; + export { default as duotoneSea } from 'react-syntax-highlighter/dist/styles/prism/duotone-sea'; + export { default as duotoneSpace } from 'react-syntax-highlighter/dist/styles/prism/duotone-space'; + export { default as funky } from 'react-syntax-highlighter/dist/styles/prism/funky'; + export { default as ghcolors } from 'react-syntax-highlighter/dist/styles/prism/ghcolors'; + export { default as hopscotch } from 'react-syntax-highlighter/dist/styles/prism/hopscotch'; + export { default as okaidia } from 'react-syntax-highlighter/dist/styles/prism/okaidia'; + export { default as pojoaque } from 'react-syntax-highlighter/dist/styles/prism/pojoaque'; + export { default as prism } from 'react-syntax-highlighter/dist/styles/prism/prism'; + export { default as solarizedlight } from 'react-syntax-highlighter/dist/styles/prism/solarizedlight'; + export { default as tomorrow } from 'react-syntax-highlighter/dist/styles/prism/tomorrow'; + export { default as twilight } from 'react-syntax-highlighter/dist/styles/prism/twilight'; + export { default as vs } from 'react-syntax-highlighter/dist/styles/prism/vs'; + export { default as xonokai } from 'react-syntax-highlighter/dist/styles/prism/xonokai'; } -declare module 'react-syntax-highlighter/styles/prism/atom-dark' { +declare module 'react-syntax-highlighter/dist/styles/prism/atom-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/base16-ateliersulphurpool.light' { +declare module 'react-syntax-highlighter/dist/styles/prism/base16-ateliersulphurpool.light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/cb' { +declare module 'react-syntax-highlighter/dist/styles/prism/cb' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/coy' { +declare module 'react-syntax-highlighter/dist/styles/prism/coy' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/darcula' { +declare module 'react-syntax-highlighter/dist/styles/prism/darcula' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/dark' { +declare module 'react-syntax-highlighter/dist/styles/prism/dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/duotone-dark' { +declare module 'react-syntax-highlighter/dist/styles/prism/duotone-dark' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/duotone-earth' { +declare module 'react-syntax-highlighter/dist/styles/prism/duotone-earth' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/duotone-forest' { +declare module 'react-syntax-highlighter/dist/styles/prism/duotone-forest' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/duotone-light' { +declare module 'react-syntax-highlighter/dist/styles/prism/duotone-light' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/duotone-sea' { +declare module 'react-syntax-highlighter/dist/styles/prism/duotone-sea' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/duotone-space' { +declare module 'react-syntax-highlighter/dist/styles/prism/duotone-space' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/funky' { +declare module 'react-syntax-highlighter/dist/styles/prism/funky' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/ghcolors' { +declare module 'react-syntax-highlighter/dist/styles/prism/ghcolors' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/hopscotch' { +declare module 'react-syntax-highlighter/dist/styles/prism/hopscotch' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/okaidia' { +declare module 'react-syntax-highlighter/dist/styles/prism/okaidia' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/pojoaque' { +declare module 'react-syntax-highlighter/dist/styles/prism/pojoaque' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/prism' { +declare module 'react-syntax-highlighter/dist/styles/prism/prism' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/solarizedlight' { +declare module 'react-syntax-highlighter/dist/styles/prism/solarizedlight' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/tomorrow' { +declare module 'react-syntax-highlighter/dist/styles/prism/tomorrow' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/twilight' { +declare module 'react-syntax-highlighter/dist/styles/prism/twilight' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/vs' { +declare module 'react-syntax-highlighter/dist/styles/prism/vs' { const style: any; export default style; } -declare module 'react-syntax-highlighter/styles/prism/xonokai' { +declare module 'react-syntax-highlighter/dist/styles/prism/xonokai' { const style: any; export default style; } diff --git a/types/react-syntax-highlighter/react-syntax-highlighter-tests.tsx b/types/react-syntax-highlighter/react-syntax-highlighter-tests.tsx index c516d9f610..36a55aedc1 100644 --- a/types/react-syntax-highlighter/react-syntax-highlighter-tests.tsx +++ b/types/react-syntax-highlighter/react-syntax-highlighter-tests.tsx @@ -3,8 +3,8 @@ import SyntaxHighlighter from "react-syntax-highlighter"; import PrismSyntaxHighlighter from "react-syntax-highlighter/prism"; import PrismLightHighlighter, { registerLanguage } from "react-syntax-highlighter/prism-light"; import jsx from 'react-syntax-highlighter/languages/prism/jsx'; -import { docco } from "react-syntax-highlighter/styles/hljs"; -import { atomDark } from "react-syntax-highlighter/styles/prism"; +import { docco } from "react-syntax-highlighter/dist/styles/hljs"; +import { atomDark } from "react-syntax-highlighter/dist/styles/prism"; function hljsHighlighter(): JSX.Element { const codeString: string = `class CPP { From 0f73bf3034f5138fec401e9f629ade0124dc8403 Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Fri, 7 Dec 2018 12:13:41 +0100 Subject: [PATCH 156/241] Update method documentation ####Example: => Example: --- types/mongoose/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index ad515a1806..83aaa33b2b 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -2026,7 +2026,7 @@ declare module "mongoose" { * This is handy for integrating with async/await, because `orFail()` saves you * an extra `if` statement to check if no document was found. * - * ####Example: + * Example: * * // Throws if no doc returned * await Model.findOne({ foo: 'bar' }).orFail(); From 9a7b2dc7d0e741a3dde3f816805b7acb89bde49f Mon Sep 17 00:00:00 2001 From: webcarrot Date: Fri, 7 Dec 2018 12:19:47 +0100 Subject: [PATCH 157/241] [mailgun-js] inline and multiple attachments 1. Allow array of `attachment`s in SendData interface. 2. Add `inline` to SendData interface. --- types/mailgun-js/index.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/mailgun-js/index.d.ts b/types/mailgun-js/index.d.ts index 0c6ef0eef3..32af61b68c 100644 --- a/types/mailgun-js/index.d.ts +++ b/types/mailgun-js/index.d.ts @@ -49,6 +49,8 @@ declare namespace Mailgun { contentType?: string; getType(): string; } + + type AttachmentData = string | Buffer | NodeJS.ReadWriteStream | Attachment; interface MailgunExport { new (options: ConstructorParams): Mailgun; @@ -64,7 +66,8 @@ declare namespace Mailgun { subject?: string; text?: string; html?: string; - attachment?: string | Buffer | NodeJS.ReadWriteStream | Attachment; + attachment?: AttachmentData | AttachmentData[]; + inline?: AttachmentData | AttachmentData[]; } interface BatchData extends SendData { From a4e765a77684407f0637e66369be02abb58f5437 Mon Sep 17 00:00:00 2001 From: AlexeyTokmakov Date: Fri, 7 Dec 2018 14:35:30 +0300 Subject: [PATCH 158/241] Update index.d.ts Add Class "Polyline" , Interface "IPolylineOptions" and change IGeoObjectFeature, field takes type "object" . --- types/yandex-maps/index.d.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/types/yandex-maps/index.d.ts b/types/yandex-maps/index.d.ts index 94806b9254..1986a5238c 100644 --- a/types/yandex-maps/index.d.ts +++ b/types/yandex-maps/index.d.ts @@ -2126,7 +2126,7 @@ declare namespace ymaps { } interface IGeoObjectFeature { - geometry?: IGeometry | IGeometryJson; + geometry?: IGeometry | IGeometryJson | object; properties?: IDataManager | object; } @@ -3036,6 +3036,7 @@ declare namespace ymaps { shift(offset: number[]): IShape; } + class Monitor { constructor(dataManager: IDataManager | IOptionManager); add(name: string[] | string, changeCallback: (event: (object | IEvent)) => void, context?: any, params?: any): Monitor; @@ -3044,4 +3045,13 @@ declare namespace ymaps { remove(name: string): Monitor; removeAll(): Monitor; } + + class Polyline extends GeoObject { + constructor(geometry: number[][] | object | ILineStringGeometry, properties: object | IDataManager, options?: IPolylineOptions); + } + + interface IPolylineOptions { + cursor?: string; + [index: string]: any; + } } From 8b4d0980ef3f4e2e54ee0d4eb0d7e9262edab195 Mon Sep 17 00:00:00 2001 From: webcarrot Date: Fri, 7 Dec 2018 12:37:40 +0100 Subject: [PATCH 159/241] [] to ReadonlyArray --- types/mailgun-js/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/mailgun-js/index.d.ts b/types/mailgun-js/index.d.ts index 32af61b68c..a9ea40bc93 100644 --- a/types/mailgun-js/index.d.ts +++ b/types/mailgun-js/index.d.ts @@ -66,8 +66,8 @@ declare namespace Mailgun { subject?: string; text?: string; html?: string; - attachment?: AttachmentData | AttachmentData[]; - inline?: AttachmentData | AttachmentData[]; + attachment?: AttachmentData | ReadonlyArray; + inline?: AttachmentData | ReadonlyArray; } interface BatchData extends SendData { From a7a41699ea7a37bfaf06a323ba3a00f55bbbda86 Mon Sep 17 00:00:00 2001 From: webcarrot Date: Fri, 7 Dec 2018 12:44:26 +0100 Subject: [PATCH 160/241] update tests --- types/mailgun-js/mailgun-js-tests.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/types/mailgun-js/mailgun-js-tests.ts b/types/mailgun-js/mailgun-js-tests.ts index e06e683248..2dc7629050 100644 --- a/types/mailgun-js/mailgun-js-tests.ts +++ b/types/mailgun-js/mailgun-js-tests.ts @@ -25,7 +25,14 @@ const exampleSendData: mailgunFactory.messages.SendData = { attachment: new mailgun.Attachment({ data: "filepath", filename: "my_custom_name.png" - }) + }), + inline: [ + new mailgun.Attachment({ + data: "filepath", + filename: "my_custom_name_2.png" + }), + "my_custom_file_3.png" + ] }; mailgun.messages().send(exampleSendData, (err, body) => {}); From 00bd8dbd716931469e1a357ada78542b50f2aeec Mon Sep 17 00:00:00 2001 From: webcarrot Date: Fri, 7 Dec 2018 12:50:01 +0100 Subject: [PATCH 161/241] add buffer to test --- types/mailgun-js/mailgun-js-tests.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/mailgun-js/mailgun-js-tests.ts b/types/mailgun-js/mailgun-js-tests.ts index 2dc7629050..0d830308d1 100644 --- a/types/mailgun-js/mailgun-js-tests.ts +++ b/types/mailgun-js/mailgun-js-tests.ts @@ -31,7 +31,8 @@ const exampleSendData: mailgunFactory.messages.SendData = { data: "filepath", filename: "my_custom_name_2.png" }), - "my_custom_file_3.png" + "my_custom_file_3.png", + Buffer.from("plain text") ] }; From 7f3016822d1107d9b565ddc55f279f6431b790fa Mon Sep 17 00:00:00 2001 From: webcarrot Date: Fri, 7 Dec 2018 12:50:40 +0100 Subject: [PATCH 162/241] remove spaces --- types/mailgun-js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mailgun-js/index.d.ts b/types/mailgun-js/index.d.ts index a9ea40bc93..7c6284059e 100644 --- a/types/mailgun-js/index.d.ts +++ b/types/mailgun-js/index.d.ts @@ -49,7 +49,7 @@ declare namespace Mailgun { contentType?: string; getType(): string; } - + type AttachmentData = string | Buffer | NodeJS.ReadWriteStream | Attachment; interface MailgunExport { From c9b217ba146aeaacb33ce9340a6d36446bb0a064 Mon Sep 17 00:00:00 2001 From: Ilia Beliaev Date: Fri, 7 Dec 2018 14:52:26 +0300 Subject: [PATCH 163/241] Added missing options. --- types/pretty-ms/index.d.ts | 6 +++++- types/pretty-ms/pretty-ms-tests.ts | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/types/pretty-ms/index.d.ts b/types/pretty-ms/index.d.ts index b1e151cd65..ca9bf663e2 100644 --- a/types/pretty-ms/index.d.ts +++ b/types/pretty-ms/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for pretty-ms 3.2 +// Type definitions for pretty-ms 4.0 // Project: https://github.com/sindresorhus/pretty-ms#readme // Definitions by: BendingBender // ocboogie +// silh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = prettyMs; @@ -14,6 +15,9 @@ declare namespace prettyMs { msDecimalDigits?: number; keepDecimalsOnWholeSeconds?: boolean; compact?: boolean; + unitCount?: number; verbose?: boolean; + separateMs?: boolean; + formatSubMs?: boolean; } } diff --git a/types/pretty-ms/pretty-ms-tests.ts b/types/pretty-ms/pretty-ms-tests.ts index ae5e8120b2..bb5e8a69ec 100644 --- a/types/pretty-ms/pretty-ms-tests.ts +++ b/types/pretty-ms/pretty-ms-tests.ts @@ -7,4 +7,7 @@ str = prettyMs(1335669000, {verbose: true}); str = prettyMs(1335669000, {keepDecimalsOnWholeSeconds: true}); str = prettyMs(1335669000, {secDecimalDigits: 1}); str = prettyMs(1335669000, {msDecimalDigits: 2}); +str = prettyMs(1335669000, {unitCount: 2}); +str = prettyMs(1335669000, {separateMs: true}); +str = prettyMs(1335669000, {formatSubMs: true}); str = prettyMs(new Date(2014, 0, 1, 10, 40).getTime() - new Date(2014, 0, 1, 10, 5).getTime()); From 633d626edbb517d9fd8fd80c2c4a45f2331eec95 Mon Sep 17 00:00:00 2001 From: AlexeyTokmakov Date: Fri, 7 Dec 2018 15:04:14 +0300 Subject: [PATCH 164/241] Update index.d.ts --- types/yandex-maps/index.d.ts | 4112 +++++++++++++++++----------------- 1 file changed, 2056 insertions(+), 2056 deletions(-) diff --git a/types/yandex-maps/index.d.ts b/types/yandex-maps/index.d.ts index 1986a5238c..e7078b4b28 100644 --- a/types/yandex-maps/index.d.ts +++ b/types/yandex-maps/index.d.ts @@ -5,3053 +5,3053 @@ // TypeScript Version: 2.4 declare namespace ymaps { - interface IClassConstructor { - new (): T; - } + interface IClassConstructor { + new(): T; + } - type ControlSingleKey = "fullscreenControl" | "geolocationControl" | "routeEditor" | "rulerControl" | "searchControl" | "trafficControl" | "typeSelector" | "zoomControl"; - type ControlSetKey = "smallMapDefaultSet" | "mediumMapDefaultSet" | "largeMapDefaultSet" | "default"; - type ControlKey = ControlSingleKey | ControlSetKey; + type ControlSingleKey = "fullscreenControl" | "geolocationControl" | "routeEditor" | "rulerControl" | "searchControl" | "trafficControl" | "typeSelector" | "zoomControl"; + type ControlSetKey = "smallMapDefaultSet" | "mediumMapDefaultSet" | "largeMapDefaultSet" | "default"; + type ControlKey = ControlSingleKey | ControlSetKey; - type OverlayKey = - "default#placemark" | "default#pin" | "default#circle" | "default#rectangle" | "default#polyline" | "default#polygon" | - "hotspot#placemark" | "hotspot#circle" | "hotspot#rectangle" | "hotspot#polyline" | "hotspot#polygon" | "html#balloon" | "html#hint" | - "html#placemark" | "html#rectangle" | - string | IClassConstructor | ((geometry: IPixelLineStringGeometry, - data: IDataManager | object, - options: object) => Promise>); - type InteractivityModelKey = "default#opaque" | "default#geoObject" | "default#layer" | "default#transparent" | "default#silent" | string; + type OverlayKey = + "default#placemark" | "default#pin" | "default#circle" | "default#rectangle" | "default#polyline" | "default#polygon" | + "hotspot#placemark" | "hotspot#circle" | "hotspot#rectangle" | "hotspot#polyline" | "hotspot#polygon" | "html#balloon" | "html#hint" | + "html#placemark" | "html#rectangle" | + string | IClassConstructor | ((geometry: IPixelLineStringGeometry, + data: IDataManager | object, + options: object) => Promise>); + type InteractivityModelKey = "default#opaque" | "default#geoObject" | "default#layer" | "default#transparent" | "default#silent" | string; - type PresetKey = string; //option.presetStorage - //[number, number] - //[[number, number], [number, number]] + type PresetKey = string; //option.presetStorage + //[number, number] + //[[number, number], [number, number]] - namespace behavior { - class DblClickZoom implements IBehavior { - constructor(options?: IDblClickZoomOptions); + namespace behavior { + class DblClickZoom implements IBehavior { + constructor(options?: IDblClickZoomOptions); - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - getParent(): IControlParent | null; + getParent(): IControlParent | null; - setParent(parent: IControlParent): this; - } + setParent(parent: IControlParent): this; + } - interface IDblClickZoomOptions extends IMapMarginOptions { - centering?: boolean; - duration?: number; - } + interface IDblClickZoomOptions extends IMapMarginOptions { + centering?: boolean; + duration?: number; + } - class Drag implements IBehavior { - constructor(options?: IDragOptions) + class Drag implements IBehavior { + constructor(options?: IDragOptions) - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; - } + setParent(parent: IControlParent): this; + } - interface IDragOptions { - actionCursor?: string; - cursor?: string; - inertia?: boolean; - inertiaDuration?: number; - tremor?: number; - } + interface IDragOptions { + actionCursor?: string; + cursor?: string; + inertia?: boolean; + inertiaDuration?: number; + tremor?: number; + } - class LeftMouseButtonMagnifier implements IBehavior { - constructor(options?: ILeftMouseButtonMagnifierOptions) + class LeftMouseButtonMagnifier implements IBehavior { + constructor(options?: ILeftMouseButtonMagnifierOptions) - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; - } + setParent(parent: IControlParent): this; + } - interface ILeftMouseButtonMagnifierOptions { - actionCursor?: string; - cursor?: string; - duration?: number; - } + interface ILeftMouseButtonMagnifierOptions { + actionCursor?: string; + cursor?: string; + duration?: number; + } - class MultiTouch implements IBehavior { - constructor(options?: IMultiTouchOptions) + class MultiTouch implements IBehavior { + constructor(options?: IMultiTouchOptions) - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; - } + setParent(parent: IControlParent): this; + } - interface IMultiTouchOptions { - tremor?: number; - } + interface IMultiTouchOptions { + tremor?: number; + } - class RightMouseButtonMagnifier implements IBehavior { - constructor(options?: IRightMouseButtonMagnifierOptions) + class RightMouseButtonMagnifier implements IBehavior { + constructor(options?: IRightMouseButtonMagnifierOptions) - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; - } + setParent(parent: IControlParent): this; + } - interface IRightMouseButtonMagnifierOptions { - actionCursor?: string; - duration?: number; - } + interface IRightMouseButtonMagnifierOptions { + actionCursor?: string; + duration?: number; + } - class RouteEditor implements IBehavior { - events: IEventManager; - options: IOptionManager; + class RouteEditor implements IBehavior { + events: IEventManager; + options: IOptionManager; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - getRoute(): router.Route; + getRoute(): router.Route; - getState(): string; + getState(): string; - setState(state: string | null): void; - } + setState(state: string | null): void; + } - class Ruler implements IBehavior { - constructor(options?: IRulerOptions) + class Ruler implements IBehavior { + constructor(options?: IRulerOptions) - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - close(): boolean; + close(): boolean; - getState(): string; + getState(): string; - setState(state: string | null): void; - } + setState(state: string | null): void; + } - interface IRulerOptions { - balloonAutoPan?: boolean; - } + interface IRulerOptions { + balloonAutoPan?: boolean; + } - class ScrollZoom implements IBehavior { - constructor(options?: IScrollZoomOptions) + class ScrollZoom implements IBehavior { + constructor(options?: IScrollZoomOptions) - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; - } + setParent(parent: IControlParent): this; + } - interface IScrollZoomOptions { - maximumDelta?: number; - speed?: number; - } + interface IScrollZoomOptions { + maximumDelta?: number; + speed?: number; + } - const storage: util.Storage; - } + const storage: util.Storage; + } - namespace clusterer { - class Balloon implements IBalloonManager { //tslint:disable-line no-shadowed-variable - constructor(clusterer: Clusterer); + namespace clusterer { + class Balloon implements IBalloonManager { //tslint:disable-line no-shadowed-variable + constructor(clusterer: Clusterer); - events: IEventManager; + events: IEventManager; - autoPan(): Promise; + autoPan(): Promise; - close(force?: boolean): Promise; + close(force?: boolean): Promise; - destroy(): void; + destroy(): void; - getData(): object | null; + getData(): object | null; - getOptions(): IOptionManager | null; + getOptions(): IOptionManager | null; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getPosition(): number[] | null; + getPosition(): number[] | null; - isOpen(): boolean; + isOpen(): boolean; - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - setData(data: object | string | HTMLElement): Promise; + setData(data: object | string | HTMLElement): Promise; - setOptions(options: object): Promise; + setOptions(options: object): Promise; - setPosition(position: number[]): Promise; - } + setPosition(position: number[]): Promise; + } - class Hint implements IHintManager { - constructor(clusterer: Clusterer); + class Hint implements IHintManager { + constructor(clusterer: Clusterer); - events: IEventManager; + events: IEventManager; - close(force?: boolean): Promise; + close(force?: boolean): Promise; - destroy(): void; + destroy(): void; - getData(): object | null; + getData(): object | null; - getOptions(): IOptionManager | null; + getOptions(): IOptionManager | null; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getPosition(): number[] | null; + getPosition(): number[] | null; - isOpen(): boolean; + isOpen(): boolean; - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - setData(data: object | string | HTMLElement): Promise; + setData(data: object | string | HTMLElement): Promise; - setOptions(options: object): Promise; + setOptions(options: object): Promise; - setPosition(position: number[]): Promise; - } - } + setPosition(position: number[]): Promise; + } + } - namespace collection { - class Item implements IChildOnMap, ICustomizable, IEventEmitter, IParentOnMap { - constructor(options?: object); + namespace collection { + class Item implements IChildOnMap, ICustomizable, IEventEmitter, IParentOnMap { + constructor(options?: object); - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - getMap(): Map; + getMap(): Map; - onAddToMap(map: Map): void; + onAddToMap(map: Map): void; - onRemoveFromMap(oldMap: Map): void; - } - } + onRemoveFromMap(oldMap: Map): void; + } + } - namespace control { - class Button implements ICustomizable, ISelectableControl { - constructor(parameters?: IButtonParameters | string); + namespace control { + class Button implements ICustomizable, ISelectableControl { + constructor(parameters?: IButtonParameters | string); - options: IOptionManager; - events: IEventManager; - data: data.Manager; - state: data.Manager; + options: IOptionManager; + events: IEventManager; + data: data.Manager; + state: data.Manager; - deselect(): void; + deselect(): void; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - isSelected(): boolean; + isSelected(): boolean; - select(): void; + select(): void; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; - } + setParent(parent: IControlParent): this; + } - interface IBaseButtonParametersOptions { - adjustMapMargin?: boolean; - float?: "none" | "left" | "right"; - floatIndex?: number; - layout?: IClassConstructor | string; - maxWidth?: number[][] | number[] | number; - position?: { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; - }; - visible?: boolean; - } + interface IBaseButtonParametersOptions { + adjustMapMargin?: boolean; + float?: "none" | "left" | "right"; + floatIndex?: number; + layout?: IClassConstructor | string; + maxWidth?: number[][] | number[] | number; + position?: { + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; + }; + visible?: boolean; + } - interface IButtonParameters { - data?: { - content?: string; - image?: string; - title?: string; - }; - options?: IBaseButtonParametersOptions & { - selectOnClick?: boolean; - size?: "auto" | "small" | "medium" | "large"; - }; - state?: { - enabled?: boolean; - selected?: boolean; - }; - } + interface IButtonParameters { + data?: { + content?: string; + image?: string; + title?: string; + }; + options?: IBaseButtonParametersOptions & { + selectOnClick?: boolean; + size?: "auto" | "small" | "medium" | "large"; + }; + state?: { + enabled?: boolean; + selected?: boolean; + }; + } - class FullscreenControl extends Button { - constructor(parameters?: IFullscreenControlParameters); + class FullscreenControl extends Button { + constructor(parameters?: IFullscreenControlParameters); - enterFullscreen(): void; + enterFullscreen(): void; - exitFullscreen(): void; - } + exitFullscreen(): void; + } - interface IFullscreenControlParameters { - data?: { - title?: string; - }; - options?: IBaseButtonParametersOptions & { - collapseOnBlur?: boolean; - expandOnClick?: boolean; - popupFloat?: "left" | "right"; - }; - state?: { - expanded?: boolean; - }; - } + interface IFullscreenControlParameters { + data?: { + title?: string; + }; + options?: IBaseButtonParametersOptions & { + collapseOnBlur?: boolean; + expandOnClick?: boolean; + popupFloat?: "left" | "right"; + }; + state?: { + expanded?: boolean; + }; + } - class GeolocationControl extends Button { - constructor(parameters?: IGeolocationControlParameters); - } + class GeolocationControl extends Button { + constructor(parameters?: IGeolocationControlParameters); + } - interface IGeolocationControlParameters extends IButtonParameters { - data?: { - image?: string; - title?: string; - }; - options?: IBaseButtonParametersOptions; - } + interface IGeolocationControlParameters extends IButtonParameters { + data?: { + image?: string; + title?: string; + }; + options?: IBaseButtonParametersOptions; + } - class ListBox implements ICollection, IControl, ICustomizable { - constructor(parameters?: IListBoxParameters); + class ListBox implements ICollection, IControl, ICustomizable { + constructor(parameters?: IListBoxParameters); - events: IEventManager; - options: IOptionManager; - data: data.Manager; - state: data.Manager; + events: IEventManager; + options: IOptionManager; + data: data.Manager; + state: data.Manager; - add(object: object): this; + add(object: object): this; - getIterator(): IIterator; + getIterator(): IIterator; - remove(object: object): this; + remove(object: object): this; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; - } + setParent(parent: IControlParent): this; + } - interface IListBoxParameters extends IButtonParameters { - options?: IBaseButtonParametersOptions & { - noPlacemark?: boolean; - }; - } - - class ListBoxItem implements ICustomizable, ISelectableControl { - constructor(parameters?: IListBoxItemParameters); - - options: IOptionManager; - events: IEventManager; - data: data.Manager; - state: data.Manager; - - deselect(): void; - - disable(): void; - - enable(): void; - - isEnabled(): boolean; - - isSelected(): boolean; - - select(): void; - - getParent(): null | IControlParent; - - setParent(parent: IControlParent): this; - - getMap(): Map; - } - - interface IListBoxItemParameters { - data?: { - content?: string; - }; - options?: { - layout?: string | IClassConstructor; - selectableLayout?: string | IClassConstructor; - selectOnClick?: boolean; - separatorLayout?: string | IClassConstructor; - type?: "selectable" | "separator"; - visible?: boolean; - }; - state?: { - selected?: boolean; - }; - } - - class Manager { - constructor(map: Map, controls?: Array, options?: IManagerOptions); - - events: event.Manager; - options: option.Manager; - state: data.Manager; - - add(control: IControl | ControlKey, options?: IManagerControlOptions): this; - - each(callback: (control: IControl) => void, context: object): this; - - get(index: number | string): IControl | null; - - getChildElement(control: IControl): Promise; - - getContainer(): HTMLElement; - - getMap(): Map; - - indexOf(childToFind: IControl | string): number; - - remove(control: IControl | string): this; - } - - interface IManagerOptions { - margin?: number; - pane?: IPane; - states?: string[]; - } + interface IListBoxParameters extends IButtonParameters { + options?: IBaseButtonParametersOptions & { + noPlacemark?: boolean; + }; + } + + class ListBoxItem implements ICustomizable, ISelectableControl { + constructor(parameters?: IListBoxItemParameters); + + options: IOptionManager; + events: IEventManager; + data: data.Manager; + state: data.Manager; + + deselect(): void; + + disable(): void; + + enable(): void; + + isEnabled(): boolean; + + isSelected(): boolean; + + select(): void; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + getMap(): Map; + } + + interface IListBoxItemParameters { + data?: { + content?: string; + }; + options?: { + layout?: string | IClassConstructor; + selectableLayout?: string | IClassConstructor; + selectOnClick?: boolean; + separatorLayout?: string | IClassConstructor; + type?: "selectable" | "separator"; + visible?: boolean; + }; + state?: { + selected?: boolean; + }; + } + + class Manager { + constructor(map: Map, controls?: Array, options?: IManagerOptions); + + events: event.Manager; + options: option.Manager; + state: data.Manager; + + add(control: IControl | ControlKey, options?: IManagerControlOptions): this; + + each(callback: (control: IControl) => void, context: object): this; + + get(index: number | string): IControl | null; + + getChildElement(control: IControl): Promise; + + getContainer(): HTMLElement; + + getMap(): Map; + + indexOf(childToFind: IControl | string): number; + + remove(control: IControl | string): this; + } + + interface IManagerOptions { + margin?: number; + pane?: IPane; + states?: string[]; + } - interface IManagerControlOptions { - float?: "none" | "left" | "right"; - floatIndex?: number; - position?: { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; - }; - } + interface IManagerControlOptions { + float?: "none" | "left" | "right"; + floatIndex?: number; + position?: { + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; + }; + } - class RouteButton implements IControl, ICustomizable { - constructor(parameters?: IRouteButtonParameters); + class RouteButton implements IControl, ICustomizable { + constructor(parameters?: IRouteButtonParameters); - events: IEventManager; - options: IOptionManager; - routePanel: IRoutePanel; + events: IEventManager; + options: IOptionManager; + routePanel: IRoutePanel; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; - } + setParent(parent: IControlParent): this; + } - interface IRouteButtonParameters { - options?: { - adjustMapMargin?: boolean; - collapseOnBlur?: boolean; - float?: "none" | "left" | "right"; - floatIndex?: number; - popupAnimate?: boolean; - popupFloat?: "auto" | "left" | "right"; - popupWidth?: string; - position?: { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; - }; - size?: "auto" | "small" | "medium" | "large"; - visible?: boolean; - }; - state?: { - expanded?: boolean; - }; - } - - class RouteEditor extends Button { - constructor(parameters?: IRouteEditorParameters); - - getRoute(): router.Route; - } - - interface IRouteEditorParameters { - data?: { - image?: string; - title?: string; - }; - options?: IBaseButtonParametersOptions; - state?: {}; - } - - class RulerControl extends Button { - constructor(parameters?: IRulerControlParameters); - } - - interface IRulerControlParameters { - data?: {}; - options?: { - adjustMapMargin?: boolean; - position?: { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; - }; - scaleLine?: boolean; - visible?: boolean; - }; - state?: {}; - } - - class SearchControl implements IControl, ICustomizable { - constructor(parameters?: ISearchControlParameters); - - events: IEventManager; - options: IOptionManager; - state: data.Manager; - - getParent(): null | IControlParent; - - setParent(parent: IControlParent): this; - - clear(): void; - - getMap(): Map; - - getRequestString(): string; - - getResponseMetaData(): object; - - getResult(index: number): Promise; - - getResultsArray(): object[]; - - getResultsCount(): number; + interface IRouteButtonParameters { + options?: { + adjustMapMargin?: boolean; + collapseOnBlur?: boolean; + float?: "none" | "left" | "right"; + floatIndex?: number; + popupAnimate?: boolean; + popupFloat?: "auto" | "left" | "right"; + popupWidth?: string; + position?: { + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; + }; + size?: "auto" | "small" | "medium" | "large"; + visible?: boolean; + }; + state?: { + expanded?: boolean; + }; + } + + class RouteEditor extends Button { + constructor(parameters?: IRouteEditorParameters); + + getRoute(): router.Route; + } + + interface IRouteEditorParameters { + data?: { + image?: string; + title?: string; + }; + options?: IBaseButtonParametersOptions; + state?: {}; + } + + class RulerControl extends Button { + constructor(parameters?: IRulerControlParameters); + } + + interface IRulerControlParameters { + data?: {}; + options?: { + adjustMapMargin?: boolean; + position?: { + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; + }; + scaleLine?: boolean; + visible?: boolean; + }; + state?: {}; + } + + class SearchControl implements IControl, ICustomizable { + constructor(parameters?: ISearchControlParameters); + + events: IEventManager; + options: IOptionManager; + state: data.Manager; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + clear(): void; + + getMap(): Map; + + getRequestString(): string; + + getResponseMetaData(): object; + + getResult(index: number): Promise; + + getResultsArray(): object[]; + + getResultsCount(): number; - getSelectedIndex(): number; + getSelectedIndex(): number; - hideResult(): void; + hideResult(): void; - search(request: string): Promise; + search(request: string): Promise; - showResult(index: number): this; - } + showResult(index: number): this; + } - interface ISearchControlParameters { - data?: {}; - options?: { - adjustMapMargin?: boolean; - boundedBy?: number[][]; - fitMaxWidth?: boolean; - float?: "none" | "left" | "right"; - floatIndex?: number; - formLayout?: string | IClassConstructor; - kind?: "house" | "street" | "metro" | "district" | "locality"; - layout?: string | IClassConstructor; - maxWidth?: number[][] | number[] | number; - noCentering?: boolean; - noPlacemark?: boolean; - noPopup?: boolean; - noSelect?: boolean; - noSuggestPanel?: boolean; - placeholderContent?: string; - popupItemLayout?: string | IClassConstructor; - popupLayout?: string | IClassConstructor; - position?: { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; - }; - provider?: IGeocodeProvider | "yandex#map" | "yandex#search"; - searchCoordOrder?: "latlong" | "longlat"; - size?: "auto" | "small" | "medium" | "large"; - strictBounds?: boolean; - suppressYandexSearch?: boolean; - useMapBounds?: boolean; - zoomMargin?: number; - visible?: boolean; - }; - state?: {}; - } - } + interface ISearchControlParameters { + data?: {}; + options?: { + adjustMapMargin?: boolean; + boundedBy?: number[][]; + fitMaxWidth?: boolean; + float?: "none" | "left" | "right"; + floatIndex?: number; + formLayout?: string | IClassConstructor; + kind?: "house" | "street" | "metro" | "district" | "locality"; + layout?: string | IClassConstructor; + maxWidth?: number[][] | number[] | number; + noCentering?: boolean; + noPlacemark?: boolean; + noPopup?: boolean; + noSelect?: boolean; + noSuggestPanel?: boolean; + placeholderContent?: string; + popupItemLayout?: string | IClassConstructor; + popupLayout?: string | IClassConstructor; + position?: { + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; + }; + provider?: IGeocodeProvider | "yandex#map" | "yandex#search"; + searchCoordOrder?: "latlong" | "longlat"; + size?: "auto" | "small" | "medium" | "large"; + strictBounds?: boolean; + suppressYandexSearch?: boolean; + useMapBounds?: boolean; + zoomMargin?: number; + visible?: boolean; + }; + state?: {}; + } + } - namespace data { - class Manager implements IDataManager, IFreezable { - constructor(data?: object); + namespace data { + class Manager implements IDataManager, IFreezable { + constructor(data?: object); - events: IEventManager; + events: IEventManager; - get(path: string, defaultValue: object): object; + get(path: string, defaultValue: object): object; - getAll(): object; + getAll(): object; - set(path: object | string, value: object): this; + set(path: object | string, value: object): this; - setAll(): this; + setAll(): this; - unset(path: object | string): this; + unset(path: object | string): this; - unsetAll(): this; + unsetAll(): this; - freeze(): IFreezable; + freeze(): IFreezable; - isFrozen(): boolean; + isFrozen(): boolean; - unfreeze(): IFreezable; + unfreeze(): IFreezable; - add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - getParent(): IEventManager | null; + getParent(): IEventManager | null; - group(): IEventGroup; + group(): IEventGroup; - remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - setParent(parent: IEventManager | null): this; + setParent(parent: IEventManager | null): this; - fire(type: string, eventobject: object | IEvent): this; - } - } + fire(type: string, eventobject: object | IEvent): this; + } + } - namespace event { - class Manager implements IEventManager { - constructor(params?: { context?: object; controllers?: IEventWorkflowController[]; parent?: IEventManager }); + namespace event { + class Manager implements IEventManager { + constructor(params?: { context?: object; controllers?: IEventWorkflowController[]; parent?: IEventManager }); - add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - getParent(): IEventManager | null; + getParent(): IEventManager | null; - group(): IEventGroup; + group(): IEventGroup; - remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - setParent(parent: IEventManager | null): this; + setParent(parent: IEventManager | null): this; - fire(type: string, eventobject: object | IEvent): this; + fire(type: string, eventobject: object | IEvent): this; - createEventobject(type: string, event: object, target: object): Event; + createEventobject(type: string, event: object, target: object): Event; - once(types: string[][] | string[] | string, callback: (event: IEvent) => any, context?: object, priority?: number): this; - } - } + once(types: string[][] | string[] | string, callback: (event: IEvent) => any, context?: object, priority?: number): this; + } + } - namespace geometry { - namespace base { - class LineString implements IBaseLineStringGeometry { //tslint:disable-line no-shadowed-variable - static fromEncodedCoordinates(encodedCoordinates: string): geometry.LineString; //tslint:disable-line function-name + namespace geometry { + namespace base { + class LineString implements IBaseLineStringGeometry { //tslint:disable-line no-shadowed-variable + static fromEncodedCoordinates(encodedCoordinates: string): geometry.LineString; //tslint:disable-line function-name - static toEncodedCoordinates(geometry: geometry.LineString): string; //tslint:disable-line function-name + static toEncodedCoordinates(geometry: geometry.LineString): string; //tslint:disable-line function-name - events: IEventManager; + events: IEventManager; - getBounds(): number[][] | null; + getBounds(): number[][] | null; - getType(): string; + getType(): string; - get(index: number): number[]; + get(index: number): number[]; - getChildGeometry(index: number): IPointGeometryAccess; + getChildGeometry(index: number): IPointGeometryAccess; - getClosest(anchorPosition: number[]): object; + getClosest(anchorPosition: number[]): object; - getCoordinates(): number[][]; + getCoordinates(): number[][]; - getLength(): number; + getLength(): number; - insert(index: number, coordinates: number[][]): ILineStringGeometryAccess; + insert(index: number, coordinates: number[][]): ILineStringGeometryAccess; - remove(index: number): number[]; + remove(index: number): number[]; - remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - set(index: number, coordinates: number[]): ILineStringGeometryAccess; + set(index: number, coordinates: number[]): ILineStringGeometryAccess; - setCoordinates(coordinates: number[]): ILineStringGeometryAccess; + setCoordinates(coordinates: number[]): ILineStringGeometryAccess; - splice(index: number, length: number): number[][]; + splice(index: number, length: number): number[][]; - freeze(): IFreezable; + freeze(): IFreezable; - isFrozen(): boolean; + isFrozen(): boolean; - unfreeze(): IFreezable; + unfreeze(): IFreezable; - add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - getParent(): object | null; + getParent(): object | null; - group(): IEventGroup; + group(): IEventGroup; - setParent(parent: IEventManager | null): this; + setParent(parent: IEventManager | null): this; - fire(type: string, eventobject: object | IEvent): this; - } + fire(type: string, eventobject: object | IEvent): this; + } - class Point implements IBasePointGeometry { //tslint:disable-line no-shadowed-variable - events: IEventManager; + class Point implements IBasePointGeometry { //tslint:disable-line no-shadowed-variable + events: IEventManager; - getBounds(): number[][] | null; + getBounds(): number[][] | null; - getType(): string; + getType(): string; - getCoordinates(): number[] | null; + getCoordinates(): number[] | null; - setCoordinates(coordinates: number[] | null): this; - } - } + setCoordinates(coordinates: number[] | null): this; + } + } - class LineString implements ILineStringGeometry { - constructor(coordinates?: number[][], options?: { - coordRendering?: "shortestPath" | "straightPath"; - geodesic?: boolean; - pixelRendering?: "jumpy" | "static"; - projection?: IProjection; - simplification?: boolean; - }); + class LineString implements ILineStringGeometry { + constructor(coordinates?: number[][], options?: { + coordRendering?: "shortestPath" | "straightPath"; + geodesic?: boolean; + pixelRendering?: "jumpy" | "static"; + projection?: IProjection; + simplification?: boolean; + }); - static fromEncodedCoordinates(encodedCoordinates: string): LineString; //tslint:disable-line function-name + static fromEncodedCoordinates(encodedCoordinates: string): LineString; //tslint:disable-line function-name - static toEncodedCoordinates(geometry: LineString): string; //tslint:disable-line function-name + static toEncodedCoordinates(geometry: LineString): string; //tslint:disable-line function-name - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - getMap(): Map | null; + getMap(): Map | null; - getPixelGeometry(options?: object): IPixelGeometry; + getPixelGeometry(options?: object): IPixelGeometry; - setMap(map: Map): void; + setMap(map: Map): void; - getBounds(): number[][] | null; + getBounds(): number[][] | null; - getType(): string; + getType(): string; - get(index: number): number[]; + get(index: number): number[]; - getChildGeometry(index: number): IPointGeometryAccess; + getChildGeometry(index: number): IPointGeometryAccess; - getClosest(anchorPosition: number[]): object; + getClosest(anchorPosition: number[]): object; - getCoordinates(): number[][]; + getCoordinates(): number[][]; - getLength(): number; + getLength(): number; - insert(index: number, coordinates: number[][]): ILineStringGeometryAccess; + insert(index: number, coordinates: number[][]): ILineStringGeometryAccess; - remove(index: number): number[]; + remove(index: number): number[]; - remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - set(index: number, coordinates: number[]): ILineStringGeometryAccess; + set(index: number, coordinates: number[]): ILineStringGeometryAccess; - setCoordinates(coordinates: number[]): ILineStringGeometryAccess; + setCoordinates(coordinates: number[]): ILineStringGeometryAccess; - splice(index: number, length: number): number[][]; + splice(index: number, length: number): number[][]; - freeze(): IFreezable; + freeze(): IFreezable; - isFrozen(): boolean; + isFrozen(): boolean; - unfreeze(): IFreezable; + unfreeze(): IFreezable; - add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - getParent(): object | null; + getParent(): object | null; - group(): IEventGroup; + group(): IEventGroup; - setParent(parent: IEventManager | null): this; + setParent(parent: IEventManager | null): this; - fire(type: string, eventobject: object | IEvent): this; - } + fire(type: string, eventobject: object | IEvent): this; + } - class Point implements IPointGeometry { - constructor(coordinates?: number[] | null); + class Point implements IPointGeometry { + constructor(coordinates?: number[] | null); - options: IOptionManager; - events: IEventManager; + options: IOptionManager; + events: IEventManager; - getMap(): Map | null; + getMap(): Map | null; - getPixelGeometry(options?: object): IPixelGeometry; + getPixelGeometry(options?: object): IPixelGeometry; - setMap(map: Map): void; + setMap(map: Map): void; - getBounds(): number[][] | null; + getBounds(): number[][] | null; - getType(): string; + getType(): string; - getCoordinates(): number[] | null; + getCoordinates(): number[] | null; - setCoordinates(coordinates: number[] | null): this; - } - } + setCoordinates(coordinates: number[] | null): this; + } + } - namespace geoObject { - class Balloon implements IBalloonManager { //tslint:disable-line no-shadowed-variable - constructor(geoObject: GeoObject); + namespace geoObject { + class Balloon implements IBalloonManager { //tslint:disable-line no-shadowed-variable + constructor(geoObject: GeoObject); - events: IEventManager; + events: IEventManager; - autoPan(): Promise; + autoPan(): Promise; - close(force?: boolean): Promise; + close(force?: boolean): Promise; - destroy(): void; + destroy(): void; - getData(): object | null; + getData(): object | null; - getOptions(): IOptionManager | null; + getOptions(): IOptionManager | null; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getPosition(): number[] | null; + getPosition(): number[] | null; - isOpen(): boolean; + isOpen(): boolean; - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - setData(data: object | string | HTMLElement): Promise; + setData(data: object | string | HTMLElement): Promise; - setOptions(options: object): Promise; + setOptions(options: object): Promise; - setPosition(position: number[]): Promise; - } + setPosition(position: number[]): Promise; + } - class Hint implements IHintManager { - constructor(geoObject: GeoObject); + class Hint implements IHintManager { + constructor(geoObject: GeoObject); - events: IEventManager; + events: IEventManager; - close(force?: boolean): Promise; + close(force?: boolean): Promise; - destroy(): void; + destroy(): void; - getData(): object | null; + getData(): object | null; - getOptions(): IOptionManager | null; + getOptions(): IOptionManager | null; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getPosition(): number[] | null; + getPosition(): number[] | null; - isOpen(): boolean; + isOpen(): boolean; - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - setData(data: object | string | HTMLElement): Promise; + setData(data: object | string | HTMLElement): Promise; - setOptions(options: object): Promise; + setOptions(options: object): Promise; - setPosition(position: number[]): Promise; - } + setPosition(position: number[]): Promise; + } - class Sequence implements IGeoObject, IGeoObjectSequence { - constructor(geoObject: GeoObject); + class Sequence implements IGeoObject, IGeoObjectSequence { + constructor(geoObject: GeoObject); - geometry: IGeometry | null; - properties: IDataManager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; + geometry: IGeometry | null; + properties: IDataManager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - getMap(): Map; + getMap(): Map; - each(callback: (geoObject: IGeoObject) => void, context?: object): void; + each(callback: (geoObject: IGeoObject) => void, context?: object): void; - get(index: number): IGeoObject; + get(index: number): IGeoObject; - getBounds(): number[][] | null; + getBounds(): number[][] | null; - getIterator(): IIterator; + getIterator(): IIterator; - getLength(): number; + getLength(): number; - getPixelBounds(): number[][] | null; + getPixelBounds(): number[][] | null; - indexOf(geoObject: IGeoObject): number; - } - } + indexOf(geoObject: IGeoObject): number; + } + } - namespace layout { - namespace templateBased { - class Base implements ILayout { - constructor(data: object); + namespace layout { + namespace templateBased { + class Base implements ILayout { + constructor(data: object); - events: IEventManager; + events: IEventManager; - destroy(): void; + destroy(): void; - getData(): object; + getData(): object; - getParentElement(): HTMLElement; + getParentElement(): HTMLElement; - getShape(): IShape | null; + getShape(): IShape | null; - isEmpty(): boolean; + isEmpty(): boolean; - setData(data: object): void; + setData(data: object): void; - setParentElement(parent: HTMLElement | null): this; + setParentElement(parent: HTMLElement | null): this; - build(): void; + build(): void; - clear(): void; + clear(): void; - onSublayoutSizeChange(sublayoutInfo: object, nodeSizeByContent: object): void; + onSublayoutSizeChange(sublayoutInfo: object, nodeSizeByContent: object): void; - rebuild(): void; - } - } - } + rebuild(): void; + } + } + } - namespace map { - namespace action { - class Manager implements IEventEmitter { - constructor(map: Map); + namespace map { + namespace action { + class Manager implements IEventEmitter { + constructor(map: Map); - events: IEventManager; + events: IEventManager; - breakTick(): void; + breakTick(): void; - execute(action: IMapAction): void; + execute(action: IMapAction): void; - getCurrentState(): object; + getCurrentState(): object; - getMap(): Map; + getMap(): Map; - setCorrection(userFunction: () => void): void; + setCorrection(userFunction: () => void): void; - stop(): void; - } - } + stop(): void; + } + } - namespace behavior { // tslint:disable-line no-shadowed-variable - class Manager implements ICustomizable, IEventEmitter, IParentOnMap { - constructor(map: Map, behaviors?: string[][] | string[], options?: object); + namespace behavior { // tslint:disable-line no-shadowed-variable + class Manager implements ICustomizable, IEventEmitter, IParentOnMap { + constructor(map: Map, behaviors?: string[][] | string[], options?: object); - options: IOptionManager; - events: IEventManager; + options: IOptionManager; + events: IEventManager; - getMap(): Map; + getMap(): Map; - disable(behaviors: string[][] | string[] | string): this; + disable(behaviors: string[][] | string[] | string): this; - enable(behaviors: string[][] | string[] | string): this; + enable(behaviors: string[][] | string[] | string): this; - get(behaviorName: string): IBehavior; + get(behaviorName: string): IBehavior; - isEnabled(behaviorName: string): boolean; - } - } + isEnabled(behaviorName: string): boolean; + } + } - namespace layer { - class Manager implements ILayer, IMapObjectCollection { - constructor(map: Map, options?: { - trafficImageZIndex?: number; - trafficInfoZIndex?: number; - trafficJamZIndex?: number; - }); + namespace layer { + class Manager implements ILayer, IMapObjectCollection { + constructor(map: Map, options?: { + trafficImageZIndex?: number; + trafficInfoZIndex?: number; + trafficJamZIndex?: number; + }); - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - add(object: object): this; + add(object: object): this; - getIterator(): IIterator; + getIterator(): IIterator; - remove(object: object): this; + remove(object: object): this; - getMap(): Map; - } - } + getMap(): Map; + } + } - namespace margin { - class Accessor { - constructor(screenArea: object); + namespace margin { + class Accessor { + constructor(screenArea: object); - getArea(): object; + getArea(): object; - remove(): this; + remove(): this; - setArea(screenArea: object): this; - } + setArea(screenArea: object): this; + } - class Manager { - constructor(map: Map); + class Manager { + constructor(map: Map); - addArea(screenArea: object): Accessor; + addArea(screenArea: object): Accessor; - destroy(): this; + destroy(): this; - getMargin(): number[]; + getMargin(): number[]; - getOffset(): number[]; + getOffset(): number[]; - setDefaultMargin(margin: number[][] | number[] | number): void; - } - } + setDefaultMargin(margin: number[][] | number[] | number): void; + } + } - namespace pane { - class Manager { - constructor(map: Map); + namespace pane { + class Manager { + constructor(map: Map); - append(key: string, pane: IPane): void; + append(key: string, pane: IPane): void; - destroy(): void; + destroy(): void; - get(key: string): IPane | null; + get(key: string): IPane | null; - getLower(): string; + getLower(): string; - getUpper(): string; + getUpper(): string; - insertBefore(key: string, pane: IPane, referenceKey: string): void; + insertBefore(key: string, pane: IPane, referenceKey: string): void; - remove(pane: IPane): void; - } - } + remove(pane: IPane): void; + } + } - class Balloon implements IBalloonManager/*, IBalloonSharingManager*/ { //tslint:disable-line no-shadowed-variable - constructor(map: Map); + class Balloon implements IBalloonManager/*, IBalloonSharingManager*/ { //tslint:disable-line no-shadowed-variable + constructor(map: Map); - events: IEventManager; + events: IEventManager; - autoPan(): Promise; + autoPan(): Promise; - close(force?: boolean): Promise; + close(force?: boolean): Promise; - destroy(): void; + destroy(): void; - getData(): object | null; + getData(): object | null; - getOptions(): IOptionManager | null; + getOptions(): IOptionManager | null; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getPosition(): number[] | null; + getPosition(): number[] | null; - isOpen(): boolean; + isOpen(): boolean; - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - setData(data: object | string | HTMLElement): Promise; + setData(data: object | string | HTMLElement): Promise; - setOptions(options: object): Promise; + setOptions(options: object): Promise; - setPosition(position: number[]): Promise; - } + setPosition(position: number[]): Promise; + } - class Container implements IDomEventEmitter { - constructor(parentElement: string | HTMLElement); + class Container implements IDomEventEmitter { + constructor(parentElement: string | HTMLElement); - events: IEventManager; + events: IEventManager; - enterFullscreen(): void; + enterFullscreen(): void; - exitFullscreen(): void; + exitFullscreen(): void; - fitToViewport(preservePixelPosition?: boolean): void; + fitToViewport(preservePixelPosition?: boolean): void; - getElement(): HTMLElement; + getElement(): HTMLElement; - getOffset(): number[]; + getOffset(): number[]; - getParentElement(): HTMLElement; + getParentElement(): HTMLElement; - getSize(): number[]; + getSize(): number[]; - isFullscreen(): boolean; - } + isFullscreen(): boolean; + } - class Converter { - constructor(map: Map); + class Converter { + constructor(map: Map); - globalToPage(globalPixelPoint: number[]): number[]; + globalToPage(globalPixelPoint: number[]): number[]; - pageToGlobal(pagePixelPoint: number[]): number[]; - } + pageToGlobal(pagePixelPoint: number[]): number[]; + } - class Copyrights { - constructor(map: Map); + class Copyrights { + constructor(map: Map); - add(customCopyrights: string | HTMLElement | Array): ICopyrightsAccessor; + add(customCopyrights: string | HTMLElement | Array): ICopyrightsAccessor; - addProvider(provider: ICopyrightsProvider): this; + addProvider(provider: ICopyrightsProvider): this; - get(point?: number[], zoom?: number): Promise>; + get(point?: number[], zoom?: number): Promise>; - getPromoLink(): string; + getPromoLink(): string; - removeProvider(provider: ICopyrightsProvider): this; - } + removeProvider(provider: ICopyrightsProvider): this; + } - class GeoObjects implements IGeoObjectCollection { - constructor(map: Map, options?: object); + class GeoObjects implements IGeoObjectCollection { + constructor(map: Map, options?: object); - options: IOptionManager; - events: IEventManager; + options: IOptionManager; + events: IEventManager; - add(child: IGeoObject, index?: number): this; + add(child: IGeoObject, index?: number): this; - each(callback: (object: IGeoObject) => void, context: object): void; + each(callback: (object: IGeoObject) => void, context: object): void; - get(index: number): IGeoObject; + get(index: number): IGeoObject; - getBounds(): number[][] | null; + getBounds(): number[][] | null; - getIterator(): IIterator; + getIterator(): IIterator; - getLength(): number; + getLength(): number; - getPixelBounds(): number[][] | null; + getPixelBounds(): number[][] | null; - indexOf(object: IGeoObject): number; + indexOf(object: IGeoObject): number; - remove(child: IGeoObject): this; + remove(child: IGeoObject): this; - removeAll(): this; + removeAll(): this; - set(index: number, child: IGeoObject): this; + set(index: number, child: IGeoObject): this; - splice(index: number, length: number): this; + splice(index: number, length: number): this; - getMap(): Map; - } + getMap(): Map; + } - class Hint implements IHintManager/*, IHintSharingManager*/ { - constructor(map: Map); + class Hint implements IHintManager/*, IHintSharingManager*/ { + constructor(map: Map); - events: IEventManager; + events: IEventManager; - close(force?: boolean): Promise; + close(force?: boolean): Promise; - destroy(): void; + destroy(): void; - getData(): object | null; + getData(): object | null; - getOptions(): IOptionManager | null; + getOptions(): IOptionManager | null; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getPosition(): number[] | null; + getPosition(): number[] | null; - isOpen(): boolean; + isOpen(): boolean; - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - setData(data: object | string | HTMLElement): Promise; + setData(data: object | string | HTMLElement): Promise; - setOptions(options: object): Promise; + setOptions(options: object): Promise; - setPosition(position: number[]): Promise; - } + setPosition(position: number[]): Promise; + } - class ZoomRange implements IEventEmitter { - constructor(map: Map, constraints: number[]); + class ZoomRange implements IEventEmitter { + constructor(map: Map, constraints: number[]); - events: IEventManager; + events: IEventManager; - get(coords?: number[]): Promise; + get(coords?: number[]): Promise; - getCurrent(): number[]; - } - } + getCurrent(): number[]; + } + } - namespace multiRouter { - namespace driving { - class Path implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - model: PathModel; - events: IEventManager; - options: IOptionManager; + namespace multiRouter { + namespace driving { + class Path implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + model: PathModel; + events: IEventManager; + options: IOptionManager; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): object | null; + getParent(): object | null; - setParent(parent: object): this; + setParent(parent: object): this; - getMap(): Map; + getMap(): Map; - getSegments(): GeoObjectCollection; - } + getSegments(): GeoObjectCollection; + } - class PathModel implements IEventEmitter { - events: IEventManager; - properties: data.Manager; - route: RouteModel; + class PathModel implements IEventEmitter { + events: IEventManager; + properties: data.Manager; + route: RouteModel; - destroy(): void; + destroy(): void; - getSegments(): SegmentModel[]; + getSegments(): SegmentModel[]; - getType(): string; + getType(): string; - update(pathJson: object): void; - } + update(pathJson: object): void; + } - class Route implements IGeoObject { - geometry: IGeometry | null; - properties: IDataManager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; + class Route implements IGeoObject { + geometry: IGeometry | null; + properties: IDataManager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): object | null; + getParent(): object | null; - setParent(parent: object): this; + setParent(parent: object): this; - getMap(): Map; + getMap(): Map; - getPaths(): GeoObjectCollection; - } + getPaths(): GeoObjectCollection; + } - class RouteModel implements IEventEmitter { - events: IEventManager; - multiRoute: MultiRouteModel; - properties: data.Manager; + class RouteModel implements IEventEmitter { + events: IEventManager; + multiRoute: MultiRouteModel; + properties: data.Manager; - destroy(): void; + destroy(): void; - getPaths(): PathModel[]; + getPaths(): PathModel[]; - update(routeJson: object): void; + update(routeJson: object): void; - getType(): string; - } + getType(): string; + } - class Segment implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; + class Segment implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): object | null; + getParent(): object | null; - setParent(parent: object): this; + setParent(parent: object): this; - getMap(): Map; - } + getMap(): Map; + } - class SegmentModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.LineString; - path: PathModel; + class SegmentModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.LineString; + path: PathModel; - destroy(): void; + destroy(): void; - getType(): string; + getType(): string; - getViaPoints(): ViaPointModel[]; + getViaPoints(): ViaPointModel[]; - update(segmentJson: object): void; - } - } + update(segmentJson: object): void; + } + } - namespace masstransit { - class Path implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - model: PathModel; + namespace masstransit { + class Path implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + model: PathModel; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): object | null; + getParent(): object | null; - setParent(parent: object): this; + setParent(parent: object): this; - getMap(): Map; + getMap(): Map; - getSegmentMarkers(): GeoObjectCollection; + getSegmentMarkers(): GeoObjectCollection; - getSegments(): GeoObjectCollection; - } + getSegments(): GeoObjectCollection; + } - class PathModel implements IEventEmitter { - events: IEventManager; - properties: data.Manager; - route: RouteModel; + class PathModel implements IEventEmitter { + events: IEventManager; + properties: data.Manager; + route: RouteModel; - destroy(): void; + destroy(): void; - getSegments(): Array; + getSegments(): Array; - getType(): string; + getType(): string; - update(pathJson: object): void; - } + update(pathJson: object): void; + } - class Route implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - model: RouteModel; - state: IDataManager; - events: IEventManager; - options: IOptionManager; + class Route implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + model: RouteModel; + state: IDataManager; + events: IEventManager; + options: IOptionManager; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): object | null; + getParent(): object | null; - setParent(parent: object): this; + setParent(parent: object): this; - getMap(): Map; + getMap(): Map; - getPaths(): GeoObjectCollection; - } + getPaths(): GeoObjectCollection; + } - class RouteModel implements IEventEmitter { - events: IEventManager; - multiRoute: MultiRouteModel; - properties: data.Manager; + class RouteModel implements IEventEmitter { + events: IEventManager; + multiRoute: MultiRouteModel; + properties: data.Manager; - destroy(): void; + destroy(): void; - getPaths(): PathModel[]; + getPaths(): PathModel[]; - getType(): string; + getType(): string; - update(routeJson: object): void; - } + update(routeJson: object): void; + } - class StopModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.Point; - properties: data.Manager; - segment: TransportSegmentModel; + class StopModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.Point; + properties: data.Manager; + segment: TransportSegmentModel; - update(stopJson: object): void; - } + update(stopJson: object): void; + } - class TransferSegment implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - model: TransferSegmentModel; + class TransferSegment implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + model: TransferSegmentModel; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): object | null; + getParent(): object | null; - setParent(parent: object): this; + setParent(parent: object): this; - getMap(): Map; - } + getMap(): Map; + } - class TransferSegmentModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.LineString; - path: PathModel; - properties: data.Manager; + class TransferSegmentModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.LineString; + path: PathModel; + properties: data.Manager; - destroy(segmentJson: object): void; + destroy(segmentJson: object): void; - getType(): string; - } + getType(): string; + } - class TransportSegment implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - model: TransportSegmentModel; + class TransportSegment implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + model: TransportSegmentModel; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): object | null; + getParent(): object | null; - setParent(parent: object): this; + setParent(parent: object): this; - getMap(): Map; - } + getMap(): Map; + } - class TransportSegmentModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.LineString; - path: PathModel; - properties: data.Manager; + class TransportSegmentModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.LineString; + path: PathModel; + properties: data.Manager; - destroy(): void; + destroy(): void; - getStops(): StopModel[]; + getStops(): StopModel[]; - getType(): string; + getType(): string; - update(segmentJson: object): void; - } + update(segmentJson: object): void; + } - class WalkSegment implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - model: WalkSegmentModel; + class WalkSegment implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + model: WalkSegmentModel; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): object | null; + getParent(): object | null; - setParent(parent: object): this; + setParent(parent: object): this; - getMap(): Map; - } + getMap(): Map; + } - class WalkSegmentModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.LineString; - path: PathModel; - properties: data.Manager; + class WalkSegmentModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.LineString; + path: PathModel; + properties: data.Manager; - destroy(): void; + destroy(): void; - getType(): string; - } - } + getType(): string; + } + } - class EditorAddon implements ICustomizable, IEventEmitter { - options: IOptionManager; - events: IEventManager; - state: data.Manager; + class EditorAddon implements ICustomizable, IEventEmitter { + options: IOptionManager; + events: IEventManager; + state: data.Manager; - isActive(): boolean; + isActive(): boolean; - start(state: object): void; + start(state: object): void; - stop(): void; - } + stop(): void; + } - class MultiRoute implements IGeoObject { - constructor(model: MultiRouteModel | IMultiRouteModelJson, options?: { - activeRouteAutoSelection?: boolean; - boundsAutoApply?: boolean; - dragUpdateInterval?: string | number; - preventDragUpdate?: boolean; - useMapMargin?: boolean; - zoomMargin?: number[][] | number[] | number; - [index: string]: any; - }); + class MultiRoute implements IGeoObject { + constructor(model: MultiRouteModel | IMultiRouteModelJson, options?: { + activeRouteAutoSelection?: boolean; + boundsAutoApply?: boolean; + dragUpdateInterval?: string | number; + preventDragUpdate?: boolean; + useMapMargin?: boolean; + zoomMargin?: number[][] | number[] | number; + [index: string]: any; + }); - editor: EditorAddon; - model: MultiRouteModel; - geometry: IGeometry | null; - properties: IDataManager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; + editor: EditorAddon; + model: MultiRouteModel; + geometry: IGeometry | null; + properties: IDataManager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): object | null; + getParent(): object | null; - setParent(parent: object): this; + setParent(parent: object): this; - getMap(): Map; + getMap(): Map; - getActiveRoute(): driving.Route | masstransit.Route | null; + getActiveRoute(): driving.Route | masstransit.Route | null; - getBounds(): number[][] | null; + getBounds(): number[][] | null; - getPixelBounds(): number[][] | null; + getPixelBounds(): number[][] | null; - getRoutes(): GeoObjectCollection; + getRoutes(): GeoObjectCollection; - getViaPoints(): GeoObjectCollection; + getViaPoints(): GeoObjectCollection; - getWayPoints(): GeoObjectCollection; + getWayPoints(): GeoObjectCollection; - setActiveRoute(route: driving.Route | masstransit.Route | null): void; - } + setActiveRoute(route: driving.Route | masstransit.Route | null): void; + } - class MultiRouteModel implements IEventEmitter { - constructor(referencePoints: IMultiRouteReferencePoint[], params?: IMultiRouteParams); + class MultiRouteModel implements IEventEmitter { + constructor(referencePoints: IMultiRouteReferencePoint[], params?: IMultiRouteParams); - events: IEventManager; - properties: data.Manager; + events: IEventManager; + properties: data.Manager; - destroy(): void; + destroy(): void; - getAllPoints(): Array; + getAllPoints(): Array; - getJson(): object; + getJson(): object; - getParams(): IMultiRouteParams; + getParams(): IMultiRouteParams; - getPoints(): Array; + getPoints(): Array; - getReferencePointIndexes(): object; + getReferencePointIndexes(): object; - getReferencePoints(): IMultiRouteReferencePoint[]; + getReferencePoints(): IMultiRouteReferencePoint[]; - getRoutes(): driving.RouteModel[] | masstransit.RouteModel[]; + getRoutes(): driving.RouteModel[] | masstransit.RouteModel[]; - getViaPoints(): ViaPointModel[]; + getViaPoints(): ViaPointModel[]; - getWayPoints(): WayPointModel[]; + getWayPoints(): WayPointModel[]; - setParams(params: IMultiRouteParams, extend?: boolean, clearRequests?: boolean): void; + setParams(params: IMultiRouteParams, extend?: boolean, clearRequests?: boolean): void; - setReferencePoints(referencePoints: IMultiRouteReferencePoint[], viaIndexes?: number[], clearRequests?: boolean): void; - } + setReferencePoints(referencePoints: IMultiRouteReferencePoint[], viaIndexes?: number[], clearRequests?: boolean): void; + } - class ViaPoint implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; + class ViaPoint implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): object | null; + getParent(): object | null; - setParent(parent: object): this; + setParent(parent: object): this; - getMap(): Map; - } + getMap(): Map; + } - class ViaPointModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.Point; - multiRoute: MultiRouteModel; - properties: data.Manager; + class ViaPointModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.Point; + multiRoute: MultiRouteModel; + properties: data.Manager; - destroy(): void; + destroy(): void; - getReferencePoint(): object; + getReferencePoint(): object; - getReferencePointIndex(): number; + getReferencePointIndex(): number; - setReferencePoint(referencePoint: object): void; + setReferencePoint(referencePoint: object): void; - update(viaPointJson: object): void; - } + update(viaPointJson: object): void; + } - class WayPoint implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - model: WayPointModel; + class WayPoint implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + model: WayPointModel; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): object | null; + getParent(): object | null; - setParent(parent: object): this; + setParent(parent: object): this; - getMap(): Map; - } + getMap(): Map; + } - class WayPointModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.Point; - multiRoute: MultiRouteModel; - properties: data.Manager; + class WayPointModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.Point; + multiRoute: MultiRouteModel; + properties: data.Manager; - destroy(): void; + destroy(): void; - getReferencePoint(): object; + getReferencePoint(): object; - getReferencePointIndex(): number; + getReferencePointIndex(): number; - setReferencePoint(referencePoint: object): void; + setReferencePoint(referencePoint: object): void; - update(wayPointJson: object): void; - } - } + update(wayPointJson: object): void; + } + } - namespace option { - class Manager implements IOptionManager { - constructor(options?: object, parent?: IOptionManager, name?: string); + namespace option { + class Manager implements IOptionManager { + constructor(options?: object, parent?: IOptionManager, name?: string); - events: IEventManager; + events: IEventManager; - get(key: string, defaultValue: object): object; + get(key: string, defaultValue: object): object; - getAll(): object; + getAll(): object; - getName(): string; + getName(): string; - getNative(key: string): object; + getNative(key: string): object; - resolve(key: string, name?: string): object; + resolve(key: string, name?: string): object; - set(key: object | string, value?: object): this; + set(key: object | string, value?: object): this; - unset(keys: string[][] | string[] | string): this; + unset(keys: string[][] | string[] | string): this; - unsetAll(): this; + unsetAll(): this; - setName(name: string): void; + setName(name: string): void; - getParent(): null | IOptionManager; + getParent(): null | IOptionManager; - setParent(parent: IOptionManager): this; + setParent(parent: IOptionManager): this; - freeze(): IFreezable; + freeze(): IFreezable; - isFrozen(): boolean; + isFrozen(): boolean; - unfreeze(): IFreezable; + unfreeze(): IFreezable; - add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - group(): IEventGroup; + group(): IEventGroup; - remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - fire(type: string, eventobject: object | IEvent): this; - } - } + fire(type: string, eventobject: object | IEvent): this; + } + } - namespace panorama { - class Manager implements IEventEmitter { - events: IEventManager; + namespace panorama { + class Manager implements IEventEmitter { + events: IEventManager; - closePlayer(): void; + closePlayer(): void; - disableLookup(): void; + disableLookup(): void; - enableLookup(): void; + enableLookup(): void; - getPlayer(): Player; + getPlayer(): Player; - isLookupEnabled(): boolean; + isLookupEnabled(): boolean; - openPlayer(panorama: IPanorama[] | number): Promise; - } + openPlayer(panorama: IPanorama[] | number): Promise; + } - class Player implements IEventEmitter { - constructor(element: HTMLElement | string, panorama: IPanorama, options?: { - autoFitToViewport?: "none" | "ifNull" | "always"; - controls?: string[]; - direction?: number[] | string; - hotkeysEnabled?: boolean; - scrollZoomBehavior?: boolean; - span?: number[] | string; - suppressMapOpenBlock?: boolean; - }) + class Player implements IEventEmitter { + constructor(element: HTMLElement | string, panorama: IPanorama, options?: { + autoFitToViewport?: "none" | "ifNull" | "always"; + controls?: string[]; + direction?: number[] | string; + hotkeysEnabled?: boolean; + scrollZoomBehavior?: boolean; + span?: number[] | string; + suppressMapOpenBlock?: boolean; + }) - events: IEventManager; + events: IEventManager; - destroy(): void; + destroy(): void; - fitToViewport(): void; + fitToViewport(): void; - getDirection(): number[]; + getDirection(): number[]; - getPanorama(): IPanorama; + getPanorama(): IPanorama; - getSpan(): number[]; + getSpan(): number[]; - lookAt(point: number[]): this; + lookAt(point: number[]): this; - moveTo(point: number[], options?: { - direction?: number[] | string; - layer?: "yandex#panorama" | "yandex#airPanorama"; - span?: number[] | string; - }): Promise; + moveTo(point: number[], options?: { + direction?: number[] | string; + layer?: "yandex#panorama" | "yandex#airPanorama"; + span?: number[] | string; + }): Promise; - setDirection(direction: number[] | string): this; + setDirection(direction: number[] | string): this; - setPanorama(panorama: IPanorama): this; + setPanorama(panorama: IPanorama): this; - setSpan(span: number[] | string): this; - } - } + setSpan(span: number[] | string): this; + } + } - namespace router { - class Editor implements ICustomizable, IEventEmitter { - options: IOptionManager; - events: IEventManager; + namespace router { + class Editor implements ICustomizable, IEventEmitter { + options: IOptionManager; + events: IEventManager; - start(options?: { - addViaPoints?: boolean; - addWayPoints?: boolean; - editViaPoints?: boolean; - editWayPoints?: boolean; - removeViaPoints?: boolean; - removeWayPoints?: boolean; - }): void; + start(options?: { + addViaPoints?: boolean; + addWayPoints?: boolean; + editViaPoints?: boolean; + editWayPoints?: boolean; + removeViaPoints?: boolean; + removeWayPoints?: boolean; + }): void; - stop(): void; - } + stop(): void; + } - abstract class Route implements IGeoObject { - geometry: IGeometry | null; - properties: IDataManager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - editor: Editor; + abstract class Route implements IGeoObject { + geometry: IGeometry | null; + properties: IDataManager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + editor: Editor; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - getMap(): Map; + getMap(): Map; - getHumanJamsTime(): string; + getHumanJamsTime(): string; - getHumanLength(): string; + getHumanLength(): string; - getHumanTime(): string; + getHumanTime(): string; - getJamsTime(): number; + getJamsTime(): number; - getLength(): number; + getLength(): number; - getPaths(): GeoObjectCollection; + getPaths(): GeoObjectCollection; - getTime(): number; + getTime(): number; - getViaPoints(): GeoObjectCollection; + getViaPoints(): GeoObjectCollection; - getWayPoints(): GeoObjectCollection; - } - } + getWayPoints(): GeoObjectCollection; + } + } - class Balloon extends Popup implements IBaloon { - constructor(map: Map, options?: IBalloonOptions); + class Balloon extends Popup implements IBaloon { + constructor(map: Map, options?: IBalloonOptions); - getData(): object; + getData(): object; - close(force?: boolean): Promise; + close(force?: boolean): Promise; - getParent(): Balloon | null; + getParent(): Balloon | null; - setParent(parent: Balloon): this; + setParent(parent: Balloon): this; - autoPan(): Promise; + autoPan(): Promise; - freeze(): IFreezable; + freeze(): IFreezable; - isFrozen(): boolean; + isFrozen(): boolean; - unfreeze(): IFreezable; + unfreeze(): IFreezable; - add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - group(): IEventGroup; + group(): IEventGroup; - remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - fire(type: string, eventobject: object | IEvent): this; - } + fire(type: string, eventobject: object | IEvent): this; + } - interface IBalloonOptions { - autoPan?: boolean; - autoPanCheckZoomRange?: boolean; - autoPanDuration?: number; - autoPanMargin?: number[][] | number[] | number; - autoPanUseMapMargin?: boolean; - closeButton?: boolean; - contentLayout?: IClassConstructor | string; - layout?: IClassConstructor | string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - offset?: number[]; - pane?: string; - panelContentLayout?: IClassConstructor | string; - panelMaxHeightRatio?: number; - panelMaxMapArea?: number; - shadow?: boolean; - shadowLayout?: IClassConstructor | string; - shadowOffset?: number[]; - } - - class Circle implements GeoObject { - constructor(geometry: ICircleGeometry[][][][] | number[][] | object, properties?: object | IDataManager, options?: ICircleOptions) - - balloon: geoObject.Balloon; - editor: IGeometryEditor; - hint: geoObject.Hint; - events: event.Manager; - options: option.Manager; - properties: data.Manager; - state: data.Manager; + interface IBalloonOptions { + autoPan?: boolean; + autoPanCheckZoomRange?: boolean; + autoPanDuration?: number; + autoPanMargin?: number[][] | number[] | number; + autoPanUseMapMargin?: boolean; + closeButton?: boolean; + contentLayout?: IClassConstructor | string; + layout?: IClassConstructor | string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + offset?: number[]; + pane?: string; + panelContentLayout?: IClassConstructor | string; + panelMaxHeightRatio?: number; + panelMaxMapArea?: number; + shadow?: boolean; + shadowLayout?: IClassConstructor | string; + shadowOffset?: number[]; + } + + class Circle implements GeoObject { + constructor(geometry: ICircleGeometry[][][][] | number[][] | object, properties?: object | IDataManager, options?: ICircleOptions) + + balloon: geoObject.Balloon; + editor: IGeometryEditor; + hint: geoObject.Hint; + events: event.Manager; + options: option.Manager; + properties: data.Manager; + state: data.Manager; - geometry: IGeometry | null; - indices: ArrayBuffer; - vertices: ArrayBuffer; + geometry: IGeometry | null; + indices: ArrayBuffer; + vertices: ArrayBuffer; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - getMap(): Map; - } + getMap(): Map; + } - interface ICircleOptions { - circleOverlay?: string | ((geometry: IPixelCircleGeometry, data: object, options: object) => Promise); - cursor?: string; - draggable?: boolean; - fill?: boolean; - fillColor?: string; - fillImageHref?: string; - fillMethod?: "stretch" | "tile"; - fillOpacity?: number; - hasBalloon?: boolean; - hasHint?: boolean; - hideIconOnBalloonOpen?: boolean; - interactiveZIndex?: boolean; - interactivityModel?: InteractivityModelKey; - opacity?: number; - openBalloonOnClick?: boolean; - openEmptyBalloon?: boolean; - openEmptyHint?: boolean; - openHintOnHover?: boolean; - outline?: boolean; - pane?: string; - strokeColor?: string[][] | string[] | string; - strokeOpacity?: number[][] | number[] | number; - strokeStyle?: string[][][] | object[][] | string[] | object[] | string | object; - strokeWidth?: number[][] | number[] | number; - syncOverlayInit?: boolean; - useMapMarginInDragging?: boolean; - visible?: boolean; - zIndex?: number; - zIndexActive?: number; - zIndexDrag?: number; - zIndexHover?: number; - } - - class Clusterer implements IChildOnMap, ICustomizable, IEventEmitter, IParentOnMap { - constructor(options?: IClustererOptions); - - events: IEventManager; - options: IOptionManager; - balloon: clusterer.Balloon; - // balloonopen: - hint: clusterer.Hint; - - getParent(): null | IControlParent; - - setParent(parent: IControlParent): this; - - // balloonclose: - - getMap(): Map; - } - - interface IClustererOptions { - gridSize?: number; - groupByCoordinates?: boolean; - hasBalloon?: boolean; - hasHint?: boolean; - margin?: number[][] | number[] | number; - maxZoom?: number[] | number; - minClusterSize?: number; - preset?: PresetKey; - showInAlphabeticalOrder?: boolean; - useMapMargin?: boolean; - viewportMargin?: number[][] | number[] | number; - zoomMargin?: number[][] | number[] | number; - } - - class ClusterPlacemark implements IGeoObject, collection.Item { - constructor(geometry: number[] | object | IPointGeometry, properties: IClusterPlacemarkProperties, options?: IClusterPlacemarkOptions); + interface ICircleOptions { + circleOverlay?: string | ((geometry: IPixelCircleGeometry, data: object, options: object) => Promise); + cursor?: string; + draggable?: boolean; + fill?: boolean; + fillColor?: string; + fillImageHref?: string; + fillMethod?: "stretch" | "tile"; + fillOpacity?: number; + hasBalloon?: boolean; + hasHint?: boolean; + hideIconOnBalloonOpen?: boolean; + interactiveZIndex?: boolean; + interactivityModel?: InteractivityModelKey; + opacity?: number; + openBalloonOnClick?: boolean; + openEmptyBalloon?: boolean; + openEmptyHint?: boolean; + openHintOnHover?: boolean; + outline?: boolean; + pane?: string; + strokeColor?: string[][] | string[] | string; + strokeOpacity?: number[][] | number[] | number; + strokeStyle?: string[][][] | object[][] | string[] | object[] | string | object; + strokeWidth?: number[][] | number[] | number; + syncOverlayInit?: boolean; + useMapMarginInDragging?: boolean; + visible?: boolean; + zIndex?: number; + zIndexActive?: number; + zIndexDrag?: number; + zIndexHover?: number; + } + + class Clusterer implements IChildOnMap, ICustomizable, IEventEmitter, IParentOnMap { + constructor(options?: IClustererOptions); + + events: IEventManager; + options: IOptionManager; + balloon: clusterer.Balloon; + // balloonopen: + hint: clusterer.Hint; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + // balloonclose: + + getMap(): Map; + } + + interface IClustererOptions { + gridSize?: number; + groupByCoordinates?: boolean; + hasBalloon?: boolean; + hasHint?: boolean; + margin?: number[][] | number[] | number; + maxZoom?: number[] | number; + minClusterSize?: number; + preset?: PresetKey; + showInAlphabeticalOrder?: boolean; + useMapMargin?: boolean; + viewportMargin?: number[][] | number[] | number; + zoomMargin?: number[][] | number[] | number; + } + + class ClusterPlacemark implements IGeoObject, collection.Item { + constructor(geometry: number[] | object | IPointGeometry, properties: IClusterPlacemarkProperties, options?: IClusterPlacemarkOptions); - geometry: IGeometry | null; - properties: IDataManager; - events: IEventManager; - options: IOptionManager; - state: data.Manager; + geometry: IGeometry | null; + properties: IDataManager; + events: IEventManager; + options: IOptionManager; + state: data.Manager; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - getMap(): Map; + getMap(): Map; - onAddToMap(map: Map): void; + onAddToMap(map: Map): void; - onRemoveFromMap(oldMap: Map): void; + onRemoveFromMap(oldMap: Map): void; - getBounds(): number[][] | null; + getBounds(): number[][] | null; - getGeoObjects(): IGeoObject[]; - } + getGeoObjects(): IGeoObject[]; + } - interface IClusterPlacemarkProperties extends IDataManager { - geoObjects: IGeoObject[]; - } + interface IClusterPlacemarkProperties extends IDataManager { + geoObjects: IGeoObject[]; + } - interface IClusterPlacemarkOptions { - balloonContentLayout?: "cluster#balloonTwoColumns" | "cluster#balloonCarousel" | "cluster#balloonAccordion" | string | IClassConstructor; - balloonContentLayoutHeight?: number; - balloonContentLayoutWidth?: number; - balloonItemContentLayout?: ILayout | string; - balloonPanelContentLayout?: string | IClassConstructor; - cursor?: string; - disableClickZoom?: boolean; - hideIconOnBalloonOpen?: boolean; - iconColor?: string; - iconContentLayout?: string | IClassConstructor; - iconLayout?: string | IClassConstructor; - icons?: Array<{ - href: string; - size: number[]; - ooffset: number[]; - shape?: IShape | IGeometryJson; - }>; - iconShape?: IGeometryJson; - interactivityModel?: InteractivityModelKey; - numbers?: number[]; - openBalloonOnClick?: boolean; - openEmptyHint?: boolean; - openHintOnHover?: boolean; - zIndexHover?: number; - } + interface IClusterPlacemarkOptions { + balloonContentLayout?: "cluster#balloonTwoColumns" | "cluster#balloonCarousel" | "cluster#balloonAccordion" | string | IClassConstructor; + balloonContentLayoutHeight?: number; + balloonContentLayoutWidth?: number; + balloonItemContentLayout?: ILayout | string; + balloonPanelContentLayout?: string | IClassConstructor; + cursor?: string; + disableClickZoom?: boolean; + hideIconOnBalloonOpen?: boolean; + iconColor?: string; + iconContentLayout?: string | IClassConstructor; + iconLayout?: string | IClassConstructor; + icons?: Array<{ + href: string; + size: number[]; + ooffset: number[]; + shape?: IShape | IGeometryJson; + }>; + iconShape?: IGeometryJson; + interactivityModel?: InteractivityModelKey; + numbers?: number[]; + openBalloonOnClick?: boolean; + openEmptyHint?: boolean; + openHintOnHover?: boolean; + zIndexHover?: number; + } - class Collection implements ICollection, collection.Item { - constructor(options?: object); + class Collection implements ICollection, collection.Item { + constructor(options?: object); - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - add(object: object): this; + add(object: object): this; - getIterator(): IIterator; + getIterator(): IIterator; - remove(object: object): this; + remove(object: object): this; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - getMap(): Map; + getMap(): Map; - onAddToMap(map: Map): void; + onAddToMap(map: Map): void; - onRemoveFromMap(oldMap: Map): void; + onRemoveFromMap(oldMap: Map): void; - filter(filterFunction: (object: object) => boolean): object[]; + filter(filterFunction: (object: object) => boolean): object[]; - get(index: number): object; + get(index: number): object; - getAll(): object[]; + getAll(): object[]; - getLength(): number; + getLength(): number; - indexOf(childToFind: object): number; + indexOf(childToFind: object): number; - removeAll(): this; - } + removeAll(): this; + } - class Event implements IEvent { - constructor(originalEvent: object, sourceEvent: IEvent); + class Event implements IEvent { + constructor(originalEvent: object, sourceEvent: IEvent); - allowMapEvent(): void; + allowMapEvent(): void; - callMethod(name: string): void; + callMethod(name: string): void; - get(name: string): object; + get(name: string): object; - getSourceEvent(): IEvent | null; + getSourceEvent(): IEvent | null; - isDefaultPrevented(): boolean; + isDefaultPrevented(): boolean; - isImmediatePropagationStopped(): boolean; + isImmediatePropagationStopped(): boolean; - isMapEventAllowed(): boolean; + isMapEventAllowed(): boolean; - isPropagationStopped(): boolean; + isPropagationStopped(): boolean; - preventDefault(): boolean; + preventDefault(): boolean; - stopImmediatePropagation(): boolean; + stopImmediatePropagation(): boolean; - stopPropagation(): boolean; - } + stopPropagation(): boolean; + } - class GeoObject implements IGeoObject { - constructor(feature?: IGeoObjectFeature, options?: IGeoObjectOptions); + class GeoObject implements IGeoObject { + constructor(feature?: IGeoObjectFeature, options?: IGeoObjectOptions); - geometry: IGeometry | null; - balloon: geoObject.Balloon; - editor: IGeometryEditor; - hint: geoObject.Hint; - events: event.Manager; - options: option.Manager; - properties: data.Manager; - state: data.Manager; + geometry: IGeometry | null; + balloon: geoObject.Balloon; + editor: IGeometryEditor; + hint: geoObject.Hint; + events: event.Manager; + options: option.Manager; + properties: data.Manager; + state: data.Manager; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - getMap(): Map; - } + getMap(): Map; + } - interface IGeoObjectFeature { - geometry?: IGeometry | IGeometryJson | object; - properties?: IDataManager | object; - } + interface IGeoObjectFeature { + geometry?: IGeometry | IGeometryJson | object; + properties?: IDataManager | object; + } - interface IGeoObjectOptions extends ICircleOptions { - iconCaptionMaxWidth?: number; - iconColor?: string; - iconContentLayout?: string | IClassConstructor; - iconContentOffset?: number[]; - iconContentPadding?: number[]; - iconContentSize?: number[]; - iconImageClipRect?: number[][]; - iconImageHref?: string; - iconImageOffset?: number[]; - iconImageShape?: IShape | null; - iconImageSize?: number[]; - iconLayout?: string | IClassConstructor; - iconMaxHeight?: number; - iconMaxWidth?: number; - iconOffset?: number[]; - iconShadow?: boolean; - iconShadowImageClipRect?: number[][]; - iconShadowImageHref?: string; - iconShadowImageOffset?: number[]; - iconShadowImageSize?: number[]; - iconShadowLayout?: string | IClassConstructor; - iconShadowOffset?: number[]; - lineStringOverlay?: OverlayKey; - pointOverlay?: OverlayKey; - polygonOverlay?: OverlayKey; - preset?: string; - rectangleOverlay?: OverlayKey; - setMapCursorInDragging?: boolean; - } + interface IGeoObjectOptions extends ICircleOptions { + iconCaptionMaxWidth?: number; + iconColor?: string; + iconContentLayout?: string | IClassConstructor; + iconContentOffset?: number[]; + iconContentPadding?: number[]; + iconContentSize?: number[]; + iconImageClipRect?: number[][]; + iconImageHref?: string; + iconImageOffset?: number[]; + iconImageShape?: IShape | null; + iconImageSize?: number[]; + iconLayout?: string | IClassConstructor; + iconMaxHeight?: number; + iconMaxWidth?: number; + iconOffset?: number[]; + iconShadow?: boolean; + iconShadowImageClipRect?: number[][]; + iconShadowImageHref?: string; + iconShadowImageOffset?: number[]; + iconShadowImageSize?: number[]; + iconShadowLayout?: string | IClassConstructor; + iconShadowOffset?: number[]; + lineStringOverlay?: OverlayKey; + pointOverlay?: OverlayKey; + polygonOverlay?: OverlayKey; + preset?: string; + rectangleOverlay?: OverlayKey; + setMapCursorInDragging?: boolean; + } - class GeoObjectCollection implements IGeoObject, IGeoObjectCollection { - constructor(feature?: { - children?: IGeoObject[]; - geometry?: IGeometry | object; - properties?: IDataManager | object; - }, options?: object); + class GeoObjectCollection implements IGeoObject, IGeoObjectCollection { + constructor(feature?: { + children?: IGeoObject[]; + geometry?: IGeometry | object; + properties?: IDataManager | object; + }, options?: object); - geometry: IGeometry | null; - properties: IDataManager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; + geometry: IGeometry | null; + properties: IDataManager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - getMap(): Map; + getMap(): Map; - add(child: IGeoObject, index?: number): this; + add(child: IGeoObject, index?: number): this; - each(callback: (object: IGeoObject) => void, context: object): void; + each(callback: (object: IGeoObject) => void, context: object): void; - get(index: number): IGeoObject; + get(index: number): IGeoObject; - getBounds(): number[][] | null; + getBounds(): number[][] | null; - getIterator(): IIterator; + getIterator(): IIterator; - getLength(): number; + getLength(): number; - getPixelBounds(): number[][] | null; + getPixelBounds(): number[][] | null; - indexOf(object: IGeoObject): number; + indexOf(object: IGeoObject): number; - remove(child: IGeoObject): this; + remove(child: IGeoObject): this; - removeAll(): this; + removeAll(): this; - set(index: number, child: IGeoObject): this; + set(index: number, child: IGeoObject): this; - splice(index: number, length: number): this; + splice(index: number, length: number): this; - toArray(): IGeoObject[]; - } + toArray(): IGeoObject[]; + } - class Layer implements ILayer, IParentOnMap, IPositioningContext { - constructor(tileUrlTemplate: string | ((tileNumber: number[], tileZoom: number) => string)); + class Layer implements ILayer, IParentOnMap, IPositioningContext { + constructor(tileUrlTemplate: string | ((tileNumber: number[], tileZoom: number) => string)); - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - fromClientPixels(clientPixelPoint: number[]): number[]; + fromClientPixels(clientPixelPoint: number[]): number[]; - getZoom(): number; + getZoom(): number; - toClientPixels(globalPixelPoint: number[]): number[]; + toClientPixels(globalPixelPoint: number[]): number[]; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - getMap(): Map; - } + getMap(): Map; + } - class Map implements IDomEventEmitter { - constructor(parentElement: HTMLElement | string, state: IMapState, options?: IMapOptions) + class Map implements IDomEventEmitter { + constructor(parentElement: HTMLElement | string, state: IMapState, options?: IMapOptions) - action: map.action.Manager; - balloon: map.Balloon; - behaviors: map.behavior.Manager; - container: map.Container; - controls: control.Manager; - converter: map.Converter; - copyrights: map.Copyrights; - cursors: util.cursor.Manager; - events: event.Manager; - geoObjects: map.GeoObjects; - hint: map.Hint; - layers: map.layer.Manager; - margin: map.margin.Manager; - options: option.Manager; - panes: map.pane.Manager; - zoomRange: map.ZoomRange; + action: map.action.Manager; + balloon: map.Balloon; + behaviors: map.behavior.Manager; + container: map.Container; + controls: control.Manager; + converter: map.Converter; + copyrights: map.Copyrights; + cursors: util.cursor.Manager; + events: event.Manager; + geoObjects: map.GeoObjects; + hint: map.Hint; + layers: map.layer.Manager; + margin: map.margin.Manager; + options: option.Manager; + panes: map.pane.Manager; + zoomRange: map.ZoomRange; - destroy(): void; + destroy(): void; - getBounds(options?: IMapMarginOptions): number[][]; + getBounds(options?: IMapMarginOptions): number[][]; - getCenter(options?: IMapMarginOptions): number[]; + getCenter(options?: IMapMarginOptions): number[]; - getGlobalPixelCenter(options?: IMapMarginOptions): number[]; + getGlobalPixelCenter(options?: IMapMarginOptions): number[]; - getPanoramaManager(): Promise; + getPanoramaManager(): Promise; - getType(): string | MapType; + getType(): string | MapType; - getZoom(): number; + getZoom(): number; - panTo(center: number[] | object[], options?: IMapPanOptions): Promise; + panTo(center: number[] | object[], options?: IMapPanOptions): Promise; - setBounds(bounds: number[][], options?: IMapBoundsOptions): Promise; + setBounds(bounds: number[][], options?: IMapBoundsOptions): Promise; - setCenter(center: number[], zoom?: number, options?: IMapPositionOptions): Promise; + setCenter(center: number[], zoom?: number, options?: IMapPositionOptions): Promise; - setGlobalPixelCenter(globalPixelCenter: number[], zoom?: number, options?: IMapPositionOptions): Promise; + setGlobalPixelCenter(globalPixelCenter: number[], zoom?: number, options?: IMapPositionOptions): Promise; - setType(type: string | MapType, options?: IMapCheckZoomRangeOptions): Promise; + setType(type: string | MapType, options?: IMapCheckZoomRangeOptions): Promise; - setZoom(zoom: number, options?: IMapZoomOptions): Promise; - } + setZoom(zoom: number, options?: IMapZoomOptions): Promise; + } - interface IMapMarginOptions { - useMapMargin?: boolean; - } + interface IMapMarginOptions { + useMapMargin?: boolean; + } - interface IMapCheckZoomRangeOptions { - checkZoomRange?: boolean; - } + interface IMapCheckZoomRangeOptions { + checkZoomRange?: boolean; + } - interface IMapZoomOptions extends IMapMarginOptions, IMapCheckZoomRangeOptions { - duration?: number; - } + interface IMapZoomOptions extends IMapMarginOptions, IMapCheckZoomRangeOptions { + duration?: number; + } - interface IMapPositionOptions extends IMapZoomOptions { - timingFunction?: string; - } + interface IMapPositionOptions extends IMapZoomOptions { + timingFunction?: string; + } - interface IMapBoundsOptions extends IMapPositionOptions { - preciseZoom?: boolean; - zoomMargin?: number[][] | number[]; - } + interface IMapBoundsOptions extends IMapPositionOptions { + preciseZoom?: boolean; + zoomMargin?: number[][] | number[]; + } - interface IMapPanOptions extends IMapPositionOptions { - delay?: number; - flying?: boolean; - safe?: boolean; - } + interface IMapPanOptions extends IMapPositionOptions { + delay?: number; + flying?: boolean; + safe?: boolean; + } - class MapType { - constructor(name: string, layers: Array | string>) - } + class MapType { + constructor(name: string, layers: Array | string>) + } - interface IMapState { - behaviors?: string[]; - bounds?: number[][]; - center?: number[]; - controls?: string[]; - margin?: number[][] | number[]; - type?: "yandex#map" | "yandex#satellite" | "yandex#hybrid"; - zoom?: number; - } + interface IMapState { + behaviors?: string[]; + bounds?: number[][]; + center?: number[]; + controls?: string[]; + margin?: number[][] | number[]; + type?: "yandex#map" | "yandex#satellite" | "yandex#hybrid"; + zoom?: number; + } - interface IMapOptions { - autoFitToViewport?: "none" | "ifNull" | "always"; - avoidFractionalZoom?: boolean; - exitFullscreenByEsc?: boolean; - fullscreenZIndex?: number; - mapAutoFocus?: boolean; - maxAnimationZoomDifference?: number; - maxZoom?: number; - minZoom?: number; - nativeFullscreen?: boolean; - projection?: IProjection; - restrictMapArea?: boolean; - suppressMapOpenBlock?: boolean; - suppressObsoleteBrowserNotifier?: boolean; - yandexMapAutoSwitch?: boolean; - yandexMapDisablePoiInteractivity?: boolean; - } + interface IMapOptions { + autoFitToViewport?: "none" | "ifNull" | "always"; + avoidFractionalZoom?: boolean; + exitFullscreenByEsc?: boolean; + fullscreenZIndex?: number; + mapAutoFocus?: boolean; + maxAnimationZoomDifference?: number; + maxZoom?: number; + minZoom?: number; + nativeFullscreen?: boolean; + projection?: IProjection; + restrictMapArea?: boolean; + suppressMapOpenBlock?: boolean; + suppressObsoleteBrowserNotifier?: boolean; + yandexMapAutoSwitch?: boolean; + yandexMapDisablePoiInteractivity?: boolean; + } - class Placemark extends GeoObject { - constructor(geometry: number[] | object | IPointGeometry, properties: object | IDataManager, options?: IPlacemarkOptions) - } + class Placemark extends GeoObject { + constructor(geometry: number[] | object | IPointGeometry, properties: object | IDataManager, options?: IPlacemarkOptions) + } - interface IPlacemarkOptions { - cursor?: string; - draggable?: boolean; + interface IPlacemarkOptions { + cursor?: string; + draggable?: boolean; - [index: string]: any; - } + [index: string]: any; + } - class Popup implements IPopup { - constructor(map: Map, options?: IPopupOptions); + class Popup implements IPopup { + constructor(map: Map, options?: IPopupOptions); - options: IOptionManager; - events: IEventManager; + options: IOptionManager; + events: IEventManager; - close(force?: boolean): Promise; + close(force?: boolean): Promise; - getData(): object; + getData(): object; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay; + getOverlaySync(): IOverlay; - getPosition(): number[]; + getPosition(): number[]; - isOpen(): boolean; + isOpen(): boolean; - open(position: number[], data: object | string | HTMLElement): Promise; + open(position: number[], data: object | string | HTMLElement): Promise; - setData(data: object | string | HTMLElement): Promise; + setData(data: object | string | HTMLElement): Promise; - setPosition(position: number[]): Promise; - } + setPosition(position: number[]): Promise; + } - interface IPopupOptions { - closeTimeout?: number; - interactivityModel?: InteractivityModelKey; - openTimeout?: number; - pane?: IPane | string; - projection?: IProjection; - zIndex?: number; - } + interface IPopupOptions { + closeTimeout?: number; + interactivityModel?: InteractivityModelKey; + openTimeout?: number; + pane?: IPane | string; + projection?: IProjection; + zIndex?: number; + } - function ready(successCallback?: () => any | IReadyobject, errorCallback?: () => any, context?: object): Promise; + function ready(successCallback?: () => any | IReadyobject, errorCallback?: () => any, context?: object): Promise; - interface IReadyobject { - require?: string[]; - context?: object; + interface IReadyobject { + require?: string[]; + context?: object; - successCallback?(): void; + successCallback?(): void; - errorCallback?(): void; - } + errorCallback?(): void; + } - namespace templateLayoutFactory { - function createClass(template: string, overrides?: object, staticMethods?: object): IClassConstructor; - } + namespace templateLayoutFactory { + function createClass(template: string, overrides?: object, staticMethods?: object): IClassConstructor; + } - namespace util { - namespace cursor { - class Accessor { - constructor(key: string); + namespace util { + namespace cursor { + class Accessor { + constructor(key: string); - getKey(): string; + getKey(): string; - remove(): void; + remove(): void; - setKey(): void; - } + setKey(): void; + } - class Manager { - constructor(element: HTMLElement); + class Manager { + constructor(element: HTMLElement); - push(key: string): Accessor; - } - } + push(key: string): Accessor; + } + } - class Storage { - add(key: string, object: object): this; + class Storage { + add(key: string, object: object): this; - get(key: string | object): object | string; + get(key: string | object): object | string; - remove(key: string): object; - } - } + remove(key: string): object; + } + } - /*Interfaces*/ + /*Interfaces*/ - interface IBaloon extends IPopup, ICustomizable, IChild, IFreezable { - autoPan(): Promise; - } + interface IBaloon extends IPopup, ICustomizable, IChild, IFreezable { + autoPan(): Promise; + } - interface IBalloonManager extends IPopupManager { - autoPan(): Promise; - } + interface IBalloonManager extends IPopupManager { + autoPan(): Promise; + } - interface IBaseGeometry extends IEventEmitter { - getBounds(): number[][] | null; + interface IBaseGeometry extends IEventEmitter { + getBounds(): number[][] | null; - getType(): string; - } + getType(): string; + } - interface IBaseLineStringGeometry extends IBaseGeometry, ILineStringGeometryAccess {//tslint:disable-line no-empty-interface no-empty-interfaces - } + interface IBaseLineStringGeometry extends IBaseGeometry, ILineStringGeometryAccess {//tslint:disable-line no-empty-interface no-empty-interfaces + } - interface IBasePointGeometry extends IBaseGeometry, IPointGeometryAccess {//tslint:disable-line no-empty-interface no-empty-interfaces - } + interface IBasePointGeometry extends IBaseGeometry, IPointGeometryAccess {//tslint:disable-line no-empty-interface no-empty-interfaces + } - interface IBehavior extends IChildOnMap, ICustomizable { - disable(): void; + interface IBehavior extends IChildOnMap, ICustomizable { + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; - } + isEnabled(): boolean; + } - interface IChild extends IEventEmitter { - getParent(): object | null; + interface IChild extends IEventEmitter { + getParent(): object | null; - setParent(parent: object | null): this; - } + setParent(parent: object | null): this; + } - interface IChildOnMap extends IChild { //tslint:disable-line no-empty-interface no-empty-interfaces - } + interface IChildOnMap extends IChild { //tslint:disable-line no-empty-interface no-empty-interfaces + } - interface ICircleGeometry extends ICircleGeometryAccess, IGeometry { //tslint:disable-line no-empty-interface no-empty-interfaces - } + interface ICircleGeometry extends ICircleGeometryAccess, IGeometry { //tslint:disable-line no-empty-interface no-empty-interfaces + } - interface ICircleGeometryAccess extends IFreezable { - contains(position: number[]): boolean; + interface ICircleGeometryAccess extends IFreezable { + contains(position: number[]): boolean; - getClosest(anchorPosition: number[]): object; + getClosest(anchorPosition: number[]): object; - getCoordinates(): number[] | null; + getCoordinates(): number[] | null; - getRadius(): number; + getRadius(): number; - setCoordinates(coordinates: number[] | null): this; + setCoordinates(coordinates: number[] | null): this; - setRadius(radius: number): this; - } + setRadius(radius: number): this; + } - interface ICollection extends IEventEmitter { - add(object: object): this; + interface ICollection extends IEventEmitter { + add(object: object): this; - getIterator(): IIterator; + getIterator(): IIterator; - remove(object: object): this; - } + remove(object: object): this; + } - interface IControl extends IChildOnMap { //tslint:disable-line no-empty-interface no-empty-interfaces - // new (options?: object); - } + interface IControl extends IChildOnMap { //tslint:disable-line no-empty-interface no-empty-interfaces + // new (options?: object); + } - interface IControlParent extends IParentOnMap { - getChildElement(child: IControl): Promise; - } + interface IControlParent extends IParentOnMap { + getChildElement(child: IControl): Promise; + } - interface ICoordSystem { - getDistance(point1: number[], point2: number[]): number; + interface ICoordSystem { + getDistance(point1: number[], point2: number[]): number; - solveDirectProblem(startPoint: number[], direction: number[], distance: number): object; + solveDirectProblem(startPoint: number[], direction: number[], distance: number): object; - solveInverseProblem(startPoint: number[], endPoint: number[], reverseDirection?: boolean): object; - } + solveInverseProblem(startPoint: number[], endPoint: number[], reverseDirection?: boolean): object; + } - interface ICopyrightsAccessor extends ICopyrightsProvider { //tslint:disable-line no-empty-interface no-empty-interfaces - } + interface ICopyrightsAccessor extends ICopyrightsProvider { //tslint:disable-line no-empty-interface no-empty-interfaces + } - interface ICopyrightsProvider extends IEventEmitter { - getCopyrights(coords: number[], zoom: number): Promise>; + interface ICopyrightsProvider extends IEventEmitter { + getCopyrights(coords: number[], zoom: number): Promise>; - remove(): void; + remove(): void; - setCopyrights(copyrights: string | HTMLElement | Array): void; - } + setCopyrights(copyrights: string | HTMLElement | Array): void; + } - interface ICustomizable extends IEventEmitter { - options: IOptionManager; - } + interface ICustomizable extends IEventEmitter { + options: IOptionManager; + } - interface IDataManager extends IEventEmitter { - get(path: string, defaultValue: object): object; - } + interface IDataManager extends IEventEmitter { + get(path: string, defaultValue: object): object; + } - interface IDomEventEmitter extends IEventEmitter { //tslint:disable-line no-empty-interface no-empty-interfaces - } + interface IDomEventEmitter extends IEventEmitter { //tslint:disable-line no-empty-interface no-empty-interfaces + } - interface IEvent { - allowMapEvent(): void; + interface IEvent { + allowMapEvent(): void; - callMethod(name: string): void; + callMethod(name: string): void; - get(name: string): object; + get(name: string): object; - getSourceEvent(): IEvent | null; + getSourceEvent(): IEvent | null; - isDefaultPrevented(): boolean; + isDefaultPrevented(): boolean; - isImmediatePropagationStopped(): boolean; + isImmediatePropagationStopped(): boolean; - isMapEventAllowed(): boolean; + isMapEventAllowed(): boolean; - isPropagationStopped(): boolean; + isPropagationStopped(): boolean; - preventDefault(): boolean; + preventDefault(): boolean; - stopImmediatePropagation(): boolean; + stopImmediatePropagation(): boolean; - stopPropagation(): boolean; - } + stopPropagation(): boolean; + } - interface IEventController { - onStartListening?(events: IEventManager, type: string): void; + interface IEventController { + onStartListening?(events: IEventManager, type: string): void; - onStopListening?(events: IEventManager, type: string): void; - } + onStopListening?(events: IEventManager, type: string): void; + } - interface IEventEmitter { - events: IEventManager; - } + interface IEventEmitter { + events: IEventManager; + } - interface IEventGroup { - add(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; + interface IEventGroup { + add(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; - remove(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; + remove(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; - removeAll(): this; - } + removeAll(): this; + } - interface IEventManager extends IEventTrigger { - add(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; + interface IEventManager extends IEventTrigger { + add(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; - getParent(): object | null; + getParent(): object | null; - group(): IEventGroup; + group(): IEventGroup; - //remove(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; + //remove(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; - setParent(parent: object | null): this; - } + setParent(parent: object | null): this; + } - interface IEventTrigger { - fire(type: string, eventobject: object | IEvent): this; - } + interface IEventTrigger { + fire(type: string, eventobject: object | IEvent): this; + } - interface IEventWorkflowController extends IEventController { - onAfterEventFiring?(events: IEventManager, type: string, event?: IEvent): void; + interface IEventWorkflowController extends IEventController { + onAfterEventFiring?(events: IEventManager, type: string, event?: IEvent): void; - onBeforeEventFiring?(events: IEventManager, type: string, event?: IEvent): void; - } + onBeforeEventFiring?(events: IEventManager, type: string, event?: IEvent): void; + } - interface IExpandableControlLayout extends ILayout { //tslint:disable-line no-empty-interface no-empty-interfaces - } + interface IExpandableControlLayout extends ILayout { //tslint:disable-line no-empty-interface no-empty-interfaces + } - interface IFreezable extends IEventManager { - freeze(): IFreezable; + interface IFreezable extends IEventManager { + freeze(): IFreezable; - isFrozen(): boolean; + isFrozen(): boolean; - unfreeze(): IFreezable; - } + unfreeze(): IFreezable; + } - interface IGeocodeProvider { - geocode(request: string, options?: { boundedBy?: number[][], results?: number, skip?: number, strictBounds?: boolean }): Promise; + interface IGeocodeProvider { + geocode(request: string, options?: { boundedBy?: number[][], results?: number, skip?: number, strictBounds?: boolean }): Promise; - suggest(request: string, options?: { boundedBy?: number[][], results?: number, strictBounds?: boolean }): Promise; - } + suggest(request: string, options?: { boundedBy?: number[][], results?: number, strictBounds?: boolean }): Promise; + } - interface IGeometry extends IBaseGeometry, ICustomizable { - getMap(): Map | null; + interface IGeometry extends IBaseGeometry, ICustomizable { + getMap(): Map | null; - getPixelGeometry(options?: object): IPixelGeometry; + getPixelGeometry(options?: object): IPixelGeometry; - setMap(map: Map): void; - } + setMap(map: Map): void; + } - interface IGeometryEditor extends ICustomizable, IEventEmitter { - startEditing(): void; + interface IGeometryEditor extends ICustomizable, IEventEmitter { + startEditing(): void; - stopEditing(): void; - } + stopEditing(): void; + } - interface IGeometryJson { - type: string; - } + interface IGeometryJson { + type: string; + } - interface IGeoObject extends IChildOnMap, ICustomizable, IDomEventEmitter, IParentOnMap { - geometry: IGeometry | null; - properties: IDataManager; - state: IDataManager; + interface IGeoObject extends IChildOnMap, ICustomizable, IDomEventEmitter, IParentOnMap { + geometry: IGeometry | null; + properties: IDataManager; + state: IDataManager; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; - } + getOverlaySync(): IOverlay | null; + } - interface IGeoObjectCollection extends ICustomizable, IEventEmitter, IParentOnMap { - add(child: IGeoObject, index?: number): this; + interface IGeoObjectCollection extends ICustomizable, IEventEmitter, IParentOnMap { + add(child: IGeoObject, index?: number): this; - each(callback: (object: IGeoObject) => void, context: object): void; + each(callback: (object: IGeoObject) => void, context: object): void; - get(index: number): IGeoObject; + get(index: number): IGeoObject; - getBounds(): number[][] | null; + getBounds(): number[][] | null; - getIterator(): IIterator; + getIterator(): IIterator; - getLength(): number; + getLength(): number; - getPixelBounds(): number[][] | null; + getPixelBounds(): number[][] | null; - indexOf(object: IGeoObject): number; + indexOf(object: IGeoObject): number; - remove(child: IGeoObject): this; + remove(child: IGeoObject): this; - removeAll(): this; + removeAll(): this; - set(index: number, child: IGeoObject): this; + set(index: number, child: IGeoObject): this; - splice(index: number, length: number): this; - } + splice(index: number, length: number): this; + } - interface IGeoObjectSequence extends ICustomizable, IEventEmitter, IParentOnMap { - each(callback: (geoObject: IGeoObject) => void, context?: object): void; + interface IGeoObjectSequence extends ICustomizable, IEventEmitter, IParentOnMap { + each(callback: (geoObject: IGeoObject) => void, context?: object): void; - get(index: number): IGeoObject; + get(index: number): IGeoObject; - getBounds(): number[][] | null; + getBounds(): number[][] | null; - getIterator(): IIterator; + getIterator(): IIterator; - getLength(): number; + getLength(): number; - getPixelBounds(): number[][] | null; + getPixelBounds(): number[][] | null; - indexOf(geoObject: IGeoObject): number; - } + indexOf(geoObject: IGeoObject): number; + } - interface IHintManager extends IPopupManager { //tslint:disable-line no-empty-interface no-empty-interfaces - } + interface IHintManager extends IPopupManager { //tslint:disable-line no-empty-interface no-empty-interfaces + } - interface IIterator { - getNext(): object | null; - } + interface IIterator { + getNext(): object | null; + } - interface ILayer extends IChildOnMap, ICustomizable, IEventEmitter { - getBrightness?(): number; + interface ILayer extends IChildOnMap, ICustomizable, IEventEmitter { + getBrightness?(): number; - getCopyrights?(coords: number[], zoom: number): Promise>; + getCopyrights?(coords: number[], zoom: number): Promise>; - getZoomRange?(point: number[]): Promise; - } + getZoomRange?(point: number[]): Promise; + } - interface ILayout extends IDomEventEmitter { - // new (data: object); - destroy(): void; + interface ILayout extends IDomEventEmitter { + // new (data: object); + destroy(): void; - getData(): object; + getData(): object; - getParentElement(): HTMLElement; + getParentElement(): HTMLElement; - getShape(): IShape | null; + getShape(): IShape | null; - isEmpty(): boolean; + isEmpty(): boolean; - setData(data: object): void; + setData(data: object): void; - setParentElement(parent: HTMLElement | null): void; - } + setParentElement(parent: HTMLElement | null): void; + } - interface ILineStringGeometry extends IGeometry, ILineStringGeometryAccess { //tslint:disable-line no-empty-interface no-empty-interfaces - } + interface ILineStringGeometry extends IGeometry, ILineStringGeometryAccess { //tslint:disable-line no-empty-interface no-empty-interfaces + } - interface ILineStringGeometryAccess extends IFreezable { - get(index: number): number[]; + interface ILineStringGeometryAccess extends IFreezable { + get(index: number): number[]; - getChildGeometry(index: number): IPointGeometryAccess; + getChildGeometry(index: number): IPointGeometryAccess; - getClosest(anchorPosition: number[]): object; + getClosest(anchorPosition: number[]): object; - getCoordinates(): number[][]; + getCoordinates(): number[][]; - getLength(): number; + getLength(): number; - insert(index: number, coordinates: number[][]): ILineStringGeometryAccess; + insert(index: number, coordinates: number[][]): ILineStringGeometryAccess; - remove(index: number): number[]; + remove(index: number): number[]; - set(index: number, coordinates: number[]): ILineStringGeometryAccess; + set(index: number, coordinates: number[]): ILineStringGeometryAccess; - setCoordinates(coordinates: number[]): ILineStringGeometryAccess; + setCoordinates(coordinates: number[]): ILineStringGeometryAccess; - splice(index: number, length: number): number[][]; - } + splice(index: number, length: number): number[][]; + } - interface IMapAction extends IEventEmitter { - begin(mapActionManager: map.action.Manager): void; + interface IMapAction extends IEventEmitter { + begin(mapActionManager: map.action.Manager): void; - end(): void; - } + end(): void; + } - interface IMapObjectCollection extends ICollection, ICustomizable, IParentOnMap { //tslint:disable-line no-empty-interface no-empty-interfaces - } + interface IMapObjectCollection extends ICollection, ICustomizable, IParentOnMap { //tslint:disable-line no-empty-interface no-empty-interfaces + } - interface IMultiRouteModelJson { - params: IMultiRouteParams; - referencePoints: IMultiRouteReferencePoint[]; - } + interface IMultiRouteModelJson { + params: IMultiRouteParams; + referencePoints: IMultiRouteReferencePoint[]; + } - interface IMultiRouteParams { - avoidTrafficJams?: boolean; - boundedBy?: number[][] | null; - requestSendInterval?: string | number; - results?: number; - reverseGeocoding?: boolean; - routingMode?: "auto" | "masstransit" | "pedestrian"; - searchCoordOrder?: string; - strictBounds?: boolean; - viaIndexes?: number[]; - } + interface IMultiRouteParams { + avoidTrafficJams?: boolean; + boundedBy?: number[][] | null; + requestSendInterval?: string | number; + results?: number; + reverseGeocoding?: boolean; + routingMode?: "auto" | "masstransit" | "pedestrian"; + searchCoordOrder?: string; + strictBounds?: boolean; + viaIndexes?: number[]; + } - type IMultiRouteReferencePoint = string | number[] | geometry.Point; + type IMultiRouteReferencePoint = string | number[] | geometry.Point; - interface IOptionManager extends IChild, IEventEmitter, IFreezable { - get(key: string, defaultValue: object): object; + interface IOptionManager extends IChild, IEventEmitter, IFreezable { + get(key: string, defaultValue: object): object; - getAll(): object; + getAll(): object; - getName(): string; + getName(): string; - getNative(key: string): object; + getNative(key: string): object; - resolve(key: string, name?: string): object; + resolve(key: string, name?: string): object; - setName(name: string): void; - } + setName(name: string): void; + } - interface IOverlay extends ICustomizable, IDomEventEmitter { - getData(): object; + interface IOverlay extends ICustomizable, IDomEventEmitter { + getData(): object; - getGeometry(): IPixelGeometry; + getGeometry(): IPixelGeometry; - getMap(): Map | null; + getMap(): Map | null; - getShape(): IShape | null; + getShape(): IShape | null; - isEmpty(): boolean; + isEmpty(): boolean; - setData(data: object): void; + setData(data: object): void; - setGeometry(geometry: IPixelGeometry): void; + setGeometry(geometry: IPixelGeometry): void; - setMap(map: Map | null): void; - } + setMap(map: Map | null): void; + } - interface IPane extends IEventEmitter { - destroy(): void; + interface IPane extends IEventEmitter { + destroy(): void; - getElement(): HTMLElement; + getElement(): HTMLElement; - getMap(): Map; + getMap(): Map; - getOverflow(): "visible" | "hidden"; + getOverflow(): "visible" | "hidden"; - getZIndex(): number; - } + getZIndex(): number; + } - interface IPanorama { - getAngularBBox(): number[]; + interface IPanorama { + getAngularBBox(): number[]; - getConnectionArrows(): IPanoramaConnectionArrow[]; + getConnectionArrows(): IPanoramaConnectionArrow[]; - getConnectionMarkers(): IPanoramaConnectionMarker[]; + getConnectionMarkers(): IPanoramaConnectionMarker[]; - getCoordSystem(): ICoordSystem; + getCoordSystem(): ICoordSystem; - getDefaultDirection(): number[]; + getDefaultDirection(): number[]; - getDefaultSpan(): number[]; + getDefaultSpan(): number[]; - getGraph(): IPanoramaGraph | null; + getGraph(): IPanoramaGraph | null; - getMarkers(): IPanoramaMarker[]; + getMarkers(): IPanoramaMarker[]; - getName(): string; + getName(): string; - getPosition(): number[]; + getPosition(): number[]; - getTileLevels(): IPanoramaTileLevel[]; + getTileLevels(): IPanoramaTileLevel[]; - getTileSize(): number[]; - } + getTileSize(): number[]; + } - interface IPanoramaConnection { - getConnectedPanorama(): Promise; - } + interface IPanoramaConnection { + getConnectedPanorama(): Promise; + } - interface IPanoramaConnectionArrow extends IPanoramaConnection { - properties: data.Manager; + interface IPanoramaConnectionArrow extends IPanoramaConnection { + properties: data.Manager; - getDirection(): number[]; + getDirection(): number[]; - getPanorama(): IPanorama; - } + getPanorama(): IPanorama; + } - interface IPanoramaConnectionMarker extends IPanoramaConnection, IPanoramaMarker { //tslint:disable-line no-empty-interface no-empty-interfaces - } + interface IPanoramaConnectionMarker extends IPanoramaConnection, IPanoramaMarker { //tslint:disable-line no-empty-interface no-empty-interfaces + } - interface IPanoramaGraph { - getEdges(): IPanoramaGraphEdge[]; + interface IPanoramaGraph { + getEdges(): IPanoramaGraphEdge[]; - getNodes(): IPanoramaGraphEdge[]; + getNodes(): IPanoramaGraphEdge[]; - getPanorama(): IPanorama; - } + getPanorama(): IPanorama; + } - interface IPanoramaGraphEdge { - getEndNodes(): IPanoramaGraphNode[]; - } + interface IPanoramaGraphEdge { + getEndNodes(): IPanoramaGraphNode[]; + } - interface IPanoramaGraphNode { - getConnectedPanorama(): Promise; - } + interface IPanoramaGraphNode { + getConnectedPanorama(): Promise; + } - interface IPanoramaMarker { - properties: data.Manager; + interface IPanoramaMarker { + properties: data.Manager; - getIconSet(): Promise; + getIconSet(): Promise; - getPanorama(): IPanorama; + getPanorama(): IPanorama; - getPosition(): number[]; - } + getPosition(): number[]; + } - interface IPanoramaMarkerIcon { - image: HTMLCanvasElement | HTMLImageElement; - offset: number[]; - } + interface IPanoramaMarkerIcon { + image: HTMLCanvasElement | HTMLImageElement; + offset: number[]; + } - interface IPanoramaMarkerIconSet { - default: IPanoramaMarkerIcon | null; - expanded: IPanoramaMarkerIcon | null; - expandedHovered: IPanoramaMarkerIcon | null; - hovered: IPanoramaMarkerIcon | null; - } + interface IPanoramaMarkerIconSet { + default: IPanoramaMarkerIcon | null; + expanded: IPanoramaMarkerIcon | null; + expandedHovered: IPanoramaMarkerIcon | null; + hovered: IPanoramaMarkerIcon | null; + } - interface IPanoramaTileLevel { - getImageSize(): number[]; + interface IPanoramaTileLevel { + getImageSize(): number[]; - getTileUrl(x: number, y: number): string; - } + getTileUrl(x: number, y: number): string; + } - interface IParentOnMap { - getMap(): Map; - } + interface IParentOnMap { + getMap(): Map; + } - interface IPixelCircleGeometry extends IPixelGeometry { - getCoordinates(): number[]; + interface IPixelCircleGeometry extends IPixelGeometry { + getCoordinates(): number[]; - getRadius(): number; - } + getRadius(): number; + } - interface IPixelLineStringGeometry extends IPixelGeometry { - getClosest(anchorPosition: number[]): object; + interface IPixelLineStringGeometry extends IPixelGeometry { + getClosest(anchorPosition: number[]): object; - getCoordinates(): number[][]; + getCoordinates(): number[][]; - getLength(): number; - } + getLength(): number; + } - interface IPixelGeometry extends IBaseGeometry { - equals(geometry: IPixelGeometry): boolean; + interface IPixelGeometry extends IBaseGeometry { + equals(geometry: IPixelGeometry): boolean; - getMetaData(): object; + getMetaData(): object; - scale(factor: number): IPixelGeometry; + scale(factor: number): IPixelGeometry; - shift(offset: number[]): IPixelGeometry; - } + shift(offset: number[]): IPixelGeometry; + } - interface IPointGeometry extends IGeometry, IPointGeometryAccess { //tslint:disable-line no-empty-interface no-empty-interfaces - } + interface IPointGeometry extends IGeometry, IPointGeometryAccess { //tslint:disable-line no-empty-interface no-empty-interfaces + } - interface IPointGeometryAccess { - getCoordinates(): number[] | null; + interface IPointGeometryAccess { + getCoordinates(): number[] | null; - setCoordinates(coordinates: number[] | null): this; - } + setCoordinates(coordinates: number[] | null): this; + } - interface IPopup extends ICustomizable, IEventEmitter { - close(force?: boolean): Promise; + interface IPopup extends ICustomizable, IEventEmitter { + close(force?: boolean): Promise; - getData(): object; + getData(): object; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay; + getOverlaySync(): IOverlay; - getPosition(): number[]; + getPosition(): number[]; - isOpen(): boolean; + isOpen(): boolean; - open(position: number[], data: object | string | HTMLElement): Promise; + open(position: number[], data: object | string | HTMLElement): Promise; - setData(data: object | string | HTMLElement): Promise; + setData(data: object | string | HTMLElement): Promise; - setPosition(position: number[]): Promise; - } + setPosition(position: number[]): Promise; + } - interface IPopupManager extends IEventEmitter { - close(force?: boolean): Promise; + interface IPopupManager extends IEventEmitter { + close(force?: boolean): Promise; - destroy(): void; + destroy(): void; - getData(): object | null; + getData(): object | null; - getOptions(): IOptionManager | null; + getOptions(): IOptionManager | null; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getPosition(): number[] | null; + getPosition(): number[] | null; - isOpen(): boolean; + isOpen(): boolean; - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - setData(data: object | string | HTMLElement): Promise; + setData(data: object | string | HTMLElement): Promise; - setOptions(options: object): Promise; + setOptions(options: object): Promise; - setPosition(position: number[]): Promise; - } + setPosition(position: number[]): Promise; + } - interface IPositioningContext { - fromClientPixels(clientPixelPoint: number[]): number[]; + interface IPositioningContext { + fromClientPixels(clientPixelPoint: number[]): number[]; - getZoom(): number; + getZoom(): number; - toClientPixels(globalPixelPoint: number[]): number[]; - } + toClientPixels(globalPixelPoint: number[]): number[]; + } - interface IProjection { - fromGlobalPixels(globalPixelPoint: number[], zoom: number): number[]; + interface IProjection { + fromGlobalPixels(globalPixelPoint: number[], zoom: number): number[]; - getCoordSystem(): ICoordSystem; + getCoordSystem(): ICoordSystem; - isCycled(): boolean[]; + isCycled(): boolean[]; - toGlobalPixels(coordPoint: number[], zoom: number): number[]; - } + toGlobalPixels(coordPoint: number[], zoom: number): number[]; + } - interface IRoutePanel { - options: IOptionManager; - state: IDataManager; + interface IRoutePanel { + options: IOptionManager; + state: IDataManager; - getRoute(): multiRouter.MultiRoute; + getRoute(): multiRouter.MultiRoute; - switchPoints(): void; - } + switchPoints(): void; + } - interface ISearchControlLayout extends IExpandableControlLayout { //tslint:disable-line no-empty-interface no-empty-interfaces - } + interface ISearchControlLayout extends IExpandableControlLayout { //tslint:disable-line no-empty-interface no-empty-interfaces + } - interface ISelectableControl extends IControl { - deselect(): void; + interface ISelectableControl extends IControl { + deselect(): void; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - isSelected(): boolean; + isSelected(): boolean; - select(): void; - } + select(): void; + } - interface ISelectableControlLayout extends ILayout { //tslint:disable-line no-empty-interface no-empty-interfaces - } + interface ISelectableControlLayout extends ILayout { //tslint:disable-line no-empty-interface no-empty-interfaces + } - interface IShape { - contains(position: number[]): boolean; + interface IShape { + contains(position: number[]): boolean; - equals(shape: IShape): boolean; + equals(shape: IShape): boolean; - getBounds(): number[][] | null; + getBounds(): number[][] | null; - getGeometry(): IPixelGeometry; + getGeometry(): IPixelGeometry; - getType(): string; + getType(): string; - scale(factor: number): IShape; + scale(factor: number): IShape; + + shift(offset: number[]): IShape; + } + + class Monitor { + constructor(dataManager: IDataManager | IOptionManager); + add(name: string[] | string, changeCallback: (event: (object | IEvent)) => void, context?: any, params?: any): Monitor; + forceChange(): Monitor; + get(name: string): any; + remove(name: string): Monitor; + removeAll(): Monitor; + } - shift(offset: number[]): IShape; - } - - class Monitor { - constructor(dataManager: IDataManager | IOptionManager); - add(name: string[] | string, changeCallback: (event: (object | IEvent)) => void, context?: any, params?: any): Monitor; - forceChange(): Monitor; - get(name: string): any; - remove(name: string): Monitor; - removeAll(): Monitor; - } - class Polyline extends GeoObject { constructor(geometry: number[][] | object | ILineStringGeometry, properties: object | IDataManager, options?: IPolylineOptions); } - interface IPolylineOptions { - cursor?: string; + interface IPolylineOptions { + cursor?: string; [index: string]: any; } } From d61496670ffe1e77ca8451afa1f58c4614782fc7 Mon Sep 17 00:00:00 2001 From: AlexeyTokmakov Date: Fri, 7 Dec 2018 15:16:05 +0300 Subject: [PATCH 165/241] Update yandex-maps-tests.ts --- types/yandex-maps/yandex-maps-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/yandex-maps/yandex-maps-tests.ts b/types/yandex-maps/yandex-maps-tests.ts index 2406ef6cd6..c300679d35 100644 --- a/types/yandex-maps/yandex-maps-tests.ts +++ b/types/yandex-maps/yandex-maps-tests.ts @@ -22,8 +22,8 @@ const balloonLayout = ymaps.templateLayoutFactory.createClass( "
    ", { build(this: ymaps.ILayout): void { - ( ( this.constructor).superclass).build.call(this); - this.getParentElement().children.item(0)!.children.item(0)!.appendChild(( this.getData()).properties.get("balloonContent")); + ((this.constructor as any).superclass as ymaps.layout.templateBased.Base).build.call(this); + this.getParentElement().children.item(0)!.children.item(0)!.appendChild((this.getData() as any).properties.get("balloonContent")); } } ); @@ -52,6 +52,6 @@ mapMarker.events.add("click", (event: ymaps.Event) => { map.geoObjects.add(mapMarker); -map.setCenter(( mapMarker.geometry).getCoordinates() || [55.76, 37.64]); +map.setCenter((mapMarker.geometry as ymaps.IPointGeometry).getCoordinates() || [55.76, 37.64]); map.setZoom(13); From be97f863f040390410f692dbe6a284e32cb884dd Mon Sep 17 00:00:00 2001 From: Alexaner T Date: Fri, 7 Dec 2018 16:20:48 +0200 Subject: [PATCH 166/241] Add invertStickyHeaders prop to ScrollView --- types/react-native/index.d.ts | 6 ++++++ types/react-native/test/index.tsx | 1 + 2 files changed, 7 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 24e4aee9dc..ae3127bc1d 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -6337,6 +6337,12 @@ export interface ScrollViewProps */ horizontal?: boolean; + /** + * If sticky headers should stick at the bottom instead of the top of the + * ScrollView. This is usually used with inverted ScrollViews. + */ + invertStickyHeaders?: boolean; + /** * Determines whether the keyboard gets dismissed in response to a drag. * - 'none' (the default) drags do not dismiss the keyboard. diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index b5d7a5faeb..79c5a111ca 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -430,6 +430,7 @@ class ScrollerListComponentTest extends React.Component< Date: Fri, 7 Dec 2018 15:30:24 +0100 Subject: [PATCH 167/241] Add a missing getSlideById method to the Presentation --- types/google-apps-script/google-apps-script.slides.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/google-apps-script/google-apps-script.slides.d.ts b/types/google-apps-script/google-apps-script.slides.d.ts index 90e034ff60..434e3ad4fc 100644 --- a/types/google-apps-script/google-apps-script.slides.d.ts +++ b/types/google-apps-script/google-apps-script.slides.d.ts @@ -840,6 +840,7 @@ declare namespace GoogleAppsScript { getPageWidth(): Number; getSelection(): Selection; getSlides(): Slide[]; + getSlideById(id: string): Slide; getUrl(): string; getViewers(): Base.User[]; insertSlide(insertionIndex: Integer): Slide; From 424cdc79f7e9d707ba08e3da1c81c5a61f52bb5c Mon Sep 17 00:00:00 2001 From: Dominik Palo Date: Fri, 7 Dec 2018 15:42:26 +0100 Subject: [PATCH 168/241] Fix ordering --- types/google-apps-script/google-apps-script.slides.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/google-apps-script/google-apps-script.slides.d.ts b/types/google-apps-script/google-apps-script.slides.d.ts index 434e3ad4fc..68e61914a1 100644 --- a/types/google-apps-script/google-apps-script.slides.d.ts +++ b/types/google-apps-script/google-apps-script.slides.d.ts @@ -839,8 +839,8 @@ declare namespace GoogleAppsScript { getPageHeight(): Number; getPageWidth(): Number; getSelection(): Selection; - getSlides(): Slide[]; getSlideById(id: string): Slide; + getSlides(): Slide[]; getUrl(): string; getViewers(): Base.User[]; insertSlide(insertionIndex: Integer): Slide; From 22671903858e1ce2c0fd4bf0c72bc6feebbec96d Mon Sep 17 00:00:00 2001 From: ThibaudAv Date: Fri, 7 Dec 2018 15:46:22 +0100 Subject: [PATCH 169/241] Update Intro.Js types --- types/intro.js/index.d.ts | 6 +++++- types/intro.js/intro.js-tests.ts | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/types/intro.js/index.d.ts b/types/intro.js/index.d.ts index ec27d19439..40603bed1d 100644 --- a/types/intro.js/index.d.ts +++ b/types/intro.js/index.d.ts @@ -7,7 +7,11 @@ declare namespace IntroJs { interface Step { intro: string; element?: string|HTMLElement|Element; - position?: string; + position?: "top"|"left"|"right"|"bottom"|"bottom-left-aligned"|"bottom-middle-aligned"|"bottom-right-aligned"|"auto"; + tooltipClass?: string; + highlightClass?: string; + scrollTo?: "off"|"tooltip"|"element"; + disableInteraction?: boolean; } interface Hint { diff --git a/types/intro.js/intro.js-tests.ts b/types/intro.js/intro.js-tests.ts index d40fbe3f36..44b2f238d3 100644 --- a/types/intro.js/intro.js-tests.ts +++ b/types/intro.js/intro.js-tests.ts @@ -31,13 +31,22 @@ intro.setOptions({ position: 'left' }, { - element : '#step4', - intro : "Another step.", - position: 'bottom' + element : '#step4', + intro : "Another step.", + position : 'bottom', + tooltipClass : 'step4Class', + highlightClass: '' }, { - element: '#step5', - intro : 'Get it, use it.' + element : '#step4', + intro : "Another step.", + position: 'bottom', + scrollTo: 'tooltip' + }, + { + element : '#step5', + intro : 'Get it, use it.', + disableInteraction: true } ], hints: [ From 1a9082286f4f6d6f72787faa3fa9a647aff16c95 Mon Sep 17 00:00:00 2001 From: Dominik Palo Date: Fri, 7 Dec 2018 18:47:10 +0100 Subject: [PATCH 170/241] Add a missing getPageElementById method to the Presentation --- types/google-apps-script/google-apps-script.slides.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/google-apps-script/google-apps-script.slides.d.ts b/types/google-apps-script/google-apps-script.slides.d.ts index 68e61914a1..3d1aac9227 100644 --- a/types/google-apps-script/google-apps-script.slides.d.ts +++ b/types/google-apps-script/google-apps-script.slides.d.ts @@ -836,6 +836,7 @@ declare namespace GoogleAppsScript { getNotesMaster(): NotesMaster; getNotesPageHeight(): Number; getNotesPageWidth(): Number; + getPageElementById(id: string): PageElement; getPageHeight(): Number; getPageWidth(): Number; getSelection(): Selection; From 3f5782e055177f76e0b754acb48947a364f262ea Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Fri, 7 Dec 2018 21:20:54 +0100 Subject: [PATCH 171/241] Add types for @sindresorhus/to-milliseconds --- .../sindresorhus__to-milliseconds/index.d.ts | 20 +++++++++++++ .../sindresorhus__to-milliseconds-tests.ts | 24 ++++++++++++++++ .../tsconfig.json | 28 +++++++++++++++++++ .../sindresorhus__to-milliseconds/tslint.json | 1 + 4 files changed, 73 insertions(+) create mode 100644 types/sindresorhus__to-milliseconds/index.d.ts create mode 100644 types/sindresorhus__to-milliseconds/sindresorhus__to-milliseconds-tests.ts create mode 100644 types/sindresorhus__to-milliseconds/tsconfig.json create mode 100644 types/sindresorhus__to-milliseconds/tslint.json diff --git a/types/sindresorhus__to-milliseconds/index.d.ts b/types/sindresorhus__to-milliseconds/index.d.ts new file mode 100644 index 0000000000..8eb44b2a7b --- /dev/null +++ b/types/sindresorhus__to-milliseconds/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for @sindresorhus/to-milliseconds 1.0 +// Project: https://github.com/sindresorhus/to-milliseconds +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = toMilliseconds; + +declare function toMilliseconds(input: toMilliseconds.TimeSpec): number; + +declare namespace toMilliseconds { + interface TimeSpec { + days?: number; + hours?: number; + minutes?: number; + seconds?: number; + milliseconds?: number; + microseconds?: number; + nanoseconds?: number; + } +} diff --git a/types/sindresorhus__to-milliseconds/sindresorhus__to-milliseconds-tests.ts b/types/sindresorhus__to-milliseconds/sindresorhus__to-milliseconds-tests.ts new file mode 100644 index 0000000000..aff7ba6fe0 --- /dev/null +++ b/types/sindresorhus__to-milliseconds/sindresorhus__to-milliseconds-tests.ts @@ -0,0 +1,24 @@ +import toMilliseconds = require('@sindresorhus/to-milliseconds'); + +// $ExpectType number +toMilliseconds({ + days: 15, +}); +toMilliseconds({ + hours: 11, +}); +toMilliseconds({ + minutes: 23, +}); +toMilliseconds({ + seconds: 20, +}); +toMilliseconds({ + milliseconds: 1, +}); +toMilliseconds({ + microseconds: 1, +}); +toMilliseconds({ + nanoseconds: 1, +}); diff --git a/types/sindresorhus__to-milliseconds/tsconfig.json b/types/sindresorhus__to-milliseconds/tsconfig.json new file mode 100644 index 0000000000..be9b1a9bec --- /dev/null +++ b/types/sindresorhus__to-milliseconds/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "paths": { + "@sindresorhus/to-milliseconds": [ + "sindresorhus__to-milliseconds" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "sindresorhus__to-milliseconds-tests.ts" + ] +} diff --git a/types/sindresorhus__to-milliseconds/tslint.json b/types/sindresorhus__to-milliseconds/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sindresorhus__to-milliseconds/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b76386c8638d89874adc15f38e2dd4bb2c039027 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Fri, 7 Dec 2018 22:24:17 +0100 Subject: [PATCH 172/241] Add types for crypto-hash --- types/crypto-hash/crypto-hash-tests.ts | 29 ++++++++++++++++ types/crypto-hash/index.d.ts | 48 ++++++++++++++++++++++++++ types/crypto-hash/tsconfig.json | 23 ++++++++++++ types/crypto-hash/tslint.json | 1 + 4 files changed, 101 insertions(+) create mode 100644 types/crypto-hash/crypto-hash-tests.ts create mode 100644 types/crypto-hash/index.d.ts create mode 100644 types/crypto-hash/tsconfig.json create mode 100644 types/crypto-hash/tslint.json diff --git a/types/crypto-hash/crypto-hash-tests.ts b/types/crypto-hash/crypto-hash-tests.ts new file mode 100644 index 0000000000..73e62ad1c6 --- /dev/null +++ b/types/crypto-hash/crypto-hash-tests.ts @@ -0,0 +1,29 @@ +import { sha1, sha256, sha384, sha512 } from 'crypto-hash'; + +// $ExpectType Promise +sha1('🦄'); +// $ExpectType Promise +sha1('🦄', { outputFormat: 'buffer' }); +// $ExpectType Promise +sha1('🦄', { outputFormat: 'hex' }); + +// $ExpectType Promise +sha256('🦄'); +// $ExpectType Promise +sha256('🦄', { outputFormat: 'buffer' }); +// $ExpectType Promise +sha256('🦄', { outputFormat: 'hex' }); + +// $ExpectType Promise +sha384('🦄'); +// $ExpectType Promise +sha384('🦄', { outputFormat: 'buffer' }); +// $ExpectType Promise +sha384('🦄', { outputFormat: 'hex' }); + +// $ExpectType Promise +sha512('🦄'); +// $ExpectType Promise +sha512('🦄', { outputFormat: 'buffer' }); +// $ExpectType Promise +sha512('🦄', { outputFormat: 'hex' }); diff --git a/types/crypto-hash/index.d.ts b/types/crypto-hash/index.d.ts new file mode 100644 index 0000000000..c22864b2ae --- /dev/null +++ b/types/crypto-hash/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for crypto-hash 1.0 +// Project: https://github.com/sindresorhus/crypto-hash#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function sha1( + buffer: string | ArrayBuffer | ArrayBufferView, + options?: OptionsHexOutput +): Promise; +export function sha1( + buffer: string | ArrayBuffer | ArrayBufferView, + options: OptionBufferOutput +): Promise; + +export function sha256( + buffer: string | ArrayBuffer | ArrayBufferView, + options?: OptionsHexOutput +): Promise; +export function sha256( + buffer: string | ArrayBuffer | ArrayBufferView, + options: OptionBufferOutput +): Promise; + +export function sha384( + buffer: string | ArrayBuffer | ArrayBufferView, + options?: OptionsHexOutput +): Promise; +export function sha384( + buffer: string | ArrayBuffer | ArrayBufferView, + options: OptionBufferOutput +): Promise; + +export function sha512( + buffer: string | ArrayBuffer | ArrayBufferView, + options?: OptionsHexOutput +): Promise; +export function sha512( + buffer: string | ArrayBuffer | ArrayBufferView, + options: OptionBufferOutput +): Promise; + +export interface OptionsHexOutput { + outputFormat?: 'hex'; +} + +export interface OptionBufferOutput { + outputFormat: 'buffer'; +} diff --git a/types/crypto-hash/tsconfig.json b/types/crypto-hash/tsconfig.json new file mode 100644 index 0000000000..410ee34985 --- /dev/null +++ b/types/crypto-hash/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", + "crypto-hash-tests.ts" + ] +} diff --git a/types/crypto-hash/tslint.json b/types/crypto-hash/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/crypto-hash/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From cafab0196145ec7461463418b24f8b4f9d1cd4c0 Mon Sep 17 00:00:00 2001 From: Alvaro J Cruz Date: Fri, 7 Dec 2018 15:59:40 -0500 Subject: [PATCH 173/241] Add types for dynaTrace ADK --- types/dynatrace/dynatrace-tests.ts | 88 +++++++++++ types/dynatrace/index.d.ts | 234 +++++++++++++++++++++++++++++ types/dynatrace/tsconfig.json | 23 +++ types/dynatrace/tslint.json | 1 + 4 files changed, 346 insertions(+) create mode 100644 types/dynatrace/dynatrace-tests.ts create mode 100644 types/dynatrace/index.d.ts create mode 100644 types/dynatrace/tsconfig.json create mode 100644 types/dynatrace/tslint.json diff --git a/types/dynatrace/dynatrace-tests.ts b/types/dynatrace/dynatrace-tests.ts new file mode 100644 index 0000000000..027b924cf9 --- /dev/null +++ b/types/dynatrace/dynatrace-tests.ts @@ -0,0 +1,88 @@ +function customActions() { + const actionId = dynaTrace.enterAction("my custom action", "click"); + dynaTrace.leaveAction(actionId); +} + +function customVisit() { + dynaTrace.tagVisit("My Custom Visit"); + /** after some code execution we can end the visit early */ + dynaTrace.endVisit(); +} + +function signal() { + dynaTrace.signalLoadStart(); + dynaTrace.signalLoadEnd(); + dynaTrace.signalOnLoadStart(); + dynaTrace.signalOnLoadEnd(); + + dynaTrace.sendSignal(false, false, true); +} + +function load() { + dynaTrace.setLoadEndManually(); + dynaTrace.incrementOnLoadEndMarkers(); +} + +function automaticDetection() { + dynaTrace.setAutomaticActionDetection(false); +} + +function reporting() { + dynaTrace.reportError(" Custom error"); + const actionId = dynaTrace.enterAction("second action", "keypress"); + dynaTrace.reportError("Second custom error", actionId); + + dynaTrace.reportEvent("My Event"); + dynaTrace.reportString("My Key", "Custom value"); + dynaTrace.reportValue("Value Key", 2); + dynaTrace.reportWarning("Warning"); +} + +function thirdParty() { + const url = "http://somescript.com"; + dynaTrace.startThirdParty("s", url); + dynaTrace.stopThirdParty(url, true, Date.now() - 1000, Date.now()); +} + +function listener() { + const clickListener = (key: string) => ({}); + dynaTrace.addPageLeavingListener(clickListener); +} + +function streaming() { + dynaTrace.addStreamingNode( + "http://youtube.com", + 120, + true, + false, + 120, + 30, + 10, + 5, + "_info_" + ); +} + +function userInput() { + const userInput = dynaTrace.beginUserInput("", "click", "RETURN", 23); + dynaTrace.endUserInput(userInput); +} + +function Xhr() { + const enterActionId = dynaTrace.enterXhrAction( + "Angular Http request", + 0, + false + ); + dynaTrace.enterXhrCallback(enterActionId); + dynaTrace.leaveXhrCallback(enterActionId); + dynaTrace.leaveXhrAction(enterActionId); +} + +function appVersion() { + dynaTrace.setAppVersion("1.1.1"); +} + +function metadata() { + dynaTrace.setMetaData("some metadata", "value"); +} diff --git a/types/dynatrace/index.d.ts b/types/dynatrace/index.d.ts new file mode 100644 index 0000000000..5627e6b1db --- /dev/null +++ b/types/dynatrace/index.d.ts @@ -0,0 +1,234 @@ +// Type definitions for dynatrace 1.0 +// Project: https://www.dynatrace.com/ +// Definitions by: Alvaro Cruz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface dynaTrace { + /** + * @description disable automatic detection + * Use in conjuction with enterAction + * @example + * dynaTrace.setAutomaticActionDetection(false); + * dynaTrace.enterAction('action message', 'select', null, null); + */ + setAutomaticActionDetection(on: boolean): void; + /** + * @description capture load event manually. + * followed by a signalLoadEnd to complete the capture. + */ + setLoadEndManually(): void; + /** + * @description Signal load start. If load start can be determined more accurately + * than the automatic detection, this function can be used. + */ + signalLoadStart(): void; + /** + * @description Signals that the page has finished loading + */ + signalLoadEnd(): void; + /** + * @description Force signal sending to make certain that actions aren't lost. + * @param forceSync - Force synchronous sending of signal (if false, it'll be sent asynchronously) + * @param sendPreview - Force sending of preview signals which haven't been closed yet. + * @param killUnfinished - Kills unfinished actions and sends them immediately. Handle with care, actions might be inaccurate. + */ + sendSignal( + forceSync: boolean, + sendPreview: boolean, + killUnfinished: boolean + ): void; + /** + * @description parentAction: optional id of parent action. + * - if parameter is not passed => appended to currently running action + * - if a number is passed => action is added as subaction to action with given id + * - if false => new root action is started. + * The function returns an internal tracking object that represents the action that was started. + * This tracking object must be passed to dynaTrace.leaveAction(). + * @param name - name of the action + * @param type + * @param startTime - time in milliseconds. if null, current time is used. + * @param parentAction optional id of parent action. if parameter is not passed=> appended to + * currently running action, if false => root action, if a number is passed, action is added + * as subaction to action with given id. + * @returns id of created action + */ + enterAction( + name: string, + type: string, + time?: number, + parentAction?: number | boolean + ): number; + /** + * @description stops the action that is represented by the given tracking object. + * @param actionId - id of action to leave. must be the value returned by enterAction + * @param time - end time in milliseconds + * @param startTime - optional start time in milliseconds (necessary if start time should be modified) + */ + leaveAction(actionId: number, time?: number, startTime?: number): void; + /** + * @description Reports an error message + * @param parentAction - parent action id. if not passed or null, error is added to current action + */ + reportError(error: string | Error, parentAction?: number): void; + /** + * @description Reports a warning message + * @param parentAction - parent action id. if not passed or null, error is added to current action + */ + reportWarning(warning: string, parentAction?: number): void; + /** + * @description Reports an event + * @param parentAction - parent action id. if not passed or null, error is added to current action + */ + reportEvent(msg: string, parentAction?: number): void; + /** + * @description Reports a key value pair to the server. The data can e.g. be used to create charts. + */ + reportValue(key: string, value: number): void; + /** + * @description Reports a key value pair to the server. The data can e.g. be used to create charts. + * The difference to the reportValue function is that here the value is a string. + */ + reportString(key: string, value: string): void; + /** + * @description The JavaScript ADK enables you to tag your visits with any value you want. + * Use tagVisit(visitName) to tag the current visit with the specified value + */ + tagVisit(visitName: string): void; + /** + * @description Indicates start of a third party resource + * @param type - i = image, s = script, c = custom + */ + startThirdParty(type: "i" | "s" | "c", url: string): void; + /** + * @description Indicates stop of a third party resource + * @param url - Complete URL of resource (must match URL provided in startThirdParty). + * @param success - True if the resource was loaded successfully, false if not. + * @param start - Absolute start time in milliseconds. When parameter is not passed or <= 0, + * time of startThirdParty call is used. + * @param stop - Absolute stop time in milliseconds. When parameter is not passed or <= 0, + * time of stopThirdParty call is used. + */ + stopThirdParty( + url: string, + success: boolean, + start?: number, + stop?: number + ): void; + /** + * @description Adds a listener that is called when the user is leaving the page, + * but before the monitor signal is sent + * @param listener A function that will be called in case the user leaves the page. + */ + addPageLeavingListener(listener: (key: string) => {}): void; + /** + * @description Sends a Streaming Node to the Server + * @param source - URL of the streaming resource + * @param duration - duration of the streaming resource in seconds + * @param userTriggered - did the user trigger the playback or did it start automatically? + * @param watchedCompletely - did the streaming resource play to the end? + * @param maxPlayTime - maximum progress this streaming resource had in seconds + * @param playTime - the time this streaming resource was playing in seconds + * @param bufferingCount - amount of bufferings that occured during the playback + * @param bufferingTime - total time spent with buffering in seconds + * @param type - action type of the streaming node. Is used for classifying events + * on the serverside, e.g. _info_, _warn_, _error_ + */ + addStreamingNode( + source: string, + duration: number, + userTriggered: boolean, + watchedCompletely: boolean, + maxPlayTime: number, + playTime: number, + bufferingCount: number, + bufferingTime: number, + type: "_info_" | "_warn_" | "_error_" + ): void; + /** + * @description Indicates the start of a user input. User inputs must always + * be stopped by calling endUserInput. If an xhr call or a page load happens + * it is checked if a user input is active. If yes, the user input is set to + * have triggered the page action. + * @param domNode - Which triggered the action (button, etc) is used for determining its caption + * @param type - Type of the user input: 'click', 'keypress', 'scroll',... + * @param addInfo - Additional info for user input such as key, mouse button, etc ('F5', 'RETURN',...) + * @param validTime - How long should the user input be able to open actions? default is 30ms + */ + beginUserInput( + domNode: any, + type: string, + addInfo: string, + validTime: number + ): any; + /** + * @description the user input object returned by beginUserInput + */ + endUserInput(userInputObject: any): void; + /** + * @description Initiate ajax action. Must be closed by leaveXhrAction afterwards. + * @param type Additional info about type of xhr (eg. framework name,etc) + * @param mode - The action mode: 0 .. just extend running ajax actions 1 .. extend any running action 2 .. + * extend any running action - visible subaction 3 .. start action if user input is present + * @param webSocket - Indicates if this action is a webSocket action or not + * @returns id of action + */ + enterXhrAction(type: string, mode: number, webSocket: boolean): number; + /** + * @description Indicates the end of an xhr action. Must be started by leaveXhrAction beforehand. + * @param id - id of action (must be the value returned by enterXhrAction) + */ + leaveXhrAction(id: number): void; + /** + * @description Indicates that an xhr callback is active (eg. XMLHttpRequest onreadystatechange). + * This is necessary to automatically add actions started during a callback as subactions. + * Xhr callback must be stopped by leaveXhrCallback. + * @param actionId - id of action where callback belongs to + */ + enterXhrCallback(actionId: number): void; + /** + * @description Indicates the end of an xhr callback. Must be called after enterXhrCallback. + * @param actionId - id of action where callback belongs to + */ + leaveXhrCallback(actionId: number): void; + /** + * @description Indicates the start of a load action. Frameworks often have their own load callback functions. + * This can be used when framework starts load before "DOMContentLoaded". + */ + signalOnLoadStart(): void; + /** + * @description Tells the JavaScript agent to wait for an additional call of signalOnLoadEnd. + * When the last call of signalOnLoadEnd is performed the "onload" action is closed. + * Note: if this function is called, signalOnLoadEnd MUST be called afterwards to indicated the end of one load. + * Otherwise there will be unexpected action behaviour. + */ + incrementOnLoadEndMarkers(): void; + /** + * @description Indicates the end of a load action. needs incrementOnLoadEndMarkers to be called before. + * As soon as the last signalOnLoadEnd is called, the "onload" action is closed. + */ + signalOnLoadEnd(): void; + /** + * @description By default a visit ends after a configurable inactivity time (default is 30 min.). + * Using the ADK, a visit can be ended forcibly, for example when a user logs out from an application. + * Simply call dynaTrace.endVisit() and the visit ends without waiting for the inactivity time. + * For correlation purposes the visit shows as active in the client for about three minutes, + * but actions sent after dynaTrace.endVisit() are added to a new visit. + * End the current UEM visit. This is useful for "logout" buttons, so that, + * when the user logs out, the user's visit can also be closed by calling this method. + */ + endVisit(): void; + /** + * @description Set the application version for this visit. + * This will be read on the server side and included as part of each visit for easy splitting. + * @param appVersion - The version string to be set. + */ + setAppVersion(appVersion: string): void; + /** + * @description Set meta-data for the page via a key/value pair. + * @param key - The readable key for the value + * @param value - The value to associate with the identifier + */ + setMetaData(key: string, value: string): void; +} + +declare let dynaTrace: dynaTrace; diff --git a/types/dynatrace/tsconfig.json b/types/dynatrace/tsconfig.json new file mode 100644 index 0000000000..6c137be982 --- /dev/null +++ b/types/dynatrace/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", + "dynatrace-tests.ts" + ] +} diff --git a/types/dynatrace/tslint.json b/types/dynatrace/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/dynatrace/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b1d67d102779101709614ee6e60872bce77761aa Mon Sep 17 00:00:00 2001 From: Andrew Casey Date: Fri, 7 Dec 2018 13:36:29 -0800 Subject: [PATCH 174/241] Update CODEOWNERS --- .github/CODEOWNERS | 431 +++++++++++++++++++++++++++++++-------------- 1 file changed, 302 insertions(+), 129 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 94701801da..7e3c9ccc69 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -9,6 +9,7 @@ /types/absolute/ @AyaMorisawa /types/abstract-leveldown/ @MeirionHughes @danwbyrne /types/acc-wizard/ @cyrilschumacher +/types/accept/ @feinoujc /types/accept-language-parser/ @kampfgnom /types/accepts/ @bomret @brikou /types/accounting/ @gerich-home @chrisleck @@ -159,7 +160,7 @@ /types/ansi-escapes/ @jacobbubu /types/ansi-regex/ @mvachhar /types/ansi-styles/ @brynbellomy @plylrnsdy -/types/ansicolors/ @rogierschouten +/types/ansicolors/ @balupton /types/antlr4/ @mcchatman8009 /types/antlr4-autosuggest/ @jonfreedman /types/any-db/ @rogierschouten @@ -175,6 +176,7 @@ /types/apollo-codegen/ @bradleyayers @kostspielig /types/apollo-upload-client/ @Slessi /types/apostrophe/ @afholderman +/types/app-module-path/ @darkwebdev /types/app-root-dir/ @chenyang-biu /types/app-root-path/ @shantmarouti /types/appdmg/ @unindented @@ -212,7 +214,7 @@ /types/asenv/ @remisery /types/asn1js/ @microshine /types/aspnet-identity-pw/ @jt000 -/types/assert/ @nicoabie +/types/assert/ @nicoabie @LinusU /types/assert-equal-jsx/ @seryl /types/assert-plus/ @KostyaTretyak /types/assertsharp/ @brunolm @@ -231,6 +233,7 @@ /types/atlaskit__inline-edit/ @lstanden /types/atlaskit__layer/ @lstanden /types/atlaskit__single-select/ @lstanden +/types/atlaskit__tree/ @benhjames /types/atlassian-crowd-client/ @mtgto /types/atmosphere.js/ @toedter @Mory1879 @Scipion /types/atob/ @johngeorgewright @@ -254,6 +257,7 @@ /types/autoprefixer/ @odnamrataizem @murt /types/autosize/ @kingdango @keika299 @NeekSandhu /types/autosuggest-highlight/ @senukartur +/types/await-timeout/ @szhu /types/awesomplete/ @webbiesdk @bmdixon @tbekolay @chrislopresto /types/aws-iot-device-sdk/ @niik @mlamp /types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex @MichaelMarner @daniel-cottone @kostya-misura @coderbyheart @palmithor @daniloraisi @simonbuchan @Haydabase @repl-chris @aneilbaboo @jeznag @louislarry @dpapukchiev @ohookins @trevor-leach @jagregory @@ -279,20 +283,19 @@ /types/babel__code-frame/ @mohsen1 @ForbesLindesay /types/babel__core/ @yortus @marvinhagemeister @mgroenhoff /types/babel__generator/ @yortus @johnnyestilles @mgroenhoff -/types/babel__parser/ @yortus @marvinhagemeister @mgroenhoff /types/babel__template/ @yortus @marvinhagemeister @mgroenhoff /types/babel__traverse/ @yortus @marvinhagemeister @rpetrich @mgroenhoff /types/babelify/ @TeamworkGuy2 @marvinhagemeister /types/babylon/ @yortus @marvinhagemeister /types/babylon-walk/ @czbuchi /types/babyparse/ @cdiddy77 -/types/backbone/ @borisyankov @nvivo @kenjiru +/types/backbone/ @borisyankov @nvivo @kenjiru @jjoekoullas /types/backbone-associations/ @craigbrett17 /types/backbone-fetch-cache/ @delphinus35 /types/backbone-relational/ @eirikhm /types/backbone.layoutmanager/ @hejiang2000 /types/backbone.localstorage/ @lgrignon -/types/backbone.marionette/ @zhamid @nvivo @sventschui @razorness @confususs +/types/backbone.marionette/ @zhamid @nvivo @sventschui @razorness @confususs @jjoekoullas /types/backbone.paginator/ @Nyamazing /types/backbone.radio/ @alphaleonis /types/backgrid/ @jlujan @@ -301,6 +304,7 @@ /types/backoff/ @BendingBender /types/baconjs/ @alexander-matsievsky @gekkio /types/bagpipes/ @micmro +/types/baidu-app/ @taoqf /types/barbellweights/ @evelijn /types/barcode/ @pvomhoff /types/bardjs/ @TepigMC @@ -329,7 +333,7 @@ /types/better-curry/ @pocesar /types/better-queue/ @maozedong /types/better-scroll/ @stoneChen @cnjack -/types/better-sqlite3/ @Morfent @matrumz +/types/better-sqlite3/ @Morfent @matrumz @sant123 /types/bezier-easing/ @ptlis /types/bezier-js/ @danmarshall @Epskampie /types/bgiframe/ @sumegizoltan @@ -340,7 +344,7 @@ /types/bignum/ @Patman64 /types/bigscreen/ @dduugg /types/bin-pack/ @orentrutner -/types/binary-parser/ @riggs @dolanmiu +/types/binary-parser/ @riggs @dolanmiu @yuhr /types/bind-ponyfill/ @skysteve /types/bindings/ @unindented /types/bintrees/ @CjS77 @@ -352,7 +356,7 @@ /types/bitcoinjs-lib/ @mhegazy @dlebrecht @rbuckton @micksatana @youssefgh @kento1218 /types/bitcore-lib/ @lautarodragan /types/bittorrent-protocol/ @feross @tlaziuk -/types/bitwise-xor/ @rogierschouten +/types/bitwise-xor/ @rogierschouten @BendingBender /types/bl/ @Bartvds @reconbot /types/blacklist/ @mhegazy /types/blazy/ @julienpa @@ -425,6 +429,7 @@ /types/browser-resolve/ @marionebl /types/browser-sync/ @joeskeen @aznnomness /types/browserify/ @AndrewGaspar @jvilk @leonard-thieu @LinusU +/types/browserslist/ @davecardwell /types/bs58/ @chrootsu /types/bson/ @horiuchi @CaselIT /types/btoa/ @johngeorgewright @@ -438,7 +443,7 @@ /types/bufferstream/ @Bartvds /types/builtin-modules/ @ajafff /types/bull/v2/ @bgrieder @JProgrammer -/types/bull/ @bgrieder @JProgrammer @marshall007 @weeco @blaugold @iamolegga @koblas @bondz @wuha-team @aleccool213 @danmana +/types/bull/ @bgrieder @JProgrammer @marshall007 @weeco @blaugold @iamolegga @koblas @bondz @wuha-team @aleccool213 @danmana @kjellmorten @pc-jedi /types/bump-regex/ @silkentrance /types/bunnymq/ @cyrilschumacher /types/bunyan/ @amikhalev @@ -457,6 +462,7 @@ /types/bytewise/ @danwbyrne /types/c3/ @mcliment @gerinjacob @denyo @dmitryshindin @timn /types/cache-manager/ @GausSim +/types/cached-path-relative/ @TeamworkGuy2 /types/cal-heatmap/ @RetroChrisB /types/caller/ @ignocide /types/callsite/ @newclear @@ -468,6 +474,7 @@ /types/camo/ @lucasmciruzzi /types/cancan/ @Vincent-Pang /types/caniuse-api/ @davecardwell +/types/caniuse-lite/ @mutech /types/cannon/ @clark-stevenson @Gelio /types/canvas-confetti/ @matracey /types/canvas-gauges/ @Mikhus @@ -482,10 +489,12 @@ /types/cassandra-driver/ @Svjard @pc-jedi /types/catbox/v7/ @jasonswearingen @AJamesPhillips /types/catbox/ @jasonswearingen @AJamesPhillips @saboya +/types/catbox-memory/ @SimonSchick /types/catbox-redis/ @SimonSchick /types/cbor/ @pushplay /types/ccap/ @taoqf /types/cesium/ @Zuzon @hnipps @szechyjs @golyalpha +/types/cfn-response/ @ivoisbelongtous /types/chai/v2/ @Bartvds @AGBrown /types/chai/ @jedmao @Bartvds @AGBrown @olivr70 @mwistrand @joshuakgoldberg @shaunluttin @Naktibalda @micksatana @ErikSchierboom /types/chai-arrays/ @clementprevot @@ -520,7 +529,7 @@ /types/check-types/ @idchlife /types/checkstyle-formatter/ @mhegazy /types/checksum/ @rogierschouten -/types/cheerio/ @blittle @wmaurer @umarniz @LiJinyao @chennakrishna8 +/types/cheerio/ @blittle @wmaurer @umarniz @LiJinyao @chennakrishna8 @AzSiAz /types/chess.js/ @JacobFischer /types/chessboardjs/ @sliverb @davidmpaz /types/chmodr/ @BendingBender @@ -538,7 +547,8 @@ /types/circuit-breaker-js/ @DeTeam /types/circular-json/ @jpevarnek /types/ckeditor/v2/ @wittwert -/types/ckeditor/ @wittwert @stuartlong +/types/ckeditor/ @wittwert @stuartlong @viktorpegy +/types/ckeditor__ckeditor5-utils/ @denisname /types/clamp-js/ @Hikariii /types/clamp-js-main/ @sinziananicolae /types/classnames/ @adidahiya @JKillian @seansfkelley @mradamczyk @marvinhagemeister @@ -552,6 +562,7 @@ /types/clearbladejs-server/ @ClearBlade /types/cleave.js/ @clentfort @jasongi-at-sportsbet @sashashakun /types/cli/ @kayahr +/types/cli-box/ @athasach /types/cli-color/ @ChaosinaCan /types/cli-interact/ @ffflorian /types/cli-progress/ @mhegazy @@ -579,7 +590,7 @@ /types/co-body/ @geoffreak /types/co-views/ @devlee @geoffreak /types/code/ @prashaantt -/types/codemirror/ @mihailik @nrbernard @Pr1st0n @rileymiller +/types/codemirror/ @mihailik @nrbernard @Pr1st0n @rileymiller @toddself /types/codependency/ @morphatic /types/coffeeify/ @tkQubo /types/coinbase/ @rogierschouten @@ -598,9 +609,10 @@ /types/com.darktalker.cordova.screenshot/ @akarienta /types/com.wikitude.phonegap.wikitudeplugin/ @zbarbuto /types/combine-source-map/ @TeamworkGuy2 -/types/combined-stream/ @felixge @tlaziuk +/types/combined-stream/ @felixge @tlaziuk @konpikwastaken /types/combokeys/ @iclanton /types/cometd/ @derekcicerone @unindented @alxHenry +/types/command-exists/ @BendingBender /types/command-line-args/v4/ @CzBuCHi @75lb /types/command-line-args/ @75lb /types/command-line-commands/ @CzBuCHi @@ -610,9 +622,10 @@ /types/commercetools__enzyme-extensions/ @screendriver /types/common-errors/ @icopp /types/common-prefix/ @seangenabe -/types/common-tags/ @zuzusik @tzupengwang +/types/common-tags/ @zuzusik @tzupengwang @BendingBender /types/commondir/ @leonard-thieu /types/commonmark/ @nicojs @leonard-thieu +/types/compare-func/ @fennibay /types/compare-version/ @jpevarnek /types/compare-versions/ @LogvinovLeon /types/complex/ @AyaMorisawa @pavasich @@ -662,7 +675,7 @@ /types/convert-layout/ @xeningem /types/convert-source-map/ @AndrewGaspar @mgroenhoff @TeamworkGuy2 /types/convict/ @Nemo157 @vesse @elyscape @vanthiyathevan -/types/cookie/ @pine613 +/types/cookie/ @pine /types/cookie-parser/ @santialbo @BendingBender /types/cookie-session/ @borislavjivkov /types/cookie-signature/ @lith-light-g @@ -706,7 +719,8 @@ /types/countdown/ @gjuchault /types/counterpart/ @santiagodoldan /types/countries-and-timezones/ @zero51 -/types/country-list/ @iRoachie +/types/country-list/v1/ @iRoachie +/types/country-list/ @iRoachie @Kimahriman /types/country-select-js/ @humrochagf /types/countup.js/ @shermendev /types/coverup/ @bevalorous @@ -717,6 +731,8 @@ /types/cradle/ @panuhorsmalahti /types/crc/ @YuJianrong /types/create-error/ @tkrotoff +/types/create-hash/ @BendingBender +/types/create-hmac/ @BendingBender /types/create-react-class/ @jgoz /types/create-subscription/ @Asana @vsiao /types/createjs/ @evilangelist @gyohk @@ -731,20 +747,24 @@ /types/crossfilter/ @schmuli @iebaker @nordfjord /types/crossroads/ @diullei /types/crpc/ @0xdeafcafe +/types/crumb/ @lenovouser @SimonSchick /types/cryptiles/ @awendland /types/crypto-js/ @misak113 /types/crypto-random-string/ @MrManny /types/cryptojs/ @giabao +/types/cryptr/ @rrogowski /types/cson/ @stpettersens +/types/cson-parser/ @lenovouser /types/csprng/ @winksaville /types/csrf/ @markis /types/css/ @ilich /types/css-font-loading-module/ @slikts /types/css-modules/ @NeekSandhu /types/css-to-style/ @bengry +/types/css-tree/ @erik-kallen /types/cssbeautify/ @rictic /types/cssnano/ @odnamrataizem -/types/csso/ @screendriver +/types/csso/ @screendriver @erik-kallen /types/csurf/ @horiuchi /types/csv-parse/ @davidm77 @obi-jan-kenobi /types/csv-stringify/ @rogierschouten @arjenvanderende @@ -777,7 +797,7 @@ /types/d3-delaunay/ @BTOdell /types/d3-dispatch/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-drag/ @tomwanzek @gustavderdrache @borisyankov -/types/d3-dsv/ @tomwanzek @gustavderdrache @borisyankov +/types/d3-dsv/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-ease/ @tomwanzek @gustavderdrache @borisyankov /types/d3-fetch/ @ledragon /types/d3-force/ @tomwanzek @gustavderdrache @borisyankov @@ -843,7 +863,8 @@ /types/dd-trace/ @ColinBradley @alloy /types/deasync/ @Sicilica /types/debessmann/ @vkorehov -/types/debounce/ @denis-sokolov @joshuakgoldberg +/types/debounce/ @denis-sokolov @joshuakgoldberg @wcarson +/types/debounce-promise/ @whtsky /types/debug/ @swook @galtalmor @zamb3zi @brasten /types/decamelize/ @samverschueren /types/decay/ @enaeseth @@ -876,10 +897,13 @@ /types/depd/ @danny8002 @BendingBender /types/dependency-tree/ @joscha /types/deployjava/ @cyrilschumacher +/types/deprecate/ @Toilal +/types/deps-sort/ @TeamworkGuy2 /types/derhuerst__cli-on-key/ @jacobbubu /types/destroy/ @BendingBender /types/destroy-on-hwm/ @BendingBender -/types/detect-browser/ @rogierschouten +/types/detect-browser/ @rogierschouten @carusology +/types/detect-character-encoding/ @BendingBender /types/detect-hover/ @thomastilkema /types/detect-indent/v0/ @Bartvds /types/detect-indent/ @Bartvds @BendingBender @@ -901,17 +925,21 @@ /types/di-lite/ @dcrusader /types/diacritics/ @otociulis /types/dialogflow/ @dyladan +/types/dicer/ @GoupilRobin @BendingBender /types/diff/ @vvakame @szdc @moc-yuto /types/diff2html/ @rtfpessoa +/types/diffie-hellman/ @BendingBender /types/digibyte/ @lautarodragan @werewolfe +/types/dinero.js/ @BendingBender /types/dir-resolve/ @andy-ms /types/discontinuous-range/ @OiCMudkips +/types/discord-rpc/ @jasonhaxstuff /types/discourse-sso/ @championswimmer /types/dispatchr/ @Ragg- /types/disposable-email-domains/ @geoffreak /types/dnssd/ @angelmerino @Maxr1998 /types/doccookies/ @jonegerton -/types/dockerode/ @seikho @nlaplante @isac322 @lazarusx @meisenzahl @thegecko +/types/dockerode/ @seikho @nlaplante @isac322 @lazarusx @meisenzahl @thegecko @CameronDiver /types/docopt/ @giggio /types/doctrine/ @rictic /types/document-promises/ @NotWoods @@ -923,6 +951,7 @@ /types/dom-clipboard-api/ @43081j /types/dom-inputevent/ @diagramatics /types/dom-loaded/ @ltetzlaff +/types/dom-mediacapture-record/ @eliasmeire /types/dom-to-image/ @JipSterk /types/dom4/ @adidahiya @giladgray /types/domo/ @Steve-Fenton @@ -937,7 +966,7 @@ /types/dotdir-regex/ @mrmlnc /types/dotdotdot/ @milanjaros /types/dotenv/v2/ @jussikinnula @borekb @enaeseth -/types/dotenv/ @jussikinnula @borekb @enaeseth +/types/dotenv/ @jussikinnula @borekb @enaeseth @maxbeatty /types/dotenv-safe/ @krenor /types/dotenv-webpack/ @karol-majewski /types/dotfile-regex/ @mrmlnc @@ -984,7 +1013,7 @@ /types/easy-xapi/ @DeadAlready /types/easy-xapi-utils/ @DeadAlready /types/ebongarde-root/ @Ebongarde -/types/echarts/ @xieisabug @AntiMoron @liveangela @Ovilia +/types/echarts/ @xieisabug @AntiMoron @liveangela @Ovilia @iRON5 /types/ecma-proposal-math-extensions/ @ksm2 /types/ecurve/ @mhegazy /types/ed25519/ @erikma @@ -1018,7 +1047,7 @@ /types/electron-winstaller/ @shiftkey @unindented /types/elegant-spinner/ @danwbyrne /types/element-ready/ @BendingBender -/types/element-resize-detector/ @saranshkataria +/types/element-resize-detector/ @saranshkataria @franklixuefei /types/element-resize-event/ @rogierschouten @plgregoire /types/elementtree/ @dwieeb /types/elliptic/ @danwbyrne @@ -1062,6 +1091,7 @@ /types/emoji-regex/ @iKBAHT /types/emojione/ @dbrgn /types/empower/ @vvakame +/types/empty-dir/ @BendingBender /types/emscripten/ @zakki @periklis /types/encoding-down/ @MeirionHughes @danwbyrne /types/end-of-stream/ @strax @@ -1079,6 +1109,7 @@ /types/enzyme-adapter-react-15/ @tkrotoff /types/enzyme-adapter-react-15.4/ @nali /types/enzyme-adapter-react-16/ @tkrotoff +/types/enzyme-async-helpers/ @kimehrenpohl /types/enzyme-redux/ @knegusen /types/enzyme-to-json/ @joscha /types/eonasdan-bootstrap-datetimepicker/ @ToastHawaii @@ -1137,17 +1168,21 @@ /types/exit/ @Bartvds /types/exit-hook/ @BendingBender /types/exorcist/ @TeamworkGuy2 +/types/expand-tilde/ @carnesen /types/expect/ @jmreidy @merrywhether /types/expect-puppeteer/ @JoshuaKGoldberg @tkrotoff /types/expect.js/ @teppeis /types/expectations/ @vvakame /types/expired-storage/ @intolerance +/types/expirymanager/ @DanielRose /types/expo/v23/ @KonstantinKai /types/expo/v24/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger /types/expo/v25/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov /types/expo/v26/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @tinaroh /types/expo/v27/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo -/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo +/types/expo/v30/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo +/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel +/types/expo-localization/ @burtek /types/expo__status-bar-height/ @dawnmist /types/expo__vector-icons/ @incleaf /types/express/ @borisyankov @@ -1188,6 +1223,7 @@ /types/express-redis-cache/ @ajliv /types/express-route-fs/ @kripod /types/express-routemap/ @icopp +/types/express-routes-versioning/ @weffe /types/express-sanitized/ @cjbarth /types/express-serve-static-core/ @borisyankov @19majkel94 @kacepe @micksatana @samijaber /types/express-session/ @horiuchi @jacobbogers @builtinnya @ry7n @@ -1195,6 +1231,8 @@ /types/express-socket.io-session/ @AylaJK /types/express-to-koa/ @xiaohanzhang /types/express-unless/ @wokim +/types/express-version-request/ @weffe +/types/express-version-route/ @weffe /types/express-wechat-access/ @simmons8616 /types/express-winston/ @bricka /types/express-ws/ @ajliv @@ -1226,11 +1264,11 @@ /types/fancy-log/ @pine /types/fancybox/ @borisyankov /types/farbtastic/ @EnableSoftware -/types/fast-diff/ @djrenren /types/fast-levenshtein/ @mizunashi-mana /types/fast-list/ @BendingBender /types/fast-stats/ @rogierschouten /types/fastclick/ @shinnn +/types/fastify-accepts/ @leomelzer /types/fastify-cors/ @jannikkeye /types/fastify-jwt/ @jannikkeye /types/fastify-multipart/ @jannikkeye @@ -1283,13 +1321,15 @@ /types/finalhandler/ @chrootsu /types/finch/ @DavidSichau /types/find/ @andypyrope +/types/find-package-json/ @BendingBender /types/find-parent-dir/ @ikatyang /types/find-process/ @buaban /types/find-project-root/ @ikatyang /types/find-root/ @Alorel /types/find-up/ @BendingBender -/types/find-versions/ @LogvinovLeon +/types/find-versions/ @LogvinovLeon @carnesen /types/findup-sync/ @Bartvds @ngbrown +/types/fined/ @BendingBender /types/fingerprintjs/ @zaneli /types/fingerprintjs2/ @curtstate /types/firebase-client/ @fpsscarecrow @@ -1301,7 +1341,9 @@ /types/first-mate/ @GlenCFL /types/fixed-data-table/ @pepaar @stephenjelfs /types/fixed-data-table-2/ @ilivit +/types/flagged-respawn/ @BendingBender /types/flat/ @chrootsu +/types/fleximap/ @DanielRose /types/flexslider/ @diullei /types/flickity/ @clmcgrath @wagich /types/flight/ @jonathanhedren @@ -1309,6 +1351,7 @@ /types/flipsnap/ @kubosho @gsino @mayuki /types/float-regex/ @wanganjun /types/flot/ @burlandm @Anticom @admiralsmaster +/types/flowdoc/ @animify /types/flowjs/ @ryan10132 /types/fluent-ffmpeg/ @tcaesvk @DingWeizhe @mabidina /types/flush-write-stream/ @djcsdy @@ -1374,6 +1417,7 @@ /types/fusioncharts/ @rohitkr @shivarajkv /types/fuzzaldrin/ @mhegazy /types/fuzzaldrin-plus/ @jeancroy @jkillian @reyronald +/types/fuzzy-search/ @alex-deas @BendingBender /types/fuzzyset/ @lgrignon @narainsagar /types/fuzzyset.js/ @lgrignon @narainsagar /types/fxn/ @charrondev @@ -1547,6 +1591,7 @@ /types/getos/ @BendingBender /types/gettext.js/ @jucrouzet /types/gh-pages/ @DanielRosenwasser +/types/ghauth/ @Leko /types/gifffer/ @gatimus /types/gijgo/ @atatanasov /types/giraffe/ @darthapo @@ -1555,11 +1600,17 @@ /types/git-config/ @stpettersens /types/git-remote-origin-url/ @janslow /types/git-rev-sync/ @khoi-fish +/types/git-root-dir/ @ffflorian /types/git-url-parse/ @ajafff +/types/gitconfiglocal/ @ffflorian /types/github-url-to-object/ @ajafff /types/github-username-regex/ @BehindTheMath -/types/gitlab/ @yanqing6628780 @Arylo /types/gl-matrix/ @mattijskneppers @tatchx @nbabanov @auzmartist @surtr-isaz +/types/gl-react/ @jussikinnula +/types/gl-react-dom/ @jussikinnula +/types/gl-react-expo/ @jussikinnula +/types/gl-react-headless/ @jussikinnula +/types/gl-react-native/ @jussikinnula /types/gl-shader/ @MathiasPaumgarten /types/gl-texture2d/ @MathiasPaumgarten /types/gldatepicker/ @qcz @@ -1585,12 +1636,12 @@ /types/google-apps-script-oauth2/ @dhayab /types/google-cloud__datastore/ @beaulac @ogawa0071 @ThomasdenH /types/google-cloud__pubsub/ @pheromonez @LunaPg @msiviero -/types/google-cloud__storage/ @blove @nbperry @welkie @ogawa0071 /types/google-earth/ @icholy /types/google-images/ @dolanmiu /types/google-libphonenumber/ @leonyu @winfinit /types/google-map-react/ @honzabrecka /types/google-maps/ @DeividasBakanas @GiedriusGrabauskas +/types/google-maps-react/ @gburgett @jpowell /types/google-protobuf/ @marcuslongmuir /types/google-translate-api/ @maple3142 /types/google.analytics/ @tyler-murphy @@ -1598,7 +1649,7 @@ /types/google.fonts/ @danmarshall /types/google.geolocation/ @vbortone /types/google.picker/ @grapswiz -/types/google.visualization/ @danludwig @gmoore-sjcorg @danmana @mlcheng @IvanBisultanov @glebm +/types/google.visualization/ @danludwig @gmoore-sjcorg @danmana @mlcheng @IvanBisultanov @glebm @shrujalshah28 /types/google__maps/ @indrimuska /types/googlemaps/ @cgwrench @nertzy @xaolas @mrmcnerd @martincostello @svenkreiss @bolatovumar @gauthierm /types/googlemaps.infobubble/ @Dashue @@ -1616,6 +1667,7 @@ /types/graphql-date/ @enaeseth /types/graphql-deduplicator/ @lfades /types/graphql-depth-limit/ @eritikass +/types/graphql-fields/ @feinoujc /types/graphql-iso-date/ @jwaldrip /types/graphql-list-fields/ @filipows /types/graphql-query-complexity/ @abhikmitra @@ -1678,6 +1730,7 @@ /types/gulp-jasmine/ @andypyrope /types/gulp-jasmine-browser/ @tkrotoff /types/gulp-json-editor/ @peterjuras +/types/gulp-json-validator/ @pe8ter /types/gulp-jsonmin/ @romain-faust /types/gulp-jsonminify/ @pine /types/gulp-jspm/ @peterjuras @@ -1722,12 +1775,14 @@ /types/halogen/ @steller /types/hammerjs/ @milkisevil @codler /types/handlebars/ @borisyankov @evil-shrike +/types/handlebars-helpers/ @Toilal /types/hapi/v8/ @jasonswearingen /types/hapi/v12/ @jasonswearingen /types/hapi/v15/ @jasonswearingen /types/hapi/v16/ @jasonswearingen @AJamesPhillips /types/hapi/ @rafaelsouzaf @jhsimms @SimonSchick /types/hapi-auth-basic/ @AJamesPhillips @saboya +/types/hapi-auth-cookie/ @lenovouser @SimonSchick @Mutmatt /types/hapi-auth-jwt2/v7/ @warrenseymour /types/hapi-auth-jwt2/ @warrenseymour @SimonSchick /types/hapi-decorators/ @kenhowardpdx @@ -1764,6 +1819,7 @@ /types/hexo-fs/ @segayuu /types/hexo-log/ @segayuu /types/hexo-util/ @segayuu +/types/hibp/ @lenovouser /types/highcharts/ @damianog @baltie @AlbertOzimek @hanssens /types/highcharts-ng/ @scatcher /types/highland/ @Bartvds @hgwood @iwllyu @alvis @notbobthebuilder @@ -1821,6 +1877,7 @@ /types/humanparser/ @MichalPodeszwa /types/humps/ @nikeee /types/hyco-ws/ @mrcabellom +/types/hyper-aws4/ @bambutz /types/hyperscript/ @spacejack @jmfirth /types/hypertext-application-language/ @maks3w /types/hystrixjs/ @igorsechyn @@ -1867,7 +1924,7 @@ /types/images/ @DingWeizhe /types/imagesloaded/ @coldacid @apexskier /types/imap/ @psnider -/types/imap-simple/ @pushplay +/types/imap-simple/ @pushplay @iaarnio /types/imgur-rest-api/ @lukewestby /types/imperium/ @gaetansenn /types/impress/ @borisyankov @@ -1881,7 +1938,7 @@ /types/inflected/ @dsci /types/inflection/ @shiwano /types/inherits/ @chrootsu -/types/ini/ @marcinporebski +/types/ini/ @marcinporebski @carnesen /types/iniparser/ @chrootsu /types/init-package-json/ @kfarnung /types/inline-css/ @philipisapain @@ -1890,33 +1947,38 @@ /types/inquirer-npm-name/ @manuth /types/insert-module-globals/ @leonard-thieu /types/insight/ @vvakame +/types/instabug-reactnative/ @pengcao1 /types/integer/ @Morfent /types/intercom-client/ @jineshshah36 @peping /types/intercom-web/ @fongandrew @salbahra @onatm /types/intercomjs/ @spencerwi /types/internal-ip/ @BendingBender +/types/interpret/ @BendingBender /types/intl/ @RagibHasin /types/intl-locales-supported/ @Slessi /types/intl-messageformat/ @mhegazy /types/intl-relativeformat/ @mohsen1 -/types/intl-tel-input/ @fdnhkj @leonard-thieu +/types/intl-tel-input/v13/ @fdnhkj @leonard-thieu +/types/intl-tel-input/ @fdnhkj @leonard-thieu @molnarm /types/into-stream/ @BendingBender /types/intrinsic-scale/ @shalomdotnet /types/intro.js/ @anahkiasen /types/invariant/ @bennett000 /types/inversify-devtools/ @inversify +/types/iobroker/ @AlCalzone /types/ion-rangeslider/v1/ @dduugg @Karel-van-de-Plassche /types/ion-rangeslider/ @Karel-van-de-Plassche /types/ioredis/v3/ @plantain-00 @chrisleck @aliarham11 @br8h @shaharmor @palindrom615 @reconbot -/types/ioredis/ @plantain-00 @chrisleck @aliarham11 @br8h @shaharmor @palindrom615 @reconbot @funthing @iamolegga +/types/ioredis/ @plantain-00 @chrisleck @aliarham11 @br8h @shaharmor @palindrom615 @reconbot @funthing @iamolegga @tingwai-to /types/iota.lib.js/ @fogsh /types/ip/ @codeanimal /types/ip-address/ @icopp @danwbyrne /types/ip-regex/ @unindented /types/ipcheck/ @bengry /types/irc/ @phillips1012 +/types/iri/ @BendingBender /types/iron/ @simonschick @rafaelsouzaf -/types/is/ @cabralRodrigo +/types/is/ @cabralRodrigo @gricey432 /types/is-absolute-url/ @mhegazy /types/is-alphanumerical/ @vutran /types/is-archive/ @mhegazy @@ -1936,10 +1998,12 @@ /types/is-my-json-valid/ @kruncher /types/is-negated-glob/ @ajafff /types/is-number/ @harryshipton +/types/is-obj/ @forivall /types/is-object/ @wbhob /types/is-path-cwd/ @DanielRosenwasser /types/is-path-in-cwd/ @mhegazy /types/is-promise/ @DanielRosenwasser +/types/is-regexp/ @forivall /types/is-relative-url/ @mhegazy /types/is-root/ @mhegazy /types/is-root-path/ @mhegazy @@ -1975,7 +2039,9 @@ /types/jade/ @panuhorsmalahti /types/jalaali-js/ @alitaheri /types/japanese-holidays/ @syamatoo -/types/jasmine/ @borisyankov @theodorejb @davidparsson @gmoothart @lukas-zech-software @Engineer2B +/types/jasmine/v1/ @borisyankov +/types/jasmine/v2/ @borisyankov @theodorejb @davidparsson @gmoothart @lukas-zech-software @Engineer2B @cyungmann +/types/jasmine/ @borisyankov @theodorejb @davidparsson @gmoothart @lukas-zech-software @Engineer2B @cyungmann @Roaders /types/jasmine-ajax/ @lgrignon /types/jasmine-data-provider/ @tlaziuk /types/jasmine-data_driven_tests/ @AnthonyMacKinnon @@ -1991,7 +2057,7 @@ /types/jasminewd2/ @sjelin @gkalpak /types/java/ @jimlloyd @hrl7 @darti /types/java-applet/ @cyrilschumacher -/types/javascript-astar/ @ptlis +/types/javascript-astar/ @ptlis @lazerwalker /types/javascript-bignum/ @sandersn /types/javascript-obfuscator/ @sanex3339 /types/javascript-state-machine/ @borisyankov @mdocter @MrBigDog2U @samael65535 @taoqf @@ -2021,10 +2087,11 @@ /types/jexl/ @m-tomczyk /types/jfs/ @tlaziuk /types/jira-client/ @KOPTE3 @orta +/types/jju/ @ecraig12345 @rlidwka /types/jjv/ @Nemo157 /types/jjve/ @Nemo157 /types/jmespath/ @pushplay -/types/johnny-five/ @nakakura @ujvzolee @workshop2 +/types/johnny-five/ @nakakura @ujvzolee @workshop2 @xtrimsystems /types/joi/v6/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW /types/joi/v10/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @aconanlai /types/joi/v13/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus @wanganjun @rafaelkallis @aconanlai @zaphoyd @thewillg @SimonSchick @@ -2173,7 +2240,7 @@ /types/js-sha512/ @nicojs /types/js-string-escape/ @viralpickaxe /types/js-to-java/ @skyitachi -/types/js-url/ @pine613 +/types/js-url/ @pine /types/js-yaml/ @Bartvds @sclausen /types/js.spec/ @mattbishop /types/jsbn/ @Evgenus @al2xed @@ -2201,6 +2268,7 @@ /types/json-rpc-random-id/ @micahriggan /types/json-rpc-ws/ @npenin @mlamp /types/json-schema/ @bcherny @cyrilletuzi @lucianbuzzo @rolandjitsu +/types/json-server/ @jeremyben /types/json-socket/ @svi3c /types/json-stable-stringify/ @mhfrantz /types/json-stringify-safe/ @BendingBender @@ -2208,6 +2276,7 @@ /types/json2md/ @MartynasZilinskas /types/json3/ @NN--- /types/json5/ @Esemesek +/types/json_ml/ @pluma /types/jsonata/ @nick121212 /types/jsoneditor/ @alejo90 @errietta /types/jsoneditor-for-react/ @joshuakgoldberg @@ -2225,7 +2294,7 @@ /types/jsonwebtoken/ @SomaticIT @danielheim @brikou @vpk @rlgod /types/jsonwebtoken-promisified/ @SomaticIT @danielheim @brikou @aneilbaboo /types/jspath/ @dex4er -/types/jspdf/ @amberjs +/types/jspdf/ @amberjs @lleios @jemerald /types/jsqrcode/ @lordazzi /types/jsrender/ @zakki /types/jsreport-core/ @taoqf @@ -2253,6 +2322,7 @@ /types/jui-grid/ @easylogic /types/just-debounce-it/ @azizhk /types/just-extend/ @pe8ter +/types/just-pick/ @pe8ter /types/jweixin/ @taoqf @gomydodo /types/jwplayer/ @martinduparc @kutomer @philippguertler @danielmcgraw @bpdsw /types/jws/ @JustinBeckwith @@ -2268,7 +2338,7 @@ /types/karma/ @tkrotoff @43081j @devoto13 /types/karma-chai/ @JayAndCatchFire /types/karma-chai-sinon/ @vasek17 -/types/karma-coverage/ @tkrotoff +/types/karma-coverage/ @tkrotoff @devoto13 /types/karma-fixture/ @evictor @afshawnlotfi /types/karma-jasmine/ @michelsalib /types/karma-viewport/ @karak @@ -2276,9 +2346,11 @@ /types/katex/ @mrand01 /types/kcors/ @Xstoudi @izayoiko /types/kdbush/ @DenisCarriere @chrfrasco +/types/kdbxweb/ @Roang-zero1 /types/keen-tracking/ @rui-ferreira /types/kefir/ @AyaMorisawa @HitoriSensei /types/kendo-ui/ @telerik +/types/kerberos/ @velezsarain /types/keyboardjs/ @vbortone @piranha771 @teoxoy /types/keycloak-connect/ @gstamac /types/keygrip/ @jkeylu @@ -2293,10 +2365,10 @@ /types/klaw/ @mceachen /types/klaw-sync/ @shiftkey /types/kms-json/ @sunnyone -/types/knex/ @tkQubo @MeLlamoPablo @mastermatt @micksatana @shreyjain1994 +/types/knex/ @tkQubo @MeLlamoPablo @mastermatt @micksatana @shreyjain1994 @joelshepherd /types/knex-postgis/ @vesse /types/knockback/ @borisyankov -/types/knockout/ @borisyankov @Igorbek @moonpyk @EnableSoftware @BenjaminEckardt @ffMathy @ltlombardi +/types/knockout/ @borisyankov @Igorbek @moonpyk @EnableSoftware @BenjaminEckardt @ffMathy @ltlombardi @Retsam /types/knockout-amd-helpers/ @DavidSichau /types/knockout-secure-binding/ @pine613 /types/knockout-transformations/ @johnnyreilly @Nemo157 @@ -2317,7 +2389,8 @@ /types/koa/ @DavidCai1993 @jkeylu @brikou /types/koa-basic-auth/ @Tobias4872 /types/koa-better-body/ @danwbyrne -/types/koa-bodyparser/ @hellopao @anup-2s +/types/koa-bodyparser/ @hellopao @anup-2s @hirochachacha +/types/koa-bouncer/ @maruware /types/koa-bunyan-logger/ @sjmcdowall /types/koa-cache-control/ @pe8ter /types/koa-compose/ @jkeylu @@ -2332,9 +2405,10 @@ /types/koa-hbs/ @jcbmln @mudkipme /types/koa-helmet/ @me /types/koa-html-minifier/ @romain-faust -/types/koa-joi-router/ @wingsbob @move-zig +/types/koa-joi-router/ @wingsbob @move-zig @hirochachacha /types/koa-json/ @brooklyndev /types/koa-json-error/ @mudkipme +/types/koa-log/ @havenchyk /types/koa-logger/ @geoffreak @tlaziuk /types/koa-logger-winston/ @stevehipwell /types/koa-morgan/ @vesse @@ -2343,14 +2417,16 @@ /types/koa-passport/ @horiuchi @tlaziuk @brendtumi /types/koa-pino-logger/ @khell /types/koa-pug/ @Xstoudi +/types/koa-qs/ @RemyJeancolas /types/koa-range/ @strax /types/koa-ratelimit/ @OutdatedVersion +/types/koa-ratelimit-lru/ @danwbyrne /types/koa-redis/ @nsimmons /types/koa-redis-cache/ @dimamukhin /types/koa-requestid/ @sjmcdowall /types/koa-response-time/ @thorsedeke @sjmcdowall /types/koa-route/ @migstopheles @jacogr -/types/koa-router/ @hellopao @schfkt @JounQin @romain-faust +/types/koa-router/ @hellopao @schfkt @JounQin @romain-faust @Guillaume-Mayer @falinor /types/koa-send/ @pe8ter @tlaziuk /types/koa-session/ @kerol2r20 @tlaziuk /types/koa-session-minimal/ @longztian @@ -2358,6 +2434,7 @@ /types/koa-static/ @hellopao @tlaziuk /types/koa-static-cache/ @JounQin /types/koa-static-server/ @wulunyi +/types/koa-useragent/ @rvboris /types/koa-views/ @brooklyndev /types/koa-webpack/ @malj @leebenson @miZyind @tlaziuk /types/koa-websocket/ @moimael @jacogr @zdila @Kroisse @@ -2387,6 +2464,7 @@ /types/lazy-value/ @ikatyang /types/lazy.js/ @Bartvds @miso440 /types/lazypipe/ @tomc974 +/types/ldap-filters/ @pluma /types/ldapjs/ @cvillemure @peterkooijmans /types/leadfoot/ @theintern /types/leaflet/v0/ @rgripper @@ -2441,6 +2519,7 @@ /types/libxmljs/ @fdecampredon @ComFreek /types/libxslt/ @alejo90 /types/license-checker/ @rogierschouten @unindented +/types/liftoff/ @BendingBender /types/lil-uuid/ @Pr1st0n /types/lime-js/ @arthur-xavier /types/line-by-line/ @etomsen @@ -2450,6 +2529,8 @@ /types/lingui__macro/ @huan086 /types/lingui__react/ @huan086 /types/linkify-it/ @praxxis +/types/linkifyjs/ @szhu +/types/list-stream/ @IanStorm /types/listr/ @durad /types/lls/ @borislavjivkov /types/load-json-file/ @SamVerschueren @@ -2767,6 +2848,7 @@ /types/lokijs/ @TeamworkGuy2 @thomasconner /types/lolex/ @Nemo157 @joshuakgoldberg @rogierschouten /types/long/ @peterkooijmans +/types/looks-same/ @xcatliu /types/loopback/ @kattsushi @enko @sequoia @drmikecrowe @karimsa /types/loopback-boot/ @kattsushi /types/lorem-ipsum/ @durad @@ -2778,12 +2860,12 @@ /types/lozad/ @plantain-00 /types/lru-cache/ @Bartvds @BendingBender /types/lscache/ @Chris-Martinezz -/types/ltx/ @PJakcson +/types/ltx/ @PJakcson @BendingBender /types/luaparse/ @stpettersens /types/lunr/v0/ @sebastian-lenz /types/lunr/ @seantanly /types/lusca/ @crutchcorn -/types/luxon/ @colbydehart @FourwingsY @jsiebern +/types/luxon/ @colbydehart @FourwingsY @jsiebern @mastermatt /types/lwip/ @AyaMorisawa /types/lz-string/ @M0ns1gn0r /types/lzma-native/ @leshow @@ -2793,19 +2875,21 @@ /types/mailcheck/ @pocesar /types/maildev/ @cyrilschumacher @zbarbuto /types/mailgen/ @vothanhkiet @jordanfarrer -/types/mailgun-js/ @sampsonjoliver +/types/mailgun-js/ @sampsonjoliver @andipaetzold /types/mailparser/ @psnider /types/main-bower-files/ @k-kagurazaka /types/make-dir/ @ikatyang @BendingBender /types/maker.js/ @danmarshall /types/makeup-expander/ @darkwebdev /types/makeup-floating-label/ @darkwebdev +/types/makeup-keyboard-trap/ @darkwebdev +/types/makeup-prevent-scroll-keys/ @darkwebdev /types/makeup-screenreader-trap/ @darkwebdev /types/mali-compose/ @danwbyrne /types/mali-onerror/ @danwbyrne /types/mandrill-api/ @pocesar /types/map-obj/ @BendingBender -/types/mapbox/ @anahkiasen +/types/mapbox/ @anahkiasen @Fluccioni /types/mapbox-gl/ @dobrud @patrickr /types/mapbox-gl-leaflet/ @agorshkov23 /types/mapbox__geo-viewport/ @fnberta @@ -2822,7 +2906,7 @@ /types/markdown-it-lazy-headers/ @knom /types/markdown-pdf/ @MonsieurMan /types/markdownlint/ @ark120202 -/types/marked/ @worr @BendingBender @CrossR +/types/marked/ @worr @BendingBender @CrossR @mwickett /types/marker-animate-unobtrusive/ @viskin /types/markerclustererplus/ @enanox @mxl /types/markitup/ @drillbits @@ -2868,12 +2952,13 @@ /types/materialize-css/ @huww98 @MaximBalaganskiy @MonizDave @broccoliarchy /types/math3d/ @laszlojakab @jimsmart /types/mathjax/ @rolandzwaga -/types/mathjs/ @siavol @andnp @bradbesserman +/types/mathjs/ @siavol @andnp @bradbesserman @pawkrol /types/matter-js/ @piranha771 @hasparus -/types/maxmind/ @geoffreak +/types/mcrypt/ @pluma /types/mcustomscrollbar/ @flurg /types/md5/ @arcdev1 @jprogrammer /types/md5-file/ @BamButz +/types/mdast/ @lujun2 /types/mdns/ @reppners /types/mdurl/ @rokt33r /types/media-typer/ @BendingBender @@ -2892,6 +2977,7 @@ /types/memwatch-next/ @cyrilschumacher /types/meow/ @KnisterPeter @praxxis @bitjson /types/merge-descriptors/ @danny8002 +/types/merge-env/ @BendingBender /types/merge-stream/ @k-kagurazaka @tomxtobin @daniel-zazula @djcsdy /types/merge2/ @tkrotoff @smac89 /types/merkle/ @kerol2r20 @@ -2945,12 +3031,12 @@ /types/mixpanel/ @hjellek @Manduro /types/mixto/ @vvakame /types/mjml/ @aahoughton @marpstar +/types/mjml-react/ @henrinormak /types/mkdirp/ @Bartvds @mrmlnc /types/mkdirp-promise/ @pluma /types/mkpath/ @optical /types/ml-levenberg-marquardt/ @m93a /types/mobx-apollo/ @pselden -/types/mobx-cookie/ @t49tran /types/mobx-devtools-mst/ @pluma /types/mocha/ @kazimanzurrashid @otiai10 @jt000 @enlight @cspotcode @1999 /types/mocha-each/ @magnostherobot @@ -2964,6 +3050,7 @@ /types/mock-require/ @gDelgado14 /types/mockdate/ @brunolm /types/mockery/ @jt000 +/types/mockingoose/ @hirochachacha /types/modernizr/ @borisyankov @theodorejb @leonyu @lucax88x @nhardy /types/modesl/ @neeschit /types/module-alias/ @KevinRamharak @@ -2982,7 +3069,7 @@ /types/money-math/ @taoqf /types/mongo-sanitize/ @CedricCazin /types/mongodb/v2/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi -/types/mongodb/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi @EnricoPicci @AJCStriker @julien-c @daprahamian @denys-bushulyak @BastienAr @sindbach @geraldinelemeur @jishi @various89 @angela-1 @lirbank @hector7 @floric +/types/mongodb/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi @EnricoPicci @AJCStriker @julien-c @daprahamian @denys-bushulyak @BastienAr @sindbach @geraldinelemeur @jishi @various89 @angela-1 @lirbank @hector7 @floric @erikc5000 /types/mongodb-memory-server/ @dmitryrogozhny /types/mongodb-uri/ @mernxl /types/mongoose/v4/ @simonxca @horiuchi @sindrenm @lukasz-zak @@ -3040,6 +3127,7 @@ /types/murmurhash3js/ @dlee-nvisia /types/musicmetadata/ @Xstoudi /types/mustache/ @markashleybell @manuth +/types/mustache-express/ @BendingBender /types/mutexify/ @maistho /types/mv/ @nenadalm /types/mysql/ @wjohnsto @kacepe @kpping @jdmunro @@ -3078,6 +3166,8 @@ /types/nes/ @NoHomey @saboya /types/nested-error-stacks/ @woutervh- /types/net-keepalive/ @hertzg +/types/netease-captcha/ @norubidium +/types/netlify-identity-widget/ @nkprince007 /types/netmask/ @mhfrantz /types/network-interfaces/ @anderswestberg /types/new-relic-browser/ @renehamburger @piotrkubisa @@ -3112,7 +3202,8 @@ /types/ngtoaster/ @btesser /types/ngwysiwyg/ @patrick-mackay /types/nightmare/ @horiuchi @samyang-au @Bleser92 -/types/nightwatch/ @rkavalap @schlesiger +/types/nightwatch/ @rkavalap @schlesiger @ClaytonAstrom +/types/nise/ @a-tarasyuk /types/nivo-slider/ @AndersonFriaca /types/noble/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko /types/nock/ @bonnici @horiuchi @afharo @mastermatt @damour @paambaati @@ -3123,7 +3214,7 @@ /types/node/v7/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @eps1lon @KSXGitHub @Archcry /types/node/v8/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 @n-e @brunoscheufler @KSXGitHub @islishude @r3nya /types/node/v9/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e @brunoscheufler @mohsen1 @KSXGitHub @a-tarasyuk @islishude @r3nya @eyqs -/types/node/ @Microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @brunoscheufler @smac89 @tellnes @DeividasBakanas @eyqs @Flarna @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @matthieusieben @mohsen1 @n-e @octo-sniffle @parambirs @eps1lon @SimonSchick @ThomasdenH @WilcoBakker @wwwy3y3 @ZaneHannanAU @jeremiergz +/types/node/ @Microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @brunoscheufler @smac89 @tellnes @DeividasBakanas @eyqs @Flarna @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @matthieusieben @mohsen1 @n-e @octo-sniffle @parambirs @eps1lon @SimonSchick @ThomasdenH @WilcoBakker @wwwy3y3 @ZaneHannanAU @jeremiergz @samuela /types/node-7z/ @erkie /types/node-array-ext/ @Beng89 /types/node-cache/ @chrootsu @dthunell @useltmann @@ -3137,7 +3228,7 @@ /types/node-emoji/ @jonestristand @styu /types/node-fetch/ @torstenwerner @nikcorg /types/node-fibers/ @caryhaynie -/types/node-forge/ @westy92 @flynetworks @a-k-g @rafal2228 @beenotung @joeflateau +/types/node-forge/ @westy92 @flynetworks @a-k-g @rafal2228 @beenotung @joeflateau @Apologiz @timhwang21 /types/node-gcm/ @horiuchi /types/node-geocoder/ @rosek86 /types/node-getopt/ @kcauchy @@ -3212,7 +3303,7 @@ /types/ns-api/ @Archcry /types/nslog/ @unindented /types/nsqjs/ @cezaryrk -/types/nuka-carousel/ @Romic @altaudio +/types/nuka-carousel/ @Romic @altaudio @matt-sungwook /types/number-is-nan/ @mhegazy /types/number-to-words/ @frederickfogerty /types/numeral/ @vbortone @BehindTheMath @klujanrosas @@ -3226,8 +3317,9 @@ /types/nwmatcher/ @woutervh- /types/o.js/ @IceOnFire @bradzacher @janhommes @jcchalte /types/oauth/ @nonAlgebraic @EduardoAC +/types/oauth-shim/ @BendingBender /types/oauth.js/ @nobuoka -/types/oauth2-server/ @vangorra @cirick @d-fischer +/types/oauth2-server/ @vangorra @cirick @d-fischer @rvitorsantos /types/oauth2orize/ @wokim @heycalmdown @stevehipwell /types/obelisk.js/ @bdrupieski /types/obj-file-parser/ @benc-uk @@ -3248,6 +3340,7 @@ /types/observe-js/ @herrmanno /types/oclazyload/ @rolandzwaga /types/odata/ @janhommes @jcchalte +/types/oembed-parser/ @BendingBender /types/ofe/ @Morfent /types/office-js/ @OfficeDev @LanceEA @Zlatkovsky @kbrandl @Rick-Kirkham @AlexJerabek @ElizabethSamuel-MSFT /types/office-runtime/ @Zlatkovsky @mscharlock @@ -3271,17 +3364,18 @@ /types/opener/ @tikurahul /types/openfin/v17/ @chrisbarker /types/openfin/v29/ @chrisbarker @rdepena -/types/openfin/ @chrisbarker @rdepena @whyn07m3 +/types/openfin/v34/ @chrisbarker @rdepena @whyn07m3 +/types/openfin/ @chrisbarker @rdepena @whyn07m3 @licui3936 /types/openjscad/ @danmarshall /types/openlayers/v2/ @bolhovsky /types/openlayers/v3/ @osechet @matthiasdailey-ccri /types/openlayers/ @osechet @wb14123 @ailrun @mylen @iamthechad @danmana @yairtawil @pierremarc @hauke96 @gberaudo -/types/openpgp/ @errietta @damonpam +/types/openpgp/ @errietta @damonpam @po5i /types/openstack-wrapper/ @sanjaymadane /types/opentok/ @westy92 @CatGuardian /types/opentype.js/ @danmarshall @edzis /types/opn/ @shinnn @SomaticIT @tlent -/types/opossum/ @quinnlangille @lance +/types/opossum/ @quinnlangille @merufm @lance /types/optics-agent/ @crevil /types/optimist/ @soywiz @chbrown /types/optimize-css-assets-webpack-plugin/ @odnamrataizem @@ -3310,7 +3404,7 @@ /types/p-cancelable/ @BendingBender /types/p-catch-if/ @LinusU /types/p-debounce/ @BendingBender -/types/p-defer/ @SamVerschueren +/types/p-defer/ @SamVerschueren @BendingBender /types/p-do-whilst/ @BendingBender /types/p-each-series/ @BendingBender /types/p-event/ @BendingBender @@ -3326,6 +3420,7 @@ /types/p-one/ @BendingBender /types/p-progress/ @icopp /types/p-props/ @BendingBender +/types/p-queue/v2/ @BendingBender @evanshortiss /types/p-queue/ @BendingBender @evanshortiss /types/p-reduce/ @BendingBender /types/p-reflect/ @BendingBender @@ -3337,6 +3432,7 @@ /types/p-throttle/ @BendingBender /types/p-timeout/ @BendingBender /types/p-try/ @BendingBender @LinusU +/types/p-wait-for/v1/ @BendingBender /types/p-wait-for/ @BendingBender /types/p-whilst/ @BendingBender /types/p2/ @clark-stevenson @@ -3358,7 +3454,8 @@ /types/parity-pmd/ @leovujanic @jewbre /types/parity-pmr/ @leovujanic /types/parity-poe/ @leovujanic -/types/parse/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas +/types/parse/v1/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas +/types/parse/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas @agoldis /types/parse-git-config/ @leonard-thieu @deltaidea /types/parse-github-url/ @ajafff /types/parse-glob/ @glen-84 @@ -3382,9 +3479,10 @@ /types/parsimmon/ @Bartvds @mizunashi-mana @bcherny @bvanreeven @leonard-thieu @MrJohz /types/passport/ @horiuchi @enaeseth @theigor @tlaziuk @danielpa9708 /types/passport-anonymous/ @0x6368656174 -/types/passport-auth0/ @johnbendi @iamvishnusankar +/types/passport-auth0/ @johnbendi @iamvishnusankar @duncanhall /types/passport-azure-ad/ @ShekharNain /types/passport-beam/ @AtlasDev +/types/passport-bnet/ @ivan94 /types/passport-cognito/ @mbutsykin /types/passport-discord/ @kzay /types/passport-facebook/ @staticfunction @lucasmacosta @@ -3403,7 +3501,7 @@ /types/passport-oauth2/ @pasieronen @WangZishi @EduardoAC /types/passport-oauth2-client-password/ @akaNightmare /types/passport-remember-me-extended/ @AylaJK -/types/passport-saml/ @cjbarth @dassennato +/types/passport-saml/ @cjbarth @dassennato @ksamborski /types/passport-steam/ @kzay /types/passport-strategy/ @liorm /types/passport-twitter/ @staticfunction @@ -3425,6 +3523,7 @@ /types/paypal-rest-sdk/ @trainerbill /types/pbf/ @cschwarz /types/pbkdf2/ @timonegk +/types/pdf2image/ @taoqf /types/pdfjs-dist/ @jbaldwin /types/pdfkit/ @erichillah /types/pdfmake/ @m1llen1um @radziksh @evolkmann @@ -3467,13 +3566,13 @@ /types/picturefill/ @alaz /types/pidusage/ @cyrilschumacher @mx601595686 /types/pify/ @samverschueren @mad-mike @c7hm4r -/types/pigpio/ @manerfan +/types/pigpio/ @manerfan @erikma /types/pigpio-dht/ @erikma /types/pikaday/ @MidnightDesign @wake42 @mezoistvan /types/pikaday-time/ @Sayan751 /types/pinkyswear/ @chances /types/pino/v3/ @psnider -/types/pino/ @psnider @BendingBender @screendriver @paambaati @alferpal +/types/pino/ @psnider @BendingBender @screendriver @paambaati @alferpal @mortiy /types/pino-http/ @screendriver /types/pino-multi-stream/ @JakeGinnivan /types/pinterest-sdk/ @adamburmister @@ -3483,6 +3582,7 @@ /types/pixi.js/ @clark-stevenson /types/pkg-conf/ @jorgegonzalez /types/pkg-dir/ @NK-WEB-Git +/types/pkg-up/ @forivall /types/pkijs/ @microshine /types/platform/ @JakeH /types/playcanvas/ @Neoflash1979 @@ -3503,6 +3603,12 @@ /types/podcast/ @nikeee /types/podium/ @AJamesPhillips /types/point-in-polygon/ @dyst5422 @kogai +/types/pollyjs__adapter/ @feinoujc +/types/pollyjs__adapter-fetch/ @feinoujc +/types/pollyjs__core/ @feinoujc +/types/pollyjs__persister/ @feinoujc +/types/pollyjs__persister-fs/ @feinoujc +/types/pollyjs__utils/ @feinoujc /types/polyfill-service/ @Alorel /types/polylabel/ @DenisCarriere /types/polyline/ @Kern0 @@ -3513,7 +3619,11 @@ /types/postal/ @lokeshpeta @myitcv /types/postcss-calc/ @huan086 /types/postcss-icss-values/ @huan086 +/types/postcss-modules-extract-imports/ @huan086 +/types/postcss-modules-local-by-default/ @huan086 /types/postcss-modules-resolve-imports/ @huan086 +/types/postcss-modules-scope/ @huan086 +/types/postcss-url/ @lenovouser /types/postman-collection/ @kbuzby /types/postmark/ @benbayard @jineshshah36 /types/pouch-redux-middleware/ @charrondev @@ -3563,21 +3673,23 @@ /types/promise-ftp/ @coolreader18 /types/promise-ftp-common/ @coolreader18 /types/promise-map-limit/ @kohlmannj +/types/promise-memoize/ @forivall /types/promise-pg/ @coldacid -/types/promise-polyfill/ @skysteve +/types/promise-polyfill/ @skysteve @djcsdy /types/promise-pool/ @vilic /types/promise-queue/ @LachlanStuart /types/promise-retry/ @shirakaba /types/promise-sftp/ @coolreader18 /types/promise-timeout/ @Aankhen /types/promise.prototype.finally/ @slavik57 @BendingBender +/types/promised-ldap/ @pluma /types/promised-temp/ @rokadias /types/promisify-node/ @borekb /types/promisify-supertest/ @aleung /types/prompt-sync/ @MugeSo /types/prompt-sync-history/ @MugeSo /types/promptly/ @danrspencer -/types/prompts/ @Berkays +/types/prompts/ @Berkays @danielpa9708 /types/prop-types/ @DovydasNavickas @ferdaber /types/proper-lockfile/ @qlonik /types/properties-reader/ @Goldsmith42 @@ -3610,12 +3722,13 @@ /types/ptomasroos__react-native-multi-slider/ @Slessi /types/pty.js/ @enlight /types/public-ip/ @BendingBender -/types/pubnub/ @bitbankinc @rollymaduk @vitosamson +/types/pubnub/ @bitbankinc @rollymaduk @vitosamson @FlorianDr /types/pubsub-js/ @borisyankov /types/pug/ @TonyPythoneer @19majkel94 /types/pulltorefreshjs/ @DanielRosenwasser @humpedli /types/pump/ @tlaziuk /types/pumpify/ @JustinBeckwith @aoberoi +/types/punycode/ @yavanosta /types/pupa/ @nju33 /types/puppeteer/v0/ @marvinhagemeister @cdeutsch /types/puppeteer/ @marvinhagemeister @cdeutsch @ksm2 @SimonSchick @@ -3651,13 +3764,22 @@ /types/qwest/ @lindsayevans /types/r-script/ @NaridaL /types/rabbit.js/ @wokim +/types/rabbitmq-schema/ @rulezzz1987 /types/radium/ @alexgorbatchev @nupplaphil @asvetliakov /types/radius/ @codeanimal +/types/radix64/ @huan086 /types/ramda/ @donnut @tycho01 @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick @leighman @CaptJakk @deftomat @deptno @blimusiek @biern @rayhaneh @rgm @drewwyatt +/types/random-boolean/ @BendingBender +/types/random-float/ @BendingBender +/types/random-int/ @BendingBender +/types/random-item/ @BendingBender /types/random-js/ @pistacchio /types/random-number/ @OpenByteDev +/types/random-obj-key/ @BendingBender +/types/random-obj-prop/ @BendingBender /types/random-seed/ @endel /types/random-string/ @stpettersens +/types/randombytes/ @BendingBender /types/randomcolor/ @feitzi @BradyLiles /types/range-parser/ @tlaziuk /types/rangyinputs/ @ersimont @@ -3681,9 +3803,11 @@ /types/raygun4js/ @xt0rted @BenjaminHarding @UberMouse /types/rbac-a/ @tlaziuk /types/rc/ @DanielRosenwasser +/types/rc-progress/ @jussikinnula /types/rc-select/ @DenisTirilis /types/rc-slider/ @mantasmarcinkus @mattoni @paustint @j-fro @Deanna2 /types/rc-time-picker/ @Hoff97 +/types/rc-tooltip/ @rhysd @ahstro @vsaarinen /types/rc-tree/ @johnnyreilly @Methuselah96 /types/rcloader/ @panuhorsmalahti /types/rdf-data-model/ @rubensworks @@ -3692,7 +3816,7 @@ /types/re-base/ @jordandrako /types/reach__router/ @kingdaro /types/react/v15/ @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz -/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei +/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei @Kovensky /types/react-adal/ @dkorolev1 /types/react-albus/ @sseppola @conradreuter @kuirak /types/react-alert/v2/ @ssyrell @@ -3708,7 +3832,8 @@ /types/react-avatar-editor/ @diogocorrea @gabsprates /types/react-beautiful-dnd/ @varHarrie @bradleyayers @paustint @marknelissen /types/react-better-password/ @mhuynh1 -/types/react-big-calendar/ @piotrwitek @paustint @pikpok @eps1lon @strongpauly +/types/react-big-calendar/ @piotrwitek @paustint @pikpok @eps1lon @strongpauly @janb87 +/types/react-blessed/ @me /types/react-body-classname/ @mhegazy /types/react-bootstrap/ @walkerburgin @vsiao @danilojrr @Batbold-Gansukh @octatone @chengsieuly @mretolaza @katbusch @vitosamson @LKay @aaronbeall @jrakotoharisoa @r3nya @t49tran /types/react-bootstrap-date-picker/ @LKay @ssi-hu-antal-bodnar @@ -3720,6 +3845,7 @@ /types/react-breadcrumbs-dynamic/ @mitsuruog /types/react-broadcast/ @kandros /types/react-burger-menu/ @radziksh +/types/react-cache/ @skovy /types/react-calendar-heatmap/ @9renpoto /types/react-calendar-timeline/ @radziksh @acemac /types/react-cartographer/ @trevonmckay @@ -3738,6 +3864,7 @@ /types/react-countup/ @danielbrodin /types/react-credit-cards/ @vstrimaitis @olefrank /types/react-cropper/ @stepancar +/types/react-css-collapse/ @dford07 /types/react-css-modules/ @KostyaEsmukov @skirsdeda /types/react-css-transition-replace/ @LKay /types/react-currency-formatter/ @pastushenkoy @Jeka-Vasiliev @@ -3748,7 +3875,7 @@ /types/react-data-grid/ @SupernaviX @KieranPeat @martinnov92 @baso53 /types/react-datagrid/ @stephenjelfs /types/react-date-range/ @Junbong -/types/react-datepicker/ @radziksh @andrewBalekha @smrq @Rogach @royxue @KoalaHuman @seansfkelley +/types/react-datepicker/ @radziksh @andrewBalekha @smrq @Rogach @royxue @KoalaHuman @seansfkelley @justingrant @jakeboone02 /types/react-daterange-picker/ @uncovertruth @MartynasZilinskas @donaldtf @vladflorescu94 /types/react-dates/ @ArturAmpilogov @NathanNZ /types/react-daum-postcode/ @Sa-ryong @@ -3775,7 +3902,7 @@ /types/react-file-reader-input/ @dmitryrogozhny @alitaheri /types/react-flag-icon-css/ @jonfreedman /types/react-flags-select/ @senukartur -/types/react-flatpickr/ @begincalendar +/types/react-flatpickr/ @begincalendar @snaveevans /types/react-flex/ @pushplay /types/react-flexr/ @pushplay /types/react-fontawesome/ @timurrustamov @dublicator @vincaslt @gavingregory @@ -3814,17 +3941,17 @@ /types/react-infinite/ @rhysd /types/react-infinite-calendar/ @christianchown /types/react-infinite-scroll-component/ @sroy3 @burtek @davidkevork @JoshuaScript -/types/react-infinite-scroller/ @Lapanti @psrebniak @WrathZA +/types/react-infinite-scroller/ @Lapanti @psrebniak @WrathZA @daggerjames /types/react-input-autosize/ @jsonunger @franklixuefei /types/react-input-calendar/ @stepancar /types/react-input-mask/v1/ @apare /types/react-input-mask/ @apare @dima7a14 /types/react-instantsearch/ @gburgett @jpowell -/types/react-instantsearch-core/ @gburgett @jpowell +/types/react-instantsearch-core/ @gburgett @jpowell @davidfurlong /types/react-instantsearch-dom/ @gburgett @jpowell /types/react-instantsearch-native/ @gburgett @jpowell /types/react-intl/v1/ @bgrieder -/types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari @formatlos @lukyth +/types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari @formatlos @lukyth @obedm503 /types/react-intl-redux/ @LKay /types/react-is/ @AviVahl @christianchown /types/react-is-deprecated/ @seansfkelley @@ -3838,6 +3965,7 @@ /types/react-lazyload/ @m0a /types/react-lazylog/ @benjaminRomano /types/react-leaflet/ @danzel @davschne @yuit +/types/react-leaflet-markercluster/ @Kimahriman /types/react-lifecycle-component/ @pixelshaded /types/react-list/ @buptyyf @tomshen /types/react-loadable/ @Kovensky @odensc @ianks @tlaziuk @iMobs @@ -3865,16 +3993,18 @@ /types/react-native-communications/ @huhuanming @PaitoAnderson /types/react-native-custom-tabs/ @philnova /types/react-native-datepicker/ @jacobbaskin -/types/react-native-dialog/ @MrLuje +/types/react-native-dialog/ @MrLuje @stackbuilders @ibarrae /types/react-native-dialogflow/ @jasonmerino /types/react-native-doc-viewer/ @iRoachie /types/react-native-document-picker/ @plantain-00 +/types/react-native-draggable-flatlist/ @stackbuilders @ibarrae /types/react-native-drawer/ @jnbt @suniahk /types/react-native-drawer-layout/ @jmfirth /types/react-native-elevated-view/ @fhelwanger /types/react-native-fabric/ @josephroque /types/react-native-fbsdk/ @ifiokjr /types/react-native-fetch-blob/ @MNBuyskih +/types/react-native-flip-card/ @imjakechapman /types/react-native-fs/ @pocesar @josephroque /types/react-native-google-signin/ @j-fro @bm-software @christianchown @echentw /types/react-native-htmlview/ @ifiokjr @@ -3903,6 +4033,7 @@ /types/react-native-referrer/ @christianchown /types/react-native-restart/ @christianchown /types/react-native-safari-view/ @mrand01 +/types/react-native-safe-area/ @pvinis /types/react-native-scaled-image/ @Jaeger25 /types/react-native-scrollable-tab-view/ @CaiHuan @egorshulga /types/react-native-sensor-manager/ @SahinVardar @@ -3927,7 +4058,7 @@ /types/react-native-version-number/ @VincentLanglet /types/react-native-video/ @huhuanming /types/react-navigation/v1/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi -/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @jkillian +/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @alechill @builtbyproxy @jkillian @jeroenvervaeke @chagasaway /types/react-navigation-material-bottom-tabs/ @iRoachie /types/react-no-ssr/ @rafalfilipek /types/react-notification-system/ @GiedriusGrabauskas @DeividasBakanas @LKay @sztobar @@ -3941,7 +4072,8 @@ /types/react-overlays/ @aaronbeall @vitosamson /types/react-owl-carousel/ @tbounsiar @igorissen @KennethanCeyer /types/react-paginate/v4/ @deevus @wouterhardeman @pegel03 @archy-bold -/types/react-paginate/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke +/types/react-paginate/v5/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke +/types/react-paginate/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke @sugarshin /types/react-places-autocomplete/ @guilhermehubner @r3nya /types/react-plotly.js/ @jonfreedman /types/react-pointable/ @istefo @mdibyo @@ -3955,7 +4087,7 @@ /types/react-recaptcha/ @mhegazy @zzanol /types/react-reconciler/ @Methuselah96 /types/react-redux/v5/ @tkqubo @thasner @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva -/types/react-redux/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva @kallikrein @val1984 @jrakotoharisoa @apapirovski +/types/react-redux/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva @kallikrein @val1984 @jrakotoharisoa @apapirovski @surgeboris /types/react-redux-epic/ @forabi /types/react-redux-i18n/ @clementdevos /types/react-redux-toastr/ @Smiche @artyomsv @kulmajaba @@ -3970,7 +4102,7 @@ /types/react-router/v3/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @ssorallen @gillchristian @nulladdict /types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga @neuoy @rraina @pret-a-porter @t49tran @8enSmith /types/react-router-bootstrap/ @vlesierse @LKay @olmobrutall -/types/react-router-config/ @lith-light-g @johnnyreilly +/types/react-router-config/ @lith-light-g @johnnyreilly @NullMDR /types/react-router-dom/ @tkrotoff @huy-nguyen @p-jackson @johnnyreilly /types/react-router-hash-link/ @zoompie /types/react-router-native/ @ezintz @fhelwanger @@ -3989,7 +4121,7 @@ /types/react-show-more/ @naortor /types/react-side-effect/ @remojansen @0xcaff /types/react-sidebar/ @jeroenvervaeke -/types/react-sketchapp/ @ricokahler @DomiR +/types/react-sketchapp/ @ricokahler @DomiR @saschazar21 /types/react-slick/ @andrewBalekha @GiedriusGrabauskas @r3nya /types/react-slider/ @jsonunger /types/react-smooth-scrollbar/ @asvetliakov @@ -4000,12 +4132,13 @@ /types/react-sparklines/ @henrinormak /types/react-spinkit/v1/ @tkqubo @mleko @pelotom /types/react-spinkit/ @tkqubo @mleko @pelotom @zzanol +/types/react-splitter-layout/ @snaptags /types/react-star-rating-component/ @marpstar /types/react-sticky/ @curtisw0 @ajhyndman /types/react-sticky-box/ @koss-lebedev /types/react-sticky-el/ @jbraithwaite /types/react-stickynode/ @tstirrat -/types/react-stripe-elements/ @dan-j @santiagodoldan @sonnysangha @9y5 @thchia +/types/react-stripe-elements/ @dan-j @santiagodoldan @sonnysangha @9y5 @thchia @yhnavein /types/react-svg-inline/ @kiyopikko /types/react-svg-pan-zoom/ @huy-nguyen /types/react-swf/ @stepancar @@ -4013,7 +4146,7 @@ /types/react-swipeable/ @GiedriusGrabauskas @mctep @horiuchi /types/react-swipeable-views/ @mxl @DeividasBakanas /types/react-syntax-highlighter/ @NoHomey @ajgamble-milner -/types/react-table/ @royxue @psakalo @Havret @andys8 +/types/react-table/ @royxue @psakalo @Havret @andys8 @Gelio /types/react-table-filter/ @gjsln /types/react-tabs/ @danez @Equationist /types/react-tag-autocomplete/ @jlismore @@ -4043,9 +4176,9 @@ /types/react-user-tour/ @ccancellieri /types/react-vertical-timeline-component/ @stephane-monnot /types/react-virtual-keyboard/ @bsurai -/types/react-virtualized/ @kaoDev @guntherjh @wasd171 @szabolcsx @kraenhansen @Stevearzh @mgoszcz2 @brandonhall +/types/react-virtualized/ @kaoDev @guntherjh @wasd171 @szabolcsx @kraenhansen @Stevearzh @mgoszcz2 @brandonhall @sbusch /types/react-virtualized-select/ @seansfkelley -/types/react-visibility-sensor/ @JRasmusBm +/types/react-visibility-sensor/ @JRasmusBm @gcangussu /types/react-webcam/ @squat /types/react-weui/ @tairan /types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya @MBillemaz @georg94 @@ -4068,14 +4201,15 @@ /types/readline-sync/ @jonestristand /types/readline-transform/ @dex4er /types/reapop/ @Barrokgl -/types/rebass/ @ryee-dev +/types/rebass/ @ryee-dev @jamesmckenzie /types/rebass__grid/ @antonvasin @vittorio @lhache @lavoaster /types/recaptcha2/ @l-jonas /types/recase/ @18steps -/types/recharts/ @mthmulders @rapmue @royxue @ZheyangSong @richbai90 @caspeco-dan @pkeuter @jrsaunde @paulmelnikow @crusectrl @apalugniok +/types/recharts/ @mthmulders @rapmue @royxue @ZheyangSong @richbai90 @caspeco-dan @pkeuter @jrsaunde @paulmelnikow @crusectrl @apalugniok @RobertStigsson /types/recharts-scale/ @johnnyreilly +/types/rechoir/ @BendingBender /types/recluster/ @dex4er -/types/recompose/ @iskandersierra @mrapogee @clayne11 @Pajn @lucasterra @brian-lives-outdoors +/types/recompose/ @iskandersierra @clayne11 @Pajn @lucasterra @brian-lives-outdoors @TiuSh /types/reconnect-core/ @thw0rted /types/reconnectingwebsocket/ @nguarracino /types/recorder-js/ @higuri @@ -4084,7 +4218,7 @@ /types/redis/ @soywiz @CodeAnimal @MugeSo @UppaJung @Rokt33r @43081j @barnski @1pete /types/redis-errors/ @43081j /types/redis-mock/ @BendingBender -/types/redis-rate-limiter/ @westy92 +/types/redis-rate-limiter/ @westy92 @nodify-at /types/redis-scripto/ @westy92 /types/redlock/v2/ @chrootsu /types/redlock/ @chrootsu @BendingBender @@ -4102,7 +4236,7 @@ /types/redux-devtools-dock-monitor/ @mc-petry /types/redux-devtools-log-monitor/ @mc-petry /types/redux-doghouse/ @BendingBender -/types/redux-first-router/ @Valbrand @viggyfresh @janb87 @corydeppen @jscinoz @surgeboris +/types/redux-first-router/ @Valbrand @viggyfresh @janb87 @corydeppen @jscinoz @surgeboris @geirsagberg /types/redux-first-router-link/ @janb87 /types/redux-first-router-restore-scroll/ @icopp /types/redux-first-routing/ @tlaziuk @@ -4111,7 +4245,7 @@ /types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun /types/redux-immutable/v3/ @oizie @sebald @gavingregory /types/redux-immutable/ @oizie @sebald @gavingregory @lukyth -/types/redux-immutable-state-invariant/ @remojansen @highflying +/types/redux-immutable-state-invariant/ @remojansen @highflying @mihai-dinculescu /types/redux-infinite-scroll/ @silkyfray /types/redux-injectable-store/ @unindented /types/redux-localstorage/ @LKay @@ -4129,7 +4263,8 @@ /types/redux-promise-middleware/ @ianks /types/redux-recycle/ @LKay /types/redux-router/ @stepancar -/types/redux-saga-tester/ @BenLorantfy +/types/redux-saga-tester/ @BenLorantfy @lawsumisu +/types/redux-sentry-middleware/ @dolezel /types/redux-shortcuts/ @tstirrat /types/redux-socket.io/ @snakeego /types/redux-storage/ @asvetliakov @@ -4212,8 +4347,10 @@ /types/riot-route/ @karak /types/riotcontrol/ @chrootsu /types/riotjs/ @vvakame +/types/ripemd160/ @BendingBender /types/rison/ @impworks /types/rivets/ @TrevorDev @matjanos +/types/rmc-drawer/ @Hoff97 /types/rmfr/ @pluma /types/roads/ @dancespiele /types/roads-server/ @dancespiele @@ -4221,8 +4358,9 @@ /types/roll/ @icopp /types/rolling-rate-limiter/ @l-jonas /types/rollup-plugin-json/ @asmockler @hotell +/types/roman-numerals/ @pluma /types/ronomon__crypto-async/ @BendingBender -/types/rosie/ @abner @subvertallchris @abukurov +/types/rosie/ @abner @subvertallchris @abukurov @adam187 /types/roslib/ @Pro @skycoop @dgorobopec /types/rot-js/ @atiaxi /types/round-to/ @seangenabe @@ -4278,11 +4416,18 @@ /types/sanitize-filename/ @Nemo157 /types/sanitize-html/ @rogierschouten @afshin @BehindTheMath @biermeester @WillGibson @sirMerr /types/sap__xsenv/ @mad-mike +/types/sasl-anonymous/ @BendingBender +/types/saslmechanisms/ @BendingBender +/types/sass/ @lenovouser /types/sass-graph/ @marvinhagemeister /types/sass-webpack-plugin/ @AepKill /types/sat/ @omni360 /types/satnav/ @DotNetNerd /types/saywhen/ @SeanSobey +/types/sc-auth/ @DanielRose +/types/sc-broker/ @DanielRose +/types/sc-broker-cluster/ @DanielRose +/types/sc-channel/ @DanielRose /types/scalike/ @ryoppy /types/schedule/ @Methuselah96 /types/scheduler/ @Methuselah96 @@ -4367,7 +4512,9 @@ /types/session-file-store/ @blendsdk @rokt33r /types/set-cookie-parser/ @nickp10 /types/set-value/ @DanielRosenwasser +/types/setasap/ @djcsdy /types/settings/ @shreyjain1994 +/types/sha.js/ @BendingBender /types/sha1/ @arcdev1 /types/sha256/ @nhardy /types/shallow-equals/ @rsolomon @@ -4391,6 +4538,7 @@ /types/shot/ @AJamesPhillips @SimonSchick /types/should-sinon/ @Arylo /types/showdown/ @cbowdon @tan9 @arielsaldana +/types/shpjs/ @littlebtc /types/shrink-ray/ @forabi /types/shuffle-seed/ @LeartS /types/siema/ @Irmiz @0x6368656174 @samnau @@ -4407,7 +4555,7 @@ /types/simple-lru/ @NN--- /types/simple-mock/ @leonyu /types/simple-oauth2/v1/ @mad-mike @troy-lamerton @netux -/types/simple-oauth2/ @mad-mike @troy-lamerton @netux +/types/simple-oauth2/ @mad-mike @troy-lamerton @netux @LinusU /types/simple-peer/ @tlaziuk /types/simple-url-cache/ @a-lucas /types/simple-websocket/ @dex4er @@ -4420,7 +4568,7 @@ /types/sindresorhus__df/ @whatknight /types/single-line-log/ @ffflorian /types/single-spa-react/ @Garrett-Smith-iq -/types/sinon/ @mrbigdog2u @rationull @lumaxis @nicojs @43081j @joshuakgoldberg @gjednaszewski +/types/sinon/ @mrbigdog2u @rationull @lumaxis @nicojs @43081j @joshuakgoldberg @gjednaszewski @johnjesse /types/sinon-as-promised/ @igrayson /types/sinon-chai/v2/ @kazimanzurrashid @jedmao /types/sinon-chai/ @kazimanzurrashid @jedmao @elpdpt @@ -4437,7 +4585,7 @@ /types/sjcl/ @Evgenus /types/skatejs/ @Hotell /types/ski/ @AyaMorisawa -/types/skyway/ @nakakura +/types/skyway/ @nakakura @izmhr /types/slack-mock/ @kkalavantavanich /types/slack-node/ @geoffreak /types/slack-winston/ @BlueHatbRit @@ -4448,18 +4596,21 @@ /types/slate-html-serializer/ @YangusKhan /types/slate-irc/ @elisee /types/slate-plain-serializer/ @YangusKhan @mkiefel -/types/slate-react/ @andykent @majelbstoat @JanLoebel @PatrickSachs @YangusKhan @isubasti @sgreav +/types/slate-react/ @andykent @majelbstoat @JanLoebel @PatrickSachs @YangusKhan @isubasti @sgreav @Kornil /types/sleep/ @rajarz +/types/slice-ansi/ @dwieeb /types/slickgrid/ @jbaldwin /types/slideout/ @ToastHawaii /types/slimerjs/ @alexwall /types/slocket/ @BendingBender /types/slug/ @mhegazy /types/smart-fox-server/ @ChanceM +/types/smooth-scroll/ @andreiho /types/smoothscroll-polyfill/ @kryops /types/smtp-server/v1/ @markisme @Taisiias /types/smtp-server/ @markisme @Taisiias @dex4er /types/smtpapi/ @a-morales +/types/snakecase-keys/ @BendingBender /types/snappy/ @reconbot /types/snapsvg/ @lhk @mattanja @kant2002 /types/snazzy-info-window/ @milosd92 @@ -4474,6 +4625,9 @@ /types/socket.io-parser/ @plantain-00 /types/socket.io-redis/ @nupplaphil @seeLuck /types/socket.io.users/ @kataras +/types/socketcluster/ @DanielRose +/types/socketcluster-client/ @DanielRose +/types/socketcluster-server/ @DanielRose /types/socketio-jwt/ @ehallander9591 /types/socketio-jwt-auth/ @codeanimal /types/socketio-wildcard/ @BendingBender @@ -4485,6 +4639,7 @@ /types/solution-center-communicator/ @dami-gg /types/sonic-boom/ @alferpal /types/sort-array/ @mrmlnc +/types/sort-object-keys/ @forivall /types/sortablejs/ @Maw-Fox @maartenstaa /types/soundmanager2/ @elton2048 /types/soupbintcp/ @jewbre @@ -4502,7 +4657,7 @@ /types/spdy/ @tony19 /types/speakeasy/ @legendecas @mrOlorin @xeoneux /types/speakingurl/ @Goldsmith42 -/types/spectacle/ @zmaybury +/types/spectacle/ @zmaybury @kale-stew /types/spectrum/ @M-Zuber @Ailrun /types/split/ @marcinporebski /types/split.js/ @icholy @@ -4514,6 +4669,7 @@ /types/sprintf/ @soywiz @BendingBender /types/sprintf-js/ @jasonswearingen @BendingBender @cdagli /types/sql-bricks/ @adn05 @paleo +/types/sql-template/ @q42jaap /types/sql.js/ @Hozuki /types/sqlanywhere/ @pkeuter /types/sqlite3/ @nmalaguti @dpyro @BehindTheMath @@ -4521,8 +4677,8 @@ /types/squirejs/ @bradleyayers /types/srp/ @Patman64 /types/ssh-key-decrypt/ @BendingBender -/types/ssh2/ @tkQubo @rbuckton @wrboyce -/types/ssh2-sftp-client/ @igrayson @ascariandrea @kartik2406 +/types/ssh2/ @tkQubo @rbuckton @wrboyce @lucasmotta +/types/ssh2-sftp-client/ @igrayson @ascariandrea @kartik2406 @viamuli /types/ssh2-streams/ @rbuckton /types/sshpk/ @mabels /types/stack-mapper/ @rogierschouten @@ -4552,9 +4708,9 @@ /types/sticky-cluster/ @paustint /types/stompit/ @DanielRose /types/stompjs/ @jimic @Dr4k4n -/types/stoppable/ @EricByers +/types/stoppable/ @EricByers @jplusje /types/storage-helper/ @ajafff -/types/store/ @vbortone @harry0000 @Ky6uk +/types/store/ @vbortone @harry0000 @Ky6uk @igl00 /types/storybook-addon-jsx/ @jameslnewell /types/storybook-readme/ @lonyele /types/storybook__addon-a11y/ @hyunseob @@ -4566,10 +4722,10 @@ /types/storybook__addon-knobs/ @joscha @martynaskadisa @amacleay /types/storybook__addon-links/ @joscha @jessepinho /types/storybook__addon-notes/ @joscha @amacleay -/types/storybook__addon-options/ @joscha @simonhn @amacleay +/types/storybook__addon-options/ @joscha @simonhn @amacleay @gaetanmaisse @adam187 /types/storybook__addon-storyshots/ @bradleyayers -/types/storybook__react/ @joscha @wapgear -/types/storybook__react-native/ @joscha @wapgear @alechill @iRoachie +/types/storybook__react/ @joscha @wapgear @dandean +/types/storybook__react-native/ @joscha @wapgear @alechill @iRoachie @ceyhuno /types/storybook__vue/ @pntgupta /types/stream-array/ @Tyler-Murphy /types/stream-buffers/ @Jason3S @@ -4584,6 +4740,7 @@ /types/stream-to-array/v0/ @Bartvds /types/stream-to-array/ @Bartvds @BendingBender /types/stream-to-promise/ @Alorel +/types/stream-to-string/ @BendingBender /types/streaming-json-stringify/ @BendingBender /types/streamjs/ @erosb /types/streamtest/ @lummish @@ -4606,7 +4763,7 @@ /types/stripe-checkout/ @cgwrench /types/stripe-v2/ @ejsmith @amritk @adamcmiel @jleider @galuszkak /types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak -/types/stripejs/ @RobinvanTienhoven +/types/stripejs/ @RobinvanTienhoven @mattferderer /types/strong-cluster-control/ @shuntksh /types/strong-error-handler/ @blankstar85 /types/strong-log-transformer/ @azasypkin @@ -4614,7 +4771,7 @@ /types/strophe.js/ @DavidKDeutsch /types/structured-source/ @azu /types/styled-components/v3/ @Igorbek @Igmat -/types/styled-components/ @Igorbek @Igmat @lavoaster +/types/styled-components/ @Igorbek @Igmat @lavoaster @Kovensky /types/styled-jsx/ @R1ZZU /types/styled-react-modal/ @Lavoaster /types/styled-system/ @maxdeviant @phobon @zephraph @damassi @alloy @maoueh @lavoaster @jschuler @@ -4634,7 +4791,7 @@ /types/sumo-logger/ @forabi @clementallen /types/suncalc/ @horiuchi /types/superagent/v2/ @varju @NicoZelaya @mxl -/types/superagent/ @NicoZelaya @mxl @paplorinc @shreyjain1994 @zopf @beeequeue +/types/superagent/ @NicoZelaya @mxl @paplorinc @shreyjain1994 @zopf @beeequeue @lukaselmer /types/superagent-bunyan/ @bricka /types/superagent-no-cache/ @mxl /types/superagent-prefix/ @mxl @@ -4658,7 +4815,7 @@ /types/sw-precache/ @JounQin /types/sw-precache-webpack-plugin/ @JounQin /types/swag/ @shiwano -/types/swagger-express-middleware/ @alexandreroba +/types/swagger-express-middleware/ @alexandreroba @tromgy /types/swagger-express-mw/ @micmro /types/swagger-express-validator/ @pinguet62 /types/swagger-hapi/ @micmro @@ -4690,8 +4847,9 @@ /types/tabbable/ @mokkan /types/table/ @evanshortiss @mrmlnc /types/tableau/ @protip +/types/tableify/ @forivall /types/tabris-plugin-firebase/ @eclipsesource -/types/tabtab/ @vojtechhabarta +/types/tabtab/ @vojtechhabarta @kamontat /types/tabulator/ @euginio /types/tail/ @spacejack /types/tapable/v0/ @e-cloud @@ -4721,7 +4879,7 @@ /types/tether-drop/ @adidahiya /types/tether-shepherd/ @mtgibbs /types/text-buffer/ @GlenCFL -/types/text-encoding/ @pine613 @mohsen1 @nwmqpa +/types/text-encoding/ @pine @mohsen1 @nwmqpa /types/text-encoding-utf-8/ @trxcllnt /types/text-table/ @saadq /types/textarea-caret/ @shiftkey @@ -4732,7 +4890,8 @@ /types/theming/ @eps1lon /types/theo/ @petekp /types/thepiratebay/ @jsorrell -/types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner @PsychoSTS @dhritzkiv @apurvaojas @NotWoods @sethk @elk941 @Methuselah96 @Dukuo @JulianSSS @devilsparta +/types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner @PsychoSTS @dhritzkiv @apurvaojas @NotWoods @sethk @elk941 @Methuselah96 @Dukuo @JulianSSS @devilsparta @KonstantinLukaschenko +/types/three-tds-loader/ @KonstantinLukaschenko @sschoensee /types/thrift/ @kamek-pf @kevin-greene-ck @jessezhang91 /types/throng/ @cyrilschumacher @tatethurston /types/throttle/ @BendingBender @@ -4742,6 +4901,7 @@ /types/through2/ @Bartvds @jedmao @valotas @TeamworkGuy2 @Alorel /types/through2-concurrent/ @Alorel /types/through2-map/ @LucasHill +/types/tildify/ @BendingBender /types/tile-reduce/ @DenisCarriere /types/tilebelt/ @DenisCarriere /types/time-span/ @BendingBender @mdvorscak @@ -4749,6 +4909,8 @@ /types/timelinejs3/ @MikeMatusz /types/timer-machine/ @dolanmiu /types/timezone-js/ @bonnici +/types/timing-safe-equal/ @BendingBender +/types/timsort/ @Vunovati /types/tinajs__tina/ @Jimexist /types/tinajs__tina-redux/ @Jimexist /types/tinder/ @pingec @@ -4773,7 +4935,7 @@ /types/toastr/ @borisyankov /types/tocktimer/ @evanshortiss /types/tokgen/ @l-jonas -/types/toobusy-js/ @atd-schubert +/types/toobusy-js/ @atd-schubert @BendingBender /types/tooltipster/ @stephenlautier @pjmagee @VorobeY1326 @leonard-thieu @janhi @joeskeen /types/topojson/ @ricardo-mello @chenzhutian @denisname /types/topojson-client/ @denisname @ricardo-mello @@ -4787,7 +4949,7 @@ /types/tough-cookie/ @leonard-thieu @LiJinyao @no2chem /types/tough-cookie-filestore/ @friedow /types/traceback/ @misak113 -/types/tracking/ @pimterry +/types/tracking/ @pimterry @bratter /types/transducers-js/ @colinkahn @dphilipson @NaridaL /types/transducers.js/ @dphilipson /types/transliteration/ @tony19 @@ -4806,13 +4968,14 @@ /types/tspromise/ @soywiz /types/ttf2woff2/ @ThomasdenH /types/tunnel/ @BendingBender -/types/tus-js-client/ @kevhiggins +/types/tus-js-client/ @kevhiggins @Acconut /types/tv4/ @Bartvds @psnider /types/tween.js/ @Amos47 @sunetos @jzarnikov @alexburner /types/tweenjs/ @evilangelist @jcyuan /types/tweezer.js/ @praxxis /types/twig/ @soywiz @enko /types/twilio/ @nickiannone @ashleybrener +/types/twilio-common/ @gatimus /types/twilio-video/ @minddocdev @darioblanco /types/twit/ @Volox @sapphiredev @abraham @siwalikm @plhery /types/twitch-ext/ @beheh @@ -4857,7 +5020,9 @@ /types/uniqid/ @idchlife /types/unique-hash-stream/ @BendingBender /types/unique-random/ @Kuniwak -/types/unist/ @bizen241 +/types/unique-random-array/ @BendingBender +/types/unist/ @bizen241 @lujun2 @hrajchert @wooorm @rokt33r +/types/unist-util-is/ @rokt33r /types/unity-webapi/ @jmvrbanac /types/universal-analytics/ @Bartvds @DarkerTV /types/universal-cookie/ @tomi @@ -4905,6 +5070,7 @@ /types/uuid-validate/ @HiromiShikata /types/uws/ @plantain-00 @orblazer /types/v-chart-plugin/ @natemara +/types/v8flags/ @BendingBender /types/valdr/ @ilbertz /types/valdr-message/ @ilbertz /types/valerie/ @conficient @@ -4920,7 +5086,6 @@ /types/vast-client/ @jgainfort /types/vec3/ @xstoudi /types/vectorious/ @erikgerrits -/types/vega/ @pelotom /types/velocity-animate/ @smrq /types/verror/ @svi3c @max4t /types/vertx3-eventbus-client/ @oddeirik @@ -4928,7 +5093,8 @@ /types/vexdb/ @MayorMonty /types/vexflow/ @rquiring @sebastianhaas @bohoffi @sschmidTU /types/vfile/ @bizen241 @rokt33r -/types/vfile-location/ @ikatyang +/types/vfile-location/ @ikatyang @rokt33r +/types/vfile-message/ @rokt33r /types/victory/ @asvetliakov @snerks @Havret @alredyExist /types/video.js/ @vbortone @scleriot @SWBennett06 @IgelCampus @giofreitas @gjanblaszczyk @sroucheray @AkxeOne @meikidd /types/viewability-helper/ @lironzluf @@ -4944,7 +5110,7 @@ /types/vinyl-paths/ @tkQubo /types/virtual-dom/ @chbrown /types/virtual-keyboard/ @bsurai -/types/vis/ @MichaelBitard @macleodbroad-wf @adripanico @seveves @kaktus40 @mmaitre314 @supercargo @takato1314 @alex-kachura @dcop @avrahamcool +/types/vis/ @MichaelBitard @macleodbroad-wf @adripanico @seveves @kaktus40 @mmaitre314 @supercargo @takato1314 @alex-kachura @dcop @avrahamcool @divideby /types/vision/v4/ @jasonswearingen @AJamesPhillips /types/vision/ @jasonswearingen @AJamesPhillips @lenovouser /types/vitalsigns/ @cyrilschumacher @@ -4963,7 +5129,8 @@ /types/vue-scrollto/ @vincekovacs /types/vue-select/ @silh /types/vue2-datepicker/ @ChristianStornowski -/types/vuex-i18n/ @jaeggerr @noamkfir +/types/vuelidate/ @janesser +/types/vuex-i18n/ @jaeggerr @noamkfir @barahliush /types/w2ui/ @Ptival /types/w3c-generic-sensor/ @kenchris /types/w3c-image-capture/ @cosium @@ -4984,17 +5151,19 @@ /types/watson-developer-cloud/ @waldo000000 @Naktibalda /types/wavesurfer.js/ @higuri /types/waypoints/ @dominikbulaj @Koloto @evil-shrike +/types/wcag-contrast/ @plantain-00 /types/wcwidth/ @rokt33r /types/weak/ @int0h /types/weapp-api/ @vargeek /types/web-animations-js/ @kritollm /types/web-bluetooth/ @urish /types/web-push/ @paullessing +/types/web-resource-inliner/ @BendingBender /types/web3/ @simon-jentzsch @nitzantomer @zurbo @yxliang01 @phra @naddison36 @icaroharry @linusnorton @jpeletier @anneau @matrushka @andrevmatos @levino @zlumer @archangel-irk @sogasg @donamk @dkent600 @nerddan /types/web3-eth-abi/ @LogvinovLeon /types/web3-provider-engine/ @LogvinovLeon /types/webappsec-credential-management/ @iainmcgin -/types/webassembly-js-api/ @periklis +/types/webassembly-js-api/ @periklis @chicoxyzzy /types/webassembly-web-api/ @jhenninger /types/webcl/ @NCARalph /types/webcomponents.js/ @adidahiya @@ -5061,6 +5230,7 @@ /types/wicg-mediasession/ @jucrouzet /types/wif/ @danwbyrne /types/wiiu/ @mzsm +/types/wikidata-sdk/ @kamontat /types/window-or-global/ @vvakame /types/window-size/ @pmkary /types/windows-1251/ @RomanGolovanov @@ -5113,7 +5283,8 @@ /types/xmldom/ @tkqubo /types/xmlpoke/ @garthk /types/xmltojson/ @traviscrowe -/types/xmpp__jid/ @PJakcson +/types/xmpp__jid/ @PJakcson @BendingBender +/types/xmpp__xml/ @BendingBender /types/xregexp/ @Bartvds @jfahrenkrug @sigo /types/xrm/v7/ @daryllabar /types/xrm/v8/ @6ix4our @mattngan @markusmauch @daryllabar @clownwilleatme @mariusagur @@ -5137,7 +5308,8 @@ /types/yayson/ @Codesleuth /types/yazl/ @taoqf @seangenabe /types/ydn-db/ @yathit @gabrielmaldi -/types/yeoman-generator/ @armorik83 @janslow @ikatyang +/types/yeoman-assert/ @Toilal +/types/yeoman-generator/ @armorik83 @janslow @ikatyang @tasadar2 /types/yeoman-test/ @ikatyang /types/yesql/ @Sumolari /types/yoctodelay/ @seangenabe @@ -5146,10 +5318,10 @@ /types/yog2-kernel/ @ssddi456 /types/yoga-layout/ @tnobody /types/yosay/ @armorik83 -/types/youtube/ @DazWilkin @JoshuaKGoldberg @eliotfallon213 @terrymun +/types/youtube/ @DazWilkin @JoshuaKGoldberg @eliotfallon213 @terrymun @paulhobbel /types/youtube-dl/ @bsurai /types/yui/ @giabao -/types/yup/ @dhardtke @vtserman @MoretonBayRC @sseppola @YashdalfTheGray +/types/yup/ @dhardtke @vtserman @MoretonBayRC @sseppola @YashdalfTheGray @vincentjames501 /types/z-schema/ @pgonzal /types/zapier-platform-core/ @bradleyayers /types/zeit__next-typescript/ @icopp @@ -5172,5 +5344,6 @@ /types/zmq/ @davemckeown /types/zookeeper/ @xialeistudio /types/zopflipng-bin/ @hikoma +/types/zrender/ @iRON5 /types/zui/ @yuanxu /types/zxcvbn/ @mtraynham From 1c127d70abbfc157125f25cb5906a854ed1ec73b Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Fri, 7 Dec 2018 22:47:12 +0100 Subject: [PATCH 175/241] Add types for escape-goat --- types/escape-goat/escape-goat-tests.ts | 14 ++++++++++++++ types/escape-goat/index.d.ts | 9 +++++++++ types/escape-goat/tsconfig.json | 23 +++++++++++++++++++++++ types/escape-goat/tslint.json | 1 + 4 files changed, 47 insertions(+) create mode 100644 types/escape-goat/escape-goat-tests.ts create mode 100644 types/escape-goat/index.d.ts create mode 100644 types/escape-goat/tsconfig.json create mode 100644 types/escape-goat/tslint.json diff --git a/types/escape-goat/escape-goat-tests.ts b/types/escape-goat/escape-goat-tests.ts new file mode 100644 index 0000000000..cfc1808495 --- /dev/null +++ b/types/escape-goat/escape-goat-tests.ts @@ -0,0 +1,14 @@ +import * as escapeGoat from 'escape-goat'; + +// $ExpectType string +escapeGoat.escape('🦄 & 🐐'); + +// $ExpectType string +escapeGoat.unescape('🦄 & 🐐'); + +// $ExpectType string +escapeGoat.escape('Hello World'); + +const url = 'https://sindresorhus.com?x="🦄"'; +// $ExpectType string +escapeGoat.escapeTag`Unicorn`; diff --git a/types/escape-goat/index.d.ts b/types/escape-goat/index.d.ts new file mode 100644 index 0000000000..f76f384fb0 --- /dev/null +++ b/types/escape-goat/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for escape-goat 1.3 +// Project: https://github.com/sindresorhus/escape-goat#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function escape(input: string): string; +export function unescape(input: string): string; +export function escapeTag(template: TemplateStringsArray, ...substitutions: any[]): string; +export function unescapeTag(template: TemplateStringsArray, ...substitutions: any[]): string; diff --git a/types/escape-goat/tsconfig.json b/types/escape-goat/tsconfig.json new file mode 100644 index 0000000000..9715cb59e1 --- /dev/null +++ b/types/escape-goat/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", + "escape-goat-tests.ts" + ] +} diff --git a/types/escape-goat/tslint.json b/types/escape-goat/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/escape-goat/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 78e24e6d88712405552da177c36032ece6d6be1e Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Fri, 7 Dec 2018 13:47:53 -0800 Subject: [PATCH 176/241] [prop-types] Make ValidationMap not require a validator for every member (#31133) * Make ValidationMap not require a validator for every member of the props interface * Fix InferProps when there are no required keys --- types/prop-types/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/prop-types/index.d.ts b/types/prop-types/index.d.ts index 3b0a1164d6..b6918d9d44 100644 --- a/types/prop-types/index.d.ts +++ b/types/prop-types/index.d.ts @@ -41,12 +41,12 @@ export interface Requireable extends Validator { isRequired: Validator>; } -export type ValidationMap = { [K in keyof T]-?: Validator }; +export type ValidationMap = { [K in keyof T]?: Validator }; export type InferType = V extends Validator ? T : any; export type InferProps = - & InferPropsInner>> - & Partial>>>; + & (RequiredKeys extends undefined ? {} : InferPropsInner>>) + & (OptionalKeys extends undefined ? {} : Partial>>>); export const any: Requireable; export const array: Requireable; From fb9f925aa964a546e1f50d3623938a17670c7207 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Fri, 7 Dec 2018 22:57:51 +0100 Subject: [PATCH 177/241] Add types for bin-version --- types/bin-version/bin-version-tests.ts | 6 ++++++ types/bin-version/index.d.ts | 14 ++++++++++++++ types/bin-version/tsconfig.json | 23 +++++++++++++++++++++++ types/bin-version/tslint.json | 1 + 4 files changed, 44 insertions(+) create mode 100644 types/bin-version/bin-version-tests.ts create mode 100644 types/bin-version/index.d.ts create mode 100644 types/bin-version/tsconfig.json create mode 100644 types/bin-version/tslint.json diff --git a/types/bin-version/bin-version-tests.ts b/types/bin-version/bin-version-tests.ts new file mode 100644 index 0000000000..7decda3e66 --- /dev/null +++ b/types/bin-version/bin-version-tests.ts @@ -0,0 +1,6 @@ +import binVersion = require('bin-version'); + +// $ExpectType Promise +binVersion('curl'); +// $ExpectType Promise +binVersion('openssl', { args: ['version'] }); diff --git a/types/bin-version/index.d.ts b/types/bin-version/index.d.ts new file mode 100644 index 0000000000..3db592bec7 --- /dev/null +++ b/types/bin-version/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for bin-version 3.0 +// Project: https://github.com/sindresorhus/bin-version#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = binVersion; + +declare function binVersion(binary: string, options?: binVersion.Options): Promise; + +declare namespace binVersion { + interface Options { + args?: string[]; + } +} diff --git a/types/bin-version/tsconfig.json b/types/bin-version/tsconfig.json new file mode 100644 index 0000000000..e89af3fdb8 --- /dev/null +++ b/types/bin-version/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", + "bin-version-tests.ts" + ] +} diff --git a/types/bin-version/tslint.json b/types/bin-version/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/bin-version/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From dbe4ab140d0156f81e839a3721f6fea6d7878c0c Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Fri, 7 Dec 2018 23:39:39 +0100 Subject: [PATCH 178/241] Add types for @sindresorhus/class-names --- types/sindresorhus__class-names/index.d.ts | 8 ++++++ .../sindresorhus__class-names-tests.ts | 25 +++++++++++++++++ types/sindresorhus__class-names/tsconfig.json | 28 +++++++++++++++++++ types/sindresorhus__class-names/tslint.json | 1 + 4 files changed, 62 insertions(+) create mode 100644 types/sindresorhus__class-names/index.d.ts create mode 100644 types/sindresorhus__class-names/sindresorhus__class-names-tests.ts create mode 100644 types/sindresorhus__class-names/tsconfig.json create mode 100644 types/sindresorhus__class-names/tslint.json diff --git a/types/sindresorhus__class-names/index.d.ts b/types/sindresorhus__class-names/index.d.ts new file mode 100644 index 0000000000..fbb81c48c6 --- /dev/null +++ b/types/sindresorhus__class-names/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for @sindresorhus/class-names 1.0 +// Project: https://github.com/sindresorhus/class-names +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = classNames; + +declare function classNames(...input: any[]): string; diff --git a/types/sindresorhus__class-names/sindresorhus__class-names-tests.ts b/types/sindresorhus__class-names/sindresorhus__class-names-tests.ts new file mode 100644 index 0000000000..d8627cb705 --- /dev/null +++ b/types/sindresorhus__class-names/sindresorhus__class-names-tests.ts @@ -0,0 +1,25 @@ +import classNames = require('@sindresorhus/class-names'); + +// $ExpectType string +classNames('unicorn', 'rainbow'); +// $ExpectType string +classNames({ awesome: true, foo: false }, 'unicorn', { rainbow: false }); +// $ExpectType string +classNames('unicorn', null, undefined, 0, 1, { foo: null }); + +const buttonType = 'main'; +// $ExpectType string +classNames({ [`button-${buttonType}`]: true }); + +const props = { + type: 'success', + small: true, + block: undefined, +}; + +// $ExpectType string +classNames('button', { + [`button-${props.type}`]: props.type, + 'button-block': props.block, + 'button-small': props.small, +}); diff --git a/types/sindresorhus__class-names/tsconfig.json b/types/sindresorhus__class-names/tsconfig.json new file mode 100644 index 0000000000..a0b866ebdf --- /dev/null +++ b/types/sindresorhus__class-names/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "paths": { + "@sindresorhus/class-names": [ + "sindresorhus__class-names" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "sindresorhus__class-names-tests.ts" + ] +} diff --git a/types/sindresorhus__class-names/tslint.json b/types/sindresorhus__class-names/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sindresorhus__class-names/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 8bfd76757eddd4e10958478e011ed949ecba7d16 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Fri, 7 Dec 2018 23:52:35 +0100 Subject: [PATCH 179/241] Add types for humanize-url --- types/humanize-url/humanize-url-tests.ts | 4 ++++ types/humanize-url/index.d.ts | 8 ++++++++ types/humanize-url/tsconfig.json | 23 +++++++++++++++++++++++ types/humanize-url/tslint.json | 1 + 4 files changed, 36 insertions(+) create mode 100644 types/humanize-url/humanize-url-tests.ts create mode 100644 types/humanize-url/index.d.ts create mode 100644 types/humanize-url/tsconfig.json create mode 100644 types/humanize-url/tslint.json diff --git a/types/humanize-url/humanize-url-tests.ts b/types/humanize-url/humanize-url-tests.ts new file mode 100644 index 0000000000..7556cfb1c4 --- /dev/null +++ b/types/humanize-url/humanize-url-tests.ts @@ -0,0 +1,4 @@ +import humanizeUrl = require('humanize-url'); + +// $ExpectType string +humanizeUrl('https://www.sindresorhus.com/'); diff --git a/types/humanize-url/index.d.ts b/types/humanize-url/index.d.ts new file mode 100644 index 0000000000..c00f5c982f --- /dev/null +++ b/types/humanize-url/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for humanize-url 2.0 +// Project: https://github.com/sindresorhus/humanize-url#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = humanizeUrl; + +declare function humanizeUrl(url: string): string; diff --git a/types/humanize-url/tsconfig.json b/types/humanize-url/tsconfig.json new file mode 100644 index 0000000000..dd9fec46b6 --- /dev/null +++ b/types/humanize-url/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "humanize-url-tests.ts" + ] +} diff --git a/types/humanize-url/tslint.json b/types/humanize-url/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/humanize-url/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 948a00007eca26973add9d3b31ee7d95575e3341 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Sat, 8 Dec 2018 00:24:14 +0100 Subject: [PATCH 180/241] Add types for matcher --- types/matcher/index.d.ts | 16 ++++++++++++++++ types/matcher/matcher-tests.ts | 10 ++++++++++ types/matcher/tsconfig.json | 23 +++++++++++++++++++++++ types/matcher/tslint.json | 1 + 4 files changed, 50 insertions(+) create mode 100644 types/matcher/index.d.ts create mode 100644 types/matcher/matcher-tests.ts create mode 100644 types/matcher/tsconfig.json create mode 100644 types/matcher/tslint.json diff --git a/types/matcher/index.d.ts b/types/matcher/index.d.ts new file mode 100644 index 0000000000..08e4e91f8f --- /dev/null +++ b/types/matcher/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for matcher 1.1 +// Project: https://github.com/sindresorhus/matcher#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = matcher; + +declare function matcher(inputs: string[], patterns: string[], options?: matcher.Options): string[]; + +declare namespace matcher { + function isMatch(input: string, pattern: string, options?: Options): boolean; + + interface Options { + caseSensitive?: boolean; + } +} diff --git a/types/matcher/matcher-tests.ts b/types/matcher/matcher-tests.ts new file mode 100644 index 0000000000..fbadf58e1e --- /dev/null +++ b/types/matcher/matcher-tests.ts @@ -0,0 +1,10 @@ +import matcher = require('matcher'); + +// $ExpectType string[] +matcher(['foo', 'bar', 'moo'], ['*oo', '!foo']); +matcher(['foo', 'bar', 'moo'], ['!*oo']); +matcher(['foo', 'bar', 'moo'], ['!*oo'], { caseSensitive: true }); + +// $ExpectType boolean +matcher.isMatch('unicorn', 'uni*'); +matcher.isMatch('UNICORN', 'UNI*', { caseSensitive: true }); diff --git a/types/matcher/tsconfig.json b/types/matcher/tsconfig.json new file mode 100644 index 0000000000..efa5f37200 --- /dev/null +++ b/types/matcher/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", + "matcher-tests.ts" + ] +} diff --git a/types/matcher/tslint.json b/types/matcher/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/matcher/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From ec2874d4b8d43ed49da56ff303660fa242b614e2 Mon Sep 17 00:00:00 2001 From: runebaas Date: Sat, 8 Dec 2018 01:19:16 +0100 Subject: [PATCH 181/241] [openapi-factory] set strictFunctionTypes to true and change import in example code --- types/openapi-factory/openapi-factory-tests.ts | 2 +- types/openapi-factory/tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/openapi-factory/openapi-factory-tests.ts b/types/openapi-factory/openapi-factory-tests.ts index ad24a5021d..8213104a44 100644 --- a/types/openapi-factory/openapi-factory-tests.ts +++ b/types/openapi-factory/openapi-factory-tests.ts @@ -1,4 +1,4 @@ -import * as OpenApiFactory from 'openapi-factory'; +import OpenApiFactory = require('openapi-factory'); const api = new OpenApiFactory({}); diff --git a/types/openapi-factory/tsconfig.json b/types/openapi-factory/tsconfig.json index e8528e8e84..e9035817a2 100644 --- a/types/openapi-factory/tsconfig.json +++ b/types/openapi-factory/tsconfig.json @@ -7,7 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": false, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 31e9d65a72f0f95b9884f4e058293025fcda2bf0 Mon Sep 17 00:00:00 2001 From: andreidigori <45198612+andreidigori@users.noreply.github.com> Date: Sat, 8 Dec 2018 04:37:49 +0200 Subject: [PATCH 182/241] Update tsconfig.json Set strictFunctionTypes to true --- types/gdal/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/gdal/tsconfig.json b/types/gdal/tsconfig.json index 3a5bfaf917..5c11132a33 100644 --- a/types/gdal/tsconfig.json +++ b/types/gdal/tsconfig.json @@ -7,7 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": false, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 88174a627285886f0c1ad56dfd737454efa157b6 Mon Sep 17 00:00:00 2001 From: denis Date: Sat, 8 Dec 2018 15:31:04 +0100 Subject: [PATCH 183/241] Use JsDoc @deprecated --- types/d3-shape/index.d.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/types/d3-shape/index.d.ts b/types/d3-shape/index.d.ts index eccf7f1b80..0c0e27cbd7 100644 --- a/types/d3-shape/index.d.ts +++ b/types/d3-shape/index.d.ts @@ -38,7 +38,7 @@ export interface CanvasPath_D3Shape { // ----------------------------------------------------------------------------------- /** - * Interface corresponding to the minimum data type assumed by the accessor functions of the Arc generator + * Interface corresponding to the minimum data type assumed by the accessor functions of the Arc generator */ export interface DefaultArcObject { /** @@ -994,14 +994,17 @@ export function lineRadial(): LineRadial<[number, number]>; */ export function lineRadial(): LineRadial; +/** + * @deprecated Use LineRadial + */ export type RadialLine = LineRadial; /** - * DEPRECATED: Use lineRadial() + * @deprecated Use lineRadial() */ export function radialLine(): RadialLine<[number, number]>; /** - * DEPRECATED: Use lineRadial() + * @deprecated Use lineRadial() */ export function radialLine(): RadialLine; @@ -1620,16 +1623,16 @@ export function areaRadial(): AreaRadial<[number, number]>; export function areaRadial(): AreaRadial; /** - * DEPRECATED: Use AreaRadial interface + * @deprecated Use AreaRadial interface */ export type RadialArea = AreaRadial; /** - * DEPRECATED: Use areaRadial() + * @deprecated Use areaRadial() */ export function radialArea(): RadialArea<[number, number]>; /** - * DEPRECATED: Use areaRadial() + * @deprecated Use areaRadial() */ export function radialArea(): RadialArea; @@ -2239,7 +2242,7 @@ export interface LinkRadial { } /** - * DEPRECATED: Use LinkRadial interface + * @deprecated Use LinkRadial interface */ export type RadialLink = LinkRadial; From 93e6117b3b8f1163e52594056218e6224693f73b Mon Sep 17 00:00:00 2001 From: Yutaka Nishimura Date: Sun, 9 Dec 2018 01:50:33 +0900 Subject: [PATCH 184/241] update validator.isEmpty option --- types/validator/index.d.ts | 7 ++++++- types/validator/validator-tests.ts | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/types/validator/index.d.ts b/types/validator/index.d.ts index 1b51669d14..8ee398d850 100644 --- a/types/validator/index.d.ts +++ b/types/validator/index.d.ts @@ -83,7 +83,7 @@ declare namespace ValidatorJS { isEmail(str: string, options?: IsEmailOptions): boolean; // check if the string has a length of zero. - isEmpty(str: string): boolean; + isEmpty(str: string, options?: IsEmptyOptions): boolean; // check if the string is a fully qualified domain name (e.g. domain.com). isFQDN(str: string, options?: IsFQDNOptions): boolean; @@ -310,6 +310,11 @@ declare namespace ValidatorJS { require_tld?: boolean; } + // options for isEmpty + interface IsEmptyOptions { + ignore_whitespace?: boolean; + } + // options for isFQDN interface IsFQDNOptions { require_tld?: boolean; diff --git a/types/validator/validator-tests.ts b/types/validator/validator-tests.ts index 61c1c59e92..09a9a7ba17 100644 --- a/types/validator/validator-tests.ts +++ b/types/validator/validator-tests.ts @@ -425,7 +425,9 @@ let any: any; result = validator.isEmail('sample'); result = validator.isEmail('sample', isEmailOptions); + let isEmptyOptions: ValidatorJS.IsEmptyOptions = {}; result = validator.isEmpty('sample'); + result = validator.isEmpty('sample', isEmptyOptions); let isFQDNOptions: ValidatorJS.IsFQDNOptions = {}; result = validator.isFQDN('sample'); From cf2baee61a81f672275cfa7d43699a51ad82d7fc Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Sun, 9 Dec 2018 03:53:44 -0500 Subject: [PATCH 185/241] [jquery] Add `originalEvent` property to `TriggeredEvent`. (#31189) --- types/jquery/jquery-tests.ts | 13 +++++++++++++ types/jquery/misc.d.ts | 1 + 2 files changed, 14 insertions(+) diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index c533f1b235..b1f63f3ecf 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -4244,6 +4244,19 @@ function JQuery() { event; } }); + + // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/31124 + function issue_31124(el: Element, mouseX: number) { + $(el) + .on("mousedown touchstart", (evt) => { + // tslint:disable-next-line:prefer-conditional-expression + if (evt.type === "mousedown") { + mouseX = (evt.originalEvent as MouseEvent).clientX; + } else { + mouseX = (evt.originalEvent as TouchEvent).touches[0].clientX; + } + }); + } } function one() { diff --git a/types/jquery/misc.d.ts b/types/jquery/misc.d.ts index 481b79e037..ebba2f7a31 100644 --- a/types/jquery/misc.d.ts +++ b/types/jquery/misc.d.ts @@ -4710,6 +4710,7 @@ $( "button" ).click(function( event ) { ``` */ namespace?: string; + originalEvent?: _Event; /** * The last value returned by an event handler that was triggered by this event, unless the value was undefined. * @see \`{@link https://api.jquery.com/event.result/ }\` From ef8804d22c64195fecee77e1c4bf194be75c0516 Mon Sep 17 00:00:00 2001 From: Ilia Beliaev Date: Sun, 9 Dec 2018 21:47:10 +0300 Subject: [PATCH 186/241] Added old version. --- types/pretty-ms/v3.2/index.d.ts | 19 +++++++++++++++ types/pretty-ms/v3.2/pretty-ms-tests.ts | 10 ++++++++ types/pretty-ms/v3.2/tsconfig.json | 31 +++++++++++++++++++++++++ types/pretty-ms/v3.2/tslint.json | 1 + 4 files changed, 61 insertions(+) create mode 100644 types/pretty-ms/v3.2/index.d.ts create mode 100644 types/pretty-ms/v3.2/pretty-ms-tests.ts create mode 100644 types/pretty-ms/v3.2/tsconfig.json create mode 100644 types/pretty-ms/v3.2/tslint.json diff --git a/types/pretty-ms/v3.2/index.d.ts b/types/pretty-ms/v3.2/index.d.ts new file mode 100644 index 0000000000..b1e151cd65 --- /dev/null +++ b/types/pretty-ms/v3.2/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for pretty-ms 3.2 +// Project: https://github.com/sindresorhus/pretty-ms#readme +// Definitions by: BendingBender +// ocboogie +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = prettyMs; + +declare function prettyMs(input: number, options?: prettyMs.PrettyMsOptions): string; + +declare namespace prettyMs { + interface PrettyMsOptions { + secDecimalDigits?: number; + msDecimalDigits?: number; + keepDecimalsOnWholeSeconds?: boolean; + compact?: boolean; + verbose?: boolean; + } +} diff --git a/types/pretty-ms/v3.2/pretty-ms-tests.ts b/types/pretty-ms/v3.2/pretty-ms-tests.ts new file mode 100644 index 0000000000..ae5e8120b2 --- /dev/null +++ b/types/pretty-ms/v3.2/pretty-ms-tests.ts @@ -0,0 +1,10 @@ +import prettyMs = require('pretty-ms'); + +let str: string; +str = prettyMs(133); +str = prettyMs(1337, {compact: true}); +str = prettyMs(1335669000, {verbose: true}); +str = prettyMs(1335669000, {keepDecimalsOnWholeSeconds: true}); +str = prettyMs(1335669000, {secDecimalDigits: 1}); +str = prettyMs(1335669000, {msDecimalDigits: 2}); +str = prettyMs(new Date(2014, 0, 1, 10, 40).getTime() - new Date(2014, 0, 1, 10, 5).getTime()); diff --git a/types/pretty-ms/v3.2/tsconfig.json b/types/pretty-ms/v3.2/tsconfig.json new file mode 100644 index 0000000000..34da0f6d27 --- /dev/null +++ b/types/pretty-ms/v3.2/tsconfig.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "pretty-ms": [ + "pretty-ms/v3.2" + ], + "pretty-ms/*": [ + "pretty-ms/v3.2/*" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pretty-ms-tests.ts" + ] +} diff --git a/types/pretty-ms/v3.2/tslint.json b/types/pretty-ms/v3.2/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pretty-ms/v3.2/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b004a7fdd3bc327b8ed3b10ea736937c1abb9f3a Mon Sep 17 00:00:00 2001 From: Ilia Beliaev Date: Sun, 9 Dec 2018 22:34:18 +0300 Subject: [PATCH 187/241] Fixed folder naming. --- types/pretty-ms/{v3.2 => v3}/index.d.ts | 0 types/pretty-ms/{v3.2 => v3}/pretty-ms-tests.ts | 0 types/pretty-ms/{v3.2 => v3}/tsconfig.json | 5 +---- types/pretty-ms/{v3.2 => v3}/tslint.json | 0 4 files changed, 1 insertion(+), 4 deletions(-) rename types/pretty-ms/{v3.2 => v3}/index.d.ts (100%) rename types/pretty-ms/{v3.2 => v3}/pretty-ms-tests.ts (100%) rename types/pretty-ms/{v3.2 => v3}/tsconfig.json (83%) rename types/pretty-ms/{v3.2 => v3}/tslint.json (100%) diff --git a/types/pretty-ms/v3.2/index.d.ts b/types/pretty-ms/v3/index.d.ts similarity index 100% rename from types/pretty-ms/v3.2/index.d.ts rename to types/pretty-ms/v3/index.d.ts diff --git a/types/pretty-ms/v3.2/pretty-ms-tests.ts b/types/pretty-ms/v3/pretty-ms-tests.ts similarity index 100% rename from types/pretty-ms/v3.2/pretty-ms-tests.ts rename to types/pretty-ms/v3/pretty-ms-tests.ts diff --git a/types/pretty-ms/v3.2/tsconfig.json b/types/pretty-ms/v3/tsconfig.json similarity index 83% rename from types/pretty-ms/v3.2/tsconfig.json rename to types/pretty-ms/v3/tsconfig.json index 34da0f6d27..5d4f2d4c31 100644 --- a/types/pretty-ms/v3.2/tsconfig.json +++ b/types/pretty-ms/v3/tsconfig.json @@ -14,10 +14,7 @@ ], "paths": { "pretty-ms": [ - "pretty-ms/v3.2" - ], - "pretty-ms/*": [ - "pretty-ms/v3.2/*" + "pretty-ms/v3" ] }, "types": [], diff --git a/types/pretty-ms/v3.2/tslint.json b/types/pretty-ms/v3/tslint.json similarity index 100% rename from types/pretty-ms/v3.2/tslint.json rename to types/pretty-ms/v3/tslint.json From 86f51b0d4bc0a7a5b748661d3f2c987e2a928a4c Mon Sep 17 00:00:00 2001 From: Maddi Joyce Date: Mon, 10 Dec 2018 15:17:03 +1100 Subject: [PATCH 188/241] Using DrawerNavigationState instead of regular NavigationState in DrawerItemsProps --- types/react-navigation/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 85b42444b1..8e743465c6 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -899,7 +899,7 @@ export function createSwitchNavigator( export const DrawerItems: React.ComponentType; export interface DrawerItemsProps { - navigation: NavigationScreenProp; + navigation: NavigationScreenProp; items: NavigationRoute[]; activeItemKey?: string; activeTintColor?: string; From f89573a6726d30d9c7dbaf66db308bca4ffe6ad9 Mon Sep 17 00:00:00 2001 From: Kevin O'Neil <6971504+kevoneil@users.noreply.github.com> Date: Mon, 10 Dec 2018 15:25:48 +0900 Subject: [PATCH 189/241] webpack: adds inline-cheap-source-map and inline-cheap-module-source-map as options (#31224) --- types/webpack/index.d.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index f5beb1dc63..40ce95bcad 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -538,12 +538,13 @@ declare namespace webpack { namespace Options { // tslint:disable-next-line:max-line-length - type Devtool = 'eval' | 'inline-source-map' | 'cheap-eval-source-map' | 'cheap-source-map' | 'cheap-module-eval-source-map' | 'cheap-module-source-map' | 'eval-source-map' | 'source-map' | - 'nosources-source-map' | 'hidden-source-map' | 'nosources-source-map' | '@eval' | '@inline-source-map' | '@cheap-eval-source-map' | '@cheap-source-map' | '@cheap-module-eval-source-map' | - '@cheap-module-source-map' | '@eval-source-map' | '@source-map' | '@nosources-source-map' | '@hidden-source-map' | '@nosources-source-map' | '#eval' | '#inline-source-map' | - '#cheap-eval-source-map' | '#cheap-source-map' | '#cheap-module-eval-source-map' | '#cheap-module-source-map' | '#eval-source-map' | '#source-map' | '#nosources-source-map' | - '#hidden-source-map' | '#nosources-source-map' | '#@eval' | '#@inline-source-map' | '#@cheap-eval-source-map' | '#@cheap-source-map' | '#@cheap-module-eval-source-map' | - '#@cheap-module-source-map' | '#@eval-source-map' | '#@source-map' | '#@nosources-source-map' | '#@hidden-source-map' | '#@nosources-source-map' | boolean; + type Devtool = 'eval' | 'inline-source-map' | 'cheap-eval-source-map' | 'cheap-source-map' | 'cheap-module-eval-source-map' | 'cheap-module-source-map' | 'eval-source-map' + | 'source-map' | 'nosources-source-map' | 'hidden-source-map' | 'nosources-source-map' | 'inline-cheap-source-map' | 'inline-cheap-module-source-map' | '@eval' + | '@inline-source-map' | '@cheap-eval-source-map' | '@cheap-source-map' | '@cheap-module-eval-source-map' | '@cheap-module-source-map' | '@eval-source-map' + | '@source-map' | '@nosources-source-map' | '@hidden-source-map' | '@nosources-source-map' | '#eval' | '#inline-source-map' | '#cheap-eval-source-map' + | '#cheap-source-map' | '#cheap-module-eval-source-map' | '#cheap-module-source-map' | '#eval-source-map' | '#source-map' | '#nosources-source-map' + | '#hidden-source-map' | '#nosources-source-map' | '#@eval' | '#@inline-source-map' | '#@cheap-eval-source-map' | '#@cheap-source-map' | '#@cheap-module-eval-source-map' + | '#@cheap-module-source-map' | '#@eval-source-map' | '#@source-map' | '#@nosources-source-map' | '#@hidden-source-map' | '#@nosources-source-map' | boolean; interface Performance { /** This property allows webpack to control what files are used to calculate performance hints. */ From dea36b252750f3b56e61b73603d0669a97e5e196 Mon Sep 17 00:00:00 2001 From: arichter83 Date: Mon, 10 Dec 2018 09:46:45 +0100 Subject: [PATCH 190/241] Removed comment --- types/simpl-schema/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/simpl-schema/index.d.ts b/types/simpl-schema/index.d.ts index afd841e0c9..b09a8fde96 100644 --- a/types/simpl-schema/index.d.ts +++ b/types/simpl-schema/index.d.ts @@ -5,7 +5,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export interface ValidationContext extends SimpleSchemaValidationContextStatic { - // constructor(ss: any); addValidationErrors(errors: any): void; clean(...args: any[]): any; getErrorForKey(key: any, ...args: any[]): any; From 21962c480d69b619afe7aba837b05bbd9a02fd70 Mon Sep 17 00:00:00 2001 From: Meno Abels Date: Mon, 10 Dec 2018 13:31:09 +0100 Subject: [PATCH 191/241] fix: import from to import = require --- types/resolve-pkg/resolve-pkg-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/resolve-pkg/resolve-pkg-tests.ts b/types/resolve-pkg/resolve-pkg-tests.ts index 8794b0cc03..caa949a11e 100644 --- a/types/resolve-pkg/resolve-pkg-tests.ts +++ b/types/resolve-pkg/resolve-pkg-tests.ts @@ -1,4 +1,4 @@ -import * as rpkg from 'resolve-pkg'; +import rpkg = require('resolve-pkg'); const test1 = rpkg('hello'); const test2 = rpkg('hello', {}); From fddd7126b83dd03869ae54b0e2350db613ce7450 Mon Sep 17 00:00:00 2001 From: Haotian Chai Date: Mon, 10 Dec 2018 20:46:20 +0800 Subject: [PATCH 192/241] add autoIndex at top level of connection options According to mongoose api doc of 5.3.15, autoIndex is set at the top level of connection options object. --- types/mongoose/index.d.ts | 1 + types/mongoose/mongoose-tests.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index 83aaa33b2b..87ce57f05c 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -424,6 +424,7 @@ declare module "mongoose" { */ autoIndex?: boolean; }; + autoIndex?: boolean; } /** See the node-mongodb-native driver instance for options that it understands. */ diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index f4fec31101..7d23e6be6b 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -27,7 +27,8 @@ const connection2: Promise = mongoose.connect(connectUri, { bufferCommands: false, useNewUrlParser: true, useFindAndModify: true, - useCreateIndex: true + useCreateIndex: true, + autoIndex: true }); const connection3: null = mongoose.connect(connectUri, function (error) { error.stack; From 3fcb1213a842f48ed2527a0ec4a2f643aa665965 Mon Sep 17 00:00:00 2001 From: AntoineC Date: Mon, 10 Dec 2018 17:18:24 +0100 Subject: [PATCH 193/241] Fix type of scaling property from number to Point --- types/paper/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index d3c818b112..5709826f6a 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -4865,7 +4865,7 @@ declare module paper { /** * The current scale factor of the view, as described by its matrix. */ - scaling: number; + scaling: Point; /** * The view’s transformation matrix, defining the view onto the project’s contents (position, zoom level, rotation, etc). From efa3d46697306e80172b37b095a7a07d567ba6d8 Mon Sep 17 00:00:00 2001 From: Nikk Radetskiy Date: Mon, 10 Dec 2018 19:22:38 +0200 Subject: [PATCH 194/241] exports reorganized to match documentation, async function declared --- types/favicons/favicons-tests.ts | 14 ++- types/favicons/index.d.ts | 153 ++++++++++++++++--------------- 2 files changed, 92 insertions(+), 75 deletions(-) diff --git a/types/favicons/favicons-tests.ts b/types/favicons/favicons-tests.ts index 485ea1d505..ce64c84e67 100644 --- a/types/favicons/favicons-tests.ts +++ b/types/favicons/favicons-tests.ts @@ -1,6 +1,6 @@ -import favicons, { Configuration } from "favicons"; +import * as favicons from "favicons"; -let config: Partial = { +let config: Partial = { path: "/foo/bar" }; @@ -19,7 +19,15 @@ favicons("path/to/file.png", config, (err, res) => { } }); -favicons("file.png", (err, res) => { +favicons("file.png", (err: any, res: any) => { + html = res.html.join(""); + + for (const { name, contents } of [...res.files, ...res.images]) { + html = name + contents.toString(); + } +}); + +favicons("file.png").then((res) => { html = res.html.join(""); for (const { name, contents } of [...res.files, ...res.images]) { diff --git a/types/favicons/index.d.ts b/types/favicons/index.d.ts index 47a9a9d24a..623fd0cb98 100644 --- a/types/favicons/index.d.ts +++ b/types/favicons/index.d.ts @@ -1,79 +1,84 @@ // Type definitions for favicons 5.1 // Project: https://github.com/evilebottnawi/favicons/blob/master/package.json -// Definitions by: Mohsen Azimi +// Definitions by: Mohsen Azimi , Nikk Radetskiy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 /// -export interface Configuration { - /** Path for overriding default icons path @default "/" */ - path: string; - /** Your application's name @default null */ - appName: string | null; - /** Your application's description @default null */ - appDescription: string | null; - /** Your (or your developer's) name @default null */ - developerName: string | null; - /** Your (or your developer's) URL @default null */ - developerURL: string | null; - /** Primary text direction for name, short_name, and description @default "auto" */ - dir: string; - /** Primary language for name and short_name @default "en-US */ - lang: string; - /** Background colour for flattened icons @default "#fff" */ - background: string; - /** Theme color user for example in Android's task switcher @default "#fff" */ - theme_color: string; - /** Preferred display mode: "fullscreen", "standalone", "minimal-ui" or "browser" @default "standalone" */ - display: "fullscreen" | "standalone" | "minimal-ui" | "browser"; - /** Default orientation: "any", "natural", "portrait" or "landscape" @default "any" */ - orientation: "any" | "natural" | "portrait" | "landscape"; - /** Start URL when launching the application from a device @default "/?homescreen=1" */ - start_url: string; - /** Your application's version string @default "1.0" */ - version: string; - /** Print logs to console? @default false */ - logging: boolean; - /** - * Platform Options: - * - offset - offset in percentage - * - background: - * * false - use default - * * true - force use default, e.g. set background for Android icons - * * color - set background for the specified icons - */ - icons: Partial<{ - /* Create Android homescreen icon. */ - android: boolean | { offset: string; background: string }; - /* Create Apple touch icons. */ - appleIcon: boolean | { offset: string; background: string }; - /* Create Apple startup images. */ - appleStartup: boolean | { offset: string; background: string }; - /* Create Opera Coast icon. */ - coast: boolean | { offset: string; background: string }; - /* Create regular favicons. */ - favicons: boolean; - /* Create Firefox OS icons. */ - firefox: boolean | { offset: string; background: string }; - /* Create Windows 8 tile icons. */ - windows: boolean | { background: string }; - /* Create Yandex browser icon. */ - yandex: boolean | { background: string }; - }>; +import { Duplex } from "stream"; + +declare namespace favicons { + interface Configuration { + /** Path for overriding default icons path @default "/" */ + path: string; + /** Your application's name @default null */ + appName: string | null; + /** Your application's description @default null */ + appDescription: string | null; + /** Your (or your developer's) name @default null */ + developerName: string | null; + /** Your (or your developer's) URL @default null */ + developerURL: string | null; + /** Primary text direction for name, short_name, and description @default "auto" */ + dir: string; + /** Primary language for name and short_name @default "en-US */ + lang: string; + /** Background colour for flattened icons @default "#fff" */ + background: string; + /** Theme color user for example in Android's task switcher @default "#fff" */ + theme_color: string; + /** Preferred display mode: "fullscreen", "standalone", "minimal-ui" or "browser" @default "standalone" */ + display: "fullscreen" | "standalone" | "minimal-ui" | "browser"; + /** Default orientation: "any", "natural", "portrait" or "landscape" @default "any" */ + orientation: "any" | "natural" | "portrait" | "landscape"; + /** Start URL when launching the application from a device @default "/?homescreen=1" */ + start_url: string; + /** Your application's version string @default "1.0" */ + version: string; + /** Print logs to console? @default false */ + logging: boolean; + /** + * Platform Options: + * - offset - offset in percentage + * - background: + * * false - use default + * * true - force use default, e.g. set background for Android icons + * * color - set background for the specified icons + */ + icons: Partial<{ + /* Create Android homescreen icon. */ + android: boolean | { offset: string; background: string }; + /* Create Apple touch icons. */ + appleIcon: boolean | { offset: string; background: string }; + /* Create Apple startup images. */ + appleStartup: boolean | { offset: string; background: string }; + /* Create Opera Coast icon. */ + coast: boolean | { offset: string; background: string }; + /* Create regular favicons. */ + favicons: boolean; + /* Create Firefox OS icons. */ + firefox: boolean | { offset: string; background: string }; + /* Create Windows 8 tile icons. */ + windows: boolean | { background: string }; + /* Create Yandex browser icon. */ + yandex: boolean | { background: string }; + }>; + } + + interface FavIconResponse { + images: Array<{ name: string; contents: Buffer }>; + files: Array<{ name: string; contents: Buffer }>; + html: string[]; + } + + type Callback = (error: Error | null, response: FavIconResponse) => void; + + /** You can programmatically access Favicons configuration (icon filenames, HTML, manifest files, etc) with this export */ + const config: Configuration; + + function stream(configuration?: Configuration): Duplex; } - -export interface FavIconResponse { - images: Array<{ name: string; contents: Buffer }>; - files: Array<{ name: string; contents: Buffer }>; - html: string[]; -} - -export type Callback = (error: Error | null, response: FavIconResponse) => void; - -/** You can programmatically access Favicons configuration (icon filenames, HTML, manifest files, etc) with this export */ -export const config: Configuration; - /** * Generate favicons * @param source Source image(s) @@ -82,12 +87,16 @@ export const config: Configuration; */ declare function favicons( source: string | Buffer | string[], - callback?: Callback + configuration?: Partial, +): Promise; +declare function favicons( + source: string | Buffer | string[], + callback?: favicons.Callback ): void; declare function favicons( source: string | Buffer | string[], - configuration?: Partial, - callback?: Callback + configuration?: Partial, + callback?: favicons.Callback ): void; -export default favicons; +export = favicons; From 242eb56ec6748c52a6b21182a75591c2b927d318 Mon Sep 17 00:00:00 2001 From: Nikk Radetskiy Date: Mon, 10 Dec 2018 19:29:00 +0200 Subject: [PATCH 195/241] version bump --- types/favicons/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/favicons/index.d.ts b/types/favicons/index.d.ts index 623fd0cb98..6bd3a4892e 100644 --- a/types/favicons/index.d.ts +++ b/types/favicons/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for favicons 5.1 +// Type definitions for favicons 5.3 // Project: https://github.com/evilebottnawi/favicons/blob/master/package.json // Definitions by: Mohsen Azimi , Nikk Radetskiy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 77acc1c821bc309be2e1a947fb37c6503f8a66de Mon Sep 17 00:00:00 2001 From: Richie Foreman Date: Mon, 10 Dec 2018 09:31:03 -0800 Subject: [PATCH 196/241] Add '$mdInkRippleProvider' defs to 'angular-material' ref: https://github.com/angular/material/blob/master/src/core/services/ripple/ripple.js#L102 --- types/angular-material/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index db74c97d10..cfa894b87f 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -152,6 +152,10 @@ declare module 'angular' { defaultViewBoxSize(viewBoxSize: number): IIconProvider; // default: 24 defaultFontSet(name: string): IIconProvider; } + + interface IInkRippleProvider { + disableInkRipple(): void; + } type IMedia = (media: string) => boolean; From 084b2d56eaad28caee9f7255fe7c0c881313909d Mon Sep 17 00:00:00 2001 From: "Charnoz, Antoine" Date: Mon, 10 Dec 2018 19:24:02 +0100 Subject: [PATCH 197/241] Add test for scaling of view --- types/paper/paper-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/paper/paper-tests.ts b/types/paper/paper-tests.ts index 165c64b2d8..1d1bc32abe 100644 --- a/types/paper/paper-tests.ts +++ b/types/paper/paper-tests.ts @@ -79,6 +79,8 @@ hitTestResults = paper.project.hitTestAll(hitTestPoint, hitOptionsInterfaceEmpty hitTestResults = paper.project.hitTestAll(hitTestPoint, hitOptionsInterfacePartial); hitTestResults = paper.project.hitTestAll(hitTestPoint, hitOptionsInterfaceFull); +paper.view.scaling = new paper.Point(1, 1); + function Examples() { function BooleanOperations(){ let text = new paper.PointText({ From a410c93186c77eb745911eb0103cb17fa283dfad Mon Sep 17 00:00:00 2001 From: Dima Smirnov Date: Mon, 10 Dec 2018 22:12:29 +0300 Subject: [PATCH 198/241] added FindOptionsOrderArray type for find options --- types/sequelize/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 06f27421cb..6898a82ca4 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -3291,6 +3291,11 @@ declare namespace sequelize { */ type FindOptionsAttributesArray = Array; + /** + * Shortcut for order type in FindOptions.attributes + */ + type FindOptionsOrderArray = Array | { model: Model, as?: string } | fn>; + /** * Options that are passed to any model creating a SELECT query * @@ -3331,7 +3336,7 @@ declare namespace sequelize { * first element is the column / function to order by, the second is the direction. For example: * `order: [['name', 'DESC']]`. In this way the column will be escaped, but the direction will not. */ - order?: string | col | literal | Array | { model: Model, as?: string } | fn> | fn | Array | { model: Model, as?: string }| fn>| fn>; + order?: string | col | literal | FindOptionsOrderArray | fn | Array; /** * Limit the results From a10c1b112f97c3104a6b73f1e9022eeeab27ef2a Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Mon, 10 Dec 2018 23:21:51 +0100 Subject: [PATCH 199/241] Add types for has-emoji --- types/has-emoji/has-emoji-tests.ts | 6 ++++++ types/has-emoji/index.d.ts | 8 ++++++++ types/has-emoji/tsconfig.json | 23 +++++++++++++++++++++++ types/has-emoji/tslint.json | 1 + 4 files changed, 38 insertions(+) create mode 100644 types/has-emoji/has-emoji-tests.ts create mode 100644 types/has-emoji/index.d.ts create mode 100644 types/has-emoji/tsconfig.json create mode 100644 types/has-emoji/tslint.json diff --git a/types/has-emoji/has-emoji-tests.ts b/types/has-emoji/has-emoji-tests.ts new file mode 100644 index 0000000000..f1453f4cf5 --- /dev/null +++ b/types/has-emoji/has-emoji-tests.ts @@ -0,0 +1,6 @@ +import hasEmoji = require('has-emoji'); + +// $ExpectType boolean +hasEmoji('Unicorn 🦄'); +// $ExpectType boolean +hasEmoji('Cat'); diff --git a/types/has-emoji/index.d.ts b/types/has-emoji/index.d.ts new file mode 100644 index 0000000000..2160e66497 --- /dev/null +++ b/types/has-emoji/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for has-emoji 1.0 +// Project: https://github.com/sindresorhus/has-emoji#readme +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = hasEmoji; + +declare function hasEmoji(candidate: string): boolean; diff --git a/types/has-emoji/tsconfig.json b/types/has-emoji/tsconfig.json new file mode 100644 index 0000000000..646f983707 --- /dev/null +++ b/types/has-emoji/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", + "has-emoji-tests.ts" + ] +} diff --git a/types/has-emoji/tslint.json b/types/has-emoji/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/has-emoji/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From dcd364079b5b48c940bf14a9c113268d62a74254 Mon Sep 17 00:00:00 2001 From: Richie Foreman Date: Mon, 10 Dec 2018 18:59:51 -0800 Subject: [PATCH 200/241] Update index.d.ts --- types/angular-material/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index cfa894b87f..9202829175 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -152,7 +152,7 @@ declare module 'angular' { defaultViewBoxSize(viewBoxSize: number): IIconProvider; // default: 24 defaultFontSet(name: string): IIconProvider; } - + interface IInkRippleProvider { disableInkRipple(): void; } From ee2d459f330f322e7531ace80692b0d31541c69e Mon Sep 17 00:00:00 2001 From: Ben Talbot Date: Mon, 10 Dec 2018 19:28:08 -0800 Subject: [PATCH 201/241] Remove declare module '@google-cloud/kms' and change to use 4 spaces instead of tabs. --- .../google-cloud__kms-tests.ts | 170 +++---- types/google-cloud__kms/index.d.ts | 428 +++++++++--------- types/google-cloud__kms/tslint.json | 5 +- 3 files changed, 299 insertions(+), 304 deletions(-) diff --git a/types/google-cloud__kms/google-cloud__kms-tests.ts b/types/google-cloud__kms/google-cloud__kms-tests.ts index e3f6648310..96ab80c7c1 100644 --- a/types/google-cloud__kms/google-cloud__kms-tests.ts +++ b/types/google-cloud__kms/google-cloud__kms-tests.ts @@ -4,114 +4,114 @@ let kmsClientV1: kms.v1.KeyManagementServiceClient; kmsClientV1 = new kms.v1.KeyManagementServiceClient(); const credentials = { - type: 'service_account', - project_id: '****', - private_key_id: '****', - private_key: '****', - client_email: '****', - client_id: '****', - auth_uri: 'https://accounts.google.com/o/oauth2/auth', - token_uri: 'https://oauth2.googleapis.com/token', - auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs', - client_x509_cert_url: '****' + type: 'service_account', + project_id: '****', + private_key_id: '****', + private_key: '****', + client_email: '****', + client_id: '****', + auth_uri: 'https://accounts.google.com/o/oauth2/auth', + token_uri: 'https://oauth2.googleapis.com/token', + auth_provider_x509_cert_url: 'https://www.googleapis.com/oauth2/v1/certs', + client_x509_cert_url: '****' }; let kmsClient: kms.KeyManagementServiceClient; kmsClient = new kms.KeyManagementServiceClient({ credentials }); async function exampleListKeyRings() { - const locationPath = kmsClient.locationPath('[PROJECT_ID]', '[LOCATION]'); - const [ asyncKeyRings ] = await kmsClient.listKeyRings({parent: locationPath}); - if (asyncKeyRings.length > 0) { - const keyRing = asyncKeyRings[ 0 ]; - console.log(`KeyRing: ${keyRing.name}`); - } + const locationPath = kmsClient.locationPath('[PROJECT_ID]', '[LOCATION]'); + const [ asyncKeyRings ] = await kmsClient.listKeyRings({parent: locationPath}); + if (asyncKeyRings.length > 0) { + const keyRing = asyncKeyRings[ 0 ]; + console.log(`KeyRing: ${keyRing.name}`); + } - kmsClient.listKeyRings({parent: locationPath}, (err, [ callbackKeyRings ]) => { - if (callbackKeyRings.length > 0) { - const keyRing = callbackKeyRings[ 0 ]; - console.log(`KeyRing: ${keyRing.name}`); - } - }); + kmsClient.listKeyRings({parent: locationPath}, (err, [ callbackKeyRings ]) => { + if (callbackKeyRings.length > 0) { + const keyRing = callbackKeyRings[ 0 ]; + console.log(`KeyRing: ${keyRing.name}`); + } + }); - kmsClient.listKeyRings({parent: locationPath}, { timeout: 1000 }, (err, [ callbackWithOptionsKeyRings ]) => { - if (callbackWithOptionsKeyRings.length > 0) { - const keyRing = callbackWithOptionsKeyRings[ 0 ]; - console.log(`KeyRing: ${keyRing.name}`); - } - }); + kmsClient.listKeyRings({parent: locationPath}, { timeout: 1000 }, (err, [ callbackWithOptionsKeyRings ]) => { + if (callbackWithOptionsKeyRings.length > 0) { + const keyRing = callbackWithOptionsKeyRings[ 0 ]; + console.log(`KeyRing: ${keyRing.name}`); + } + }); } async function exampleListCryptoKeys() { - const keyRingPath = kmsClient.keyRingPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]'); - const [ asyncKeys ] = await kmsClient.listCryptoKeys({parent: keyRingPath}); - if (asyncKeys.length > 0) { - const key = asyncKeys[ 0 ]; - console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`); - } + const keyRingPath = kmsClient.keyRingPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]'); + const [ asyncKeys ] = await kmsClient.listCryptoKeys({parent: keyRingPath}); + if (asyncKeys.length > 0) { + const key = asyncKeys[ 0 ]; + console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`); + } - kmsClient.listCryptoKeys({parent: keyRingPath}, (err, [ callbackKeys ]) => { - if (callbackKeys.length > 0) { - const key = callbackKeys[ 0 ]; - console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`); - } - }); + kmsClient.listCryptoKeys({parent: keyRingPath}, (err, [ callbackKeys ]) => { + if (callbackKeys.length > 0) { + const key = callbackKeys[ 0 ]; + console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`); + } + }); - kmsClient.listCryptoKeys({parent: keyRingPath}, { timeout: 1000 }, (err, [ callbackWithOptionsKeys ]) => { - if (callbackWithOptionsKeys.length > 0) { - const key = callbackWithOptionsKeys[ 0 ]; - console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`); - } - }); + kmsClient.listCryptoKeys({parent: keyRingPath}, { timeout: 1000 }, (err, [ callbackWithOptionsKeys ]) => { + if (callbackWithOptionsKeys.length > 0) { + const key = callbackWithOptionsKeys[ 0 ]; + console.log(`CryptoKey: ${key.name} Version: ${key.primary.name}`); + } + }); } async function exampleEncrypt() { - const formattedName = kmsClient.cryptoKeyPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]', '[KEY_ID]'); - const unencryptedText = new Buffer('Hello World'); + const formattedName = kmsClient.cryptoKeyPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]', '[KEY_ID]'); + const unencryptedText = new Buffer('Hello World'); - const [ asyncEncryptResult ] = await kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') }); - if (asyncEncryptResult != null) { - console.log(`Encrypted: ${asyncEncryptResult.ciphertext.toString('base64')}`); - } + const [ asyncEncryptResult ] = await kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') }); + if (asyncEncryptResult != null) { + console.log(`Encrypted: ${asyncEncryptResult.ciphertext.toString('base64')}`); + } - kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') }, (err, [ callbackEncryptResult ]) => { - if (callbackEncryptResult != null) { - console.log(`Encrypted: ${callbackEncryptResult.ciphertext.toString('base64')}`); - } - }); + kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') }, (err, [ callbackEncryptResult ]) => { + if (callbackEncryptResult != null) { + console.log(`Encrypted: ${callbackEncryptResult.ciphertext.toString('base64')}`); + } + }); - kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') }, { timeout: 1000 }, (err, [ callbackWithOptionsEncryptResult ]) => { - if (callbackWithOptionsEncryptResult != null) { - console.log(`Encrypted: ${callbackWithOptionsEncryptResult.ciphertext.toString('base64')}`); - } - }); + kmsClient.encrypt({ name: formattedName, plaintext: unencryptedText.toString('base64') }, { timeout: 1000 }, (err, [ callbackWithOptionsEncryptResult ]) => { + if (callbackWithOptionsEncryptResult != null) { + console.log(`Encrypted: ${callbackWithOptionsEncryptResult.ciphertext.toString('base64')}`); + } + }); } async function exampleDecrypt() { - // Example pulling a file from Cloud Storage - // const secretsStorage = new Storage({ credentials }); - // const bucket = secretsStorage.bucket('[KMS_STORAGE_BUCKET]'); - // const filePath = '[PATH_TO_KMS_ENCRYPTED_FILE'; - // const file = bucket.file(filePath); - // const buffers = await file.download(); - // const buffer = buffers[ 0 ]; + // Example pulling a file from Cloud Storage + // const secretsStorage = new Storage({ credentials }); + // const bucket = secretsStorage.bucket('[KMS_STORAGE_BUCKET]'); + // const filePath = '[PATH_TO_KMS_ENCRYPTED_FILE'; + // const file = bucket.file(filePath); + // const buffers = await file.download(); + // const buffer = buffers[ 0 ]; - const buffer = new Buffer('[ENCRYPTED_SOURCE_BUFFER]'); - const formattedName = kmsClient.cryptoKeyPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]', '[KEY_ID]'); - const [ asyncDecryptResult ] = await kmsClient.decrypt({name: formattedName, ciphertext: buffer.toString('base64') }); - if (asyncDecryptResult != null) { - console.log(`Decrypted: ${asyncDecryptResult.plaintext}`); - } + const buffer = new Buffer('[ENCRYPTED_SOURCE_BUFFER]'); + const formattedName = kmsClient.cryptoKeyPath('[PROJECT_ID]', '[LOCATION]', '[KEYRING_ID]', '[KEY_ID]'); + const [ asyncDecryptResult ] = await kmsClient.decrypt({name: formattedName, ciphertext: buffer.toString('base64') }); + if (asyncDecryptResult != null) { + console.log(`Decrypted: ${asyncDecryptResult.plaintext}`); + } - kmsClient.decrypt({ name: formattedName, ciphertext: buffer.toString('base64') }, (err, [ callbackDecryptResult ]) => { - if (callbackDecryptResult != null) { - console.log(`Decrypted: ${callbackDecryptResult.plaintext}`); - } - }); + kmsClient.decrypt({ name: formattedName, ciphertext: buffer.toString('base64') }, (err, [ callbackDecryptResult ]) => { + if (callbackDecryptResult != null) { + console.log(`Decrypted: ${callbackDecryptResult.plaintext}`); + } + }); - kmsClient.decrypt({ name: formattedName, ciphertext: buffer.toString('base64') }, (err, [ callbackWithOptionsDecryptResult ]) => { - if (callbackWithOptionsDecryptResult != null) { - console.log(`Decrypted: ${callbackWithOptionsDecryptResult.plaintext}`); - } - }); + kmsClient.decrypt({ name: formattedName, ciphertext: buffer.toString('base64') }, (err, [ callbackWithOptionsDecryptResult ]) => { + if (callbackWithOptionsDecryptResult != null) { + console.log(`Decrypted: ${callbackWithOptionsDecryptResult.plaintext}`); + } + }); } diff --git a/types/google-cloud__kms/index.d.ts b/types/google-cloud__kms/index.d.ts index 7f14a731bd..237c7115a0 100644 --- a/types/google-cloud__kms/index.d.ts +++ b/types/google-cloud__kms/index.d.ts @@ -8,268 +8,266 @@ import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb"; -declare module '@google-cloud/kms' { - namespace v1 { - enum CryptoKeyVersionAlgorithm { - // Not specified. - CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED = 0, +export namespace v1 { + enum CryptoKeyVersionAlgorithm { + // Not specified. + CRYPTO_KEY_VERSION_ALGORITHM_UNSPECIFIED = 0, - // Creates symmetric encryption keys. - GOOGLE_SYMMETRIC_ENCRYPTION = 1, + // Creates symmetric encryption keys. + GOOGLE_SYMMETRIC_ENCRYPTION = 1, - // RSASSA-PSS 2048 bit key with a SHA256 digest. - RSA_SIGN_PSS_2048_SHA256 = 2, + // RSASSA-PSS 2048 bit key with a SHA256 digest. + RSA_SIGN_PSS_2048_SHA256 = 2, - // RSASSA-PSS 3072 bit key with a SHA256 digest. - RSA_SIGN_PSS_3072_SHA256 = 3, + // RSASSA-PSS 3072 bit key with a SHA256 digest. + RSA_SIGN_PSS_3072_SHA256 = 3, - // RSASSA-PSS 4096 bit key with a SHA256 digest. - RSA_SIGN_PSS_4096_SHA256 = 4, + // RSASSA-PSS 4096 bit key with a SHA256 digest. + RSA_SIGN_PSS_4096_SHA256 = 4, - // RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest. - RSA_SIGN_PKCS1_2048_SHA256 = 5, + // RSASSA-PKCS1-v1_5 with a 2048 bit key and a SHA256 digest. + RSA_SIGN_PKCS1_2048_SHA256 = 5, - // RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest. - RSA_SIGN_PKCS1_3072_SHA256 = 6, + // RSASSA-PKCS1-v1_5 with a 3072 bit key and a SHA256 digest. + RSA_SIGN_PKCS1_3072_SHA256 = 6, - // RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest. - RSA_SIGN_PKCS1_4096_SHA256 = 7, + // RSASSA-PKCS1-v1_5 with a 4096 bit key and a SHA256 digest. + RSA_SIGN_PKCS1_4096_SHA256 = 7, - // RSAES-OAEP 2048 bit key with a SHA256 digest. - RSA_DECRYPT_OAEP_2048_SHA256 = 8, + // RSAES-OAEP 2048 bit key with a SHA256 digest. + RSA_DECRYPT_OAEP_2048_SHA256 = 8, - // RSAES-OAEP 3072 bit key with a SHA256 digest. - RSA_DECRYPT_OAEP_3072_SHA256 = 9, + // RSAES-OAEP 3072 bit key with a SHA256 digest. + RSA_DECRYPT_OAEP_3072_SHA256 = 9, - // RSAES-OAEP 4096 bit key with a SHA256 digest. - RSA_DECRYPT_OAEP_4096_SHA256 = 10, + // RSAES-OAEP 4096 bit key with a SHA256 digest. + RSA_DECRYPT_OAEP_4096_SHA256 = 10, - // ECDSA on the NIST P-256 curve with a SHA256 digest. - EC_SIGN_P256_SHA256 = 12, + // ECDSA on the NIST P-256 curve with a SHA256 digest. + EC_SIGN_P256_SHA256 = 12, - // ECDSA on the NIST P-384 curve with a SHA384 digest. - EC_SIGN_P384_SHA384 = 13, - } + // ECDSA on the NIST P-384 curve with a SHA384 digest. + EC_SIGN_P384_SHA384 = 13, + } - enum CryptoKeyVersionState { - // Not specified. - CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0, + enum CryptoKeyVersionState { + // Not specified. + CRYPTO_KEY_VERSION_STATE_UNSPECIFIED = 0, - // This version is still being generated. It may not be used, enabled, - // disabled, or destroyed yet. Cloud KMS will automatically mark this - // version [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] as soon as the version is ready. - PENDING_GENERATION = 5, + // This version is still being generated. It may not be used, enabled, + // disabled, or destroyed yet. Cloud KMS will automatically mark this + // version [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] as soon as the version is ready. + PENDING_GENERATION = 5, - // This version may be used for cryptographic operations. - ENABLED = 1, + // This version may be used for cryptographic operations. + ENABLED = 1, - // This version may not be used, but the key material is still available, - // and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state. - DISABLED = 2, + // This version may not be used, but the key material is still available, + // and the version can be placed back into the [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] state. + DISABLED = 2, - // This version is destroyed, and the key material is no longer stored. - // A version may not leave this state once entered. - DESTROYED = 3, + // This version is destroyed, and the key material is no longer stored. + // A version may not leave this state once entered. + DESTROYED = 3, - // This version is scheduled for destruction, and will be destroyed soon. - // Call - // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] - // to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state. - DESTROY_SCHEDULED = 4, - } + // This version is scheduled for destruction, and will be destroyed soon. + // Call + // [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] + // to put it back into the [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] state. + DESTROY_SCHEDULED = 4, + } - enum CryptoKeyVersionView { - // Default view for each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not include - // the [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field. - CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0, + enum CryptoKeyVersionView { + // Default view for each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. Does not include + // the [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation] field. + CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0, - // Provides all fields in each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the - // [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation]. - FULL = 1, - } + // Provides all fields in each [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion], including the + // [attestation][google.cloud.kms.v1.CryptoKeyVersion.attestation]. + FULL = 1, + } - enum ProtectionLevel { - // Not specified. - PROTECTION_LEVEL_UNSPECIFIED = 0, + enum ProtectionLevel { + // Not specified. + PROTECTION_LEVEL_UNSPECIFIED = 0, - // Crypto operations are performed in software. - SOFTWARE = 1, + // Crypto operations are performed in software. + SOFTWARE = 1, - // Crypto operations are performed in a Hardware Security Module. - HSM = 2, - } + // Crypto operations are performed in a Hardware Security Module. + HSM = 2, + } - enum AttestationFormat { - ATTESTATION_FORMAT_UNSPECIFIED = 0, + enum AttestationFormat { + ATTESTATION_FORMAT_UNSPECIFIED = 0, - // Cavium HSM attestation compressed with gzip. Note that this format is - // defined by Cavium and subject to change at any time. - CAVIUM_V1_COMPRESSED = 3, - } + // Cavium HSM attestation compressed with gzip. Note that this format is + // defined by Cavium and subject to change at any time. + CAVIUM_V1_COMPRESSED = 3, + } - interface KeyOperationAttestation { - format: AttestationFormat; - } + interface KeyOperationAttestation { + format: AttestationFormat; + } - interface CryptoKeyVersion { - name: string; - state: CryptoKeyVersionState; - protectionLevel: ProtectionLevel; - algorithm: CryptoKeyVersionAlgorithm; - attestation?: KeyOperationAttestation; - createTime: google_protobuf_timestamp_pb.Timestamp.AsObject; - generateTime: google_protobuf_timestamp_pb.Timestamp.AsObject; - destroyTime?: google_protobuf_timestamp_pb.Timestamp.AsObject; - destroyEventTime?: google_protobuf_timestamp_pb.Timestamp.AsObject; - } + interface CryptoKeyVersion { + name: string; + state: CryptoKeyVersionState; + protectionLevel: ProtectionLevel; + algorithm: CryptoKeyVersionAlgorithm; + attestation?: KeyOperationAttestation; + createTime: google_protobuf_timestamp_pb.Timestamp.AsObject; + generateTime: google_protobuf_timestamp_pb.Timestamp.AsObject; + destroyTime?: google_protobuf_timestamp_pb.Timestamp.AsObject; + destroyEventTime?: google_protobuf_timestamp_pb.Timestamp.AsObject; + } - interface CryptoKeyVersionTemplate { - protectionLevel: ProtectionLevel; - algorithm: CryptoKeyVersionAlgorithm; - } + interface CryptoKeyVersionTemplate { + protectionLevel: ProtectionLevel; + algorithm: CryptoKeyVersionAlgorithm; + } - enum CryptoKeyPurpose { - // Not specified. - CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0, + enum CryptoKeyPurpose { + // Not specified. + CRYPTO_KEY_PURPOSE_UNSPECIFIED = 0, - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with - // [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and - // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. - ENCRYPT_DECRYPT = 1, + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with + // [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and + // [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. + ENCRYPT_DECRYPT = 1, - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with - // [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign] and - // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. - ASYMMETRIC_SIGN = 5, + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with + // [AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign] and + // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. + ASYMMETRIC_SIGN = 5, - // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with - // [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt] and - // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. - ASYMMETRIC_DECRYPT = 6, - } + // [CryptoKeys][google.cloud.kms.v1.CryptoKey] with this purpose may be used with + // [AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt] and + // [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. + ASYMMETRIC_DECRYPT = 6, + } - interface CryptoKey { - name: string; - primary: CryptoKeyVersion; - purpose: CryptoKeyPurpose; - createTime: google_protobuf_timestamp_pb.Timestamp.AsObject; - nextRotationTime?: google_protobuf_timestamp_pb.Timestamp.AsObject; - versionTemplate: CryptoKeyVersionTemplate; - labels: { [s: string]: string; }; - } + interface CryptoKey { + name: string; + primary: CryptoKeyVersion; + purpose: CryptoKeyPurpose; + createTime: google_protobuf_timestamp_pb.Timestamp.AsObject; + nextRotationTime?: google_protobuf_timestamp_pb.Timestamp.AsObject; + versionTemplate: CryptoKeyVersionTemplate; + labels: { [s: string]: string; }; + } - interface KeyRing { - name: string; - createTime: google_protobuf_timestamp_pb.Timestamp.AsObject; - } + interface KeyRing { + name: string; + createTime: google_protobuf_timestamp_pb.Timestamp.AsObject; + } - namespace KeyManagementServiceClient { - interface ConfigurationObject { - credentials?: { - client_email?: string; - private_key?: string - }; - email?: string; - keyFilename?: string; - port?: number; - projectId?: string; - promise?: any; - servicePath?: string; - } + namespace KeyManagementServiceClient { + interface ConfigurationObject { + credentials?: { + client_email?: string; + private_key?: string + }; + email?: string; + keyFilename?: string; + port?: number; + projectId?: string; + promise?: any; + servicePath?: string; + } - interface EncryptRequest { - name: string; - plaintext: string; - additionalAuthenticatedData?: string; - } - interface EncryptResponse { - name: string; - ciphertext: Buffer; - } - type EncryptCallback = (err: Error | null, apiResponse: [EncryptResponse, any, any]) => void; + interface EncryptRequest { + name: string; + plaintext: string; + additionalAuthenticatedData?: string; + } + interface EncryptResponse { + name: string; + ciphertext: Buffer; + } + type EncryptCallback = (err: Error | null, apiResponse: [EncryptResponse, any, any]) => void; - interface DecryptRequest { - name: string; - ciphertext: string; - additionalAuthenticatedData?: string; - } - interface DecryptResponse { - plaintext: Buffer; - } - type DecryptCallback = (err: Error | null, apiResponse: [DecryptResponse, any, any]) => void; + interface DecryptRequest { + name: string; + ciphertext: string; + additionalAuthenticatedData?: string; + } + interface DecryptResponse { + plaintext: Buffer; + } + type DecryptCallback = (err: Error | null, apiResponse: [DecryptResponse, any, any]) => void; - interface ListKeyRingsRequest { - parent: string; - page_size?: number; - page_token?: string; - } - type ListKeyRingsCallback = (err: Error | null, apiResponse: [KeyRing[], any, any]) => void; + interface ListKeyRingsRequest { + parent: string; + page_size?: number; + page_token?: string; + } + type ListKeyRingsCallback = (err: Error | null, apiResponse: [KeyRing[], any, any]) => void; - interface ListCryptoKeysRequest { - parent: string; - page_size?: number; - page_token?: string; - } - type ListCryptoKeysCallback = (err: Error | null, apiResponse: [CryptoKey[], any, any]) => void; - } + interface ListCryptoKeysRequest { + parent: string; + page_size?: number; + page_token?: string; + } + type ListCryptoKeysCallback = (err: Error | null, apiResponse: [CryptoKey[], any, any]) => void; + } - class KeyManagementServiceClient { - constructor(options?: KeyManagementServiceClient.ConfigurationObject); + class KeyManagementServiceClient { + constructor(options?: KeyManagementServiceClient.ConfigurationObject); - keyRingPath(project: string, location: string, keyRing: string): string; - cryptoKeyPathPath(project: string, location: string, keyRing: string, cryptoKeyPath: string): string; - locationPath(project: string, location: string): string; - cryptoKeyPath(project: string, location: string, keyRing: string, cryptoKey: string): string; - cryptoKeyVersionPath(project: string, location: string, keyRing: string, cryptoKey: string, cryptoKeyVersion: string): string; + keyRingPath(project: string, location: string, keyRing: string): string; + cryptoKeyPathPath(project: string, location: string, keyRing: string, cryptoKeyPath: string): string; + locationPath(project: string, location: string): string; + cryptoKeyPath(project: string, location: string, keyRing: string, cryptoKey: string): string; + cryptoKeyVersionPath(project: string, location: string, keyRing: string, cryptoKey: string, cryptoKeyVersion: string): string; - encrypt(request: KeyManagementServiceClient.EncryptRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyManagementServiceClient.EncryptResponse, any, any]>; - encrypt(request: KeyManagementServiceClient.EncryptRequest, callback: KeyManagementServiceClient.EncryptCallback): void; - encrypt(request: KeyManagementServiceClient.EncryptRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.EncryptCallback): void; + encrypt(request: KeyManagementServiceClient.EncryptRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyManagementServiceClient.EncryptResponse, any, any]>; + encrypt(request: KeyManagementServiceClient.EncryptRequest, callback: KeyManagementServiceClient.EncryptCallback): void; + encrypt(request: KeyManagementServiceClient.EncryptRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.EncryptCallback): void; - decrypt(request: KeyManagementServiceClient.DecryptRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyManagementServiceClient.DecryptResponse, any, any]>; - decrypt(request: KeyManagementServiceClient.DecryptRequest, callback: KeyManagementServiceClient.DecryptCallback): void; - decrypt(request: KeyManagementServiceClient.DecryptRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.DecryptCallback): void; + decrypt(request: KeyManagementServiceClient.DecryptRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyManagementServiceClient.DecryptResponse, any, any]>; + decrypt(request: KeyManagementServiceClient.DecryptRequest, callback: KeyManagementServiceClient.DecryptCallback): void; + decrypt(request: KeyManagementServiceClient.DecryptRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.DecryptCallback): void; - listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyRing[], any, any]>; - listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, callback: KeyManagementServiceClient.ListKeyRingsCallback): void; - listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.ListKeyRingsCallback): void; + listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, gaxOpts?: GAX.CallOptions): Promise<[KeyRing[], any, any]>; + listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, callback: KeyManagementServiceClient.ListKeyRingsCallback): void; + listKeyRings(request: KeyManagementServiceClient.ListKeyRingsRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.ListKeyRingsCallback): void; - listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, gaxOpts?: GAX.CallOptions): Promise<[CryptoKey[], any, any]>; - listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, callback: KeyManagementServiceClient.ListCryptoKeysCallback): void; - listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.ListCryptoKeysCallback): void; - } - } + listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, gaxOpts?: GAX.CallOptions): Promise<[CryptoKey[], any, any]>; + listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, callback: KeyManagementServiceClient.ListCryptoKeysCallback): void; + listCryptoKeys(request: KeyManagementServiceClient.ListCryptoKeysRequest, gaxOpts: GAX.CallOptions, callback: KeyManagementServiceClient.ListCryptoKeysCallback): void; + } +} - class KeyManagementServiceClient extends v1.KeyManagementServiceClient { - constructor(options?: v1.KeyManagementServiceClient.ConfigurationObject); - } +export class KeyManagementServiceClient extends v1.KeyManagementServiceClient { + constructor(options?: v1.KeyManagementServiceClient.ConfigurationObject); +} - namespace GAX { - /** https://googleapis.github.io/gax-nodejs/global.html#CallOptions */ - interface CallOptions { - timeout?: number; - retry?: RetryOptions; - autoPaginate?: boolean; - pageToken?: object; - isBundling?: boolean; - longrunning?: BackoffSettings; - promise?: PromiseConstructor; // FIXME Unsure if this is the correct type; remove this comment if it is - } +export namespace GAX { + /** https://googleapis.github.io/gax-nodejs/global.html#CallOptions */ + interface CallOptions { + timeout?: number; + retry?: RetryOptions; + autoPaginate?: boolean; + pageToken?: object; + isBundling?: boolean; + longrunning?: BackoffSettings; + promise?: PromiseConstructor; // FIXME Unsure if this is the correct type; remove this comment if it is + } - /** https://googleapis.github.io/gax-nodejs/global.html#RetryOptions */ - interface RetryOptions { - retryCodes: string[]; - backoffSettings: BackoffSettings; - } + /** https://googleapis.github.io/gax-nodejs/global.html#RetryOptions */ + interface RetryOptions { + retryCodes: string[]; + backoffSettings: BackoffSettings; + } - /** https://googleapis.github.io/gax-nodejs/global.html#BackoffSettings */ - interface BackoffSettings { - initialRetryDelayMillis: number; - retryDelayMultiplier: number; - maxRetryDelayMillis: number; - initialRpcTimeoutMillis: number; - maxRpcTimeoutMillis: number; - totalTimeoutMillis: number; - } - } + /** https://googleapis.github.io/gax-nodejs/global.html#BackoffSettings */ + interface BackoffSettings { + initialRetryDelayMillis: number; + retryDelayMultiplier: number; + maxRetryDelayMillis: number; + initialRpcTimeoutMillis: number; + maxRpcTimeoutMillis: number; + totalTimeoutMillis: number; + } } diff --git a/types/google-cloud__kms/tslint.json b/types/google-cloud__kms/tslint.json index ffaae9bd46..f93cf8562a 100644 --- a/types/google-cloud__kms/tslint.json +++ b/types/google-cloud__kms/tslint.json @@ -1,6 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "indent": [true, "tabs"] - } + "extends": "dtslint/dt.json" } From d3ba03f75649289aaa7562d452a8ebdf5ea292e0 Mon Sep 17 00:00:00 2001 From: Junyoung Choi Date: Tue, 11 Dec 2018 13:48:40 +0900 Subject: [PATCH 202/241] Discard context type checking --- types/unist-util-is/index.d.ts | 6 +++--- types/unist-util-is/unist-util-is-tests.ts | 12 ++---------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/types/unist-util-is/index.d.ts b/types/unist-util-is/index.d.ts index ae92217c6e..82e6e1fdc8 100644 --- a/types/unist-util-is/index.d.ts +++ b/types/unist-util-is/index.d.ts @@ -14,8 +14,8 @@ declare namespace unistUtilIs { * @param index Position of node in parent * @param parent Parent of node */ - type TestFunction = (this: C, node: unknown, index?: number, parent?: Unist.Parent) => boolean | void; - type Test = TestFunction | Partial | string | null; + type TestFunction = (node: unknown, index?: number, parent?: Unist.Parent) => boolean | void; + type Test = TestFunction | Partial | string | null; } /** @@ -31,6 +31,6 @@ declare namespace unistUtilIs { * @param context Context object to invoke `test` with * @returns Whether test passed and `node` is a `Node` (object with `type` set to non-empty `string`). */ -declare function unistUtilIs(test: unistUtilIs.Test | Array>, node: unknown, index?: number, parent?: Unist.Parent, context?: any): boolean; +declare function unistUtilIs(test: unistUtilIs.Test | unistUtilIs.Test[], node: unknown, index?: number, parent?: Unist.Parent, context?: any): boolean; export = unistUtilIs; diff --git a/types/unist-util-is/unist-util-is-tests.ts b/types/unist-util-is/unist-util-is-tests.ts index 4d355c90ec..9f3eecc680 100644 --- a/types/unist-util-is/unist-util-is-tests.ts +++ b/types/unist-util-is/unist-util-is-tests.ts @@ -20,15 +20,7 @@ is(test, node); is(test, node, 4, parent); is(test, node, 5, parent); -interface TestContext { - some: string; -} -function testWithContext(this: TestContext, node: unknown) {} -is(testWithContext, node); +function testFunc(node: unknown) {} +is(testFunc, node); const wrongTestFunc: is.TestFunction = (node: unknown, n: string) => {}; // $ExpectError - -interface OtherTestContext { - some: number; -} -is(testWithContext, node); // $ExpectError From d83c38e33756f0d4865de5cd34beffb399d595cd Mon Sep 17 00:00:00 2001 From: Brian Faust Date: Tue, 11 Dec 2018 08:55:38 +0200 Subject: [PATCH 203/241] Add the `unsafe` method to the NumberSchema of Joi --- types/joi/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 096847a82c..1af519dd5a 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -504,6 +504,11 @@ export interface NumberSchema extends AnySchema { */ integer(): this; + /** + * Allows the number to be outside of JavaScript's safety range (Number.MIN_SAFE_INTEGER & Number.MAX_SAFE_INTEGER). + */ + unsafe(enabled: boolean): this; + /** * Specifies the maximum number of decimal places where: * @param limit - the maximum number of decimal places allowed. From 0a70db0e4c7aa9a78523188c703c07e7d0c44d34 Mon Sep 17 00:00:00 2001 From: Brian Faust Date: Tue, 11 Dec 2018 09:07:03 +0200 Subject: [PATCH 204/241] Add test for `unsafe` for the NumberSchema of Joi --- types/joi/index.d.ts | 2 +- types/joi/joi-tests.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 1af519dd5a..404e0339ef 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -507,7 +507,7 @@ export interface NumberSchema extends AnySchema { /** * Allows the number to be outside of JavaScript's safety range (Number.MIN_SAFE_INTEGER & Number.MAX_SAFE_INTEGER). */ - unsafe(enabled: boolean): this; + unsafe(enabled?: boolean): this; /** * Specifies the maximum number of decimal places where: diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index 716fc70c16..e21310396b 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -618,6 +618,7 @@ numSchema = numSchema.greater(ref); numSchema = numSchema.less(num); numSchema = numSchema.less(ref); numSchema = numSchema.integer(); +numSchema = numSchema.unsafe(); numSchema = numSchema.precision(num); numSchema = numSchema.multiple(num); numSchema = numSchema.positive(); From 1f04344d92116837def38f25dd14586e8def467d Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Tue, 11 Dec 2018 18:15:20 +1100 Subject: [PATCH 205/241] fix(react-router): match can be null (#31212) * fix(react-router): match can be null * fix(react-router): update tests --- types/react-router-dom/react-router-dom-tests.tsx | 4 ++++ types/react-router/index.d.ts | 2 +- .../test/examples-from-react-router-website/Ambiguous.tsx | 2 +- .../test/examples-from-react-router-website/Animation.tsx | 6 +++--- .../test/examples-from-react-router-website/Basic.tsx | 4 ++-- .../examples-from-react-router-website/ModalGallery.tsx | 8 ++++++++ .../test/examples-from-react-router-website/Params.tsx | 2 +- .../test/examples-from-react-router-website/Recursive.tsx | 4 ++++ 8 files changed, 24 insertions(+), 8 deletions(-) diff --git a/types/react-router-dom/react-router-dom-tests.tsx b/types/react-router-dom/react-router-dom-tests.tsx index a550a579fa..a7715e9ea1 100644 --- a/types/react-router-dom/react-router-dom-tests.tsx +++ b/types/react-router-dom/react-router-dom-tests.tsx @@ -27,6 +27,10 @@ type OtherProps = RouteComponentProps<{ }>; const Component: React.SFC = props => { + if (!props.match) { + return null; + } + const { id } = props.match.params; return (
    {id}
    diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index f62fc44b18..fff900d458 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -68,7 +68,7 @@ export interface StaticContext { export interface RouteComponentProps { history: H.History; location: H.Location; - match: match; + match: match | null; staticContext?: C; } diff --git a/types/react-router/test/examples-from-react-router-website/Ambiguous.tsx b/types/react-router/test/examples-from-react-router-website/Ambiguous.tsx index 6e6598fd71..3f2dbc2223 100644 --- a/types/react-router/test/examples-from-react-router-website/Ambiguous.tsx +++ b/types/react-router/test/examples-from-react-router-website/Ambiguous.tsx @@ -41,7 +41,7 @@ const AmbiguousExample = () => ( const About = () =>

    About

    ; const Company = () =>

    Company

    ; -const User: React.SFC> = ({ match }) => ( +const User: React.SFC> = ({ match }) => match && (

    User: {match.params.user}

    diff --git a/types/react-router/test/examples-from-react-router-website/Animation.tsx b/types/react-router/test/examples-from-react-router-website/Animation.tsx index 8133528179..306ad14ea4 100644 --- a/types/react-router/test/examples-from-react-router-website/Animation.tsx +++ b/types/react-router/test/examples-from-react-router-website/Animation.tsx @@ -72,12 +72,12 @@ interface HSLParams { l: string; } -const HSL: React.SFC> = ({ match: { params } }) => ( +const HSL: React.SFC> = ({ match }) => match && (
    hsl({params.h}, {params.s}%, {params.l}%)
    + background: `hsl(${match.params.h}, ${match.params.s}%, ${match.params.l}%)` + }}>hsl({match.params.h}, {match.params.s}%, {match.params.l}%) ); const styles: any = {}; diff --git a/types/react-router/test/examples-from-react-router-website/Basic.tsx b/types/react-router/test/examples-from-react-router-website/Basic.tsx index ba6a5eabe5..05e2101f85 100644 --- a/types/react-router/test/examples-from-react-router-website/Basic.tsx +++ b/types/react-router/test/examples-from-react-router-website/Basic.tsx @@ -36,7 +36,7 @@ const About = () => ( ); -const Topics: React.SFC = ({ match }) => ( +const Topics: React.SFC = ({ match }) => match === null ? null : (

    Topics

      @@ -64,7 +64,7 @@ const Topics: React.SFC = ({ match }) => (
    ); -const Topic: React.SFC> = ({ match }) => ( +const Topic: React.SFC> = ({ match }) => match && (

    {match.params.topicId}

    diff --git a/types/react-router/test/examples-from-react-router-website/ModalGallery.tsx b/types/react-router/test/examples-from-react-router-website/ModalGallery.tsx index c51d63ac0f..be9bd1c322 100644 --- a/types/react-router/test/examples-from-react-router-website/ModalGallery.tsx +++ b/types/react-router/test/examples-from-react-router-website/ModalGallery.tsx @@ -114,6 +114,10 @@ const Gallery = () => ( ); const ImageView: React.SFC> = ({ match }) => { + if (!match) { + return null; + } + const image = IMAGES[parseInt(match.params.id, 10)]; if (!image) { return
    Image not found
    ; @@ -128,6 +132,10 @@ const ImageView: React.SFC> = ({ match }) => }; const Modal: React.SFC> = ({ match, history }) => { + if (!match) { + return null; + } + const image = IMAGES[parseInt(match.params.id, 10)]; if (!image) { return null; diff --git a/types/react-router/test/examples-from-react-router-website/Params.tsx b/types/react-router/test/examples-from-react-router-website/Params.tsx index a6d0bded7f..801a889d79 100644 --- a/types/react-router/test/examples-from-react-router-website/Params.tsx +++ b/types/react-router/test/examples-from-react-router-website/Params.tsx @@ -22,7 +22,7 @@ const ParamsExample = () => ( ); -const Child: React.SFC> = ({ match }) => ( +const Child: React.SFC> = ({ match }) => match && (

    ID: {match.params.id}

    diff --git a/types/react-router/test/examples-from-react-router-website/Recursive.tsx b/types/react-router/test/examples-from-react-router-website/Recursive.tsx index 534fe52931..9489d2fb25 100644 --- a/types/react-router/test/examples-from-react-router-website/Recursive.tsx +++ b/types/react-router/test/examples-from-react-router-website/Recursive.tsx @@ -39,6 +39,10 @@ interface InitialPersonProps { type PersonProps = RouteComponentProps<{ id: string }>; const Person: React.SFC = ({ match }) => { + if (!match) { + return null; + } + const person = find(match.params.id); return ( From bccc29241bd1993164f45b16225bb93f2b416982 Mon Sep 17 00:00:00 2001 From: gaston Date: Tue, 11 Dec 2018 23:44:47 +0700 Subject: [PATCH 206/241] Added polygon type, geometryEditor namespace, filled placemark options, added vow namespace --- types/yandex-maps/index.d.ts | 5345 ++++++++++++++++++---------------- 1 file changed, 2884 insertions(+), 2461 deletions(-) diff --git a/types/yandex-maps/index.d.ts b/types/yandex-maps/index.d.ts index e7078b4b28..d3c6975e98 100644 --- a/types/yandex-maps/index.d.ts +++ b/types/yandex-maps/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for yandex-maps 2.1 // Project: https://github.com/Delagen/typings-yandex-maps // Definitions by: Delagen +// gastwork13 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -140,1795 +141,2485 @@ declare namespace ymaps { duration?: number; } - class RouteEditor implements IBehavior { - events: IEventManager; - options: IOptionManager; + class RouteEditor implements IBehavior { + events: IEventManager; + options: IOptionManager; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - getRoute(): router.Route; + getRoute(): router.Route; - getState(): string; + getState(): string; - setState(state: string | null): void; - } + setState(state: string | null): void; + } - class Ruler implements IBehavior { - constructor(options?: IRulerOptions) + class Ruler implements IBehavior { + constructor(options?: IRulerOptions) - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - close(): boolean; + close(): boolean; - getState(): string; + getState(): string; - setState(state: string | null): void; - } + setState(state: string | null): void; + } - interface IRulerOptions { - balloonAutoPan?: boolean; - } + interface IRulerOptions { + balloonAutoPan?: boolean; + } - class ScrollZoom implements IBehavior { - constructor(options?: IScrollZoomOptions) + class ScrollZoom implements IBehavior { + constructor(options?: IScrollZoomOptions) - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; - } + setParent(parent: IControlParent): this; + } - interface IScrollZoomOptions { - maximumDelta?: number; - speed?: number; - } + interface IScrollZoomOptions { + maximumDelta?: number; + speed?: number; + } - const storage: util.Storage; - } + const storage: util.Storage; + } - namespace clusterer { - class Balloon implements IBalloonManager { //tslint:disable-line no-shadowed-variable - constructor(clusterer: Clusterer); + namespace clusterer { + class Balloon implements IBalloonManager { //tslint:disable-line no-shadowed-variable + constructor(clusterer: Clusterer); - events: IEventManager; + events: IEventManager; - autoPan(): Promise; + autoPan(): Promise; - close(force?: boolean): Promise; + close(force?: boolean): Promise; - destroy(): void; + destroy(): void; - getData(): object | null; + getData(): object | null; - getOptions(): IOptionManager | null; + getOptions(): IOptionManager | null; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getPosition(): number[] | null; + getPosition(): number[] | null; - isOpen(): boolean; + isOpen(): boolean; - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - setData(data: object | string | HTMLElement): Promise; + setData(data: object | string | HTMLElement): Promise; - setOptions(options: object): Promise; + setOptions(options: object): Promise; - setPosition(position: number[]): Promise; - } + setPosition(position: number[]): Promise; + } - class Hint implements IHintManager { - constructor(clusterer: Clusterer); + class Hint implements IHintManager { + constructor(clusterer: Clusterer); - events: IEventManager; + events: IEventManager; - close(force?: boolean): Promise; + close(force?: boolean): Promise; - destroy(): void; + destroy(): void; - getData(): object | null; + getData(): object | null; - getOptions(): IOptionManager | null; + getOptions(): IOptionManager | null; - getOverlay(): Promise; + getOverlay(): Promise; - getOverlaySync(): IOverlay | null; + getOverlaySync(): IOverlay | null; - getPosition(): number[] | null; + getPosition(): number[] | null; - isOpen(): boolean; + isOpen(): boolean; - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - setData(data: object | string | HTMLElement): Promise; + setData(data: object | string | HTMLElement): Promise; - setOptions(options: object): Promise; + setOptions(options: object): Promise; - setPosition(position: number[]): Promise; - } - } + setPosition(position: number[]): Promise; + } + } - namespace collection { - class Item implements IChildOnMap, ICustomizable, IEventEmitter, IParentOnMap { - constructor(options?: object); + namespace collection { + class Item implements IChildOnMap, ICustomizable, IEventEmitter, IParentOnMap { + constructor(options?: object); - events: IEventManager; - options: IOptionManager; + events: IEventManager; + options: IOptionManager; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; + setParent(parent: IControlParent): this; - getMap(): Map; + getMap(): Map; - onAddToMap(map: Map): void; + onAddToMap(map: Map): void; - onRemoveFromMap(oldMap: Map): void; - } - } + onRemoveFromMap(oldMap: Map): void; + } + } - namespace control { - class Button implements ICustomizable, ISelectableControl { - constructor(parameters?: IButtonParameters | string); + namespace control { + class Button implements ICustomizable, ISelectableControl { + constructor(parameters?: IButtonParameters | string); - options: IOptionManager; - events: IEventManager; - data: data.Manager; - state: data.Manager; + options: IOptionManager; + events: IEventManager; + data: data.Manager; + state: data.Manager; - deselect(): void; + deselect(): void; - disable(): void; + disable(): void; - enable(): void; + enable(): void; - isEnabled(): boolean; + isEnabled(): boolean; - isSelected(): boolean; + isSelected(): boolean; - select(): void; + select(): void; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; - } + setParent(parent: IControlParent): this; + } - interface IBaseButtonParametersOptions { - adjustMapMargin?: boolean; - float?: "none" | "left" | "right"; - floatIndex?: number; - layout?: IClassConstructor | string; - maxWidth?: number[][] | number[] | number; - position?: { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; - }; - visible?: boolean; - } + interface IBaseButtonParametersOptions { + adjustMapMargin?: boolean; + float?: "none" | "left" | "right"; + floatIndex?: number; + layout?: IClassConstructor | string; + maxWidth?: number[][] | number[] | number; + position?: { + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; + }; + visible?: boolean; + } - interface IButtonParameters { - data?: { - content?: string; - image?: string; - title?: string; - }; - options?: IBaseButtonParametersOptions & { - selectOnClick?: boolean; - size?: "auto" | "small" | "medium" | "large"; - }; - state?: { - enabled?: boolean; - selected?: boolean; - }; - } + interface IButtonParameters { + data?: { + content?: string; + image?: string; + title?: string; + }; + options?: IBaseButtonParametersOptions & { + selectOnClick?: boolean; + size?: "auto" | "small" | "medium" | "large"; + }; + state?: { + enabled?: boolean; + selected?: boolean; + }; + } - class FullscreenControl extends Button { - constructor(parameters?: IFullscreenControlParameters); + class FullscreenControl extends Button { + constructor(parameters?: IFullscreenControlParameters); - enterFullscreen(): void; + enterFullscreen(): void; - exitFullscreen(): void; - } + exitFullscreen(): void; + } - interface IFullscreenControlParameters { - data?: { - title?: string; - }; - options?: IBaseButtonParametersOptions & { - collapseOnBlur?: boolean; - expandOnClick?: boolean; - popupFloat?: "left" | "right"; - }; - state?: { - expanded?: boolean; - }; - } + interface IFullscreenControlParameters { + data?: { + title?: string; + }; + options?: IBaseButtonParametersOptions & { + collapseOnBlur?: boolean; + expandOnClick?: boolean; + popupFloat?: "left" | "right"; + }; + state?: { + expanded?: boolean; + }; + } - class GeolocationControl extends Button { - constructor(parameters?: IGeolocationControlParameters); - } + class GeolocationControl extends Button { + constructor(parameters?: IGeolocationControlParameters); + } - interface IGeolocationControlParameters extends IButtonParameters { - data?: { - image?: string; - title?: string; - }; - options?: IBaseButtonParametersOptions; - } + interface IGeolocationControlParameters extends IButtonParameters { + data?: { + image?: string; + title?: string; + }; + options?: IBaseButtonParametersOptions; + } - class ListBox implements ICollection, IControl, ICustomizable { - constructor(parameters?: IListBoxParameters); + class ListBox implements ICollection, IControl, ICustomizable { + constructor(parameters?: IListBoxParameters); - events: IEventManager; - options: IOptionManager; - data: data.Manager; - state: data.Manager; + events: IEventManager; + options: IOptionManager; + data: data.Manager; + state: data.Manager; - add(object: object): this; + add(object: object): this; - getIterator(): IIterator; + getIterator(): IIterator; - remove(object: object): this; + remove(object: object): this; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; - } + setParent(parent: IControlParent): this; + } - interface IListBoxParameters extends IButtonParameters { - options?: IBaseButtonParametersOptions & { - noPlacemark?: boolean; - }; - } - - class ListBoxItem implements ICustomizable, ISelectableControl { - constructor(parameters?: IListBoxItemParameters); - - options: IOptionManager; - events: IEventManager; - data: data.Manager; - state: data.Manager; - - deselect(): void; - - disable(): void; - - enable(): void; - - isEnabled(): boolean; - - isSelected(): boolean; - - select(): void; - - getParent(): null | IControlParent; - - setParent(parent: IControlParent): this; - - getMap(): Map; - } - - interface IListBoxItemParameters { - data?: { - content?: string; - }; - options?: { - layout?: string | IClassConstructor; - selectableLayout?: string | IClassConstructor; - selectOnClick?: boolean; - separatorLayout?: string | IClassConstructor; - type?: "selectable" | "separator"; - visible?: boolean; - }; - state?: { - selected?: boolean; - }; - } - - class Manager { - constructor(map: Map, controls?: Array, options?: IManagerOptions); - - events: event.Manager; - options: option.Manager; - state: data.Manager; - - add(control: IControl | ControlKey, options?: IManagerControlOptions): this; - - each(callback: (control: IControl) => void, context: object): this; - - get(index: number | string): IControl | null; - - getChildElement(control: IControl): Promise; - - getContainer(): HTMLElement; - - getMap(): Map; - - indexOf(childToFind: IControl | string): number; - - remove(control: IControl | string): this; - } - - interface IManagerOptions { - margin?: number; - pane?: IPane; - states?: string[]; - } + interface IListBoxParameters extends IButtonParameters { + options?: IBaseButtonParametersOptions & { + noPlacemark?: boolean; + }; + } + + class ListBoxItem implements ICustomizable, ISelectableControl { + constructor(parameters?: IListBoxItemParameters); + + options: IOptionManager; + events: IEventManager; + data: data.Manager; + state: data.Manager; + + deselect(): void; + + disable(): void; + + enable(): void; + + isEnabled(): boolean; + + isSelected(): boolean; + + select(): void; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + getMap(): Map; + } + + interface IListBoxItemParameters { + data?: { + content?: string; + }; + options?: { + layout?: string | IClassConstructor; + selectableLayout?: string | IClassConstructor; + selectOnClick?: boolean; + separatorLayout?: string | IClassConstructor; + type?: "selectable" | "separator"; + visible?: boolean; + }; + state?: { + selected?: boolean; + }; + } + + class Manager { + constructor(map: Map, controls?: Array, options?: IManagerOptions); + + events: event.Manager; + options: option.Manager; + state: data.Manager; + + add(control: IControl | ControlKey, options?: IManagerControlOptions): this; + + each(callback: (control: IControl) => void, context: object): this; + + get(index: number | string): IControl | null; + + getChildElement(control: IControl): Promise; + + getContainer(): HTMLElement; + + getMap(): Map; + + indexOf(childToFind: IControl | string): number; + + remove(control: IControl | string): this; + } + + interface IManagerOptions { + margin?: number; + pane?: IPane; + states?: string[]; + } - interface IManagerControlOptions { - float?: "none" | "left" | "right"; - floatIndex?: number; - position?: { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; - }; - } + interface IManagerControlOptions { + float?: "none" | "left" | "right"; + floatIndex?: number; + position?: { + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; + }; + } - class RouteButton implements IControl, ICustomizable { - constructor(parameters?: IRouteButtonParameters); + class RouteButton implements IControl, ICustomizable { + constructor(parameters?: IRouteButtonParameters); - events: IEventManager; - options: IOptionManager; - routePanel: IRoutePanel; + events: IEventManager; + options: IOptionManager; + routePanel: IRoutePanel; - getParent(): null | IControlParent; + getParent(): null | IControlParent; - setParent(parent: IControlParent): this; - } + setParent(parent: IControlParent): this; + } - interface IRouteButtonParameters { - options?: { - adjustMapMargin?: boolean; - collapseOnBlur?: boolean; - float?: "none" | "left" | "right"; - floatIndex?: number; - popupAnimate?: boolean; - popupFloat?: "auto" | "left" | "right"; - popupWidth?: string; - position?: { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; - }; - size?: "auto" | "small" | "medium" | "large"; - visible?: boolean; - }; - state?: { - expanded?: boolean; - }; - } - - class RouteEditor extends Button { - constructor(parameters?: IRouteEditorParameters); - - getRoute(): router.Route; - } - - interface IRouteEditorParameters { - data?: { - image?: string; - title?: string; - }; - options?: IBaseButtonParametersOptions; - state?: {}; - } - - class RulerControl extends Button { - constructor(parameters?: IRulerControlParameters); - } - - interface IRulerControlParameters { - data?: {}; - options?: { - adjustMapMargin?: boolean; - position?: { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; - }; - scaleLine?: boolean; - visible?: boolean; - }; - state?: {}; - } - - class SearchControl implements IControl, ICustomizable { - constructor(parameters?: ISearchControlParameters); - - events: IEventManager; - options: IOptionManager; - state: data.Manager; - - getParent(): null | IControlParent; - - setParent(parent: IControlParent): this; - - clear(): void; - - getMap(): Map; - - getRequestString(): string; - - getResponseMetaData(): object; - - getResult(index: number): Promise; - - getResultsArray(): object[]; - - getResultsCount(): number; + interface IRouteButtonParameters { + options?: { + adjustMapMargin?: boolean; + collapseOnBlur?: boolean; + float?: "none" | "left" | "right"; + floatIndex?: number; + popupAnimate?: boolean; + popupFloat?: "auto" | "left" | "right"; + popupWidth?: string; + position?: { + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; + }; + size?: "auto" | "small" | "medium" | "large"; + visible?: boolean; + }; + state?: { + expanded?: boolean; + }; + } + + class RouteEditor extends Button { + constructor(parameters?: IRouteEditorParameters); + + getRoute(): router.Route; + } + + interface IRouteEditorParameters { + data?: { + image?: string; + title?: string; + }; + options?: IBaseButtonParametersOptions; + state?: {}; + } + + class RulerControl extends Button { + constructor(parameters?: IRulerControlParameters); + } + + interface IRulerControlParameters { + data?: {}; + options?: { + adjustMapMargin?: boolean; + position?: { + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; + }; + scaleLine?: boolean; + visible?: boolean; + }; + state?: {}; + } + + class SearchControl implements IControl, ICustomizable { + constructor(parameters?: ISearchControlParameters); + + events: IEventManager; + options: IOptionManager; + state: data.Manager; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + clear(): void; + + getMap(): Map; + + getRequestString(): string; + + getResponseMetaData(): object; + + getResult(index: number): Promise; + + getResultsArray(): object[]; + + getResultsCount(): number; - getSelectedIndex(): number; + getSelectedIndex(): number; - hideResult(): void; + hideResult(): void; - search(request: string): Promise; + search(request: string): Promise; - showResult(index: number): this; - } + showResult(index: number): this; + } - interface ISearchControlParameters { - data?: {}; - options?: { - adjustMapMargin?: boolean; - boundedBy?: number[][]; - fitMaxWidth?: boolean; - float?: "none" | "left" | "right"; - floatIndex?: number; - formLayout?: string | IClassConstructor; - kind?: "house" | "street" | "metro" | "district" | "locality"; - layout?: string | IClassConstructor; - maxWidth?: number[][] | number[] | number; - noCentering?: boolean; - noPlacemark?: boolean; - noPopup?: boolean; - noSelect?: boolean; - noSuggestPanel?: boolean; - placeholderContent?: string; - popupItemLayout?: string | IClassConstructor; - popupLayout?: string | IClassConstructor; - position?: { - bottom?: number | string; - left?: number | string; - right?: number | string; - top?: number | string; - }; - provider?: IGeocodeProvider | "yandex#map" | "yandex#search"; - searchCoordOrder?: "latlong" | "longlat"; - size?: "auto" | "small" | "medium" | "large"; - strictBounds?: boolean; - suppressYandexSearch?: boolean; - useMapBounds?: boolean; - zoomMargin?: number; - visible?: boolean; - }; - state?: {}; - } - } + interface ISearchControlParameters { + data?: {}; + options?: { + adjustMapMargin?: boolean; + boundedBy?: number[][]; + fitMaxWidth?: boolean; + float?: "none" | "left" | "right"; + floatIndex?: number; + formLayout?: string | IClassConstructor; + kind?: "house" | "street" | "metro" | "district" | "locality"; + layout?: string | IClassConstructor; + maxWidth?: number[][] | number[] | number; + noCentering?: boolean; + noPlacemark?: boolean; + noPopup?: boolean; + noSelect?: boolean; + noSuggestPanel?: boolean; + placeholderContent?: string; + popupItemLayout?: string | IClassConstructor; + popupLayout?: string | IClassConstructor; + position?: { + bottom?: number | string; + left?: number | string; + right?: number | string; + top?: number | string; + }; + provider?: IGeocodeProvider | "yandex#map" | "yandex#search"; + searchCoordOrder?: "latlong" | "longlat"; + size?: "auto" | "small" | "medium" | "large"; + strictBounds?: boolean; + suppressYandexSearch?: boolean; + useMapBounds?: boolean; + zoomMargin?: number; + visible?: boolean; + }; + state?: {}; + } + } - namespace data { - class Manager implements IDataManager, IFreezable { - constructor(data?: object); + namespace data { + class Manager implements IDataManager, IFreezable { + constructor(data?: object); - events: IEventManager; + events: IEventManager; - get(path: string, defaultValue: object): object; + get(path: string, defaultValue: object): object; - getAll(): object; + getAll(): object; - set(path: object | string, value: object): this; + set(path: object | string, value: object): this; - setAll(): this; + setAll(): this; - unset(path: object | string): this; + unset(path: object | string): this; - unsetAll(): this; + unsetAll(): this; - freeze(): IFreezable; + freeze(): IFreezable; - isFrozen(): boolean; + isFrozen(): boolean; - unfreeze(): IFreezable; + unfreeze(): IFreezable; - add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - getParent(): IEventManager | null; + getParent(): IEventManager | null; - group(): IEventGroup; + group(): IEventGroup; - remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - setParent(parent: IEventManager | null): this; + setParent(parent: IEventManager | null): this; - fire(type: string, eventobject: object | IEvent): this; - } - } + fire(type: string, eventobject: object | IEvent): this; + } + } - namespace event { - class Manager implements IEventManager { - constructor(params?: { context?: object; controllers?: IEventWorkflowController[]; parent?: IEventManager }); + namespace event { + class Manager implements IEventManager { + constructor(params?: { context?: object; controllers?: IEventWorkflowController[]; parent?: IEventManager }); - add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - getParent(): IEventManager | null; + getParent(): IEventManager | null; - group(): IEventGroup; + group(): IEventGroup; - remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - setParent(parent: IEventManager | null): this; + setParent(parent: IEventManager | null): this; - fire(type: string, eventobject: object | IEvent): this; + fire(type: string, eventobject: object | IEvent): this; - createEventobject(type: string, event: object, target: object): Event; + createEventobject(type: string, event: object, target: object): Event; - once(types: string[][] | string[] | string, callback: (event: IEvent) => any, context?: object, priority?: number): this; - } - } - - namespace geometry { - namespace base { - class LineString implements IBaseLineStringGeometry { //tslint:disable-line no-shadowed-variable - static fromEncodedCoordinates(encodedCoordinates: string): geometry.LineString; //tslint:disable-line function-name - - static toEncodedCoordinates(geometry: geometry.LineString): string; //tslint:disable-line function-name + once(types: string[][] | string[] | string, callback: (event: IEvent) => any, context?: object, priority?: number): this; + } + } + namespace geometry { + namespace base { + class LineString implements IBaseLineStringGeometry { //tslint:disable-line no-shadowed-variable events: IEventManager; - getBounds(): number[][] | null; + static fromEncodedCoordinates(encodedCoordinates: string): geometry.LineString; //tslint:disable-line function-name - getType(): string; + static toEncodedCoordinates(geometry: geometry.LineString): string; //tslint:disable-line function-name - get(index: number): number[]; + getBounds(): number[][] | null; - getChildGeometry(index: number): IPointGeometryAccess; + getType(): string; - getClosest(anchorPosition: number[]): object; + get(index: number): number[]; - getCoordinates(): number[][]; + getChildGeometry(index: number): IPointGeometryAccess; - getLength(): number; + getClosest(anchorPosition: number[]): object; - insert(index: number, coordinates: number[][]): ILineStringGeometryAccess; + getCoordinates(): number[][]; - remove(index: number): number[]; + getLength(): number; - remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + insert(index: number, coordinates: number[][]): ILineStringGeometryAccess; - set(index: number, coordinates: number[]): ILineStringGeometryAccess; + remove(index: number): number[]; - setCoordinates(coordinates: number[]): ILineStringGeometryAccess; + remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - splice(index: number, length: number): number[][]; + set(index: number, coordinates: number[]): ILineStringGeometryAccess; - freeze(): IFreezable; + setCoordinates(coordinates: number[]): ILineStringGeometryAccess; - isFrozen(): boolean; + splice(index: number, length: number): number[][]; - unfreeze(): IFreezable; + freeze(): IFreezable; - add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + isFrozen(): boolean; - getParent(): object | null; + unfreeze(): IFreezable; - group(): IEventGroup; + add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - setParent(parent: IEventManager | null): this; + getParent(): object | null; - fire(type: string, eventobject: object | IEvent): this; - } + group(): IEventGroup; - class Point implements IBasePointGeometry { //tslint:disable-line no-shadowed-variable - events: IEventManager; + setParent(parent: IEventManager | null): this; - getBounds(): number[][] | null; + fire(type: string, eventobject: object | IEvent): this; + } - getType(): string; + class Point implements IBasePointGeometry { //tslint:disable-line no-shadowed-variable + events: IEventManager; - getCoordinates(): number[] | null; + getBounds(): number[][] | null; - setCoordinates(coordinates: number[] | null): this; - } - } + getType(): string; - class LineString implements ILineStringGeometry { - constructor(coordinates?: number[][], options?: { - coordRendering?: "shortestPath" | "straightPath"; - geodesic?: boolean; - pixelRendering?: "jumpy" | "static"; - projection?: IProjection; - simplification?: boolean; - }); + getCoordinates(): number[] | null; - static fromEncodedCoordinates(encodedCoordinates: string): LineString; //tslint:disable-line function-name + setCoordinates(coordinates: number[] | null): this; + } + } + class LineString implements ILineStringGeometry { + constructor(coordinates?: number[][], options?: { + coordRendering?: "shortestPath" | "straightPath"; + geodesic?: boolean; + pixelRendering?: "jumpy" | "static"; + projection?: IProjection; + simplification?: boolean; + }); + + events: IEventManager; + options: IOptionManager; + + static fromEncodedCoordinates(encodedCoordinates: string): LineString; //tslint:disable-line function-name static toEncodedCoordinates(geometry: LineString): string; //tslint:disable-line function-name - events: IEventManager; - options: IOptionManager; + getMap(): Map | null; - getMap(): Map | null; + getPixelGeometry(options?: object): IPixelGeometry; - getPixelGeometry(options?: object): IPixelGeometry; + setMap(map: Map): void; - setMap(map: Map): void; + getBounds(): number[][] | null; - getBounds(): number[][] | null; + getType(): string; - getType(): string; + get(index: number): number[]; - get(index: number): number[]; + getChildGeometry(index: number): IPointGeometryAccess; - getChildGeometry(index: number): IPointGeometryAccess; + getClosest(anchorPosition: number[]): object; - getClosest(anchorPosition: number[]): object; + getCoordinates(): number[][]; - getCoordinates(): number[][]; + getLength(): number; - getLength(): number; + insert(index: number, coordinates: number[][]): ILineStringGeometryAccess; - insert(index: number, coordinates: number[][]): ILineStringGeometryAccess; + remove(index: number): number[]; - remove(index: number): number[]; + remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + set(index: number, coordinates: number[]): ILineStringGeometryAccess; - set(index: number, coordinates: number[]): ILineStringGeometryAccess; + setCoordinates(coordinates: number[]): ILineStringGeometryAccess; - setCoordinates(coordinates: number[]): ILineStringGeometryAccess; + splice(index: number, length: number): number[][]; - splice(index: number, length: number): number[][]; + freeze(): IFreezable; - freeze(): IFreezable; + isFrozen(): boolean; - isFrozen(): boolean; + unfreeze(): IFreezable; - unfreeze(): IFreezable; + add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; - add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + getParent(): object | null; - getParent(): object | null; + group(): IEventGroup; - group(): IEventGroup; + setParent(parent: IEventManager | null): this; - setParent(parent: IEventManager | null): this; + fire(type: string, eventobject: object | IEvent): this; + } - fire(type: string, eventobject: object | IEvent): this; - } + class Point implements IPointGeometry { + constructor(coordinates?: number[] | null); - class Point implements IPointGeometry { - constructor(coordinates?: number[] | null); + options: IOptionManager; + events: IEventManager; - options: IOptionManager; - events: IEventManager; + getMap(): Map | null; - getMap(): Map | null; + getPixelGeometry(options?: object): IPixelGeometry; - getPixelGeometry(options?: object): IPixelGeometry; + setMap(map: Map): void; - setMap(map: Map): void; + getBounds(): number[][] | null; - getBounds(): number[][] | null; + getType(): string; - getType(): string; - - getCoordinates(): number[] | null; + getCoordinates(): number[] | null; setCoordinates(coordinates: number[] | null): this; } } - namespace geoObject { - class Balloon implements IBalloonManager { //tslint:disable-line no-shadowed-variable - constructor(geoObject: GeoObject); + namespace geometryEditor { + class Circle implements IGeometryEditor { + constructor(geometry: ICircleGeometry, options?: object); events: IEventManager; - - autoPan(): Promise; - - close(force?: boolean): Promise; - - destroy(): void; - - getData(): object | null; - - getOptions(): IOptionManager | null; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getPosition(): number[] | null; - - isOpen(): boolean; - - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - - setData(data: object | string | HTMLElement): Promise; - - setOptions(options: object): Promise; - - setPosition(position: number[]): Promise; - } - - class Hint implements IHintManager { - constructor(geoObject: GeoObject); - - events: IEventManager; - - close(force?: boolean): Promise; - - destroy(): void; - - getData(): object | null; - - getOptions(): IOptionManager | null; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getPosition(): number[] | null; - - isOpen(): boolean; - - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - - setData(data: object | string | HTMLElement): Promise; - - setOptions(options: object): Promise; - - setPosition(position: number[]): Promise; - } - - class Sequence implements IGeoObject, IGeoObjectSequence { - constructor(geoObject: GeoObject); - - geometry: IGeometry | null; - properties: IDataManager; + geometry: IGeometry; + options: IOptionManager; state: IDataManager; + + startDrawing(): vow.Promise; + + startEditing(): void; + + stopDrawing(): vow.Promise; + + stopEditing(): void; + } + + class LineString implements IGeometryEditor { + constructor(geometry: ILineStringGeometry, options?: object); + events: IEventManager; + geometry: IGeometry; options: IOptionManager; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getParent(): null | IControlParent; - - setParent(parent: IControlParent): this; - - getMap(): Map; - - each(callback: (geoObject: IGeoObject) => void, context?: object): void; - - get(index: number): IGeoObject; - - getBounds(): number[][] | null; - - getIterator(): IIterator; - - getLength(): number; - - getPixelBounds(): number[][] | null; - - indexOf(geoObject: IGeoObject): number; - } - } - - namespace layout { - namespace templateBased { - class Base implements ILayout { - constructor(data: object); - - events: IEventManager; - - destroy(): void; - - getData(): object; - - getParentElement(): HTMLElement; - - getShape(): IShape | null; - - isEmpty(): boolean; - - setData(data: object): void; - - setParentElement(parent: HTMLElement | null): this; - - build(): void; - - clear(): void; - - onSublayoutSizeChange(sublayoutInfo: object, nodeSizeByContent: object): void; - - rebuild(): void; - } - } - } - - namespace map { - namespace action { - class Manager implements IEventEmitter { - constructor(map: Map); - - events: IEventManager; - - breakTick(): void; - - execute(action: IMapAction): void; - - getCurrentState(): object; - - getMap(): Map; - - setCorrection(userFunction: () => void): void; - - stop(): void; - } - } - - namespace behavior { // tslint:disable-line no-shadowed-variable - class Manager implements ICustomizable, IEventEmitter, IParentOnMap { - constructor(map: Map, behaviors?: string[][] | string[], options?: object); - - options: IOptionManager; - events: IEventManager; - - getMap(): Map; - - disable(behaviors: string[][] | string[] | string): this; - - enable(behaviors: string[][] | string[] | string): this; - - get(behaviorName: string): IBehavior; - - isEnabled(behaviorName: string): boolean; - } - } - - namespace layer { - class Manager implements ILayer, IMapObjectCollection { - constructor(map: Map, options?: { - trafficImageZIndex?: number; - trafficInfoZIndex?: number; - trafficJamZIndex?: number; - }); - - events: IEventManager; - options: IOptionManager; - - getParent(): null | IControlParent; - - setParent(parent: IControlParent): this; - - add(object: object): this; - - getIterator(): IIterator; - - remove(object: object): this; - - getMap(): Map; - } - } - - namespace margin { - class Accessor { - constructor(screenArea: object); - - getArea(): object; - - remove(): this; - - setArea(screenArea: object): this; - } - - class Manager { - constructor(map: Map); - - addArea(screenArea: object): Accessor; - - destroy(): this; - - getMargin(): number[]; - - getOffset(): number[]; - - setDefaultMargin(margin: number[][] | number[] | number): void; - } - } - - namespace pane { - class Manager { - constructor(map: Map); - - append(key: string, pane: IPane): void; - - destroy(): void; - - get(key: string): IPane | null; - - getLower(): string; - - getUpper(): string; - - insertBefore(key: string, pane: IPane, referenceKey: string): void; - - remove(pane: IPane): void; - } - } - - class Balloon implements IBalloonManager/*, IBalloonSharingManager*/ { //tslint:disable-line no-shadowed-variable - constructor(map: Map); - - events: IEventManager; - - autoPan(): Promise; - - close(force?: boolean): Promise; - - destroy(): void; - - getData(): object | null; - - getOptions(): IOptionManager | null; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getPosition(): number[] | null; - - isOpen(): boolean; - - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - - setData(data: object | string | HTMLElement): Promise; - - setOptions(options: object): Promise; - - setPosition(position: number[]): Promise; - } - - class Container implements IDomEventEmitter { - constructor(parentElement: string | HTMLElement); - - events: IEventManager; - - enterFullscreen(): void; - - exitFullscreen(): void; - - fitToViewport(preservePixelPosition?: boolean): void; - - getElement(): HTMLElement; - - getOffset(): number[]; - - getParentElement(): HTMLElement; - - getSize(): number[]; - - isFullscreen(): boolean; - } - - class Converter { - constructor(map: Map); - - globalToPage(globalPixelPoint: number[]): number[]; - - pageToGlobal(pagePixelPoint: number[]): number[]; - } - - class Copyrights { - constructor(map: Map); - - add(customCopyrights: string | HTMLElement | Array): ICopyrightsAccessor; - - addProvider(provider: ICopyrightsProvider): this; - - get(point?: number[], zoom?: number): Promise>; - - getPromoLink(): string; - - removeProvider(provider: ICopyrightsProvider): this; - } - - class GeoObjects implements IGeoObjectCollection { - constructor(map: Map, options?: object); - - options: IOptionManager; - events: IEventManager; - - add(child: IGeoObject, index?: number): this; - - each(callback: (object: IGeoObject) => void, context: object): void; - - get(index: number): IGeoObject; - - getBounds(): number[][] | null; - - getIterator(): IIterator; - - getLength(): number; - - getPixelBounds(): number[][] | null; - - indexOf(object: IGeoObject): number; - - remove(child: IGeoObject): this; - - removeAll(): this; - - set(index: number, child: IGeoObject): this; - - splice(index: number, length: number): this; - - getMap(): Map; - } - - class Hint implements IHintManager/*, IHintSharingManager*/ { - constructor(map: Map); - - events: IEventManager; - - close(force?: boolean): Promise; - - destroy(): void; - - getData(): object | null; - - getOptions(): IOptionManager | null; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getPosition(): number[] | null; - - isOpen(): boolean; - - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - - setData(data: object | string | HTMLElement): Promise; - - setOptions(options: object): Promise; - - setPosition(position: number[]): Promise; - } - - class ZoomRange implements IEventEmitter { - constructor(map: Map, constraints: number[]); - - events: IEventManager; - - get(coords?: number[]): Promise; - - getCurrent(): number[]; - } - } - - namespace multiRouter { - namespace driving { - class Path implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - model: PathModel; - events: IEventManager; - options: IOptionManager; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getParent(): object | null; - - setParent(parent: object): this; - - getMap(): Map; - - getSegments(): GeoObjectCollection; - } - - class PathModel implements IEventEmitter { - events: IEventManager; - properties: data.Manager; - route: RouteModel; - - destroy(): void; - - getSegments(): SegmentModel[]; - - getType(): string; - - update(pathJson: object): void; - } - - class Route implements IGeoObject { - geometry: IGeometry | null; - properties: IDataManager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getParent(): object | null; - - setParent(parent: object): this; - - getMap(): Map; - - getPaths(): GeoObjectCollection; - } - - class RouteModel implements IEventEmitter { - events: IEventManager; - multiRoute: MultiRouteModel; - properties: data.Manager; - - destroy(): void; - - getPaths(): PathModel[]; - - update(routeJson: object): void; - - getType(): string; - } - - class Segment implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getParent(): object | null; - - setParent(parent: object): this; - - getMap(): Map; - } - - class SegmentModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.LineString; - path: PathModel; - - destroy(): void; - - getType(): string; - - getViaPoints(): ViaPointModel[]; - - update(segmentJson: object): void; - } - } - - namespace masstransit { - class Path implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - model: PathModel; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getParent(): object | null; - - setParent(parent: object): this; - - getMap(): Map; - - getSegmentMarkers(): GeoObjectCollection; - - getSegments(): GeoObjectCollection; - } - - class PathModel implements IEventEmitter { - events: IEventManager; - properties: data.Manager; - route: RouteModel; - - destroy(): void; - - getSegments(): Array; - - getType(): string; - - update(pathJson: object): void; - } - - class Route implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - model: RouteModel; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getParent(): object | null; - - setParent(parent: object): this; - - getMap(): Map; - - getPaths(): GeoObjectCollection; - } - - class RouteModel implements IEventEmitter { - events: IEventManager; - multiRoute: MultiRouteModel; - properties: data.Manager; - - destroy(): void; - - getPaths(): PathModel[]; - - getType(): string; - - update(routeJson: object): void; - } - - class StopModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.Point; - properties: data.Manager; - segment: TransportSegmentModel; - - update(stopJson: object): void; - } - - class TransferSegment implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - model: TransferSegmentModel; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getParent(): object | null; - - setParent(parent: object): this; - - getMap(): Map; - } - - class TransferSegmentModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.LineString; - path: PathModel; - properties: data.Manager; - - destroy(segmentJson: object): void; - - getType(): string; - } - - class TransportSegment implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - model: TransportSegmentModel; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getParent(): object | null; - - setParent(parent: object): this; - - getMap(): Map; - } - - class TransportSegmentModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.LineString; - path: PathModel; - properties: data.Manager; - - destroy(): void; - - getStops(): StopModel[]; - - getType(): string; - - update(segmentJson: object): void; - } - - class WalkSegment implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - model: WalkSegmentModel; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getParent(): object | null; - - setParent(parent: object): this; - - getMap(): Map; - } - - class WalkSegmentModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.LineString; - path: PathModel; - properties: data.Manager; - - destroy(): void; - - getType(): string; - } - } - - class EditorAddon implements ICustomizable, IEventEmitter { - options: IOptionManager; - events: IEventManager; - state: data.Manager; - - isActive(): boolean; - - start(state: object): void; - - stop(): void; - } - - class MultiRoute implements IGeoObject { - constructor(model: MultiRouteModel | IMultiRouteModelJson, options?: { - activeRouteAutoSelection?: boolean; - boundsAutoApply?: boolean; - dragUpdateInterval?: string | number; - preventDragUpdate?: boolean; - useMapMargin?: boolean; - zoomMargin?: number[][] | number[] | number; - [index: string]: any; - }); - - editor: EditorAddon; - model: MultiRouteModel; - geometry: IGeometry | null; - properties: IDataManager; state: IDataManager; + + getModel(): vow.Promise; + + getModelSync(): model.RootLineString | null; + + getView(): vow.Promise; + + getViewSync(): view.Path | null; + + startDrawing(): vow.Promise; + + startEditing(): vow.Promise; + + startFraming(): vow.Promise; + + stopDrawing(): void; + + stopEditing(): void; + + stopFraming(): void; + } + + namespace model { + class ChildLinearRing extends ChildLineString {} + + class ChildLineString implements IGeometryEditorChildModel { + editor: IGeometryEditor; + events: IEventManager; + geometry: IBaseGeometry; + + destroy(): void; + + getAllVerticesNumber(): number; + + getEdgeModels(): Edge[]; + + getIndex(): number; + + getParent(): IGeometryEditorModel; + + getPixels(): number[]; + + getVertexModels(): ChildVertex[]; + + setIndex(index: number): void; + + setPixels(pixels: number[]): void; + + spliceVertices(start: number, deleteCount: number): number[][]; + } + + class ChildVertex implements IGeometryEditorChildModel { + editor: IGeometryEditor; + events: IEventManager; + geometry: IBaseGeometry; + + destroy(): void; + + getAllVerticesNumber(): number; + + getIndex(): number; + + getNextVertex(): ChildVertex | null; + + getParent(): IGeometryEditorModel; + + getPixels(): number[]; + + getPrevVertex(): ChildVertex | null; + + setGlobalPixels(pixels: number[]): void; + + setIndex(index: number): void; + + setNextVertex(nextVertex: ChildVertex): void; + + setPixels(pixels: number[]): void; + + setPrevVertex(prevVertex: ChildVertex): void; + } + + class Edge implements IGeometryEditorRootModel { + events: IEventManager; + + destroy(): void; + + getNextVertex(): ChildVertex | null; + + getPixels(): number[]; + + getPrevVertex(): ChildVertex | null; + + setNextVertex(nextVertex: ChildVertex): void; + + setPrevVertex(prevVertex: ChildVertex): void; + } + + class EdgeGeometry implements IGeometry { + events: IEventManager; + options: IOptionManager; + + getBounds(): number[][] | null; + + getMap(): Map | null; + + getPixelGeometry(options?: object): IPixelGeometry; + + getType(): string; + + setMap(map: Map): void; + } + + class RootLineString implements IGeometryEditorRootModel { + events: IEventManager; + + destroy(): void; + + getAllVerticesNumber(): number; + + getPixels(): number[]; + + getVertexModels(): ChildVertex[]; + + spliceVertices(start: number, deleteCount: number): number[][]; + } + + class RootPolygon implements IGeometryEditorRootModel { + events: IEventManager; + + destroy(): void; + + getAllVerticesNumber(): number; + + getPathModels(): ChildLinearRing[]; + + getPixels(): number[]; + + splicePaths(start: number, deleteCount: number): number[][]; + } + } + + class Point implements IGeometryEditor { events: IEventManager; + geometry: IGeometry; options: IOptionManager; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getParent(): object | null; - - setParent(parent: object): this; - - getMap(): Map; - - getActiveRoute(): driving.Route | masstransit.Route | null; - - getBounds(): number[][] | null; - - getPixelBounds(): number[][] | null; - - getRoutes(): GeoObjectCollection; - - getViaPoints(): GeoObjectCollection; - - getWayPoints(): GeoObjectCollection; - - setActiveRoute(route: driving.Route | masstransit.Route | null): void; - } - - class MultiRouteModel implements IEventEmitter { - constructor(referencePoints: IMultiRouteReferencePoint[], params?: IMultiRouteParams); - - events: IEventManager; - properties: data.Manager; - - destroy(): void; - - getAllPoints(): Array; - - getJson(): object; - - getParams(): IMultiRouteParams; - - getPoints(): Array; - - getReferencePointIndexes(): object; - - getReferencePoints(): IMultiRouteReferencePoint[]; - - getRoutes(): driving.RouteModel[] | masstransit.RouteModel[]; - - getViaPoints(): ViaPointModel[]; - - getWayPoints(): WayPointModel[]; - - setParams(params: IMultiRouteParams, extend?: boolean, clearRequests?: boolean): void; - - setReferencePoints(referencePoints: IMultiRouteReferencePoint[], viaIndexes?: number[], clearRequests?: boolean): void; - } - - class ViaPoint implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; state: IDataManager; + + startDrawing(): vow.Promise; + + startEditing(): void; + + stopDrawing(): vow.Promise; + + stopEditing(): void; + } + + class Polygon implements IGeometryEditor { + constructor(geometry: IPolygonGeometry, options: object) + events: IEventManager; + geometry: IGeometry; options: IOptionManager; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getParent(): object | null; - - setParent(parent: object): this; - - getMap(): Map; - } - - class ViaPointModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.Point; - multiRoute: MultiRouteModel; - properties: data.Manager; - - destroy(): void; - - getReferencePoint(): object; - - getReferencePointIndex(): number; - - setReferencePoint(referencePoint: object): void; - - update(viaPointJson: object): void; - } - - class WayPoint implements IGeoObject { - geometry: IGeometry | null; - properties: data.Manager; state: IDataManager; - events: IEventManager; - options: IOptionManager; - model: WayPointModel; - getOverlay(): Promise; + getModel(): vow.Promise; - getOverlaySync(): IOverlay | null; + getModelSync(): model.RootPolygon | null; - getParent(): object | null; + getView(): vow.Promise; - setParent(parent: object): this; + getViewSync(): view.MultiPath | null; - getMap(): Map; + startDrawing(): vow.Promise; + + startEditing(): vow.Promise; + + startFraming(): vow.Promise; + + stopDrawing(): void; + + stopEditing(): void; + + stopFraming(): void; } - class WayPointModel implements IEventEmitter { - events: IEventManager; - geometry: geometry.base.Point; - multiRoute: MultiRouteModel; - properties: data.Manager; + namespace view { + class Edge { + getPlacemark(): GeoObject; + } - destroy(): void; + class MultiPath { + getEdgePlacemarks(): GeoObjectCollection; - getReferencePoint(): object; + getPathViews(): Path[]; - getReferencePointIndex(): number; + getVertexPlacemarks(): GeoObjectCollection; + } - setReferencePoint(referencePoint: object): void; + class Path { + getEdgePlacemarks(): GeoObjectCollection; - update(wayPointJson: object): void; + getEdgeViews(): Edge[]; + + getVertexPlacemarks(): GeoObjectCollection; + + getVertexViews(): Vertex[]; + } + + class Vertex { + getPlacemark(): GeoObject; + } } } - namespace option { - class Manager implements IOptionManager { - constructor(options?: object, parent?: IOptionManager, name?: string); + namespace geoObject { + class Balloon implements IBalloonManager { //tslint:disable-line no-shadowed-variable + constructor(geoObject: GeoObject); - events: IEventManager; + events: IEventManager; - get(key: string, defaultValue: object): object; + autoPan(): Promise; - getAll(): object; + close(force?: boolean): Promise; - getName(): string; + destroy(): void; - getNative(key: string): object; + getData(): object | null; - resolve(key: string, name?: string): object; + getOptions(): IOptionManager | null; - set(key: object | string, value?: object): this; + getOverlay(): Promise; - unset(keys: string[][] | string[] | string): this; + getOverlaySync(): IOverlay | null; - unsetAll(): this; + getPosition(): number[] | null; - setName(name: string): void; + isOpen(): boolean; - getParent(): null | IOptionManager; + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - setParent(parent: IOptionManager): this; + setData(data: object | string | HTMLElement): Promise; - freeze(): IFreezable; + setOptions(options: object): Promise; - isFrozen(): boolean; + setPosition(position: number[]): Promise; + } - unfreeze(): IFreezable; + class Hint implements IHintManager { + constructor(geoObject: GeoObject); - add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + events: IEventManager; - group(): IEventGroup; + close(force?: boolean): Promise; - remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + destroy(): void; - fire(type: string, eventobject: object | IEvent): this; - } - } + getData(): object | null; - namespace panorama { - class Manager implements IEventEmitter { - events: IEventManager; + getOptions(): IOptionManager | null; - closePlayer(): void; + getOverlay(): Promise; - disableLookup(): void; + getOverlaySync(): IOverlay | null; - enableLookup(): void; + getPosition(): number[] | null; - getPlayer(): Player; + isOpen(): boolean; - isLookupEnabled(): boolean; + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - openPlayer(panorama: IPanorama[] | number): Promise; - } + setData(data: object | string | HTMLElement): Promise; - class Player implements IEventEmitter { - constructor(element: HTMLElement | string, panorama: IPanorama, options?: { - autoFitToViewport?: "none" | "ifNull" | "always"; - controls?: string[]; - direction?: number[] | string; - hotkeysEnabled?: boolean; - scrollZoomBehavior?: boolean; - span?: number[] | string; - suppressMapOpenBlock?: boolean; - }) + setOptions(options: object): Promise; - events: IEventManager; + setPosition(position: number[]): Promise; + } - destroy(): void; + class Sequence implements IGeoObject, IGeoObjectSequence { + constructor(geoObject: GeoObject); - fitToViewport(): void; + geometry: IGeometry | null; + properties: IDataManager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; - getDirection(): number[]; + getOverlay(): Promise; - getPanorama(): IPanorama; + getOverlaySync(): IOverlay | null; - getSpan(): number[]; + getParent(): null | IControlParent; - lookAt(point: number[]): this; + setParent(parent: IControlParent): this; - moveTo(point: number[], options?: { - direction?: number[] | string; - layer?: "yandex#panorama" | "yandex#airPanorama"; - span?: number[] | string; - }): Promise; + getMap(): Map; - setDirection(direction: number[] | string): this; + each(callback: (geoObject: IGeoObject) => void, context?: object): void; - setPanorama(panorama: IPanorama): this; + get(index: number): IGeoObject; - setSpan(span: number[] | string): this; - } - } + getBounds(): number[][] | null; - namespace router { - class Editor implements ICustomizable, IEventEmitter { - options: IOptionManager; - events: IEventManager; + getIterator(): IIterator; - start(options?: { - addViaPoints?: boolean; - addWayPoints?: boolean; - editViaPoints?: boolean; - editWayPoints?: boolean; - removeViaPoints?: boolean; - removeWayPoints?: boolean; - }): void; + getLength(): number; - stop(): void; - } + getPixelBounds(): number[][] | null; - abstract class Route implements IGeoObject { - geometry: IGeometry | null; - properties: IDataManager; - state: IDataManager; - events: IEventManager; - options: IOptionManager; - editor: Editor; + indexOf(geoObject: IGeoObject): number; + } + } - getOverlay(): Promise; + namespace layout { + namespace templateBased { + class Base implements ILayout { + constructor(data: object); - getOverlaySync(): IOverlay | null; + events: IEventManager; - getParent(): null | IControlParent; + destroy(): void; - setParent(parent: IControlParent): this; + getData(): object; - getMap(): Map; + getParentElement(): HTMLElement; - getHumanJamsTime(): string; + getShape(): IShape | null; - getHumanLength(): string; + isEmpty(): boolean; - getHumanTime(): string; + setData(data: object): void; - getJamsTime(): number; + setParentElement(parent: HTMLElement | null): this; - getLength(): number; + build(): void; - getPaths(): GeoObjectCollection; + clear(): void; - getTime(): number; + onSublayoutSizeChange(sublayoutInfo: object, nodeSizeByContent: object): void; - getViaPoints(): GeoObjectCollection; + rebuild(): void; + } + } + } - getWayPoints(): GeoObjectCollection; - } - } + namespace map { + namespace action { + class Manager implements IEventEmitter { + constructor(map: Map); - class Balloon extends Popup implements IBaloon { - constructor(map: Map, options?: IBalloonOptions); + events: IEventManager; - getData(): object; + breakTick(): void; - close(force?: boolean): Promise; + execute(action: IMapAction): void; - getParent(): Balloon | null; + getCurrentState(): object; - setParent(parent: Balloon): this; + getMap(): Map; - autoPan(): Promise; + setCorrection(userFunction: () => void): void; - freeze(): IFreezable; + stop(): void; + } + } - isFrozen(): boolean; + namespace behavior { //tslint:disable-line no-shadowed-variable + class Manager implements ICustomizable, IEventEmitter, IParentOnMap { + constructor(map: Map, behaviors?: string[][] | string[], options?: object); - unfreeze(): IFreezable; + options: IOptionManager; + events: IEventManager; - add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + getMap(): Map; - group(): IEventGroup; + disable(behaviors: string[][] | string[] | string): this; - remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + enable(behaviors: string[][] | string[] | string): this; - fire(type: string, eventobject: object | IEvent): this; - } + get(behaviorName: string): IBehavior; - interface IBalloonOptions { - autoPan?: boolean; - autoPanCheckZoomRange?: boolean; - autoPanDuration?: number; - autoPanMargin?: number[][] | number[] | number; - autoPanUseMapMargin?: boolean; - closeButton?: boolean; - contentLayout?: IClassConstructor | string; - layout?: IClassConstructor | string; - maxHeight?: number; - maxWidth?: number; - minHeight?: number; - minWidth?: number; - offset?: number[]; + isEnabled(behaviorName: string): boolean; + } + } + + namespace layer { + class Manager implements ILayer, IMapObjectCollection { + constructor(map: Map, options?: { + trafficImageZIndex?: number; + trafficInfoZIndex?: number; + trafficJamZIndex?: number; + }); + + events: IEventManager; + options: IOptionManager; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + add(object: object): this; + + getIterator(): IIterator; + + remove(object: object): this; + + getMap(): Map; + } + } + + namespace margin { + class Accessor { + constructor(screenArea: object); + + getArea(): object; + + remove(): this; + + setArea(screenArea: object): this; + } + + class Manager { + constructor(map: Map); + + addArea(screenArea: object): Accessor; + + destroy(): this; + + getMargin(): number[]; + + getOffset(): number[]; + + setDefaultMargin(margin: number[][] | number[] | number): void; + } + } + + namespace pane { + class Manager { + constructor(map: Map); + + append(key: string, pane: IPane): void; + + destroy(): void; + + get(key: string): IPane | null; + + getLower(): string; + + getUpper(): string; + + insertBefore(key: string, pane: IPane, referenceKey: string): void; + + remove(pane: IPane): void; + } + } + + class Balloon implements IBalloonManager/*, IBalloonSharingManager*/ { //tslint:disable-line no-shadowed-variable + constructor(map: Map); + + events: IEventManager; + + autoPan(): Promise; + + close(force?: boolean): Promise; + + destroy(): void; + + getData(): object | null; + + getOptions(): IOptionManager | null; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getPosition(): number[] | null; + + isOpen(): boolean; + + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; + + setData(data: object | string | HTMLElement): Promise; + + setOptions(options: object): Promise; + + setPosition(position: number[]): Promise; + } + + class Container implements IDomEventEmitter { + constructor(parentElement: string | HTMLElement); + + events: IEventManager; + + enterFullscreen(): void; + + exitFullscreen(): void; + + fitToViewport(preservePixelPosition?: boolean): void; + + getElement(): HTMLElement; + + getOffset(): number[]; + + getParentElement(): HTMLElement; + + getSize(): number[]; + + isFullscreen(): boolean; + } + + class Converter { + constructor(map: Map); + + globalToPage(globalPixelPoint: number[]): number[]; + + pageToGlobal(pagePixelPoint: number[]): number[]; + } + + class Copyrights { + constructor(map: Map); + + add(customCopyrights: string | HTMLElement | Array): ICopyrightsAccessor; + + addProvider(provider: ICopyrightsProvider): this; + + get(point?: number[], zoom?: number): Promise>; + + getPromoLink(): string; + + removeProvider(provider: ICopyrightsProvider): this; + } + + class GeoObjects implements IGeoObjectCollection { + constructor(map: Map, options?: object); + + options: IOptionManager; + events: IEventManager; + + add(child: IGeoObject, index?: number): this; + + each(callback: (object: IGeoObject) => void, context: object): void; + + get(index: number): IGeoObject; + + getBounds(): number[][] | null; + + getIterator(): IIterator; + + getLength(): number; + + getPixelBounds(): number[][] | null; + + indexOf(object: IGeoObject): number; + + remove(child: IGeoObject): this; + + removeAll(): this; + + set(index: number, child: IGeoObject): this; + + splice(index: number, length: number): this; + + getMap(): Map; + } + + class Hint implements IHintManager/*, IHintSharingManager*/ { + constructor(map: Map); + + events: IEventManager; + + close(force?: boolean): Promise; + + destroy(): void; + + getData(): object | null; + + getOptions(): IOptionManager | null; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getPosition(): number[] | null; + + isOpen(): boolean; + + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; + + setData(data: object | string | HTMLElement): Promise; + + setOptions(options: object): Promise; + + setPosition(position: number[]): Promise; + } + + class ZoomRange implements IEventEmitter { + constructor(map: Map, constraints: number[]); + + events: IEventManager; + + get(coords?: number[]): Promise; + + getCurrent(): number[]; + } + } + + namespace multiRouter { + namespace driving { + class Path implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + model: PathModel; + events: IEventManager; + options: IOptionManager; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): object | null; + + setParent(parent: object): this; + + getMap(): Map; + + getSegments(): GeoObjectCollection; + } + + class PathModel implements IEventEmitter { + events: IEventManager; + properties: data.Manager; + route: RouteModel; + + destroy(): void; + + getSegments(): SegmentModel[]; + + getType(): string; + + update(pathJson: object): void; + } + + class Route implements IGeoObject { + geometry: IGeometry | null; + properties: IDataManager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): object | null; + + setParent(parent: object): this; + + getMap(): Map; + + getPaths(): GeoObjectCollection; + } + + class RouteModel implements IEventEmitter { + events: IEventManager; + multiRoute: MultiRouteModel; + properties: data.Manager; + + destroy(): void; + + getPaths(): PathModel[]; + + update(routeJson: object): void; + + getType(): string; + } + + class Segment implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): object | null; + + setParent(parent: object): this; + + getMap(): Map; + } + + class SegmentModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.LineString; + path: PathModel; + + destroy(): void; + + getType(): string; + + getViaPoints(): ViaPointModel[]; + + update(segmentJson: object): void; + } + } + + namespace masstransit { + class Path implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + model: PathModel; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): object | null; + + setParent(parent: object): this; + + getMap(): Map; + + getSegmentMarkers(): GeoObjectCollection; + + getSegments(): GeoObjectCollection; + } + + class PathModel implements IEventEmitter { + events: IEventManager; + properties: data.Manager; + route: RouteModel; + + destroy(): void; + + getSegments(): Array; + + getType(): string; + + update(pathJson: object): void; + } + + class Route implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + model: RouteModel; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): object | null; + + setParent(parent: object): this; + + getMap(): Map; + + getPaths(): GeoObjectCollection; + } + + class RouteModel implements IEventEmitter { + events: IEventManager; + multiRoute: MultiRouteModel; + properties: data.Manager; + + destroy(): void; + + getPaths(): PathModel[]; + + getType(): string; + + update(routeJson: object): void; + } + + class StopModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.Point; + properties: data.Manager; + segment: TransportSegmentModel; + + update(stopJson: object): void; + } + + class TransferSegment implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + model: TransferSegmentModel; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): object | null; + + setParent(parent: object): this; + + getMap(): Map; + } + + class TransferSegmentModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.LineString; + path: PathModel; + properties: data.Manager; + + destroy(segmentJson: object): void; + + getType(): string; + } + + class TransportSegment implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + model: TransportSegmentModel; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): object | null; + + setParent(parent: object): this; + + getMap(): Map; + } + + class TransportSegmentModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.LineString; + path: PathModel; + properties: data.Manager; + + destroy(): void; + + getStops(): StopModel[]; + + getType(): string; + + update(segmentJson: object): void; + } + + class WalkSegment implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + model: WalkSegmentModel; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): object | null; + + setParent(parent: object): this; + + getMap(): Map; + } + + class WalkSegmentModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.LineString; + path: PathModel; + properties: data.Manager; + + destroy(): void; + + getType(): string; + } + } + + class EditorAddon implements ICustomizable, IEventEmitter { + options: IOptionManager; + events: IEventManager; + state: data.Manager; + + isActive(): boolean; + + start(state: object): void; + + stop(): void; + } + + class MultiRoute implements IGeoObject { + constructor(model: MultiRouteModel | IMultiRouteModelJson, options?: { + activeRouteAutoSelection?: boolean; + boundsAutoApply?: boolean; + dragUpdateInterval?: string | number; + preventDragUpdate?: boolean; + useMapMargin?: boolean; + zoomMargin?: number[][] | number[] | number; + [index: string]: any; + }); + + editor: EditorAddon; + model: MultiRouteModel; + geometry: IGeometry | null; + properties: IDataManager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): object | null; + + setParent(parent: object): this; + + getMap(): Map; + + getActiveRoute(): driving.Route | masstransit.Route | null; + + getBounds(): number[][] | null; + + getPixelBounds(): number[][] | null; + + getRoutes(): GeoObjectCollection; + + getViaPoints(): GeoObjectCollection; + + getWayPoints(): GeoObjectCollection; + + setActiveRoute(route: driving.Route | masstransit.Route | null): void; + } + + class MultiRouteModel implements IEventEmitter { + constructor(referencePoints: IMultiRouteReferencePoint[], params?: IMultiRouteParams); + + events: IEventManager; + properties: data.Manager; + + destroy(): void; + + getAllPoints(): Array; + + getJson(): object; + + getParams(): IMultiRouteParams; + + getPoints(): Array; + + getReferencePointIndexes(): object; + + getReferencePoints(): IMultiRouteReferencePoint[]; + + getRoutes(): driving.RouteModel[] | masstransit.RouteModel[]; + + getViaPoints(): ViaPointModel[]; + + getWayPoints(): WayPointModel[]; + + setParams(params: IMultiRouteParams, extend?: boolean, clearRequests?: boolean): void; + + setReferencePoints(referencePoints: IMultiRouteReferencePoint[], viaIndexes?: number[], clearRequests?: boolean): void; + } + + class ViaPoint implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): object | null; + + setParent(parent: object): this; + + getMap(): Map; + } + + class ViaPointModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.Point; + multiRoute: MultiRouteModel; + properties: data.Manager; + + destroy(): void; + + getReferencePoint(): object; + + getReferencePointIndex(): number; + + setReferencePoint(referencePoint: object): void; + + update(viaPointJson: object): void; + } + + class WayPoint implements IGeoObject { + geometry: IGeometry | null; + properties: data.Manager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + model: WayPointModel; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): object | null; + + setParent(parent: object): this; + + getMap(): Map; + } + + class WayPointModel implements IEventEmitter { + events: IEventManager; + geometry: geometry.base.Point; + multiRoute: MultiRouteModel; + properties: data.Manager; + + destroy(): void; + + getReferencePoint(): object; + + getReferencePointIndex(): number; + + setReferencePoint(referencePoint: object): void; + + update(wayPointJson: object): void; + } + } + + namespace option { + class Manager implements IOptionManager { + constructor(options?: object, parent?: IOptionManager, name?: string); + + events: IEventManager; + + get(key: string, defaultValue: object): object; + + getAll(): object; + + getName(): string; + + getNative(key: string): object; + + resolve(key: string, name?: string): object; + + set(key: object | string, value?: object): this; + + unset(keys: string[][] | string[] | string): this; + + unsetAll(): this; + + setName(name: string): void; + + getParent(): null | IOptionManager; + + setParent(parent: IOptionManager): this; + + freeze(): IFreezable; + + isFrozen(): boolean; + + unfreeze(): IFreezable; + + add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + + group(): IEventGroup; + + remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + + fire(type: string, eventobject: object | IEvent): this; + } + } + + namespace panorama { + class Manager implements IEventEmitter { + events: IEventManager; + + closePlayer(): void; + + disableLookup(): void; + + enableLookup(): void; + + getPlayer(): Player; + + isLookupEnabled(): boolean; + + openPlayer(panorama: IPanorama[] | number): Promise; + } + + class Player implements IEventEmitter { + constructor(element: HTMLElement | string, panorama: IPanorama, options?: { + autoFitToViewport?: "none" | "ifNull" | "always"; + controls?: string[]; + direction?: number[] | string; + hotkeysEnabled?: boolean; + scrollZoomBehavior?: boolean; + span?: number[] | string; + suppressMapOpenBlock?: boolean; + }) + + events: IEventManager; + + destroy(): void; + + fitToViewport(): void; + + getDirection(): number[]; + + getPanorama(): IPanorama; + + getSpan(): number[]; + + lookAt(point: number[]): this; + + moveTo(point: number[], options?: { + direction?: number[] | string; + layer?: "yandex#panorama" | "yandex#airPanorama"; + span?: number[] | string; + }): Promise; + + setDirection(direction: number[] | string): this; + + setPanorama(panorama: IPanorama): this; + + setSpan(span: number[] | string): this; + } + } + + namespace router { + class Editor implements ICustomizable, IEventEmitter { + options: IOptionManager; + events: IEventManager; + + start(options?: { + addViaPoints?: boolean; + addWayPoints?: boolean; + editViaPoints?: boolean; + editWayPoints?: boolean; + removeViaPoints?: boolean; + removeWayPoints?: boolean; + }): void; + + stop(): void; + } + + abstract class Route implements IGeoObject { + geometry: IGeometry | null; + properties: IDataManager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + editor: Editor; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + getMap(): Map; + + getHumanJamsTime(): string; + + getHumanLength(): string; + + getHumanTime(): string; + + getJamsTime(): number; + + getLength(): number; + + getPaths(): GeoObjectCollection; + + getTime(): number; + + getViaPoints(): GeoObjectCollection; + + getWayPoints(): GeoObjectCollection; + } + } + + class Balloon extends Popup implements IBaloon { + constructor(map: Map, options?: IBalloonOptions); + + getData(): object; + + close(force?: boolean): Promise; + + getParent(): Balloon | null; + + setParent(parent: Balloon): this; + + autoPan(): Promise; + + freeze(): IFreezable; + + isFrozen(): boolean; + + unfreeze(): IFreezable; + + add(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + + group(): IEventGroup; + + remove(types: string[][] | string[] | string, callback: (event: (object | IEvent)) => void, context?: object, priority?: number): this; + + fire(type: string, eventobject: object | IEvent): this; + } + + interface IBalloonOptions { + autoPan?: boolean; + autoPanCheckZoomRange?: boolean; + autoPanDuration?: number; + autoPanMargin?: number[][] | number[] | number; + autoPanUseMapMargin?: boolean; + closeButton?: boolean; + contentLayout?: IClassConstructor | string; + layout?: IClassConstructor | string; + maxHeight?: number; + maxWidth?: number; + minHeight?: number; + minWidth?: number; + offset?: number[]; + pane?: string; + panelContentLayout?: IClassConstructor | string; + panelMaxHeightRatio?: number; + panelMaxMapArea?: number; + shadow?: boolean; + shadowLayout?: IClassConstructor | string; + shadowOffset?: number[]; + } + + class Circle implements GeoObject { + constructor(geometry: ICircleGeometry[][][][] | number[][] | object, properties?: object | IDataManager, options?: ICircleOptions) + + balloon: geoObject.Balloon; + editor: IGeometryEditor; + hint: geoObject.Hint; + events: event.Manager; + options: option.Manager; + properties: data.Manager; + state: data.Manager; + + geometry: IGeometry | null; + indices: ArrayBuffer; + vertices: ArrayBuffer; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + getMap(): Map; + } + + interface ICircleOptions { + circleOverlay?: string | ((geometry: IPixelCircleGeometry, data: object, options: object) => Promise); + cursor?: string; + draggable?: boolean; + fill?: boolean; + fillColor?: string; + fillImageHref?: string; + fillMethod?: "stretch" | "tile"; + fillOpacity?: number; + hasBalloon?: boolean; + hasHint?: boolean; + hideIconOnBalloonOpen?: boolean; + interactiveZIndex?: boolean; + interactivityModel?: InteractivityModelKey; + opacity?: number; + openBalloonOnClick?: boolean; + openEmptyBalloon?: boolean; + openEmptyHint?: boolean; + openHintOnHover?: boolean; + outline?: boolean; + pane?: string; + strokeColor?: string[][] | string[] | string; + strokeOpacity?: number[][] | number[] | number; + strokeStyle?: string[][][] | object[][] | string[] | object[] | string | object; + strokeWidth?: number[][] | number[] | number; + syncOverlayInit?: boolean; + useMapMarginInDragging?: boolean; + visible?: boolean; + zIndex?: number; + zIndexActive?: number; + zIndexDrag?: number; + zIndexHover?: number; + } + + class Clusterer implements IChildOnMap, ICustomizable, IEventEmitter, IParentOnMap { + constructor(options?: IClustererOptions); + + events: IEventManager; + options: IOptionManager; + balloon: clusterer.Balloon; + // balloonopen: + hint: clusterer.Hint; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + // balloonclose: + + getMap(): Map; + } + + interface IClustererOptions { + gridSize?: number; + groupByCoordinates?: boolean; + hasBalloon?: boolean; + hasHint?: boolean; + margin?: number[][] | number[] | number; + maxZoom?: number[] | number; + minClusterSize?: number; + preset?: PresetKey; + showInAlphabeticalOrder?: boolean; + useMapMargin?: boolean; + viewportMargin?: number[][] | number[] | number; + zoomMargin?: number[][] | number[] | number; + } + + class ClusterPlacemark implements IGeoObject, collection.Item { + constructor(geometry: number[] | object | IPointGeometry, properties: IClusterPlacemarkProperties, options?: IClusterPlacemarkOptions); + + geometry: IGeometry | null; + properties: IDataManager; + events: IEventManager; + options: IOptionManager; + state: data.Manager; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + getMap(): Map; + + onAddToMap(map: Map): void; + + onRemoveFromMap(oldMap: Map): void; + + getBounds(): number[][] | null; + + getGeoObjects(): IGeoObject[]; + } + + interface IClusterPlacemarkProperties extends IDataManager { + geoObjects: IGeoObject[]; + } + + interface IClusterPlacemarkOptions { + balloonContentLayout?: "cluster#balloonTwoColumns" | "cluster#balloonCarousel" | "cluster#balloonAccordion" | string | IClassConstructor; + balloonContentLayoutHeight?: number; + balloonContentLayoutWidth?: number; + balloonItemContentLayout?: ILayout | string; + balloonPanelContentLayout?: string | IClassConstructor; + cursor?: string; + disableClickZoom?: boolean; + hideIconOnBalloonOpen?: boolean; + iconColor?: string; + iconContentLayout?: string | IClassConstructor; + iconLayout?: string | IClassConstructor; + icons?: Array<{ + href: string; + size: number[]; + ooffset: number[]; + shape?: IShape | IGeometryJson; + }>; + iconShape?: IGeometryJson; + interactivityModel?: InteractivityModelKey; + numbers?: number[]; + openBalloonOnClick?: boolean; + openEmptyHint?: boolean; + openHintOnHover?: boolean; + zIndexHover?: number; + } + + class Collection implements ICollection, collection.Item { + constructor(options?: object); + + events: IEventManager; + options: IOptionManager; + + add(object: object): this; + + getIterator(): IIterator; + + remove(object: object): this; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + getMap(): Map; + + onAddToMap(map: Map): void; + + onRemoveFromMap(oldMap: Map): void; + + filter(filterFunction: (object: object) => boolean): object[]; + + get(index: number): object; + + getAll(): object[]; + + getLength(): number; + + indexOf(childToFind: object): number; + + removeAll(): this; + } + + class Event implements IEvent { + constructor(originalEvent: object, sourceEvent: IEvent); + + allowMapEvent(): void; + + callMethod(name: string): void; + + get(name: string): object; + + getSourceEvent(): IEvent | null; + + isDefaultPrevented(): boolean; + + isImmediatePropagationStopped(): boolean; + + isMapEventAllowed(): boolean; + + isPropagationStopped(): boolean; + + preventDefault(): boolean; + + stopImmediatePropagation(): boolean; + + stopPropagation(): boolean; + } + + class GeoObject implements IGeoObject { + constructor(feature?: IGeoObjectFeature, options?: IGeoObjectOptions); + + geometry: IGeometry | null; + balloon: geoObject.Balloon; + editor: IGeometryEditor; + hint: geoObject.Hint; + events: event.Manager; + options: option.Manager; + properties: data.Manager; + state: data.Manager; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + getMap(): Map; + } + + interface IGeoObjectFeature { + geometry?: IGeometry | IGeometryJson; + properties?: IDataManager | object; + } + + interface IGeoObjectOptions extends ICircleOptions { + iconCaptionMaxWidth?: number; + iconColor?: string; + iconContentLayout?: string | IClassConstructor; + iconContentOffset?: number[]; + iconContentPadding?: number[]; + iconContentSize?: number[]; + iconImageClipRect?: number[][]; + iconImageHref?: string; + iconImageOffset?: number[]; + iconImageShape?: IShape | null; + iconImageSize?: number[]; + iconLayout?: string | IClassConstructor; + iconMaxHeight?: number; + iconMaxWidth?: number; + iconOffset?: number[]; + iconShadow?: boolean; + iconShadowImageClipRect?: number[][]; + iconShadowImageHref?: string; + iconShadowImageOffset?: number[]; + iconShadowImageSize?: number[]; + iconShadowLayout?: string | IClassConstructor; + iconShadowOffset?: number[]; + lineStringOverlay?: OverlayKey; + pointOverlay?: OverlayKey; + polygonOverlay?: OverlayKey; + preset?: string; + rectangleOverlay?: OverlayKey; + setMapCursorInDragging?: boolean; + } + + class GeoObjectCollection implements IGeoObject, IGeoObjectCollection { + constructor(feature?: { + children?: IGeoObject[]; + geometry?: IGeometry | object; + properties?: IDataManager | object; + }, options?: object); + + geometry: IGeometry | null; + properties: IDataManager; + state: IDataManager; + events: IEventManager; + options: IOptionManager; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + getMap(): Map; + + add(child: IGeoObject, index?: number): this; + + each(callback: (object: IGeoObject) => void, context: object): void; + + get(index: number): IGeoObject; + + getBounds(): number[][] | null; + + getIterator(): IIterator; + + getLength(): number; + + getPixelBounds(): number[][] | null; + + indexOf(object: IGeoObject): number; + + remove(child: IGeoObject): this; + + removeAll(): this; + + set(index: number, child: IGeoObject): this; + + splice(index: number, length: number): this; + + toArray(): IGeoObject[]; + } + + class Layer implements ILayer, IParentOnMap, IPositioningContext { + constructor(tileUrlTemplate: string | ((tileNumber: number[], tileZoom: number) => string)); + + events: IEventManager; + options: IOptionManager; + + fromClientPixels(clientPixelPoint: number[]): number[]; + + getZoom(): number; + + toClientPixels(globalPixelPoint: number[]): number[]; + + getParent(): null | IControlParent; + + setParent(parent: IControlParent): this; + + getMap(): Map; + } + + class Map implements IDomEventEmitter { + constructor(parentElement: HTMLElement | string, state: IMapState, options?: IMapOptions) + + action: map.action.Manager; + balloon: map.Balloon; + behaviors: map.behavior.Manager; + container: map.Container; + controls: control.Manager; + converter: map.Converter; + copyrights: map.Copyrights; + cursors: util.cursor.Manager; + events: event.Manager; + geoObjects: map.GeoObjects; + hint: map.Hint; + layers: map.layer.Manager; + margin: map.margin.Manager; + options: option.Manager; + panes: map.pane.Manager; + zoomRange: map.ZoomRange; + + destroy(): void; + + getBounds(options?: IMapMarginOptions): number[][]; + + getCenter(options?: IMapMarginOptions): number[]; + + getGlobalPixelCenter(options?: IMapMarginOptions): number[]; + + getPanoramaManager(): Promise; + + getType(): string | MapType; + + getZoom(): number; + + panTo(center: number[] | object[], options?: IMapPanOptions): Promise; + + setBounds(bounds: number[][], options?: IMapBoundsOptions): Promise; + + setCenter(center: number[], zoom?: number, options?: IMapPositionOptions): Promise; + + setGlobalPixelCenter(globalPixelCenter: number[], zoom?: number, options?: IMapPositionOptions): Promise; + + setType(type: string | MapType, options?: IMapCheckZoomRangeOptions): Promise; + + setZoom(zoom: number, options?: IMapZoomOptions): Promise; + } + + interface IMapMarginOptions { + useMapMargin?: boolean; + } + + interface IMapCheckZoomRangeOptions { + checkZoomRange?: boolean; + } + + interface IMapZoomOptions extends IMapMarginOptions, IMapCheckZoomRangeOptions { + duration?: number; + } + + interface IMapPositionOptions extends IMapZoomOptions { + timingFunction?: string; + } + + interface IMapBoundsOptions extends IMapPositionOptions { + preciseZoom?: boolean; + zoomMargin?: number[][] | number[]; + } + + interface IMapPanOptions extends IMapPositionOptions { + delay?: number; + flying?: boolean; + safe?: boolean; + } + + class MapType { + constructor(name: string, layers: Array | string>) + } + + interface IMapState { + behaviors?: string[]; + bounds?: number[][]; + center?: number[]; + controls?: string[]; + margin?: number[][] | number[]; + type?: "yandex#map" | "yandex#satellite" | "yandex#hybrid"; + zoom?: number; + } + + interface IMapOptions { + autoFitToViewport?: "none" | "ifNull" | "always"; + avoidFractionalZoom?: boolean; + exitFullscreenByEsc?: boolean; + fullscreenZIndex?: number; + mapAutoFocus?: boolean; + maxAnimationZoomDifference?: number; + maxZoom?: number; + minZoom?: number; + nativeFullscreen?: boolean; + projection?: IProjection; + restrictMapArea?: boolean; + suppressMapOpenBlock?: boolean; + suppressObsoleteBrowserNotifier?: boolean; + yandexMapAutoSwitch?: boolean; + yandexMapDisablePoiInteractivity?: boolean; + } + + class Placemark extends GeoObject { + constructor(geometry: number[] | object | IPointGeometry, properties: object | IDataManager, options?: IPlacemarkOptions) + } + + interface IPlacemarkOptions { + cursor?: string; + draggable?: boolean; + hasBalloon?: boolean; + hasHint?: boolean; + hideIconOnBalloonOpen?: boolean; + iconOffset?: number[]; + iconShape?: IGeometryJson | null; + interactiveZIndex?: boolean; + interactivityModel?: string; + openBalloonOnClick?: boolean; + openEmptyBalloon?: boolean; + openEmptyHint?: boolean; + openHintOnHover?: boolean; pane?: string; - panelContentLayout?: IClassConstructor | string; - panelMaxHeightRatio?: number; - panelMaxMapArea?: number; - shadow?: boolean; - shadowLayout?: IClassConstructor | string; - shadowOffset?: number[]; + pointOverlay?: string; + syncOverlayInit?: boolean; + useMapMarginInDragging?: boolean; + visible?: boolean; + zIndex?: number; + zIndexActive?: number; + zIndexDrag?: number; + zIndexHover?: number; + } + + class Polygon extends GeoObject { + constructor(geometry: number[][][] | object| IPolygonGeometry, properties?: object | IDataManager, options?: IPolygonOptions) } - class Circle implements GeoObject { - constructor(geometry: ICircleGeometry[][][][] | number[][] | object, properties?: object | IDataManager, options?: ICircleOptions) - - balloon: geoObject.Balloon; - editor: IGeometryEditor; - hint: geoObject.Hint; - events: event.Manager; - options: option.Manager; - properties: data.Manager; - state: data.Manager; - - geometry: IGeometry | null; - indices: ArrayBuffer; - vertices: ArrayBuffer; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getParent(): null | IControlParent; - - setParent(parent: IControlParent): this; - - getMap(): Map; - } - - interface ICircleOptions { - circleOverlay?: string | ((geometry: IPixelCircleGeometry, data: object, options: object) => Promise); + interface IPolygonOptions { cursor?: string; draggable?: boolean; fill?: boolean; fillColor?: string; fillImageHref?: string; - fillMethod?: "stretch" | "tile"; + fillMethod?: 'stretch' | 'tile'; fillOpacity?: number; hasBalloon?: boolean; hasHint?: boolean; - hideIconOnBalloonOpen?: boolean; interactiveZIndex?: boolean; - interactivityModel?: InteractivityModelKey; + interactivityModel?: string; opacity?: number; openBalloonOnClick?: boolean; openEmptyBalloon?: boolean; @@ -1936,10 +2627,11 @@ declare namespace ymaps { openHintOnHover?: boolean; outline?: boolean; pane?: string; - strokeColor?: string[][] | string[] | string; - strokeOpacity?: number[][] | number[] | number; - strokeStyle?: string[][][] | object[][] | string[] | object[] | string | object; - strokeWidth?: number[][] | number[] | number; + polygonOverlay?: string; + strokeColor?: string | string[]; + strokeOpacity?: number | number[]; + strokeStyle?: string | string[] | object | object[]; + strokeWidth?: number | number[]; syncOverlayInit?: boolean; useMapMarginInDragging?: boolean; visible?: boolean; @@ -1949,770 +2641,447 @@ declare namespace ymaps { zIndexHover?: number; } - class Clusterer implements IChildOnMap, ICustomizable, IEventEmitter, IParentOnMap { - constructor(options?: IClustererOptions); - - events: IEventManager; - options: IOptionManager; - balloon: clusterer.Balloon; - // balloonopen: - hint: clusterer.Hint; - - getParent(): null | IControlParent; - - setParent(parent: IControlParent): this; - - // balloonclose: - - getMap(): Map; + class Polyline extends GeoObject { + constructor(geometry: number[][]| object | ILineStringGeometry, properties?: object | IDataManager, options?: IPolylineOptions) } - interface IClustererOptions { - gridSize?: number; - groupByCoordinates?: boolean; + interface IPolylineOptions { + cursor?: string; + draggable?: boolean; hasBalloon?: boolean; hasHint?: boolean; - margin?: number[][] | number[] | number; - maxZoom?: number[] | number; - minClusterSize?: number; - preset?: PresetKey; - showInAlphabeticalOrder?: boolean; - useMapMargin?: boolean; - viewportMargin?: number[][] | number[] | number; - zoomMargin?: number[][] | number[] | number; - } - - class ClusterPlacemark implements IGeoObject, collection.Item { - constructor(geometry: number[] | object | IPointGeometry, properties: IClusterPlacemarkProperties, options?: IClusterPlacemarkOptions); - - geometry: IGeometry | null; - properties: IDataManager; - events: IEventManager; - options: IOptionManager; - state: data.Manager; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getParent(): null | IControlParent; - - setParent(parent: IControlParent): this; - - getMap(): Map; - - onAddToMap(map: Map): void; - - onRemoveFromMap(oldMap: Map): void; - - getBounds(): number[][] | null; - - getGeoObjects(): IGeoObject[]; - } - - interface IClusterPlacemarkProperties extends IDataManager { - geoObjects: IGeoObject[]; - } - - interface IClusterPlacemarkOptions { - balloonContentLayout?: "cluster#balloonTwoColumns" | "cluster#balloonCarousel" | "cluster#balloonAccordion" | string | IClassConstructor; - balloonContentLayoutHeight?: number; - balloonContentLayoutWidth?: number; - balloonItemContentLayout?: ILayout | string; - balloonPanelContentLayout?: string | IClassConstructor; - cursor?: string; - disableClickZoom?: boolean; - hideIconOnBalloonOpen?: boolean; - iconColor?: string; - iconContentLayout?: string | IClassConstructor; - iconLayout?: string | IClassConstructor; - icons?: Array<{ - href: string; - size: number[]; - ooffset: number[]; - shape?: IShape | IGeometryJson; - }>; - iconShape?: IGeometryJson; - interactivityModel?: InteractivityModelKey; - numbers?: number[]; + interactiveZIndex?: boolean; + interactivityModel?: string; + lineStringOverlay?: () => object | string; + opacity?: number; openBalloonOnClick?: boolean; + openEmptyBalloon?: boolean; openEmptyHint?: boolean; openHintOnHover?: boolean; + pane?: string; + strokeColor?: string | string[]; + strokeOpacity?: number | number[]; + strokeStyle?: string | string[] | object | object[]; + strokeWidth?: number | number[]; + syncOverlayInit?: boolean; + useMapMarginInDragging?: boolean; + visible?: boolean; + zIndex?: number; + zIndexActive?: number; + zIndexDrag?: number; zIndexHover?: number; } - class Collection implements ICollection, collection.Item { - constructor(options?: object); + class Popup implements IPopup { + constructor(map: Map, options?: IPopupOptions); - events: IEventManager; - options: IOptionManager; + options: IOptionManager; + events: IEventManager; - add(object: object): this; + close(force?: boolean): Promise; - getIterator(): IIterator; + getData(): object; - remove(object: object): this; + getOverlay(): Promise; - getParent(): null | IControlParent; + getOverlaySync(): IOverlay; - setParent(parent: IControlParent): this; + getPosition(): number[]; - getMap(): Map; + isOpen(): boolean; - onAddToMap(map: Map): void; + open(position: number[], data: object | string | HTMLElement): Promise; - onRemoveFromMap(oldMap: Map): void; + setData(data: object | string | HTMLElement): Promise; - filter(filterFunction: (object: object) => boolean): object[]; + setPosition(position: number[]): Promise; + } - get(index: number): object; + interface IPopupOptions { + closeTimeout?: number; + interactivityModel?: InteractivityModelKey; + openTimeout?: number; + pane?: IPane | string; + projection?: IProjection; + zIndex?: number; + } - getAll(): object[]; + function ready(successCallback?: () => any | IReadyobject, errorCallback?: () => any, context?: object): Promise; - getLength(): number; + interface IReadyobject { + require?: string[]; + context?: object; - indexOf(childToFind: object): number; + successCallback?(): void; - removeAll(): this; + errorCallback?(): void; + } + + namespace templateLayoutFactory { + function createClass(template: string, overrides?: object, staticMethods?: object): IClassConstructor; + } + + namespace util { + namespace cursor { + class Accessor { + constructor(key: string); + + getKey(): string; + + remove(): void; + + setKey(): void; + } + + class Manager { + constructor(element: HTMLElement); + + push(key: string): Accessor; + } + } + + class Storage { + add(key: string, object: object): this; + + get(key: string | object): object | string; + + remove(key: string): object; + } + } + + namespace vow { + class Deferred { + promise(): Promise; + + reject(reason: object): void; + + resolve(value: object): void; + } + + class Promise { + constructor(resolver?: () => void); + + done(onFulfilled?: () => void, onRejected?: () => void, onProgress?: () => void, ctx?: object): void; + + spread(onFulfilled?: () => void, onRejected?: () => void, ctx?: object): Promise; + + then(onFulfilled?: () => void, onRejected?: () => void, onProgress?: () => void, ctx?: object): Promise; + + valueOf(): object; + } } - class Event implements IEvent { - constructor(originalEvent: object, sourceEvent: IEvent); + /*Interfaces*/ - allowMapEvent(): void; + interface IBaloon extends IPopup, ICustomizable, IChild, IFreezable { + autoPan(): Promise; + } - callMethod(name: string): void; + interface IBalloonManager extends IPopupManager { + autoPan(): Promise; + } - get(name: string): object; + interface IBaseGeometry extends IEventEmitter { + getBounds(): number[][] | null; - getSourceEvent(): IEvent | null; + getType(): string; + } - isDefaultPrevented(): boolean; + interface IBaseLineStringGeometry extends IBaseGeometry, ILineStringGeometryAccess {//tslint:disable-line no-empty-interface no-empty-interfaces + } - isImmediatePropagationStopped(): boolean; + interface IBasePointGeometry extends IBaseGeometry, IPointGeometryAccess {//tslint:disable-line no-empty-interface no-empty-interfaces + } - isMapEventAllowed(): boolean; + interface IBehavior extends IChildOnMap, ICustomizable { + disable(): void; - isPropagationStopped(): boolean; + enable(): void; - preventDefault(): boolean; + isEnabled(): boolean; + } - stopImmediatePropagation(): boolean; + interface IChild extends IEventEmitter { + getParent(): object | null; - stopPropagation(): boolean; - } + setParent(parent: object | null): this; + } - class GeoObject implements IGeoObject { - constructor(feature?: IGeoObjectFeature, options?: IGeoObjectOptions); + interface IChildOnMap extends IChild { //tslint:disable-line no-empty-interface no-empty-interfaces + } - geometry: IGeometry | null; - balloon: geoObject.Balloon; - editor: IGeometryEditor; - hint: geoObject.Hint; - events: event.Manager; - options: option.Manager; - properties: data.Manager; - state: data.Manager; + interface ICircleGeometry extends ICircleGeometryAccess, IGeometry { //tslint:disable-line no-empty-interface no-empty-interfaces + } - getOverlay(): Promise; + interface ICircleGeometryAccess extends IFreezable { + contains(position: number[]): boolean; - getOverlaySync(): IOverlay | null; + getClosest(anchorPosition: number[]): object; - getParent(): null | IControlParent; + getCoordinates(): number[] | null; - setParent(parent: IControlParent): this; + getRadius(): number; - getMap(): Map; - } + setCoordinates(coordinates: number[] | null): this; - interface IGeoObjectFeature { - geometry?: IGeometry | IGeometryJson | object; - properties?: IDataManager | object; - } + setRadius(radius: number): this; + } - interface IGeoObjectOptions extends ICircleOptions { - iconCaptionMaxWidth?: number; - iconColor?: string; - iconContentLayout?: string | IClassConstructor; - iconContentOffset?: number[]; - iconContentPadding?: number[]; - iconContentSize?: number[]; - iconImageClipRect?: number[][]; - iconImageHref?: string; - iconImageOffset?: number[]; - iconImageShape?: IShape | null; - iconImageSize?: number[]; - iconLayout?: string | IClassConstructor; - iconMaxHeight?: number; - iconMaxWidth?: number; - iconOffset?: number[]; - iconShadow?: boolean; - iconShadowImageClipRect?: number[][]; - iconShadowImageHref?: string; - iconShadowImageOffset?: number[]; - iconShadowImageSize?: number[]; - iconShadowLayout?: string | IClassConstructor; - iconShadowOffset?: number[]; - lineStringOverlay?: OverlayKey; - pointOverlay?: OverlayKey; - polygonOverlay?: OverlayKey; - preset?: string; - rectangleOverlay?: OverlayKey; - setMapCursorInDragging?: boolean; - } + interface ICollection extends IEventEmitter { + add(object: object): this; - class GeoObjectCollection implements IGeoObject, IGeoObjectCollection { - constructor(feature?: { - children?: IGeoObject[]; - geometry?: IGeometry | object; - properties?: IDataManager | object; - }, options?: object); + getIterator(): IIterator; - geometry: IGeometry | null; - properties: IDataManager; + remove(object: object): this; + } + + interface IControl extends IChildOnMap { //tslint:disable-line no-empty-interface no-empty-interfaces + // new (options?: object); + } + + interface IControlParent extends IParentOnMap { + getChildElement(child: IControl): Promise; + } + + interface ICoordSystem { + getDistance(point1: number[], point2: number[]): number; + + solveDirectProblem(startPoint: number[], direction: number[], distance: number): object; + + solveInverseProblem(startPoint: number[], endPoint: number[], reverseDirection?: boolean): object; + } + + interface ICopyrightsAccessor extends ICopyrightsProvider { //tslint:disable-line no-empty-interface no-empty-interfaces + } + + interface ICopyrightsProvider extends IEventEmitter { + getCopyrights(coords: number[], zoom: number): Promise>; + + remove(): void; + + setCopyrights(copyrights: string | HTMLElement | Array): void; + } + + interface ICustomizable extends IEventEmitter { + options: IOptionManager; + } + + interface IDataManager extends IEventEmitter { + get(path: string, defaultValue: object): object; + } + + interface IDomEventEmitter extends IEventEmitter { //tslint:disable-line no-empty-interface no-empty-interfaces + } + + interface IEvent { + allowMapEvent(): void; + + callMethod(name: string): void; + + get(name: string): object; + + getSourceEvent(): IEvent | null; + + isDefaultPrevented(): boolean; + + isImmediatePropagationStopped(): boolean; + + isMapEventAllowed(): boolean; + + isPropagationStopped(): boolean; + + preventDefault(): boolean; + + stopImmediatePropagation(): boolean; + + stopPropagation(): boolean; + } + + interface IEventController { + onStartListening?(events: IEventManager, type: string): void; + + onStopListening?(events: IEventManager, type: string): void; + } + + interface IEventEmitter { + events: IEventManager; + } + + interface IEventGroup { + add(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; + + remove(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; + + removeAll(): this; + } + + interface IEventManager extends IEventTrigger { + add(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; + + getParent(): object | null; + + group(): IEventGroup; + + //remove(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; + + setParent(parent: object | null): this; + } + + interface IEventTrigger { + fire(type: string, eventobject: object | IEvent): this; + } + + interface IEventWorkflowController extends IEventController { + onAfterEventFiring?(events: IEventManager, type: string, event?: IEvent): void; + + onBeforeEventFiring?(events: IEventManager, type: string, event?: IEvent): void; + } + + interface IExpandableControlLayout extends ILayout { //tslint:disable-line no-empty-interface no-empty-interfaces + } + + interface IFreezable extends IEventManager { + freeze(): IFreezable; + + isFrozen(): boolean; + + unfreeze(): IFreezable; + } + + interface IGeocodeProvider { + geocode(request: string, options?: { boundedBy?: number[][], results?: number, skip?: number, strictBounds?: boolean }): Promise; + + suggest(request: string, options?: { boundedBy?: number[][], results?: number, strictBounds?: boolean }): Promise; + } + + interface IGeometry extends IBaseGeometry, ICustomizable { + getMap(): Map | null; + + getPixelGeometry(options?: object): IPixelGeometry; + + setMap(map: Map): void; + } + + interface IGeometryEditor extends ICustomizable, IEventEmitter { + geometry: IGeometry; state: IDataManager; - events: IEventManager; - options: IOptionManager; - getOverlay(): Promise; + startEditing(): void; - getOverlaySync(): IOverlay | null; + stopEditing(): void; + } - getParent(): null | IControlParent; + interface IGeometryEditorChildModel extends IGeometryEditorModel { + editor: IGeometryEditor; + geometry: IBaseGeometry; - setParent(parent: IControlParent): this; + getParent(): IGeometryEditorModel; - getMap(): Map; - - add(child: IGeoObject, index?: number): this; - - each(callback: (object: IGeoObject) => void, context: object): void; - - get(index: number): IGeoObject; - - getBounds(): number[][] | null; - - getIterator(): IIterator; - - getLength(): number; - - getPixelBounds(): number[][] | null; - - indexOf(object: IGeoObject): number; - - remove(child: IGeoObject): this; - - removeAll(): this; - - set(index: number, child: IGeoObject): this; - - splice(index: number, length: number): this; - - toArray(): IGeoObject[]; + setPixels(pixels: number[]): void; } - class Layer implements ILayer, IParentOnMap, IPositioningContext { - constructor(tileUrlTemplate: string | ((tileNumber: number[], tileZoom: number) => string)); - - events: IEventManager; - options: IOptionManager; - - fromClientPixels(clientPixelPoint: number[]): number[]; - - getZoom(): number; - - toClientPixels(globalPixelPoint: number[]): number[]; - - getParent(): null | IControlParent; - - setParent(parent: IControlParent): this; - - getMap(): Map; - } - - class Map implements IDomEventEmitter { - constructor(parentElement: HTMLElement | string, state: IMapState, options?: IMapOptions) - - action: map.action.Manager; - balloon: map.Balloon; - behaviors: map.behavior.Manager; - container: map.Container; - controls: control.Manager; - converter: map.Converter; - copyrights: map.Copyrights; - cursors: util.cursor.Manager; - events: event.Manager; - geoObjects: map.GeoObjects; - hint: map.Hint; - layers: map.layer.Manager; - margin: map.margin.Manager; - options: option.Manager; - panes: map.pane.Manager; - zoomRange: map.ZoomRange; - + interface IGeometryEditorModel extends IEventEmitter { destroy(): void; - getBounds(options?: IMapMarginOptions): number[][]; - - getCenter(options?: IMapMarginOptions): number[]; - - getGlobalPixelCenter(options?: IMapMarginOptions): number[]; - - getPanoramaManager(): Promise; - - getType(): string | MapType; - - getZoom(): number; - - panTo(center: number[] | object[], options?: IMapPanOptions): Promise; - - setBounds(bounds: number[][], options?: IMapBoundsOptions): Promise; - - setCenter(center: number[], zoom?: number, options?: IMapPositionOptions): Promise; - - setGlobalPixelCenter(globalPixelCenter: number[], zoom?: number, options?: IMapPositionOptions): Promise; - - setType(type: string | MapType, options?: IMapCheckZoomRangeOptions): Promise; - - setZoom(zoom: number, options?: IMapZoomOptions): Promise; + getPixels(): number[]; } - interface IMapMarginOptions { - useMapMargin?: boolean; + interface IGeometryEditorRootModel extends IGeometryEditorModel { //tslint:disable-line no-empty-interface no-empty-interfaces } - interface IMapCheckZoomRangeOptions { - checkZoomRange?: boolean; - } - - interface IMapZoomOptions extends IMapMarginOptions, IMapCheckZoomRangeOptions { - duration?: number; - } - - interface IMapPositionOptions extends IMapZoomOptions { - timingFunction?: string; - } - - interface IMapBoundsOptions extends IMapPositionOptions { - preciseZoom?: boolean; - zoomMargin?: number[][] | number[]; - } - - interface IMapPanOptions extends IMapPositionOptions { - delay?: number; - flying?: boolean; - safe?: boolean; - } + interface IGeometryJson { + type: string; + } - class MapType { - constructor(name: string, layers: Array | string>) - } + interface IGeoObject extends IChildOnMap, ICustomizable, IDomEventEmitter, IParentOnMap { + geometry: IGeometry | null; + properties: IDataManager; + state: IDataManager; - interface IMapState { - behaviors?: string[]; - bounds?: number[][]; - center?: number[]; - controls?: string[]; - margin?: number[][] | number[]; - type?: "yandex#map" | "yandex#satellite" | "yandex#hybrid"; - zoom?: number; - } + getOverlay(): Promise; - interface IMapOptions { - autoFitToViewport?: "none" | "ifNull" | "always"; - avoidFractionalZoom?: boolean; - exitFullscreenByEsc?: boolean; - fullscreenZIndex?: number; - mapAutoFocus?: boolean; - maxAnimationZoomDifference?: number; - maxZoom?: number; - minZoom?: number; - nativeFullscreen?: boolean; - projection?: IProjection; - restrictMapArea?: boolean; - suppressMapOpenBlock?: boolean; - suppressObsoleteBrowserNotifier?: boolean; - yandexMapAutoSwitch?: boolean; - yandexMapDisablePoiInteractivity?: boolean; - } + getOverlaySync(): IOverlay | null; + } - class Placemark extends GeoObject { - constructor(geometry: number[] | object | IPointGeometry, properties: object | IDataManager, options?: IPlacemarkOptions) - } + interface IGeoObjectCollection extends ICustomizable, IEventEmitter, IParentOnMap { + add(child: IGeoObject, index?: number): this; - interface IPlacemarkOptions { - cursor?: string; - draggable?: boolean; + each(callback: (object: IGeoObject) => void, context: object): void; - [index: string]: any; - } + get(index: number): IGeoObject; - class Popup implements IPopup { - constructor(map: Map, options?: IPopupOptions); + getBounds(): number[][] | null; - options: IOptionManager; - events: IEventManager; + getIterator(): IIterator; - close(force?: boolean): Promise; + getLength(): number; - getData(): object; + getPixelBounds(): number[][] | null; - getOverlay(): Promise; + indexOf(object: IGeoObject): number; - getOverlaySync(): IOverlay; + remove(child: IGeoObject): this; - getPosition(): number[]; + removeAll(): this; - isOpen(): boolean; + set(index: number, child: IGeoObject): this; - open(position: number[], data: object | string | HTMLElement): Promise; + splice(index: number, length: number): this; + } - setData(data: object | string | HTMLElement): Promise; + interface IGeoObjectSequence extends ICustomizable, IEventEmitter, IParentOnMap { + each(callback: (geoObject: IGeoObject) => void, context?: object): void; - setPosition(position: number[]): Promise; - } + get(index: number): IGeoObject; - interface IPopupOptions { - closeTimeout?: number; - interactivityModel?: InteractivityModelKey; - openTimeout?: number; - pane?: IPane | string; - projection?: IProjection; - zIndex?: number; - } + getBounds(): number[][] | null; - function ready(successCallback?: () => any | IReadyobject, errorCallback?: () => any, context?: object): Promise; + getIterator(): IIterator; - interface IReadyobject { - require?: string[]; - context?: object; + getLength(): number; - successCallback?(): void; + getPixelBounds(): number[][] | null; - errorCallback?(): void; - } + indexOf(geoObject: IGeoObject): number; + } - namespace templateLayoutFactory { - function createClass(template: string, overrides?: object, staticMethods?: object): IClassConstructor; - } + interface IHintManager extends IPopupManager { //tslint:disable-line no-empty-interface no-empty-interfaces + } - namespace util { - namespace cursor { - class Accessor { - constructor(key: string); + interface IIterator { + getNext(): object | null; + } - getKey(): string; + interface ILayer extends IChildOnMap, ICustomizable, IEventEmitter { + getBrightness?(): number; - remove(): void; + getCopyrights?(coords: number[], zoom: number): Promise>; - setKey(): void; - } + getZoomRange?(point: number[]): Promise; + } - class Manager { - constructor(element: HTMLElement); + interface ILayout extends IDomEventEmitter { + // new (data: object); + destroy(): void; - push(key: string): Accessor; - } - } + getData(): object; - class Storage { - add(key: string, object: object): this; + getParentElement(): HTMLElement; - get(key: string | object): object | string; + getShape(): IShape | null; - remove(key: string): object; - } - } + isEmpty(): boolean; - /*Interfaces*/ + setData(data: object): void; - interface IBaloon extends IPopup, ICustomizable, IChild, IFreezable { - autoPan(): Promise; - } + setParentElement(parent: HTMLElement | null): void; + } - interface IBalloonManager extends IPopupManager { - autoPan(): Promise; - } + interface ILinearRingGeometryAccess extends IFreezable { + contain(position: number): boolean; - interface IBaseGeometry extends IEventEmitter { - getBounds(): number[][] | null; - - getType(): string; - } - - interface IBaseLineStringGeometry extends IBaseGeometry, ILineStringGeometryAccess {//tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface IBasePointGeometry extends IBaseGeometry, IPointGeometryAccess {//tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface IBehavior extends IChildOnMap, ICustomizable { - disable(): void; - - enable(): void; - - isEnabled(): boolean; - } - - interface IChild extends IEventEmitter { - getParent(): object | null; - - setParent(parent: object | null): this; - } - - interface IChildOnMap extends IChild { //tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface ICircleGeometry extends ICircleGeometryAccess, IGeometry { //tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface ICircleGeometryAccess extends IFreezable { - contains(position: number[]): boolean; - - getClosest(anchorPosition: number[]): object; - - getCoordinates(): number[] | null; - - getRadius(): number; - - setCoordinates(coordinates: number[] | null): this; - - setRadius(radius: number): this; - } - - interface ICollection extends IEventEmitter { - add(object: object): this; - - getIterator(): IIterator; - - remove(object: object): this; - } - - interface IControl extends IChildOnMap { //tslint:disable-line no-empty-interface no-empty-interfaces - // new (options?: object); - } - - interface IControlParent extends IParentOnMap { - getChildElement(child: IControl): Promise; - } - - interface ICoordSystem { - getDistance(point1: number[], point2: number[]): number; - - solveDirectProblem(startPoint: number[], direction: number[], distance: number): object; - - solveInverseProblem(startPoint: number[], endPoint: number[], reverseDirection?: boolean): object; - } - - interface ICopyrightsAccessor extends ICopyrightsProvider { //tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface ICopyrightsProvider extends IEventEmitter { - getCopyrights(coords: number[], zoom: number): Promise>; - - remove(): void; - - setCopyrights(copyrights: string | HTMLElement | Array): void; - } - - interface ICustomizable extends IEventEmitter { - options: IOptionManager; - } - - interface IDataManager extends IEventEmitter { - get(path: string, defaultValue: object): object; - } - - interface IDomEventEmitter extends IEventEmitter { //tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface IEvent { - allowMapEvent(): void; - - callMethod(name: string): void; - - get(name: string): object; - - getSourceEvent(): IEvent | null; - - isDefaultPrevented(): boolean; - - isImmediatePropagationStopped(): boolean; - - isMapEventAllowed(): boolean; - - isPropagationStopped(): boolean; - - preventDefault(): boolean; - - stopImmediatePropagation(): boolean; - - stopPropagation(): boolean; - } - - interface IEventController { - onStartListening?(events: IEventManager, type: string): void; - - onStopListening?(events: IEventManager, type: string): void; - } - - interface IEventEmitter { - events: IEventManager; - } - - interface IEventGroup { - add(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; - - remove(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; - - removeAll(): this; - } - - interface IEventManager extends IEventTrigger { - add(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; - - getParent(): object | null; - - group(): IEventGroup; - - //remove(types: string[][] | string[] | string, callback: (event: object | IEvent) => void, context?: object, priority?: number): this; - - setParent(parent: object | null): this; - } - - interface IEventTrigger { - fire(type: string, eventobject: object | IEvent): this; - } - - interface IEventWorkflowController extends IEventController { - onAfterEventFiring?(events: IEventManager, type: string, event?: IEvent): void; - - onBeforeEventFiring?(events: IEventManager, type: string, event?: IEvent): void; - } - - interface IExpandableControlLayout extends ILayout { //tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface IFreezable extends IEventManager { freeze(): IFreezable; - isFrozen(): boolean; - - unfreeze(): IFreezable; - } - - interface IGeocodeProvider { - geocode(request: string, options?: { boundedBy?: number[][], results?: number, skip?: number, strictBounds?: boolean }): Promise; - - suggest(request: string, options?: { boundedBy?: number[][], results?: number, strictBounds?: boolean }): Promise; - } - - interface IGeometry extends IBaseGeometry, ICustomizable { - getMap(): Map | null; - - getPixelGeometry(options?: object): IPixelGeometry; - - setMap(map: Map): void; - } - - interface IGeometryEditor extends ICustomizable, IEventEmitter { - startEditing(): void; - - stopEditing(): void; - } - - interface IGeometryJson { - type: string; - } - - interface IGeoObject extends IChildOnMap, ICustomizable, IDomEventEmitter, IParentOnMap { - geometry: IGeometry | null; - properties: IDataManager; - state: IDataManager; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - } - - interface IGeoObjectCollection extends ICustomizable, IEventEmitter, IParentOnMap { - add(child: IGeoObject, index?: number): this; - - each(callback: (object: IGeoObject) => void, context: object): void; - - get(index: number): IGeoObject; - - getBounds(): number[][] | null; - - getIterator(): IIterator; - - getLength(): number; - - getPixelBounds(): number[][] | null; - - indexOf(object: IGeoObject): number; - - remove(child: IGeoObject): this; - - removeAll(): this; - - set(index: number, child: IGeoObject): this; - - splice(index: number, length: number): this; - } - - interface IGeoObjectSequence extends ICustomizable, IEventEmitter, IParentOnMap { - each(callback: (geoObject: IGeoObject) => void, context?: object): void; - - get(index: number): IGeoObject; - - getBounds(): number[][] | null; - - getIterator(): IIterator; - - getLength(): number; - - getPixelBounds(): number[][] | null; - - indexOf(geoObject: IGeoObject): number; - } - - interface IHintManager extends IPopupManager { //tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface IIterator { - getNext(): object | null; - } - - interface ILayer extends IChildOnMap, ICustomizable, IEventEmitter { - getBrightness?(): number; - - getCopyrights?(coords: number[], zoom: number): Promise>; - - getZoomRange?(point: number[]): Promise; - } - - interface ILayout extends IDomEventEmitter { - // new (data: object); - destroy(): void; - - getData(): object; - - getParentElement(): HTMLElement; - - getShape(): IShape | null; - - isEmpty(): boolean; - - setData(data: object): void; - - setParentElement(parent: HTMLElement | null): void; - } - - interface ILineStringGeometry extends IGeometry, ILineStringGeometryAccess { //tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface ILineStringGeometryAccess extends IFreezable { get(index: number): number[]; getChildGeometry(index: number): IPointGeometryAccess; @@ -2721,337 +3090,391 @@ declare namespace ymaps { getCoordinates(): number[][]; + getFillRule(): string; + getLength(): number; - insert(index: number, coordinates: number[][]): ILineStringGeometryAccess; + insert(index: number, coordinates: number[]): ILinearRingGeometryAccess; + + isFrozen(): boolean; remove(index: number): number[]; - set(index: number, coordinates: number[]): ILineStringGeometryAccess; + set(index: number, coordinates: number[]): ILinearRingGeometryAccess; - setCoordinates(coordinates: number[]): ILineStringGeometryAccess; + setCoordinates(coordinates: number[][]): ILinearRingGeometryAccess; - splice(index: number, length: number): number[][]; + setFillRule(fillRule: string): ILinearRingGeometryAccess; + + splice(index: number, number: number): number[][]; + + unfreeze(): IFreezable; } - interface IMapAction extends IEventEmitter { - begin(mapActionManager: map.action.Manager): void; + interface ILineStringGeometry extends IGeometry, ILineStringGeometryAccess { //tslint:disable-line no-empty-interface no-empty-interfaces + } - end(): void; + interface ILineStringGeometryAccess extends IFreezable { + get(index: number): number[]; + + getChildGeometry(index: number): IPointGeometryAccess; + + getClosest(anchorPosition: number[]): object; + + getCoordinates(): number[][]; + + getLength(): number; + + insert(index: number, coordinates: number[][]): ILineStringGeometryAccess; + + remove(index: number): number[]; + + set(index: number, coordinates: number[]): ILineStringGeometryAccess; + + setCoordinates(coordinates: number[]): ILineStringGeometryAccess; + + splice(index: number, length: number): number[][]; + } + + interface IMapAction extends IEventEmitter { + begin(mapActionManager: map.action.Manager): void; + + end(): void; + } + + interface IMapObjectCollection extends ICollection, ICustomizable, IParentOnMap { //tslint:disable-line no-empty-interface no-empty-interfaces + } + + interface IMultiRouteModelJson { + params: IMultiRouteParams; + referencePoints: IMultiRouteReferencePoint[]; + } + + interface IMultiRouteParams { + avoidTrafficJams?: boolean; + boundedBy?: number[][] | null; + requestSendInterval?: string | number; + results?: number; + reverseGeocoding?: boolean; + routingMode?: "auto" | "masstransit" | "pedestrian"; + searchCoordOrder?: string; + strictBounds?: boolean; + viaIndexes?: number[]; + } + + type IMultiRouteReferencePoint = string | number[] | geometry.Point; + + interface IOptionManager extends IChild, IEventEmitter, IFreezable { + get(key: string, defaultValue: object): object; + + getAll(): object; + + getName(): string; + + getNative(key: string): object; + + resolve(key: string, name?: string): object; + + setName(name: string): void; + } + + interface IOverlay extends ICustomizable, IDomEventEmitter { + getData(): object; + + getGeometry(): IPixelGeometry; + + getMap(): Map | null; + + getShape(): IShape | null; + + isEmpty(): boolean; + + setData(data: object): void; + + setGeometry(geometry: IPixelGeometry): void; + + setMap(map: Map | null): void; + } + + interface IPane extends IEventEmitter { + destroy(): void; + + getElement(): HTMLElement; + + getMap(): Map; + + getOverflow(): "visible" | "hidden"; + + getZIndex(): number; + } + + interface IPanorama { + getAngularBBox(): number[]; + + getConnectionArrows(): IPanoramaConnectionArrow[]; + + getConnectionMarkers(): IPanoramaConnectionMarker[]; + + getCoordSystem(): ICoordSystem; + + getDefaultDirection(): number[]; + + getDefaultSpan(): number[]; + + getGraph(): IPanoramaGraph | null; + + getMarkers(): IPanoramaMarker[]; + + getName(): string; + + getPosition(): number[]; + + getTileLevels(): IPanoramaTileLevel[]; + + getTileSize(): number[]; + } + + interface IPanoramaConnection { + getConnectedPanorama(): Promise; + } + + interface IPanoramaConnectionArrow extends IPanoramaConnection { + properties: data.Manager; + + getDirection(): number[]; + + getPanorama(): IPanorama; + } + + interface IPanoramaConnectionMarker extends IPanoramaConnection, IPanoramaMarker { //tslint:disable-line no-empty-interface no-empty-interfaces + } + + interface IPanoramaGraph { + getEdges(): IPanoramaGraphEdge[]; + + getNodes(): IPanoramaGraphEdge[]; + + getPanorama(): IPanorama; + } + + interface IPanoramaGraphEdge { + getEndNodes(): IPanoramaGraphNode[]; + } + + interface IPanoramaGraphNode { + getConnectedPanorama(): Promise; + } + + interface IPanoramaMarker { + properties: data.Manager; + + getIconSet(): Promise; + + getPanorama(): IPanorama; + + getPosition(): number[]; + } + + interface IPanoramaMarkerIcon { + image: HTMLCanvasElement | HTMLImageElement; + offset: number[]; + } + + interface IPanoramaMarkerIconSet { + default: IPanoramaMarkerIcon | null; + expanded: IPanoramaMarkerIcon | null; + expandedHovered: IPanoramaMarkerIcon | null; + hovered: IPanoramaMarkerIcon | null; + } + + interface IPanoramaTileLevel { + getImageSize(): number[]; + + getTileUrl(x: number, y: number): string; + } + + interface IParentOnMap { + getMap(): Map; + } + + interface IPixelCircleGeometry extends IPixelGeometry { + getCoordinates(): number[]; + + getRadius(): number; + } + + interface IPixelLineStringGeometry extends IPixelGeometry { + getClosest(anchorPosition: number[]): object; + + getCoordinates(): number[][]; + + getLength(): number; + } + + interface IPixelGeometry extends IBaseGeometry { + equals(geometry: IPixelGeometry): boolean; + + getMetaData(): object; + + scale(factor: number): IPixelGeometry; + + shift(offset: number[]): IPixelGeometry; + } + + interface IPointGeometry extends IGeometry, IPointGeometryAccess { //tslint:disable-line no-empty-interface no-empty-interfaces + } + + interface IPointGeometryAccess { + getCoordinates(): number[] | null; + + setCoordinates(coordinates: number[] | null): this; + } + + interface IPolygonGeometry extends IGeometry, IPolygonGeometryAccess { //tslint:disable-line no-empty-interface no-empty-interfaces } - interface IMapObjectCollection extends ICollection, ICustomizable, IParentOnMap { //tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface IMultiRouteModelJson { - params: IMultiRouteParams; - referencePoints: IMultiRouteReferencePoint[]; - } - - interface IMultiRouteParams { - avoidTrafficJams?: boolean; - boundedBy?: number[][] | null; - requestSendInterval?: string | number; - results?: number; - reverseGeocoding?: boolean; - routingMode?: "auto" | "masstransit" | "pedestrian"; - searchCoordOrder?: string; - strictBounds?: boolean; - viaIndexes?: number[]; - } - - type IMultiRouteReferencePoint = string | number[] | geometry.Point; - - interface IOptionManager extends IChild, IEventEmitter, IFreezable { - get(key: string, defaultValue: object): object; - - getAll(): object; - - getName(): string; - - getNative(key: string): object; - - resolve(key: string, name?: string): object; - - setName(name: string): void; - } - - interface IOverlay extends ICustomizable, IDomEventEmitter { - getData(): object; - - getGeometry(): IPixelGeometry; - - getMap(): Map | null; - - getShape(): IShape | null; - - isEmpty(): boolean; - - setData(data: object): void; - - setGeometry(geometry: IPixelGeometry): void; - - setMap(map: Map | null): void; - } - - interface IPane extends IEventEmitter { - destroy(): void; - - getElement(): HTMLElement; - - getMap(): Map; - - getOverflow(): "visible" | "hidden"; - - getZIndex(): number; - } - - interface IPanorama { - getAngularBBox(): number[]; - - getConnectionArrows(): IPanoramaConnectionArrow[]; - - getConnectionMarkers(): IPanoramaConnectionMarker[]; - - getCoordSystem(): ICoordSystem; - - getDefaultDirection(): number[]; - - getDefaultSpan(): number[]; - - getGraph(): IPanoramaGraph | null; - - getMarkers(): IPanoramaMarker[]; - - getName(): string; - - getPosition(): number[]; - - getTileLevels(): IPanoramaTileLevel[]; - - getTileSize(): number[]; - } - - interface IPanoramaConnection { - getConnectedPanorama(): Promise; - } - - interface IPanoramaConnectionArrow extends IPanoramaConnection { - properties: data.Manager; - - getDirection(): number[]; - - getPanorama(): IPanorama; - } - - interface IPanoramaConnectionMarker extends IPanoramaConnection, IPanoramaMarker { //tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface IPanoramaGraph { - getEdges(): IPanoramaGraphEdge[]; - - getNodes(): IPanoramaGraphEdge[]; - - getPanorama(): IPanorama; - } - - interface IPanoramaGraphEdge { - getEndNodes(): IPanoramaGraphNode[]; - } - - interface IPanoramaGraphNode { - getConnectedPanorama(): Promise; - } - - interface IPanoramaMarker { - properties: data.Manager; - - getIconSet(): Promise; - - getPanorama(): IPanorama; - - getPosition(): number[]; - } - - interface IPanoramaMarkerIcon { - image: HTMLCanvasElement | HTMLImageElement; - offset: number[]; - } - - interface IPanoramaMarkerIconSet { - default: IPanoramaMarkerIcon | null; - expanded: IPanoramaMarkerIcon | null; - expandedHovered: IPanoramaMarkerIcon | null; - hovered: IPanoramaMarkerIcon | null; - } - - interface IPanoramaTileLevel { - getImageSize(): number[]; - - getTileUrl(x: number, y: number): string; - } - - interface IParentOnMap { - getMap(): Map; - } - - interface IPixelCircleGeometry extends IPixelGeometry { - getCoordinates(): number[]; - - getRadius(): number; - } - - interface IPixelLineStringGeometry extends IPixelGeometry { - getClosest(anchorPosition: number[]): object; - - getCoordinates(): number[][]; - - getLength(): number; - } - - interface IPixelGeometry extends IBaseGeometry { - equals(geometry: IPixelGeometry): boolean; - - getMetaData(): object; - - scale(factor: number): IPixelGeometry; - - shift(offset: number[]): IPixelGeometry; - } - - interface IPointGeometry extends IGeometry, IPointGeometryAccess { //tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface IPointGeometryAccess { - getCoordinates(): number[] | null; - - setCoordinates(coordinates: number[] | null): this; - } - - interface IPopup extends ICustomizable, IEventEmitter { - close(force?: boolean): Promise; - - getData(): object; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay; - - getPosition(): number[]; - - isOpen(): boolean; - - open(position: number[], data: object | string | HTMLElement): Promise; - - setData(data: object | string | HTMLElement): Promise; - - setPosition(position: number[]): Promise; - } - - interface IPopupManager extends IEventEmitter { - close(force?: boolean): Promise; - - destroy(): void; - - getData(): object | null; - - getOptions(): IOptionManager | null; - - getOverlay(): Promise; - - getOverlaySync(): IOverlay | null; - - getPosition(): number[] | null; - - isOpen(): boolean; - - open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; - - setData(data: object | string | HTMLElement): Promise; - - setOptions(options: object): Promise; - - setPosition(position: number[]): Promise; - } - - interface IPositioningContext { - fromClientPixels(clientPixelPoint: number[]): number[]; - - getZoom(): number; - - toClientPixels(globalPixelPoint: number[]): number[]; - } - - interface IProjection { - fromGlobalPixels(globalPixelPoint: number[], zoom: number): number[]; - - getCoordSystem(): ICoordSystem; - - isCycled(): boolean[]; - - toGlobalPixels(coordPoint: number[], zoom: number): number[]; - } - - interface IRoutePanel { - options: IOptionManager; - state: IDataManager; - - getRoute(): multiRouter.MultiRoute; - - switchPoints(): void; - } - - interface ISearchControlLayout extends IExpandableControlLayout { //tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface ISelectableControl extends IControl { - deselect(): void; - - disable(): void; - - enable(): void; - - isEnabled(): boolean; - - isSelected(): boolean; - - select(): void; - } - - interface ISelectableControlLayout extends ILayout { //tslint:disable-line no-empty-interface no-empty-interfaces - } - - interface IShape { + interface IPolygonGeometryAccess extends IFreezable { contains(position: number[]): boolean; - equals(shape: IShape): boolean; + get(index: number): number[][]; - getBounds(): number[][] | null; + getChildGeometry(index: number): ILinearRingGeometryAccess; - getGeometry(): IPixelGeometry; + getClosest(anchorPosition: number[]): object; - getType(): string; + getCoordinates(): number[][][]; - scale(factor: number): IShape; + getFillRule(): string; - shift(offset: number[]): IShape; + getLength(): number; + + insert(index: number, path: number[][]): IPolygonGeometryAccess; + + remove(index: number): ILinearRingGeometryAccess; + + set(index: number, path: number[][]): IPolygonGeometryAccess; + + setCoordinates(coordinates: number[][][]): IPolygonGeometryAccess; + + setFillRule(fillRule: string): IPolygonGeometryAccess; + + splice(index: number, number: number): ILinearRingGeometryAccess[]; } - class Monitor { - constructor(dataManager: IDataManager | IOptionManager); - add(name: string[] | string, changeCallback: (event: (object | IEvent)) => void, context?: any, params?: any): Monitor; - forceChange(): Monitor; - get(name: string): any; - remove(name: string): Monitor; - removeAll(): Monitor; - } + interface IPopup extends ICustomizable, IEventEmitter { + close(force?: boolean): Promise; - class Polyline extends GeoObject { - constructor(geometry: number[][] | object | ILineStringGeometry, properties: object | IDataManager, options?: IPolylineOptions); - } + getData(): object; - interface IPolylineOptions { - cursor?: string; - [index: string]: any; - } + getOverlay(): Promise; + + getOverlaySync(): IOverlay; + + getPosition(): number[]; + + isOpen(): boolean; + + open(position: number[], data: object | string | HTMLElement): Promise; + + setData(data: object | string | HTMLElement): Promise; + + setPosition(position: number[]): Promise; + } + + interface IPopupManager extends IEventEmitter { + close(force?: boolean): Promise; + + destroy(): void; + + getData(): object | null; + + getOptions(): IOptionManager | null; + + getOverlay(): Promise; + + getOverlaySync(): IOverlay | null; + + getPosition(): number[] | null; + + isOpen(): boolean; + + open(position?: number[], data?: object | string | HTMLElement, options?: object): Promise; + + setData(data: object | string | HTMLElement): Promise; + + setOptions(options: object): Promise; + + setPosition(position: number[]): Promise; + } + + interface IPositioningContext { + fromClientPixels(clientPixelPoint: number[]): number[]; + + getZoom(): number; + + toClientPixels(globalPixelPoint: number[]): number[]; + } + + interface IProjection { + fromGlobalPixels(globalPixelPoint: number[], zoom: number): number[]; + + getCoordSystem(): ICoordSystem; + + isCycled(): boolean[]; + + toGlobalPixels(coordPoint: number[], zoom: number): number[]; + } + + interface IRoutePanel { + options: IOptionManager; + state: IDataManager; + + getRoute(): multiRouter.MultiRoute; + + switchPoints(): void; + } + + interface ISearchControlLayout extends IExpandableControlLayout { //tslint:disable-line no-empty-interface no-empty-interfaces + } + + interface ISelectableControl extends IControl { + deselect(): void; + + disable(): void; + + enable(): void; + + isEnabled(): boolean; + + isSelected(): boolean; + + select(): void; + } + + interface ISelectableControlLayout extends ILayout { //tslint:disable-line no-empty-interface no-empty-interfaces + } + + interface IShape { + contains(position: number[]): boolean; + + equals(shape: IShape): boolean; + + getBounds(): number[][] | null; + + getGeometry(): IPixelGeometry; + + getType(): string; + + scale(factor: number): IShape; + + shift(offset: number[]): IShape; + } + class Monitor { + constructor(dataManager: IDataManager | IOptionManager); + add(name: string[] | string, changeCallback: (event: (object | IEvent)) => void, context?: any, params?: any): Monitor; + forceChange(): Monitor; + get(name: string): any; + remove(name: string): Monitor; + removeAll(): Monitor; + } } From 1d69ae66948c781aa5cabd1e4aad0360dde16161 Mon Sep 17 00:00:00 2001 From: Pascal Sthamer Date: Tue, 11 Dec 2018 17:50:07 +0100 Subject: [PATCH 207/241] dockerode definition update --- types/dockerode/index.d.ts | 261 +++++++++++++++++++++++++++---------- 1 file changed, 194 insertions(+), 67 deletions(-) diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index 5c1c1bfae6..e467441634 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -6,6 +6,8 @@ // Ray Fang // Marius Meisenzahl // Rob Moran +// Cameron Diver +// Pascal Sthamer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -14,8 +16,16 @@ import * as stream from 'stream'; import * as events from 'events'; +// The modem parameter is an instance of docker-modem, which is missing type declarations. +// https://github.com/apocas/docker-modem + declare namespace Dockerode { - interface Container { + class Container { + constructor(modem: any, id: string); + + modem: any; + id: string; + inspect(options: {}, callback: Callback): void; inspect(callback: Callback): void; inspect(options?: {}): Promise; @@ -103,14 +113,16 @@ declare namespace Dockerode { stats(callback: Callback): void; stats(options?: {}): Promise; - attach(options: {}, callback: Callback): void; - attach(options: {}): Promise; - - modem: any; - id?: string; + attach(options: {}, callback: Callback): void; + attach(options: {}): Promise; } - interface Image { + class Image { + constructor(modem: any, name: string); + + modem: any; + id: string; + inspect(callback: Callback): void; inspect(): Promise; @@ -131,24 +143,28 @@ declare namespace Dockerode { remove(options: {}, callback: Callback): void; remove(callback: Callback): void; remove(options?: {}): Promise; - - modem: any; - id?: string; } - interface Volume { + class Volume { + constructor(modem: any, name: string); + + modem: any; + name: string; + inspect(callback: Callback): void; inspect(): Promise; remove(options: {}, callback: Callback): void; remove(callback: Callback): void; remove(options?: {}): Promise; - - modem: any; - name?: string; } - interface Service { + class Service { + constructor(modem: any, id: string); + + modem: any; + id: string; + inspect(callback: Callback): void; inspect(): Promise; @@ -158,20 +174,24 @@ declare namespace Dockerode { update(options: {}, callback: Callback): void; update(options: {}): Promise; - - modem: any; - id?: string; } - interface Task { + class Task { + constructor(modem: any, id: string); + + modem: any; + id: string; + inspect(callback: Callback): void; inspect(): Promise; - - modem: any; - id?: string; } - interface Node { + class Node { + constructor(modem: any, id: string); + + modem: any; + id: string; + inspect(callback: Callback): void; inspect(): Promise; @@ -182,12 +202,11 @@ declare namespace Dockerode { remove(options: {}, callback: Callback): void; remove(callback: Callback): void; remove(options?: {}): Promise; - - modem: any; - id?: string; } - interface Plugin { + class Plugin { + constructor(modem: any, name: string, remote?: any); + modem: any; name: string; remote: any; @@ -226,7 +245,12 @@ declare namespace Dockerode { upgrade(auth: any, options?: {}): Promise; } - interface Secret { + class Secret { + constructor(modem: any, id: string); + + modem: any; + id: string; + inspect(callback: Callback): void; inspect(): Promise; @@ -237,12 +261,14 @@ declare namespace Dockerode { remove(options: {}, callback: Callback): void; remove(callback: Callback): void; remove(options?: {}): Promise; - - modem: any; - id?: string; } - interface Network { + class Network { + constructor(modem: any, id: string); + + modem: any; + id: string; + inspect(callback: Callback): void; inspect(): Promise; @@ -257,12 +283,14 @@ declare namespace Dockerode { disconnect(options: {}, callback: Callback): void; disconnect(callback: Callback): void; disconnect(options?: {}): Promise; - - modem: any; - id?: string; } - interface Exec { + class Exec { + constructor(modem: any, id: string); + + modem: any; + id: string; + inspect(callback: Callback): void; inspect(): Promise; @@ -271,9 +299,6 @@ declare namespace Dockerode { resize(options: {}, callback: Callback): void; resize(options: {}): Promise; - - modem: any; - id?: string; } interface ImageInfo { @@ -328,6 +353,20 @@ declare namespace Dockerode { MacAddress: string; } + // not complete definition of network inspection + // info which is returned by list / inspect + interface NetworkInspectInfo { + Id: string; + Name: string; + Driver: string; + Created: string; + Scope: string; + EnableIPv6: boolean; + Internal: boolean; + Attachable: boolean; + Ingress: boolean; + } + interface ContainerInspectInfo { Id: string; Created: string; @@ -434,13 +473,13 @@ declare namespace Dockerode { } }; Node?: { - ID: string; - IP: string; - Addr: string; - Name: string; - Cpus: number; - Memory: number; - Labels: any; + ID: string; + IP: string; + Addr: string; + Name: string; + Cpus: number; + Memory: number; + Labels: any; } }; } @@ -573,6 +612,77 @@ declare namespace Dockerode { }; } + interface AuthConfig { + username: string; + password: string; + serveraddress: string; + email?: string; + } + + interface PortBinding { + HostIp?: string; + HostPort?: string; + } + + interface PortMap { + [key: string]: PortBinding[]; + } + + interface RestartPolicy { + Name: string; + MaximumRetryCount?: number; + } + + type LoggingDriverType = + | "json-file" + | "syslog" + | "journald" + | "gelf" + | "fluentd" + | "awslogs" + | "splunk" + | "etwlogs" + | "none"; + + interface LogConfig { + Type: LoggingDriverType; + Config?: { [key: string]: string }; + } + + interface DeviceMapping { + PathOnHost: string; + PathInContainer: string; + CgroupPermissions: string; + } + + /* tslint:disable:interface-name */ + interface IPAMConfig { + IPv4Address?: string; + IPv6Address?: string; + LinkLocalIPs?: string[]; + } + /* tslint:enable:interface-name */ + + interface EndpointSettings { + IPAMConfig?: IPAMConfig; + Links?: string[]; + Aliases?: string[]; + NetworkID?: string; + EndpointID?: string; + Gateway?: string; + IPAddress?: string; + IPPrefixLen?: number; + IPv6Gateway?: string; + GlobalIPv6Address?: string; + GlobalIPV6PrefixLen?: number; + MacAddress?: string; + DriverOpts?: { [key: string]: string }; + } + + interface EndpointsConfig { + [key: string]: EndpointSettings; + } + interface ContainerCreateOptions { name?: string; Hostname?: string; @@ -620,7 +730,7 @@ declare namespace Dockerode { OomScoreAdj?: number; PidMode?: string; PidsLimit?: number; - PortBindings?: { [portAndProtocol: string]: Array<{ [index: string]: string }> }; + PortBindings?: PortMap; PublishAllPorts?: boolean; Privileged?: boolean; ReadonlyRootfs?: boolean; @@ -632,31 +742,19 @@ declare namespace Dockerode { CapAdd?: string[]; CapDrop?: string[]; GroupAdd?: string[]; - RestartPolicy?: { [index: string]: number | string }; + RestartPolicy?: RestartPolicy; NetworkMode?: string; - Devices?: any[]; + Devices?: DeviceMapping[]; Sysctls?: { [index: string]: string }; Ulimits?: Array<{}>; - LogConfig?: { [index: string]: string | {} }; + LogConfig?: LogConfig; SecurityOpt?: { [index: string]: any }; CgroupParent?: string; VolumeDriver?: string; ShmSize?: number; }; NetworkingConfig?: { - EndpointsConfig?: { - [index: string]: any; - isolated_nw?: { - [index: string]: any; - IPAMConfig?: { - IPv4Address?: string; - IPv6Adress?: string; - LinkLocalIPs?: string[]; - } - Links?: string[]; - Aliases?: string[]; - } - } + EndpointsConfig?: EndpointsConfig; }; } @@ -820,8 +918,37 @@ declare namespace Dockerode { } interface ImageBuildContext { - context: string; - src: string[]; + context: string; + src: string[]; + } + + interface DockerVersion { + ApiVersion: string; + Arch: string; + BuildTime: Date; + Components: Array<{ + Details: { + ApiVersion: string; + Arch: string; + BuilTime: Date; + Experimental: string; + GitCommit: string; + GoVersion: string; + KernelVersion: string; + Os: string; + }; + Name: string; + Version: string; + }>; + GitCommit: string; + GoVersion: string; + KernelVersion: string; + MinAPIVersion: string; + Os: string; + Platform: { + Name: string; + }; + Version: string; } } @@ -949,8 +1076,8 @@ declare class Dockerode { df(callback: Callback): void; df(): Promise; - version(callback: Callback): void; - version(): Promise; + version(callback: Callback): void; + version(): Promise; ping(callback: Callback): void; ping(): Promise; From e1b2162dce95f3e655cf918b7a9befaebe8fcb78 Mon Sep 17 00:00:00 2001 From: CameronDiver Date: Tue, 11 Dec 2018 18:53:50 +0100 Subject: [PATCH 208/241] Fix typo Co-Authored-By: P4sca1 --- types/dockerode/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index 64656edbb8..3ced325cb2 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -930,7 +930,7 @@ declare namespace Dockerode { Details: { ApiVersion: string; Arch: string; - BuilTime: Date; + BuildTime: Date; Experimental: string; GitCommit: string; GoVersion: string; From 01401844ac7c7824ced00aeb73ea4372d20f4542 Mon Sep 17 00:00:00 2001 From: Pascal Sthamer Date: Tue, 11 Dec 2018 18:57:07 +0100 Subject: [PATCH 209/241] Remove duplicate DockerVersion interface --- types/dockerode/index.d.ts | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index 3ced325cb2..d823c46fe4 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -950,35 +950,6 @@ declare namespace Dockerode { }; Version: string; } - - interface DockerVersion { - ApiVersion: string; - Arch: string; - BuildTime: Date; - Components: Array<{ - Details: { - ApiVersion: string; - Arch: string; - BuilTime: Date; - Experimental: string; - GitCommit: string; - GoVersion: string; - KernelVersion: string; - Os: string; - }; - Name: string; - Version: string; - }>; - GitCommit: string; - GoVersion: string; - KernelVersion: string; - MinAPIVersion: string; - Os: string; - Platform: { - Name: string; - }; - Version: string; - } } type Callback = (error?: any, result?: T) => void; From 291ba3002e9c7c6c0fe8ebf6da7aa9735e765b95 Mon Sep 17 00:00:00 2001 From: Jesse Trinity <42591254+jessetrinity@users.noreply.github.com> Date: Tue, 11 Dec 2018 11:08:16 -0800 Subject: [PATCH 210/241] Clarifying tslint.json content instructions The language and examples surrounding linting of new packages is ambiguous. This makes the language and examples more explicit in an attempt to direct contributors to remove linting rules from tslint.json before opening PRs. --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eba170c493..a9be0471a1 100644 --- a/README.md +++ b/README.md @@ -169,8 +169,14 @@ If a package was never on DefinitelyTyped, it does not need to be added to `notN #### Lint -To lint a package, just add a `tslint.json` to that package containing `{ "extends": "dtslint/dt.json" }`. All new packages must be linted. -If a `tslint.json` turns rules off, this is because that hasn't been fixed yet. For example: +All new packages must be linted. To lint a package, add a `tslint.json` to that package containing +```js +{ + "extends": "dtslint/dt.json" +} +``` + +This should be the only content in a finished project's `tslint.json` file. If a `tslint.json` turns rules off, this is because that hasn't been fixed yet. For example: ```js { From 21ab9421ab77846d826752f7ff14abdab458960a Mon Sep 17 00:00:00 2001 From: Maninder Singh Date: Wed, 12 Dec 2018 01:55:59 +0530 Subject: [PATCH 211/241] Add 'movingOut' param to Dom walker's guard method --- types/ckeditor/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ckeditor/index.d.ts b/types/ckeditor/index.d.ts index 69c23d6a99..2889b30574 100644 --- a/types/ckeditor/index.d.ts +++ b/types/ckeditor/index.d.ts @@ -498,7 +498,7 @@ declare namespace CKEDITOR { class walker { evaluator: (node: node) => boolean; - guard: (node: node) => boolean; + guard: (node: node, movingOut?: boolean) => boolean; static validEmptyBlockContainers: { [key: string]: any }; From f4d137c459d2c7ff2532cec76d5814b9cea7158d Mon Sep 17 00:00:00 2001 From: David Brett Date: Tue, 11 Dec 2018 16:51:05 -0500 Subject: [PATCH 212/241] PR Feedback - linting and missing export --- types/multi-progress/index.d.ts | 6 +- types/multi-progress/multi-progress-tests.ts | 6 +- types/multi-progress/tsconfig.json | 2 +- types/multi-progress/tslint.json | 77 +------------------- 4 files changed, 8 insertions(+), 83 deletions(-) diff --git a/types/multi-progress/index.d.ts b/types/multi-progress/index.d.ts index e1ae12a4e0..ebedcf9597 100644 --- a/types/multi-progress/index.d.ts +++ b/types/multi-progress/index.d.ts @@ -1,14 +1,14 @@ -// Type definitions for multi-progress v2.0.0 +// Type definitions for multi-progress 2.0 // Project: https://github.com/pitaj/multi-progress // Definitions by: David Brett // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -import ProgressBar, { ProgressBarOptions } from '../progress' +import ProgressBar, { ProgressBarOptions } from '../progress'; import { Stream } from 'stream'; -declare class MultiProgress { +export default class MultiProgress { /** * Create a new @see MultiProgress with the given stream, or stderr by default * @param stream A stream to write the progress bars to diff --git a/types/multi-progress/multi-progress-tests.ts b/types/multi-progress/multi-progress-tests.ts index 3397a48428..9dde27c16b 100644 --- a/types/multi-progress/multi-progress-tests.ts +++ b/types/multi-progress/multi-progress-tests.ts @@ -3,14 +3,14 @@ */ // require the library -var MultiProgress = require("multi-progress"); +import MultiProgress from 'multi-progress'; // spawn an instance with the optional stream to write to // use of `new` is optional -var multi = new MultiProgress(process.stderr); +const multi = new MultiProgress(process.stderr); // create a progress bar -var bar = multi.newBar(' downloading [:bar] :percent :etas', { +const bar = multi.newBar(' downloading [:bar] :percent :etas', { complete: '=', incomplete: ' ', width: 30, diff --git a/types/multi-progress/tsconfig.json b/types/multi-progress/tsconfig.json index 72100a32f7..3f0dc36371 100644 --- a/types/multi-progress/tsconfig.json +++ b/types/multi-progress/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/multi-progress/tslint.json b/types/multi-progress/tslint.json index a41bf5d19a..1a60b8a5dd 100644 --- a/types/multi-progress/tslint.json +++ b/types/multi-progress/tslint.json @@ -1,79 +1,4 @@ { "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 - } + "rules": { } } From d5d8a4429bc0b1d0895e8f1dd2b915e9c1860ea8 Mon Sep 17 00:00:00 2001 From: jb1361 Date: Tue, 11 Dec 2018 17:25:33 -0500 Subject: [PATCH 213/241] Update styles interface --- types/react-burger-menu/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react-burger-menu/index.d.ts b/types/react-burger-menu/index.d.ts index 85d49494c2..544dd84aec 100644 --- a/types/react-burger-menu/index.d.ts +++ b/types/react-burger-menu/index.d.ts @@ -16,6 +16,7 @@ export interface Styles { bmCross: Partial; bmCrossButton: Partial; bmItemList: Partial; + bmMenuWrap: Partial; bmMenu: Partial; bmMorphShape: Partial; bmOverlay: Partial; From bd464573d7946e481a041858165b1e7a2c19a1b8 Mon Sep 17 00:00:00 2001 From: Joshua O'Brien Date: Wed, 12 Dec 2018 11:24:32 +1100 Subject: [PATCH 214/241] fix(gapi.people): replace deprecated RequestMask with PersonFields --- types/gapi.people/gapi.people-tests.ts | 1 + types/gapi.people/index.d.ts | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/types/gapi.people/gapi.people-tests.ts b/types/gapi.people/gapi.people-tests.ts index 65b6339765..349f956b39 100644 --- a/types/gapi.people/gapi.people-tests.ts +++ b/types/gapi.people/gapi.people-tests.ts @@ -64,6 +64,7 @@ var request = gapi.client.people.people.connections.list({ 'resourceName': 'people/me', 'pageSize': 10, + 'personFields': 'names' }); request.execute(function(resp) { diff --git a/types/gapi.people/index.d.ts b/types/gapi.people/index.d.ts index 851eab2c0b..d39dc0b875 100644 --- a/types/gapi.people/index.d.ts +++ b/types/gapi.people/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Google People API 1.0 // Project: https://developers.google.com/people/ // Definitions by: Tanguy Krotoff +// Joshua O'Brien // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -13,7 +14,7 @@ declare namespace gapi.client.people { resourceName: string; // Query parameters - requestMask?: RequestMask; + personFields: string; } function get(parameters: GetParameters): HttpRequest; @@ -21,7 +22,7 @@ declare namespace gapi.client.people { interface GetBatchGetParameters { // Query parameters resourcesName?: string; - requestMask?: RequestMask; + personFields: string; } function getBatchGet(parameters: GetBatchGetParameters): HttpRequest; @@ -49,7 +50,7 @@ declare namespace gapi.client.people { pageSize?: number; sortOrder?: SortOrder; syncToken?: string; - requestMask?: RequestMask; + personFields: string; } interface Response { @@ -60,10 +61,6 @@ declare namespace gapi.client.people { } } - interface RequestMask { - includeField: string; - } - type SourceType = 'SOURCE_TYPE_UNSPECIFIED' | 'ACCOUNT' | 'PROFILE' | 'DOMAIN_PROFILE' | 'CONTACT'; interface Source { From dd92d2da9b7184766f41a8b6c07bb93e58d8c1d8 Mon Sep 17 00:00:00 2001 From: Joshua O'Brien Date: Wed, 12 Dec 2018 11:54:59 +1100 Subject: [PATCH 215/241] Refactor gapi and gapi.auth2 tests to account for changes in gapi.people definitions --- types/gapi.auth2/gapi.auth2-tests.ts | 3 ++- types/gapi/gapi-tests.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/gapi.auth2/gapi.auth2-tests.ts b/types/gapi.auth2/gapi.auth2-tests.ts index 1fc03f7f4f..229a18f5fc 100644 --- a/types/gapi.auth2/gapi.auth2-tests.ts +++ b/types/gapi.auth2/gapi.auth2-tests.ts @@ -144,7 +144,8 @@ function handleSignoutClick(event: MouseEvent) { // Load the API and make an API call. Display the results on the screen. function makeApiCall() { gapi.client.people.people.get({ - resourceName: 'people/me' + resourceName: 'people/me', + personFields: 'names' }).then((resp) => { const p = document.createElement('p'); const name = resp.result.names[0].givenName; diff --git a/types/gapi/gapi-tests.ts b/types/gapi/gapi-tests.ts index 7c5308aaf9..0de37fdccb 100644 --- a/types/gapi/gapi-tests.ts +++ b/types/gapi/gapi-tests.ts @@ -20,7 +20,8 @@ https://developers.google.com/api-client-library/javascript/reference/referenced }).then(function() { // 3. Initialize and make the API request. return gapi.client.people.people.get({ - resourceName: 'people/me' + resourceName: 'people/me', + personFields: 'name' }); }).then(function(response) { console.log(response.result); From 5bcb6eca220081d0cd6f81b29232956f969db8de Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Wed, 12 Dec 2018 15:56:05 +1100 Subject: [PATCH 216/241] fix(react-router): match is only null for function child (#31278) * fix(react-router): match is only null for function child * fix(react-router): explicitly export interface (strict-export-declare-modifiers) --- types/react-router/index.d.ts | 13 +++++++++++-- types/react-router/test/Children.tsx | 6 ++++++ .../Ambiguous.tsx | 2 +- .../Animation.tsx | 6 +++--- .../examples-from-react-router-website/Basic.tsx | 4 ++-- .../ModalGallery.tsx | 8 -------- .../examples-from-react-router-website/Params.tsx | 2 +- .../Recursive.tsx | 4 ---- 8 files changed, 24 insertions(+), 21 deletions(-) diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index fff900d458..eee1b15972 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -68,15 +68,24 @@ export interface StaticContext { export interface RouteComponentProps { history: H.History; location: H.Location; - match: match | null; + match: match; staticContext?: C; } +export interface RouteChildrenProps< + Params extends { [K in keyof Params]?: string } = {}, + S = H.LocationState +> { + history: H.History; + location: H.Location; + match: match | null; +} + export interface RouteProps { location?: H.Location; component?: React.ComponentType> | React.ComponentType; render?: ((props: RouteComponentProps) => React.ReactNode); - children?: ((props: RouteComponentProps) => React.ReactNode) | React.ReactNode; + children?: ((props: RouteChildrenProps) => React.ReactNode) | React.ReactNode; path?: string | string[]; exact?: boolean; sensitive?: boolean; diff --git a/types/react-router/test/Children.tsx b/types/react-router/test/Children.tsx index c3dea4f482..7f33629f3c 100644 --- a/types/react-router/test/Children.tsx +++ b/types/react-router/test/Children.tsx @@ -20,3 +20,9 @@ function RouteWithElementJsxChildren() { {
    Hello!
    } ; } + +function RouteWithFunctionChildrenUsingNullableMatch() { + return + {({ match }) => match !== null ?
    Matched path: {match.path}
    :
    No match!
    } +
    ; +} diff --git a/types/react-router/test/examples-from-react-router-website/Ambiguous.tsx b/types/react-router/test/examples-from-react-router-website/Ambiguous.tsx index 3f2dbc2223..6e6598fd71 100644 --- a/types/react-router/test/examples-from-react-router-website/Ambiguous.tsx +++ b/types/react-router/test/examples-from-react-router-website/Ambiguous.tsx @@ -41,7 +41,7 @@ const AmbiguousExample = () => ( const About = () =>

    About

    ; const Company = () =>

    Company

    ; -const User: React.SFC> = ({ match }) => match && ( +const User: React.SFC> = ({ match }) => (

    User: {match.params.user}

    diff --git a/types/react-router/test/examples-from-react-router-website/Animation.tsx b/types/react-router/test/examples-from-react-router-website/Animation.tsx index 306ad14ea4..8133528179 100644 --- a/types/react-router/test/examples-from-react-router-website/Animation.tsx +++ b/types/react-router/test/examples-from-react-router-website/Animation.tsx @@ -72,12 +72,12 @@ interface HSLParams { l: string; } -const HSL: React.SFC> = ({ match }) => match && ( +const HSL: React.SFC> = ({ match: { params } }) => (
    hsl({match.params.h}, {match.params.s}%, {match.params.l}%)
    + background: `hsl(${params.h}, ${params.s}%, ${params.l}%)` + }}>hsl({params.h}, {params.s}%, {params.l}%) ); const styles: any = {}; diff --git a/types/react-router/test/examples-from-react-router-website/Basic.tsx b/types/react-router/test/examples-from-react-router-website/Basic.tsx index 05e2101f85..ba6a5eabe5 100644 --- a/types/react-router/test/examples-from-react-router-website/Basic.tsx +++ b/types/react-router/test/examples-from-react-router-website/Basic.tsx @@ -36,7 +36,7 @@ const About = () => ( ); -const Topics: React.SFC = ({ match }) => match === null ? null : ( +const Topics: React.SFC = ({ match }) => (

    Topics

      @@ -64,7 +64,7 @@ const Topics: React.SFC = ({ match }) => match === null ? n
    ); -const Topic: React.SFC> = ({ match }) => match && ( +const Topic: React.SFC> = ({ match }) => (

    {match.params.topicId}

    diff --git a/types/react-router/test/examples-from-react-router-website/ModalGallery.tsx b/types/react-router/test/examples-from-react-router-website/ModalGallery.tsx index be9bd1c322..c51d63ac0f 100644 --- a/types/react-router/test/examples-from-react-router-website/ModalGallery.tsx +++ b/types/react-router/test/examples-from-react-router-website/ModalGallery.tsx @@ -114,10 +114,6 @@ const Gallery = () => ( ); const ImageView: React.SFC> = ({ match }) => { - if (!match) { - return null; - } - const image = IMAGES[parseInt(match.params.id, 10)]; if (!image) { return
    Image not found
    ; @@ -132,10 +128,6 @@ const ImageView: React.SFC> = ({ match }) => }; const Modal: React.SFC> = ({ match, history }) => { - if (!match) { - return null; - } - const image = IMAGES[parseInt(match.params.id, 10)]; if (!image) { return null; diff --git a/types/react-router/test/examples-from-react-router-website/Params.tsx b/types/react-router/test/examples-from-react-router-website/Params.tsx index 801a889d79..a6d0bded7f 100644 --- a/types/react-router/test/examples-from-react-router-website/Params.tsx +++ b/types/react-router/test/examples-from-react-router-website/Params.tsx @@ -22,7 +22,7 @@ const ParamsExample = () => ( ); -const Child: React.SFC> = ({ match }) => match && ( +const Child: React.SFC> = ({ match }) => (

    ID: {match.params.id}

    diff --git a/types/react-router/test/examples-from-react-router-website/Recursive.tsx b/types/react-router/test/examples-from-react-router-website/Recursive.tsx index 9489d2fb25..534fe52931 100644 --- a/types/react-router/test/examples-from-react-router-website/Recursive.tsx +++ b/types/react-router/test/examples-from-react-router-website/Recursive.tsx @@ -39,10 +39,6 @@ interface InitialPersonProps { type PersonProps = RouteComponentProps<{ id: string }>; const Person: React.SFC = ({ match }) => { - if (!match) { - return null; - } - const person = find(match.params.id); return ( From c2367fab52cf48fafa9daa915f0714a81d3c122f Mon Sep 17 00:00:00 2001 From: Ferdy Budhidharma Date: Tue, 11 Dec 2018 22:57:32 -0600 Subject: [PATCH 217/241] [react] allow weaker prop declarations for nullish properties (#31280) * feat(react): allow weaker prop declarations for nullish properties * fix tests --- types/prop-types/index.d.ts | 16 ++++++++------ types/prop-types/prop-types-tests.ts | 31 ++++++++++------------------ types/react/index.d.ts | 16 ++++++++++---- types/react/test/tsx.tsx | 25 ++++++++++++++++++++++ 4 files changed, 58 insertions(+), 30 deletions(-) diff --git a/types/prop-types/index.d.ts b/types/prop-types/index.d.ts index b6918d9d44..5f95d354dd 100644 --- a/types/prop-types/index.d.ts +++ b/types/prop-types/index.d.ts @@ -5,11 +5,15 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 +export type ReactComponentLike = + | string + | ((props: any, context?: any) => any) + | (new (props: any, context?: any) => any); + export interface ReactElementLike { - type: string | ((...args: any[]) => ReactElementLike); + type: ReactComponentLike; props: any; key: string | number | null; - children?: ReactNodeLike; } export interface ReactNodeArray extends Array {} @@ -28,9 +32,9 @@ export const nominalTypeHack: unique symbol; export type IsOptional = undefined | null extends T ? true : undefined extends T ? true : null extends T ? true : false; -export type RequiredKeys = { [K in keyof V]: V[K] extends Validator ? IsOptional extends true ? never : K : never }[keyof V]; +export type RequiredKeys = { [K in keyof V]-?: Exclude extends Validator ? IsOptional extends true ? never : K : never }[keyof V]; export type OptionalKeys = Exclude>; -export type InferPropsInner = { [K in keyof V]: InferType; }; +export type InferPropsInner = { [K in keyof V]-?: InferType; }; export interface Validator { (props: object, propName: string, componentName: string, location: string, propFullName: string): Error | null; @@ -45,8 +49,8 @@ export type ValidationMap = { [K in keyof T]?: Validator }; export type InferType = V extends Validator ? T : any; export type InferProps = - & (RequiredKeys extends undefined ? {} : InferPropsInner>>) - & (OptionalKeys extends undefined ? {} : Partial>>>); + & InferPropsInner>> + & Partial>>>; export const any: Requireable; export const array: Requireable; diff --git a/types/prop-types/prop-types-tests.ts b/types/prop-types/prop-types-tests.ts index a9bde3af00..baf210fdeb 100644 --- a/types/prop-types/prop-types-tests.ts +++ b/types/prop-types/prop-types-tests.ts @@ -129,35 +129,26 @@ type ExtractedPartialProps = PropTypes.InferProps; type ExtractedPropsWithoutAnnotation = PropTypes.InferProps; type ExtractedPropsFromOuterPropsWithoutAnnotation = PropTypes.InferProps['props']; -// $ExpectType: true +// $ExpectType true type ExtractPropsMatch = ExtractedProps extends ExtractedPropsWithoutAnnotation ? true : false; -// $ExpectType: true +// $ExpectType true type ExtractPropsMatch2 = ExtractedPropsWithoutAnnotation extends ExtractedProps ? true : false; -// $ExpectType: true +// $ExpectType true type ExtractPropsMatch3 = ExtractedProps extends Props ? true : false; -// $ExpectType: true +// $ExpectType true type ExtractPropsMatch4 = Props extends ExtractedPropsWithoutAnnotation ? true : false; -// $ExpectType: true +// $ExpectType true type ExtractFromOuterPropsMatch = ExtractedPropsFromOuterProps extends ExtractedPropsFromOuterPropsWithoutAnnotation ? true : false; -// $ExpectType: true +// $ExpectType true type ExtractFromOuterPropsMatch2 = ExtractedPropsFromOuterPropsWithoutAnnotation extends ExtractedPropsFromOuterProps ? true : false; -// $ExpectType: true +// $ExpectType true type ExtractFromOuterPropsMatch3 = ExtractedPropsFromOuterProps extends Props ? true : false; -// $ExpectType: true +// $ExpectType true type ExtractFromOuterPropsMatch4 = Props extends ExtractedPropsFromOuterPropsWithoutAnnotation ? true : false; -// $ExpectType: false +// $ExpectType false type ExtractPropsMismatch = ExtractedPartialProps extends Props ? true : false; -// $ExpectType: {} -type UnmatchedPropKeys = Pick>; -// $ExpectType: {} -type UnmatchedPropKeys2 = Pick>; - PropTypes.checkPropTypes({ xs: PropTypes.array }, { xs: [] }, 'location', 'componentName'); // This would be the type that JSX sees @@ -189,7 +180,7 @@ const componentDefaultProps = { type DefaultizedProps = Defaultize, typeof componentDefaultProps>; type UndefaultizedProps = Undefaultize, typeof componentDefaultProps>; -// $ExpectType: true +// $ExpectType true type DefaultizedPropsTest = { fi?: (...args: any[]) => any; foo?: string | null; @@ -197,7 +188,7 @@ type DefaultizedPropsTest = { baz?: boolean | null; bat?: ReactNode; } extends DefaultizedProps ? true : false; -// $ExpectType: true +// $ExpectType true type UndefaultizedPropsTest = { fi: (...args: any[]) => any; foo?: string | null; diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 4f6e7c174b..b9a460095a 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -298,7 +298,7 @@ declare namespace React { } interface ProviderExoticComponent

    extends ExoticComponent

    { - propTypes?: ValidationMap

    ; + propTypes?: WeakValidationMap

    ; } type ContextType> = C extends Context ? T : never; @@ -461,7 +461,7 @@ declare namespace React { interface FunctionComponent

    { (props: P & { children?: ReactNode }, context?: any): ReactElement | null; - propTypes?: ValidationMap

    ; + propTypes?: WeakValidationMap

    ; contextTypes?: ValidationMap; defaultProps?: Partial

    ; displayName?: string; @@ -469,7 +469,7 @@ declare namespace React { interface RefForwardingComponent { (props: P & { children?: ReactNode }, ref: Ref | null): ReactElement | null; - propTypes?: ValidationMap

    ; + propTypes?: WeakValidationMap

    ; contextTypes?: ValidationMap; defaultProps?: Partial

    ; displayName?: string; @@ -477,7 +477,7 @@ declare namespace React { interface ComponentClass

    extends StaticLifecycle { new (props: P, context?: any): Component; - propTypes?: ValidationMap

    ; + propTypes?: WeakValidationMap

    ; contextType?: Context; contextTypes?: ValidationMap; childContextTypes?: ValidationMap; @@ -2558,6 +2558,14 @@ declare namespace React { type ValidationMap = PropTypes.ValidationMap; + type WeakValidationMap = { + [K in keyof T]?: null extends T[K] + ? Validator + : undefined extends T[K] + ? Validator + : Validator + }; + interface ReactPropTypes { any: typeof PropTypes.any; array: typeof PropTypes.array; diff --git a/types/react/test/tsx.tsx b/types/react/test/tsx.tsx index 60fcb6dccc..9309799de7 100644 --- a/types/react/test/tsx.tsx +++ b/types/react/test/tsx.tsx @@ -345,3 +345,28 @@ declare global { } const CustomElement2: React.ReactType = 'my-declared-element'; + +interface TestPropTypesProps { + foo: string; +} +interface TestPropTypesProps1 { + foo?: string; +} +interface TestPropTypesProps2 { + foo: string | null; +} +interface TestPropTypesProps3 { + foo?: string | null; +} +const testPropTypes = { + foo: PropTypes.string +}; +type DeclaredPropTypes

    = Required['propTypes'], undefined>>; +// $ExpectType false +type propTypesTest = typeof testPropTypes extends DeclaredPropTypes ? true : false; +// $ExpectType true +type propTypesTest1 = typeof testPropTypes extends DeclaredPropTypes ? true : false; +// $ExpectType true +type propTypesTest2 = typeof testPropTypes extends DeclaredPropTypes ? true : false; +// $ExpectType true +type propTypesTest3 = typeof testPropTypes extends DeclaredPropTypes ? true : false; From 4b54a710074b94bbce5df1359781fc853b50293c Mon Sep 17 00:00:00 2001 From: Maninder Singh Date: Wed, 12 Dec 2018 11:21:14 +0530 Subject: [PATCH 218/241] Add UT to test updated DOM walker's guard property --- types/ckeditor/ckeditor-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/ckeditor/ckeditor-tests.ts b/types/ckeditor/ckeditor-tests.ts index 6a0b50a4d8..31c658b801 100644 --- a/types/ckeditor/ckeditor-tests.ts +++ b/types/ckeditor/ckeditor-tests.ts @@ -369,6 +369,7 @@ function test_dom_walker() { node = walker.lastForward(); node = walker.next(); node = walker.previous(); + isSomething = walker.guard(node, true); walker.reset(); isSomething = CKEDITOR.dom.walker.blockBoundary({ div: 1 })(node); From e355f9a29f395b74f9a0dad004ada8dec064744a Mon Sep 17 00:00:00 2001 From: Maninder Singh Date: Wed, 12 Dec 2018 11:39:59 +0530 Subject: [PATCH 219/241] Fix lint error for CKEditor --- types/ckeditor/ckeditor-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ckeditor/ckeditor-tests.ts b/types/ckeditor/ckeditor-tests.ts index 31c658b801..7e224ab683 100644 --- a/types/ckeditor/ckeditor-tests.ts +++ b/types/ckeditor/ckeditor-tests.ts @@ -486,7 +486,7 @@ function test_dialog() { { id: 'tab-basic', label: 'Basic Settings', - elements: [] + elements: [] as any [] }, { id: 'tab-adv', From 354829f2f744b1d8968ac0ca715190e399aef0b8 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Sat, 8 Dec 2018 12:39:23 +0100 Subject: [PATCH 220/241] Add types for experimental worker_threads module --- types/node/index.d.ts | 125 +++++++++++++++++++++++++++++++++++++++ types/node/node-tests.ts | 51 ++++++++++++++++ 2 files changed, 176 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index b9edae0587..9b93fe213a 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1618,6 +1618,131 @@ declare module "cluster" { function eventNames(): string[]; } +declare module "worker_threads" { + import { EventEmitter } from "events"; + import { Readable, Writable } from "stream"; + + const isMainThread: boolean; + const parentPort: null | MessagePort; + const threadId: number; + const workerData: any; + + class MessageChannel { + readonly port1: MessagePort; + readonly port2: MessagePort; + } + + class MessagePort extends EventEmitter { + close(): void; + postMessage(value: any, transferList?: Array): void; + ref(): void; + unref(): void; + start(): void; + + addListener(event: "close", listener: () => void): this; + addListener(event: "message", listener: (value: any) => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + + emit(event: "close"): boolean; + emit(event: "message", value: any): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + + on(event: "close", listener: () => void): this; + on(event: "message", listener: (value: any) => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + + once(event: "close", listener: () => void): this; + once(event: "message", listener: (value: any) => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + + prependListener(event: "close", listener: () => void): this; + prependListener(event: "message", listener: (value: any) => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + + prependOnceListener(event: "close", listener: () => void): this; + prependOnceListener(event: "message", listener: (value: any) => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + + removeListener(event: "close", listener: () => void): this; + removeListener(event: "message", listener: (value: any) => void): this; + removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + + off(event: "close", listener: () => void): this; + off(event: "message", listener: (value: any) => void): this; + off(event: string | symbol, listener: (...args: any[]) => void): this; + } + + interface WorkerOptions { + eval?: boolean; + workerData?: any; + stdin?: boolean; + stdout?: boolean; + stderr?: boolean; + } + + class Worker extends EventEmitter { + readonly stdin: Writable | null; + readonly stdout: Readable; + readonly stderr: Readable; + readonly threadId: number; + + constructor(filename: string, options?: WorkerOptions); + + postMessage(value: any, transferList?: Array): void; + ref(): void; + unref(): void; + terminate(callback?: (err: any, exitCode: number) => void): void; + + addListener(event: "error", listener: (err: any) => void): this; + addListener(event: "exit", listener: (exitCode: number) => void): this; + addListener(event: "message", listener: (value: any) => void): this; + addListener(event: "online", listener: () => void): this; + addListener(event: string | symbol, listener: (...args: any[]) => void): this; + + emit(event: "error", err: any): boolean; + emit(event: "exit", exitCode: number): boolean; + emit(event: "message", value: any): boolean; + emit(event: "online"): boolean; + emit(event: string | symbol, ...args: any[]): boolean; + + on(event: "error", listener: (err: any) => void): this; + on(event: "exit", listener: (exitCode: number) => void): this; + on(event: "message", listener: (value: any) => void): this; + on(event: "online", listener: () => void): this; + on(event: string | symbol, listener: (...args: any[]) => void): this; + + once(event: "error", listener: (err: any) => void): this; + once(event: "exit", listener: (exitCode: number) => void): this; + once(event: "message", listener: (value: any) => void): this; + once(event: "online", listener: () => void): this; + once(event: string | symbol, listener: (...args: any[]) => void): this; + + prependListener(event: "error", listener: (err: any) => void): this; + prependListener(event: "exit", listener: (exitCode: number) => void): this; + prependListener(event: "message", listener: (value: any) => void): this; + prependListener(event: "online", listener: () => void): this; + prependListener(event: string | symbol, listener: (...args: any[]) => void): this; + + prependOnceListener(event: "error", listener: (err: any) => void): this; + prependOnceListener(event: "exit", listener: (exitCode: number) => void): this; + prependOnceListener(event: "message", listener: (value: any) => void): this; + prependOnceListener(event: "online", listener: () => void): this; + prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; + + removeListener(event: "error", listener: (err: any) => void): this; + removeListener(event: "exit", listener: (exitCode: number) => void): this; + removeListener(event: "message", listener: (value: any) => void): this; + removeListener(event: "online", listener: () => void): this; + removeListener(event: string | symbol, listener: (...args: any[]) => void): this; + + off(event: "error", listener: (err: any) => void): this; + off(event: "exit", listener: (exitCode: number) => void): this; + off(event: "message", listener: (value: any) => void): this; + off(event: "online", listener: () => void): this; + off(event: string | symbol, listener: (...args: any[]) => void): this; + } +} + declare module "zlib" { import * as stream from "stream"; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index c0f80728fc..a638f0fee8 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -17,6 +17,7 @@ import * as path from "path"; import * as readline from "readline"; import * as childProcess from "child_process"; import * as cluster from "cluster"; +import * as workerThreads from "worker_threads"; import * as os from "os"; import * as vm from "vm"; import * as console2 from "console"; @@ -2932,6 +2933,56 @@ async function asyncStreamPipelineFinished() { } } +////////////////////////////////////////////////////////////////////// +/// worker_threads tests: https://nodejs.org/api/worker_threads.html /// +////////////////////////////////////////////////////////////////////// + +{ + { + if (workerThreads.isMainThread) { + module.exports = async function parseJSAsync(script: string) { + return new Promise((resolve, reject) => { + const worker = new workerThreads.Worker(__filename, { + workerData: script + }); + worker.on('message', resolve); + worker.on('error', reject); + worker.on('exit', (code) => { + if (code !== 0) + reject(new Error(`Worker stopped with exit code ${code}`)); + }); + }); + }; + } else { + const script = workerThreads.workerData; + workerThreads.parentPort.postMessage(script); + } + } + + { + const { port1, port2 } = new workerThreads.MessageChannel(); + port1.on('message', (message) => console.log('received', message)); + port2.postMessage({ foo: 'bar' }); + } + + { + if (workerThreads.isMainThread) { + const worker = new workerThreads.Worker(__filename); + const subChannel = new workerThreads.MessageChannel(); + worker.postMessage({ hereIsYourPort: subChannel.port1 }, [subChannel.port1]); + subChannel.port2.on('message', (value) => { + console.log('received:', value); + }); + } else { + workerThreads.parentPort.once('message', (value) => { + assert(value.hereIsYourPort instanceof MessagePort); + value.hereIsYourPort.postMessage('the worker is sending this'); + value.hereIsYourPort.close(); + }); + } + } +} + //////////////////////////////////////////////////// /// os tests : https://nodejs.org/api/os.html //////////////////////////////////////////////////// From cca60bd5447b1d86d3c296c995c766de7c2ea3d5 Mon Sep 17 00:00:00 2001 From: UrielCh Date: Wed, 12 Dec 2018 10:46:22 +0200 Subject: [PATCH 221/241] Add Document as JQuery.contents() output encapsulated type. (#31296) $('iframe').contents() is a JQuery; --- types/jquery/JQuery.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/jquery/JQuery.d.ts b/types/jquery/JQuery.d.ts index 123fad3b34..78602a2d8b 100644 --- a/types/jquery/JQuery.d.ts +++ b/types/jquery/JQuery.d.ts @@ -2090,7 +2090,7 @@ $( "#frameDemo" ).contents().find( "a" ).css( "background-color", "#BADA55" ); ``` */ - contents(): JQuery; + contents(): JQuery; /** * Bind an event handler to the "contextmenu" JavaScript event, or trigger that event on an element. * @param eventData An object containing data that will be passed to the event handler. From 00262b050a466fead06c973b08395b981ac48581 Mon Sep 17 00:00:00 2001 From: Tomas Hubelbauer Date: Wed, 12 Dec 2018 10:08:00 +0100 Subject: [PATCH 222/241] Add movementX and movementY to MouseEvent React now polyfills `movementX` and `movementY`, see facebook/react#6723. --- types/react/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index b9a460095a..c40df0db5b 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -1013,6 +1013,8 @@ declare namespace React { */ getModifierState(key: string): boolean; metaKey: boolean; + movementX: number; + movementY: number; nativeEvent: NativeMouseEvent; pageX: number; pageY: number; From c73305cc54f9ad601b68cd9289f127671de01cd8 Mon Sep 17 00:00:00 2001 From: Pascal Sthamer Date: Wed, 12 Dec 2018 12:42:20 +0100 Subject: [PATCH 223/241] Include container.stats types --- types/dockerode/index.d.ts | 83 +++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index d823c46fe4..6a988ba5c2 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -470,7 +470,7 @@ declare namespace Dockerode { GlobalIPv6Address: string; GlobalIPv6PrefixLen: number; MacAddress: string; - } + }; }; Node?: { ID: string; @@ -480,10 +480,89 @@ declare namespace Dockerode { Cpus: number; Memory: number; Labels: any; - } + }; }; } + + interface NetworkStats { + [name: string]: { + rx_bytes: number; + rx_dropped: number; + rx_errors: number; + rx_packets: number; + tx_bytes: number; + tx_dropped: number; + tx_errors: number; + tx_packets: number; + }; + } + interface CPUStats { + cpu_usage: { + percpu_usage: Array; + usage_in_usermode: number; + total_usage: number; + usage_in_kernelmode: number; + }; + system_cpu_usage: number; + online_cpus: number; + throttling_data: { + periods: number; + throttled_periods: number; + throttled_time: number; + }; + } + + interface MemoryStats { + stats: { + total_pgmajfault: number; + cache: number; + mapped_file: number; + total_inactive_file: number; + pgpgout: number; + rss: number; + total_mapped_file: number; + writeback: number; + unevictable: number; + pgpgin: number; + total_unevictable: number; + pgmajfault: number; + total_rss: number; + total_rss_huge: number; + total_writeback: number; + total_inactive_anon: number; + rss_huge: number; + hierarchical_memory_limit: number; + total_pgfault: number; + total_active_file: number; + active_anon: number; + total_active_anon: number; + total_pgpgout: number; + total_cache: number; + inactive_anon: number; + active_file: number; + pgfault: number; + inactive_file: number; + total_pgpgin: number; + }; + max_usage: number; + usage: number; + failcnt: number; + limit: number; + } + + interface ContainerStats { + read: string; + pid_stats: { + current: number; + }; + networks: NetworkStats; + memory_stats: MemoryStats; + blkio_stats: {}; + cpu_stats: CPUStats; + precpu_stats: CPUStats; + } + interface HostConfig { AutoRemove: boolean; Binds: string[]; From cea66cd28fc108a0328b8c9b407007c6ac9aa2f8 Mon Sep 17 00:00:00 2001 From: Pascal Sthamer Date: Wed, 12 Dec 2018 12:44:19 +0100 Subject: [PATCH 224/241] Forgot to update return types --- types/dockerode/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index 6a988ba5c2..1dd099f1c3 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -109,9 +109,9 @@ declare namespace Dockerode { logs(callback: Callback): void; logs(options?: ContainerLogsOptions): Promise; - stats(options: {}, callback: Callback): void; - stats(callback: Callback): void; - stats(options?: {}): Promise; + stats(options: {}, callback: Callback): void; + stats(callback: Callback): void; + stats(options?: {}): Promise; attach(options: {}, callback: Callback): void; attach(options: {}): Promise; From ba36ee16316092fa2e83c2ec70b658c37a19db1e Mon Sep 17 00:00:00 2001 From: Pascal Sthamer Date: Wed, 12 Dec 2018 12:53:43 +0100 Subject: [PATCH 225/241] Fix tslint error --- types/dockerode/index.d.ts | 152 ++++++++++++++++++------------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index 1dd099f1c3..694cc295b4 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -483,86 +483,86 @@ declare namespace Dockerode { }; }; } - + interface NetworkStats { - [name: string]: { - rx_bytes: number; - rx_dropped: number; - rx_errors: number; - rx_packets: number; - tx_bytes: number; - tx_dropped: number; - tx_errors: number; - tx_packets: number; - }; - } + [name: string]: { + rx_bytes: number; + rx_dropped: number; + rx_errors: number; + rx_packets: number; + tx_bytes: number; + tx_dropped: number; + tx_errors: number; + tx_packets: number; + }; + } - interface CPUStats { - cpu_usage: { - percpu_usage: Array; - usage_in_usermode: number; - total_usage: number; - usage_in_kernelmode: number; - }; - system_cpu_usage: number; - online_cpus: number; - throttling_data: { - periods: number; - throttled_periods: number; - throttled_time: number; - }; - } + interface CPUStats { + cpu_usage: { + percpu_usage: number[]; + usage_in_usermode: number; + total_usage: number; + usage_in_kernelmode: number; + }; + system_cpu_usage: number; + online_cpus: number; + throttling_data: { + periods: number; + throttled_periods: number; + throttled_time: number; + }; + } - interface MemoryStats { - stats: { - total_pgmajfault: number; - cache: number; - mapped_file: number; - total_inactive_file: number; - pgpgout: number; - rss: number; - total_mapped_file: number; - writeback: number; - unevictable: number; - pgpgin: number; - total_unevictable: number; - pgmajfault: number; - total_rss: number; - total_rss_huge: number; - total_writeback: number; - total_inactive_anon: number; - rss_huge: number; - hierarchical_memory_limit: number; - total_pgfault: number; - total_active_file: number; - active_anon: number; - total_active_anon: number; - total_pgpgout: number; - total_cache: number; - inactive_anon: number; - active_file: number; - pgfault: number; - inactive_file: number; - total_pgpgin: number; - }; - max_usage: number; - usage: number; - failcnt: number; - limit: number; - } + interface MemoryStats { + stats: { + total_pgmajfault: number; + cache: number; + mapped_file: number; + total_inactive_file: number; + pgpgout: number; + rss: number; + total_mapped_file: number; + writeback: number; + unevictable: number; + pgpgin: number; + total_unevictable: number; + pgmajfault: number; + total_rss: number; + total_rss_huge: number; + total_writeback: number; + total_inactive_anon: number; + rss_huge: number; + hierarchical_memory_limit: number; + total_pgfault: number; + total_active_file: number; + active_anon: number; + total_active_anon: number; + total_pgpgout: number; + total_cache: number; + inactive_anon: number; + active_file: number; + pgfault: number; + inactive_file: number; + total_pgpgin: number; + }; + max_usage: number; + usage: number; + failcnt: number; + limit: number; + } + + interface ContainerStats { + read: string; + pid_stats: { + current: number; + }; + networks: NetworkStats; + memory_stats: MemoryStats; + blkio_stats: {}; + cpu_stats: CPUStats; + precpu_stats: CPUStats; + } - interface ContainerStats { - read: string; - pid_stats: { - current: number; - }; - networks: NetworkStats; - memory_stats: MemoryStats; - blkio_stats: {}; - cpu_stats: CPUStats; - precpu_stats: CPUStats; - } - interface HostConfig { AutoRemove: boolean; Binds: string[]; From e7be2c68faaa2e54aba9c7d795b12a6fdfd20491 Mon Sep 17 00:00:00 2001 From: Harald Korneliussen Date: Wed, 12 Dec 2018 12:59:51 +0100 Subject: [PATCH 226/241] When filterAll is set, filterMethod must be a function that takes and returns any[] --- types/react-table/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-table/index.d.ts b/types/react-table/index.d.ts index 1afb6eb0fd..42d09c4338 100644 --- a/types/react-table/index.d.ts +++ b/types/react-table/index.d.ts @@ -23,7 +23,7 @@ export type ComponentPropsGetterC = (finalState: any, rowInfo?: undefined, colum export type ComponentPropsGetterRC = (finalState: any, rowInfo?: RowInfo, column?: Column, instance?: any) => object | undefined; export type DefaultFilterFunction = (filter: Filter, row: any, column: any) => boolean; -export type FilterFunction = (filter: Filter, rows: any[], column: any) => boolean; +export type FilterFunction = (filter: Filter, rows: any[], column: any) => any[]; export type SubComponentFunction = (rowInfo: RowInfo) => React.ReactNode; export type PageChangeFunction = (page: number) => void; export type PageSizeChangeFunction = (newPageSize: number, newPage: number) => void; From 60eb70b81ed4c17ba657d272738884ec2ccbd668 Mon Sep 17 00:00:00 2001 From: Nokky Goren <30292793+ApeNox@users.noreply.github.com> Date: Wed, 12 Dec 2018 14:51:41 +0200 Subject: [PATCH 227/241] rename Options to searchOptions in props This should have been added before, but has been left out --- types/react-places-autocomplete/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-places-autocomplete/index.d.ts b/types/react-places-autocomplete/index.d.ts index 6a6a85c19e..1309211c13 100644 --- a/types/react-places-autocomplete/index.d.ts +++ b/types/react-places-autocomplete/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/kenny-hibino/react-places-autocomplete/ // Definitions by: Guilherme Hübner // Andrew Makarov +// Nokky Goren // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 // @@ -38,7 +39,7 @@ export interface PropTypes { autocompleteItem?: React.CSSProperties; autocompleteItemActive?: React.CSSProperties; }; - options?: { + searchOptions?: { bounds?: google.maps.LatLngBounds | google.maps.LatLngBoundsLiteral; componentRestrictions?: google.maps.GeocoderComponentRestrictions; location?: google.maps.LatLng | google.maps.LatLngLiteral; From 84efa71066822fca8efa9155ab1d7a41b637bdc0 Mon Sep 17 00:00:00 2001 From: Pascal Sthamer Date: Wed, 12 Dec 2018 14:05:43 +0100 Subject: [PATCH 228/241] Mount config for creating a container --- types/dockerode/index.d.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/types/dockerode/index.d.ts b/types/dockerode/index.d.ts index 694cc295b4..cd06bc7ebb 100644 --- a/types/dockerode/index.d.ts +++ b/types/dockerode/index.d.ts @@ -762,6 +762,38 @@ declare namespace Dockerode { [key: string]: EndpointSettings; } + type MountType = + | "bind" + | "volume" + | "tmpfs"; + + type MountConsistency = + | "default" + | "consistent" + | "cached" + | "delegated"; + + type MountPropagation = + | "private" + | "rprivate" + | "shared" + | "rshared" + | "slave" + | "rslave"; + + interface MountSettings { + Target: string; + Source: string; + Type: MountType; + ReadOnly ?: boolean; + Consistency ?: MountConsistency; + BindOptions ?: { + Propagation: MountPropagation; + }; + } + + type MountConfig = MountSettings[]; + interface ContainerCreateOptions { name?: string; Hostname?: string; @@ -818,6 +850,7 @@ declare namespace Dockerode { DnsSearch?: string[]; ExtraHosts?: any; VolumesFrom?: string[]; + Mounts?: MountConfig; CapAdd?: string[]; CapDrop?: string[]; GroupAdd?: string[]; From f8077c82027918706a453dbb6b1b89b9729dc309 Mon Sep 17 00:00:00 2001 From: Nokky Goren <30292793+ApeNox@users.noreply.github.com> Date: Wed, 12 Dec 2018 15:20:49 +0200 Subject: [PATCH 229/241] update contributor name --- types/react-places-autocomplete/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-places-autocomplete/index.d.ts b/types/react-places-autocomplete/index.d.ts index 1309211c13..e24e479be8 100644 --- a/types/react-places-autocomplete/index.d.ts +++ b/types/react-places-autocomplete/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/kenny-hibino/react-places-autocomplete/ // Definitions by: Guilherme Hübner // Andrew Makarov -// Nokky Goren +// Nokky Goren // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 // From 6b45c74db0148c612b716bd8fe24a33ce372072a Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Wed, 12 Dec 2018 16:03:11 +0100 Subject: [PATCH 230/241] Update types for proj4 --- types/proj4/index.d.ts | 69 ++++++++++++++++++++++++++++++++------ types/proj4/proj4-tests.ts | 50 ++++++++++++++++++++------- types/proj4/tsconfig.json | 4 +-- 3 files changed, 98 insertions(+), 25 deletions(-) diff --git a/types/proj4/index.d.ts b/types/proj4/index.d.ts index afba494556..d7d4cf1ae5 100644 --- a/types/proj4/index.d.ts +++ b/types/proj4/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for proj4 2.3 +// Type definitions for proj4 2.5 // Project: https://github.com/proj4js/proj4js // Definitions by: Denis Carriere +// BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace proj4 { @@ -21,9 +22,9 @@ declare namespace proj4 { ep2: number; } - interface Static { - forward(coordinates: TemplateCoordinates): number[]; - inverse(coordinates: TemplateCoordinates): number[]; + interface Converter { + forward(coordinates: T): T; + inverse(coordinates: T): T; } interface InterfaceProjection { @@ -38,6 +39,39 @@ declare namespace proj4 { inverse(coordinates: TemplateCoordinates): number[]; } + interface ProjectionDefinition { + title: string; + projName?: string; + ellps?: string; + datum?: string; + datumName?: string; + rf?: number; + lat0?: number; + lat1?: number; + lat2?: number; + lat_ts?: number; + long0?: number; + long1?: number; + long2?: number; + alpha?: number; + longc?: number; + x0?: number; + y0?: number; + k0?: number; + a?: number; + b?: number; + R_A?: true; + zone?: number; + utmSouth?: true; + datum_params?: string | number[]; + to_meter?: number; + units?: string; + from_greenwich?: number; + datumCode?: string; + natGrids?: string; + axis?: string; + } + const defaultDatum: string; function Proj(srsCode: any, callback?: any): InterfaceProjection; @@ -45,23 +79,38 @@ declare namespace proj4 { const WGS84: any; /** - * Depecrated v3 + * @deprecated v3 */ function Point(x: number, y: number, z?: number): InterfaceCoordinates; function Point(coordinates: TemplateCoordinates | string): InterfaceCoordinates; function toPoint(array: number[]): InterfaceCoordinates; - function defs(name: string, projection?: string): any; - function defs(name: string[][]): any; + function defs(name: string, projection: string | ProjectionDefinition): void; + function defs(name: string[][]): undefined[]; + function defs(name: string): ProjectionDefinition; - function transform(source: InterfaceProjection, dest: InterfaceProjection, point: TemplateCoordinates): any; + function transform( + source: InterfaceProjection, + dest: InterfaceProjection, + point: TemplateCoordinates + ): any; function mgrs(coordinates: number[], accuracy: number): string; const version: string; } -declare function proj4(fromProjection: string, toProjection?: string, coordinates?: proj4.TemplateCoordinates): proj4.Static; -declare function proj4(fromProjection: string, coordinates: proj4.TemplateCoordinates): number[]; +declare function proj4(fromProjection: string, toProjection?: string): proj4.Converter; +declare function proj4( + toProjection: string, + coordinates: T +): T; +declare function proj4( + fromProjection: string, + toProjection: string, + coordinates: T +): T; + export = proj4; +export as namespace proj4; diff --git a/types/proj4/proj4-tests.ts b/types/proj4/proj4-tests.ts index 3d1ab1ab9b..7df09014db 100644 --- a/types/proj4/proj4-tests.ts +++ b/types/proj4/proj4-tests.ts @@ -3,31 +3,55 @@ import proj4 = require('proj4'); /////////////////////////////////////////// // Tests data initialisation /////////////////////////////////////////// -const name = 'WGS84'; const epsg = { 4269: '+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees', 4326: '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees', }; -const point1 = [-71, 41]; -const point2 = {x: 2, y: 5}; -const mgrs = "24XWT783908"; +const firstProjection = epsg[4269]; +const secondProjection = epsg[4326]; + +const pointArr = [-71, 41]; +const pointObj = { x: 2, y: 5 }; /////////////////////////////////////////// // Tests Measurement /////////////////////////////////////////// -proj4(epsg['4269'], epsg['4326'], point1); -proj4(epsg['4269'], point1); -proj4(epsg['4269'], epsg['4326']).forward(point2); -proj4(epsg['4269'], epsg['4326']).inverse(point2); +proj4(firstProjection, secondProjection, pointArr); +proj4(firstProjection, pointArr); + +// $ExpectType number[] +proj4(firstProjection, secondProjection, pointArr); +// $ExpectType { x: number; y: number; } +proj4(firstProjection, secondProjection, pointObj); + +// $ExpectType number[] +proj4(firstProjection, pointArr); +// $ExpectType { x: number; y: number; } +proj4(firstProjection, pointObj); + +// $ExpectType Converter +proj4(firstProjection, secondProjection); +// $ExpectType Converter +proj4(firstProjection); + +// $ExpectType number[] +proj4(firstProjection, secondProjection).forward(pointArr); +// $ExpectType { x: number; y: number; } +proj4(firstProjection, secondProjection).forward(pointObj); +// $ExpectType number[] +proj4(firstProjection, secondProjection).inverse(pointArr); +// $ExpectType { x: number; y: number; } +proj4(firstProjection, secondProjection).inverse(pointObj); /////////////////////////////////// // Named Projections /////////////////////////////////// -proj4.defs('WGS84', epsg['4326']); -proj4.defs([ - ['EPSG:4326', epsg['4326']], - ['EPSG:4269', epsg['4269']] -]); + +// $ExpectType ProjectionDefinition +proj4.defs('WGS84'); +proj4.defs('WGS84', secondProjection); +// $ExpectType undefined[] +proj4.defs([['EPSG:4326', secondProjection], ['EPSG:4269', firstProjection]]); proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326')); /////////////////////////////////// diff --git a/types/proj4/tsconfig.json b/types/proj4/tsconfig.json index a55659d52c..02713475d5 100644 --- a/types/proj4/tsconfig.json +++ b/types/proj4/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -20,4 +20,4 @@ "index.d.ts", "proj4-tests.ts" ] -} \ No newline at end of file +} From 56b611f6873fc63c02ee6b2f7a1bec58537bce1f Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Tue, 27 Nov 2018 10:38:18 +0000 Subject: [PATCH 231/241] sinon: allow matchers as args --- types/sinon/index.d.ts | 52 +++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts index b5c3952e7a..d0748e9ac4 100644 --- a/types/sinon/index.d.ts +++ b/types/sinon/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Sinon 5.0 +// Type definitions for Sinon 7.0 // Project: http://sinonjs.org/ // Definitions by: William Sears // Jonathan Little @@ -18,12 +18,12 @@ interface Event {} // tslint:disable-line no-empty-interface interface Document {} // tslint:disable-line no-empty-interface declare namespace Sinon { - interface SinonSpyCallApi { + interface SinonSpyCallApi { // Properties /** * Array of received arguments. */ - args: TArgs; + args: TArgs[]; // Methods /** @@ -38,11 +38,11 @@ declare namespace Sinon { * so a call that received the provided arguments (in the same spots) and possibly others as well will return true. * @param args */ - calledWith(...args: TArgs): boolean; + calledWith(...args: Array): boolean; /** * Returns true if spy was called at least once with the provided arguments and no others. */ - calledWithExactly(...args: TArgs): boolean; + calledWithExactly(...args: Array): boolean; /** * Returns true if spy/stub was called the new operator. * Beware that this is inferred based on the value of the this object and the spy function’s prototype, @@ -53,31 +53,31 @@ declare namespace Sinon { * Returns true if spy was called at exactly once with the provided arguments. * @param args */ - calledOnceWith(...args: TArgs): boolean; - calledOnceWithExactly(...args: TArgs): boolean; + calledOnceWith(...args: Array): boolean; + calledOnceWithExactly(...args: Array): boolean; /** * Returns true if spy was called with matching arguments (and possibly others). * This behaves the same as spy.calledWith(sinon.match(arg1), sinon.match(arg2), ...). * @param args */ - calledWithMatch(...args: TArgs): boolean; + calledWithMatch(...args: TArgs[]): boolean; /** * Returns true if call did not receive provided arguments. * @param args */ - notCalledWith(...args: TArgs): boolean; + notCalledWith(...args: Array): boolean; /** * Returns true if call did not receive matching arguments. * This behaves the same as spyCall.notCalledWith(sinon.match(arg1), sinon.match(arg2), ...). * @param args */ - notCalledWithMatch(...args: TArgs): boolean; + notCalledWithMatch(...args: TArgs[]): boolean; /** * Returns true if spy returned the provided value at least once. * Uses deep comparison for objects and arrays. Use spy.returned(sinon.match.same(obj)) for strict comparison (see matchers). * @param value */ - returned(value: TReturnValue): boolean; + returned(value: TReturnValue|SinonMatcher): boolean; /** * Returns true if spy threw an exception at least once. */ @@ -118,7 +118,7 @@ declare namespace Sinon { yieldToOn(property: string, obj: any, ...args: any[]): void; } - interface SinonSpyCall + interface SinonSpyCall extends SinonSpyCallApi { /** * The call’s this value. @@ -154,7 +154,7 @@ declare namespace Sinon { calledAfter(call: SinonSpyCall): boolean; } - interface SinonSpy + interface SinonSpy extends Pick< SinonSpyCallApi, Exclude, 'args'> @@ -207,7 +207,7 @@ declare namespace Sinon { /** * Array of arguments received, spy.args[0] is an array of arguments received in the first call. */ - args: TArgs[]; + args: TArgs[][]; /** * Array of exception objects thrown, spy.exceptions[0] is the exception thrown by the first call. * If the call did not throw an error, the value at the call’s location in .exceptions will be undefined. @@ -246,7 +246,7 @@ declare namespace Sinon { * This is useful to be more expressive in your assertions, where you can access the spy with the same call. * @param args Expected args */ - withArgs(...args: TArgs): SinonSpy; + withArgs(...args: Array): SinonSpy; /** * Returns true if the spy was always called with @param obj as this. * @param obj @@ -255,29 +255,29 @@ declare namespace Sinon { /** * Returns true if spy was always called with the provided arguments (and possibly others). */ - alwaysCalledWith(...args: TArgs): boolean; + alwaysCalledWith(...args: Array): boolean; /** * Returns true if spy was always called with the exact provided arguments. * @param args */ - alwaysCalledWithExactly(...args: TArgs): boolean; + alwaysCalledWithExactly(...args: Array): boolean; /** * Returns true if spy was always called with matching arguments (and possibly others). * This behaves the same as spy.alwaysCalledWith(sinon.match(arg1), sinon.match(arg2), ...). * @param args */ - alwaysCalledWithMatch(...args: TArgs): boolean; + alwaysCalledWithMatch(...args: TArgs[]): boolean; /** * Returns true if the spy/stub was never called with the provided arguments. * @param args */ - neverCalledWith(...args: TArgs): boolean; + neverCalledWith(...args: Array): boolean; /** * Returns true if the spy/stub was never called with matching arguments. * This behaves the same as spy.neverCalledWith(sinon.match(arg1), sinon.match(arg2), ...). * @param args */ - neverCalledWithMatch(...args: TArgs): boolean; + neverCalledWithMatch(...args: TArgs[]): boolean; /** * Returns true if spy always threw an exception. */ @@ -300,7 +300,7 @@ declare namespace Sinon { * If the stub was never called with a function argument, yield throws an error. * Returns an Array with all callbacks return values in the order they were called, if no error is thrown. */ - invokeCallback(...args: TArgs): void; + invokeCallback(...args: TArgs[]): void; /** * Set the displayName of the spy or stub. * @param name @@ -356,13 +356,13 @@ declare namespace Sinon { * The returned spy is the function object which replaced the original method. spy === object.method. */ (obj: T, method: K): T[K] extends ( - ...args: infer TArgs + ...args: Array ) => infer TReturnValue ? SinonSpy : SinonSpy; } - interface SinonStub + interface SinonStub extends SinonSpy { /** * Resets the stub’s behaviour to the default behaviour @@ -524,7 +524,7 @@ declare namespace Sinon { * Makes the stub call the provided @param func when invoked. * @param func */ - callsFake(func: (...args: TArgs) => TReturnValue): SinonStub; + callsFake(func: (...args: TArgs[]) => TReturnValue): SinonStub; /** * Replaces a new getter for this stub. */ @@ -631,7 +631,7 @@ declare namespace Sinon { * It is also useful to create a stub that can act differently in response to different arguments. * @param args */ - withArgs(...args: TArgs): SinonStub; + withArgs(...args: Array): SinonStub; } interface SinonStubStatic { @@ -652,7 +652,7 @@ declare namespace Sinon { * The original function can be restored by calling object.method.restore(); (or stub.restore();). */ (obj: T, method: K): T[K] extends ( - ...args: infer TArgs + ...args: Array ) => infer TReturnValue ? SinonStub : SinonStub; From 91e0fb86382bf9a3af6b7fd640643dc7f44314d0 Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Tue, 27 Nov 2018 11:51:01 +0000 Subject: [PATCH 232/241] sinon: add typed args tests --- types/sinon/sinon-tests.ts | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/types/sinon/sinon-tests.ts b/types/sinon/sinon-tests.ts index d5ae4b0eb2..31dfa64e22 100644 --- a/types/sinon/sinon-tests.ts +++ b/types/sinon/sinon-tests.ts @@ -288,6 +288,41 @@ function testAssert() { sinon.assert.expose(obj, { includeFail: true }); } +function testTypedSpy() { + const cls = class { + foo(a: number, b: string): number { + return 3; + } + } + + const instance = new cls(); + const spy = sinon.spy(instance, 'foo'); + + spy.calledWith(5, 'x'); + spy.calledWith(sinon.match(5), 'x'); + spy.calledWithExactly(5, 'x'); + spy.calledWithExactly(5, sinon.match('x')); + spy.calledOnceWith(5, 'x'); + spy.calledOnceWith(sinon.match(5), 'x'); + spy.notCalledWith(5, 'x'); + spy.notCalledWith(sinon.match(5), 'x'); + spy.returned(5); + spy.returned(sinon.match(5)); + + spy.withArgs(sinon.match(5), 'x').calledWith(5, 'x'); + spy.alwaysCalledWith(sinon.match(5), 'x'); + spy.alwaysCalledWith(5, 'x'); + spy.alwaysCalledWithExactly(sinon.match(5), 'x'); + spy.alwaysCalledWithExactly(5, 'x'); + spy.neverCalledWith(sinon.match(5), 'x'); + spy.neverCalledWith(5, 'x'); + + const stub = sinon.stub(instance, 'foo'); + + stub.withArgs(5, 'x').returns(3); + stub.withArgs(sinon.match(5), 'x').returns(5); +} + function testSpy() { const fn = () => { }; const obj = class { From b4715b48d6a64a288f4ca6d0d2efcbffb36dd1cf Mon Sep 17 00:00:00 2001 From: James Garbutt <43081j@users.noreply.github.com> Date: Tue, 27 Nov 2018 11:58:30 +0000 Subject: [PATCH 233/241] sinon: resolve version issues --- types/karma-chai-sinon/index.d.ts | 2 +- types/mochaccino/index.d.ts | 2 +- types/should-sinon/index.d.ts | 2 +- types/sinon-as-promised/index.d.ts | 2 +- types/sinon-chai/index.d.ts | 2 +- types/sinon-chai/v2/index.d.ts | 2 +- types/sinon-chrome/index.d.ts | 2 +- types/sinon-express-mock/index.d.ts | 2 +- types/sinon-mongoose/index.d.ts | 2 +- types/sinon-stub-promise/index.d.ts | 2 +- types/sinon-test/index.d.ts | 2 +- types/sinon/index.d.ts | 293 ++--- types/sinon/package.json | 7 + types/sinon/sinon-tests.ts | 2 +- types/sinon/ts3.1/index.d.ts | 1747 +++++++++++++++++++++++++++ types/sinon/ts3.1/sinon-tests.ts | 488 ++++++++ types/sinon/ts3.1/tsconfig.json | 25 + 17 files changed, 2377 insertions(+), 207 deletions(-) create mode 100644 types/sinon/package.json create mode 100644 types/sinon/ts3.1/index.d.ts create mode 100644 types/sinon/ts3.1/sinon-tests.ts create mode 100644 types/sinon/ts3.1/tsconfig.json diff --git a/types/karma-chai-sinon/index.d.ts b/types/karma-chai-sinon/index.d.ts index 0b14373a99..9a14f659e2 100644 --- a/types/karma-chai-sinon/index.d.ts +++ b/types/karma-chai-sinon/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/tubalmartin/karma-chai-sinon // Definitions by: Václav Ostrožlík // Definitions: https://github.com/borisyankov/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.8 /// import Sinon = require('sinon'); diff --git a/types/mochaccino/index.d.ts b/types/mochaccino/index.d.ts index 4dbc62b7d9..3d5d9570a8 100644 --- a/types/mochaccino/index.d.ts +++ b/types/mochaccino/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/pawelgalazka/mochaccino#readme // Definitions by: Thomas-P // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.8 import * as Sinon from 'sinon'; export interface Expect { not: Expect; diff --git a/types/should-sinon/index.d.ts b/types/should-sinon/index.d.ts index 79b04d5092..6544a55253 100644 --- a/types/should-sinon/index.d.ts +++ b/types/should-sinon/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/shouldjs/sinon // Definitions by: AryloYeung // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.8 import * as s from 'sinon'; import should = require('should'); diff --git a/types/sinon-as-promised/index.d.ts b/types/sinon-as-promised/index.d.ts index 5e2e06ed83..5187168d61 100644 --- a/types/sinon-as-promised/index.d.ts +++ b/types/sinon-as-promised/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/bendrucker/sinon-as-promised // Definitions by: igrayson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.8 import * as s from "sinon"; diff --git a/types/sinon-chai/index.d.ts b/types/sinon-chai/index.d.ts index 6a0901eb8c..ad7c8cb857 100644 --- a/types/sinon-chai/index.d.ts +++ b/types/sinon-chai/index.d.ts @@ -4,7 +4,7 @@ // Jed Mao // Eyal Lapid // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.8 /// /// diff --git a/types/sinon-chai/v2/index.d.ts b/types/sinon-chai/v2/index.d.ts index 8a03ea671c..cff6d0b3a2 100644 --- a/types/sinon-chai/v2/index.d.ts +++ b/types/sinon-chai/v2/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/domenic/sinon-chai // Definitions by: Kazi Manzur Rashid , Jed Mao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.8 /// /// diff --git a/types/sinon-chrome/index.d.ts b/types/sinon-chrome/index.d.ts index eec9604dec..c25273d757 100644 --- a/types/sinon-chrome/index.d.ts +++ b/types/sinon-chrome/index.d.ts @@ -4,7 +4,7 @@ // CRIMX // kobanyan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.8 /// /// diff --git a/types/sinon-express-mock/index.d.ts b/types/sinon-express-mock/index.d.ts index 84454048cd..f3974fc005 100644 --- a/types/sinon-express-mock/index.d.ts +++ b/types/sinon-express-mock/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Jared Chapiewsky // Tomek Łaziuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.8 import { SinonStub, diff --git a/types/sinon-mongoose/index.d.ts b/types/sinon-mongoose/index.d.ts index f725965349..86109b4917 100644 --- a/types/sinon-mongoose/index.d.ts +++ b/types/sinon-mongoose/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/underscopeio/sinon-mongoose // Definitions by: stevehipwell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.8 import * as s from "sinon"; diff --git a/types/sinon-stub-promise/index.d.ts b/types/sinon-stub-promise/index.d.ts index 298eed87c0..d817113cf7 100644 --- a/types/sinon-stub-promise/index.d.ts +++ b/types/sinon-stub-promise/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Thiago Temple // Tim Stackhouse // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.8 /// diff --git a/types/sinon-test/index.d.ts b/types/sinon-test/index.d.ts index 63318554ae..902064a7cb 100644 --- a/types/sinon-test/index.d.ts +++ b/types/sinon-test/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/sinonjs/sinon-test // Definitions by: Francis Saul // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.8 import * as Sinon from 'sinon'; diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts index d0748e9ac4..bc265d6718 100644 --- a/types/sinon/index.d.ts +++ b/types/sinon/index.d.ts @@ -9,21 +9,21 @@ // Greg Jednaszewski // John Wood // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 +// TypeScript Version: 2.8 // sinon uses DOM dependencies which are absent in browser-less environment like node.js // to avoid compiler errors this monkey patch is used // see more details in https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11351 -interface Event {} // tslint:disable-line no-empty-interface -interface Document {} // tslint:disable-line no-empty-interface +interface Event { } // tslint:disable-line no-empty-interface +interface Document { } // tslint:disable-line no-empty-interface declare namespace Sinon { - interface SinonSpyCallApi { + interface SinonSpyCallApi { // Properties /** * Array of received arguments. */ - args: TArgs[]; + args: any[]; // Methods /** @@ -38,11 +38,11 @@ declare namespace Sinon { * so a call that received the provided arguments (in the same spots) and possibly others as well will return true. * @param args */ - calledWith(...args: Array): boolean; + calledWith(...args: any[]): boolean; /** * Returns true if spy was called at least once with the provided arguments and no others. */ - calledWithExactly(...args: Array): boolean; + calledWithExactly(...args: any[]): boolean; /** * Returns true if spy/stub was called the new operator. * Beware that this is inferred based on the value of the this object and the spy function’s prototype, @@ -53,31 +53,31 @@ declare namespace Sinon { * Returns true if spy was called at exactly once with the provided arguments. * @param args */ - calledOnceWith(...args: Array): boolean; - calledOnceWithExactly(...args: Array): boolean; + calledOnceWith(...args: any[]): boolean; + calledOnceWithExactly(...args: any[]): boolean; /** * Returns true if spy was called with matching arguments (and possibly others). * This behaves the same as spy.calledWith(sinon.match(arg1), sinon.match(arg2), ...). * @param args */ - calledWithMatch(...args: TArgs[]): boolean; + calledWithMatch(...args: any[]): boolean; /** * Returns true if call did not receive provided arguments. * @param args */ - notCalledWith(...args: Array): boolean; + notCalledWith(...args: any[]): boolean; /** * Returns true if call did not receive matching arguments. * This behaves the same as spyCall.notCalledWith(sinon.match(arg1), sinon.match(arg2), ...). * @param args */ - notCalledWithMatch(...args: TArgs[]): boolean; + notCalledWithMatch(...args: any[]): boolean; /** * Returns true if spy returned the provided value at least once. * Uses deep comparison for objects and arrays. Use spy.returned(sinon.match.same(obj)) for strict comparison (see matchers). * @param value */ - returned(value: TReturnValue|SinonMatcher): boolean; + returned(value: any): boolean; /** * Returns true if spy threw an exception at least once. */ @@ -118,8 +118,7 @@ declare namespace Sinon { yieldToOn(property: string, obj: any, ...args: any[]): void; } - interface SinonSpyCall - extends SinonSpyCallApi { + interface SinonSpyCall extends SinonSpyCallApi { /** * The call’s this value. */ @@ -131,7 +130,7 @@ declare namespace Sinon { /** * Return value. */ - returnValue: TReturnValue; + returnValue: any; /** * This property is a convenience for a call’s callback. * When the last argument in a call is a Function, then callback will reference that. Otherwise it will be undefined. @@ -154,11 +153,7 @@ declare namespace Sinon { calledAfter(call: SinonSpyCall): boolean; } - interface SinonSpy - extends Pick< - SinonSpyCallApi, - Exclude, 'args'> - > { + interface SinonSpy extends SinonSpyCallApi { // Properties /** * The number of recorded calls. @@ -187,19 +182,19 @@ declare namespace Sinon { /** * The first call */ - firstCall: SinonSpyCall; + firstCall: SinonSpyCall; /** * The second call */ - secondCall: SinonSpyCall; + secondCall: SinonSpyCall; /** * The third call */ - thirdCall: SinonSpyCall; + thirdCall: SinonSpyCall; /** * The last call */ - lastCall: SinonSpyCall; + lastCall: SinonSpyCall; /** * Array of this objects, spy.thisValues[0] is the this object for the first call. */ @@ -207,7 +202,7 @@ declare namespace Sinon { /** * Array of arguments received, spy.args[0] is an array of arguments received in the first call. */ - args: TArgs[][]; + args: any[][]; /** * Array of exception objects thrown, spy.exceptions[0] is the exception thrown by the first call. * If the call did not throw an error, the value at the call’s location in .exceptions will be undefined. @@ -217,7 +212,7 @@ declare namespace Sinon { * Array of return values, spy.returnValues[0] is the return value of the first call. * If the call did not explicitly return a value, the value at the call’s location in .returnValues will be undefined. */ - returnValues: TReturnValue[]; + returnValues: any[]; // Methods (...args: any[]): any; @@ -246,7 +241,7 @@ declare namespace Sinon { * This is useful to be more expressive in your assertions, where you can access the spy with the same call. * @param args Expected args */ - withArgs(...args: Array): SinonSpy; + withArgs(...args: any[]): SinonSpy; /** * Returns true if the spy was always called with @param obj as this. * @param obj @@ -255,29 +250,29 @@ declare namespace Sinon { /** * Returns true if spy was always called with the provided arguments (and possibly others). */ - alwaysCalledWith(...args: Array): boolean; + alwaysCalledWith(...args: any[]): boolean; /** * Returns true if spy was always called with the exact provided arguments. * @param args */ - alwaysCalledWithExactly(...args: Array): boolean; + alwaysCalledWithExactly(...args: any[]): boolean; /** * Returns true if spy was always called with matching arguments (and possibly others). * This behaves the same as spy.alwaysCalledWith(sinon.match(arg1), sinon.match(arg2), ...). * @param args */ - alwaysCalledWithMatch(...args: TArgs[]): boolean; + alwaysCalledWithMatch(...args: any[]): boolean; /** * Returns true if the spy/stub was never called with the provided arguments. * @param args */ - neverCalledWith(...args: Array): boolean; + neverCalledWith(...args: any[]): boolean; /** * Returns true if the spy/stub was never called with matching arguments. * This behaves the same as spy.neverCalledWith(sinon.match(arg1), sinon.match(arg2), ...). * @param args */ - neverCalledWithMatch(...args: TArgs[]): boolean; + neverCalledWithMatch(...args: any[]): boolean; /** * Returns true if spy always threw an exception. */ @@ -300,22 +295,22 @@ declare namespace Sinon { * If the stub was never called with a function argument, yield throws an error. * Returns an Array with all callbacks return values in the order they were called, if no error is thrown. */ - invokeCallback(...args: TArgs[]): void; + invokeCallback(...args: any[]): void; /** * Set the displayName of the spy or stub. * @param name */ - named(name: string): SinonSpy; + named(name: string): SinonSpy; /** * Returns the nth call. * Accessing individual calls helps with more detailed behavior verification when the spy is called more than once. * @param n */ - getCall(n: number): SinonSpyCall; + getCall(n: number): SinonSpyCall; /** * Returns an Array of all calls recorded by the spy. */ - getCalls(): Array>; + getCalls(): SinonSpyCall[]; /** * Resets the state of a spy. */ @@ -355,15 +350,10 @@ declare namespace Sinon { * The original method can be restored by calling object.method.restore(). * The returned spy is the function object which replaced the original method. spy === object.method. */ - (obj: T, method: K): T[K] extends ( - ...args: Array - ) => infer TReturnValue - ? SinonSpy - : SinonSpy; + (obj: T, method: keyof T): SinonSpy; } - interface SinonStub - extends SinonSpy { + interface SinonStub extends SinonSpy { /** * Resets the stub’s behaviour to the default behaviour * You can reset behaviour of all stubs using sinon.resetBehavior() @@ -381,13 +371,13 @@ declare namespace Sinon { * Causes the stub to return promises using a specific Promise library instead of the global one when using stub.rejects or stub.resolves. * Returns the stub to allow chaining. */ - usingPromise(promiseLibrary: any): SinonStub; + usingPromise(promiseLibrary: any): SinonStub; /** * Makes the stub return the provided @param obj value. * @param obj */ - returns(obj: TReturnValue): SinonStub; + returns(obj: any): SinonStub; /** * Causes the stub to return the argument at the provided @param index. * stub.returnsArg(0); causes the stub to return the first argument. @@ -395,12 +385,12 @@ declare namespace Sinon { * starting from sinon@6.1.2, a TypeError will be thrown. * @param index */ - returnsArg(index: number): SinonStub; + returnsArg(index: number): SinonStub; /** * Causes the stub to return its this value. * Useful for stubbing jQuery-style fluent APIs. */ - returnsThis(): SinonStub; + returnsThis(): SinonStub; /** * Causes the stub to return a Promise which resolves to the provided value. * When constructing the Promise, sinon uses the Promise.resolve method. @@ -408,26 +398,26 @@ declare namespace Sinon { * The Promise library can be overwritten using the usingPromise method. * Since sinon@2.0.0 */ - resolves(value?: any): SinonStub; + resolves(value?: any): SinonStub; /** * Causes the stub to return a Promise which resolves to the argument at the provided index. * stub.resolvesArg(0); causes the stub to return a Promise which resolves to the first argument. * If the argument at the provided index is not available, a TypeError will be thrown. */ - resolvesArg(index: number): SinonStub; + resolvesArg(index: number): SinonStub; /** * Causes the stub to return a Promise which resolves to its this value. */ - resolvesThis(): SinonStub; + resolvesThis(): SinonStub; /** * Causes the stub to throw an exception (Error). * @param type */ - throws(type?: string): SinonStub; + throws(type?: string): SinonStub; /** * Causes the stub to throw the provided exception object. */ - throws(obj: any): SinonStub; + throws(obj: any): SinonStub; /** * Causes the stub to throw the argument at the provided index. * stub.throwsArg(0); causes the stub to throw the first argument as the exception. @@ -435,9 +425,9 @@ declare namespace Sinon { * Since sinon@2.3.0 * @param index */ - throwsArg(index: number): SinonStub; - throwsException(type?: string): SinonStub; - throwsException(obj: any): SinonStub; + throwsArg(index: number): SinonStub; + throwsException(type?: string): SinonStub; + throwsException(obj: any): SinonStub; /** * Causes the stub to return a Promise which rejects with an exception (Error). * When constructing the Promise, sinon uses the Promise.reject method. @@ -445,57 +435,53 @@ declare namespace Sinon { * The Promise library can be overwritten using the usingPromise method. * Since sinon@2.0.0 */ - rejects(): SinonStub; + rejects(): SinonStub; /** * Causes the stub to return a Promise which rejects with an exception of the provided type. * Since sinon@2.0.0 */ - rejects(errorType: string): SinonStub; + rejects(errorType: string): SinonStub; /** * Causes the stub to return a Promise which rejects with the provided exception object. * Since sinon@2.0.0 */ - rejects(value: any): SinonStub; + rejects(value: any): SinonStub; /** * Causes the stub to call the argument at the provided index as a callback function. * stub.callsArg(0); causes the stub to call the first argument as a callback. * If the argument at the provided index is not available or is not a function, a TypeError will be thrown. */ - callsArg(index: number): SinonStub; + callsArg(index: number): SinonStub; /** * Causes the original method wrapped into the stub to be called when none of the conditional stubs are matched. */ - callThrough(): SinonStub; + callThrough(): SinonStub; /** * Like stub.callsArg(index); but with an additional parameter to pass the this context. * @param index * @param context */ - callsArgOn(index: number, context: any): SinonStub; + callsArgOn(index: number, context: any): SinonStub; /** * Like callsArg, but with arguments to pass to the callback. * @param index * @param args */ - callsArgWith(index: number, ...args: any[]): SinonStub; + callsArgWith(index: number, ...args: any[]): SinonStub; /** * Like above but with an additional parameter to pass the this context. * @param index * @param context * @param args */ - callsArgOnWith( - index: number, - context: any, - ...args: any[] - ): SinonStub; + callsArgOnWith(index: number, context: any, ...args: any[]): SinonStub; /** * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. * In Node environment the callback is deferred with process.nextTick. * In a browser the callback is deferred with setTimeout(callback, 0). * @param index */ - callsArgAsync(index: number): SinonStub; + callsArgAsync(index: number): SinonStub; /** * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. * In Node environment the callback is deferred with process.nextTick. @@ -503,99 +489,91 @@ declare namespace Sinon { * @param index * @param context */ - callsArgOnAsync(index: number, context: any): SinonStub; + callsArgOnAsync(index: number, context: any): SinonStub; /** * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. * In Node environment the callback is deferred with process.nextTick. * In a browser the callback is deferred with setTimeout(callback, 0). */ - callsArgWithAsync(index: number, ...args: any[]): SinonStub; + callsArgWithAsync(index: number, ...args: any[]): SinonStub; /** * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. * In Node environment the callback is deferred with process.nextTick. * In a browser the callback is deferred with setTimeout(callback, 0). */ - callsArgOnWithAsync( - index: number, - context: any, - ...args: any[] - ): SinonStub; + callsArgOnWithAsync(index: number, context: any, ...args: any[]): SinonStub; /** * Makes the stub call the provided @param func when invoked. * @param func */ - callsFake(func: (...args: TArgs[]) => TReturnValue): SinonStub; + callsFake(func: (...args: any[]) => any): SinonStub; /** * Replaces a new getter for this stub. */ - get(func: () => any): SinonStub; + get(func: () => any): SinonStub; /** * Defines a new setter for this stub. * @param func */ - set(func: (v: any) => void): SinonStub; + set(func: (v: any) => void): SinonStub; /** * Defines the behavior of the stub on the @param n call. Useful for testing sequential interactions. * There are methods onFirstCall, onSecondCall,onThirdCall to make stub definitions read more naturally. * onCall can be combined with all of the behavior defining methods in this section. In particular, it can be used together with withArgs. * @param n */ - onCall(n: number): SinonStub; + onCall(n: number): SinonStub; /** * Alias for stub.onCall(0); */ - onFirstCall(): SinonStub; + onFirstCall(): SinonStub; /** * Alias for stub.onCall(1); */ - onSecondCall(): SinonStub; + onSecondCall(): SinonStub; /** * Alias for stub.onCall(2); */ - onThirdCall(): SinonStub; + onThirdCall(): SinonStub; /** * Defines a new value for this stub. * @param val */ - value(val: any): SinonStub; + value(val: any): SinonStub; /** * Set the displayName of the spy or stub. * @param name */ - named(name: string): SinonStub; + named(name: string): SinonStub; /** * Similar to callsArg. * Causes the stub to call the first callback it receives with the provided arguments (if any). * If a method accepts more than one callback, you need to use callsArg to have the stub invoke other callbacks than the first one. */ - yields(...args: any[]): SinonStub; + yields(...args: any[]): SinonStub; /** * Like above but with an additional parameter to pass the this context. */ - yieldsOn(context: any, ...args: any[]): SinonStub; - yieldsRight(...args: any[]): SinonStub; + yieldsOn(context: any, ...args: any[]): SinonStub; + yieldsRight(...args: any[]): SinonStub; /** * Causes the spy to invoke a callback passed as a property of an object to the spy. * Like yields, yieldsTo grabs the first matching argument, finds the callback and calls it with the (optional) arguments. * @param property * @param args */ - yieldsTo(property: string, ...args: any[]): SinonStub; + yieldsTo(property: string, ...args: any[]): SinonStub; /** * Like above but with an additional parameter to pass the this context. */ - yieldsToOn( - property: string, - context: any, - ...args: any[] - ): SinonStub; + yieldsToOn(property: string, context: any, ...args: any[]): SinonStub; /** * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. * In Node environment the callback is deferred with process.nextTick. * In a browser the callback is deferred with setTimeout(callback, 0). * @param args */ - yieldsAsync(...args: any[]): SinonStub; + yieldsAsync(...args: any[]): SinonStub; /** * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. * In Node environment the callback is deferred with process.nextTick. @@ -603,7 +581,7 @@ declare namespace Sinon { * @param context * @param args */ - yieldsOnAsync(context: any, ...args: any[]): SinonStub; + yieldsOnAsync(context: any, ...args: any[]): SinonStub; /** * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. * In Node environment the callback is deferred with process.nextTick. @@ -611,7 +589,7 @@ declare namespace Sinon { * @param property * @param args */ - yieldsToAsync(property: string, ...args: any[]): SinonStub; + yieldsToAsync(property: string, ...args: any[]): SinonStub; /** * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. * In Node environment the callback is deferred with process.nextTick. @@ -620,18 +598,14 @@ declare namespace Sinon { * @param context * @param args */ - yieldsToOnAsync( - property: string, - context: any, - ...args: any[] - ): SinonStub; + yieldsToOnAsync(property: string, context: any, ...args: any[]): SinonStub; /** * Stubs the method only for the provided arguments. * This is useful to be more expressive in your assertions, where you can access the spy with the same call. * It is also useful to create a stub that can act differently in response to different arguments. * @param args */ - withArgs(...args: Array): SinonStub; + withArgs(...args: any[]): SinonStub; } interface SinonStubStatic { @@ -651,11 +625,7 @@ declare namespace Sinon { * An exception is thrown if the property is not already a function. * The original function can be restored by calling object.method.restore(); (or stub.restore();). */ - (obj: T, method: K): T[K] extends ( - ...args: Array - ) => infer TReturnValue - ? SinonStub - : SinonStub; + (obj: T, method: keyof T): SinonStub; } interface SinonExpectation extends SinonStub { @@ -757,22 +727,11 @@ declare namespace Sinon { interface SinonFakeTimers { now: number; - setTimeout( - callback: (...args: any[]) => void, - timeout: number, - ...args: any[] - ): SinonTimerId; + setTimeout(callback: (...args: any[]) => void, timeout: number, ...args: any[]): SinonTimerId; clearTimeout(id: SinonTimerId): void; - setInterval( - callback: (...args: any[]) => void, - timeout: number, - ...args: any[] - ): SinonTimerId; + setInterval(callback: (...args: any[]) => void, timeout: number, ...args: any[]): SinonTimerId; clearInterval(id: SinonTimerId): void; - setImmediate( - callback: (...args: any[]) => void, - ...args: any[] - ): SinonTimerId; + setImmediate(callback: (...args: any[]) => void, ...args: any[]): SinonTimerId; clearImmediate(id: SinonTimerId): void; requestAnimationFrame(callback: (...args: any[]) => void): number; cancelAnimationFrame(id: number): void; @@ -806,30 +765,9 @@ declare namespace Sinon { Date(year: number, month: number): Date; Date(year: number, month: number, day: number): Date; Date(year: number, month: number, day: number, hour: number): Date; - Date( - year: number, - month: number, - day: number, - hour: number, - minute: number - ): Date; - Date( - year: number, - month: number, - day: number, - hour: number, - minute: number, - second: number - ): Date; - Date( - year: number, - month: number, - day: number, - hour: number, - minute: number, - second: number, - ms: number - ): Date; + Date(year: number, month: number, day: number, hour: number, minute: number): Date; + Date(year: number, month: number, day: number, hour: number, minute: number, second: number): Date; + Date(year: number, month: number, day: number, hour: number, minute: number, second: number, ms: number): Date; /** * Restore the faked methods. @@ -950,7 +888,7 @@ declare namespace Sinon { } interface SinonFakeXMLHttpRequestStatic { - new (): SinonFakeXMLHttpRequest; + new(): SinonFakeXMLHttpRequest; /** * Default false. * When set to true, Sinon will check added filters if certain requests should be “unfaked” @@ -962,15 +900,7 @@ declare namespace Sinon { * If the filter returns true, the request will not be faked. * @param filter */ - addFilter( - filter: ( - method: string, - url: string, - async: boolean, - username: string, - password: string - ) => boolean - ): void; + addFilter(filter: (method: string, url: string, async: boolean, username: string, password: string) => boolean): void; /** * By assigning a function to the onCreate property of the returned object from useFakeXMLHttpRequest() * you can subscribe to newly created FakeXMLHttpRequest objects. See below for the fake xhr object API. @@ -1036,10 +966,7 @@ declare namespace Sinon { /** * Responds to all requests to given URL, e.g. /posts/1. */ - respondWith( - url: string, - fn: (xhr: SinonFakeXMLHttpRequest) => void - ): void; + respondWith(url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; /** * Responds to all method requests to the given URL with the given response. * method is an HTTP verb. @@ -1054,11 +981,7 @@ declare namespace Sinon { * Responds to all method requests to the given URL with the given response. * method is an HTTP verb. */ - respondWith( - method: string, - url: string, - fn: (xhr: SinonFakeXMLHttpRequest) => void - ): void; + respondWith(method: string, url: string, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; /** * URL may be a regular expression, e.g. /\\/post\\//\\d+ * If the response is a Function, it will be passed any capture groups from the regular expression along with the XMLHttpRequest object: @@ -1073,10 +996,7 @@ declare namespace Sinon { * URL may be a regular expression, e.g. /\\/post\\//\\d+ * If the response is a Function, it will be passed any capture groups from the regular expression along with the XMLHttpRequest object: */ - respondWith( - url: RegExp, - fn: (xhr: SinonFakeXMLHttpRequest) => void - ): void; + respondWith(url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; /** * Responds to all method requests to URLs matching the regular expression. */ @@ -1088,11 +1008,7 @@ declare namespace Sinon { /** * Responds to all method requests to URLs matching the regular expression. */ - respondWith( - method: string, - url: RegExp, - fn: (xhr: SinonFakeXMLHttpRequest) => void - ): void; + respondWith(method: string, url: RegExp, fn: (xhr: SinonFakeXMLHttpRequest) => void): void; /** * Causes all queued asynchronous requests to receive a response. * If none of the responses added through respondWith match, the default response is [404, {}, ""]. @@ -1221,10 +1137,7 @@ declare namespace Sinon { * @param spyOrSpyCall * @param args */ - calledWithExactly( - spyOrSpyCall: SinonSpy | SinonSpyCall, - ...args: any[] - ): void; + calledWithExactly(spyOrSpyCall: SinonSpy | SinonSpyCall, ...args: any[]): void; /** * Passes if spy was always called with the provided arguments and no others. */ @@ -1234,10 +1147,7 @@ declare namespace Sinon { * This behaves the same way as sinon.assert.calledWith(spy, sinon.match(arg1), sinon.match(arg2), ...). * It’s possible to assert on a dedicated spy call: sinon.assert.calledWithMatch(spy.secondCall, arg1, arg2, ...);. */ - calledWithMatch( - spyOrSpyCall: SinonSpy | SinonSpyCall, - ...args: any[] - ): void; + calledWithMatch(spyOrSpyCall: SinonSpy | SinonSpyCall, ...args: any[]): void; /** * Passes if spy was always called with matching arguments. * This behaves the same way as sinon.assert.alwaysCalledWith(spy, sinon.match(arg1), sinon.match(arg2), ...). @@ -1529,7 +1439,7 @@ declare namespace Sinon { * @template TType Object type being stubbed. */ type SinonStubbedInstance = { - [P in keyof TType]: SinonStubbedMember + [P in keyof TType]: SinonStubbedMember; }; /** @@ -1619,9 +1529,7 @@ declare namespace Sinon { * You would have to call either clock.next(), clock.tick(), clock.runAll() or clock.runToLast() (see example below). Please refer to the lolex documentation for more information. * @param config */ - useFakeTimers( - config?: number | Date | Partial - ): SinonFakeTimers; + useFakeTimers(config?: number | Date | Partial): SinonFakeTimers; /** * Causes Sinon to replace the native XMLHttpRequest object in browsers that support it with a custom implementation which does not send actual requests. * In browsers that support ActiveXObject, this constructor is replaced, and fake objects are returned for XMLHTTP progIds. @@ -1675,8 +1583,7 @@ declare namespace Sinon { replace( obj: T, prop: TKey, - replacement: T[TKey] - ): T[TKey]; + replacement: T[TKey]): T[TKey]; /** * Replaces getter for property on object with replacement argument. Attempts to replace an already replaced getter cause an exception. * replacement must be a Function, and can be instances of spies, stubs and fakes. @@ -1687,8 +1594,7 @@ declare namespace Sinon { replaceGetter( obj: T, prop: TKey, - replacement: () => T[TKey] - ): () => T[TKey]; + replacement: () => T[TKey]): () => T[TKey]; /** * Replaces setter for property on object with replacement argument. Attempts to replace an already replaced setter cause an exception. * replacement must be a Function, and can be instances of spies, stubs and fakes. @@ -1699,8 +1605,7 @@ declare namespace Sinon { replaceSetter( obj: T, prop: TKey, - replacement: (val: T[TKey]) => void - ): (val: T[TKey]) => void; + replacement: (val: T[TKey]) => void): (val: T[TKey]) => void; /** * Creates a new object with the given functions as the prototype and stubs all implemented functions. @@ -1710,9 +1615,7 @@ declare namespace Sinon { * @returns A stubbed version of the constructor. * @remarks The given constructor function is not invoked. See also the stub API. */ - createStubInstance( - constructor: StubbableType - ): SinonStubbedInstance; + createStubInstance(constructor: StubbableType): SinonStubbedInstance; } interface SinonApi { diff --git a/types/sinon/package.json b/types/sinon/package.json new file mode 100644 index 0000000000..bb80441dc0 --- /dev/null +++ b/types/sinon/package.json @@ -0,0 +1,7 @@ +{ + "private": true, + "types": "index", + "typesVersions": { + ">=3.1.0-0": { "*": ["ts3.1/*"] } + } +} diff --git a/types/sinon/sinon-tests.ts b/types/sinon/sinon-tests.ts index 31dfa64e22..b892f22980 100644 --- a/types/sinon/sinon-tests.ts +++ b/types/sinon/sinon-tests.ts @@ -293,7 +293,7 @@ function testTypedSpy() { foo(a: number, b: string): number { return 3; } - } + }; const instance = new cls(); const spy = sinon.spy(instance, 'foo'); diff --git a/types/sinon/ts3.1/index.d.ts b/types/sinon/ts3.1/index.d.ts new file mode 100644 index 0000000000..bc91a3285a --- /dev/null +++ b/types/sinon/ts3.1/index.d.ts @@ -0,0 +1,1747 @@ +// sinon uses DOM dependencies which are absent in browser-less environment like node.js +// to avoid compiler errors this monkey patch is used +// see more details in https://github.com/DefinitelyTyped/DefinitelyTyped/issues/11351 +interface Event {} // tslint:disable-line no-empty-interface +interface Document {} // tslint:disable-line no-empty-interface + +declare namespace Sinon { + type MatchArguments = { + [K in keyof T]: SinonMatcher | T[K]; + }; + + interface SinonSpyCallApi { + // Properties + /** + * Array of received arguments. + */ + args: TArgs; + + // Methods + /** + * Returns true if the spy was called at least once with @param obj as this. + * calledOn also accepts a matcher spyCall.calledOn(sinon.match(fn)) (see matchers). + * @param obj + */ + calledOn(obj: any): boolean; + /** + * Returns true if spy was called at least once with the provided arguments. + * Can be used for partial matching, Sinon only checks the provided arguments against actual arguments, + * so a call that received the provided arguments (in the same spots) and possibly others as well will return true. + * @param args + */ + calledWith(...args: MatchArguments): boolean; + /** + * Returns true if spy was called at least once with the provided arguments and no others. + */ + calledWithExactly(...args: MatchArguments): boolean; + /** + * Returns true if spy/stub was called the new operator. + * Beware that this is inferred based on the value of the this object and the spy function’s prototype, + * so it may give false positives if you actively return the right kind of object. + */ + calledWithNew(): boolean; + /** + * Returns true if spy was called at exactly once with the provided arguments. + * @param args + */ + calledOnceWith(...args: MatchArguments): boolean; + calledOnceWithExactly(...args: MatchArguments): boolean; + /** + * Returns true if spy was called with matching arguments (and possibly others). + * This behaves the same as spy.calledWith(sinon.match(arg1), sinon.match(arg2), ...). + * @param args + */ + calledWithMatch(...args: TArgs): boolean; + /** + * Returns true if call did not receive provided arguments. + * @param args + */ + notCalledWith(...args: MatchArguments): boolean; + /** + * Returns true if call did not receive matching arguments. + * This behaves the same as spyCall.notCalledWith(sinon.match(arg1), sinon.match(arg2), ...). + * @param args + */ + notCalledWithMatch(...args: TArgs): boolean; + /** + * Returns true if spy returned the provided value at least once. + * Uses deep comparison for objects and arrays. Use spy.returned(sinon.match.same(obj)) for strict comparison (see matchers). + * @param value + */ + returned(value: TReturnValue|SinonMatcher): boolean; + /** + * Returns true if spy threw an exception at least once. + */ + threw(): boolean; + /** + * Returns true if spy threw an exception of the provided type at least once. + */ + threw(type: string): boolean; + /** + * Returns true if spy threw the provided exception object at least once. + */ + threw(obj: any): boolean; + /** + * Like yield, but with an explicit argument number specifying which callback to call. + * Useful if a function is called with more than one callback, and simply calling the first callback is not desired. + * @param pos + */ + callArg(pos: number): void; + callArgOn(pos: number, obj: any, ...args: any[]): void; + /** + * Like callArg, but with arguments. + */ + callArgWith(pos: number, ...args: any[]): void; + callArgOnWith(pos: number, obj: any, ...args: any[]): void; + /** + * Invoke callbacks passed to the stub with the given arguments. + * If the stub was never called with a function argument, yield throws an error. + * Returns an Array with all callbacks return values in the order they were called, if no error is thrown. + * Also aliased as invokeCallback. + */ + yield(...args: any[]): void; + yieldOn(obj: any, ...args: any[]): void; + /** + * Invokes callbacks passed as a property of an object to the stub. + * Like yield, yieldTo grabs the first matching argument, finds the callback and calls it with the (optional) arguments. + */ + yieldTo(property: string, ...args: any[]): void; + yieldToOn(property: string, obj: any, ...args: any[]): void; + } + + interface SinonSpyCall + extends SinonSpyCallApi { + /** + * The call’s this value. + */ + thisValue: any; + /** + * Exception thrown, if any. + */ + exception: any; + /** + * Return value. + */ + returnValue: TReturnValue; + /** + * This property is a convenience for a call’s callback. + * When the last argument in a call is a Function, then callback will reference that. Otherwise it will be undefined. + */ + callback: Function | undefined; + /** + * This property is a convenience for the last argument of the call. + */ + lastArg: any; + + /** + * Returns true if the spy call occurred before another spy call. + * @param call + */ + calledBefore(call: SinonSpyCall): boolean; + /** + * Returns true if the spy call occurred after another spy call. + * @param call + */ + calledAfter(call: SinonSpyCall): boolean; + } + + interface SinonSpy + extends Pick< + SinonSpyCallApi, + Exclude, 'args'> + > { + // Properties + /** + * The number of recorded calls. + */ + callCount: number; + /** + * true if the spy was called at least once + */ + called: boolean; + /** + * true if the spy was not called + */ + notCalled: boolean; + /** + * true if spy was called exactly once + */ + calledOnce: boolean; + /** + * true if the spy was called exactly twice + */ + calledTwice: boolean; + /** + * true if the spy was called exactly thrice + */ + calledThrice: boolean; + /** + * The first call + */ + firstCall: SinonSpyCall; + /** + * The second call + */ + secondCall: SinonSpyCall; + /** + * The third call + */ + thirdCall: SinonSpyCall; + /** + * The last call + */ + lastCall: SinonSpyCall; + /** + * Array of this objects, spy.thisValues[0] is the this object for the first call. + */ + thisValues: any[]; + /** + * Array of arguments received, spy.args[0] is an array of arguments received in the first call. + */ + args: TArgs[]; + /** + * Array of exception objects thrown, spy.exceptions[0] is the exception thrown by the first call. + * If the call did not throw an error, the value at the call’s location in .exceptions will be undefined. + */ + exceptions: any[]; + /** + * Array of return values, spy.returnValues[0] is the return value of the first call. + * If the call did not explicitly return a value, the value at the call’s location in .returnValues will be undefined. + */ + returnValues: TReturnValue[]; + + // Methods + (...args: any[]): any; + /** + * Returns true if the spy was called before @param anotherSpy + * @param anotherSpy + */ + calledBefore(anotherSpy: SinonSpy): boolean; + /** + * Returns true if the spy was called after @param anotherSpy + * @param anotherSpy + */ + calledAfter(anotherSpy: SinonSpy): boolean; + /** + * Returns true if spy was called before @param anotherSpy, and no spy calls occurred between spy and @param anotherSpy. + * @param anotherSpy + */ + calledImmediatelyBefore(anotherSpy: SinonSpy): boolean; + /** + * Returns true if spy was called after @param anotherSpy, and no spy calls occurred between @param anotherSpy and spy. + * @param anotherSpy + */ + calledImmediatelyAfter(anotherSpy: SinonSpy): boolean; + /** + * Creates a spy that only records calls when the received arguments match those passed to withArgs. + * This is useful to be more expressive in your assertions, where you can access the spy with the same call. + * @param args Expected args + */ + withArgs(...args: MatchArguments): SinonSpy; + /** + * Returns true if the spy was always called with @param obj as this. + * @param obj + */ + alwaysCalledOn(obj: any): boolean; + /** + * Returns true if spy was always called with the provided arguments (and possibly others). + */ + alwaysCalledWith(...args: MatchArguments): boolean; + /** + * Returns true if spy was always called with the exact provided arguments. + * @param args + */ + alwaysCalledWithExactly(...args: MatchArguments): boolean; + /** + * Returns true if spy was always called with matching arguments (and possibly others). + * This behaves the same as spy.alwaysCalledWith(sinon.match(arg1), sinon.match(arg2), ...). + * @param args + */ + alwaysCalledWithMatch(...args: TArgs): boolean; + /** + * Returns true if the spy/stub was never called with the provided arguments. + * @param args + */ + neverCalledWith(...args: MatchArguments): boolean; + /** + * Returns true if the spy/stub was never called with matching arguments. + * This behaves the same as spy.neverCalledWith(sinon.match(arg1), sinon.match(arg2), ...). + * @param args + */ + neverCalledWithMatch(...args: TArgs): boolean; + /** + * Returns true if spy always threw an exception. + */ + alwaysThrew(): boolean; + /** + * Returns true if spy always threw an exception of the provided type. + */ + alwaysThrew(type: string): boolean; + /** + * Returns true if spy always threw the provided exception object. + */ + alwaysThrew(obj: any): boolean; + /** + * Returns true if spy always returned the provided value. + * @param obj + */ + alwaysReturned(obj: any): boolean; + /** + * Invoke callbacks passed to the stub with the given arguments. + * If the stub was never called with a function argument, yield throws an error. + * Returns an Array with all callbacks return values in the order they were called, if no error is thrown. + */ + invokeCallback(...args: TArgs): void; + /** + * Set the displayName of the spy or stub. + * @param name + */ + named(name: string): SinonSpy; + /** + * Returns the nth call. + * Accessing individual calls helps with more detailed behavior verification when the spy is called more than once. + * @param n + */ + getCall(n: number): SinonSpyCall; + /** + * Returns an Array of all calls recorded by the spy. + */ + getCalls(): Array>; + /** + * Resets the state of a spy. + */ + resetHistory(): void; + /** + * Returns the passed format string with the following replacements performed: + * * %n - the name of the spy "spy" by default) + * * %c - the number of times the spy was called, in words ("once", "twice", etc.) + * * %C - a list of string representations of the calls to the spy, with each call prefixed by a newline and four spaces + * * %t - a comma-delimited list of this values the spy was called on + * * %n - the formatted value of the nth argument passed to printf + * * %* - a comma-delimited list of the (non-format string) arguments passed to printf + * * %D - a multi-line list of the arguments received by all calls to the spy + * @param format + * @param args + */ + printf(format: string, ...args: any[]): string; + /** + * Replaces the spy with the original method. Only available if the spy replaced an existing method. + */ + restore(): void; + } + + interface SinonSpyStatic { + /** + * Creates an anonymous function that records arguments, this value, exceptions and return values for all calls. + */ + (): SinonSpy; + /** + * Spies on the provided function + */ + (func: Function): SinonSpy; + /** + * Creates a spy for object.method and replaces the original method with the spy. + * An exception is thrown if the property is not already a function. + * The spy acts exactly like the original method in all cases. + * The original method can be restored by calling object.method.restore(). + * The returned spy is the function object which replaced the original method. spy === object.method. + */ + (obj: T, method: K): T[K] extends ( + ...args: infer TArgs + ) => infer TReturnValue + ? SinonSpy + : SinonSpy; + } + + interface SinonStub + extends SinonSpy { + /** + * Resets the stub’s behaviour to the default behaviour + * You can reset behaviour of all stubs using sinon.resetBehavior() + */ + resetBehavior(): void; + /** + * Resets both behaviour and history of the stub. + * This is equivalent to calling both stub.resetBehavior() and stub.resetHistory() + * Updated in sinon@2.0.0 + * Since sinon@5.0.0 + * As a convenience, you can apply stub.reset() to all stubs using sinon.reset() + */ + reset(): void; + /** + * Causes the stub to return promises using a specific Promise library instead of the global one when using stub.rejects or stub.resolves. + * Returns the stub to allow chaining. + */ + usingPromise(promiseLibrary: any): SinonStub; + + /** + * Makes the stub return the provided @param obj value. + * @param obj + */ + returns(obj: TReturnValue): SinonStub; + /** + * Causes the stub to return the argument at the provided @param index. + * stub.returnsArg(0); causes the stub to return the first argument. + * If the argument at the provided index is not available, prior to sinon@6.1.2, an undefined value will be returned; + * starting from sinon@6.1.2, a TypeError will be thrown. + * @param index + */ + returnsArg(index: number): SinonStub; + /** + * Causes the stub to return its this value. + * Useful for stubbing jQuery-style fluent APIs. + */ + returnsThis(): SinonStub; + /** + * Causes the stub to return a Promise which resolves to the provided value. + * When constructing the Promise, sinon uses the Promise.resolve method. + * You are responsible for providing a polyfill in environments which do not provide Promise. + * The Promise library can be overwritten using the usingPromise method. + * Since sinon@2.0.0 + */ + resolves(value?: any): SinonStub; + /** + * Causes the stub to return a Promise which resolves to the argument at the provided index. + * stub.resolvesArg(0); causes the stub to return a Promise which resolves to the first argument. + * If the argument at the provided index is not available, a TypeError will be thrown. + */ + resolvesArg(index: number): SinonStub; + /** + * Causes the stub to return a Promise which resolves to its this value. + */ + resolvesThis(): SinonStub; + /** + * Causes the stub to throw an exception (Error). + * @param type + */ + throws(type?: string): SinonStub; + /** + * Causes the stub to throw the provided exception object. + */ + throws(obj: any): SinonStub; + /** + * Causes the stub to throw the argument at the provided index. + * stub.throwsArg(0); causes the stub to throw the first argument as the exception. + * If the argument at the provided index is not available, a TypeError will be thrown. + * Since sinon@2.3.0 + * @param index + */ + throwsArg(index: number): SinonStub; + throwsException(type?: string): SinonStub; + throwsException(obj: any): SinonStub; + /** + * Causes the stub to return a Promise which rejects with an exception (Error). + * When constructing the Promise, sinon uses the Promise.reject method. + * You are responsible for providing a polyfill in environments which do not provide Promise. + * The Promise library can be overwritten using the usingPromise method. + * Since sinon@2.0.0 + */ + rejects(): SinonStub; + /** + * Causes the stub to return a Promise which rejects with an exception of the provided type. + * Since sinon@2.0.0 + */ + rejects(errorType: string): SinonStub; + /** + * Causes the stub to return a Promise which rejects with the provided exception object. + * Since sinon@2.0.0 + */ + rejects(value: any): SinonStub; + /** + * Causes the stub to call the argument at the provided index as a callback function. + * stub.callsArg(0); causes the stub to call the first argument as a callback. + * If the argument at the provided index is not available or is not a function, a TypeError will be thrown. + */ + callsArg(index: number): SinonStub; + /** + * Causes the original method wrapped into the stub to be called when none of the conditional stubs are matched. + */ + callThrough(): SinonStub; + /** + * Like stub.callsArg(index); but with an additional parameter to pass the this context. + * @param index + * @param context + */ + callsArgOn(index: number, context: any): SinonStub; + /** + * Like callsArg, but with arguments to pass to the callback. + * @param index + * @param args + */ + callsArgWith(index: number, ...args: any[]): SinonStub; + /** + * Like above but with an additional parameter to pass the this context. + * @param index + * @param context + * @param args + */ + callsArgOnWith( + index: number, + context: any, + ...args: any[] + ): SinonStub; + /** + * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. + * In Node environment the callback is deferred with process.nextTick. + * In a browser the callback is deferred with setTimeout(callback, 0). + * @param index + */ + callsArgAsync(index: number): SinonStub; + /** + * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. + * In Node environment the callback is deferred with process.nextTick. + * In a browser the callback is deferred with setTimeout(callback, 0). + * @param index + * @param context + */ + callsArgOnAsync(index: number, context: any): SinonStub; + /** + * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. + * In Node environment the callback is deferred with process.nextTick. + * In a browser the callback is deferred with setTimeout(callback, 0). + */ + callsArgWithAsync(index: number, ...args: any[]): SinonStub; + /** + * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. + * In Node environment the callback is deferred with process.nextTick. + * In a browser the callback is deferred with setTimeout(callback, 0). + */ + callsArgOnWithAsync( + index: number, + context: any, + ...args: any[] + ): SinonStub; + /** + * Makes the stub call the provided @param func when invoked. + * @param func + */ + callsFake(func: (...args: TArgs) => TReturnValue): SinonStub; + /** + * Replaces a new getter for this stub. + */ + get(func: () => any): SinonStub; + /** + * Defines a new setter for this stub. + * @param func + */ + set(func: (v: any) => void): SinonStub; + /** + * Defines the behavior of the stub on the @param n call. Useful for testing sequential interactions. + * There are methods onFirstCall, onSecondCall,onThirdCall to make stub definitions read more naturally. + * onCall can be combined with all of the behavior defining methods in this section. In particular, it can be used together with withArgs. + * @param n + */ + onCall(n: number): SinonStub; + /** + * Alias for stub.onCall(0); + */ + onFirstCall(): SinonStub; + /** + * Alias for stub.onCall(1); + */ + onSecondCall(): SinonStub; + /** + * Alias for stub.onCall(2); + */ + onThirdCall(): SinonStub; + /** + * Defines a new value for this stub. + * @param val + */ + value(val: any): SinonStub; + /** + * Set the displayName of the spy or stub. + * @param name + */ + named(name: string): SinonStub; + /** + * Similar to callsArg. + * Causes the stub to call the first callback it receives with the provided arguments (if any). + * If a method accepts more than one callback, you need to use callsArg to have the stub invoke other callbacks than the first one. + */ + yields(...args: any[]): SinonStub; + /** + * Like above but with an additional parameter to pass the this context. + */ + yieldsOn(context: any, ...args: any[]): SinonStub; + yieldsRight(...args: any[]): SinonStub; + /** + * Causes the spy to invoke a callback passed as a property of an object to the spy. + * Like yields, yieldsTo grabs the first matching argument, finds the callback and calls it with the (optional) arguments. + * @param property + * @param args + */ + yieldsTo(property: string, ...args: any[]): SinonStub; + /** + * Like above but with an additional parameter to pass the this context. + */ + yieldsToOn( + property: string, + context: any, + ...args: any[] + ): SinonStub; + /** + * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. + * In Node environment the callback is deferred with process.nextTick. + * In a browser the callback is deferred with setTimeout(callback, 0). + * @param args + */ + yieldsAsync(...args: any[]): SinonStub; + /** + * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. + * In Node environment the callback is deferred with process.nextTick. + * In a browser the callback is deferred with setTimeout(callback, 0). + * @param context + * @param args + */ + yieldsOnAsync(context: any, ...args: any[]): SinonStub; + /** + * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. + * In Node environment the callback is deferred with process.nextTick. + * In a browser the callback is deferred with setTimeout(callback, 0). + * @param property + * @param args + */ + yieldsToAsync(property: string, ...args: any[]): SinonStub; + /** + * Same as their corresponding non-Async counterparts, but with callback being deferred at called after all instructions in the current call stack are processed. + * In Node environment the callback is deferred with process.nextTick. + * In a browser the callback is deferred with setTimeout(callback, 0). + * @param property + * @param context + * @param args + */ + yieldsToOnAsync( + property: string, + context: any, + ...args: any[] + ): SinonStub; + /** + * Stubs the method only for the provided arguments. + * This is useful to be more expressive in your assertions, where you can access the spy with the same call. + * It is also useful to create a stub that can act differently in response to different arguments. + * @param args + */ + withArgs(...args: MatchArguments): SinonStub; + } + + interface SinonStubStatic { + /** + * Creates an anonymous stub function + */ + (): SinonStub; + /** + * Stubs all the object’s methods. + * Note that it’s usually better practice to stub individual methods, particularly on objects that you don’t understand or control all the methods for (e.g. library dependencies). + * Stubbing individual methods tests intent more precisely and is less susceptible to unexpected behavior as the object’s code evolves. + * If you want to create a stub object of MyConstructor, but don’t want the constructor to be invoked, use this utility function. + */ + (obj: T): SinonStubbedInstance; + /** + * Replaces obj.method with a stub function. + * An exception is thrown if the property is not already a function. + * The original function can be restored by calling object.method.restore(); (or stub.restore();). + */ + (obj: T, method: K): T[K] extends ( + ...args: infer TArgs + ) => infer TReturnValue + ? SinonStub + : SinonStub; + } + + interface SinonExpectation extends SinonStub { + /** + * Specify the minimum amount of calls expected. + */ + atLeast(n: number): SinonExpectation; + /** + * Specify the maximum amount of calls expected. + * @param n + */ + atMost(n: number): SinonExpectation; + /** + * Expect the method to never be called. + */ + never(): SinonExpectation; + /** + * Expect the method to be called exactly once. + */ + once(): SinonExpectation; + /** + * Expect the method to be called exactly twice. + */ + twice(): SinonExpectation; + /** + * Expect the method to be called exactly thrice. + */ + thrice(): SinonExpectation; + /** + * Expect the method to be called exactly @param n times. + */ + exactly(n: number): SinonExpectation; + /** + * Expect the method to be called with the provided arguments and possibly others. + * An expectation instance only holds onto a single set of arguments specified with withArgs. + * Subsequent calls will overwrite the previously-specified set of arguments (even if they are different), + * so it is generally not intended that this method be invoked more than once per test case. + * @param args + */ + withArgs(...args: any[]): SinonExpectation; + /** + * Expect the method to be called with the provided arguments and no others. + * An expectation instance only holds onto a single set of arguments specified with withExactArgs. + * Subsequent calls will overwrite the previously-specified set of arguments (even if they are different), + * so it is generally not intended that this method be invoked more than once per test case. + * @param args + */ + withExactArgs(...args: any[]): SinonExpectation; + on(obj: any): SinonExpectation; + /** + * Verifies all expectations on the mock. + * If any expectation is not satisfied, an exception is thrown. + * Also restores the mocked methods. + */ + verify(): SinonExpectation; + /** + * Restores all mocked methods. + */ + restore(): void; + } + + interface SinonExpectationStatic { + /** + * Creates an expectation without a mock object, basically an anonymous mock function. + * Method name is optional and is used in exception messages to make them more readable. + * @param methodName + */ + create(methodName?: string): SinonExpectation; + } + + interface SinonMock { + /** + * Overrides obj.method with a mock function and returns it. + */ + expects(method: string): SinonExpectation; + /** + * Restores all mocked methods. + */ + restore(): void; + /** + * Verifies all expectations on the mock. + * If any expectation is not satisfied, an exception is thrown. + * Also restores the mocked methods. + */ + verify(): void; + } + + interface SinonMockStatic { + (): SinonExpectation; + /** + * Creates a mock for the provided object. + * Does not change the object, but returns a mock object to set expectations on the object’s methods. + */ + (obj: any): SinonMock; + } + + type SinonTimerId = number | { id: number }; + + interface SinonFakeTimers { + now: number; + + setTimeout( + callback: (...args: any[]) => void, + timeout: number, + ...args: any[] + ): SinonTimerId; + clearTimeout(id: SinonTimerId): void; + setInterval( + callback: (...args: any[]) => void, + timeout: number, + ...args: any[] + ): SinonTimerId; + clearInterval(id: SinonTimerId): void; + setImmediate( + callback: (...args: any[]) => void, + ...args: any[] + ): SinonTimerId; + clearImmediate(id: SinonTimerId): void; + requestAnimationFrame(callback: (...args: any[]) => void): number; + cancelAnimationFrame(id: number): void; + nextTick(callback: () => void): void; + + /** + * Tick the clock ahead time milliseconds. + * Causes all timers scheduled within the affected time range to be called. + * time may be the number of milliseconds to advance the clock by or a human-readable string. + * Valid string formats are “08” for eight seconds, “01:00” for one minute and “02:34:10” for two hours, 34 minutes and ten seconds. + * time may be negative, which causes the clock to change but won’t fire any callbacks. + * @param ms + */ + tick(ms: number | string): void; + /** + * Advances the clock to the the moment of the first scheduled timer, firing it. + */ + next(): void; + /** + * This runs all pending timers until there are none remaining. If new timers are added while it is executing they will be run as well. + * This makes it easier to run asynchronous tests to completion without worrying about the number of timers they use, or the delays in those timers. + */ + runAll(): void; + runToLast(): void; + reset(): void; + runMicrotasks(): void; + runToFrame(): void; + + Date(): Date; + Date(year: number): Date; + Date(year: number, month: number): Date; + Date(year: number, month: number, day: number): Date; + Date(year: number, month: number, day: number, hour: number): Date; + Date( + year: number, + month: number, + day: number, + hour: number, + minute: number + ): Date; + Date( + year: number, + month: number, + day: number, + hour: number, + minute: number, + second: number + ): Date; + Date( + year: number, + month: number, + day: number, + hour: number, + minute: number, + second: number, + ms: number + ): Date; + + /** + * Restore the faked methods. + * Call in e.g. tearDown. + */ + restore(): void; + uninstall(): void; + + /** + * Simulate the user changing the system clock while your program is running. It changes the 'now' timestamp + * without affecting timers, intervals or immediates. + * @param now The new 'now' in unix milliseconds + */ + setSystemTime(now: number): void; + /** + * Simulate the user changing the system clock while your program is running. It changes the 'now' timestamp + * without affecting timers, intervals or immediates. + * @param now The new 'now' as a JavaScript Date + */ + setSystemTime(date: Date): void; + } + + interface SinonFakeTimersConfig { + now: number | Date; + toFake: string[]; + shouldAdvanceTime: boolean; + } + + interface SinonFakeUploadProgress { + eventListeners: { + progress: any[]; + load: any[]; + abort: any[]; + error: any[]; + }; + + addEventListener(event: string, listener: (e: Event) => any): void; + removeEventListener(event: string, listener: (e: Event) => any): void; + dispatchEvent(event: Event): void; + } + + interface SinonFakeXMLHttpRequest { + // Properties + /** + * The URL set on the request object. + */ + url: string; + /** + * The request method as a string. + */ + method: string; + /** + * An object of all request headers, i.e.: + */ + requestHeaders: any; + /** + * The request body + */ + requestBody: string; + /** + * The request’s status code. + * undefined if the request has not been handled (see respond below) + */ + status: number; + /** + * Only populated if the respond method is called (see below). + */ + statusText: string; + /** + * Whether or not the request is asynchronous. + */ + async: boolean; + /** + * Username, if any. + */ + username: string; + /** + * Password, if any. + */ + password: string; + withCredentials: boolean; + upload: SinonFakeUploadProgress; + /** + * When using respond, this property is populated with a parsed document if response headers indicate as much (see the spec) + */ + responseXML: Document; + /** + * The value of the given response header, if the request has been responded to (see respond). + * @param header + */ + getResponseHeader(header: string): string; + /** + * All response headers as an object. + */ + getAllResponseHeaders(): any; + + // Methods + /** + * Sets response headers (e.g. { "Content-Type": "text/html", ... }, updates the readyState property and fires onreadystatechange. + * @param headers + */ + setResponseHeaders(headers: any): void; + /** + * Sets the respond body, updates the readyState property and fires onreadystatechange. + * Additionally, populates responseXML with a parsed document if response headers indicate as much. + */ + setResponseBody(body: string): void; + /** + * Calls the above three methods. + */ + respond(status: number, headers: any, body: string): void; + autoRespond(ms: number): void; + /** + * Simulates a network error on the request. The onerror handler will be called and the status will be 0. + */ + error(): void; + onerror(): void; + } + + interface SinonFakeXMLHttpRequestStatic { + new (): SinonFakeXMLHttpRequest; + /** + * Default false. + * When set to true, Sinon will check added filters if certain requests should be “unfaked” + */ + useFilters: boolean; + /** + * Add a filter that will decide whether or not to fake a request. + * The filter will be called when xhr.open is called, with the exact same arguments (method, url, async, username, password). + * If the filter returns true, the request will not be faked. + * @param filter + */ + addFilter( + filter: ( + method: string, + url: string, + async: boolean, + username: string, + password: string + ) => boolean + ): void; + /** + * By assigning a function to the onCreate property of the returned object from useFakeXMLHttpRequest() + * you can subscribe to newly created FakeXMLHttpRequest objects. See below for the fake xhr object API. + * Using this observer means you can still reach objects created by e.g. jQuery.ajax (or other abstractions/frameworks). + * @param xhr + */ + onCreate(xhr: SinonFakeXMLHttpRequest): void; + /** + * Restore original function(s). + */ + restore(): void; + } + + interface SinonFakeServer extends SinonFakeServerOptions { + // Properties + /** + * Used internally to determine the HTTP method used with the provided request. + * By default this method simply returns request.method. + * When server.fakeHTTPMethods is true, the method will return the value of the _method parameter if the method is “POST”. + * This method can be overridden to provide custom behavior. + * @param request + */ + getHTTPMethod(request: SinonFakeXMLHttpRequest): string; + /** + * You can inspect the server.requests to verify request ordering, find unmatched requests or check that no requests has been done. + * server.requests is an array of all the FakeXMLHttpRequest objects that have been created. + */ + requests: SinonFakeXMLHttpRequest[]; + + // Methods + /** + * Causes the server to respond to any request not matched by another response with the provided data. The default catch-all response is [404, {}, ""]. + * A String representing the response body + * An Array with status, headers and response body, e.g. [200, { "Content-Type": "text/html", "Content-Length": 2 }, "OK"] + * A Function. + * Default status is 200 and default headers are none. + * When the response is a Function, it will be passed the request object. You must manually call respond on it to complete the request. + * @param body A String representing the response body + */ + respondWith(body: string): void; + /** + * Causes the server to respond to any request not matched by another response with the provided data. The default catch-all response is [404, {}, ""]. + * Default status is 200 and default headers are none. + * When the response is a Function, it will be passed the request object. You must manually call respond on it to complete the request. + * @param response An Array with status, headers and response body, e.g. [200, { "Content-Type": "text/html", "Content-Length": 2 }, "OK"] + */ + respondWith(response: any[]): void; + /** + * Causes the server to respond to any request not matched by another response with the provided data. The default catch-all response is [404, {}, ""]. + * Default status is 200 and default headers are none. + * When the response is a Function, it will be passed the request object. You must manually call respond on it to complete the request. + * @param fn A Function. + */ + respondWith(fn: (xhr: SinonFakeXMLHttpRequest) => void): void; + /** + * Responds to all requests to given URL, e.g. /posts/1. + */ + respondWith(url: string, body: string): void; + /** + * Responds to all requests to given URL, e.g. /posts/1. + */ + respondWith(url: string, response: any[]): void; + /** + * Responds to all requests to given URL, e.g. /posts/1. + */ + respondWith( + url: string, + fn: (xhr: SinonFakeXMLHttpRequest) => void + ): void; + /** + * Responds to all method requests to the given URL with the given response. + * method is an HTTP verb. + */ + respondWith(method: string, url: string, body: string): void; + /** + * Responds to all method requests to the given URL with the given response. + * method is an HTTP verb. + */ + respondWith(method: string, url: string, response: any[]): void; + /** + * Responds to all method requests to the given URL with the given response. + * method is an HTTP verb. + */ + respondWith( + method: string, + url: string, + fn: (xhr: SinonFakeXMLHttpRequest) => void + ): void; + /** + * URL may be a regular expression, e.g. /\\/post\\//\\d+ + * If the response is a Function, it will be passed any capture groups from the regular expression along with the XMLHttpRequest object: + */ + respondWith(url: RegExp, body: string): void; + /** + * URL may be a regular expression, e.g. /\\/post\\//\\d+ + * If the response is a Function, it will be passed any capture groups from the regular expression along with the XMLHttpRequest object: + */ + respondWith(url: RegExp, response: any[]): void; + /** + * URL may be a regular expression, e.g. /\\/post\\//\\d+ + * If the response is a Function, it will be passed any capture groups from the regular expression along with the XMLHttpRequest object: + */ + respondWith( + url: RegExp, + fn: (xhr: SinonFakeXMLHttpRequest) => void + ): void; + /** + * Responds to all method requests to URLs matching the regular expression. + */ + respondWith(method: string, url: RegExp, body: string): void; + /** + * Responds to all method requests to URLs matching the regular expression. + */ + respondWith(method: string, url: RegExp, response: any[]): void; + /** + * Responds to all method requests to URLs matching the regular expression. + */ + respondWith( + method: string, + url: RegExp, + fn: (xhr: SinonFakeXMLHttpRequest) => void + ): void; + /** + * Causes all queued asynchronous requests to receive a response. + * If none of the responses added through respondWith match, the default response is [404, {}, ""]. + * Synchronous requests are responded to immediately, so make sure to call respondWith upfront. + * If called with arguments, respondWith will be called with those arguments before responding to requests. + */ + respond(): void; + restore(): void; + } + + interface SinonFakeServerOptions { + /** + * When set to true, causes the server to automatically respond to incoming requests after a timeout. + * The default timeout is 10ms but you can control it through the autoRespondAfter property. + * Note that this feature is intended to help during mockup development, and is not suitable for use in tests. + */ + autoRespond: boolean; + /** + * When autoRespond is true, respond to requests after this number of milliseconds. Default is 10. + */ + autoRespondAfter: number; + /** + * If set to true, server will find _method parameter in POST body and recognize that as the actual method. + * Supports a pattern common to Ruby on Rails applications. For custom HTTP method faking, override server.getHTTPMethod(request). + */ + fakeHTTPMethods: boolean; + /** + * If set, the server will respond to every request immediately and synchronously. + * This is ideal for faking the server from within a test without having to call server.respond() after each request made in that test. + * As this is synchronous and immediate, this is not suitable for simulating actual network latency in tests or mockups. + * To simulate network latency with automatic responses, see server.autoRespond and server.autoRespondAfter. + */ + respondImmediately: boolean; + } + + interface SinonFakeServerStatic { + create(options?: Partial): SinonFakeServer; + } + + interface SinonExposeOptions { + prefix: string; + includeFail: boolean; + } + + interface SinonAssert { + // Properties + /** + * Defaults to AssertError. + */ + failException: string; + /** + * Every assertion fails by calling this method. + * By default it throws an error of type sinon.assert.failException. + * If the test framework looks for assertion errors by checking for a specific exception, you can simply override the kind of exception thrown. + * If that does not fit with your testing framework of choice, override the fail method to do the right thing. + */ + fail(message?: string): void; // Overridable + /** + * Called every time assertion passes. + * Default implementation does nothing. + */ + pass(assertion: any): void; // Overridable + + // Methods + /** + * Passes if spy was never called + * @param spy + */ + notCalled(spy: SinonSpy): void; + /** + * Passes if spy was called at least once. + */ + called(spy: SinonSpy): void; + /** + * Passes if spy was called once and only once. + */ + calledOnce(spy: SinonSpy): void; + /** + * Passes if spy was called exactly twice. + */ + calledTwice(spy: SinonSpy): void; + /** + * Passes if spy was called exactly three times. + */ + calledThrice(spy: SinonSpy): void; + /** + * Passes if spy was called exactly num times. + */ + callCount(spy: SinonSpy, count: number): void; + /** + * Passes if provided spies were called in the specified order. + * @param spies + */ + callOrder(...spies: SinonSpy[]): void; + /** + * Passes if spy was ever called with obj as its this value. + * It’s possible to assert on a dedicated spy call: sinon.assert.calledOn(spy.firstCall, arg1, arg2, ...);. + */ + calledOn(spyOrSpyCall: SinonSpy | SinonSpyCall, obj: any): void; + /** + * Passes if spy was always called with obj as its this value. + */ + alwaysCalledOn(spy: SinonSpy, obj: any): void; + /** + * Passes if spy was called with the provided arguments. + * It’s possible to assert on a dedicated spy call: sinon.assert.calledWith(spy.firstCall, arg1, arg2, ...);. + * @param spyOrSpyCall + * @param args + */ + calledWith(spyOrSpyCall: SinonSpy | SinonSpyCall, ...args: any[]): void; + /** + * Passes if spy was always called with the provided arguments. + * @param spy + * @param args + */ + alwaysCalledWith(spy: SinonSpy, ...args: any[]): void; + /** + * Passes if spy was never called with the provided arguments. + * @param spy + * @param args + */ + neverCalledWith(spy: SinonSpy, ...args: any[]): void; + /** + * Passes if spy was called with the provided arguments and no others. + * It’s possible to assert on a dedicated spy call: sinon.assert.calledWithExactly(spy.getCall(1), arg1, arg2, ...);. + * @param spyOrSpyCall + * @param args + */ + calledWithExactly( + spyOrSpyCall: SinonSpy | SinonSpyCall, + ...args: any[] + ): void; + /** + * Passes if spy was always called with the provided arguments and no others. + */ + alwaysCalledWithExactly(spy: SinonSpy, ...args: any[]): void; + /** + * Passes if spy was called with matching arguments. + * This behaves the same way as sinon.assert.calledWith(spy, sinon.match(arg1), sinon.match(arg2), ...). + * It’s possible to assert on a dedicated spy call: sinon.assert.calledWithMatch(spy.secondCall, arg1, arg2, ...);. + */ + calledWithMatch( + spyOrSpyCall: SinonSpy | SinonSpyCall, + ...args: any[] + ): void; + /** + * Passes if spy was always called with matching arguments. + * This behaves the same way as sinon.assert.alwaysCalledWith(spy, sinon.match(arg1), sinon.match(arg2), ...). + */ + alwaysCalledWithMatch(spy: SinonSpy, ...args: any[]): void; + /** + * Passes if spy was never called with matching arguments. + * This behaves the same way as sinon.assert.neverCalledWith(spy, sinon.match(arg1), sinon.match(arg2), ...). + * @param spy + * @param args + */ + neverCalledWithMatch(spy: SinonSpy, ...args: any[]): void; + /** + * Passes if spy was called with the new operator. + * It’s possible to assert on a dedicated spy call: sinon.assert.calledWithNew(spy.secondCall, arg1, arg2, ...);. + * @param spyOrSpyCall + */ + calledWithNew(spyOrSpyCall: SinonSpy | SinonSpyCall): void; + /** + * Passes if spy threw any exception. + */ + threw(spyOrSpyCall: SinonSpy | SinonSpyCall): void; + /** + * Passes if spy threw the given exception. + * The exception is an actual object. + * It’s possible to assert on a dedicated spy call: sinon.assert.threw(spy.thirdCall, exception);. + */ + threw(spyOrSpyCall: SinonSpy | SinonSpyCall, exception: string): void; + /** + * Passes if spy threw the given exception. + * The exception is a String denoting its type. + * It’s possible to assert on a dedicated spy call: sinon.assert.threw(spy.thirdCall, exception);. + */ + threw(spyOrSpyCall: SinonSpy | SinonSpyCall, exception: any): void; + /** + * Like threw, only required for all calls to the spy. + */ + alwaysThrew(spy: SinonSpy): void; + /** + * Like threw, only required for all calls to the spy. + */ + alwaysThrew(spy: SinonSpy, exception: string): void; + /** + * Like threw, only required for all calls to the spy. + */ + alwaysThrew(spy: SinonSpy, exception: any): void; + /** + * Uses sinon.match to test if the arguments can be considered a match. + */ + match(actual: any, expected: any): void; + /** + * Exposes assertions into another object, to better integrate with the test framework. + * For instance, JsTestDriver uses global assertions, and to make Sinon.JS assertions appear alongside them, you can do. + * @example sinon.assert.expose(this); + * This will give you assertCalled(spy),assertCallOrder(spy1, spy2, ...) and so on. + * The method accepts an optional options object with two options. + */ + expose(obj: any, options?: Partial): void; + } + + interface SinonMatcher { + /** + * All matchers implement and and or. This allows to logically combine mutliple matchers. + * The result is a new matchers that requires both (and) or one of the matchers (or) to return true. + * @example var stringOrNumber = sinon.match.string.or(sinon.match.number); + * var bookWithPages = sinon.match.instanceOf(Book).and(sinon.match.has("pages")); + */ + and(expr: SinonMatcher): SinonMatcher; + /** + * All matchers implement and and or. This allows to logically combine mutliple matchers. + * The result is a new matchers that requires both (and) or one of the matchers (or) to return true. + * @example var stringOrNumber = sinon.match.string.or(sinon.match.number); + * var bookWithPages = sinon.match.instanceOf(Book).and(sinon.match.has("pages")); + */ + or(expr: SinonMatcher): SinonMatcher; + test(val: any): boolean; + } + + interface SinonArrayMatcher extends SinonMatcher { + /** + * Requires an Array to be deep equal another one. + */ + deepEquals(expected: any[]): SinonMatcher; + /** + * Requires an Array to start with the same values as another one. + */ + startsWith(expected: any[]): SinonMatcher; + /** + * Requires an Array to end with the same values as another one. + */ + endsWith(expected: any[]): SinonMatcher; + /** + * Requires an Array to contain each one of the values the given array has. + */ + contains(expected: any[]): SinonMatcher; + } + + interface SimplifiedSet { + has(el: any): boolean; + } + + interface SimplifiedMap extends SimplifiedSet { + get(key: any): any; + } + + interface SinonMapMatcher extends SinonMatcher { + /** + * Requires a Map to be deep equal another one. + */ + deepEquals(expected: SimplifiedMap): SinonMatcher; + /** + * Requires a Map to contain each one of the items the given map has. + */ + contains(expected: SimplifiedMap): SinonMatcher; + } + + interface SinonSetMatcher extends SinonMatcher { + /** + * Requires a Set to be deep equal another one. + */ + deepEquals(expected: SimplifiedSet): SinonMatcher; + /** + * Requires a Set to contain each one of the items the given set has. + */ + contains(expected: SimplifiedSet): SinonMatcher; + } + + interface SinonMatch { + /** + * Requires the value to be == to the given number. + */ + (value: number): SinonMatcher; + /** + * Requires the value to be a string and have the expectation as a substring. + */ + (value: string): SinonMatcher; + /** + * Requires the value to be a string and match the given regular expression. + */ + (expr: RegExp): SinonMatcher; + /** + * See custom matchers. + */ + (callback: (value: any) => boolean, message?: string): SinonMatcher; + /** + * Requires the value to be not null or undefined and have at least the same properties as expectation. + * This supports nested matchers. + */ + (obj: object): SinonMatcher; + /** + * Matches anything. + */ + any: SinonMatcher; + /** + * Requires the value to be defined. + */ + defined: SinonMatcher; + /** + * Requires the value to be truthy. + */ + truthy: SinonMatcher; + /** + * Requires the value to be falsy. + */ + falsy: SinonMatcher; + /** + * Requires the value to be a Boolean + */ + bool: SinonMatcher; + /** + * Requires the value to be a Number. + */ + number: SinonMatcher; + /** + * Requires the value to be a String. + */ + string: SinonMatcher; + /** + * Requires the value to be an Object. + */ + object: SinonMatcher; + /** + * Requires the value to be a Function. + */ + func: SinonMatcher; + /** + * Requires the value to be a Map. + */ + map: SinonMapMatcher; + /** + * Requires the value to be a Set. + */ + set: SinonSetMatcher; + /** + * Requires the value to be an Array. + */ + array: SinonArrayMatcher; + /** + * Requires the value to be a regular expression. + */ + regexp: SinonMatcher; + /** + * Requires the value to be a Date object. + */ + date: SinonMatcher; + /** + * Requires the value to be a Symbol. + */ + symbol: SinonMatcher; + /** + * Requires the value to strictly equal ref. + */ + same(obj: any): SinonMatcher; + /** + * Requires the value to be of the given type, where type can be one of "undefined", "null", "boolean", "number", "string", "object", "function", "array", "regexp", "date" or "symbol". + */ + typeOf(type: string): SinonMatcher; + /** + * Requires the value to be an instance of the given type. + */ + instanceOf(type: any): SinonMatcher; + /** + * Requires the value to define the given property. + * The property might be inherited via the prototype chain. + * If the optional expectation is given, the value of the property is deeply compared with the expectation. + * The expectation can be another matcher. + * @param property + * @param expect + */ + has(property: string, expect?: any): SinonMatcher; + /** + * Same as sinon.match.has but the property must be defined by the value itself. Inherited properties are ignored. + * @param property + * @param expect + */ + hasOwn(property: string, expect?: any): SinonMatcher; + /** + * Requires the value to define the given propertyPath. Dot (prop.prop) and bracket (prop[0]) notations are supported as in Lodash.get. + * The propertyPath might be inherited via the prototype chain. + * If the optional expectation is given, the value at the propertyPath is deeply compared with the expectation. + * The expectation can be another matcher. + */ + hasNested(path: string, expect?: any): SinonMatcher; + /** + * Requires every element of an Array, Set or Map, or alternatively every value of an Object to match the given matcher. + */ + every(matcher: SinonMatcher): SinonMatcher; + /** + * Requires any element of an Array, Set or Map, or alternatively any value of an Object to match the given matcher. + */ + some(matcher: SinonMatcher): SinonMatcher; + } + + interface SinonSandboxConfig { + /** + * The sandbox’s methods can be injected into another object for convenience. + * The injectInto configuration option can name an object to add properties to. + */ + injectInto: object | null; + /** + * What properties to inject. + * Note that simply naming “server” here is not sufficient to have a server property show up in the target object, + * you also have to set useFakeServer to true. + */ + properties: string[]; + /** + * If set to true, the sandbox will have a clock property. + * You can optionally pass in a configuration object that follows the specification for fake timers, such as { toFake: ["setTimeout", "setInterval"] }. + */ + useFakeTimers: boolean | Partial; + /** + * If true, server and requests properties are added to the sandbox. Can also be an object to use for fake server. + * The default one is sinon.fakeServer, but if you’re using jQuery 1.3.x or some other library that does not set the XHR’s onreadystatechange handler, + * you might want to do: + */ + useFakeServer: boolean | SinonFakeServer; + } + + /** + * Stubbed type of an object with members replaced by stubs. + * + * @template TType Type being stubbed. + */ + type StubbableType = Function & { prototype: TType }; + + /** + * An instance of a stubbed object type with functions replaced by stubs. + * + * @template TType Object type being stubbed. + */ + type SinonStubbedInstance = { + [P in keyof TType]: SinonStubbedMember + }; + + /** + * Replaces a type with a Sinon stub if it's a function. + */ + type SinonStubbedMember = T extends Function ? SinonStub : T; + + interface SinonFake { + /** + * Creates a basic fake, with no behavior + */ + (): SinonSpy; + /** + * Wraps an existing Function to record all interactions, while leaving it up to the func to provide the behavior. + * This is useful when complex behavior not covered by the sinon.fake.* methods is required or when wrapping an existing function or method. + */ + (fn: Function): SinonSpy; + /** + * Creates a fake that returns the val argument + * @param val Returned value + */ + returns(val: any): SinonSpy; + /** + * Creates a fake that throws an Error with the provided value as the message property. + * If an Error is passed as the val argument, then that will be the thrown value. If any other value is passed, then that will be used for the message property of the thrown Error. + * @param val Returned value or throw value if an Error + */ + throws(val: Error | string): SinonSpy; + /** + * Creates a fake that returns a resolved Promise for the passed value. + * @param val Resolved promise + */ + resolves(val: any): SinonSpy; + /** + * Creates a fake that returns a rejected Promise for the passed value. + * If an Error is passed as the value argument, then that will be the value of the promise. + * If any other value is passed, then that will be used for the message property of the Error returned by the promise. + * @param val Rejected promise + */ + rejects(val: any): SinonSpy; + /** + * fake expects the last argument to be a callback and will invoke it with the given arguments. + */ + yields(...args: any[]): SinonSpy; + /** + * fake expects the last argument to be a callback and will invoke it asynchronously with the given arguments. + */ + yieldsAsync(...args: any[]): SinonSpy; + } + + interface SinonSandbox { + /** + * A convenience reference for sinon.assert + * Since sinon@2.0.0 + */ + assert: SinonAssert; + clock: SinonFakeTimers; + requests: SinonFakeXMLHttpRequest[]; + server: SinonFakeServer; + /** + * Works exactly like sinon.spy + */ + spy: SinonSpyStatic; + /** + * Works exactly like sinon.stub. + */ + stub: SinonStubStatic; + /** + * Works exactly like sinon.mock + */ + mock: SinonMockStatic; + + /** + * * No param : Causes Sinon to replace the global setTimeout, clearTimeout, setInterval, clearInterval, setImmediate, clearImmediate, process.hrtime, performance.now(when available) + * and Date with a custom implementation which is bound to the returned clock object. + * Starts the clock at the UNIX epoch (timestamp of 0). + * * Now : As above, but rather than starting the clock with a timestamp of 0, start at the provided timestamp now. + * Since sinon@2.0.0 + * You can also pass in a Date object, and its getTime() will be used for the starting timestamp. + * * Config : As above, but allows further configuration options, some of which are: + * * config.now - Number/Date - installs lolex with the specified unix epoch (default: 0) + * * config.toFake - String[ ] - an array with explicit function names to fake. + * By default lolex will automatically fake all methods except process.nextTick. You could, however, still fake nextTick by providing it explicitly + * * config.shouldAdvanceTime - Boolean - tells lolex to increment mocked time automatically based on the real system time shift (default: false) + * * Please visit the lolex.install documentation for the full feature set. + * * Important note: when faking nextTick, normal calls to process.nextTick() would not execute automatically as they would during normal event-loop phases. + * You would have to call either clock.next(), clock.tick(), clock.runAll() or clock.runToLast() (see example below). Please refer to the lolex documentation for more information. + * @param config + */ + useFakeTimers( + config?: number | Date | Partial + ): SinonFakeTimers; + /** + * Causes Sinon to replace the native XMLHttpRequest object in browsers that support it with a custom implementation which does not send actual requests. + * In browsers that support ActiveXObject, this constructor is replaced, and fake objects are returned for XMLHTTP progIds. + * Other progIds, such as XMLDOM are left untouched. + * The native XMLHttpRequest object will be available at sinon.xhr.XMLHttpRequest + */ + useFakeXMLHttpRequest(): SinonFakeXMLHttpRequestStatic; + /** + * Fakes XHR and binds a server object to the sandbox such that it too is restored when calling sandbox.restore(). + * Access requests through sandbox.requests and server through sandbox.server + */ + useFakeServer(): SinonFakeServer; + /** + * Restores all fakes created through sandbox. + */ + restore(): void; + /** + * Resets the internal state of all fakes created through sandbox. + */ + reset(): void; + /** + * Resets the history of all stubs created through the sandbox. + * Since sinon@2.0.0 + */ + resetHistory(): void; + /** + * Resets the behaviour of all stubs created through the sandbox. + * Since sinon@2.0.0 + */ + resetBehavior(): void; + /** + * Causes all stubs created from the sandbox to return promises using a specific Promise library instead of the global one when using stub.rejects or stub.resolves. + * Returns the stub to allow chaining. + * Since sinon@2.0.0 + */ + usingPromise(promiseLibrary: any): SinonSandbox; + /** + * Verifies all mocks created through the sandbox. + */ + verify(): void; + /** + * Verifies all mocks and restores all fakes created through the sandbox. + */ + verifyAndRestore(): void; + + /** + * Replaces property on object with replacement argument. Attempts to replace an already replaced value cause an exception. + * replacement can be any value, including spies, stubs and fakes. + * This method only works on non-accessor properties, for replacing accessors, use sandbox.replaceGetter() and sandbox.replaceSetter(). + */ + replace( + obj: T, + prop: TKey, + replacement: T[TKey] + ): T[TKey]; + /** + * Replaces getter for property on object with replacement argument. Attempts to replace an already replaced getter cause an exception. + * replacement must be a Function, and can be instances of spies, stubs and fakes. + * @param obj + * @param prop + * @param replacement + */ + replaceGetter( + obj: T, + prop: TKey, + replacement: () => T[TKey] + ): () => T[TKey]; + /** + * Replaces setter for property on object with replacement argument. Attempts to replace an already replaced setter cause an exception. + * replacement must be a Function, and can be instances of spies, stubs and fakes. + * @param obj + * @param prop + * @param replacement + */ + replaceSetter( + obj: T, + prop: TKey, + replacement: (val: T[TKey]) => void + ): (val: T[TKey]) => void; + + /** + * Creates a new object with the given functions as the prototype and stubs all implemented functions. + * + * @template TType Type being stubbed. + * @param constructor Object or class to stub. + * @returns A stubbed version of the constructor. + * @remarks The given constructor function is not invoked. See also the stub API. + */ + createStubInstance( + constructor: StubbableType + ): SinonStubbedInstance; + } + + interface SinonApi { + fake: SinonFake; + match: SinonMatch; + spyCall(...args: any[]): SinonSpyCall; + expectation: SinonExpectationStatic; + + clock: { + create(now: number | Date): SinonFakeTimers; + }; + + FakeXMLHttpRequest: SinonFakeXMLHttpRequestStatic; + + fakeServer: SinonFakeServerStatic; + fakeServerWithClock: SinonFakeServerStatic; + + /** + * Creates a new sandbox object with spies, stubs, and mocks. + * @param config + */ + createSandbox(config?: Partial): SinonSandbox; + defaultConfig: Partial; + } + + interface LegacySandbox { + sandbox: { + /** + * @deprecated Since 5.0, use `sinon.createSandbox` instead + */ + create(config?: Partial): SinonSandbox; + }; + } + + type SinonStatic = SinonSandbox & LegacySandbox & SinonApi; +} + +declare const Sinon: Sinon.SinonStatic; + +export = Sinon; +export as namespace sinon; diff --git a/types/sinon/ts3.1/sinon-tests.ts b/types/sinon/ts3.1/sinon-tests.ts new file mode 100644 index 0000000000..b892f22980 --- /dev/null +++ b/types/sinon/ts3.1/sinon-tests.ts @@ -0,0 +1,488 @@ +import sinon = require("sinon"); + +function testSandbox() { + const obj = {}; + + sinon.createSandbox({ + injectInto: obj, + properties: ['spy', 'stub'], + useFakeTimers: true, + useFakeServer: true + }); + sinon.createSandbox({ + injectInto: null + }); + sinon.createSandbox({ + useFakeTimers: { + now: 1000, + shouldAdvanceTime: false + }, + useFakeServer: sinon.fakeServer.create() + }); + sinon.createSandbox(sinon.defaultConfig); + sinon.sandbox.create(); + sinon.sandbox.create(sinon.defaultConfig); + + const sb = sinon.createSandbox(); + + sb.assert.pass('foo'); + sb.clock.tick(1000); + sb.spy(); + sb.stub(); + sb.mock(obj); + + sb.useFakeTimers(); + sb.useFakeTimers(1000); + sb.useFakeTimers(new Date()); + sb.useFakeTimers({ + now: 1000 + }); + + const xhr = sb.useFakeXMLHttpRequest(); + xhr.useFilters = true; + xhr.restore(); + + const server = sb.useFakeServer(); + server.respondWith('foo'); + + sb.restore(); + sb.reset(); + sb.resetHistory(); + sb.resetBehavior(); + sb.usingPromise(Promise); + sb.verify(); + sb.verifyAndRestore(); + + const replaceMe = { + prop: 5, + method() { return 6; }, + get getter() { return 7; }, + get setter() { return true; }, + set setter(val) { } + }; + + sb.replace(replaceMe, 'prop', 10); + sb.replace(replaceMe, 'method', sb.spy()); + sb.replaceGetter(replaceMe, 'getter', () => 14); + sb.replaceSetter(replaceMe, 'setter', (v) => { }); + + const cls = class { + foo() { } + bar: number; + }; + const PrivateFoo = class { + private constructor() { } + foo() { } + bar: number; + static create() { + return new PrivateFoo(); + } + }; + + const stubInstance = sb.createStubInstance(cls); + const privateFooStubbedInstance = sb.createStubInstance(PrivateFoo); + stubInstance.foo.calledWith('foo'); + privateFooStubbedInstance.foo.calledWith('foo'); + const clsFoo: sinon.SinonStub = stubInstance.foo; + const privateFooFoo: sinon.SinonStub = privateFooStubbedInstance.foo; + const clsBar: number = stubInstance.bar; + const privateFooBar: number = privateFooStubbedInstance.bar; +} + +function testFakeServer() { + let s = sinon.fakeServer.create(); + s = sinon.fakeServerWithClock.create(); + + sinon.fakeServer.create({ + autoRespond: true, + autoRespondAfter: 3, + fakeHTTPMethods: true, + respondImmediately: false + }); + + sinon.fakeServer.create({ + autoRespond: true, + autoRespondAfter: 3 + }); +} + +function testXHR() { + const xhr = new sinon.FakeXMLHttpRequest(); + const headers = xhr.getAllResponseHeaders(); + const header = xhr.getResponseHeader('foo'); + + xhr.setResponseHeaders({ 'Content-Type': 'text/html' }); + xhr.setResponseBody('foo'); + xhr.respond(200, { 'Content-Type': 'foo' }, 'bar'); + xhr.error(); + + sinon.FakeXMLHttpRequest.useFilters = true; + sinon.FakeXMLHttpRequest.addFilter((method, url, async, user, pass) => true); + sinon.FakeXMLHttpRequest.onCreate = (xhr) => { }; + sinon.FakeXMLHttpRequest.restore(); +} + +function testClock() { + let clock = sinon.clock.create(1000); + clock = sinon.clock.create(new Date()); + + let now = 0; + now = clock.now; + + const fn = () => { }; + + clock.setTimeout(fn, 0); + clock.setTimeout(fn, 0, 'a', 'b'); + clock.setInterval(fn, 0); + clock.setInterval(fn, 0, 'a', 'b'); + clock.setImmediate(fn); + clock.setImmediate(fn, 'a', 'b'); + clock.requestAnimationFrame(fn); + + let timer = clock.setTimeout(fn, 0); + clock.clearTimeout(timer); + timer = clock.setInterval(fn, 0); + clock.clearInterval(timer); + timer = clock.setImmediate(fn); + clock.clearImmediate(timer); + + const animTimer = clock.requestAnimationFrame(fn); + clock.cancelAnimationFrame(animTimer); + + clock.nextTick(fn); + clock.tick(1); + clock.tick('00:10'); + clock.next(); + clock.runAll(); + clock.runToLast(); + clock.reset(); + clock.runMicrotasks(); + clock.runToFrame(); + clock.restore(); + clock.uninstall(); + clock.setSystemTime(1000); + clock.setSystemTime(new Date()); +} + +function testExpectation() { + const obj = {}; + + let ex = sinon.expectation.create(); + ex = sinon.expectation.create('some name'); + + ex.atLeast(5).atMost(10); + ex.never(); + ex.once(); + ex.twice(); + ex.thrice(); + ex.exactly(5); + ex.withArgs('a', 'b'); + ex.withExactArgs('a', 'b'); + ex.on(obj); + ex.verify(); + ex.restore(); +} + +function testMatch() { + const obj = {}; + const fn = () => { }; + + sinon.match(5).test(5); + sinon.match('str').test('foo'); + sinon.match(/foo/).test('foo'); + sinon.match({ a: 5, b: 6 }).test({}); + sinon.match((v) => true).test('foo'); + sinon.match((v) => true, 'some message').test('foo'); + sinon.match.any.test('foo'); + sinon.match.defined.test('foo'); + sinon.match.truthy.test('foo'); + sinon.match.falsy.test('foo'); + sinon.match.bool.test('foo'); + sinon.match.number.test('foo'); + sinon.match.string.test('foo'); + sinon.match.object.test('foo'); + sinon.match.func.test(fn); + sinon.match.map.test(new Map([['a', 1], ['b', 2]])); + sinon.match.set.test(new Set([1, 2, 3])); + sinon.match.array.test([1, 2, 3]); + sinon.match.regexp.test('foo'); + sinon.match.date.test('foo'); + sinon.match.symbol.test('foo'); + sinon.match.same(obj); + sinon.match.typeOf('string').test('foo'); + sinon.match.instanceOf(fn).test('foo'); + sinon.match.has('prop').test(obj); + sinon.match.has('prop', 123).test(obj); + sinon.match.hasOwn('prop').test(obj); + sinon.match.hasOwn('prop', 123).test(obj); + sinon.match.hasNested('prop.foo.bar').test(obj); + sinon.match.hasNested('prop.foo.bar', 123).test(obj); + sinon.match.every(sinon.match.number).test([1, 2, 'three']); + sinon.match.some(sinon.match.number).test([1, 2, 'three']); + sinon.match.array.deepEquals([{ a: 'b' }]).test([]); + sinon.match.array.startsWith([{ a: 'b' }]).test([]); + sinon.match.array.deepEquals([{ a: 'b' }]).test([]); + sinon.match.array.contains([{ a: 'b' }]).test([]); + sinon.match.map.deepEquals(new Map([['a', true], ['b', false]])).test(new Map()); + sinon.match.map.contains(new Map([['a', true]])).test(new Map()); +} + +function testFake() { + const fn = () => { }; + let fake = sinon.fake(); + + fake = sinon.fake(() => true); + fake = sinon.fake.returns(5); + fake = sinon.fake.throws('foo'); + fake = sinon.fake.throws(new Error('foo')); + fake = sinon.fake.resolves('foo'); + fake = sinon.fake.rejects('foo'); + fake = sinon.fake.yields(1, 2, fn); + fake = sinon.fake.yieldsAsync(1, 2, fn); + + fake.calledWith('foo'); +} + +function testAssert() { + const spy = sinon.spy(); + const spyTwo = sinon.spy(); + const obj = {}; + + sinon.assert.fail(); + sinon.assert.fail('foo'); + sinon.assert.pass('foo'); + sinon.assert.notCalled(spy); + sinon.assert.called(spy); + sinon.assert.calledOnce(spy); + sinon.assert.calledTwice(spy); + sinon.assert.calledThrice(spy); + sinon.assert.callCount(spy, 3); + sinon.assert.callOrder(spy, spyTwo); + sinon.assert.calledOn(spy, obj); + sinon.assert.calledOn(spy.firstCall, obj); + sinon.assert.alwaysCalledOn(spy, obj); + sinon.assert.alwaysCalledWith(spy, 'a', 'b', 'c'); + sinon.assert.neverCalledWith(spy, 'a', 'b', 'c'); + sinon.assert.calledWithExactly(spy, 'a', 'b', 'c'); + sinon.assert.alwaysCalledWithExactly(spy, 'a', 'b', 'c'); + sinon.assert.calledWithMatch(spy, 'a', 'b', 'c'); + sinon.assert.calledWithMatch(spy.firstCall, 'a', 'b', 'c'); + sinon.assert.alwaysCalledWithMatch(spy, 'a', 'b', 'c'); + sinon.assert.neverCalledWithMatch(spy, 'a', 'b', 'c'); + sinon.assert.calledWithNew(spy); + sinon.assert.calledWithNew(spy.firstCall); + sinon.assert.threw(spy); + sinon.assert.threw(spy.firstCall); + sinon.assert.threw(spy, 'foo error'); + sinon.assert.threw(spy.firstCall, 'foo error'); + sinon.assert.threw(spy, new Error('foo')); + sinon.assert.threw(spy.firstCall, new Error('foo')); + sinon.assert.alwaysThrew(spy); + sinon.assert.alwaysThrew(spy, 'foo error'); + sinon.assert.alwaysThrew(spy, new Error('foo')); + sinon.assert.match('a', 'b'); + sinon.assert.match(1, 1 + 1); + sinon.assert.match({ a: 1 }, { b: 2, c: 'abc' }); + sinon.assert.expose(obj); + sinon.assert.expose(obj, { prefix: 'blah' }); + sinon.assert.expose(obj, { includeFail: true }); +} + +function testTypedSpy() { + const cls = class { + foo(a: number, b: string): number { + return 3; + } + }; + + const instance = new cls(); + const spy = sinon.spy(instance, 'foo'); + + spy.calledWith(5, 'x'); + spy.calledWith(sinon.match(5), 'x'); + spy.calledWithExactly(5, 'x'); + spy.calledWithExactly(5, sinon.match('x')); + spy.calledOnceWith(5, 'x'); + spy.calledOnceWith(sinon.match(5), 'x'); + spy.notCalledWith(5, 'x'); + spy.notCalledWith(sinon.match(5), 'x'); + spy.returned(5); + spy.returned(sinon.match(5)); + + spy.withArgs(sinon.match(5), 'x').calledWith(5, 'x'); + spy.alwaysCalledWith(sinon.match(5), 'x'); + spy.alwaysCalledWith(5, 'x'); + spy.alwaysCalledWithExactly(sinon.match(5), 'x'); + spy.alwaysCalledWithExactly(5, 'x'); + spy.neverCalledWith(sinon.match(5), 'x'); + spy.neverCalledWith(5, 'x'); + + const stub = sinon.stub(instance, 'foo'); + + stub.withArgs(5, 'x').returns(3); + stub.withArgs(sinon.match(5), 'x').returns(5); +} + +function testSpy() { + const fn = () => { }; + const obj = class { + foo() { } + }; + const instance = new obj(); + + let spy = sinon.spy(); + const spyTwo = sinon.spy().named('spyTwo'); + + spy = sinon.spy(fn); + spy = sinon.spy(instance, 'foo'); + + let count = 0; + count = spy.callCount; + + let called = false; + called = spy.called; + called = spy.notCalled; + called = spy.calledOnce; + called = spy.calledTwice; + called = spy.calledThrice; + + let arr: any[] = []; + arr = spy.thisValues; + arr = spy.args; + arr = spy.exceptions; + arr = spy.returnValues; + + spy('a', 'b'); + spy(1, 2); + spy(true); + + spy.calledBefore(spyTwo); + spy.calledAfter(spyTwo); + spy.calledImmediatelyBefore(spyTwo); + spy.calledImmediatelyAfter(spyTwo); + spy.calledWithNew(); + spy.withArgs('a', 1).calledBefore(spyTwo); + spy.alwaysCalledOn(instance); + spy.alwaysCalledWith('a', 1); + spy.alwaysCalledWith('a'); + spy.alwaysCalledWithExactly('a', 1); + spy.alwaysCalledWithMatch('foo'); + spy.neverCalledWith('b', 2); + spy.neverCalledWith('b'); + spy.neverCalledWithMatch('foo', 'bar'); + spy.alwaysThrew(); + spy.alwaysThrew('foo'); + spy.alwaysThrew(new Error('foo')); + spy.alwaysReturned('foo'); + spy.invokeCallback('a', 'b'); + spy.calledOn(instance); + spy.calledWith('a', 2); + spy.calledWithExactly('a', 2); + spy.calledOnceWith('a', 2); + spy.calledOnceWithExactly('a', 2); + spy.calledWithMatch('bar', 2); + spy.notCalledWith('a', 2); + spy.notCalledWithMatch('a', 2); + spy.returned(true); + spy.returned('foo'); + spy.returned(2); + spy.threw(); + spy.threw('foo'); + spy.threw(new Error('foo')); + spy.callArg(1); + spy.callArgOn(1, instance); + spy.callArgOn(1, instance, 'a', 2); + spy.callArgWith(1, 'a', 2); + spy.callArgOnWith(1, instance, 'a', 2); + spy.yield('a', 2); + spy.yieldOn(instance, 'a', 2); + spy.yieldTo('prop', 'a', 2); + spy.yieldToOn('prop', instance, 'a', 2); + + let call = spy.firstCall; + call = spy.secondCall; + call = spy.thirdCall; + call = spy.lastCall; + call = spy.getCall(1); + call = spy.getCalls()[0]; + + call.calledBefore(call); + call.calledAfter(call); + call.calledWithNew(); + + spy.resetHistory(); + spy.restore(); +} + +function testStub() { + const obj = class { + foo() { } + }; + const instance = new obj(); + + let stub = sinon.stub(); + stub = sinon.stub(instance, 'foo').named('namedStub'); + + const spy: sinon.SinonSpy = stub; + + sinon.stub(instance); + + stub.reset(); + stub.resetBehavior(); + stub.usingPromise(Promise); + + stub.returns(true); + stub.returns(5); + stub.returns('foo'); + stub.returnsArg(1); + stub.returnsThis(); + stub.resolves(); + stub.resolves('foo'); + stub.resolvesArg(1); + stub.resolvesThis(); + stub.throws(); + stub.throws('err'); + stub.throws(new Error('err')); + stub.throwsArg(1); + stub.throwsException('err'); + stub.throwsException(new Error('err')); + stub.rejects(); + stub.rejects('TypeError'); + stub.rejects(1234); + stub.callsArg(1); + stub.callThrough(); + stub.callsArgOn(1, instance); + stub.callsArgWith(1, 'a', 2); + stub.callsArgAsync(1); + stub.callsArgOnAsync(1, instance); + stub.callsArgWithAsync(1, 'a', 2); + stub.callsArgOnWithAsync(1, instance, 'a', 2); + stub.callsFake((s1, s2, s3) => { }); + stub.callsFake(() => { }); + stub.get(() => true); + stub.set((v) => { }); + stub.onCall(1).returns(true); + stub.onFirstCall().resolves('foo'); + stub.onSecondCall().resolves('foo'); + stub.onThirdCall().resolves('foo'); + stub.value('foo'); + stub.yields('a', 2); + stub.yieldsOn(instance, 'a', 2); + stub.yieldsRight('a', 2); + stub.yieldsTo('foo', 'a', 2); + stub.yieldsToOn('foo', instance, 'a', 2); + stub.yieldsAsync('a', 2); + stub.yieldsOnAsync(instance, 'a', 2); + stub.yieldsToAsync('foo', 'a', 2); + stub.yieldsToOnAsync('foo', instance, 'a', 2); + stub.withArgs('a', 2).returns(true); +} + +function testMock() { + const obj = {}; + const mock = sinon.mock(obj); + + mock.expects('method').atLeast(2).atMost(5); + mock.restore(); + mock.verify(); +} diff --git a/types/sinon/ts3.1/tsconfig.json b/types/sinon/ts3.1/tsconfig.json new file mode 100644 index 0000000000..7468efa8bf --- /dev/null +++ b/types/sinon/ts3.1/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "target": "es5", + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "sinon-tests.ts" + ] +} From b6ed9ced6374a38e41b83cacf60bf3d7a5dddadd Mon Sep 17 00:00:00 2001 From: Kelvin Jin Date: Mon, 10 Dec 2018 14:54:12 -0800 Subject: [PATCH 234/241] [node] add trace_events type definitions --- types/node/index.d.ts | 62 ++++++++++++++++++++++++++++++++++++++++ types/node/node-tests.ts | 14 +++++++++ 2 files changed, 76 insertions(+) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index b9edae0587..547a30b84a 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -9008,3 +9008,65 @@ declare module "perf_hooks" { const performance: Performance; } + +declare module "trace_events" { + /** + * The `Tracing` object is used to enable or disable tracing for sets of + * categories. Instances are created using the + * `trace_events.createTracing()` method. + * + * When created, the `Tracing` object is disabled. Calling the + * `tracing.enable()` method adds the categories to the set of enabled trace + * event categories. Calling `tracing.disable()` will remove the categories + * from the set of enabled trace event categories. + */ + export interface Tracing { + /** + * A comma-separated list of the trace event categories covered by this + * `Tracing` object. + */ + readonly categories: string; + + /** + * Disables this `Tracing` object. + * + * Only trace event categories _not_ covered by other enabled `Tracing` + * objects and _not_ specified by the `--trace-event-categories` flag + * will be disabled. + */ + disable(): void; + + /** + * Enables this `Tracing` object for the set of categories covered by + * the `Tracing` object. + */ + enable(): void; + + /** + * `true` only if the `Tracing` object has been enabled. + */ + readonly enabled: boolean; + } + + interface CreateTracingOptions { + /** + * An array of trace category names. Values included in the array are + * coerced to a string when possible. An error will be thrown if the + * value cannot be coerced. + */ + categories: string[]; + } + + /** + * Creates and returns a Tracing object for the given set of categories. + */ + export function createTracing(options: CreateTracingOptions): Tracing; + + /** + * Returns a comma-separated list of all currently-enabled trace event + * categories. The current set of enabled trace event categories is + * determined by the union of all currently-enabled `Tracing` objects and + * any categories enabled using the `--trace-event-categories` flag. + */ + export function getEnabledCategories(): string; +} diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index c0f80728fc..7bb69e87e4 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -30,6 +30,7 @@ import * as async_hooks from "async_hooks"; import * as http2 from "http2"; import * as inspector from "inspector"; import * as perf_hooks from "perf_hooks"; +import * as trace_events from "trace_events"; import Module = require("module"); // Specifically test buffer module regression. @@ -4676,6 +4677,19 @@ import * as constants from 'constants'; } } +/////////////////////////////////////////////////////////// +/// Trace Events Tests /// +/////////////////////////////////////////////////////////// + +{ + const enabledCategories: string = trace_events.getEnabledCategories(); + const tracing: trace_events.Tracing = trace_events.createTracing({ categories: ['node', 'v8'] }); + const categories: string = tracing.categories; + const enabled: boolean = tracing.enabled; + tracing.enable(); + tracing.disable(); +} + //////////////////////////////////////////////////// /// module tests : http://nodejs.org/api/modules.html //////////////////////////////////////////////////// From 7c55f186436f825e312850ca67d7d951e9aa974d Mon Sep 17 00:00:00 2001 From: 43081j <43081j@users.noreply.github.com> Date: Wed, 12 Dec 2018 19:05:28 +0000 Subject: [PATCH 235/241] sinon: add tslint config --- types/sinon/ts3.1/tslint.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 types/sinon/ts3.1/tslint.json diff --git a/types/sinon/ts3.1/tslint.json b/types/sinon/ts3.1/tslint.json new file mode 100644 index 0000000000..1b62a88e52 --- /dev/null +++ b/types/sinon/ts3.1/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "ban-types": false, + "unified-signatures": false + } +} From dade8fa6f710f802fd100c27ca7a480f1df8a52c Mon Sep 17 00:00:00 2001 From: Asif Rahman Date: Wed, 12 Dec 2018 14:59:56 -0500 Subject: [PATCH 236/241] Swiper 4.4 typings update - Added missing swiper options - Added missing methods --- types/swiper/index.d.ts | 64 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/types/swiper/index.d.ts b/types/swiper/index.d.ts index 9e77516978..74b8d928b9 100644 --- a/types/swiper/index.d.ts +++ b/types/swiper/index.d.ts @@ -1,10 +1,11 @@ -// Type definitions for Swiper 4.2 +// Type definitions for Swiper 4.4 // Project: https://github.com/nolimits4web/Swiper // Definitions by: Sebastián Galiano // Luca Trazzi // Eugene Matseruk // Luiz M. // Justin Abene +// Asif Rahman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 @@ -221,6 +222,7 @@ export interface SwiperOptions { slidesOffsetBefore?: number; slidesOffsetAfter?: number; normalizeSlideIndex?: boolean; + centerInsufficientSlides?: boolean; // Grab Cursor grabCursor?: boolean; @@ -238,6 +240,8 @@ export interface SwiperOptions { followFinger?: boolean; allowTouchMove?: boolean; threshold?: number; + touchStartPreventDefault?: boolean; + touchStartForcePreventDefault?: boolean; touchMoveStopPropagation?: boolean; iOSEdgeSwipeDetection?: boolean; iOSEdgeSwipeThreshold?: number; @@ -249,11 +253,12 @@ export interface SwiperOptions { resistanceRatio?: number; // Swiping / No swiping + preventInteractionOnTransition?: boolean; allowSlidePrev?: boolean; allowSlideNext?: boolean; noSwiping?: boolean; noSwipingClass?: string; - // noSwipingSelector?: string; + noSwipingSelector?: string; swipeHandler?: SelectableElement; // Clicks @@ -289,6 +294,7 @@ export interface SwiperOptions { breakpoints?: { [index: number]: SwiperOptions; }; + breakpointsInverse?: boolean; // Observer observer?: boolean; @@ -1073,6 +1079,44 @@ export default class Swiper { */ slideTo(index: number, speed?: number, runCallbacks?: boolean): void; + /** + * Does the same as .slideTo but for the case when used with enabled loop. So this + * method will slide to slides with realIndex matching to passed index + * + * @param index Index number of slide. + * @param speed Transition duration (in ms). + * @param runCallbacks Set it to false (by default it is true) and transition will + * not produce transition events. + */ + slideToLoop(index: number, speed?: number, runCallbacks?: boolean): void; + + /** + * Reset swiper position to currently active slide for the duration equal to 'speed' + * parameter. + * + * @param speed Transition duration (in ms). + * @param runCallbacks Set it to false (by default it is true) and transition will + * not produce transition events. + */ + slideReset(speed?: number, runCallbacks?: boolean): void; + + /** + * Reset swiper position to closest slide/snap point for the duration equal to 'speed' parameter. + * + * @param speed Transition duration (in ms). + * @param runCallbacks Set it to false (by default it is true) and transition will + * not produce transition events. + */ + slideToClosest(speed?: number, runCallbacks?: boolean): void; + + /** + * Force swiper to update its height (when autoHeight enabled) for the duration equal to + * 'speed' parameter + * + * @param speed Transition duration (in ms). + */ + updateAutoHeight(speed?: number): void; + /** * You should call it after you add/remove slides * manually, or after you hide/show it, or do any @@ -1162,6 +1206,17 @@ export default class Swiper { */ prependSlide(slides: HTMLElement | string | string[]): void; + /** + * Add new slides to the required index. slides could be HTMLElement or HTML string with new slide or array with such slides, for example: + * + * @example addSlide(1, '

    Slide 10"
    ') + * @example addSlide(1, [ + * '
    Slide 10"
    ', + * '
    Slide 11"
    ' + * ]); + */ + addSlide(index: number, slides: HTMLElement | string | string[]): void; + /** * Remove selected slides. slideIndex could be a number with slide index to remove or array with indexes. * @@ -1171,6 +1226,11 @@ export default class Swiper { */ removeSlide(slideIndex: number | number[]): void; + /** + * Remove all slides + */ + removeAllSlides(): any; + /** * Set custom css3 transform's translate value for swiper wrapper */ From 969421fd0e73a46a1ce7fadfbfe5a91632f968f9 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com> Date: Wed, 12 Dec 2018 12:58:11 -0800 Subject: [PATCH 237/241] Fix multi-progress reference to progress --- types/multi-progress/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/multi-progress/index.d.ts b/types/multi-progress/index.d.ts index ebedcf9597..db15a15b1b 100644 --- a/types/multi-progress/index.d.ts +++ b/types/multi-progress/index.d.ts @@ -5,7 +5,7 @@ /// -import ProgressBar, { ProgressBarOptions } from '../progress'; +import ProgressBar, { ProgressBarOptions } from 'progress'; import { Stream } from 'stream'; export default class MultiProgress { From a01d23b10cb43cdc051b70c35758294a5a651a43 Mon Sep 17 00:00:00 2001 From: mAAdhaTTah Date: Tue, 4 Dec 2018 11:27:07 -0500 Subject: [PATCH 238/241] Add barWidth & barRatio props to VictoryBarProps --- types/victory/index.d.ts | 91 +++++++++++++++++++-------------- types/victory/tslint.json | 1 - types/victory/victory-tests.tsx | 2 + 3 files changed, 55 insertions(+), 39 deletions(-) diff --git a/types/victory/index.d.ts b/types/victory/index.d.ts index 5670547317..d002a3d695 100644 --- a/types/victory/index.d.ts +++ b/types/victory/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Victory 0.9.3 +// Type definitions for Victory 31.0 // Project: https://github.com/FormidableLabs/victory // Definitions by: Alexey Svetliakov // snerks @@ -269,16 +269,16 @@ declare module "victory" { */ cursorLabel?: (point: CursorData) => void; /** - * The cursorLabelComponent prop takes a component instance which will be - * used to render a label for the cursor. The new element created from the passed + * The cursorLabelComponent prop takes a component instance which will be + * used to render a label for the cursor. The new element created from the passed * cursorLabelComponent will be supplied with the following props: x, y, * active, text. If cursorLabelComponent is omitted, a new VictoryLabel will be created with the props described above. * @default cursorLabelComponent={} */ cursorLabelComponent?: React.ReactElement; /** - * The cursorLabelOffset prop determines the pixel offset of the cursor label - * from the cursor point. This prop should be an Object with x and y properties, or a + * The cursorLabelOffset prop determines the pixel offset of the cursor label + * from the cursor point. This prop should be an Object with x and y properties, or a * number to be used for both dimensions. * @default "{ x: 5, y: -10 }" */ @@ -315,45 +315,45 @@ declare module "victory" { */ allowDrag?: boolean; /** - * The optional allowResize prop accepts a boolean that enables resizing the + * The optional allowResize prop accepts a boolean that enables resizing the * highlighted brush area. Dragging will still be enabled when the allowResize * prop is set to false, but the dimensions of the brush area will be fixed. * @default true */ allowResize?: boolean; /** - * The brushComponent prop specifies the component to be rendered for the - * highlighted area. This component will be supplied with the following props: x, y, + * The brushComponent prop specifies the component to be rendered for the + * highlighted area. This component will be supplied with the following props: x, y, * width, height, and style. When this prop is not specified, a will be rendered. * @default brushComponent={} */ brushComponent?: React.ReactElement; /** - * When the brushDimension prop is set, brushing will only be specific to the to - * the given dimension (either "x" or "y"), and the entire domain of the other + * When the brushDimension prop is set, brushing will only be specific to the to + * the given dimension (either "x" or "y"), and the entire domain of the other * dimension will be highlighted. When this prop is not specified, highlighting will * occur along both dimensions. * @example brushDimension="x" */ brushDimension?: 'x' | 'y'; /** - * The optional brushDomain prop describes the highlighted state. This prop is an - * object that specifies separate arrays for x and y. Each array is a tuple that - * describes the minimum and maximum values to render. If this prop is not provided - * initially, the chart will render with the entire domain highlighted. When this prop + * The optional brushDomain prop describes the highlighted state. This prop is an + * object that specifies separate arrays for x and y. Each array is a tuple that + * describes the minimum and maximum values to render. If this prop is not provided + * initially, the chart will render with the entire domain highlighted. When this prop * changes, the chart will render with a new highlighted domain. * @example brushDomain={{ x: [50, 100], y: [0, 100] }} */ brushDomain?: DomainPropType; /** - * The brushStyle adds custom styles to the brushComponent. This prop + * The brushStyle adds custom styles to the brushComponent. This prop * should be given as an object of SVG style attributes. * @default "brushStyle={{ stroke: "transparent", fill: "black", fillOpacity: 0.1 }}" */ brushStyle?: React.CSSProperties; /** - * The defaultBrushArea prop specifies how the container will behave when a - * region outside the active brush is clicked without selecting a new area. When the + * The defaultBrushArea prop specifies how the container will behave when a + * region outside the active brush is clicked without selecting a new area. When the * prop is set to "all", the entire domain will be selected. When the prop is set to "none", * no new region will be selected, and any existing active brush will be cleared. When * the prop is set to "disable" the new selected region will default to the current active brush. @@ -364,8 +364,8 @@ declare module "victory" { */ disable?: boolean; /** - * The handleComponent prop specifies the component to be rendered for each - * handle for the highlighted area. This component will be supplied with the following + * The handleComponent prop specifies the component to be rendered for each + * handle for the highlighted area. This component will be supplied with the following * props: x, y, width, height, cursor, and style. When this prop is not * specified, a will be rendered. * @default handleComponent={} @@ -373,7 +373,7 @@ declare module "victory" { handleComponent?: React.ReactElement; /** * The handleStyle adds custom styles to the handleComponents. This prop should be given as an object of SVG style attributes. - * + * * Handles refer to the region on each highlighted area where the area may be * expanded. Only handles relevant to the given dimension will be rendered. For * example, when brushDimension="x" only "left" and "right" handles will be @@ -382,8 +382,8 @@ declare module "victory" { */ handleStyle?: React.CSSProperties; /** - * The optional onBrushDomainChange prop accepts an function to be called on - * each update to the highlighted domain. The function accepts the parameters of + * The optional onBrushDomainChange prop accepts an function to be called on + * each update to the highlighted domain. The function accepts the parameters of * domain (the updated domain), and props (the props used by VictoryBrushContainer). * @example onBrushDomainChange={(domain, props) => handleDomainChange(domain, props)} */ @@ -394,7 +394,7 @@ declare module "victory" { export interface VictoryZoomContainerProps extends VictoryContainerProps { /** - * The optional allowPan prop accepts a boolean that enables the panning + * The optional allowPan prop accepts a boolean that enables the panning * functionality. Zooming will still be enabled when the allowPan prop is set to false. * @default true */ @@ -406,7 +406,7 @@ declare module "victory" { */ allowZoom?: boolean; /** - * VictoryZoomContainer works by clipping data outside of a given domain. + * VictoryZoomContainer works by clipping data outside of a given domain. * VictoryZoomContainer uses VictoryClipContainer by default. * This prop should not be replaced with a custom component, but you may want to set * props on VictoryClipContainer, such as clipPadding. @@ -414,30 +414,30 @@ declare module "victory" { */ clipContainerComponent?: React.ReactElement; /** - * When the zoomDimension prop is set, panning and zooming will be restricted to - * the given dimension (either x or y), and the domain of the other dimension will + * When the zoomDimension prop is set, panning and zooming will be restricted to + * the given dimension (either x or y), and the domain of the other dimension will * remain static. When this prop is not specified, both x and y dimensions will pan and zoom. * @example zoomDimension="x" */ zoomDimension?: 'x' | 'y'; /** - * The zoomDomain prop describes the zoomed state. This prop is an object that - * specifies separate arrays for x and y. Each array is a tuple that describes the - * minimum and maximum values to render. If this prop is not provided initially, the - * chart will render without an initial zoom, displaying the entire dataset. Updates to + * The zoomDomain prop describes the zoomed state. This prop is an object that + * specifies separate arrays for x and y. Each array is a tuple that describes the + * minimum and maximum values to render. If this prop is not provided initially, the + * chart will render without an initial zoom, displaying the entire dataset. Updates to * zoomDomain will trigger a re-render of the chart with the new domain. * @example zoomDomain={{x: [0, 100]}} */ zoomDomain?: DomainPropType; /** - * The brushStyle adds custom styles to the brushComponent. This prop + * The brushStyle adds custom styles to the brushComponent. This prop * should be given as an object of SVG style attributes. * @default "brushStyle={{ stroke: 'transparent', fill: 'black', fillOpacity: 0.1 }}" */ brushStyle?: React.CSSProperties; /** - * The defaultBrushArea prop specifies how the container will behave when a - * region outside the active brush is clicked without selecting a new area. When the + * The defaultBrushArea prop specifies how the container will behave when a + * region outside the active brush is clicked without selecting a new area. When the * prop is set to "all", the entire domain will be selected. When the prop is set to "none", * no new region will be selected, and any existing active brush will be cleared. When * the prop is set to "disable" the new selected region will default to the current active brush. @@ -452,10 +452,10 @@ declare module "victory" { */ downsample?: number | boolean; /** - * The minimumZoom prop sets a minimum domain extent for the zoomed chart. + * The minimumZoom prop sets a minimum domain extent for the zoomed chart. * When the difference between the maximum and minimum of a zoomed domain is equal to the minimumZoom * in either dimension, the component will stop responding to events that would normally trigger zooming in. - * Zooming out and panning will still be enabled. When this prop is not specified, the default minimum + * Zooming out and panning will still be enabled. When this prop is not specified, the default minimum * zoom will cover 1 / 1000th of the original domain. This prop should be given as an object * with numeric values for x and y. * @example minimumZoom={{x: 1, y: 0.01}} @@ -650,10 +650,10 @@ declare module "victory" { */ y?: number; } - - + + /** - * VictoryTooltip renders a tooltip component with a set of default events. When VictoryTooltip is used as a label component for any Victory component that renders data, it will attach events to rendered data components that will activate the tooltip when hovered. + * VictoryTooltip renders a tooltip component with a set of default events. When VictoryTooltip is used as a label component for any Victory component that renders data, it will attach events to rendered data components that will activate the tooltip when hovered. * VictoryTooltip renders text as well as a configurable Flyout container. */ export class VictoryTooltip extends React.Component< @@ -1317,6 +1317,21 @@ declare module "victory" { * @example {data: {fill: "red", width: 8}, labels: {fontSize: 12}} */ style?: VictoryStyleInterface; + /** + * The barRatio prop specifies an approximate ratio between bar widths and spaces between bars. + * When width is not specified via the barWidth prop or in bar styles, the barRatio prop will + * be used to calculate a default width for each bar given the total number of bars in the data series + * and the overall width of the chart. + */ + barRatio?: number; + /** + * The barWidth prop is used to specify the width of each bar. This prop may be given as + * a number of pixels or as a function that returns a number. When this prop is given as + * a function, it will be evaluated with the arguments datum, and active. When this value + * is not given, a default value will be calculated based on the overall dimensions of + * the chart, and the number of bars. + */ + barWidth?: NumberOrCallback; } /** diff --git a/types/victory/tslint.json b/types/victory/tslint.json index a41bf5d19a..a0357daa61 100644 --- a/types/victory/tslint.json +++ b/types/victory/tslint.json @@ -7,7 +7,6 @@ "ban-types": false, "callable-types": false, "comment-format": false, - "dt-header": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/victory/victory-tests.tsx b/types/victory/victory-tests.tsx index 3b882c7583..d7ddd7c33b 100644 --- a/types/victory/victory-tests.tsx +++ b/types/victory/victory-tests.tsx @@ -253,6 +253,8 @@ test = ( {x: 4, y: 2}, {x: 5, y: 1} ]} + barWidth={20} + barRatio={100} /> ); From e24f349f8135beafd1d9a0226debcd8f17733b5a Mon Sep 17 00:00:00 2001 From: perry Date: Wed, 12 Dec 2018 17:38:44 -0800 Subject: [PATCH 239/241] Add new supported plugins from 0.7 --- types/dd-trace/index.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/types/dd-trace/index.d.ts b/types/dd-trace/index.d.ts index 311fa7675e..68c047203f 100644 --- a/types/dd-trace/index.d.ts +++ b/types/dd-trace/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for dd-trace-js 0.6 +// Type definitions for dd-trace-js 0.7 // Project: https://github.com/DataDog/dd-trace-js // Definitions by: Colin Bradley // Eloy Durán @@ -185,6 +185,7 @@ declare class Scope { type Plugin = | "amqp10" | "amqplib" + | "bluebird" | "elasticsearch" | "express" | "graphql" @@ -197,8 +198,10 @@ type Plugin = | "mysql" | "mysql2" | "pg" + | "q" | "redis" - | "restify"; + | "restify" + | "when"; interface BasePluginOptions { /** From f80c5fbfea909c964f22663cb329b8e0701354c4 Mon Sep 17 00:00:00 2001 From: perry Date: Wed, 12 Dec 2018 17:39:03 -0800 Subject: [PATCH 240/241] Add missing option: enabled --- types/dd-trace/dd-trace-tests.ts | 1 + types/dd-trace/index.d.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/types/dd-trace/dd-trace-tests.ts b/types/dd-trace/dd-trace-tests.ts index 9d6936875a..f98a0853cf 100644 --- a/types/dd-trace/dd-trace-tests.ts +++ b/types/dd-trace/dd-trace-tests.ts @@ -2,6 +2,7 @@ import * as tracer from "dd-trace"; import SpanContext = require("dd-trace/src/opentracing/span_context"); tracer.init({ + enabled: true, service: "MyLovelyService", hostname: "localhost", port: 8126, diff --git a/types/dd-trace/index.d.ts b/types/dd-trace/index.d.ts index 68c047203f..43bfd7183f 100644 --- a/types/dd-trace/index.d.ts +++ b/types/dd-trace/index.d.ts @@ -54,6 +54,12 @@ declare class TraceProxy extends Tracer { } interface TracerOptions { + /** + * Whether to enable the tracer. + * @default true + */ + enabled?: boolean; + /** * Enable debug logging in the tracer. * @default false From c1ce0b8e964fc89a2beaace7a75a323fd801239c Mon Sep 17 00:00:00 2001 From: Vincent Date: Thu, 13 Dec 2018 08:46:52 +0100 Subject: [PATCH 241/241] Include the react-syntax-highlighter version --- types/react-syntax-highlighter/index.d.ts | 2 +- types/react-syntax-highlighter/tslint.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-syntax-highlighter/index.d.ts b/types/react-syntax-highlighter/index.d.ts index 825608fe92..c1ad8f0242 100644 --- a/types/react-syntax-highlighter/index.d.ts +++ b/types/react-syntax-highlighter/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-syntax-highlighter +// Type definitions for react-syntax-highlighter 10.1 // Project: https://github.com/conorhastings/react-syntax-highlighter // Definitions by: Ivo Stratev // Aimee Gamble-Milner diff --git a/types/react-syntax-highlighter/tslint.json b/types/react-syntax-highlighter/tslint.json index a41bf5d19a..4cfa77fc40 100644 --- a/types/react-syntax-highlighter/tslint.json +++ b/types/react-syntax-highlighter/tslint.json @@ -7,7 +7,7 @@ "ban-types": false, "callable-types": false, "comment-format": false, - "dt-header": false, + "dt-header": true, "eofline": false, "export-just-namespace": false, "import-spacing": false,