From cdca61035a709b4c022b91c52ac65061e29d43f2 Mon Sep 17 00:00:00 2001 From: Mike Dvorscak Date: Thu, 18 May 2017 11:40:32 -0500 Subject: [PATCH 001/286] Add JQueryCssProperties interface for $.css(properties: object) Adding JQueryCssProperties interface and changing the signature for $.css(properties: object) to $.css(properties: JQueryCssProperties) --- types/jquery/index.d.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index ca799f21e5..9dc1bf466e 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -679,6 +679,13 @@ interface JQueryCoordinates { top: number; } +/** + * The interface used to specify the properties parameter in css() + */ +interface JQueryCssProperties { + [propertyName: string]: string | number | Function; +} + /** * Elements in the array returned by serializeArray() */ @@ -1687,7 +1694,7 @@ interface JQuery { * @param properties An object of property-value pairs to set. * @see {@link https://api.jquery.com/css/#css-properties} */ - css(properties: Object): JQuery; + css(properties: JQueryCssProperties): JQuery; /** * Get the current computed height for the first element in the set of matched elements. From 9d9aad622f688044f0e94ab64451e53795e27077 Mon Sep 17 00:00:00 2001 From: Gabe Scholz Date: Fri, 19 May 2017 11:44:50 -0700 Subject: [PATCH 002/286] Add resolves and rejects matchers from Jest 20 --- types/jest/index.d.ts | 2 ++ types/jest/jest-tests.ts | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 36011e67a7..7ac5c7486b 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -178,6 +178,8 @@ declare namespace jest { interface Matchers { /** If you know how to test something, `.not` lets you test its opposite. */ not: Matchers; + resolves: Matchers; + rejects: Matchers; lastCalledWith(...args: any[]): void; /** Checks that a value is what you expect. It uses `===` to check strict equality. Don't use `toBe` with floating-point numbers. */ toBe(expected: any): void; diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index d951153842..0605724334 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -501,3 +501,18 @@ describe('Mocks', function () { anotherIns.testMethod.mockImplementation(() => 1); }); }); + +// https://facebook.github.io/jest/docs/en/expect.html#resolves +describe('resolves', function () { + it('unwraps the expected Promise', function () { + return expect(Promise.resolve('test')).resolves.toEqual('test'); + }); +}); + +// https://facebook.github.io/jest/docs/en/expect.html#rejects +describe('rejects', function () { + it('unwraps the expected Promise', function () { + const error = new Error('error'); + return expect(Promise.reject(error)).rejects.toBeDefined(); + }); +}); \ No newline at end of file From 673e4d70ec792560b1173cb7822dcef68b89049e Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Tue, 23 May 2017 11:45:51 +0200 Subject: [PATCH 003/286] add type definitions for HERE data lens --- types/heredatalens/heredatalens-tests.ts | 136 ++++ types/heredatalens/index.d.ts | 939 +++++++++++++++++++++++ types/heredatalens/tsconfig.json | 22 + types/heredatalens/tslint.json | 3 + 4 files changed, 1100 insertions(+) create mode 100644 types/heredatalens/heredatalens-tests.ts create mode 100644 types/heredatalens/index.d.ts create mode 100644 types/heredatalens/tsconfig.json create mode 100644 types/heredatalens/tslint.json diff --git a/types/heredatalens/heredatalens-tests.ts b/types/heredatalens/heredatalens-tests.ts new file mode 100644 index 0000000000..51fa56b380 --- /dev/null +++ b/types/heredatalens/heredatalens-tests.ts @@ -0,0 +1,136 @@ +/** + * Typescript definition tests for heredatalens + * + * Note: These tests are intended to test the definitions only + * in the sense of typing and call signature consistency. They + * are not intended as functional tests. + */ + +import './index'; + + +let service: H.datalens.Service; +let serviceOptions: H.datalens.Service.Options = { + subDomain: 'sub', + version: 'version', + access_token: 'token', + refresh_token: 'token', + domainSharding: ['a', 'b'], + baseUrl: 'url' +}; + +let queryTileProviderTileParamNames: H.datalens.QueryTileProvider.TileParamNames = { + x: 'x', + y: 'y', + z: 'z' +}; + +let queryTileProviderOptions: H.datalens.QueryTileProvider.Options = { + queryId: 'id', + queryParams: 'params', + tileParamNames: queryTileProviderTileParamNames +}; + +let queryTileProvider = new H.datalens.QueryTileProvider(service, queryTileProviderOptions); +queryTileProvider.setQueryId('some id'); +queryTileProvider.setQueryParams('some params'); +queryTileProvider.setTileParamNames(queryTileProviderTileParamNames); + + +service = new H.datalens.Service(serviceOptions); +service.request('method', 'endpoint', 'params', 'body', function(result) {}, function(error) {}).then(data => {}); +service.fetchQueryData('id', 'params', function(result) {}, function(error) {}).then(data => {}); +service.fetchQueryStats('id', 'query', function(result) {}, function(error) {}).then(data => {}); +service.fetchLayer('name', 'params', function(result) {}, function(error) {}).then(data => {}); +service.fetchLayerTile('name', 1, 2, 3, 'params', function(result) {}, function(error) {}).then(data => {}); +service.setTokens('token', 'refresh_token'); +service.configure('app_id', 'app_code', true, true, new H.service.Url('scheme', 'host')); + + +let provider = new H.datalens.Provider({ columns: ['1', '2'], rows: [[], []]}); +provider.getData(); +provider.setData({ columns: ['3', '4'], rows: [[], []]}); + + +let queryProviderOptions: H.datalens.QueryProvider.Options = { + queryId: 'id', + queryParams: 'params' +}; +let queryProvider = new H.datalens.QueryProvider({ columns: ['1', '2'], rows: [[], []]}, queryProviderOptions); +queryProvider.setQueryId('id'); +queryProvider.setQueryParams('params'); +queryProvider.reload(); +queryProvider.getData(); +queryProvider.setData({ columns: ['3', '4'], rows: [[], []]}); + + +let rasterLayerOptions: H.datalens.RasterLayer.Options = { + dataToRows: (): H.datalens.RasterLayer.Row[] => { return []; }, + rowToTilePoint: (): H.datalens.RasterLayer.TilePoint => { return { x: 1, y: 2 }; }, + buffer: (): number => { return 1; }, + renderTile: () => {} +}; + +let rasterLayer = new H.datalens.RasterLayer(); +rasterLayer.redraw(); + + +let heatmapLayerOptions: H.datalens.HeatmapLayer.Options = { + dataToRows: (): H.datalens.HeatmapLayer.Row[] => { return []; }, + rowToTilePoint: (): H.datalens.HeatmapLayer.TilePoint => { return { x: 1, y: 2, value: 5, count: 5 }; }, + bandwidth: 5, + valueRange: (): number[] => { return []; }, + countRange: (): number[] => { return []; }, + colorScale: (): string => { return '2'; }, + alphaScale: (): number => { return 1; }, + aggregation: H.datalens.HeatmapLayer.Aggregation.SUM, + inputScale: H.datalens.HeatmapLayer.InputScale.LINEAR +}; + +let heatmapLayer = new H.datalens.HeatmapLayer(queryTileProvider, heatmapLayerOptions); +heatmapLayer.getOptionsPerZoom(5); +heatmapLayer.dispose(); +heatmapLayer.redraw(); + + +let objectLayerOptions: H.datalens.ObjectLayer.Options = { + dataToRows: (): H.datalens.ObjectLayer.Row[] => { return []; }, + rowToMapObject: (): H.map.Object => { return new H.map.Object() }, + rowToStyle: (): H.datalens.ObjectLayer.ObjectStyleOptions => { return { icon: new H.map.Icon('x'), style: {}, arrows: {}, zIndex: 1 }; }, + dataDomains: 2, + clustering: { rowToDataPoint: (): H.clustering.DataPoint => { return; }, options: (): H.clustering.Provider.ClusteringOptions => { return {}; } } +} + +let objectLayer = new H.datalens.ObjectLayer(provider, objectLayerOptions); +objectLayer.redraw(); +objectLayer.updateObjectStyle(new H.map.Object, { icon: new H.map.Icon('x'), style: {}, arrows: {}, zIndex: 1 }); + + +let rawDataProviderOptions: H.datalens.RawDataProvider.Options = { + dataUrl: 'url', + dataToFeatures: (): H.datalens.RawDataProvider.Feature[] => { return []; }, + featuresToRows: (): H.datalens.ObjectLayer.Row[] => { return []; } +}; + +let rawDataProvider = new H.datalens.RawDataProvider(rawDataProviderOptions); + + +let spatialTileProviderOptions: H.datalens.SpatialTileProvider.Options = { + layerName: 'name', + queryParams: 'params' +}; + +let spatialProvider: H.datalens.SpatialTileProvider = new H.datalens.SpatialTileProvider(service, spatialTileProviderOptions); + +let spatialLayerOptions: H.datalens.SpatialLayer.Options = { + dataToRows: (): H.datalens.SpatialLayer.Row[] => { return []; }, + rowToSpatialId: (): string => { return 'asd'; }, + featureToSpatialId: (): string => { return 'asd'; }, + rowToStyle: (): any => { return; }, + defaultStyle: (): any => { return; }, + transformFeature: 1 +}; + +let spatialLayer = new H.datalens.SpatialLayer(provider, spatialProvider, spatialLayerOptions); + + diff --git a/types/heredatalens/index.d.ts b/types/heredatalens/index.d.ts new file mode 100644 index 0000000000..9c7c5d910c --- /dev/null +++ b/types/heredatalens/index.d.ts @@ -0,0 +1,939 @@ +// Type definitions for HERE Data Lens API for JavaScript v2.3.0-31 +// Project: https://developer.here.com/ +// Definitions by: Bernd Hacker +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace H { + /** + * Data Lens REST API connector for HERE Maps API + * Data Lens JavaScript API is a module for HERE Maps API. + * It connects Data Lens REST API and provides data-driven styling of data on a map. + */ + namespace datalens { + /** + * HERE Maps API and Data Lens JavaScript API can be used to visualize data from different network sources. + * For each network source type, a service class is required. The service also stores API connection credentials. + * The service instance must be configured with a H.service.Platform instance. + */ + class Service implements H.service.IConfigurable { + /** + * Constructor + * @param options {H.datalens.Service.Options=} - Overrides the configuration from the H.service.Platform instance + */ + constructor(options?: H.datalens.Service.Options); + + /** + * This method makes an HTTP request to the Data Lens REST API. + * It makes any CRUD request (GET, PUT, POST, DELETE). + * This method can be used when implementing a custom provider or implementing data management. + * Otherwise existing providers are used to get data from the Data Lens REST API. + * @param method {string} - Any HTTP method (GET, PUT, POST, etc.) + * @param endpoint {string} - The REST API endpoint + * @param params {any=} - URL parameters + * @param body {any=} - The payload of the request + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + request(method: string, endpoint: string, params?: any, body?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches query data for a given query ID. + * This method can be used when implementing a custom provider. + * Otherwise existing providers are used to get data from the Data Lens REST API. + * @param queryId {string} - The ID of the Data Lens REST API query + * @param params {any=} - Query dynamic parameters + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + fetchQueryData(queryId: string, params?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches statistical data for the Data Lens query (eg minimum and maximum values for the query metric). + * It can be used to define visualization boundaries, scales and legends. + * @param queryId {string} - The ID of the Data Lens REST API query + * @param statsQuery {any} - A JSON object which defines a statistics query for the Data Lens query + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + fetchQueryStats(queryId: string, statsQuery: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches a layer of geometries (eg buildings or administrative boundaries). + * @param layerName {string} - The name of the layer + * @param params {any=} - URL parameters (eg bounding box) + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Response Promise + */ + fetchLayer(layerName: string, params?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * This method fetches vector tile data from the layer. + * @param layerName {string} + * @param x {H.datalens.QueryTileProvider.X} - Tile columns + * @param y {H.datalens.QueryTileProvider.Y} - Tile row + * @param z {H.datalens.QueryTileProvider.Zoom} - zoom level + * @param params {any=} - URL parameters (eg bounding box) + * @param onResult {function(any)=} - Callback called on a successful request with response data + * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object + * @returns {Promise} - Typed array with tile data + */ + fetchLayerTile(layerName: string, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom, + params?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; + + /** + * Sets the access and refresh tokens used to authenticate all requests against the Data Lens REST API. + * Use this method to implement custom authentication to the Data Lens REST API. + * @param accessToken {string} - The token used to authenticate all requests + * @param refreshToken {string} - The token used to fetch a new access token after the previous access token has expired. + * When refreshToken is provided, Service will automatically update the expired accessToken. + */ + setTokens(accessToken: string, refreshToken: string): void; + + /** + * This method implements H.service.IConfigurable interface. It is called by the H.service.Platform instance. + * @param appId {string} - The appId + * @param appCode {string} - The appCode + * @param useHTTPS {boolean} - A flag to use HTTPS or not + * @param useCIT {boolean} - A flag to use the staging server (CIT) or not + * @param baseUrl {H.service.Url=} - The base URL for all requests to the Data Lens REST API + * @returns {H.datalens.Service} + */ + configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, baseUrl?: H.service.Url): H.datalens.Service; + } + + namespace Service { + /** + * Overrides the H.datalens.Service configuration + * Normally the H.datalens.Service instance is configured with the H.service.Platform instance. + * This configuration can be overridden by specifying these options. + * It can be useful when the Data Lens environment is different from the HERE Platform environment. + * @property subDomain {string=} - Subdomain of the Data Lens REST API URL + * @property version {string=} - Pathname prefix of the Data Lens REST API endpoints + * @property access_token {string=} - The token used to authenticate all requests + * @property refresh_token {string=} - The token used to fetch a new access token after the previous access token has expired. + * When refresh_token is provided, Service will automatically update the expired access_token. + * @property domainSharding {string[]=} - To increase the number of simultaneous requests to the Data Lens REST API, domain sharding is used. + * This option can be used when the Data Lens environment does not support domain sharding. + * @property baseUrl {string=} - Defines an alternative host for the Data Lens REST API URL + */ + interface Options { + subDomain?: string; + version?: string; + access_token?: string; + refresh_token?: string; + domainSharding?: string[]; + baseUrl?: string; + } + + /** + * The format of Data Lens query data. + * The Data Lens query data has a table-like structure with named columns and rows. + * @property columns {string[]} - Column names + * @property rows {Array} - Rows of data + */ + interface Data { + columns: string[]; + rows: [any[]]; // rows : { Array. } + } + } + + /** + * Providers define interfaces for layers to access data. + * The input data can be stored locally or loaded from the network. Data can be loaded by tiles or in one chunk. + * This provider allows you to supply data stored locally or fetched using external tools. + */ + class Provider extends H.map.provider.Provider { + /** + * Constructor + * @param data {H.datalens.Service.Data=} - JSON object + * @param options {H.map.provider.Provider.Options=} - Configures data accessibility parameters + */ + constructor(data?: H.datalens.Service.Data, options?: H.map.provider.Provider.Options); + + /** + * Updates the provider data. When data is updated, the update event is triggered so that the consuming layers are redrawn. + * @param data {H.datalens.Service.Data} - JSON object + */ + setData(data: H.datalens.Service.Data): void; + + /** + * Retrieves the provider data. + * @returns {H.datalens.Service.Data} - JSON object + */ + getData(): H.datalens.Service.Data; + } + + /** + * Defines the source of the data for layers from a Data Lens query. + * Providers define interfaces for layers to access data. The input data can be stored locally or loaded from the network. + * Data can be loaded by tiles or in one chunk. This provider loads query data with the Data Lens REST API. + * Note that this provider must be used only for non-tiled queries. + */ + class QueryProvider extends H.datalens.Provider { + /** + * Constructor + * @param service {H.datalens.Service} - Data Lens REST API service + * @param options {H.datalens.QueryProvider.Options=} - Configures source query and data accessibility parameters + */ + constructor(data: H.datalens.Service.Data, options?: H.map.provider.Provider.Options); + + /** + * Updates the query ID to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. + * @param queryId {string} + */ + setQueryId(queryId: string): void; + + /** + * Updates the query's dynamic parameters to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. + * This method is normally used when updating your visualization. + * @param queryParams {any|null} - Query dynamic parameters + */ + setQueryParams(queryParams: any|null): void; + + /** + * Fetches new data from the Data Lens REST API. + * When data is fetched, the update event is triggered so that the consuming layers are redrawn. + */ + reload(): void; + + /** + * Updates the provider data. + * When data is updated, the update event is triggered so that the consuming layers are redrawn. + * @param data {H.datalens.Service.Data} - JSON object + */ + setData(data: H.datalens.Service.Data): void; + + /** + * Retrieves the provider data. + * @returns {H.datalens.Service.Data} - JSON object + */ + getData(): H.datalens.Service.Data; + } + + namespace QueryProvider { + /** + * Configures source query and data accessibility parameters for H.datalens.QueryProvider + * Specifies the query credentials and dynamic parameters required for fetching query data with the Data Lens REST API. Other options from H.datalens.Provider.Options are available. + * @property queryId {string} - The ID of the Data Lens REST API query + * @property queryParams {any=} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. + */ + interface Options { + queryId: string; + queryParams?: any; + } + } + + /** + * Providers define interfaces for layers to access data. + * The input data can be stored locally or loaded from the network. Data can be loaded by tiles or in one chunk. + * This provider loads tiled query data with the Data Lens REST API. Tiled queries are used to load data only for the current viewport. + * This optimizes memory and network usage and enables progressive rendering. + */ + class QueryTileProvider extends H.map.provider.RemoteTileProvider { + /** + * Constructor + * @param service {H.datalens.Service} - Data Lens REST API service + * @param options {H.datalens.QueryTileProvider.Options} - Configures source query and data accessibility parameters + */ + constructor(service: H.datalens.Service, options: H.datalens.QueryTileProvider.Options); + + /** + * Updates the query ID to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. + * @param queryId {string} + */ + setQueryId(queryId: string): void; + + /** + * Updates the query's dynamic parameters to be used in the next call of the Data Lens REST API. + * Note that new data will be fetched only after the reload method is called. This method is normally used when updating your visualization. + * @param queryParams {any|null} + */ + setQueryParams(queryParams: any|null): void; + + /** + * Updates the names of the dynamic parameters that defines tiles. This method is only needed when the query ID is updated. + * Note that new data will be fetched only after the reload method is called. + * @param tileParamNames {H.datalens.QueryTileProvider.TileParamNames} - Names of the URI parameters that control the x/y/z of a tiled query + */ + setTileParamNames(tileParamNames: H.datalens.QueryTileProvider.TileParamNames): void; + } + + namespace QueryTileProvider { + /** + * Represents the names of the URI parameters that control the x/y/z of tiled query. + * When defining the Data Lens query, dynamic parameters that control tiling can be arbitrarily named. + * Names of these parameters must be specified to fetch tiles. + * @property x {string} - Name of the dynamic parameter that defines tile column + * @property y {string} - Name of the dynamic parameter that defines tile row + * @property z {string} - Name of the dynamic parameter that defines zoom level + */ + interface TileParamNames { + x: string; + y: string; + z: string; + } + + /** + * Configures source query and data accessibility parameters for H.datalens.QueryTileProvider + * Specifies the query credentials and dynamic parameters required for fetching tiled query data with the Data Lens REST API. + * Other options from H.datalens.Provider.Options are available. + * @property tileParamNames {H.datalens.QueryTileProvider.TileParamNames=} - Names of the URI parameters that control the x/y/z of a tiled query + * @property queryId {string} - The ID for the Data Lens REST API query + * @property queryParams {any=} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. + */ + interface Options { + tileParamNames: H.datalens.QueryTileProvider.TileParamNames; + queryId: string; + queryParams?: string; + } + + /** + * Tile X coordinate (column) + * Coordinate in XYZ tile numbering scheme. + */ + type X = number; + + /** + * Tile Y coordinate (row) + * Coordinate in XYZ tile numbering scheme. + */ + type Y = number; + + /** + * Zoom level + * Coordinate in XYZ tile numbering scheme. May vary within range 1 to 20. + */ + type Zoom = number; + } + + /** + * Provides pixel-wise rendering of data. + * Layer used when you need to visualize more than 10k points. The layer requires source data to be located in pixel coordinates. + * The rendering is implemented by drawing directly on a canvas. The layer is often used together with a Data Lens query which groups rows by pixels. + * This reduces the amount of data delivered to the client. + */ + class RasterLayer extends H.map.layer.TileLayer { + /** + * Constructor + */ + constructor(); + + /** + * Default value for dataToRows callback option. + * It represents each row as an object where property names correspond to data column names. + */ + static defaultDataToRows: any; + + /** + * Force re-rendering of the layer. + * In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + + /** + * This is a default implementation of renderTile callback. This method represents each point as a black 1x1 pixel square. + * @param points {Array} - Input data points within a tile + * @param canvas {HTMLCanvasElement} - The target canvas + */ + static defaultRenderTile(points: H.datalens.RasterLayer.TilePoint[], canvas: HTMLCanvasElement): void; + } + + namespace RasterLayer { + /** + * Defines data processing and rendering options for RasterLayer. + * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.RasterLayer.defaultDataToRows. + * This behavior can be changed by defining the dataToRows callback. + * To collect the rows for a tile including buffer, the rows must be translated to H.datalens.RasterLayer.TilePoint. + * This translation must be specified with the rowToTilePoint callback. The final rendering on the tile canvas must be defined in renderTile. + * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. + * @property rowToTilePoint {function(H.datalens.RasterLayer.Row, H.datalens.RasterLayer.X, H.datalens.RasterLayer.Y)=} - + * Defines how the row is translated to the H.datalens.RasterLayer.TilePoint. This callback is called for each row that is returned from dataToRows. + * @property buffer {function(H.datalens.QueryTileProvider.Zoom)=} - Defines the buffer as a function of the zoom level. + * The buffer is a value (in pixels) that defines an extra area around each tile to capture data points from. + * This is done to avoid drawing edges between tiles. For example, if data points represented with circles with a maximum radius of 10 pixels, then the buffer must be 10 pixels. + * @property renderTile {function(Array, HTMLCanvasElement, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how tile data is represented on a canvas. Input points for each tile are collected with respect to the buffer. + * For progressive rendering this callback may be called more than once for the tile. + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom): + H.datalens.RasterLayer.Row[]; + rowToTilePoint?(row: H.datalens.RasterLayer.Row, x: H.datalens.RasterLayer.X, y: H.datalens.RasterLayer.Y): H.datalens.RasterLayer.TilePoint; + buffer?(zoom: H.datalens.QueryTileProvider.Zoom): number; + renderTile?(points: H.datalens.RasterLayer.TilePoint[], canvas: HTMLCanvasElement, zoom: H.datalens.QueryTileProvider.Zoom): void; + } + + /** + * Defines the input data format for heat map rendering. + * To collect data rows for each tile with respect to the buffer, each row must be represented as a point within the map tile. + * @property x {number} - Row relative to tile + * @property y {number} - Column relative to tile + * @property data {H.datalens.RasterLayer.Row=} - Reference to source data row + */ + interface TilePoint { + x: number; + y: number; + data?: H.datalens.RasterLayer.Row; + } + + /** + * Tile X coordinate (column) + * Coordinate in XYZ tile numbering scheme. + */ + type X = number; + + /** + * Tile Y coordinate (row) + * Coordinate in XYZ tile numbering scheme. + */ + type Y = number; + + /** + * Slice of data (eg Data Lens query data row) that represents a data point. + * Each row is transformed into TilePoint and passed to renderTile callback. By default each row is an Object where property names correspond to data column names. + * This representation can be changed with the dataToRows callback. + */ + type Row = number; + } + + /** + * Provides functionality of value-based heat map with density alpha mask. + * Layer support different types of blending, including weighted average. Also it allows to apply alpha mask calculated by density. + * In most cases, the layer consumes data grouped by 1x1 pixels buckets. For proper averaging it requires aggregated value and count (number of rows in bucket) for each bucket. + * Blending of buckets is implemented via kernel density estimation (KDE) with a Gaussian kernel. + */ + class HeatmapLayer extends H.datalens.RasterLayer { + /** + * Constructor + * @param provider {H.datalens.QueryTileProvider} - Source of tiled data + * @param options {H.datalens.HeatmapLayer.Options} - Configuration for data processing and rendering + */ + constructor(provider: H.datalens.QueryTileProvider, options: H.datalens.HeatmapLayer.Options); + + /** + * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. + * @param data {H.datalens.Service.Data} + * @param x {H.datalens.QueryTileProvider.X} + * @param y {H.datalens.QueryTileProvider.Y} + * @param zoom {H.datalens.QueryTileProvider.Zoom} + * @returns {Array} + */ + static defaultDataToRows: (data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom) => + H.datalens.HeatmapLayer.Row[]; + + /** + * Set of possible values for the inputScale option + * @type {H.datalens.HeatmapLayer.InputScale} + */ + static inputScale: H.datalens.HeatmapLayer.InputScale; + + /** + * Set of possible values for the aggregation option + * @type {H.datalens.HeatmapLayer.Aggregation} + */ + static aggregation: H.datalens.HeatmapLayer.Aggregation; + + /** + * @param zoom {number} - zoom level + * @return {H.datalens.HeatmapLayer.Options} + */ + getOptionsPerZoom(zoom: number): H.datalens.HeatmapLayer.Options; + + /** + * Removes listeners, and references to memory consuming objects, from this layer. Call this method when you no longer need the layer. + */ + dispose(): void; + + /** + * Force re-rendering of the layer. In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + } + + namespace HeatmapLayer { + /** + * Defines data processing and rendering options for HeatmapLayer. + * The data processing flow of HeatmapLayer is similar to RasterLayer. The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.HeatmapLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * To collect the rows for a tile including buffer, the rows must be translated to H.datalens.HeatmapLayer.TilePoint. This translation must be specified with the rowToTilePoint callback. + * Other options define the blending options for the heat map. + * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. + * @property rowToTilePoint {function(H.datalens.HeatmapLayer.Row, H.datalens.HeatmapLayer.X, H.datalens.HeatmapLayer.Y)=} - + * Defines how the row is translated to the H.datalens.HeatmapLayer.TilePoint. This callback is called for each row that is returned from dataToRows. + * @property bandwidth {H.datalens.HeatmapLayer~Bandwidth | H.datalens.HeatmapLayer~BandwidthStop | Array. | + * H.datalens.HeatmapLayer~BandwidthCallback=} - Describes the bandwidth behavior in relation to current zoom level A numeric value sets it static across all levels + * An Object with zoom, value and optional zoomIncrementFactor (1 equals doubling on every zoom increment) defines a behavior across all zoom levels + * An Array of one or more zoom, value objects describes the behavior between the two defined levels and extrapolates the implied change outside of the defined range + * Alternatively defines the level of smoothing as a function of the zoom level. The callback must return a value in pixels. + * The cut-off of the Gaussian kernel is defined as 3 * bandwidth , a multiple (default 3) of bandwidth. + * @property valueRange {function(H.datalens.QueryTileProvider.Zoom)} - Defines the range for the color scale as a function of the zoom level. + * The returned value must be an array of 2 numbers. + * @property countRange {function(H.datalens.QueryTileProvider.Zoom)} - Defines the range for the density alpha mask as a function of the zoom level. + * When defined, the density alpha mask is applied. The returned value must be an array of 2 numbers. + * @property colorScale {function(number)} - Defines a color palette as a function of the normalized value. You can use D3.js library scale functions with the domain [0, 1]. + * @property alphaScale {function(number)} - Defines the alpha mask value as a function of the normalized count. + * You can use D3.js library scale functions with the domain [0, 1] and the range [0, 1]. + * @property aggregation {H.datalens.HeatmapLayer.Aggregation} - Specifies which type of aggregation was applied (eg. type of aggregation function for bucket in the Data Lens query). + * Possible values are SUM or AVERAGE. If the aggregation type is AVERAGE , then an averaged heat map is rendered. + * @property inputScale {H.datalens.HeatmapLayer.InputScale} - Defines the scale (eg logarithmic scale) of the TilePoint value. + * Note: if the value is not in a linear scale, then the aggregation in the source query must be defined with respect to the scale type. + * For example, before applying the average aggregation function in a query, the value must be transformed to the linear scale. This guarantees correct linear averaging of values. + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom): + H.datalens.HeatmapLayer.Row[]; + rowToTilePoint(row: H.datalens.HeatmapLayer.Row, x: H.datalens.HeatmapLayer.X, y: H.datalens.HeatmapLayer.Y): H.datalens.HeatmapLayer.TilePoint; + bandwidth?: H.datalens.HeatmapLayer.Bandwidth | H.datalens.HeatmapLayer.BandwidthStop | H.datalens.HeatmapLayer.BandwidthStop[] | H.datalens.HeatmapLayer.BandwidthCallback; + valueRange?(zoom: H.datalens.QueryTileProvider.Zoom): number[]; + countRange?(zoom: H.datalens.QueryTileProvider.Zoom): number[]; + colorScale?(scale: number): string; + alphaScale?(scale: number): number; + aggregation?: H.datalens.HeatmapLayer.Aggregation; + inputScale?: H.datalens.HeatmapLayer.InputScale; + } + + /** + * Tile X coordinate (column) + * Coordinate in XYZ tile numbering scheme. + */ + type X = number; + + /** + * Tile Y coordinate (row) + * Coordinate in XYZ tile numbering scheme. + */ + type Y = number; + + /** + * Slice of data (eg Data Lens query data row) that represents a data point. + * Each row is transformed into TilePoint and then rendered on a heat map. By default each row is an Object where property names correspond to data column names. + * This representation can be changed with the dataToRows callback. + */ + type Row = number; + + /** + * Defines a constant for the bandwidth + * A number that sets a constant for the bandwidth across all zoom levels. + */ + type Bandwidth = number; + + /** + * Sets the bandwidth for a given zoom level and uses this to calculate the increment or decrement of the bandwidth at other zoom levels + * This object defines the behavior of the bandwidth value across all zoom levels, initialized by a reference zoom level and its value at that level. + * The default behavior with zoomIncrementFactor = 1 doubles the bandwidth with every increasing zoom level and halves it on every decrease in zoom level. + * For example, a bandwidth of 10@zoom1 turns to 20@zoom2 and 5@zoom0. A zoomIncrementFactor of 0 effectively equals the bandwidth number, ignoring the provided zoom level. + * A zoomIncrementFactor of 0.5 mean a bandwidth increase of 50% compared to a factor of 1. So a bandwidth of 10@zoom1 computes to 15@zoom2. + */ + interface BandwidthStop { + zoom: number; + value: number; + zoomIncrementFactor?: number; + } + + /** + * TODO: this is missing in the documentation: https://developer.here.com/visualization/documentation/datalens/h-datalens-heatmaplayer-options.html + */ + type BandwidthCallback = () => void; + + /** + * Defines the input data format for heat map rendering. + * For heat map rendering, each row of data must be represented as a point within the map tile. + * @property x {number} - Row relative to tile + * @property y {number} - Column relative to tile + * @property value {number} - Value at the point (eg aggregated bucket value) + * @property count {number} - Number of contributors to the value at the point (eg number of rows in a bucket) + * @property data {H.datalens.HeatmapLayer.Row} - Reference to source data row + */ + interface TilePoint { + x: number; + y: number; + value: number; + count: number; + data?: H.datalens.HeatmapLayer.Row; + } + + /** + * Set of possible values for the aggregation option. + * If the heat map input data is buckets, then different types of aggregation can be applied to the rows in a bucket. + * The aggregation type is required for proper blending mode of the heat map. For the AVERAGE aggregation type, an averaged heat map is rendered. + * @property SUM {string} - Specifies that the sum aggregation was applied to the bucket value + * @property AVERAGE {string} - Specifies that the average aggregation was applied to the bucket value + */ + enum Aggregation { + SUM, + AVERAGE + } + + /** + * Set of possible values for the inputScale option. + * The input scale is required for proper heat map blending. If the input scale is not linear, then the TilePoint.value is converted to linear scale before calculating the sum or average. + * @property DB {string} - Decibel (dB) scale + * @property LINEAR {string} - Linear scale + * @property LOG {string} - Logarithmic scale + */ + enum InputScale { + DB, + LINEAR, + LOG + } + } + + /** + * Presents data as points or spatial map objects with data-driven styles and client-side clustering. + * Applicable for drawing interactive map objects like markers, polygons, circles and other instances of H.map.Object. Source of data can be either tiled or not tiled. + * Styles for objects can be parametrized with data rows and zoom level. Allows to create data-driven icons for markers like donuts or bars. + * Also enables clustering and data domains for visualizing up to 100k points or more. + */ + class ObjectLayer extends H.map.layer.ObjectLayer { + /** + * Constructor + * @param provider {H.map.provider.RemoteTileProvider | H.datalens.Provider | H.datalens.QueryProvider | H.datalens.QueryTileProvider} - Data source (tiled or not) + * @param options {H.datalens.ObjectLayer.Options} - Defines data processing, clustering and data-driven styling + */ + constructor(provider: H.map.provider.RemoteTileProvider | H.datalens.Provider | H.datalens.QueryProvider | H.datalens.QueryTileProvider, options: H.datalens.ObjectLayer.Options); + + /** + * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. + * @property data {H.datalens.Service.Data} + * @returns {Array} + */ + static defaultDataToRows(data: H.datalens.Service.Data): H.datalens.ObjectLayer.Row[]; + + /** + * A factory method for data-driven icons. The method allows you to build an icon from SVG markup or JsonML object. Provides caching of icons with the same markup. + * @param svg {string | Array} - SVG presented as markup or JsonML Array + * @param options {H.map.Icon.Options} - Icon options (eg size and anchor). Note that the default anchor is in the middle. + * @param options.size {H.math.ISize | number} - When the icon is a square, you can define the size as a number in pixels + * @returns {H.map.Icon} - Icon which can be used for marker or cluster + */ + static createIcon(svg: string | any[], options?: H.map.Icon.Options): H.map.Icon; + + /** + * Returns cache of icons created with the createIcon method. Can be used to clean the icon cache. + * @return {H.util.Cache} - Icon cache + */ + static getIconCache(): H.util.Cache; + + /** + * Force re-rendering of the layer. In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + + /** + * Recalculates the style and applies it to the map object based on the new StyleState + * @param object {H.map.Object} - Map object + * @param state {H.datalens.ObjectLayer.StyleState} - New state + */ + updateObjectStyle(any: H.map.Object, state: H.datalens.ObjectLayer.StyleState): void; + } + + namespace ObjectLayer { + /** + * Defines data processing and data-driven styling for ObjectLayer + * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.ObjectLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * In the next step each row must be presented as a map object with the rowToMapObject callback. Data-driven styling can be provided with the rowToStyle callback. + * @property dataToRows {function(H.datalens.Service.Data)=} - Defines how the input data is split by rows. You can specify this callback to define client-side aggregation and filtering. + * @property rowToMapObject {function(H.datalens.ObjectLayer.Row, H.datalens.QueryTileProvider.Zoom)} - Defines how each row is presented on the map (eg marker, polygon) + * @property rowToStyle {function(H.datalens.ObjectLayer.Row, H.datalens.QueryTileProvider.Zoom, H.datalens.ObjectLayer.StyleState)=} - + * Defines map object style and icon according to data row and zoom level. Also it can define different styles depending on the StyleState (eg hovered, selected). + * @property dataDomains {H.datalens.ObjectLayer.DataDomains=} - Defines quantization of data for improving data-driven styling performance + * @property clustering {H.datalens.ObjectLayer.Clustering=} - When present, client-side clustering is applied + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data): H.datalens.ObjectLayer.Row[]; + rowToMapObject(row: H.datalens.ObjectLayer.Row, z: H.datalens.QueryTileProvider.Zoom): H.map.Object; + rowToStyle?(row: H.datalens.ObjectLayer.Row, z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.ObjectLayer.StyleState): H.datalens.ObjectLayer.ObjectStyleOptions; + dataDomains?: H.datalens.ObjectLayer.DataDomains; + clustering?: H.datalens.ObjectLayer.Clustering; + } + + /** + * Defines client-side clustering in the ObjectLayer. + * When the clustering option is provided, rows returned from dataToRows go to the clustering.rowToDataPoint callback to be transformed to data points. + * Then, the data points are clustered according to clustering.options. Clustering produces clusters and noise points (data points that are not clustered). + * Clusters and noise points must be presented as map objects with the rowToMapObject callback and can be styled with the rowToStyle callback. + * @property rowToDataPoint {H.datalens.ObjectLayer.Row} - Defines data points from rows + * @property options {function(H.datalens.QueryTileProvider.Zoom)} - Defines clustering options as a function of the zoom level + */ + interface Clustering { + rowToDataPoint(row: H.datalens.ObjectLayer.Row): H.clustering.DataPoint; + options(zoom: H.datalens.QueryTileProvider.Zoom): H.clustering.Provider.ClusteringOptions; + } + + /** + * Slice of data (eg Data Lens query data row) that represents a data point. + * Each row is translated to map objects with the rowToMapObject callback. By default each row is an Object where property names correspond to data column names. + * This representation can be changed with the dataToRows callback. + */ + type Row = number; + + /** + * User defined modification of a data-driven style + * StyleState appears as a parameter in the rowToStyle callback. By default it is 'DEFAULT_STATE'. To change StyleState, use the ObjectLayer.updateObjectStyle method. + */ + type StyleState = any; + + /** + * Output from the rowToStyle callback. + * Defines the styles or the icon that is applied to the map object. + * @property icon {H.map.Icon} - Marker icon + * @property style {H.map.SpatialStyle.Options} - Spatial style + * @property arrows {H.map.ArrowStyle.Options} - Style of arrows to render along a polyline + * @property zIndex {number} - The z-index value of the map object, default is 0 + */ + interface ObjectStyleOptions { + icon: H.map.Icon; + style: H.map.SpatialStyle.Options; + arrows: H.map.ArrowStyle.Options; + zIndex: number; + } + + /** + * Input data quantization domain, used to optimize styling performance. + * The option must have properties corresponding to the properties of H.datalens.ObjectLayer.Row. Values must be represented as an Array of Numbers that defines the quantization domain. + * When provided, the input data will be quantized, and rowToStyle will be called only for quantized values. + */ + type DataDomains = any; + } + + /** + * Defines how to load data from a raw data file + * This provider defines the interface for loading data, such as geometries or coordinates, from a local or remote data file in GeoJSON or CSV format + */ + class RawDataProvider extends H.map.provider.RemoteTileProvider { + /** + * Constructor + * @param options {H.datalens.RawDataProvider.Options} - Configures options + */ + constructor(options: H.datalens.RawDataProvider.Options); + + /** + * Updates the data url. Note that new data will be fetched only after the reload method is called. + * @param dataUrl {string} + */ + setDataUrl(dataUrl: string): void; + } + + namespace RawDataProvider { + /** + * Defines options for RawDataProvider + * Options for RawDataProvider + * @property dataUrl - The data url to fetch + * @property dataToFeatures {function(any)=} - Defines how the input data is mapped to an array of GeoJSON features + * @property featuresToRows {function(Array, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom, + * H.datalens.RawDataProvider.TileSize, H.datalens.RawDataProvider.Helpers)=} - + * Defines how GeoJSON features on a tile should be mapped to data rows, which are inputs to layers such as ObjectLayer and HeatmapLayer + */ + interface Options { + dataUrl?: string; + dataToFeatures?(obj: any): H.datalens.RawDataProvider.Feature[]; + featuresToRows?(features: H.datalens.RawDataProvider.Feature[], x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom, + tileSize: H.datalens.RawDataProvider.TileSize, helpers: H.datalens.RawDataProvider.Helpers): H.datalens.ObjectLayer.Row[]; + } + + /** + * A GeoJSON feature + * A GeoJSON feature object which conforms to the standard GeoJSON spec + */ + type Feature = any; + + /** + * Tile size + * The tile size in pixels. + */ + type TileSize = any; + + /** + * A helper class used in the worker thread + * This helper class provides convenience functions you can use in the worker thread + * @property latLngToPixel {function(H.datalens.RawDataProvider.Latitude, H.datalens.RawDataProvider.Longitude, H.datalens.QueryTileProvider.Zoom, H.datalens.RawDataProvider.TileSize)=} - + * Translates geographical coordinates (latitude, longitude) to world pixel coordinates. + * @property pixelToLatLng {function(H.datalens.RawDataProvider.PX, H.datalens.RawDataProvider.PY, H.datalens.QueryTileProvider.Zoom, H.datalens.RawDataProvider.TileSize)=} - + * Translates world pixel coordinates to geographical coordinates (latitude, longitude). + * @property parseCSV {function(any)=} - Takes CSV data as input, parses it, and return the parsed result. + */ + interface Helpers { + latLngToPixel?(latitude: H.datalens.RawDataProvider.Latitude, longitude: H.datalens.RawDataProvider.Longitude, z: H.datalens.QueryTileProvider.Zoom, + tileSize: H.datalens.RawDataProvider.TileSize): H.datalens.RawDataProvider.PixelCoordinates; + pixelToLatLng?(x: H.datalens.RawDataProvider.PX, y: H.datalens.RawDataProvider.PY, z: H.datalens.QueryTileProvider.Zoom, tileSize: H.datalens.RawDataProvider.TileSize): + H.datalens.RawDataProvider.GeoCoordinates; + parseCSV?(obj: any): any[]; + } + + /** + * Geographic coordinates + * A geographic coordinates pair [lat, lng] + */ + type GeoCoordinates = [number, number]; + + /** + * Latitude coordinate + * The latitude in the geographic coordinates pair + */ + type Latitude = number; + + /** + * Longitude coordinate + * The longitude in the geographic coordinates pair + */ + type Longitude = number; + + /** + * Pixel coordinates + * Pixel coordinates [px, py] pair + */ + type PixelCoordinates = [number, number]; + + /** + * Pixel coordinate in the x direction + * The x coordinate of the pixel coordinates pair [px, py] + */ + type PX = number; + + /** + * Pixel coordinate in the y direction + * The y coordinate of the pixel coordinates pair [px, py] + */ + type PY = number; + } + + /** + * Renders vector tiles using data-driven styles + * This layer binds the spatial data and user data, all provided by the Data Lens REST API. The layer renders geometry features using data-driven styles. + */ + class SpatialLayer extends H.map.layer.TileLayer { + /** + * Constructor + * @param dataProvider {H.datalens.Provider} - Source of tiled data (pass in null if data come from feature properties) + * @param spatialProvider {H.datalens.SpatialTileProvider} - Source of geometry data + * @param options {H.datalens.SpatialLayer.Options} - Configuration for data processing and rendering + */ + constructor(dataProvider: H.datalens.Provider, spatialProvider: H.datalens.SpatialTileProvider, options: H.datalens.SpatialLayer.Options); + + static DEFAULT_STATE: any; + static Spatial: any; + + /** + * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. + */ + static defaultDataToRows: any; + + /** + * Forces re-rendering of the layer. When the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. + */ + redraw(): void; + + /** + * This method changes the state of a map object; for example, style on mouse event. + * @param {H.map.Object} spatial + * @param {H.datalens.SpatialLayer.StyleState} state + */ + updateSpatialStyle(spatial: H.map.Object, state: H.datalens.SpatialLayer.StyleState): void; + } + + namespace SpatialLayer { + /** + * Defines data processing and rendering options for SpatialLayer + * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. + * By default this step is processed with H.datalens.SpatialLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. + * @property rowToSpatialId {function(H.datalens.SpatialLayer.Row)} - + * Defines how to get the spatial ID from a data row. This callback is called for each row that is returned from dataToRows. + * @property featureToSpatialId {function(H.datalens.SpatialLayer.Feature)} - + * Defines how to get the spatial ID from a geometry feature. This callback is called for each geometry feature in the vector tile. + * @property rowToStyle {function(H.datalens.SpatialLayer.Row, H.datalens.QueryTileProvider.Zoom, H.datalens.SpatialLayer.StyleState)} - + * Defines how the row is translated to map object style. This callback is called for each row that is returned from dataToRows. + * @property defaultStyle {function(H.datalens.QueryTileProvider.Zoom, H.datalens.SpatialLayer.StyleState)} - Defines the default map object style. + * @property transformFeature {H.datalens.SpatialLayer.transformFeature} - Defines how to transform the features. + */ + interface Options { + dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom): + H.datalens.SpatialLayer.Row[]; + rowToSpatialId(row: H.datalens.SpatialLayer.Row): string; + featureToSpatialId(feature: H.datalens.SpatialLayer.Feature): string; + rowToStyle(row: H.datalens.SpatialLayer.Row, z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.SpatialLayer.StyleState): any; + defaultStyle(z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.SpatialLayer.StyleState): any; + transformFeature: H.datalens.SpatialLayer.transformFeature; + } + + /** + * Defines modification of a data-driven style + * StyleState appears as a parameter in the rowToStyle callback. By default it is 'DEFAULT_STATE'. To change StyleState, use the SpatialLayer.updateSpatialStyle method. + */ + type StyleState = any; + + /** + * Defines a slice of data (eg Data Lens query data row) that represents a data point + * By default each row is an object where property names correspond to data column names. This representation can be changed with the dataToRows callback. + */ + type Row = any; + + /** + * Defines a geometry in the vector tile + * Each geometry is described by various properties, including a unique identifier which must be used to map the geometry to user data. + */ + type Feature = any; + + /** + * TODO: missing in documentation: https://developer.here.com/visualization/documentation/datalens/h-datalens-spatiallayer-options.html + */ + type transformFeature = any; + } + + /** + * Specifies how to access layer data (shapes, geometries) using the Data Lens REST API. + * This provider defines the interface for accessing shape layers via the Data Lens REST API. The input data is provided as vector tiles in the MapBox format (Protobuf). + * Data is loaded by tiles. + */ + class SpatialTileProvider extends H.map.provider.RemoteTileProvider { + /** + * Constructor + * @param service {H.datalens.Service} - Data Lens REST API service + * @param options {H.datalens.SpatialTileProvider.Options} - Configures layer name + */ + constructor(service: H.datalens.Service, options: H.datalens.SpatialTileProvider.Options); + + static VectorTile: any; + + /** + * Updates the layer name to be used in the next call of the Data Lens REST API. Note that new data will be fetched only after the reload method is called. + * @param {string} layerName + */ + setLayerName(layerName: string): void; + + /** + * Updates the query's dynamic parameters to be used in the next call of the Data Lens REST API. Note that new data will be fetched only after the reload method is called. + * This method is normally used when updating your visualization. + * @param {any|null} queryParams + */ + setQueryParams(queryParams: any | null): void; + } + + namespace SpatialTileProvider { + /** + * Defines layer name and data accessibility parameters for H.datalens.SpatialTileProvider + * This defines the layer name and dynamic parameters required for fetching tiled geometry data with the Data Lens REST API. Other options from H.datalens.Provider.Options are available. + * @property layerName {string} - The name of the layer to fetch with the Data Lens REST API query + * @property queryParams {any} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. + */ + interface Options { + layerName: string; + queryParams?: any; + } + } + } +} diff --git a/types/heredatalens/tsconfig.json b/types/heredatalens/tsconfig.json new file mode 100644 index 0000000000..d687f69017 --- /dev/null +++ b/types/heredatalens/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} \ No newline at end of file diff --git a/types/heredatalens/tslint.json b/types/heredatalens/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/heredatalens/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From 5cced096319d160a84587c0ae96c0d9fff73e9e5 Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Tue, 23 May 2017 11:55:28 +0200 Subject: [PATCH 004/286] add missing test file to tsconfig.json --- types/heredatalens/tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/heredatalens/tsconfig.json b/types/heredatalens/tsconfig.json index d687f69017..9c60b13753 100644 --- a/types/heredatalens/tsconfig.json +++ b/types/heredatalens/tsconfig.json @@ -17,6 +17,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "heredatalens-tests.ts" ] } \ No newline at end of file From dd14b496587c5d4497378ab0da1a656ff03130f1 Mon Sep 17 00:00:00 2001 From: Gabe Scholz Date: Tue, 23 May 2017 12:01:10 -0700 Subject: [PATCH 005/286] Ensure that typings for resolves and rejects return type Matchers> --- types/jest/index.d.ts | 72 +++++++++++++++++++++------------------- types/jest/jest-tests.ts | 39 +++++++++++++++++----- 2 files changed, 68 insertions(+), 43 deletions(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 7ac5c7486b..9c96fd1615 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -159,7 +159,7 @@ declare namespace jest { * * @param {any} actual The value to apply matchers against. */ - (actual: any): Matchers; + (actual: any): Matchers; anything(): any; /** Matches anything that was created with the given constructor. You can use it inside `toEqual` or `toBeCalledWith` instead of a literal value. */ any(classType: any): any; @@ -175,69 +175,71 @@ declare namespace jest { stringMatching(str: string | RegExp): any; } - interface Matchers { + interface Matchers { /** If you know how to test something, `.not` lets you test its opposite. */ - not: Matchers; - resolves: Matchers; - rejects: Matchers; - lastCalledWith(...args: any[]): void; + not: Matchers; + /** Use resolves to unwrap the value of a fulfilled promise so any other matcher can be chained. If the promise is rejected the assertion fails. */ + resolves: Matchers>; + /** Unwraps the reason of a rejected promise so any other matcher can be chained. If the promise is fulfilled the assertion fails. */ + rejects: Matchers>; + lastCalledWith(...args: any[]): R; /** Checks that a value is what you expect. It uses `===` to check strict equality. Don't use `toBe` with floating-point numbers. */ - toBe(expected: any): void; + toBe(expected: any): R; /** Ensures that a mock function is called. */ - toBeCalled(): void; + toBeCalled(): R; /** Ensure that a mock function is called with specific arguments. */ - toBeCalledWith(...args: any[]): void; + toBeCalledWith(...args: any[]): R; /** Using exact equality with floating point numbers is a bad idea. Rounding means that intuitive things fail. */ - toBeCloseTo(expected: number, delta?: number): void; + toBeCloseTo(expected: number, delta?: number): R; /** Ensure that a variable is not undefined. */ - toBeDefined(): void; + toBeDefined(): R; /** When you don't care what a value is, you just want to ensure a value is false in a boolean context. */ - toBeFalsy(): void; + toBeFalsy(): R; /** For comparing floating point numbers. */ - toBeGreaterThan(expected: number): void; + toBeGreaterThan(expected: number): R; /** For comparing floating point numbers. */ - toBeGreaterThanOrEqual(expected: number): void; + toBeGreaterThanOrEqual(expected: number): R; /** Ensure that an object is an instance of a class. This matcher uses `instanceof` underneath. */ - toBeInstanceOf(expected: any): void + toBeInstanceOf(expected: any): R /** For comparing floating point numbers. */ - toBeLessThan(expected: number): void; + toBeLessThan(expected: number): R; /** For comparing floating point numbers. */ - toBeLessThanOrEqual(expected: number): void; + toBeLessThanOrEqual(expected: number): R; /** This is the same as `.toBe(null)` but the error messages are a bit nicer. So use `.toBeNull()` when you want to check that something is null. */ - toBeNull(): void; + toBeNull(): R; /** Use when you don't care what a value is, you just want to ensure a value is true in a boolean context. In JavaScript, there are six falsy values: `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy. */ - toBeTruthy(): void; + toBeTruthy(): R; /** Used to check that a variable is undefined. */ - toBeUndefined(): void; + toBeUndefined(): R; /** Used when you want to check that an item is in a list. For testing the items in the list, this uses `===`, a strict equality check. */ - toContain(expected: any): void; + toContain(expected: any): R; /** Used when you want to check that an item is in a list. For testing the items in the list, this matcher recursively checks the equality of all fields, rather than checking for object identity. */ - toContainEqual(expected: any): void; + toContainEqual(expected: any): R; /** Used when you want to check that two objects have the same value. This matcher recursively checks the equality of all fields, rather than checking for object identity. */ - toEqual(expected: any): void; + toEqual(expected: any): R; /** Ensures that a mock function is called. */ - toHaveBeenCalled(): boolean; + toHaveBeenCalled(): R; /** Ensures that a mock function is called an exact number of times. */ - toHaveBeenCalledTimes(expected: number): boolean; + toHaveBeenCalledTimes(expected: number): R; /** Ensure that a mock function is called with specific arguments. */ - toHaveBeenCalledWith(...params: any[]): boolean; + toHaveBeenCalledWith(...params: any[]): R; /** If you have a mock function, you can use `.toHaveBeenLastCalledWith` to test what arguments it was last called with. */ - toHaveBeenLastCalledWith(...params: any[]): boolean; + toHaveBeenLastCalledWith(...params: any[]): R; /** Used to check that an object has a `.length` property and it is set to a certain numeric value. */ - toHaveLength(expected: number): void; - toHaveProperty(propertyPath: string, value?: any): void; + toHaveLength(expected: number): R; + toHaveProperty(propertyPath: string, value?: any): R; /** Check that a string matches a regular expression. */ - toMatch(expected: string | RegExp): void; + toMatch(expected: string | RegExp): R; /** Used to check that a JavaScript object matches a subset of the properties of an objec */ - toMatchObject(expected: {}): void; + toMatchObject(expected: {}): R; /** This ensures that a value matches the most recent snapshot. Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information. */ - toMatchSnapshot(snapshotName?: string): void; + toMatchSnapshot(snapshotName?: string): R; /** Used to test that a function throws when it is called. */ - toThrow(error?: string | Constructable | RegExp): void; + toThrow(error?: string | Constructable | RegExp): R; /** If you want to test that a specific error is thrown inside a function. */ - toThrowError(error?: string | Constructable | RegExp): void; + toThrowError(error?: string | Constructable | RegExp): R; /** Used to test that a function throws a error matching the most recent snapshot when it is called. */ - toThrowErrorMatchingSnapshot(): void; + toThrowErrorMatchingSnapshot(): R; } interface Constructable { diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index 0605724334..eb86e1c861 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -503,16 +503,39 @@ describe('Mocks', function () { }); // https://facebook.github.io/jest/docs/en/expect.html#resolves -describe('resolves', function () { - it('unwraps the expected Promise', function () { - return expect(Promise.resolve('test')).resolves.toEqual('test'); +describe('resolves', function() { + it('unwraps the expected Promise', function() { + const expectation = expect(Promise.resolve('test')).resolves.toEqual('test'); + expect(expectation instanceof Promise).toBeTruthy(); + return expectation; + }); + + it('unwraps a .toHaveBeenCalledX', function(done) { + expect.assertions(2); + + const fn = jest.fn(); + return expect(Promise.resolve(fn)).resolves.toHaveBeenCalledTimes(0).then(val => { + expect(val).toEqual(true); + done(); + }); + }); + + it('unwraps a not.toHaveBeenCalledX', function(done) { + expect.assertions(2); + + const fn = jest.fn(); + return expect(Promise.resolve(fn)).resolves.not.toHaveBeenCalledTimes(1).then(val => { + expect(val).toEqual(true); + done(); + }); }); }); // https://facebook.github.io/jest/docs/en/expect.html#rejects -describe('rejects', function () { - it('unwraps the expected Promise', function () { - const error = new Error('error'); - return expect(Promise.reject(error)).rejects.toBeDefined(); +describe('rejects', function() { + it('unwraps the expected Promise', function() { + const expectation = expect(Promise.reject(new Error('error'))).rejects.toMatch('error'); + expect(expectation instanceof Promise).toBeTruthy(); + return expectation; }); -}); \ No newline at end of file +}); From 649f8e44f145620cd9409aa8ac4ca87888a11796 Mon Sep 17 00:00:00 2001 From: Gabe Scholz Date: Mon, 29 May 2017 16:17:51 -0700 Subject: [PATCH 006/286] PR Fixes: - Fix Jest version - Add hasAssertions() --- types/jest/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 9c96fd1615..9abee06c9f 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Jest 19.2.0 +// Type definitions for Jest 20.0.4 // Project: http://facebook.github.io/jest/ // Definitions by: Asana , Ivo Stratev , jwbay , Alexey Svetliakov , Alex Jover Morales // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -167,6 +167,8 @@ declare namespace jest { arrayContaining(arr: any[]): any; /** Verifies that a certain number of assertions are called during a test. This is often useful when testing asynchronous code, in order to make sure that assertions in a callback actually got called. */ assertions(num: number): void; + /** Verifies that at least one assertion is called during a test. This is often useful when testing asynchronous code, in order to make sure that assertions in a callback actually got called. */ + hasAssertions(): void; /** You can use `expect.extend` to add your own matchers to Jest. */ extend(obj: ExpectExtendMap): void; /** Matches any object that recursively matches the provided keys. This is often handy in conjunction with other asymmetric matchers. */ From 7ded9e7db477e1503b219009ff7971b25d08cb53 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 1 Jun 2017 21:09:29 +0100 Subject: [PATCH 007/286] Initial commit of files --- types/nodegit/index.d.ts | 6 +++ types/nodegit/nodegit-tests.ts | 5 +++ types/nodegit/repository.d.ts | 71 ++++++++++++++++++++++++++++++++++ types/nodegit/tsconfig.json | 23 +++++++++++ types/nodegit/tslint.json | 6 +++ 5 files changed, 111 insertions(+) create mode 100644 types/nodegit/index.d.ts create mode 100644 types/nodegit/nodegit-tests.ts create mode 100644 types/nodegit/repository.d.ts create mode 100644 types/nodegit/tsconfig.json create mode 100644 types/nodegit/tslint.json diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts new file mode 100644 index 0000000000..3a70a8ea9a --- /dev/null +++ b/types/nodegit/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for nodegit 0.18 +// Project: https://github.com/nodegit/nodegit +// Definitions by: Dolan Miu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export { Repository } from './repository'; diff --git a/types/nodegit/nodegit-tests.ts b/types/nodegit/nodegit-tests.ts new file mode 100644 index 0000000000..b7fa54b0c1 --- /dev/null +++ b/types/nodegit/nodegit-tests.ts @@ -0,0 +1,5 @@ +import * as Git from 'nodegit'; + +Git.Repository.discover("startPath", 1, "ceilingDirs").then((string) => { + // Use string +}); diff --git a/types/nodegit/repository.d.ts b/types/nodegit/repository.d.ts new file mode 100644 index 0000000000..f075a063f1 --- /dev/null +++ b/types/nodegit/repository.d.ts @@ -0,0 +1,71 @@ +interface RepositoryInitOptions { + description: string, + flags: number, + initialHead: string, + mode: number, + originUrl: string, + templatePath: string, + version: number, + workdirPath: string +} + + +export class Repository { + /** + * Creates a branch with the passed in name pointing to the commit + * + * @static + * @param {string} startPath + * @param {number} acrossFs + * @param {string} ceilingDirs + * @returns {Promise} + * + * @memberof Repository + */ + static discover(startPath: string, acrossFs: number, ceilingDirs: string): Promise; + /** + * + * + * @static + * @param {string} path + * @param {boolean} [isBare] + * @returns {Promise} + * + * @memberof Repository + */ + static init(path: string, isBare?: boolean): Promise; + /** + * + * + * @static + * @param {string} repoPath + * @param {RepositoryInitOptions} [options] + * @returns {Promise} + * + * @memberof Repository + */ + static initExt(repoPath: string, options?: RepositoryInitOptions): Promise; + /** + * + * + * @static + * @param {string} path + * @returns {Promise} + * + * @memberof Repository + */ + static open(path: string): Promise; + /** + * + * + * @static + * @param {string} barePath + * @returns {Promise} + * + * @memberof Repository + */ + static openBare(barePath: string): Promise; + static openExt(path: string, flags?: number, ceilingDirs?: string): Promise; + + // getBranchCommit(name: string): Promise; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json new file mode 100644 index 0000000000..ba25d4da3e --- /dev/null +++ b/types/nodegit/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "nodegit-tests.ts", + "repository.d.ts" + ] +} diff --git a/types/nodegit/tslint.json b/types/nodegit/tslint.json new file mode 100644 index 0000000000..a62d0d4e68 --- /dev/null +++ b/types/nodegit/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "ban-types": false + } +} From 082710a32c88410a67e873c250f7ce1c1c29fd72 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 2 Jun 2017 03:05:10 +0100 Subject: [PATCH 008/286] Added more types --- types/nodegit/buf.d.ts | 12 +++++ types/nodegit/index.d.ts | 7 +++ types/nodegit/object.d.ts | 21 +++++++++ types/nodegit/odb.d.ts | 18 ++++++++ types/nodegit/oid.d.ts | 11 +++++ types/nodegit/reference.d.ts | 58 ++++++++++++++++++++++++ types/nodegit/repository.d.ts | 83 ++++++++++++++++++++++++++++++++++- types/nodegit/signature.d.ts | 15 +++++++ types/nodegit/time.d.ts | 4 ++ types/nodegit/tsconfig.json | 9 +++- 10 files changed, 235 insertions(+), 3 deletions(-) create mode 100644 types/nodegit/buf.d.ts create mode 100644 types/nodegit/object.d.ts create mode 100644 types/nodegit/odb.d.ts create mode 100644 types/nodegit/oid.d.ts create mode 100644 types/nodegit/reference.d.ts create mode 100644 types/nodegit/signature.d.ts create mode 100644 types/nodegit/time.d.ts diff --git a/types/nodegit/buf.d.ts b/types/nodegit/buf.d.ts new file mode 100644 index 0000000000..53886615ed --- /dev/null +++ b/types/nodegit/buf.d.ts @@ -0,0 +1,12 @@ +/// + +export class Buf { + containsNul(): number; + free(): void; + grow(target_size: number): Promise; + isBinary(): number; + set(data: Buffer, datalen: number): Promise; + ptr: string; + asize: number; + size: number; + } diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 3a70a8ea9a..77d7003e05 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -3,4 +3,11 @@ // Definitions by: Dolan Miu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +export { Buf } from './buf'; +export { Object } from './object'; +export { Odb } from './odb'; +export { Oid } from './oid'; +export { Reference } from './reference'; export { Repository } from './repository'; +export { Signature } from './signature'; +export { Time } from './time'; diff --git a/types/nodegit/object.d.ts b/types/nodegit/object.d.ts new file mode 100644 index 0000000000..8fabe5fdd2 --- /dev/null +++ b/types/nodegit/object.d.ts @@ -0,0 +1,21 @@ +import { Oid } from './oid'; +import { Repository } from './repository'; +import { Buf } from './buf'; + +export class Object { + static size(type: number): number; + static lookup(repo: Repository, id: Oid, type: number): Promise; + static lookupPrefix(repo: Repository, id: Oid, len: number, type: number): Promise; + static string2type(str: string): number; + static type2string(type: number): string; + static typeisloose(type: number): number; + + dup(): Promise; + free(): void; + id(): Oid; + lookupByPath(path: string, type: number): Promise; + owner(): Repository; + peel(target_type: number): Promise; + shortId(): Promise; + type(): number; +} diff --git a/types/nodegit/odb.d.ts b/types/nodegit/odb.d.ts new file mode 100644 index 0000000000..acacda8b73 --- /dev/null +++ b/types/nodegit/odb.d.ts @@ -0,0 +1,18 @@ +import { Oid } from './oid'; + +export namespace Odb { + enum STREAM { + RDONLY = 2, + WRONLY = 4, + RW = 6 + } +} + +export class Odb { + static open(objects_dir: string): Promise; + + addDiskAlternate(path: string): number; + free(): void; + read(id: Oid): Promise; + write(data: Buffer, len: number, type: number): Promise; +} diff --git a/types/nodegit/oid.d.ts b/types/nodegit/oid.d.ts new file mode 100644 index 0000000000..2aa65905f6 --- /dev/null +++ b/types/nodegit/oid.d.ts @@ -0,0 +1,11 @@ +export class Oid { + static fromString(str: string): Oid; + cmp(b: Oid): number; + cpy(): Oid; + equal(b: Oid): number; + iszero(): number; + ncmp(b: Oid, len: number): number; + strcmp(str: string): number; + streq(str: string): number; + tostrS(): string; +} diff --git a/types/nodegit/reference.d.ts b/types/nodegit/reference.d.ts new file mode 100644 index 0000000000..92e3e546b2 --- /dev/null +++ b/types/nodegit/reference.d.ts @@ -0,0 +1,58 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; + +export namespace Reference { + enum TYPE { + INVALID = 0, + OID = 1, + SYMBOLIC = 2, + LISTALL = 3 + } + + enum NORMALIZE { + REF_FORMAT_NORMAL = 0, + REF_FORMAT_ALLOW_ONELEVEL = 1, + REF_FORMAT_REFSPEC_PATTERN = 2, + REF_FORMAT_REFSPEC_SHORTHAND = 4 + } +} + +export class Reference { + static create(repo: Repository, name: string, id: Oid, force: number, logMessage: string): Promise; + static createMatching(repo: Repository, name: string, id: Oid, force: number, currentId: Oid, logMessage: string): Promise; + static dwim(repo: Repository, id: string | Reference, callback: Function): Promise; + static ensureLog(repo: Repository, refname: string): number; + static hasLog(repo: Repository, refname: string): number; + static isValidName(refname: string): number; + static list(repo: Repository): Promise; + static lookup(repo: Repository, id: string | Reference, callback: Function): Promise; + static nameToId(repo: Repository, name: string): Promise; + static normalizeName(bufferOut: string, bufferSize: number, name: string, flags: number): number; + static remove(repo: Repository, name: string): number; + static symbolicCreate(repo: Repository, name: string, target: string, force: number, logMessage: string): Promise; + static symbolicCreateMatching(repo: Repository, name: string, target: string, force: number, currentValue: string, logMessage: string): Promise; + + cmp(ref2: Reference): number; + delete(): number; + isBranch(): number; + isNote(): number; + isRemote(): number; + isTag(): number; + name(): string; + owner(): Repository; + peel(type: number): Promise; + rename(newName: string, force: number, logMessage: string): Promise; + resolve(): Promise; + setTarget(id: Oid, logMessage: string): Promise; + shorthand(): string; + symbolicSetTarget(target: string, logMessage: string): Promise; + symbolicTarget(): string; + target(): Oid; + targetPeel(): Oid; + type(): number; + isValid(): Boolean; + isConcrete(): Boolean; + isSymbolic(): Boolean; + toString(): string; + isHead(): boolean; +} diff --git a/types/nodegit/repository.d.ts b/types/nodegit/repository.d.ts index f075a063f1..f32ca65c60 100644 --- a/types/nodegit/repository.d.ts +++ b/types/nodegit/repository.d.ts @@ -1,3 +1,9 @@ +import { Oid } from './oid'; +import { Buf } from './buf'; +import { Reference } from './reference'; +import { Odb } from './odb'; +import { Object } from './object'; + interface RepositoryInitOptions { description: string, flags: number, @@ -22,7 +28,7 @@ export class Repository { * * @memberof Repository */ - static discover(startPath: string, acrossFs: number, ceilingDirs: string): Promise; + static discover(startPath: string, acrossFs: number, ceilingDirs: string): Promise; /** * * @@ -66,6 +72,79 @@ export class Repository { */ static openBare(barePath: string): Promise; static openExt(path: string, flags?: number, ceilingDirs?: string): Promise; + static wrapOdb(odb: Odb): Promise; - // getBranchCommit(name: string): Promise; + cleanup(): void; + config(): Promise; + configSnapshot(): Promise; + detachHead(): number; + fetchheadForeach(callback: Function): Promise; + free(): void; + getNamespace(): string; + head(): Promise; + headDetached(): number; + headUnborn(): number; + index(): Promise; + isBare(): number; + isEmpty(): number; + isShallow(): number; + mergeheadForeach(callback: Function): Promise; + messageRemove(): number; + odb(): Promise; + path(): string; + refdb(): Promise; + setHead(refname: string): Promise; + setHeadDetached(commitish: Oid): number; + setHeadDetachedFromAnnotated(commitish: NodeGit.AnnotatedCommit): number; + setIdent(name: string, email: string): number; + setNamespace(nmspace: string): number; + setWorkdir(workdir: string, update_gitlink: number): number; + state(): number; + stateCleanup(): number; + workdir(): string; + createBranch(name: string, commit: NodeGit.Commit | string | Oid, force: boolean, signature: NodeGit.Signature, logMessage: string): Promise; + getReferenceCommit(name: string | Reference): Promise; + getBranch(name: string | Reference): Promise; + getBranchCommit(name: string | Reference): Promise; + getCurrentBranch(): Promise; + getReference(name: string | Reference): Promise; + getReferences(type: Reference.TYPE): Promise; + getReferenceNames(type: Reference.TYPE): Promise; + getCommit(string: string | Oid): Promise; + getBlob(string: string | Oid): Promise; + getTree(string: string | Oid): Promise; + createTag(string: string | Oid, name: string, message: string): Promise; + createLightweightTag(string: string | Oid, name: string): Promise; + getTag(string: string | Oid): Promise; + getTagByName(Short: string): Promise; + deleteTagByName(Short: string): Promise; + createRevWalk(string: string | Oid): any; + getMasterCommit(): Promise; + getHeadCommit(): Promise; + createCommit(updateRef: string, author: NodeGit.Signature, committer: NodeGit.Signature, message: string, Tree: NodeGit.Tree | Oid | string, parents: any[]): Promise; + createCommitOnHead(filesToAdd: any[], author: NodeGit.Signature, committer: NodeGit.Signature, message: string): Promise; + createBlobFromBuffer(buffer: Buffer): Oid; + treeBuilder(tree: NodeGit.Tree): any; + defaultSignature(): Signature; + getRemotes(Optional: Function): Promise; + getRemote(remote: string | Remote, callback: Function): Promise; + fetch(remote: string | Remote, fetchOptions: Object | FetchOptions): Promise; + fetchAll(fetchOptions: Object | FetchOptions, callback: Function): Promise; + mergeBranches(to: string | Reference, from: string | Reference, signature: NodeGit.Signature, mergePreference: NodeGit.Merge.PREFERENCE, mergeOptions: NodeGit.MergeOptions): Promise; + rebaseBranches(branch: string, upstream: string, onto: string, signature: NodeGit.Signature, beforeNextFn: Function): Promise; + continueRebase(signature: NodeGit.Signature, beforeNextFn: Function): Promise; + getStatus(opts: any): Promise; + getStatusExt(opts: any): Promise; + getSubmoduleNames(): Promise; + checkoutRef(reference: Reference, opts: Object | CheckoutOptions): Promise; + checkoutBranch(branch: string | Reference, opts: Object | CheckoutOptions): Promise; + stageFilemode(filePath: string | any[], stageNew: Boolean): Promise; + stageLines(filePath: string, newLines: any[], isStaged: Boolean): Promise; + isDefaultState(): Boolean; + isApplyingMailbox(): Boolean; + isBisecting(): Boolean; + isCherrypicking(): Boolean; + isMerging(): Boolean; + isRebasing(): Boolean; + isReverting(): Boolean; } diff --git a/types/nodegit/signature.d.ts b/types/nodegit/signature.d.ts new file mode 100644 index 0000000000..c18ccb45ff --- /dev/null +++ b/types/nodegit/signature.d.ts @@ -0,0 +1,15 @@ +import { Repository } from './repository'; +import { Time } from './time'; + +export class Signature { + static default(repo: Repository): Signature; + static create(name: string, email: string, time: number, offset: number): Signature; + static now(name: string, email: string): Signature; + + dup(): Promise; + free(): void; + toString(): string; + name: string; + email: string; + when: Time; +} diff --git a/types/nodegit/time.d.ts b/types/nodegit/time.d.ts new file mode 100644 index 0000000000..575c005781 --- /dev/null +++ b/types/nodegit/time.d.ts @@ -0,0 +1,4 @@ +export class Time { + time: number; + offset: number; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index ba25d4da3e..471d7919cd 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -16,8 +16,15 @@ "forceConsistentCasingInFileNames": true }, "files": [ + "buf.d.ts", "index.d.ts", "nodegit-tests.ts", - "repository.d.ts" + "object.d.ts", + "odb.d.ts", + "oid.d.ts", + "reference.d.ts", + "repository.d.ts", + "signature.d.ts", + "time.d.ts", ] } From 9d2d217c3c929db64c59a9cf96b5b356e9c5bf95 Mon Sep 17 00:00:00 2001 From: Dvorscak Date: Fri, 2 Jun 2017 10:05:20 -0500 Subject: [PATCH 009/286] Add test for css function second parameter --- types/jquery/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 9dc1bf466e..39d75e1eaf 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -682,8 +682,9 @@ interface JQueryCoordinates { /** * The interface used to specify the properties parameter in css() */ +type cssPropertySetter = (index: number, value: string) => string | number; interface JQueryCssProperties { - [propertyName: string]: string | number | Function; + [propertyName: string]: string | number | cssPropertySetter; } /** From 5222e357223f7208a46098464d61cc4f4038300b Mon Sep 17 00:00:00 2001 From: Dvorscak Date: Fri, 2 Jun 2017 10:05:42 -0500 Subject: [PATCH 010/286] Make cssPropertySettter more strict --- types/jquery/jquery-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index d2d58aa2a2..3a2d2a74bc 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -1062,8 +1062,8 @@ function test_css() { var color = $(this).css("background-color"); $("#result").html("That div is " + color + "."); }); - $('div.example').css('width', function (index) { - return index * 50; + $('div.example').css('width', function (index, style) { + return style.length > 0 ? style : index * 50; }); $("p").mouseover(function () { $(this).css("color", "red"); From 84e83354e7cf3dec1b9e6c366c59f6b561e7bd9a Mon Sep 17 00:00:00 2001 From: Michael Ledin Date: Fri, 2 Jun 2017 21:56:32 +0300 Subject: [PATCH 011/286] Formatting. --- types/superagent/index.d.ts | 66 ++--- types/superagent/superagent-tests.ts | 367 ++++++++++++++------------- types/superagent/tsconfig.json | 2 +- 3 files changed, 220 insertions(+), 215 deletions(-) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index fe6a797675..b53feed20d 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -21,7 +21,7 @@ declare namespace request { method: string; url: string; cookies: string; - } + } interface SuperAgentStatic extends SuperAgent { (url: string): SuperAgentRequest; (method: string, url: string): SuperAgentRequest; @@ -58,9 +58,9 @@ declare namespace request { search(url: string, callback?: CallbackHandler): Req; connect(url: string, callback?: CallbackHandler): Req; - parse(fn: (res: Response, callback: (err: Error | null, body: any) => void) => void): this; - saveCookies(res: Response): void; - attachCookies(req: Req): void; + parse(fn: (res: Response, callback: (err: Error | null, body: any) => void) => void): this; + saveCookies(res: Response): void; + attachCookies(req: Req): void; } interface Response extends NodeJS.ReadableStream { @@ -90,35 +90,35 @@ declare namespace request { } interface Request extends Promise /* extends NodeJS.WritableStream */ { - abort(): void; - accept(type: string): this; - attach(field: string, file: string, filename?: string): this; - auth(user: string, name: string): this; - buffer(val?: boolean): this; - clearTimeout(): this; - end(callback?: CallbackHandler): this; - field(name: string, val: string): this; - get(field: string): string; - on(name: string, handler: Function): this; - on(name: 'error', handler: (err: any) => void): this; - part(): this; - pipe(stream: NodeJS.WritableStream, options?: Object): stream.Writable; - query(val: Object): this; - redirects(n: number): this; - responseType(type: string): this; - send(data: string): this; - send(data: Object): this; - send(): this; - set(field: string, val: string): this; - set(field: Object): this; - timeout(ms: number): this; - type(val: string): this; - unset(field: string): this; - use(fn: Function): this; - withCredentials(): this; - write(data: string, encoding?: string): this; - write(data: Buffer, encoding?: string): this; - parse(fn: (res: Response, callback: (err: Error | null, body: any) => void) => void): this; + abort(): void; + accept(type: string): this; + attach(field: string, file: string, filename?: string): this; + auth(user: string, name: string): this; + buffer(val?: boolean): this; + clearTimeout(): this; + end(callback?: CallbackHandler): this; + field(name: string, val: string): this; + get(field: string): string; + on(name: string, handler: Function): this; + on(name: 'error', handler: (err: any) => void): this; + part(): this; + pipe(stream: NodeJS.WritableStream, options?: Object): stream.Writable; + query(val: Object): this; + redirects(n: number): this; + responseType(type: string): this; + send(data: string): this; + send(data: Object): this; + send(): this; + set(field: string, val: string): this; + set(field: Object): this; + timeout(ms: number): this; + type(val: string): this; + unset(field: string): this; + use(fn: Function): this; + withCredentials(): this; + write(data: string, encoding?: string): this; + write(data: Buffer, encoding?: string): this; + parse(fn: (res: Response, callback: (err: Error | null, body: any) => void) => void): this; } } diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index da60314b23..cfac121640 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -1,9 +1,9 @@ // via: http://visionmedia.github.io/superagent/ -import * as request from 'superagent'; -import * as fs from 'fs'; -import * as assert from 'assert'; -import { Agent } from 'https'; +import * as request from 'superagent' +import * as fs from 'fs' +import * as assert from 'assert' +import {Agent} from 'https' // Examples taken from https://github.com/visionmedia/superagent/blob/gh-pages/docs/index.md @@ -12,207 +12,208 @@ import { Agent } from 'https'; const httpsAgent: Agent = new Agent(); request - .post('/api/pet') - .send({ name: 'Manny', species: 'cat' }) - .set('X-API-Key', 'foobar') - .set('Accept', 'application/json') - .agent(httpsAgent) - .end((err, res) => { - if (res.ok) { - console.log('yay got ' + JSON.stringify(res.body)); - } else { - console.log('Oh no! error ' + res.text); - } - }); + .post('/api/pet') + .send({name: 'Manny', species: 'cat'}) + .set('X-API-Key', 'foobar') + .set('Accept', 'application/json') + .agent(httpsAgent) + .end((err, res) => { + if (res.ok) { + console.log('yay got ' + JSON.stringify(res.body)); + } else { + console.log('Oh no! error ' + res.text); + } + }); var agent = request.agent(); agent - .post('/api/pet') - .send({ name: 'Manny', species: 'cat' }) - .set('X-API-Key', 'foobar') - .set('Accept', 'application/json') - .end((err, res) => { - if (res.error) { - console.log('oh no ' + res.error.message); - } else { - console.log('got ' + res.status + ' response'); - } - }); + .post('/api/pet') + .send({name: 'Manny', species: 'cat'}) + .set('X-API-Key', 'foobar') + .set('Accept', 'application/json') + .end((err, res) => { + if (res.error) { + console.log('oh no ' + res.error.message); + } else { + console.log('got ' + res.status + ' response'); + } + }); // Plugins var nocache = require('superagent-no-cache'); var prefix = require('superagent-prefix')('/static'); request - .get('/some-url') - .use(prefix) // Prefixes *only* this request - .use(nocache) // Prevents caching of *only* this request - .end(function(err, res){ - // Do something - }); + .get('/some-url') + .use(prefix) // Prefixes *only* this request + .use(nocache) // Prevents caching of *only* this request + .end(function (err, res) { + // Do something + }); -var callback = (err: any, res: request.Response) => {}; +var callback = (err: any, res: request.Response) => { +}; // Request basics request - .get('/search') - .end(callback); + .get('/search') + .end(callback); request('GET', '/search') - .end(callback); + .end(callback); request - .get('http://example.com/search') - .end(callback); + .get('http://example.com/search') + .end(callback); request - .head('/favicon.ico') - .end(callback); + .head('/favicon.ico') + .end(callback); request - .del('/user/1') - .end(callback); + .del('/user/1') + .end(callback); request - .delete('/user/1') - .end(callback); + .delete('/user/1') + .end(callback); request - .delete('/user/1') - .send() - .end(callback); + .delete('/user/1') + .send() + .end(callback); request('/search') - .end(callback); + .end(callback); // Setting header fields request - .get('/search') - .set('API-Key', 'foobar') - .set('Accept', 'application/json') - .end(callback); + .get('/search') + .set('API-Key', 'foobar') + .set('Accept', 'application/json') + .end(callback); request - .get('/search') - .set({ 'API-Key': 'foobar', Accept: 'application/json' }) - .end(callback); + .get('/search') + .set({'API-Key': 'foobar', Accept: 'application/json'}) + .end(callback); // GET requests request - .get('/search') - .query({ query: 'Manny' }) - .query({ range: '1..5' }) - .query({ order: 'desc' }) - .end(callback); + .get('/search') + .query({query: 'Manny'}) + .query({range: '1..5'}) + .query({order: 'desc'}) + .end(callback); request - .get('/search') - .query({ query: 'Manny', range: '1..5', order: 'desc' }) - .end(callback); + .get('/search') + .query({query: 'Manny', range: '1..5', order: 'desc'}) + .end(callback); request - .get('/querystring') - .query('search=Manny&range=1..5') - .end(callback); + .get('/querystring') + .query('search=Manny&range=1..5') + .end(callback); request - .get('/querystring') - .query('search=Manny') - .query('range=1..5') - .end(callback); + .get('/querystring') + .query('search=Manny') + .query('range=1..5') + .end(callback); // HEAD requests request - .head('/users') - .query({ email: 'joe@smith.com' }) - .end(callback); + .head('/users') + .query({email: 'joe@smith.com'}) + .end(callback); // POST / PUT requests request.post('/user') - .set('Content-Type', 'application/json') - .send('{"name":"tj","pet":"tobi"}') - .end(callback); + .set('Content-Type', 'application/json') + .send('{"name":"tj","pet":"tobi"}') + .end(callback); request.post('/user') - .send({ name: 'tj', pet: 'tobi' }) - .end(callback); + .send({name: 'tj', pet: 'tobi'}) + .end(callback); request.post('/user') - .send({ name: 'tj' }) - .send({ pet: 'tobi' }) - .end(callback); + .send({name: 'tj'}) + .send({pet: 'tobi'}) + .end(callback); request.post('/user') - .send('name=tj') - .send('pet=tobi') - .end(callback); + .send('name=tj') + .send('pet=tobi') + .end(callback); request.post('/user') - .type('form') - .send({ name: 'tj' }) - .send({ pet: 'tobi' }) - .end(callback); + .type('form') + .send({name: 'tj'}) + .send({pet: 'tobi'}) + .end(callback); // Setting the Content-Type request.post('/user') - .set('Content-Type', 'application/json'); + .set('Content-Type', 'application/json'); request.post('/user') - .type('application/json'); + .type('application/json'); request.post('/user') - .type('json'); + .type('json'); request.post('/user') - .type('png'); + .type('png'); // Setting Accept request.get('/user') - .accept('application/json'); + .accept('application/json'); request.get('/user') - .accept('json'); + .accept('json'); request.get('/user') - .accept('png'); + .accept('png'); // Query strings request - .post('/') - .query({ format: 'json' }) - .query({ dest: '/login' }) - .send({ post: 'data', here: 'wahoo' }) - .end(callback); + .post('/') + .query({format: 'json'}) + .query({dest: '/login'}) + .send({post: 'data', here: 'wahoo'}) + .end(callback); // Parsing response bodies request('/search') - .end((res: request.Response) => { - var status: number = res.status; - var body = res.body; - var files: Object = res.files; - var text: string = res.text; - var contentLength = res.header['content-length']; - var contentType: string = res.type; - var charset: string = res.charset; - }); + .end((res: request.Response) => { + var status: number = res.status; + var body = res.body; + var files: Object = res.files; + var text: string = res.text; + var contentLength = res.header['content-length']; + var contentType: string = res.type; + var charset: string = res.charset; + }); // Custom parsers request - .post('/search') - .parse((res, callback) => { - res.setEncoding("binary"); - let data = ""; - res.on("data", (chunk: string) => { - data += chunk; - }); + .post('/search') + .parse((res, callback) => { + res.setEncoding("binary"); + let data = ""; + res.on("data", (chunk: string) => { + data += chunk; + }); - res.on("end", () => { - callback(null, new Buffer(data, "base64")); + res.on("end", () => { + callback(null, new Buffer(data, "base64")); + }); + }) + .end((res: request.Response) => { + res.body.toString("hex"); }); - }) - .end((res: request.Response) => { - res.body.toString("hex"); - }); var req = request.get('/hoge'); // Aborting requests @@ -230,94 +231,98 @@ console.log(reqMethod + ' request to ' + reqUrl + ' cookies ' + reqCookies); // Basic authentication request.get('http://tobi:learnboost@local').end(callback); request - .get('http://local') - .auth('tobo', 'learnboost') - .end(callback); + .get('http://local') + .auth('tobo', 'learnboost') + .end(callback); // Following redirects request - .get('/some.png') - .redirects(2) - .end(callback); + .get('/some.png') + .redirects(2) + .end(callback); // Piping data /* -(function() { -var stream = fs.createReadStream('path/to/my.json'); -var req = request.post('/somewhere'); -req.type('json'); -stream.pipe(req); -})(); -*/ + (function() { + var stream = fs.createReadStream('path/to/my.json'); + var req = request.post('/somewhere'); + req.type('json'); + stream.pipe(req); + })(); + */ -(function() { -var stream = fs.createWriteStream('path/to/my.json'); -var req = request.get('/some.json'); -req.pipe(stream); +(function () { + var stream = fs.createWriteStream('path/to/my.json'); + var req = request.get('/some.json'); + req.pipe(stream); })(); // Multipart requests -(function() { -var req = request.post('/upload'); +(function () { + var req = request.post('/upload'); -req.part() - .set('Content-Type', 'image/png') - .set('Content-Disposition', 'attachment; filename="myimage.png"') - .write('some image data') - .write('some more image data'); + req.part() + .set('Content-Type', 'image/png') + .set('Content-Disposition', 'attachment; filename="myimage.png"') + .write('some image data') + .write('some more image data'); -req.part() - .set('Content-Disposition', 'form-data; name="name"') - .set('Content-Type', 'text/plain') - .write('tobi'); + req.part() + .set('Content-Disposition', 'form-data; name="name"') + .set('Content-Type', 'text/plain') + .write('tobi'); -req.end(callback); + req.end(callback); })(); // Attaching files request - .post('/upload') - .attach('avatar', 'path/to/tobi.png', 'user.png') - .attach('image', 'path/to/loki.png') - .attach('file', 'path/to/jane.png') - .end(callback); + .post('/upload') + .attach('avatar', 'path/to/tobi.png', 'user.png') + .attach('image', 'path/to/loki.png') + .attach('file', 'path/to/jane.png') + .end(callback); // Field values request - .post('/upload') - .field('user[name]', 'Tobi') - .field('user[email]', 'tobi@learnboost.com') - .attach('image', 'path/to/tobi.png') - .end(callback); + .post('/upload') + .field('user[name]', 'Tobi') + .field('user[email]', 'tobi@learnboost.com') + .attach('image', 'path/to/tobi.png') + .end(callback); // CORS request - .get('http://localhost:4001/') - .withCredentials() - .end(callback); + .get('http://localhost:4001/') + .withCredentials() + .end(callback); // Error handling request - .post('/upload') - .attach('image', 'path/to/tobi.png') - .end((err: any, res: request.Response): void => {}); + .post('/upload') + .attach('image', 'path/to/tobi.png') + .end((err: any, res: request.Response): void => { + }); request - .post('/upload') - .attach('image', 'path/to/tobi.png') - .on('error', (err: any) => {}) - .end(callback); + .post('/upload') + .attach('image', 'path/to/tobi.png') + .on('error', (err: any) => { + }) + .end(callback); //Promise request - .get('/search') - .then((response) => {}) - .catch((error) => {}); + .get('/search') + .then((response) => { + }) + .catch((error) => { + }); // Requesting binary data. // adapted from: https://github.com/visionmedia/superagent/blob/v2.0.0/test/client/request.js#L110 request - .get('/blob') - .responseType('blob') - .end(function (err, res) { - assert(res.xhr instanceof XMLHttpRequest) - assert(res.xhr.response instanceof Blob); - }); + .get('/blob') + .responseType('blob') + .end(function (err, res) { + assert(res.xhr instanceof XMLHttpRequest) + assert(res.xhr.response instanceof Blob); + }); diff --git a/types/superagent/tsconfig.json b/types/superagent/tsconfig.json index 1a20530571..b1f13095f7 100644 --- a/types/superagent/tsconfig.json +++ b/types/superagent/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "superagent-tests.ts" ] -} \ No newline at end of file +} From 2ea788c86674d734ba6fe33119349223bb7b53a7 Mon Sep 17 00:00:00 2001 From: Michael Ledin Date: Fri, 2 Jun 2017 22:11:19 +0300 Subject: [PATCH 012/286] Add superagent Plugin type. --- types/superagent/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index b53feed20d..0a028e015b 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -114,13 +114,14 @@ declare namespace request { timeout(ms: number): this; type(val: string): this; unset(field: string): this; - use(fn: Function): this; + use(fn: Plugin): this; withCredentials(): this; write(data: string, encoding?: string): this; write(data: Buffer, encoding?: string): this; parse(fn: (res: Response, callback: (err: Error | null, body: any) => void) => void): this; } + type Plugin = (req: Request) => void; } export = request; From f72abdaf74df9837f986efd925c78fff3bf80a97 Mon Sep 17 00:00:00 2001 From: Michael Ledin Date: Fri, 2 Jun 2017 22:13:28 +0300 Subject: [PATCH 013/286] Add definitions for superagent-no-cache 0.1. --- types/superagent-no-cache/index.d.ts | 11 +++++++++ .../superagent-no-cache-tests.ts | 9 ++++++++ types/superagent-no-cache/tsconfig.json | 23 +++++++++++++++++++ types/superagent-no-cache/tslint.json | 1 + types/superagent/superagent-tests.ts | 2 -- 5 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 types/superagent-no-cache/index.d.ts create mode 100644 types/superagent-no-cache/superagent-no-cache-tests.ts create mode 100644 types/superagent-no-cache/tsconfig.json create mode 100644 types/superagent-no-cache/tslint.json diff --git a/types/superagent-no-cache/index.d.ts b/types/superagent-no-cache/index.d.ts new file mode 100644 index 0000000000..9dcfc02005 --- /dev/null +++ b/types/superagent-no-cache/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for superagent-no-cache 0.1 +// Project: https://github.com/johntron/superagent-no-cache +// Definitions by: Michael Ledin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import * as request from 'superagent'; + +declare const plugin: request.Plugin; + +export default plugin; diff --git a/types/superagent-no-cache/superagent-no-cache-tests.ts b/types/superagent-no-cache/superagent-no-cache-tests.ts new file mode 100644 index 0000000000..528eb4fd40 --- /dev/null +++ b/types/superagent-no-cache/superagent-no-cache-tests.ts @@ -0,0 +1,9 @@ +import * as request from 'superagent'; +import plugin from 'superagent-no-cache'; + +request + .get('/some-url') + .use(plugin) + .end((err, res) => { + // Do something + }); diff --git a/types/superagent-no-cache/tsconfig.json b/types/superagent-no-cache/tsconfig.json new file mode 100644 index 0000000000..668d406795 --- /dev/null +++ b/types/superagent-no-cache/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "superagent-no-cache-tests.ts" + ] +} diff --git a/types/superagent-no-cache/tslint.json b/types/superagent-no-cache/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/superagent-no-cache/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index cfac121640..628b4fd1f6 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -40,13 +40,11 @@ agent }); // Plugins -var nocache = require('superagent-no-cache'); var prefix = require('superagent-prefix')('/static'); request .get('/some-url') .use(prefix) // Prefixes *only* this request - .use(nocache) // Prevents caching of *only* this request .end(function (err, res) { // Do something }); From 89ca5ad175ac540c24a11ef1e570d69562439e7e Mon Sep 17 00:00:00 2001 From: Michael Ledin Date: Fri, 2 Jun 2017 22:14:15 +0300 Subject: [PATCH 014/286] Add definitions for superagent-prefix 0.0. --- types/superagent-prefix/index.d.ts | 9 ++++++++ .../superagent-prefix-tests.ts | 9 ++++++++ types/superagent-prefix/tsconfig.json | 23 +++++++++++++++++++ types/superagent-prefix/tslint.json | 1 + types/superagent/superagent-tests.ts | 10 -------- 5 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 types/superagent-prefix/index.d.ts create mode 100644 types/superagent-prefix/superagent-prefix-tests.ts create mode 100644 types/superagent-prefix/tsconfig.json create mode 100644 types/superagent-prefix/tslint.json diff --git a/types/superagent-prefix/index.d.ts b/types/superagent-prefix/index.d.ts new file mode 100644 index 0000000000..238046dde9 --- /dev/null +++ b/types/superagent-prefix/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for superagent-prefix 0.0 +// Project: https://github.com/johntron/superagent-prefix +// Definitions by: Michael Ledin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import * as request from 'superagent'; + +export default function(prefix: string): request.Plugin; diff --git a/types/superagent-prefix/superagent-prefix-tests.ts b/types/superagent-prefix/superagent-prefix-tests.ts new file mode 100644 index 0000000000..58101d8fda --- /dev/null +++ b/types/superagent-prefix/superagent-prefix-tests.ts @@ -0,0 +1,9 @@ +import * as request from 'superagent'; +import plugin from 'superagent-prefix'; + +request + .get('/some-url') + .use(plugin('/static')) + .end((err, res) => { + // Do something + }); diff --git a/types/superagent-prefix/tsconfig.json b/types/superagent-prefix/tsconfig.json new file mode 100644 index 0000000000..20c1d2c993 --- /dev/null +++ b/types/superagent-prefix/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "superagent-prefix-tests.ts" + ] +} diff --git a/types/superagent-prefix/tslint.json b/types/superagent-prefix/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/superagent-prefix/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index 628b4fd1f6..482c2d9e96 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -39,16 +39,6 @@ agent } }); -// Plugins -var prefix = require('superagent-prefix')('/static'); - -request - .get('/some-url') - .use(prefix) // Prefixes *only* this request - .end(function (err, res) { - // Do something - }); - var callback = (err: any, res: request.Response) => { }; From 7419b3c13a7a1f9ac0614c1c9aa22cdeece79414 Mon Sep 17 00:00:00 2001 From: Michael Ledin Date: Fri, 2 Jun 2017 22:19:10 +0300 Subject: [PATCH 015/286] Update definitions for superagent: - update version to 2.3 - fix tslint errors - update to typescript 2.2 --- types/promisify-supertest/index.d.ts | 2 +- types/simple-cw-node/index.d.ts | 2 +- types/superagent/index.d.ts | 29 ++++++----- types/superagent/superagent-tests.ts | 72 ++++++++++++++-------------- types/superagent/tslint.json | 1 + types/supertest/index.d.ts | 1 + 6 files changed, 53 insertions(+), 54 deletions(-) create mode 100644 types/superagent/tslint.json diff --git a/types/promisify-supertest/index.d.ts b/types/promisify-supertest/index.d.ts index 5c0ea6251a..9f59afdb89 100644 --- a/types/promisify-supertest/index.d.ts +++ b/types/promisify-supertest/index.d.ts @@ -2,7 +2,7 @@ // Project: https://www.npmjs.com/package/promisify-supertest // Definitions by: Leo Liang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +// TypeScript Version: 2.2 // Mostly copy-pasted from supertest.d.ts diff --git a/types/simple-cw-node/index.d.ts b/types/simple-cw-node/index.d.ts index c73394e4b0..66aace5ddb 100644 --- a/types/simple-cw-node/index.d.ts +++ b/types/simple-cw-node/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/astronaughts/simple-cw-node // Definitions by: vvakame // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - +// TypeScript Version: 2.2 import superagent = require("superagent"); // TODO 1. update superagent with generics diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index 0a028e015b..f598bbd4fe 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -1,22 +1,23 @@ -// Type definitions for SuperAgent v2.0.1 +// Type definitions for SuperAgent 2.3 // Project: https://github.com/visionmedia/superagent // Definitions by: Alex Varju // Nico Zelaya +// Michael Ledin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// -import stream = require('stream'); -import https = require('https'); +import * as stream from 'stream'; +import * as https from 'https'; type CallbackHandler = (err: any, res: request.Response) => void; -declare var request: request.SuperAgentStatic; +declare const request: request.SuperAgentStatic; declare namespace request { interface SuperAgentRequest extends Request { - agent(agent: https.Agent): this; - agent(): this; + agent(agent?: https.Agent): this; method: string; url: string; @@ -24,6 +25,7 @@ declare namespace request { } interface SuperAgentStatic extends SuperAgent { (url: string): SuperAgentRequest; + // tslint:disable-next-line:unified-signatures (method: string, url: string): SuperAgentRequest; agent(): SuperAgent; @@ -99,25 +101,22 @@ declare namespace request { end(callback?: CallbackHandler): this; field(name: string, val: string): this; get(field: string): string; - on(name: string, handler: Function): this; + on(name: string, handler: (event: any) => void): this; on(name: 'error', handler: (err: any) => void): this; part(): this; - pipe(stream: NodeJS.WritableStream, options?: Object): stream.Writable; - query(val: Object): this; + pipe(stream: NodeJS.WritableStream, options?: object): stream.Writable; + query(val: object | string): this; redirects(n: number): this; responseType(type: string): this; - send(data: string): this; - send(data: Object): this; - send(): this; + send(data?: string | object): this; set(field: string, val: string): this; - set(field: Object): this; + set(field: object): this; timeout(ms: number): this; type(val: string): this; unset(field: string): this; use(fn: Plugin): this; withCredentials(): this; - write(data: string, encoding?: string): this; - write(data: Buffer, encoding?: string): this; + write(data: string | Buffer, encoding?: string): this; parse(fn: (res: Response, callback: (err: Error | null, body: any) => void) => void): this; } diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index 482c2d9e96..0ad9c302fc 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -1,10 +1,9 @@ // via: http://visionmedia.github.io/superagent/ -import * as request from 'superagent' -import * as fs from 'fs' -import * as assert from 'assert' -import {Agent} from 'https' - +import * as request from 'superagent'; +import * as fs from 'fs'; +import * as assert from 'assert'; +import { Agent } from 'https'; // Examples taken from https://github.com/visionmedia/superagent/blob/gh-pages/docs/index.md // and https://github.com/visionmedia/superagent/blob/master/Readme.md @@ -25,7 +24,7 @@ request } }); -var agent = request.agent(); +const agent = request.agent(); agent .post('/api/pet') .send({name: 'Manny', species: 'cat'}) @@ -39,8 +38,7 @@ agent } }); -var callback = (err: any, res: request.Response) => { -}; +const callback = (err: any, res: request.Response) => {}; // Request basics request @@ -175,15 +173,15 @@ request // Parsing response bodies request('/search') - .end((res: request.Response) => { - var status: number = res.status; - var body = res.body; - var files: Object = res.files; - var text: string = res.text; - var contentLength = res.header['content-length']; - var contentType: string = res.type; - var charset: string = res.charset; - }); + .end((res: request.Response) => { + const status: number = res.status; + const body = res.body; + const files: object = res.files; + const text: string = res.text; + const contentLength = res.header['content-length']; + const contentType: string = res.type; + const charset: string = res.charset; + }); // Custom parsers request @@ -203,7 +201,7 @@ request res.body.toString("hex"); }); -var req = request.get('/hoge'); +const req = request.get('/hoge'); // Aborting requests req.abort(); @@ -231,23 +229,23 @@ request // Piping data /* - (function() { - var stream = fs.createReadStream('path/to/my.json'); - var req = request.post('/somewhere'); - req.type('json'); - stream.pipe(req); - })(); - */ +(() => { +const stream = fs.createReadStream('path/to/my.json'); +const req = request.post('/somewhere'); +req.type('json'); +stream.pipe(req); +})(); +*/ -(function () { - var stream = fs.createWriteStream('path/to/my.json'); - var req = request.get('/some.json'); +(() => { + const stream = fs.createWriteStream('path/to/my.json'); + const req = request.get('/some.json'); req.pipe(stream); })(); // Multipart requests -(function () { - var req = request.post('/upload'); +(() => { + const req = request.post('/upload'); req.part() .set('Content-Type', 'image/png') @@ -298,7 +296,7 @@ request }) .end(callback); -//Promise +// Promise request .get('/search') .then((response) => { @@ -308,9 +306,9 @@ request // Requesting binary data. // adapted from: https://github.com/visionmedia/superagent/blob/v2.0.0/test/client/request.js#L110 request - .get('/blob') - .responseType('blob') - .end(function (err, res) { - assert(res.xhr instanceof XMLHttpRequest) - assert(res.xhr.response instanceof Blob); - }); + .get('/blob') + .responseType('blob') + .end((err, res) => { + assert(res.xhr instanceof XMLHttpRequest); + assert(res.xhr.response instanceof Blob); + }); diff --git a/types/superagent/tslint.json b/types/superagent/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/superagent/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/supertest/index.d.ts b/types/supertest/index.d.ts index f3866469e3..206c70defd 100644 --- a/types/supertest/index.d.ts +++ b/types/supertest/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/visionmedia/supertest // Definitions by: Alex Varju // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import * as superagent from "superagent" From 3863bbf41574d7e9ccf43f29ce6c031d00450a0a Mon Sep 17 00:00:00 2001 From: Michael Ledin Date: Fri, 2 Jun 2017 22:29:04 +0300 Subject: [PATCH 016/286] Add definitions for superagent 3.5. --- types/superagent/index.d.ts | 2 +- types/superagent/v2/index.d.ts | 126 ++++++++++ types/superagent/v2/superagent-tests.ts | 314 ++++++++++++++++++++++++ types/superagent/v2/tsconfig.json | 27 ++ types/superagent/v2/tslint.json | 1 + 5 files changed, 469 insertions(+), 1 deletion(-) create mode 100644 types/superagent/v2/index.d.ts create mode 100644 types/superagent/v2/superagent-tests.ts create mode 100644 types/superagent/v2/tsconfig.json create mode 100644 types/superagent/v2/tslint.json diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index f598bbd4fe..97ce3a6600 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for SuperAgent 2.3 +// Type definitions for SuperAgent 3.5 // Project: https://github.com/visionmedia/superagent // Definitions by: Alex Varju // Nico Zelaya diff --git a/types/superagent/v2/index.d.ts b/types/superagent/v2/index.d.ts new file mode 100644 index 0000000000..f598bbd4fe --- /dev/null +++ b/types/superagent/v2/index.d.ts @@ -0,0 +1,126 @@ +// Type definitions for SuperAgent 2.3 +// Project: https://github.com/visionmedia/superagent +// Definitions by: Alex Varju +// Nico Zelaya +// Michael Ledin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +import * as stream from 'stream'; +import * as https from 'https'; + +type CallbackHandler = (err: any, res: request.Response) => void; + +declare const request: request.SuperAgentStatic; + +declare namespace request { + interface SuperAgentRequest extends Request { + agent(agent?: https.Agent): this; + + method: string; + url: string; + cookies: string; + } + interface SuperAgentStatic extends SuperAgent { + (url: string): SuperAgentRequest; + // tslint:disable-next-line:unified-signatures + (method: string, url: string): SuperAgentRequest; + + agent(): SuperAgent; + } + + interface SuperAgent extends stream.Stream { + get(url: string, callback?: CallbackHandler): Req; + post(url: string, callback?: CallbackHandler): Req; + put(url: string, callback?: CallbackHandler): Req; + head(url: string, callback?: CallbackHandler): Req; + del(url: string, callback?: CallbackHandler): Req; + delete(url: string, callback?: CallbackHandler): Req; + options(url: string, callback?: CallbackHandler): Req; + trace(url: string, callback?: CallbackHandler): Req; + copy(url: string, callback?: CallbackHandler): Req; + lock(url: string, callback?: CallbackHandler): Req; + mkcol(url: string, callback?: CallbackHandler): Req; + move(url: string, callback?: CallbackHandler): Req; + purge(url: string, callback?: CallbackHandler): Req; + propfind(url: string, callback?: CallbackHandler): Req; + proppatch(url: string, callback?: CallbackHandler): Req; + unlock(url: string, callback?: CallbackHandler): Req; + report(url: string, callback?: CallbackHandler): Req; + mkactivity(url: string, callback?: CallbackHandler): Req; + checkout(url: string, callback?: CallbackHandler): Req; + merge(url: string, callback?: CallbackHandler): Req; + // m-search(url: string, callback?: CallbackHandler): Req; + notify(url: string, callback?: CallbackHandler): Req; + subscribe(url: string, callback?: CallbackHandler): Req; + unsubscribe(url: string, callback?: CallbackHandler): Req; + patch(url: string, callback?: CallbackHandler): Req; + search(url: string, callback?: CallbackHandler): Req; + connect(url: string, callback?: CallbackHandler): Req; + + parse(fn: (res: Response, callback: (err: Error | null, body: any) => void) => void): this; + saveCookies(res: Response): void; + attachCookies(req: Req): void; + } + + interface Response extends NodeJS.ReadableStream { + text: string; + body: any; + files: any; + header: any; + type: string; + charset: string; + status: number; + statusType: number; + info: boolean; + ok: boolean; + redirect: boolean; + clientError: boolean; + serverError: boolean; + error: Error; + accepted: boolean; + noContent: boolean; + badRequest: boolean; + unauthorized: boolean; + notAcceptable: boolean; + notFound: boolean; + forbidden: boolean; + xhr: XMLHttpRequest; + get(header: string): string; + } + + interface Request extends Promise /* extends NodeJS.WritableStream */ { + abort(): void; + accept(type: string): this; + attach(field: string, file: string, filename?: string): this; + auth(user: string, name: string): this; + buffer(val?: boolean): this; + clearTimeout(): this; + end(callback?: CallbackHandler): this; + field(name: string, val: string): this; + get(field: string): string; + on(name: string, handler: (event: any) => void): this; + on(name: 'error', handler: (err: any) => void): this; + part(): this; + pipe(stream: NodeJS.WritableStream, options?: object): stream.Writable; + query(val: object | string): this; + redirects(n: number): this; + responseType(type: string): this; + send(data?: string | object): this; + set(field: string, val: string): this; + set(field: object): this; + timeout(ms: number): this; + type(val: string): this; + unset(field: string): this; + use(fn: Plugin): this; + withCredentials(): this; + write(data: string | Buffer, encoding?: string): this; + parse(fn: (res: Response, callback: (err: Error | null, body: any) => void) => void): this; + } + + type Plugin = (req: Request) => void; +} + +export = request; diff --git a/types/superagent/v2/superagent-tests.ts b/types/superagent/v2/superagent-tests.ts new file mode 100644 index 0000000000..0ad9c302fc --- /dev/null +++ b/types/superagent/v2/superagent-tests.ts @@ -0,0 +1,314 @@ +// via: http://visionmedia.github.io/superagent/ + +import * as request from 'superagent'; +import * as fs from 'fs'; +import * as assert from 'assert'; +import { Agent } from 'https'; + +// Examples taken from https://github.com/visionmedia/superagent/blob/gh-pages/docs/index.md +// and https://github.com/visionmedia/superagent/blob/master/Readme.md + +const httpsAgent: Agent = new Agent(); + +request + .post('/api/pet') + .send({name: 'Manny', species: 'cat'}) + .set('X-API-Key', 'foobar') + .set('Accept', 'application/json') + .agent(httpsAgent) + .end((err, res) => { + if (res.ok) { + console.log('yay got ' + JSON.stringify(res.body)); + } else { + console.log('Oh no! error ' + res.text); + } + }); + +const agent = request.agent(); +agent + .post('/api/pet') + .send({name: 'Manny', species: 'cat'}) + .set('X-API-Key', 'foobar') + .set('Accept', 'application/json') + .end((err, res) => { + if (res.error) { + console.log('oh no ' + res.error.message); + } else { + console.log('got ' + res.status + ' response'); + } + }); + +const callback = (err: any, res: request.Response) => {}; + +// Request basics +request + .get('/search') + .end(callback); + +request('GET', '/search') + .end(callback); + +request + .get('http://example.com/search') + .end(callback); + +request + .head('/favicon.ico') + .end(callback); + +request + .del('/user/1') + .end(callback); + +request + .delete('/user/1') + .end(callback); + +request + .delete('/user/1') + .send() + .end(callback); + +request('/search') + .end(callback); + +// Setting header fields +request + .get('/search') + .set('API-Key', 'foobar') + .set('Accept', 'application/json') + .end(callback); + +request + .get('/search') + .set({'API-Key': 'foobar', Accept: 'application/json'}) + .end(callback); + +// GET requests +request + .get('/search') + .query({query: 'Manny'}) + .query({range: '1..5'}) + .query({order: 'desc'}) + .end(callback); + +request + .get('/search') + .query({query: 'Manny', range: '1..5', order: 'desc'}) + .end(callback); + +request + .get('/querystring') + .query('search=Manny&range=1..5') + .end(callback); + +request + .get('/querystring') + .query('search=Manny') + .query('range=1..5') + .end(callback); + +// HEAD requests +request + .head('/users') + .query({email: 'joe@smith.com'}) + .end(callback); + +// POST / PUT requests +request.post('/user') + .set('Content-Type', 'application/json') + .send('{"name":"tj","pet":"tobi"}') + .end(callback); + +request.post('/user') + .send({name: 'tj', pet: 'tobi'}) + .end(callback); + +request.post('/user') + .send({name: 'tj'}) + .send({pet: 'tobi'}) + .end(callback); + +request.post('/user') + .send('name=tj') + .send('pet=tobi') + .end(callback); + +request.post('/user') + .type('form') + .send({name: 'tj'}) + .send({pet: 'tobi'}) + .end(callback); + +// Setting the Content-Type +request.post('/user') + .set('Content-Type', 'application/json'); + +request.post('/user') + .type('application/json'); + +request.post('/user') + .type('json'); + +request.post('/user') + .type('png'); + +// Setting Accept +request.get('/user') + .accept('application/json'); + +request.get('/user') + .accept('json'); + +request.get('/user') + .accept('png'); + +// Query strings +request + .post('/') + .query({format: 'json'}) + .query({dest: '/login'}) + .send({post: 'data', here: 'wahoo'}) + .end(callback); + +// Parsing response bodies +request('/search') + .end((res: request.Response) => { + const status: number = res.status; + const body = res.body; + const files: object = res.files; + const text: string = res.text; + const contentLength = res.header['content-length']; + const contentType: string = res.type; + const charset: string = res.charset; + }); + +// Custom parsers +request + .post('/search') + .parse((res, callback) => { + res.setEncoding("binary"); + let data = ""; + res.on("data", (chunk: string) => { + data += chunk; + }); + + res.on("end", () => { + callback(null, new Buffer(data, "base64")); + }); + }) + .end((res: request.Response) => { + res.body.toString("hex"); + }); + +const req = request.get('/hoge'); +// Aborting requests +req.abort(); + +// Request timeouts +req.timeout(100); + +const reqUrl: string = req.url; +const reqMethod: string = req.method; +const reqCookies: string = req.cookies; + +console.log(reqMethod + ' request to ' + reqUrl + ' cookies ' + reqCookies); + +// Basic authentication +request.get('http://tobi:learnboost@local').end(callback); +request + .get('http://local') + .auth('tobo', 'learnboost') + .end(callback); + +// Following redirects +request + .get('/some.png') + .redirects(2) + .end(callback); + +// Piping data +/* +(() => { +const stream = fs.createReadStream('path/to/my.json'); +const req = request.post('/somewhere'); +req.type('json'); +stream.pipe(req); +})(); +*/ + +(() => { + const stream = fs.createWriteStream('path/to/my.json'); + const req = request.get('/some.json'); + req.pipe(stream); +})(); + +// Multipart requests +(() => { + const req = request.post('/upload'); + + req.part() + .set('Content-Type', 'image/png') + .set('Content-Disposition', 'attachment; filename="myimage.png"') + .write('some image data') + .write('some more image data'); + + req.part() + .set('Content-Disposition', 'form-data; name="name"') + .set('Content-Type', 'text/plain') + .write('tobi'); + + req.end(callback); +})(); + +// Attaching files +request + .post('/upload') + .attach('avatar', 'path/to/tobi.png', 'user.png') + .attach('image', 'path/to/loki.png') + .attach('file', 'path/to/jane.png') + .end(callback); + +// Field values +request + .post('/upload') + .field('user[name]', 'Tobi') + .field('user[email]', 'tobi@learnboost.com') + .attach('image', 'path/to/tobi.png') + .end(callback); + +// CORS +request + .get('http://localhost:4001/') + .withCredentials() + .end(callback); + +// Error handling +request + .post('/upload') + .attach('image', 'path/to/tobi.png') + .end((err: any, res: request.Response): void => { + }); +request + .post('/upload') + .attach('image', 'path/to/tobi.png') + .on('error', (err: any) => { + }) + .end(callback); + +// Promise +request + .get('/search') + .then((response) => { + }) + .catch((error) => { + }); +// Requesting binary data. +// adapted from: https://github.com/visionmedia/superagent/blob/v2.0.0/test/client/request.js#L110 +request + .get('/blob') + .responseType('blob') + .end((err, res) => { + assert(res.xhr instanceof XMLHttpRequest); + assert(res.xhr.response instanceof Blob); + }); diff --git a/types/superagent/v2/tsconfig.json b/types/superagent/v2/tsconfig.json new file mode 100644 index 0000000000..9061d77842 --- /dev/null +++ b/types/superagent/v2/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "superagent": ["superagent/v2"], + "superagent/*": ["superagent/v2/*"] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "superagent-tests.ts" + ] +} diff --git a/types/superagent/v2/tslint.json b/types/superagent/v2/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/superagent/v2/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From df04a6e201b34f942f22f8a61d63df060aaf1e8c Mon Sep 17 00:00:00 2001 From: Michael Ledin Date: Fri, 2 Jun 2017 22:44:21 +0300 Subject: [PATCH 017/286] Add superagent request.on('progress', ...). --- types/superagent/index.d.ts | 8 ++++++++ types/superagent/superagent-tests.ts | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index 97ce3a6600..9c3706d574 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -103,6 +103,7 @@ declare namespace request { get(field: string): string; on(name: string, handler: (event: any) => void): this; on(name: 'error', handler: (err: any) => void): this; + on(name: 'progress', handler: (event: ProgressEvent) => void): this; part(): this; pipe(stream: NodeJS.WritableStream, options?: object): stream.Writable; query(val: object | string): this; @@ -121,6 +122,13 @@ declare namespace request { } type Plugin = (req: Request) => void; + + interface ProgressEvent { + direction: 'download' | 'upload'; + loaded: number; + percent?: number; + total?: number; + } } export = request; diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index 0ad9c302fc..9d0e5f0ac9 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -296,6 +296,20 @@ request }) .end(callback); +// Progress +request + .post('/upload') + .attach('image', 'path/to/tobi.png') + .on('progress', (progress: request.ProgressEvent) => { + if (progress.direction === 'download') { + } else if (progress.direction === 'upload') { + } + const loaded: number = progress.loaded; + const percent: number | undefined = progress.percent; + const total: number | undefined = progress.total; + }) + .end(callback); + // Promise request .get('/search') From eab5bd9833ef005d33bdc43c1731514c19406456 Mon Sep 17 00:00:00 2001 From: Michael Ledin Date: Fri, 2 Jun 2017 22:51:52 +0300 Subject: [PATCH 018/286] superagent - attach blobs to request. --- types/superagent/index.d.ts | 2 +- types/superagent/superagent-tests.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/superagent/index.d.ts b/types/superagent/index.d.ts index 9c3706d574..e02747ac5d 100644 --- a/types/superagent/index.d.ts +++ b/types/superagent/index.d.ts @@ -94,7 +94,7 @@ declare namespace request { interface Request extends Promise /* extends NodeJS.WritableStream */ { abort(): void; accept(type: string): this; - attach(field: string, file: string, filename?: string): this; + attach(field: string, file: string | Blob, filename?: string): this; auth(user: string, name: string): this; buffer(val?: boolean): this; clearTimeout(): this; diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index 9d0e5f0ac9..9e8dc0aa96 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -262,11 +262,13 @@ stream.pipe(req); })(); // Attaching files +const blob: Blob = new File([], 'thor.png'); request .post('/upload') .attach('avatar', 'path/to/tobi.png', 'user.png') .attach('image', 'path/to/loki.png') .attach('file', 'path/to/jane.png') + .attach('blob', blob) .end(callback); // Field values From eeef424526f1f1115482931b334aa74bd7111edd Mon Sep 17 00:00:00 2001 From: dyst5422 Date: Sat, 3 Jun 2017 09:10:23 -0700 Subject: [PATCH 019/286] Add animateTransform SVG element to JSX.IntrinsicElements The animateTransform SVG element was missing from JSX.IntrinsicElements. Like the SVG animate element, this will need to be refined when TypeScript's lib.dom.d.ts is updated to include SVGAnimateTransformElement. --- types/react/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 979870febb..49d1e0b435 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -2857,6 +2857,7 @@ declare global { svg: React.SVGProps; animate: React.SVGProps; // TODO: It is SVGAnimateElement but is not in TypeScript's lib.dom.d.ts for now. + animateTransform: React.SVGProps; // TODO: It is SVGAnimateTransformElement but is not in TypeScript's lib.dom.d.ts for now. circle: React.SVGProps; clipPath: React.SVGProps; defs: React.SVGProps; From cdf69c51e9a57b1b069b74727a0b4ef28d2d64f5 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sun, 4 Jun 2017 00:45:48 +0100 Subject: [PATCH 020/286] More types --- types/nodegit/annotated-commit.d.ts | 13 +++ types/nodegit/blob.d.ts | 20 ++++ types/nodegit/checkout-options.d.ts | 26 +++++ types/nodegit/commit.d.ts | 47 +++++++++ types/nodegit/diff-delta.d.ts | 10 ++ types/nodegit/diff-file.d.ts | 9 ++ types/nodegit/diff-perf-data.d.ts | 5 + types/nodegit/diff.d.ts | 154 ++++++++++++++++++++++++++++ types/nodegit/enums.d.ts | 41 ++++++++ types/nodegit/fetch-options.d.ts | 9 ++ types/nodegit/index-entry.d.ts | 21 ++++ types/nodegit/index.d.ts | 19 ++++ types/nodegit/index_.d.ts | 56 ++++++++++ types/nodegit/nodegit-tests.ts | 4 + types/nodegit/odb-object.d.ts | 10 ++ types/nodegit/odb.d.ts | 3 +- types/nodegit/reference.d.ts | 3 +- types/nodegit/remote-callbacks.d.ts | 8 ++ types/nodegit/remote.d.ts | 62 +++++++++++ types/nodegit/repository.d.ts | 43 +++++--- types/nodegit/str-array.d.ts | 6 ++ types/nodegit/tree-builder.d.ts | 16 +++ types/nodegit/tree-entry.d.ts | 30 ++++++ types/nodegit/tree.d.ts | 44 ++++++++ types/nodegit/tsconfig.json | 18 ++++ 25 files changed, 658 insertions(+), 19 deletions(-) create mode 100644 types/nodegit/annotated-commit.d.ts create mode 100644 types/nodegit/blob.d.ts create mode 100644 types/nodegit/checkout-options.d.ts create mode 100644 types/nodegit/commit.d.ts create mode 100644 types/nodegit/diff-delta.d.ts create mode 100644 types/nodegit/diff-file.d.ts create mode 100644 types/nodegit/diff-perf-data.d.ts create mode 100644 types/nodegit/diff.d.ts create mode 100644 types/nodegit/enums.d.ts create mode 100644 types/nodegit/fetch-options.d.ts create mode 100644 types/nodegit/index-entry.d.ts create mode 100644 types/nodegit/index_.d.ts create mode 100644 types/nodegit/odb-object.d.ts create mode 100644 types/nodegit/remote-callbacks.d.ts create mode 100644 types/nodegit/remote.d.ts create mode 100644 types/nodegit/str-array.d.ts create mode 100644 types/nodegit/tree-builder.d.ts create mode 100644 types/nodegit/tree-entry.d.ts create mode 100644 types/nodegit/tree.d.ts diff --git a/types/nodegit/annotated-commit.d.ts b/types/nodegit/annotated-commit.d.ts new file mode 100644 index 0000000000..f0f9d4d925 --- /dev/null +++ b/types/nodegit/annotated-commit.d.ts @@ -0,0 +1,13 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Reference } from './reference'; + +export class AnnotatedCommit { + static fromFetchhead(repo: Repository, branch_name: string, remote_url: string, id: Oid): Promise; + static fromRef(repo: Repository, ref: Reference): Promise; + static fromRevspec(repo: Repository, revspec: string): Promise; + static lookup(repo: Repository, id: Oid): Promise; + + free(): void; + id(): Oid; +} diff --git a/types/nodegit/blob.d.ts b/types/nodegit/blob.d.ts new file mode 100644 index 0000000000..32f020b0ce --- /dev/null +++ b/types/nodegit/blob.d.ts @@ -0,0 +1,20 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; + +export class Blob { + static createFromBuffer(repo: Repository, buffer: Buffer, len: number): Oid; + static createFromDisk(id: Oid, repo: Repository, path: string): number; + static createFromWorkdir(id: Oid, repo: Repository, relative_path: string): number; + static lookup(repo: Repository, id: string | Oid | Blob): Promise; + static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + + free(): void; + id(): Oid; + isBinary(): number; + owner(): Repository; + rawcontent(): Buffer; + rawsize(): number; + content(): Buffer; + toString(): string; + filemode(): number; +} diff --git a/types/nodegit/checkout-options.d.ts b/types/nodegit/checkout-options.d.ts new file mode 100644 index 0000000000..cd23a70ede --- /dev/null +++ b/types/nodegit/checkout-options.d.ts @@ -0,0 +1,26 @@ +import { Strarray } from './str-array'; +import { Tree } from './tree'; +import { Index } from './index'; + +export interface CheckoutOptions { + version?: number; + checkoutStrategy?: number; + disableFilters?: number; + dirMode?: number; + fileMode?: number; + fileOpenFlags?: number; + notifyFlags?: number; + notifyCb?: any; + notifyPayload?: void; + progressCb?: any; + progressPayload?: void; + paths?: Strarray; + baseline?: Tree; + baselineIndex?: Index; + targetDirectory?: string; + ancestorLabel?: string; + ourLabel?: string; + theirLabel?: string; + perfdataCb?: any; + perfdataPayload?: void; +} diff --git a/types/nodegit/commit.d.ts b/types/nodegit/commit.d.ts new file mode 100644 index 0000000000..3980ce080e --- /dev/null +++ b/types/nodegit/commit.d.ts @@ -0,0 +1,47 @@ +import { Repository } from './repository'; +import { Signature } from './signature'; +import { Oid } from './oid'; +import { Buf } from './buf'; +import { Object } from './object'; +import { Tree } from './tree'; +import { TreeEntry } from './tree-entry'; +import { Diff } from './diff'; + +export class Commit { + static create(repo: Repository, update_ref: string, author: Signature, committer: Signature, message_encoding: string, message: string, tree: Tree, parent_count: number, parents: any[]): Oid; + static createV(id: Oid, repo: Repository, update_ref: string, author: Signature, committer: Signature, message_encoding: string, message: string, tree: Tree, parent_count: number): number; + static lookup(repo: Repository, id: string | Oid | Commit): Promise; + static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + + amend(update_ref: string, author: Signature, committer: Signature, message_encoding: string, message: string, tree: Tree): Oid; + author(): Signature; + committer(): Signature; + free(): void; + headerField(field: string): Promise; + id(): Oid; + message(): string; + messageEncoding(): string; + messageRaw(): string; + nthGenAncestor(n: number): Promise; + owner(): Repository; + parent(n: number): Promise; + parentId(n: number): Oid; + parentcount(): number; + rawHeader(): string; + summary(): string; + time(): number; + timeOffset(): number; + tree(tree_out: Tree): number; + treeId(): Oid; + sha(): string; + timeMs(): number; + date(): Date; + getTree(): Promise; + getEntry(path: string): Promise; + history(): EventEmitter; + getParents(limit: number, callback: Function): Promise; + parents(callback: Function): Oid[]; + getDiff(callback: Function): Promise; + getDiffWithOptions(options: Object, callback: Function): Promise; + toString(): string; +} diff --git a/types/nodegit/diff-delta.d.ts b/types/nodegit/diff-delta.d.ts new file mode 100644 index 0000000000..c21d98f430 --- /dev/null +++ b/types/nodegit/diff-delta.d.ts @@ -0,0 +1,10 @@ +import { DiffFile } from './diff-file'; + +export class DiffDelta { + status: number; + flags: number; + similarity: number; + nfiles: number; + oldFile: DiffFile; + newFile: DiffFile; +} diff --git a/types/nodegit/diff-file.d.ts b/types/nodegit/diff-file.d.ts new file mode 100644 index 0000000000..99646ec08b --- /dev/null +++ b/types/nodegit/diff-file.d.ts @@ -0,0 +1,9 @@ +import { Oid } from './oid'; + +export class DiffFile { + flags(): number; + id(): Oid; + mode(): number; + path(): string; + size(): number; +} diff --git a/types/nodegit/diff-perf-data.d.ts b/types/nodegit/diff-perf-data.d.ts new file mode 100644 index 0000000000..5dfca09670 --- /dev/null +++ b/types/nodegit/diff-perf-data.d.ts @@ -0,0 +1,5 @@ +export class DiffPerfdata { + version: number; + statCalls: number; + oidCalculations: number; +} diff --git a/types/nodegit/diff.d.ts b/types/nodegit/diff.d.ts new file mode 100644 index 0000000000..ab3b3aa2c8 --- /dev/null +++ b/types/nodegit/diff.d.ts @@ -0,0 +1,154 @@ +import { Blob } from './blob'; +import { Repository } from './repository'; +import { Tree } from './tree'; +import { Strarray } from './str-array'; +import { Index } from './index_'; +import { DiffDelta } from './diff-delta'; +import { DiffPerfdata } from './diff-perf-data'; + +export interface DiffFindOptions { + version: number; + flags: number; + renameThreshold: number; + renameFromRewriteThreshold: number; + copyThreshold: number; + breakRewriteThreshold: number; + renameLimit: number; +} + +export interface DiffOptions { + version: number; + flags: number; + ignoreSubmodules: number; + pathspec: Strarray; + notifyCb: Function; + notifyPayload: void; + contextLines: number; + interhunkLines: number; + idAbbrev: number; + maxSize: number; + oldPrefix: string; + newPrefix: string; +} + +export namespace Diff { + enum DELTA { + UNMODIFIED = 0, + ADDED = 1, + DELETED = 2, + MODIFIED = 3, + RENAMED = 4, + COPIED = 5, + IGNORED = 6, + UNTRACKED = 7, + TYPECHANGE = 8, + UNREADABLE = 9, + CONFLICTED = 10 + } + + enum FIND { + BY_CONFIG = 0, + RENAMES = 1, + RENAMES_FROM_REWRITES = 2, + COPIES = 4, + COPIES_FROM_UNMODIFIED = 8, + REWRITES = 16, + BREAK_REWRITES = 32, + AND_BREAK_REWRITES = 48, + FOR_UNTRACKED = 64, + ALL = 255, + IGNORE_LEADING_WHITESPACE = 0, + IGNORE_WHITESPACE = 4096, + DONT_IGNORE_WHITESPACE = 8192, + EXACT_MATCH_ONLY = 16384, + BREAK_REWRITES_FOR_RENAMES_ONLY = 32768, + REMOVE_UNMODIFIED = 65536 + } + + enum FLAG { + BINARY = 1, + NOT_BINARY = 2, + VALID_ID = 4, + EXISTS = 8 + } + + enum FORMAT { + PATCH = 1, + PATCH_HEADER = 2, + RAW = 3, + NAME_ONLY = 4, + NAME_STATUS = 5 + } + + enum FORMAT_EMAIL_FLAGS { + FORMAT_EMAIL_NONE = 0, + FORMAT_EMAIL_EXCLUDE_SUBJECT_PATCH_MARKER = 1 + } + + enum LINE { + CONTEXT = 32, + ADDITION = 43, + DELETION = 45, + CONTEXT_EOFNL = 61, + ADD_EOFNL = 62, + DEL_EOFNL = 60, + FILE_HDR = 70, + HUNK_HDR = 72, + BINARY = 66 + } + + enum OPTION { + NORMAL = 0, + REVERSE = 1, + INCLUDE_IGNORED = 2, + RECURSE_IGNORED_DIRS = 4, + INCLUDE_UNTRACKED = 8, + RECURSE_UNTRACKED_DIRS = 16, + INCLUDE_UNMODIFIED = 32, + INCLUDE_TYPECHANGE = 64, + INCLUDE_TYPECHANGE_TREES = 128, + IGNORE_FILEMODE = 256, + IGNORE_SUBMODULES = 512, + IGNORE_CASE = 1024, + INCLUDE_CASECHANGE = 2048, + DISABLE_PATHSPEC_MATCH = 4096, + SKIP_BINARY_CHECK = 8192, + ENABLE_FAST_UNTRACKED_DIRS = 16384, + UPDATE_INDEX = 32768, + INCLUDE_UNREADABLE = 65536, + INCLUDE_UNREADABLE_AS_UNTRACKED = 131072, + FORCE_TEXT = 1048576, + FORCE_BINARY = 2097152, + IGNORE_WHITESPACE = 4194304, + IGNORE_WHITESPACE_CHANGE = 8388608, + IGNORE_WHITESPACE_EOL = 16777216, + SHOW_UNTRACKED_CONTENT = 33554432, + SHOW_UNMODIFIED = 67108864, + PATIENCE = 268435456, + MINIMAL = 536870912, + SHOW_BINARY = 1073741824 + } + + enum STATS_FORMAT { + STATS_NONE = 0, + STATS_FULL = 1, + STATS_SHORT = 2, + STATS_NUMBER = 4, + STATS_INCLUDE_SUMMARY = 8 + } +} + +export class Diff { + static blobToBuffer(old_blob: Blob, old_as_path: string, buffer: string, buffer_as_path: string, opts: DiffOptions, file_cb: Function, binary_cb: Function, hunk_cb: Function, line_cb: Function): Promise; + static indexToWorkdir(repo: Repository, index: Index, opts: DiffOptions): Promise; + static treeToIndex(repo: Repository, old_tree: Tree, index: Index, opts: DiffOptions): Promise; + static treeToTree(repo: Repository, old_tree: Tree, new_tree: Tree, opts: DiffOptions): Promise; + static treeToWorkdir(repo: Repository, old_tree: Tree, opts: DiffOptions): Promise; + static treeToWorkdirWithIndex(repo: Repository, old_tree: Tree, opts: DiffOptions): Promise; + + findSimilar(options: DiffFindOptions): Promise; + getDelta(idx: number): DiffDelta; + getPerfdata(): Promise; + numDeltas(): number; + patches(): Promise; +} diff --git a/types/nodegit/enums.d.ts b/types/nodegit/enums.d.ts new file mode 100644 index 0000000000..850979ac51 --- /dev/null +++ b/types/nodegit/enums.d.ts @@ -0,0 +1,41 @@ +export namespace Enums { + enum CVAR { + FALSE = 0, + TRUE = 1, + INT32 = 2, + string = 3 + } + + enum DIRECTION { + FETCH = 0, + PUSH = 1 + } + + enum FEATURE { + THREADS = 1, + HTTPS = 2, + SSH = 4 + } + + enum IDXENTRY_EXTENDED_FLAG { + IDXENTRY_INTENT_TO_ADD = 8192, + IDXENTRY_SKIP_WORKTREE = 16384, + IDXENTRY_EXTENDED2 = 32768, + S = 24576, + IDXENTRY_UPDATE = 1, + IDXENTRY_REMOVE = 2, + IDXENTRY_UPTODATE = 4, + IDXENTRY_ADDED = 8, + IDXENTRY_HASHED = 16, + IDXENTRY_UNHASHED = 32, + IDXENTRY_WT_REMOVE = 64, + IDXENTRY_CONFLICTED = 128, + IDXENTRY_UNPACKED = 256, + IDXENTRY_NEW_SKIP_WORKTREE = 512 + } + + enum INDXENTRY_FLAG { + IDXENTRY_EXTENDED = 16384, + IDXENTRY_VALID = 32768 + } +} diff --git a/types/nodegit/fetch-options.d.ts b/types/nodegit/fetch-options.d.ts new file mode 100644 index 0000000000..1aa26fd974 --- /dev/null +++ b/types/nodegit/fetch-options.d.ts @@ -0,0 +1,9 @@ +import { RemoteCallbacks } from './remote-callbacks'; + +export interface FetchOptions { + version?: number; + callbacks?: RemoteCallbacks; + prune?: number; + updateFetchhead?: number; + downloadTags?: number; +} diff --git a/types/nodegit/index-entry.d.ts b/types/nodegit/index-entry.d.ts new file mode 100644 index 0000000000..a6591e37b9 --- /dev/null +++ b/types/nodegit/index-entry.d.ts @@ -0,0 +1,21 @@ +import { Oid } from './oid'; + +interface IndexTime { + seconds: number; + nanoseconds: number; +} + +export interface IndexEntry { + ctime: IndexTime; + mtime: IndexTime; + dev: number; + ino: number; + mode: number; + uid: number; + gid: number; + fileSize: number; + id: Oid; + flags: number; + flagsExtended: number; + path: string; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 77d7003e05..92307a1abb 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -3,11 +3,30 @@ // Definitions by: Dolan Miu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +export { AnnotatedCommit } from './annotated-commit'; +export { Blob } from './blob'; export { Buf } from './buf'; +export { CheckoutOptions } from './checkout-options'; +export { Commit } from './commit'; +export { DiffDelta } from './diff-delta'; +export { DiffFile } from './diff-file'; +export { DiffPerfdata } from './diff-perf-data'; +export { Diff } from './diff'; +export { Enums } from './enums'; +export { FetchOptions } from './fetch-options'; +export { IndexEntry } from './index-entry'; +export { Index } from './index_'; export { Object } from './object'; +export { OdbObject } from './odb-object'; export { Odb } from './odb'; export { Oid } from './oid'; export { Reference } from './reference'; +export { RemoteCallbacks } from './remote-callbacks'; +export { Remote } from './remote'; export { Repository } from './repository'; export { Signature } from './signature'; +export { Strarray } from './str-array'; export { Time } from './time'; +export { Treebuilder } from './tree-builder'; +export { TreeEntry } from './tree-entry'; +export { Tree } from './tree'; diff --git a/types/nodegit/index_.d.ts b/types/nodegit/index_.d.ts new file mode 100644 index 0000000000..9902b53d35 --- /dev/null +++ b/types/nodegit/index_.d.ts @@ -0,0 +1,56 @@ +import { Oid } from './oid'; +import { IndexEntry } from './index-entry'; +import { Repository } from './repository'; +import { Tree } from './tree'; +import { Strarray } from './str-array'; + +export namespace Index { + enum ADD_OPTION { + ADD_DEFAULT = 0, + ADD_FORCE = 1, + ADD_DISABLE_PATHSPEC_MATCH = 2, + ADD_CHECK_PATHSPEC = 4 + } + + enum CAP { + IGNORE_CASE = 1, + NO_FILEMODE = 2, + NO_SYMLINKS = 4, + FROM_OWNER = -1 + } +} + +export class Index { + static entryIsConflict(entry: IndexEntry): number; + static entryStage(entry: IndexEntry): number; + static open(index_path: string): Promise; + + add(source_entry: IndexEntry): number; + addAll(pathspec: Strarray, flags: number, callback: Function, payload: void): Promise; + addByPath(path: string): number; + caps(): number; + checksum(): Oid; + clear(): number; + conflictAdd(ancestor_entry: IndexEntry, our_entry: IndexEntry, their_entry: IndexEntry): number; + conflictCleanup(): number; + conflictGet(path: string): Promise; + conflictRemove(path: string): number; + entryCount(): number; + getByIndex(n: number): IndexEntry; + getByPath(path: string, stage: number): IndexEntry; + hasConflicts(): number; + owner(): Repository; + path(): string; + read(force: number): number; + readTree(tree: Tree): number; + remove(path: string, stage: number): number; + removeAll(pathspec: Strarray, callback: Function, payload: void): Promise; + removeByPath(path: string): number; + removeDirectory(dir: string, stage: number): number; + setCaps(caps: number): number; + updateAll(pathspec: Strarray, callback: Function, payload: void): Promise; + write(): number; + writeTree(): Promise; + writeTreeTo(repo: Repository): Promise; + entries(): IndexEntry[]; +} diff --git a/types/nodegit/nodegit-tests.ts b/types/nodegit/nodegit-tests.ts index b7fa54b0c1..c4c57854b7 100644 --- a/types/nodegit/nodegit-tests.ts +++ b/types/nodegit/nodegit-tests.ts @@ -3,3 +3,7 @@ import * as Git from 'nodegit'; Git.Repository.discover("startPath", 1, "ceilingDirs").then((string) => { // Use string }); + +Git.Repository.init("path", true).then((repository) => { + // Use repository +}); diff --git a/types/nodegit/odb-object.d.ts b/types/nodegit/odb-object.d.ts new file mode 100644 index 0000000000..361e8c0718 --- /dev/null +++ b/types/nodegit/odb-object.d.ts @@ -0,0 +1,10 @@ +import { Oid } from './oid'; + +export class OdbObject { + data(): Buffer; + dup(): Promise; + free(): void; + id(): Oid; + size(): number; + type(): number; +} diff --git a/types/nodegit/odb.d.ts b/types/nodegit/odb.d.ts index acacda8b73..f43f1673db 100644 --- a/types/nodegit/odb.d.ts +++ b/types/nodegit/odb.d.ts @@ -1,4 +1,5 @@ import { Oid } from './oid'; +import { OdbObject } from './odb-object'; export namespace Odb { enum STREAM { @@ -13,6 +14,6 @@ export class Odb { addDiskAlternate(path: string): number; free(): void; - read(id: Oid): Promise; + read(id: Oid): Promise; write(data: Buffer, len: number, type: number): Promise; } diff --git a/types/nodegit/reference.d.ts b/types/nodegit/reference.d.ts index 92e3e546b2..e2148f6a07 100644 --- a/types/nodegit/reference.d.ts +++ b/types/nodegit/reference.d.ts @@ -1,5 +1,6 @@ import { Repository } from './repository'; import { Oid } from './oid'; +import { Object } from './object'; export namespace Reference { enum TYPE { @@ -40,7 +41,7 @@ export class Reference { isTag(): number; name(): string; owner(): Repository; - peel(type: number): Promise; + peel(type: number): Promise; rename(newName: string, force: number, logMessage: string): Promise; resolve(): Promise; setTarget(id: Oid, logMessage: string): Promise; diff --git a/types/nodegit/remote-callbacks.d.ts b/types/nodegit/remote-callbacks.d.ts new file mode 100644 index 0000000000..0987b6259f --- /dev/null +++ b/types/nodegit/remote-callbacks.d.ts @@ -0,0 +1,8 @@ +export interface RemoteCallbacks { + version?: number; + credentials?: Function; + certificateCheck?: Function; + transferProgress?: Function; + transport?: Function; + payload?: void; +} diff --git a/types/nodegit/remote.d.ts b/types/nodegit/remote.d.ts new file mode 100644 index 0000000000..3fc10534d4 --- /dev/null +++ b/types/nodegit/remote.d.ts @@ -0,0 +1,62 @@ +import { Repository } from './repository'; +import { RemoteCallbacks } from './remote-callbacks'; +import { Strarray } from './str-array'; +import { FetchOptions } from './fetch-options'; +import { Buf } from './buf'; +import { Enums } from './enums'; + +export namespace Remote { + enum AUTOTAG_OPTION { + DOWNLOAD_TAGS_UNSPECIFIED = 0, + DOWNLOAD_TAGS_AUTO = 1, + DOWNLOAD_TAGS_NONE = 2, + DOWNLOAD_TAGS_ALL = 3 + } + + enum COMPLETION_TYPE { + COMPLETION_DOWNLOAD = 0, + COMPLETION_INDEXING = 1, + COMPLETION_ERROR = 2 + } +} + +export class Remote { + static addFetch(repo: Repository, remote: string, refspec: string): number; + static addPush(repo: Repository, remote: string, refspec: string): number; + static create(repo: Repository, name: string, url: string): Remote; + static createAnonymous(repo: Repository, url: string): Promise; + static createWithFetchspec(repo: Repository, name: string, url: string, fetch: string): Promise; + static delete(repo: Repository, name: string): Promise; + static initCallbacks(opts: RemoteCallbacks, version: number): number; + static isValidName(remote_name: string): number; + static list(repo: Repository): Promise; + static lookup(repo: Repository, name: string | Remote, callback: Function): Promise; + static setAutotag(repo: Repository, remote: string, value: number): number; + static setPushurl(repo: Repository, remote: string, url: string): number; + static setUrl(repo: Repository, remote: string, url: string): number; + + autotag(): number; + connect(direction: Enums.DIRECTION, callbacks: RemoteCallbacks, callback: Function): Promise; + connected(): number; + defaultBranch(): Promise; + disconnect(): Promise; + download(refSpecs: any[], opts: FetchOptions, callback: Function): Promise; + dup(): Promise; + fetch(refSpecs: any[], opts: FetchOptions, message: string, callback: Function): Promise; + free(): void; + getFetchRefspecs(): Promise; + getPushRefspecs(): Promise; + getRefspec(n: number): Refspec; + name(): string; + owner(): Repository; + prune(callbacks: RemoteCallbacks): number; + pruneRefs(): number; + push(refSpecs: any[], options: PushOptions, callback: Function): Promise; + pushurl(): string; + refspecCount(): number; + stats(): TransferProgress; + stop(): void; + updateTips(callbacks: RemoteCallbacks, update_fetchhead: number, download_tags: number, reflog_message: string): number; + upload(refspecs: Strarray, opts: PushOptions): number; + url(): string; +} diff --git a/types/nodegit/repository.d.ts b/types/nodegit/repository.d.ts index f32ca65c60..e18984bbcb 100644 --- a/types/nodegit/repository.d.ts +++ b/types/nodegit/repository.d.ts @@ -3,6 +3,15 @@ import { Buf } from './buf'; import { Reference } from './reference'; import { Odb } from './odb'; import { Object } from './object'; +import { Index } from './index_'; +import { Commit } from './commit'; +import { Blob } from './blob'; +import { Tree } from './tree'; +import { Signature } from './signature'; +import { AnnotatedCommit } from './annotated-commit'; +import { FetchOptions } from './fetch-options'; +import { CheckoutOptions } from './checkout-options'; +import { Remote } from './remote'; interface RepositoryInitOptions { description: string, @@ -84,7 +93,7 @@ export class Repository { head(): Promise; headDetached(): number; headUnborn(): number; - index(): Promise; + index(): Promise; isBare(): number; isEmpty(): number; isShallow(): number; @@ -95,44 +104,44 @@ export class Repository { refdb(): Promise; setHead(refname: string): Promise; setHeadDetached(commitish: Oid): number; - setHeadDetachedFromAnnotated(commitish: NodeGit.AnnotatedCommit): number; + setHeadDetachedFromAnnotated(commitish: AnnotatedCommit): number; setIdent(name: string, email: string): number; setNamespace(nmspace: string): number; setWorkdir(workdir: string, update_gitlink: number): number; state(): number; stateCleanup(): number; workdir(): string; - createBranch(name: string, commit: NodeGit.Commit | string | Oid, force: boolean, signature: NodeGit.Signature, logMessage: string): Promise; - getReferenceCommit(name: string | Reference): Promise; + createBranch(name: string, commit: Commit | string | Oid, force: boolean, signature: Signature, logMessage: string): Promise; + getReferenceCommit(name: string | Reference): Promise; getBranch(name: string | Reference): Promise; - getBranchCommit(name: string | Reference): Promise; + getBranchCommit(name: string | Reference): Promise; getCurrentBranch(): Promise; getReference(name: string | Reference): Promise; getReferences(type: Reference.TYPE): Promise; getReferenceNames(type: Reference.TYPE): Promise; - getCommit(string: string | Oid): Promise; - getBlob(string: string | Oid): Promise; - getTree(string: string | Oid): Promise; + getCommit(string: string | Oid): Promise; + getBlob(string: string | Oid): Promise; + getTree(string: string | Oid): Promise; createTag(string: string | Oid, name: string, message: string): Promise; createLightweightTag(string: string | Oid, name: string): Promise; getTag(string: string | Oid): Promise; getTagByName(Short: string): Promise; deleteTagByName(Short: string): Promise; createRevWalk(string: string | Oid): any; - getMasterCommit(): Promise; - getHeadCommit(): Promise; - createCommit(updateRef: string, author: NodeGit.Signature, committer: NodeGit.Signature, message: string, Tree: NodeGit.Tree | Oid | string, parents: any[]): Promise; - createCommitOnHead(filesToAdd: any[], author: NodeGit.Signature, committer: NodeGit.Signature, message: string): Promise; + getMasterCommit(): Promise; + getHeadCommit(): Promise; + createCommit(updateRef: string, author: Signature, committer: Signature, message: string, Tree: Tree | Oid | string, parents: any[]): Promise; + createCommitOnHead(filesToAdd: any[], author: Signature, committer: Signature, message: string): Promise; createBlobFromBuffer(buffer: Buffer): Oid; - treeBuilder(tree: NodeGit.Tree): any; + treeBuilder(tree: Tree): any; defaultSignature(): Signature; getRemotes(Optional: Function): Promise; - getRemote(remote: string | Remote, callback: Function): Promise; + getRemote(remote: string | Remote, callback: Function): Promise; fetch(remote: string | Remote, fetchOptions: Object | FetchOptions): Promise; fetchAll(fetchOptions: Object | FetchOptions, callback: Function): Promise; - mergeBranches(to: string | Reference, from: string | Reference, signature: NodeGit.Signature, mergePreference: NodeGit.Merge.PREFERENCE, mergeOptions: NodeGit.MergeOptions): Promise; - rebaseBranches(branch: string, upstream: string, onto: string, signature: NodeGit.Signature, beforeNextFn: Function): Promise; - continueRebase(signature: NodeGit.Signature, beforeNextFn: Function): Promise; + mergeBranches(to: string | Reference, from: string | Reference, signature: Signature, mergePreference: NodeGit.Merge.PREFERENCE, mergeOptions: NodeGit.MergeOptions): Promise; + rebaseBranches(branch: string, upstream: string, onto: string, signature: Signature, beforeNextFn: Function): Promise; + continueRebase(signature: Signature, beforeNextFn: Function): Promise; getStatus(opts: any): Promise; getStatusExt(opts: any): Promise; getSubmoduleNames(): Promise; diff --git a/types/nodegit/str-array.d.ts b/types/nodegit/str-array.d.ts new file mode 100644 index 0000000000..fc400448f2 --- /dev/null +++ b/types/nodegit/str-array.d.ts @@ -0,0 +1,6 @@ +export class Strarray { + copy(src: Strarray): number; + free(): void; + strings: string; + count: number; +} diff --git a/types/nodegit/tree-builder.d.ts b/types/nodegit/tree-builder.d.ts new file mode 100644 index 0000000000..03d11db900 --- /dev/null +++ b/types/nodegit/tree-builder.d.ts @@ -0,0 +1,16 @@ +import { Oid } from './oid'; +import { Repository } from './repository'; +import { Tree } from './tree'; +import { TreeEntry } from './tree-entry'; + +export class Treebuilder { + static create(repo: Repository, source: Tree): Promise; + + clear(): void; + entrycount(): number; + free(): void; + get(filename: string): TreeEntry; + insert(filename: string, id: Oid, filemode: number): Promise; + remove(filename: string): number; + write(): Oid; +} diff --git a/types/nodegit/tree-entry.d.ts b/types/nodegit/tree-entry.d.ts new file mode 100644 index 0000000000..8d1b5d553e --- /dev/null +++ b/types/nodegit/tree-entry.d.ts @@ -0,0 +1,30 @@ +import { Tree } from './tree'; +import { Oid } from './oid'; +import { Blob } from './blob'; + +export namespace TreeEntry { + enum FILEMODE { + UNREADABLE = 0, + TREE = 16384, + BLOB = 33188, + EXECUTABLE = 33261, + LINK = 40960, + COMMIT = 57344 + } +} + +export class TreeEntry { + isFile(): Boolean; + isTree(): Boolean; + isDirectory(): Boolean; + isBlob(): Boolean; + sha(): string; + getTree(): Promise; + getBlob(): Promise; + path(): string; + toString(): string; + attr: number; + oid: Oid; + filenameLen: number; + filename: string; +} diff --git a/types/nodegit/tree.d.ts b/types/nodegit/tree.d.ts new file mode 100644 index 0000000000..b9ac62f9e2 --- /dev/null +++ b/types/nodegit/tree.d.ts @@ -0,0 +1,44 @@ +import { Oid } from './oid'; +import { TreeEntry } from './tree-entry'; +import { Repository } from './repository'; +import { Object } from './object'; +import { Treebuilder } from './tree-builder'; +import { DiffFile } from './diff-file'; + +export namespace Tree { + enum WALK_MODE { + WALK_PRE = 0, + WALK_POST = 1 + } +} + +export class Tree { + static entryCmp(e1: TreeEntry, e2: TreeEntry): number; + static entryDup(dest: TreeEntry, source: TreeEntry): number; + static entryFilemode(entry: TreeEntry): number; + static entryFilemodeRaw(entry: TreeEntry): number; + static entryFree(entry: TreeEntry): void; + static entryId(entry: TreeEntry): Oid; + static entryName(entry: TreeEntry): string; + static entryToObject(object_out: Object, repo: Repository, entry: TreeEntry): number; + static entryType(entry: TreeEntry): number; + static lookup(repo: Repository, id: string | Oid | Tree, callback: Function): Promise; + static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + + entryById(id: Oid): TreeEntry; + _entryByIndex(idx: number): TreeEntry; + entryByName(name: string): TreeEntry; + entryByPath(path: string): Promise; + entryCount(): number; + free(): void; + id(): Oid; + owner(): Repository; + diff(tree: Tree, callback: Function): Promise; + diffWithOptions(tree: Tree, options: Object, callback: Function): Promise; + entryByIndex(i: number): TreeEntry; + getEntry(filePath: string): TreeEntry; + entries(): TreeEntry[]; + walk(blobsOnly?: Boolean): NodeJS.EventEmitter; + path(): string; + builder(): Treebuilder; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 471d7919cd..eec4787935 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -16,15 +16,33 @@ "forceConsistentCasingInFileNames": true }, "files": [ + "annotated-commit.d.ts", + "blob.d.ts", "buf.d.ts", + "checkout-options.d.ts", + "commit.d.ts", + "diff-delta.d.ts", + "diff-file.d.ts", + "diff-perf-data.d.ts", + "diff.d.ts", + "enums.d.ts", + "fetch-options.d.ts", + "index-entry.d.ts", "index.d.ts", "nodegit-tests.ts", "object.d.ts", + "odb-object.d.ts", "odb.d.ts", "oid.d.ts", "reference.d.ts", + "remote-callbacks.d.ts", + "remote.d.ts", "repository.d.ts", "signature.d.ts", + "str-array.d.ts", "time.d.ts", + "tree-builder.d.ts", + "tree-entry.d.ts", + "tree.d.ts" ] } From dd5dc38dec7b349456af6a5604a88cbca23a5b3c Mon Sep 17 00:00:00 2001 From: Dolan Date: Sun, 4 Jun 2017 02:39:34 +0100 Subject: [PATCH 021/286] Added more files --- types/nodegit/checkout-options.d.ts | 6 +-- types/nodegit/commit.d.ts | 2 + types/nodegit/config.d.ts | 22 +++++++++++ types/nodegit/diff.d.ts | 5 ++- types/nodegit/index-entry.d.ts | 2 +- types/nodegit/index.d.ts | 12 +++++- types/nodegit/merge-file-input.d.ts | 7 ++++ types/nodegit/merge-options.d.ts | 8 ++++ types/nodegit/merge.d.ts | 59 ++++++++++++++++++++++++++++ types/nodegit/oid-array.d.ts | 7 ++++ types/nodegit/push-options.d.ts | 7 ++++ types/nodegit/ref-db.d.ts | 8 ++++ types/nodegit/ref-spec.d.ts | 8 ++++ types/nodegit/remote-callbacks.d.ts | 4 +- types/nodegit/remote.d.ts | 3 ++ types/nodegit/repository.d.ts | 38 ++++++++++-------- types/nodegit/tag.d.ts | 27 +++++++++++++ types/nodegit/transfer-progress.d.ts | 9 +++++ types/nodegit/tsconfig.json | 10 +++++ 19 files changed, 218 insertions(+), 26 deletions(-) create mode 100644 types/nodegit/config.d.ts create mode 100644 types/nodegit/merge-file-input.d.ts create mode 100644 types/nodegit/merge-options.d.ts create mode 100644 types/nodegit/merge.d.ts create mode 100644 types/nodegit/oid-array.d.ts create mode 100644 types/nodegit/push-options.d.ts create mode 100644 types/nodegit/ref-db.d.ts create mode 100644 types/nodegit/ref-spec.d.ts create mode 100644 types/nodegit/tag.d.ts create mode 100644 types/nodegit/transfer-progress.d.ts diff --git a/types/nodegit/checkout-options.d.ts b/types/nodegit/checkout-options.d.ts index cd23a70ede..c799ce2047 100644 --- a/types/nodegit/checkout-options.d.ts +++ b/types/nodegit/checkout-options.d.ts @@ -11,9 +11,9 @@ export interface CheckoutOptions { fileOpenFlags?: number; notifyFlags?: number; notifyCb?: any; - notifyPayload?: void; + notifyPayload?: undefined; progressCb?: any; - progressPayload?: void; + progressPayload?: undefined; paths?: Strarray; baseline?: Tree; baselineIndex?: Index; @@ -22,5 +22,5 @@ export interface CheckoutOptions { ourLabel?: string; theirLabel?: string; perfdataCb?: any; - perfdataPayload?: void; + perfdataPayload?: undefined; } diff --git a/types/nodegit/commit.d.ts b/types/nodegit/commit.d.ts index 3980ce080e..24ee08cc48 100644 --- a/types/nodegit/commit.d.ts +++ b/types/nodegit/commit.d.ts @@ -1,3 +1,5 @@ +import { EventEmitter } from 'events'; + import { Repository } from './repository'; import { Signature } from './signature'; import { Oid } from './oid'; diff --git a/types/nodegit/config.d.ts b/types/nodegit/config.d.ts new file mode 100644 index 0000000000..ad8df1a327 --- /dev/null +++ b/types/nodegit/config.d.ts @@ -0,0 +1,22 @@ +import { Buf } from './buf'; + +export namespace Config { + enum LEVEL { + SYSTEM = 1, + XDG = 2, + GLOBAL = 3, + LOCAL = 4, + APP = 5, + HIGHEST_LEVEL = -1 + } +} + +export class Config { + static openDefault(): Promise; + + getStringBuf(name: string): Promise; + setInt64(name: string, value: number): number; + setMultivar(name: string, regexp: string, value: string): number; + setString(name: string, value: string): Promise; + snapshot(): Promise; +} diff --git a/types/nodegit/diff.d.ts b/types/nodegit/diff.d.ts index ab3b3aa2c8..d8b60e1c6a 100644 --- a/types/nodegit/diff.d.ts +++ b/types/nodegit/diff.d.ts @@ -22,7 +22,7 @@ export interface DiffOptions { ignoreSubmodules: number; pathspec: Strarray; notifyCb: Function; - notifyPayload: void; + notifyPayload: undefined; contextLines: number; interhunkLines: number; idAbbrev: number; @@ -139,7 +139,8 @@ export namespace Diff { } export class Diff { - static blobToBuffer(old_blob: Blob, old_as_path: string, buffer: string, buffer_as_path: string, opts: DiffOptions, file_cb: Function, binary_cb: Function, hunk_cb: Function, line_cb: Function): Promise; + static blobToBuffer(old_blob: Blob, oldAsPath: string, + buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; static indexToWorkdir(repo: Repository, index: Index, opts: DiffOptions): Promise; static treeToIndex(repo: Repository, old_tree: Tree, index: Index, opts: DiffOptions): Promise; static treeToTree(repo: Repository, old_tree: Tree, new_tree: Tree, opts: DiffOptions): Promise; diff --git a/types/nodegit/index-entry.d.ts b/types/nodegit/index-entry.d.ts index a6591e37b9..f2ac5cad8a 100644 --- a/types/nodegit/index-entry.d.ts +++ b/types/nodegit/index-entry.d.ts @@ -1,6 +1,6 @@ import { Oid } from './oid'; -interface IndexTime { +export interface IndexTime { seconds: number; nanoseconds: number; } diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 92307a1abb..10e7c3483a 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -8,25 +8,35 @@ export { Blob } from './blob'; export { Buf } from './buf'; export { CheckoutOptions } from './checkout-options'; export { Commit } from './commit'; +export { Config } from './config'; export { DiffDelta } from './diff-delta'; export { DiffFile } from './diff-file'; export { DiffPerfdata } from './diff-perf-data'; export { Diff } from './diff'; export { Enums } from './enums'; export { FetchOptions } from './fetch-options'; -export { IndexEntry } from './index-entry'; export { Index } from './index_'; +export { IndexEntry } from './index-entry'; +export { MergeFileInput } from './merge-file-input'; +export { MergeOptions } from './merge-options'; +export { Merge } from './merge'; export { Object } from './object'; export { OdbObject } from './odb-object'; export { Odb } from './odb'; +export { Oidarray } from './oid-array'; export { Oid } from './oid'; +export { PushOptions } from './push-options'; +export { Refdb } from './ref-db'; +import { Refspec } from './ref-spec'; export { Reference } from './reference'; export { RemoteCallbacks } from './remote-callbacks'; export { Remote } from './remote'; export { Repository } from './repository'; export { Signature } from './signature'; export { Strarray } from './str-array'; +export { Tag } from './tag'; export { Time } from './time'; +export { TransferProgress } from './transfer-progress'; export { Treebuilder } from './tree-builder'; export { TreeEntry } from './tree-entry'; export { Tree } from './tree'; diff --git a/types/nodegit/merge-file-input.d.ts b/types/nodegit/merge-file-input.d.ts new file mode 100644 index 0000000000..f49bd446ca --- /dev/null +++ b/types/nodegit/merge-file-input.d.ts @@ -0,0 +1,7 @@ +export interface MergeFileInput { + version: number; + ptr: string; + size: number; + path: string; + mode: number; +} diff --git a/types/nodegit/merge-options.d.ts b/types/nodegit/merge-options.d.ts new file mode 100644 index 0000000000..a4108c767d --- /dev/null +++ b/types/nodegit/merge-options.d.ts @@ -0,0 +1,8 @@ +export interface MergeOptions { + version: number; + treeFlags: number; + renameThreshold: number; + targetLimit: number; + fileFavor: number; + fileFlags: number; +} diff --git a/types/nodegit/merge.d.ts b/types/nodegit/merge.d.ts new file mode 100644 index 0000000000..fb135e178f --- /dev/null +++ b/types/nodegit/merge.d.ts @@ -0,0 +1,59 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Tree } from './tree'; +import { Commit } from './commit'; +import { Index } from './index'; +import { AnnotatedCommit } from './annotated-commit'; +import { CheckoutOptions } from './checkout-options'; +import { Oidarray } from './oid-array'; +import { MergeOptions } from './merge-options'; +import { MergeFileInput } from './merge-file-input'; + +export namespace Merge { + enum ANALYSIS { + NONE = 0, + NORMAL = 1, + UP_TO_DATE = 2, + FASTFORWARD = 4, + UNBORN = 8 + } + + enum FILE_FAVOR { + NORMAL = 0, + OURS = 1, + THEIRS = 2, + UNION = 3 + } + + enum FILE_FLAGS { + FILE_DEFAULT = 0, + FILE_STYLE_MERGE = 1, + FILE_STYLE_DIFF3 = 2, + FILE_SIMPLIFY_ALNUM = 4, + FILE_IGNORE_WHITESPACE = 8, + FILE_IGNORE_WHITESPACE_CHANGE = 16, + FILE_IGNORE_WHITESPACE_EOL = 32, + FILE_DIFF_PATIENCE = 64, + FILE_DIFF_MINIMAL = 128 + } + + enum PREFERENCE { + NONE = 0, + NO_FASTFORWARD = 1, + FASTFORWARD_ONLY = 2 + } + + enum TREE_FLAG { + TREE_FIND_RENAMES = 1 + } +} + +export class Merge { + static merge(repo: Repository, theirHead: AnnotatedCommit, mergeOpts?: MergeOptions, checkoutOpts?: CheckoutOptions): any; + static base(repo: Repository, one: Oid, two: Oid): Promise; + static bases(repo: Repository, one: Oid, two: Oid): Promise; + static commits(repo: Repository, ourCommit: Commit, theirCommit: Commit, options?: MergeOptions): any; + static fileInitInput(opts: MergeFileInput, version: number): number; + static initOptions(opts: MergeOptions, version: number): number; + static trees(repo: Repository, ancestor_tree: Tree, our_tree: Tree, their_tree: Tree, opts: MergeOptions): Promise; +} diff --git a/types/nodegit/oid-array.d.ts b/types/nodegit/oid-array.d.ts new file mode 100644 index 0000000000..7a96f24a7a --- /dev/null +++ b/types/nodegit/oid-array.d.ts @@ -0,0 +1,7 @@ +import { Oid } from './oid'; + +export class Oidarray { + free(): void; + ids: Oid; + count: number; +} diff --git a/types/nodegit/push-options.d.ts b/types/nodegit/push-options.d.ts new file mode 100644 index 0000000000..5187548b8f --- /dev/null +++ b/types/nodegit/push-options.d.ts @@ -0,0 +1,7 @@ +import { RemoteCallbacks } from './remote-callbacks'; + +export interface PushOptions { + version: number; + pbParallelism: number; + callbacks: RemoteCallbacks; +} diff --git a/types/nodegit/ref-db.d.ts b/types/nodegit/ref-db.d.ts new file mode 100644 index 0000000000..8c9046d48d --- /dev/null +++ b/types/nodegit/ref-db.d.ts @@ -0,0 +1,8 @@ +import { Repository } from './repository'; + +export class Refdb { + static open(repo: Repository): Promise; + + compress(): number; + free(): void; +} diff --git a/types/nodegit/ref-spec.d.ts b/types/nodegit/ref-spec.d.ts new file mode 100644 index 0000000000..bf40f21ac2 --- /dev/null +++ b/types/nodegit/ref-spec.d.ts @@ -0,0 +1,8 @@ +export class Refspec { + direction(): number; + dst(): string; + dstMatches(refname: string): number; + force(): number; + src(): string; + srcMatches(refname: string): number; +} diff --git a/types/nodegit/remote-callbacks.d.ts b/types/nodegit/remote-callbacks.d.ts index 0987b6259f..ca244e5c5e 100644 --- a/types/nodegit/remote-callbacks.d.ts +++ b/types/nodegit/remote-callbacks.d.ts @@ -1,8 +1,8 @@ -export interface RemoteCallbacks { +export class RemoteCallbacks { version?: number; credentials?: Function; certificateCheck?: Function; transferProgress?: Function; transport?: Function; - payload?: void; + payload?: undefined; } diff --git a/types/nodegit/remote.d.ts b/types/nodegit/remote.d.ts index 3fc10534d4..0c3923c57c 100644 --- a/types/nodegit/remote.d.ts +++ b/types/nodegit/remote.d.ts @@ -4,6 +4,9 @@ import { Strarray } from './str-array'; import { FetchOptions } from './fetch-options'; import { Buf } from './buf'; import { Enums } from './enums'; +import { TransferProgress } from './transfer-progress'; +import { PushOptions } from './push-options'; +import { Refspec } from './ref-spec'; export namespace Remote { enum AUTOTAG_OPTION { diff --git a/types/nodegit/repository.d.ts b/types/nodegit/repository.d.ts index e18984bbcb..acf5f5b83a 100644 --- a/types/nodegit/repository.d.ts +++ b/types/nodegit/repository.d.ts @@ -12,19 +12,23 @@ import { AnnotatedCommit } from './annotated-commit'; import { FetchOptions } from './fetch-options'; import { CheckoutOptions } from './checkout-options'; import { Remote } from './remote'; +import { Tag } from './tag'; +import { Config } from './config'; +import { Merge } from './merge'; +import { MergeOptions } from './merge-options'; +import { Refdb } from './ref-db'; -interface RepositoryInitOptions { - description: string, - flags: number, - initialHead: string, - mode: number, - originUrl: string, - templatePath: string, - version: number, - workdirPath: string +export interface RepositoryInitOptions { + description: string; + flags: number; + initialHead: string; + mode: number; + originUrl: string; + templatePath: string; + version: number; + workdirPath: string; } - export class Repository { /** * Creates a branch with the passed in name pointing to the commit @@ -84,8 +88,8 @@ export class Repository { static wrapOdb(odb: Odb): Promise; cleanup(): void; - config(): Promise; - configSnapshot(): Promise; + config(): Promise; + configSnapshot(): Promise; detachHead(): number; fetchheadForeach(callback: Function): Promise; free(): void; @@ -101,7 +105,7 @@ export class Repository { messageRemove(): number; odb(): Promise; path(): string; - refdb(): Promise; + refdb(): Promise; setHead(refname: string): Promise; setHeadDetached(commitish: Oid): number; setHeadDetachedFromAnnotated(commitish: AnnotatedCommit): number; @@ -122,10 +126,10 @@ export class Repository { getCommit(string: string | Oid): Promise; getBlob(string: string | Oid): Promise; getTree(string: string | Oid): Promise; - createTag(string: string | Oid, name: string, message: string): Promise; + createTag(string: string | Oid, name: string, message: string): Promise; createLightweightTag(string: string | Oid, name: string): Promise; - getTag(string: string | Oid): Promise; - getTagByName(Short: string): Promise; + getTag(string: string | Oid): Promise; + getTagByName(Short: string): Promise; deleteTagByName(Short: string): Promise; createRevWalk(string: string | Oid): any; getMasterCommit(): Promise; @@ -139,7 +143,7 @@ export class Repository { getRemote(remote: string | Remote, callback: Function): Promise; fetch(remote: string | Remote, fetchOptions: Object | FetchOptions): Promise; fetchAll(fetchOptions: Object | FetchOptions, callback: Function): Promise; - mergeBranches(to: string | Reference, from: string | Reference, signature: Signature, mergePreference: NodeGit.Merge.PREFERENCE, mergeOptions: NodeGit.MergeOptions): Promise; + mergeBranches(to: string | Reference, from: string | Reference, signature: Signature, mergePreference: Merge.PREFERENCE, mergeOptions: MergeOptions): Promise; rebaseBranches(branch: string, upstream: string, onto: string, signature: Signature, beforeNextFn: Function): Promise; continueRebase(signature: Signature, beforeNextFn: Function): Promise; getStatus(opts: any): Promise; diff --git a/types/nodegit/tag.d.ts b/types/nodegit/tag.d.ts new file mode 100644 index 0000000000..d8f98953a0 --- /dev/null +++ b/types/nodegit/tag.d.ts @@ -0,0 +1,27 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Object } from './object'; +import { Signature } from './signature'; +import { Strarray } from './str-array'; + +export class Tag { + static annotationCreate(repo: Repository, tag_name: string, target: Object, tagger: Signature, message: string): Promise; + static create(repo: Repository, tag_name: string, target: Object, tagger: Signature, message: string, force: number): Promise; + static createLightweight(repo: Repository, tag_name: string, target: Object, force: number): Promise; + static delete(repo: Repository, tag_name: string): Promise; + static list(repo: Repository): Promise; + static listMatch(tag_names: Strarray, pattern: string, repo: Repository): number; + static lookup(repo: Repository, id: string | Oid | Tag): Promise; + static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + + free(): void; + id(): Oid; + message(): string; + name(): string; + owner(): Repository; + peel(tag_target_out: Object): number; + tagger(): Signature; + target(): Object; + targetId(): Oid; + targetType(): number; +} diff --git a/types/nodegit/transfer-progress.d.ts b/types/nodegit/transfer-progress.d.ts new file mode 100644 index 0000000000..1589d4b6c6 --- /dev/null +++ b/types/nodegit/transfer-progress.d.ts @@ -0,0 +1,9 @@ +export class TransferProgress { + totalObjects: number; + indexedObjects: number; + receivedObjects: number; + localObjects: number; + totalDeltas: number; + indexedDeltas: number; + receivedBytes: number; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index eec4787935..bfb1077c61 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -21,6 +21,7 @@ "buf.d.ts", "checkout-options.d.ts", "commit.d.ts", + "config.d.ts", "diff-delta.d.ts", "diff-file.d.ts", "diff-perf-data.d.ts", @@ -29,18 +30,27 @@ "fetch-options.d.ts", "index-entry.d.ts", "index.d.ts", + "merge-file-input.d.ts", + "merge-options.d.ts", + "merge.d.ts", "nodegit-tests.ts", "object.d.ts", "odb-object.d.ts", "odb.d.ts", + "oid-array.d.ts", "oid.d.ts", + "push-options.d.ts", + "ref-db.d.ts", + "ref-spec.d.ts", "reference.d.ts", "remote-callbacks.d.ts", "remote.d.ts", "repository.d.ts", "signature.d.ts", "str-array.d.ts", + "tag.d.ts", "time.d.ts", + "transfer-progress.d.ts", "tree-builder.d.ts", "tree-entry.d.ts", "tree.d.ts" From 314e6080f4a5a96bf7a03273e99a8f5f059adb99 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sun, 4 Jun 2017 03:10:28 +0100 Subject: [PATCH 022/286] Added more files --- types/nodegit/convenient-patch.d.ts | 21 ++++++ types/nodegit/index.d.ts | 4 + types/nodegit/str-array.d.ts | 2 +- types/nodegit/submodule-update-options.d.ts | 9 +++ types/nodegit/submodule.d.ts | 81 +++++++++++++++++++++ types/nodegit/transport.d.ts | 14 ++++ types/nodegit/tsconfig.json | 4 + 7 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 types/nodegit/convenient-patch.d.ts create mode 100644 types/nodegit/submodule-update-options.d.ts create mode 100644 types/nodegit/submodule.d.ts create mode 100644 types/nodegit/transport.d.ts diff --git a/types/nodegit/convenient-patch.d.ts b/types/nodegit/convenient-patch.d.ts new file mode 100644 index 0000000000..8dee260aa0 --- /dev/null +++ b/types/nodegit/convenient-patch.d.ts @@ -0,0 +1,21 @@ +import { DiffFile } from './diff-file'; + +export class ConvenientPatch { + oldFile(): DiffFile; + newFile(): DiffFile; + size(): number; + hunks(): Promise; + status(): number; + lineStats(): any; + isUnmodified(): Boolean; + isAdded(): Boolean; + isDeleted(): Boolean; + isModified(): Boolean; + isRenamed(): Boolean; + isCopied(): Boolean; + isIgnored(): Boolean; + isUntracked(): Boolean; + isTypeChange(): Boolean; + isUnreadable(): Boolean; + isConflicted(): Boolean; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 10e7c3483a..11d274425f 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -9,6 +9,7 @@ export { Buf } from './buf'; export { CheckoutOptions } from './checkout-options'; export { Commit } from './commit'; export { Config } from './config'; +export { ConvenientPatch } from './convenient-patch'; export { DiffDelta } from './diff-delta'; export { DiffFile } from './diff-file'; export { DiffPerfdata } from './diff-perf-data'; @@ -34,9 +35,12 @@ export { Remote } from './remote'; export { Repository } from './repository'; export { Signature } from './signature'; export { Strarray } from './str-array'; +export { SubmoduleUpdateOptions } from './submodule-update-options'; +export { Submodule } from './submodule'; export { Tag } from './tag'; export { Time } from './time'; export { TransferProgress } from './transfer-progress'; +export { Transport } from './transport'; export { Treebuilder } from './tree-builder'; export { TreeEntry } from './tree-entry'; export { Tree } from './tree'; diff --git a/types/nodegit/str-array.d.ts b/types/nodegit/str-array.d.ts index fc400448f2..525667fbcb 100644 --- a/types/nodegit/str-array.d.ts +++ b/types/nodegit/str-array.d.ts @@ -1,6 +1,6 @@ export class Strarray { copy(src: Strarray): number; free(): void; - strings: string; + strings: string[]; count: number; } diff --git a/types/nodegit/submodule-update-options.d.ts b/types/nodegit/submodule-update-options.d.ts new file mode 100644 index 0000000000..35bbd6b3f8 --- /dev/null +++ b/types/nodegit/submodule-update-options.d.ts @@ -0,0 +1,9 @@ +import { CheckoutOptions } from './checkout-options'; +import { FetchOptions } from './fetch-options'; + +export interface SubmoduleUpdateOptions { + version: number; + checkoutOpts: CheckoutOptions; + fetchOpts: FetchOptions; + cloneCheckoutStrategy: number; +} diff --git a/types/nodegit/submodule.d.ts b/types/nodegit/submodule.d.ts new file mode 100644 index 0000000000..b3c1576db4 --- /dev/null +++ b/types/nodegit/submodule.d.ts @@ -0,0 +1,81 @@ +import { Repository } from './repository'; +import { Buf } from './buf'; +import { Oid } from './oid'; +import { SubmoduleUpdateOptions } from './submodule-update-options'; + +export namespace Submodule { + enum IGNORE { + UNSPECIFIED = -1, + NONE = 1, + UNTRACKED = 2, + DIRTY = 3, + ALL = 4 + } + + enum RECURSE { + NO = 0, + YES = 1, + ONDEMAND = 2 + } + + enum STATUS { + IN_HEAD = 1, + IN_INDEX = 2, + IN_CONFIG = 4, + IN_WD = 8, + INDEX_ADDED = 16, + INDEX_DELETED = 32, + INDEX_MODIFIED = 64, + WD_UNINITIALIZED = 128, + WD_ADDED = 256, + WD_DELETED = 512, + WD_MODIFIED = 1024, + WD_INDEX_MODIFIED = 2048, + WD_WD_MODIFIED = 4096, + WD_UNTRACKED = 8192 + } + + enum UPDATE { + CHECKOUT = 1, + REBASE = 2, + MERGE = 3, + NONE = 4, + DEFAULT = 0 + } +} + +export class Submodule { + static addSetup(repo: Repository, url: string, path: string, use_gitlink: number): Promise; + static foreach(repo: Repository, callback: Function, payload: any): Promise; + static lookup(repo: Repository, name: string): Promise; + static resolveUrl(repo: Repository, url: string): Promise; + static setBranch(repo: Repository, name: string, branch: string): number; + static setFetchRecurseSubmodules(repo: Repository, name: string, fetch_recurse_submodules: number): number; + static setIgnore(repo: Repository, name: string, ignore: number): Promise; + static setUpdate(repo: Repository, name: string, update: number): Promise; + static setUrl(repo: Repository, name: string, url: string): Promise; + static status(repo: Repository, name: string, ignore: number): Promise; + static updateInitOptions(opts: SubmoduleUpdateOptions, version: number): number; + + addFinalize(): Promise; + addToIndex(write_index: number): Promise; + branch(): string; + fetchRecurseSubmodules(): number; + free(): void; + headId(): Oid; + ignore(): number; + indexId(): Oid; + init(overwrite: number): Promise; + location(): Promise; + name(): string; + open(): Promise; + owner(): Repository; + path(): string; + reload(force: number): number; + repoInit(use_gitlink: number): Promise; + sync(): Promise; + update(init: number, options: SubmoduleUpdateOptions): Promise; + updateStrategy(): number; + url(): string; + wdId(): Oid; +} diff --git a/types/nodegit/transport.d.ts b/types/nodegit/transport.d.ts new file mode 100644 index 0000000000..9d1a82b061 --- /dev/null +++ b/types/nodegit/transport.d.ts @@ -0,0 +1,14 @@ +import { Remote } from './remote'; +import { Strarray } from './str-array'; + +export namespace Transport { + enum FLAGS { + NONE = 0 + } +} + +export class Transport { + static sshWithPaths(owner: Remote, payload: Strarray): Promise; + static unregister(prefix: string): number; + init(version: number): number; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index bfb1077c61..483f995a50 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -22,6 +22,7 @@ "checkout-options.d.ts", "commit.d.ts", "config.d.ts", + "convenient-patch.d.ts", "diff-delta.d.ts", "diff-file.d.ts", "diff-perf-data.d.ts", @@ -48,9 +49,12 @@ "repository.d.ts", "signature.d.ts", "str-array.d.ts", + "submodule-update-options.d.ts", + "submodule.d.ts", "tag.d.ts", "time.d.ts", "transfer-progress.d.ts", + "transport.d.ts", "tree-builder.d.ts", "tree-entry.d.ts", "tree.d.ts" From c1400707cd6ed822a063cdb1471a21d1e5deda6a Mon Sep 17 00:00:00 2001 From: Dolan Date: Sun, 4 Jun 2017 23:02:39 +0100 Subject: [PATCH 023/286] Status typings --- types/nodegit/index.d.ts | 4 +++ types/nodegit/status-entry.d.ts | 7 ++++ types/nodegit/status-list.d.ts | 11 ++++++ types/nodegit/status-options.d.ts | 8 +++++ types/nodegit/status.d.ts | 56 +++++++++++++++++++++++++++++++ types/nodegit/tsconfig.json | 4 +++ 6 files changed, 90 insertions(+) create mode 100644 types/nodegit/status-entry.d.ts create mode 100644 types/nodegit/status-list.d.ts create mode 100644 types/nodegit/status-options.d.ts create mode 100644 types/nodegit/status.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 11d274425f..6aa64e9e1f 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -34,6 +34,10 @@ export { RemoteCallbacks } from './remote-callbacks'; export { Remote } from './remote'; export { Repository } from './repository'; export { Signature } from './signature'; +export { StatusEntry } from './status-entry'; +export { StatusList } from './status-list'; +export { StatusOptions } from './status-options'; +export { Status } from './status'; export { Strarray } from './str-array'; export { SubmoduleUpdateOptions } from './submodule-update-options'; export { Submodule } from './submodule'; diff --git a/types/nodegit/status-entry.d.ts b/types/nodegit/status-entry.d.ts new file mode 100644 index 0000000000..bc2ab62a12 --- /dev/null +++ b/types/nodegit/status-entry.d.ts @@ -0,0 +1,7 @@ +import { DiffDelta } from './diff-delta'; + +export class StatusEntry { + status: number; + headToIndex: DiffDelta; + indexToWorkdir: DiffDelta; +} diff --git a/types/nodegit/status-list.d.ts b/types/nodegit/status-list.d.ts new file mode 100644 index 0000000000..6d83044801 --- /dev/null +++ b/types/nodegit/status-list.d.ts @@ -0,0 +1,11 @@ +import { Repository } from './repository'; +import { DiffPerfdata } from './diff-perf-data'; +import { StatusOptions } from './status-options'; + +export class StatusList { + static create(repo: Repository, opts: StatusOptions): Promise; + + entrycount(): number; + free(): void; + getPerfdata(): Promise; +} diff --git a/types/nodegit/status-options.d.ts b/types/nodegit/status-options.d.ts new file mode 100644 index 0000000000..c4296a5b92 --- /dev/null +++ b/types/nodegit/status-options.d.ts @@ -0,0 +1,8 @@ +import { Strarray } from './str-array'; + +export interface StatusOptions { + version: number; + show: number; + flags: number; + pathspec: Strarray; +} diff --git a/types/nodegit/status.d.ts b/types/nodegit/status.d.ts new file mode 100644 index 0000000000..92bbe564f3 --- /dev/null +++ b/types/nodegit/status.d.ts @@ -0,0 +1,56 @@ +import { Repository } from './repository'; +import { StatusList } from './status-list'; +import { StatusEntry } from './status-entry'; +import { StatusOptions } from './status-options'; + +export namespace Status { + enum STATUS { + CURRENT = 0, + INDEX_NEW = 1, + INDEX_MODIFIED = 2, + INDEX_DELETED = 4, + INDEX_RENAMED = 8, + INDEX_TYPECHANGE = 16, + WT_NEW = 128, + WT_MODIFIED = 256, + WT_DELETED = 512, + WT_TYPECHANGE = 1024, + WT_RENAMED = 2048, + WT_UNREADABLE = 4096, + IGNORED = 16384, + CONFLICTED = 32768 + } + + enum OPT { + INCLUDE_UNTRACKED = 1, + INCLUDE_IGNORED = 2, + INCLUDE_UNMODIFIED = 4, + EXCLUDE_SUBMODULES = 8, + RECURSE_UNTRACKED_DIRS = 16, + DISABLE_PATHSPEC_MATCH = 32, + RECURSE_IGNORED_DIRS = 64, + RENAMES_HEAD_TO_INDEX = 128, + RENAMES_INDEX_TO_WORKDIR = 256, + SORT_CASE_SENSITIVELY = 512, + SORT_CASE_INSENSITIVELY = 1024, + RENAMES_FROM_REWRITES = 2048, + NO_REFRESH = 4096, + UPDATE_INDEX = 8192, + INCLUDE_UNREADABLE = 16384, + INCLUDE_UNREADABLE_AS_UNTRACKED = 32768 + } + + enum SHOW { + INDEX_AND_WORKDIR = 0, + INDEX_ONLY = 1, + WORKDIR_ONLY = 2 + } +} + +export class Status { + static byIndex(statuslist: StatusList, idx: number): StatusEntry; + static file(repo: Repository, path: string): number; + static foreach(repo: Repository, callback: Function, payload: void): Promise; + static foreachExt(repo: Repository, opts: StatusOptions, callback: Function, payload: void): Promise; + static shouldIgnore(ignored: number, repo: Repository, path: string): number; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 483f995a50..40d020dd19 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -48,6 +48,10 @@ "remote.d.ts", "repository.d.ts", "signature.d.ts", + "status-entry.d.ts", + "status-list.d.ts", + "status-options.d.ts", + "status.d.ts", "str-array.d.ts", "submodule-update-options.d.ts", "submodule.d.ts", From 046c22fa46b0d4445347fb38a3d8c3eea0a72bfc Mon Sep 17 00:00:00 2001 From: Dolan Date: Sun, 4 Jun 2017 23:09:57 +0100 Subject: [PATCH 024/286] Stash typings --- types/nodegit/index.d.ts | 1 + types/nodegit/stash.d.ts | 46 +++++++++++++++++++++++++++++++++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 48 insertions(+) create mode 100644 types/nodegit/stash.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 6aa64e9e1f..a4a90f07d2 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -34,6 +34,7 @@ export { RemoteCallbacks } from './remote-callbacks'; export { Remote } from './remote'; export { Repository } from './repository'; export { Signature } from './signature'; +export { Stash } from './stash'; export { StatusEntry } from './status-entry'; export { StatusList } from './status-list'; export { StatusOptions } from './status-options'; diff --git a/types/nodegit/stash.d.ts b/types/nodegit/stash.d.ts new file mode 100644 index 0000000000..5208fa7e5f --- /dev/null +++ b/types/nodegit/stash.d.ts @@ -0,0 +1,46 @@ +import { Repository } from './repository'; +import { Signature } from './signature'; +import { Oid } from './oid'; +import { CheckoutOptions } from './checkout-options'; + +export namespace Stash { + enum APPLY_FLAGS { + APPLY_DEFAULT = 0, + APPLY_REINSTATE_INDEX = 1 + } + + enum APPLY_PROGRESS { + NONE = 0, + LOADING_STASH = 1, + ANALYZE_INDEX = 2, + ANALYZE_MODIFIED = 3, + ANALYZE_UNTRACKED = 4, + CHECKOUT_UNTRACKED = 5, + CHECKOUT_MODIFIED = 6, + DONE = 7 + } + + enum FLAGS { + DEFAULT = 0, + KEEP_INDEX = 1, + INCLUDE_UNTRACKED = 2, + INCLUDE_IGNORED = 4 + } +} + +export interface StashApplyOptions { + version: number; + flags: number; + checkoutOptions: CheckoutOptions; + progressCb: Function; + progressPayload: void; +} + +export class Stash { + static apply(repo: Repository, index: number, options: StashApplyOptions): Promise; + static applyInitOptions(opts: StashApplyOptions, version: number): number; + static drop(repo: Repository, index: number): Promise; + static foreach(repo: Repository, callback: Function, payload: void): Promise; + static pop(repo: Repository, index: number, options: StashApplyOptions): Promise; + static save(repo: Repository, stasher: Signature, message: string, flags: number): Promise; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 40d020dd19..017b34314c 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -48,6 +48,7 @@ "remote.d.ts", "repository.d.ts", "signature.d.ts", + "stash.d.ts", "status-entry.d.ts", "status-list.d.ts", "status-options.d.ts", From f527af6ed365e87058480e22577e3e191a13fb42 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Mon, 5 Jun 2017 15:10:34 -0400 Subject: [PATCH 025/286] Annotate `react-redux` more explicitly --- types/react-redux/index.d.ts | 22 ++++----- types/react-redux/react-redux-tests.tsx | 62 +++++++++++++++++++------ types/redux-form/redux-form-tests.tsx | 4 +- 3 files changed, 62 insertions(+), 26 deletions(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index bf810575cb..112b7e9c95 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -15,12 +15,12 @@ type Store = Redux.Store; type Dispatch = Redux.Dispatch; type ActionCreator = Redux.ActionCreator; -export interface DispatchProp { - dispatch: Dispatch +export interface DispatchProp { + dispatch: Dispatch; } -interface ComponentDecorator { - (component: Component<(TOwnProps & TMergedProps) | TOwnProps>): ComponentClass; +interface ComponentDecorator { + (component: Component): ComponentClass; } interface ComponentMergeDecorator { @@ -46,21 +46,21 @@ interface ComponentMergeDecorator { * @param mergeProps * @param options */ -export declare function connect(): ComponentDecorator>; +export declare function connect(): ComponentDecorator, {}>; export declare function connect( mapStateToProps: MapStateToPropsParam -): ComponentDecorator & TStateProps>; +): ComponentDecorator & TStateProps, TOwnProps>; export declare function connect( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam -): ComponentDecorator; +): ComponentDecorator; export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam -): ComponentDecorator; +): ComponentDecorator; export declare function connect( mapStateToProps: MapStateToPropsParam, @@ -91,21 +91,21 @@ export declare function connect( mapDispatchToProps: null | undefined, mergeProps: null | undefined, options: Options -): ComponentDecorator & TStateProps & TOwnProps>; +): ComponentDecorator & TStateProps, TOwnProps>; export declare function connect( mapStateToProps: null | undefined, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: null | undefined, options: Options -): ComponentDecorator; +): ComponentDecorator; export declare function connect( mapStateToProps: MapStateToPropsParam, mapDispatchToProps: MapDispatchToPropsParam, mergeProps: null | undefined, options: Options -): ComponentDecorator; +): ComponentDecorator; export declare function connect( mapStateToProps: MapStateToPropsParam, diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index d6742a3e43..5875fe9291 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -108,12 +108,7 @@ declare var store: Store; class MyRootComponent extends Component { } -class TodoApp extends Component, any> { - render (): null { - this.props.dispatch({ type: 'test' }) - return null - } -} +class TodoApp extends Component {} interface TodoState { todos: string[]|string; } @@ -156,9 +151,10 @@ ReactDOM.render( // Inject just dispatch and don't listen to store -const WrappedTodoApp = connect()<{}>(TodoApp); +const AppWrap = (props: DispatchProp & { children?: React.ReactNode }) =>
+const WrappedApp = connect()(AppWrap); - + // Inject dispatch and every field in the global state @@ -281,7 +277,7 @@ interface TestState { isLoaded: boolean; state1: number; } -class TestComponent extends Component { } +class TestComponent extends Component, TestState> { } const WrappedTestComponent = connect()(TestComponent); // return value of the connect()(TestComponent) is of the type TestComponent @@ -290,7 +286,6 @@ ATestComponent = TestComponent; ATestComponent = WrappedTestComponent; let anElement: ReactElement; -; ; ; @@ -348,7 +343,7 @@ namespace TestTOwnPropsInference { state: string; } - class OwnPropsComponent extends React.Component { + class OwnPropsComponent extends React.Component, void> { render() { return
; } @@ -370,13 +365,13 @@ namespace TestTOwnPropsInference { // React.createElement(ConnectedWithoutOwnProps, { anything: 'goes!' }); // This compiles, as expected. - React.createElement(ConnectedWithOwnProps, { state: 'string', own: 'string' }); + React.createElement(ConnectedWithOwnProps, { own: 'string' }); // This should not compile, which is good. // React.createElement(ConnectedWithOwnProps, { anything: 'goes!' }); // This compiles, as expected. - React.createElement(ConnectedWithTypeHint, { state: 'string', own: 'string' }); + React.createElement(ConnectedWithTypeHint, { own: 'string' }); // This should not compile, which is good. // React.createElement(ConnectedWithTypeHint, { anything: 'goes!' }); @@ -438,3 +433,44 @@ namespace TestMergedPropsInference { }), )(MergedPropsComponent); } + +namespace Issue16652 { + interface PassedProps { + commentIds: string[]; + } + + interface GeneratedStateProps { + comments: ({ id: string } | undefined)[]; + } + + class CommentList extends React.Component, void> {} + + const mapStateToProps = (state: any, ownProps: PassedProps): GeneratedStateProps => { + return { + comments: ownProps.commentIds.map(id => ({ id })), + }; + }; + + const ConnectedCommentList = connect(mapStateToProps)( + CommentList + ); + + +} + +namespace Issue15463 { + interface ISpinnerProps{ + showGlobalSpinner: boolean; + } + class SpinnerClass extends React.Component, undefined> { + render() { + return (
); + } + } + + export const Spinner = connect((state: any) => { + return { showGlobalSpinner: true }; + })(SpinnerClass); + + +} diff --git a/types/redux-form/redux-form-tests.tsx b/types/redux-form/redux-form-tests.tsx index d14b7a35cd..7615824b53 100644 --- a/types/redux-form/redux-form-tests.tsx +++ b/types/redux-form/redux-form-tests.tsx @@ -84,7 +84,7 @@ reduxForm({ // adapted from: http://redux-form.com/6.0.0-alpha.4/examples/initializeFromState/ -import { connect } from 'react-redux' +import { connect, DispatchProp } from 'react-redux' const { DOM: { input } } = React interface DataShape { @@ -125,7 +125,7 @@ const ConnectedDecoratedInitializeFromStateFormFunction = connect( // React ComponentClass instead of StatelessComponent -class InitializeFromStateFormClass extends React.Component { +class InitializeFromStateFormClass extends React.Component, {}> { render() { return InitializeFromStateFormFunction(this.props); } From 8cb0a9fc2f288ce297ee89b1c1c555ce5676bb41 Mon Sep 17 00:00:00 2001 From: Michael Ledin Date: Mon, 5 Jun 2017 11:52:27 +0300 Subject: [PATCH 026/286] Fix requested changes. --- types/superagent-no-cache/index.d.ts | 2 +- types/superagent-no-cache/superagent-no-cache-tests.ts | 2 +- types/superagent-prefix/index.d.ts | 7 ++++++- types/superagent-prefix/superagent-prefix-tests.ts | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/types/superagent-no-cache/index.d.ts b/types/superagent-no-cache/index.d.ts index 9dcfc02005..c08b41af15 100644 --- a/types/superagent-no-cache/index.d.ts +++ b/types/superagent-no-cache/index.d.ts @@ -8,4 +8,4 @@ import * as request from 'superagent'; declare const plugin: request.Plugin; -export default plugin; +export = plugin; diff --git a/types/superagent-no-cache/superagent-no-cache-tests.ts b/types/superagent-no-cache/superagent-no-cache-tests.ts index 528eb4fd40..68e4e961a2 100644 --- a/types/superagent-no-cache/superagent-no-cache-tests.ts +++ b/types/superagent-no-cache/superagent-no-cache-tests.ts @@ -1,5 +1,5 @@ import * as request from 'superagent'; -import plugin from 'superagent-no-cache'; +import * as plugin from 'superagent-no-cache'; request .get('/some-url') diff --git a/types/superagent-prefix/index.d.ts b/types/superagent-prefix/index.d.ts index 238046dde9..8b7eb1d508 100644 --- a/types/superagent-prefix/index.d.ts +++ b/types/superagent-prefix/index.d.ts @@ -6,4 +6,9 @@ import * as request from 'superagent'; -export default function(prefix: string): request.Plugin; +declare function plugin(prefix: string): request.Plugin; + +declare namespace plugin { +} + +export = plugin; diff --git a/types/superagent-prefix/superagent-prefix-tests.ts b/types/superagent-prefix/superagent-prefix-tests.ts index 58101d8fda..01e4b52905 100644 --- a/types/superagent-prefix/superagent-prefix-tests.ts +++ b/types/superagent-prefix/superagent-prefix-tests.ts @@ -1,5 +1,5 @@ import * as request from 'superagent'; -import plugin from 'superagent-prefix'; +import * as plugin from 'superagent-prefix'; request .get('/some-url') From 71b90dcce74d5fbe9f20c85d9e322d5e1b6bf41e Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Tue, 6 Jun 2017 16:13:40 +0200 Subject: [PATCH 027/286] fix tests and dtslint and improve typings --- types/heredatalens/heredatalens-tests.ts | 73 ++++++++++-------------- types/heredatalens/index.d.ts | 14 ++++- 2 files changed, 41 insertions(+), 46 deletions(-) diff --git a/types/heredatalens/heredatalens-tests.ts b/types/heredatalens/heredatalens-tests.ts index 51fa56b380..37f20f2f84 100644 --- a/types/heredatalens/heredatalens-tests.ts +++ b/types/heredatalens/heredatalens-tests.ts @@ -6,10 +6,6 @@ * are not intended as functional tests. */ -import './index'; - - -let service: H.datalens.Service; let serviceOptions: H.datalens.Service.Options = { subDomain: 'sub', version: 'version', @@ -31,27 +27,24 @@ let queryTileProviderOptions: H.datalens.QueryTileProvider.Options = { tileParamNames: queryTileProviderTileParamNames }; +let service: H.datalens.Service = new H.datalens.Service(serviceOptions); +service.request('method', 'endpoint', 'params', 'body', (result: any) => {}, (error: any) => {}).then((data: any) => {}); +service.fetchQueryData('id', 'params', (result: any) => {}, (error: any) => {}).then((data: any) => {}); +service.fetchQueryStats('id', 'query', (result: any) => {}, (error: any) => {}).then((data: any) => {}); +service.fetchLayer('name', 'params', (result: any) => {}, (error: any) => {}).then((data: any) => {}); +service.fetchLayerTile('name', 1, 2, 3, 'params', (result: any) => {}, (error: any) => {}).then((data: any) => {}); +service.setTokens('token', 'refresh_token'); +service.configure('app_id', 'app_code', true, true, new H.service.Url('scheme', 'host')); + let queryTileProvider = new H.datalens.QueryTileProvider(service, queryTileProviderOptions); queryTileProvider.setQueryId('some id'); queryTileProvider.setQueryParams('some params'); queryTileProvider.setTileParamNames(queryTileProviderTileParamNames); - -service = new H.datalens.Service(serviceOptions); -service.request('method', 'endpoint', 'params', 'body', function(result) {}, function(error) {}).then(data => {}); -service.fetchQueryData('id', 'params', function(result) {}, function(error) {}).then(data => {}); -service.fetchQueryStats('id', 'query', function(result) {}, function(error) {}).then(data => {}); -service.fetchLayer('name', 'params', function(result) {}, function(error) {}).then(data => {}); -service.fetchLayerTile('name', 1, 2, 3, 'params', function(result) {}, function(error) {}).then(data => {}); -service.setTokens('token', 'refresh_token'); -service.configure('app_id', 'app_code', true, true, new H.service.Url('scheme', 'host')); - - let provider = new H.datalens.Provider({ columns: ['1', '2'], rows: [[], []]}); provider.getData(); provider.setData({ columns: ['3', '4'], rows: [[], []]}); - let queryProviderOptions: H.datalens.QueryProvider.Options = { queryId: 'id', queryParams: 'params' @@ -63,26 +56,24 @@ queryProvider.reload(); queryProvider.getData(); queryProvider.setData({ columns: ['3', '4'], rows: [[], []]}); - let rasterLayerOptions: H.datalens.RasterLayer.Options = { - dataToRows: (): H.datalens.RasterLayer.Row[] => { return []; }, - rowToTilePoint: (): H.datalens.RasterLayer.TilePoint => { return { x: 1, y: 2 }; }, - buffer: (): number => { return 1; }, + dataToRows: (): H.datalens.RasterLayer.Row[] => [], + rowToTilePoint: (): H.datalens.RasterLayer.TilePoint => ({ x: 1, y: 2 }), + buffer: (): number => 1, renderTile: () => {} }; let rasterLayer = new H.datalens.RasterLayer(); rasterLayer.redraw(); - let heatmapLayerOptions: H.datalens.HeatmapLayer.Options = { - dataToRows: (): H.datalens.HeatmapLayer.Row[] => { return []; }, - rowToTilePoint: (): H.datalens.HeatmapLayer.TilePoint => { return { x: 1, y: 2, value: 5, count: 5 }; }, + dataToRows: (): H.datalens.HeatmapLayer.Row[] => [], + rowToTilePoint: (): H.datalens.HeatmapLayer.TilePoint => ({ x: 1, y: 2, value: 5, count: 5 }), bandwidth: 5, - valueRange: (): number[] => { return []; }, - countRange: (): number[] => { return []; }, - colorScale: (): string => { return '2'; }, - alphaScale: (): number => { return 1; }, + valueRange: (): number[] => [], + countRange: (): number[] => [], + colorScale: (): string => '2', + alphaScale: (): number => 1, aggregation: H.datalens.HeatmapLayer.Aggregation.SUM, inputScale: H.datalens.HeatmapLayer.InputScale.LINEAR }; @@ -92,29 +83,27 @@ heatmapLayer.getOptionsPerZoom(5); heatmapLayer.dispose(); heatmapLayer.redraw(); - let objectLayerOptions: H.datalens.ObjectLayer.Options = { - dataToRows: (): H.datalens.ObjectLayer.Row[] => { return []; }, - rowToMapObject: (): H.map.Object => { return new H.map.Object() }, - rowToStyle: (): H.datalens.ObjectLayer.ObjectStyleOptions => { return { icon: new H.map.Icon('x'), style: {}, arrows: {}, zIndex: 1 }; }, + dataToRows: (): H.datalens.ObjectLayer.Row[] => [], + rowToMapObject: (): H.map.Object => new H.map.Object(), + rowToStyle: (): H.datalens.ObjectLayer.ObjectStyleOptions => ({ icon: new H.map.Icon('x'), style: {}, arrows: {}, zIndex: 1 }), dataDomains: 2, - clustering: { rowToDataPoint: (): H.clustering.DataPoint => { return; }, options: (): H.clustering.Provider.ClusteringOptions => { return {}; } } -} + clustering: { rowToDataPoint: (): H.clustering.DataPoint => ({ lat: 12.1, lng: 1.12, alt: 5, ctx: H.geo.AltitudeContext.GL, wt: 2, data: {} }), + options: (): H.clustering.Provider.ClusteringOptions => ({}) } +}; let objectLayer = new H.datalens.ObjectLayer(provider, objectLayerOptions); objectLayer.redraw(); -objectLayer.updateObjectStyle(new H.map.Object, { icon: new H.map.Icon('x'), style: {}, arrows: {}, zIndex: 1 }); - +objectLayer.updateObjectStyle(new H.map.Object(), { icon: new H.map.Icon('x'), style: {}, arrows: {}, zIndex: 1 }); let rawDataProviderOptions: H.datalens.RawDataProvider.Options = { dataUrl: 'url', - dataToFeatures: (): H.datalens.RawDataProvider.Feature[] => { return []; }, - featuresToRows: (): H.datalens.ObjectLayer.Row[] => { return []; } + dataToFeatures: (): H.datalens.RawDataProvider.Feature[] => [], + featuresToRows: (): H.datalens.ObjectLayer.Row[] => [] }; let rawDataProvider = new H.datalens.RawDataProvider(rawDataProviderOptions); - let spatialTileProviderOptions: H.datalens.SpatialTileProvider.Options = { layerName: 'name', queryParams: 'params' @@ -123,14 +112,12 @@ let spatialTileProviderOptions: H.datalens.SpatialTileProvider.Options = { let spatialProvider: H.datalens.SpatialTileProvider = new H.datalens.SpatialTileProvider(service, spatialTileProviderOptions); let spatialLayerOptions: H.datalens.SpatialLayer.Options = { - dataToRows: (): H.datalens.SpatialLayer.Row[] => { return []; }, - rowToSpatialId: (): string => { return 'asd'; }, - featureToSpatialId: (): string => { return 'asd'; }, + dataToRows: (): H.datalens.SpatialLayer.Row[] => [], + rowToSpatialId: (): string => 'asd', + featureToSpatialId: (): string => 'asd', rowToStyle: (): any => { return; }, defaultStyle: (): any => { return; }, transformFeature: 1 }; let spatialLayer = new H.datalens.SpatialLayer(provider, spatialProvider, spatialLayerOptions); - - diff --git a/types/heredatalens/index.d.ts b/types/heredatalens/index.d.ts index 9c7c5d910c..9b3ff44431 100644 --- a/types/heredatalens/index.d.ts +++ b/types/heredatalens/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for HERE Data Lens API for JavaScript v2.3.0-31 +// Type definitions for HERE Data Lens API for JavaScript 2.3 // Project: https://developer.here.com/ // Definitions by: Bernd Hacker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -521,7 +521,11 @@ declare namespace H { * Each row is transformed into TilePoint and then rendered on a heat map. By default each row is an Object where property names correspond to data column names. * This representation can be changed with the dataToRows callback. */ - type Row = number; + interface Row { + tx?: number; + ty?: number; + count?: number; + } /** * Defines a constant for the bandwidth @@ -678,7 +682,11 @@ declare namespace H { * Each row is translated to map objects with the rowToMapObject callback. By default each row is an Object where property names correspond to data column names. * This representation can be changed with the dataToRows callback. */ - type Row = number; + interface Row { + getPosition(): H.geo.Point; + lat: number; + lng: number; + } /** * User defined modification of a data-driven style From 7d863884d0dc482dbe6934c336f61e331427a193 Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 6 Jun 2017 16:57:30 +0100 Subject: [PATCH 028/286] Added revwalk --- types/nodegit/index.d.ts | 1 + types/nodegit/rev-walk.d.ts | 36 ++++++++++++++++++++++++++++++++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 38 insertions(+) create mode 100644 types/nodegit/rev-walk.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index a4a90f07d2..14d88297c4 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -33,6 +33,7 @@ export { Reference } from './reference'; export { RemoteCallbacks } from './remote-callbacks'; export { Remote } from './remote'; export { Repository } from './repository'; +export { Revwalk } from './rev-walk'; export { Signature } from './signature'; export { Stash } from './stash'; export { StatusEntry } from './status-entry'; diff --git a/types/nodegit/rev-walk.d.ts b/types/nodegit/rev-walk.d.ts new file mode 100644 index 0000000000..ad54969164 --- /dev/null +++ b/types/nodegit/rev-walk.d.ts @@ -0,0 +1,36 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Commit } from './commit'; + +export namespace Revwalk { + enum SORT { + NONE = 0, + TOPOLOGICAL = 1, + TIME = 2, + REVERSE = 4 + } +} + +export class Revwalk { + static create(repo: Repository): Revwalk; + + hide(commit_id: Oid): number; + hideGlob(glob: string): number; + hideHead(): number; + hideRef(refname: string): number; + next(): Promise; + push(id: Oid): number; + pushGlob(glob: string): number; + pushHead(): number; + pushRange(range: string): number; + pushRef(refname: string): number; + repository(): Repository; + reset(): void; + simplifyFirstParent(): void; + sorting(sort: number): any; + fastWalk(max_count: number): Promise; + fileHistoryWalk(filePath: string, max_count: number): Promise; + walk(oid: Oid, callback: Function): Commit; + getCommitsUntil(checkFn: Function): Promise; + getCommits(count: number): Promise; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 017b34314c..9e3fa9285a 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -47,6 +47,7 @@ "remote-callbacks.d.ts", "remote.d.ts", "repository.d.ts", + "rev-walk.d.ts", "signature.d.ts", "stash.d.ts", "status-entry.d.ts", From 4106095ad7a5cd1f1508e732d037e1b9601e2e23 Mon Sep 17 00:00:00 2001 From: rainshen49 Date: Tue, 6 Jun 2017 12:05:02 -0400 Subject: [PATCH 029/286] UnparseConfig individually optional --- types/papaparse/index.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/types/papaparse/index.d.ts b/types/papaparse/index.d.ts index a529cb845e..76f7c224b3 100644 --- a/types/papaparse/index.d.ts +++ b/types/papaparse/index.d.ts @@ -78,13 +78,13 @@ declare namespace PapaParse { complete?(results: ParseResult, file?: File): void; // default: undefined error?(error: ParseError, file?: File): void; // default: undefined chunk?(results: ParseResult, parser: Parser): void; // default: undefined - beforeFirstChunk?(chunk: string): string|void; // default: undefined + beforeFirstChunk?(chunk: string): string | void; // default: undefined } interface UnparseConfig { - quotes: boolean; // default: false - delimiter: string; // default: "," - newline: string; // default: "\r\n" + quotes?: boolean; // default: false + delimiter?: string; // default: "," + newline?: string; // default: "\r\n" } interface UnparseObject { @@ -123,7 +123,7 @@ declare namespace PapaParse { /** * Parser */ - interface ParserConstructor { new(config: ParseConfig): Parser; } + interface ParserConstructor { new (config: ParseConfig): Parser; } interface Parser { // Parses the input parse(input: string, baseIndex: number, ignoreLastRow: boolean): any; From a282f4bc9aa60c8880444effae2fa7f4a76ab138 Mon Sep 17 00:00:00 2001 From: rainshen49 Date: Tue, 6 Jun 2017 12:08:34 -0400 Subject: [PATCH 030/286] added test cases and author name --- types/papaparse/index.d.ts | 2 +- types/papaparse/papaparse-tests.ts | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/types/papaparse/index.d.ts b/types/papaparse/index.d.ts index 76f7c224b3..35353f3aba 100644 --- a/types/papaparse/index.d.ts +++ b/types/papaparse/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for PapaParse v4.1 // Project: https://github.com/mholt/PapaParse -// Definitions by: Pedro Flemming +// Definitions by: Pedro Flemming , Rain Shen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace PapaParse { diff --git a/types/papaparse/papaparse-tests.ts b/types/papaparse/papaparse-tests.ts index 32de7e109f..a432fc7f09 100644 --- a/types/papaparse/papaparse-tests.ts +++ b/types/papaparse/papaparse-tests.ts @@ -13,7 +13,7 @@ Papa.parse("3,3,3", { delimiter: ';', comments: false, - step: function(results, p) { + step: function (results, p) { p.abort(); results.data.length; } @@ -22,7 +22,7 @@ Papa.parse("3,3,3", { var file = new File(null, null, null); Papa.parse(file, { - complete: function(a, b) { + complete: function (a, b) { a.meta.fields; b.name; } @@ -31,13 +31,19 @@ Papa.parse(file, { /** * Unparsing */ -Papa.unparse([{a: 1, b: 1, c: 1}]); +Papa.unparse([{ a: 1, b: 1, c: 1 }]); Papa.unparse([[1, 2, 3], [4, 5, 6]]); Papa.unparse({ fields: ["3"], data: [] }); +Papa.unparse([{ a: 1, b: 1, c: 1 }], { quotes: false }); +Papa.unparse([[1, 2, 3], [4, 5, 6]], { delimiter: "," }); +Papa.unparse({ + fields: ["3"], + data: [] +}, { newline: "\n" }); /** From dcfbea5aeb8838c9a1f6a670ab6adea8e1f04a99 Mon Sep 17 00:00:00 2001 From: marshall007 Date: Tue, 6 Jun 2017 12:08:25 -0500 Subject: [PATCH 031/286] @types/bull: updates for API changes in v3 --- types/bull/bull-tests.tsx | 104 ++++++------ types/bull/index.d.ts | 310 +++++++++++++++++++++++----------- types/bull/v2/bull-tests.tsx | 115 +++++++++++++ types/bull/v2/index.d.ts | 316 +++++++++++++++++++++++++++++++++++ types/bull/v2/tsconfig.json | 26 +++ 5 files changed, 723 insertions(+), 148 deletions(-) create mode 100644 types/bull/v2/bull-tests.tsx create mode 100644 types/bull/v2/index.d.ts create mode 100644 types/bull/v2/tsconfig.json diff --git a/types/bull/bull-tests.tsx b/types/bull/bull-tests.tsx index fcf339b3c3..2ff4579931 100644 --- a/types/bull/bull-tests.tsx +++ b/types/bull/bull-tests.tsx @@ -4,68 +4,69 @@ import * as Queue from "bull" -var videoQueue = Queue( 'video transcoding', 6379, '127.0.0.1' ); -var audioQueue = Queue( 'audio transcoding', 6379, '127.0.0.1' ); -var imageQueue = Queue( 'image transcoding', 6379, '127.0.0.1' ); +var videoQueue = new Queue('video transcoding', 'redis://127.0.0.1:6379'); +var audioQueue = new Queue('audio transcoding', {redis: {port: 6379, host: '127.0.0.1'}}); // Specify Redis connection using object +var imageQueue = new Queue('image transcoding'); +var pdfQueue = new Queue('pdf transcoding'); -videoQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { +videoQueue.process(function(job, done){ // job.data contains the custom data passed when the job was created // job.jobId contains id of this job. // transcode video asynchronously and report progress - job.progress( 42 ); + job.progress(42); // call done when finished done(); // or give a error if error - done( Error( 'error transcoding' ) ); + done(new Error('error transcoding')); // or pass it a result - done( null, { framerate: 29.5 /* etc... */ } ); + done(null, { framerate: 29.5 /* etc... */ }); // If the job throws an unhandled exception it is also handled correctly - throw (Error( 'some unexpected error' )); -} ); + throw new Error('some unexpected error'); +}); -audioQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { +audioQueue.process(function(job, done){ // transcode audio asynchronously and report progress - job.progress( 42 ); + job.progress(42); // call done when finished done(); // or give a error if error - done( Error( 'error transcoding' ) ); + done(new Error('error transcoding')); // or pass it a result - done( null, { samplerate: 48000 /* etc... */ } ); + done(null, { samplerate: 48000 /* etc... */ }); // If the job throws an unhandled exception it is also handled correctly - throw (Error( 'some unexpected error' )); -} ); + throw new Error('some unexpected error'); +}); -imageQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { +imageQueue.process(function(job, done){ // transcode image asynchronously and report progress - job.progress( 42 ); + job.progress(42); // call done when finished done(); // or give a error if error - done( Error( 'error transcoding' ) ); + done(new Error('error transcoding')); // or pass it a result - done( null, { width: 1280, height: 720 /* etc... */ } ); + done(null, { width: 1280, height: 720 /* etc... */ }); // If the job throws an unhandled exception it is also handled correctly - throw (Error( 'some unexpected error' )); -} ); + throw new Error('some unexpected error'); +}); -videoQueue.add( { video: 'http://example.com/video1.mov' } ); -audioQueue.add( { audio: 'http://example.com/audio1.mp3' } ); -imageQueue.add( { image: 'http://example.com/image1.tiff' } ); +videoQueue.add({video: 'http://example.com/video1.mov'}); +audioQueue.add({audio: 'http://example.com/audio1.mp3'}); +imageQueue.add({image: 'http://example.com/image1.tiff'}); ////////////////////////////////////////////////////////////////////////////////// @@ -74,42 +75,43 @@ imageQueue.add( { image: 'http://example.com/image1.tiff' } ); // ////////////////////////////////////////////////////////////////////////////////// -const fetchVideo = ( url: string ): Promise => { return null } -const transcodeVideo = ( data: any ): Promise => { return null } -interface VideoJob extends Queue.Job { - data: {url: string} -} +pdfQueue.process(function(job){ + // Processors can also return promises instead of using the done callback + return Promise.resolve(); +}); -videoQueue.process( ( job: VideoJob ) => { // don't forget to remove the done callback! - // Simply return a promise - fetchVideo( job.data.url ).then( transcodeVideo ); - - // Handles promise rejection - Promise.reject( new Error( 'error transcoding' ) ); - - // Passes the value the promise is resolved with to the "completed" event - Promise.resolve( { framerate: 29.5 /* etc... */ } ); - - // same as - Promise.reject( new Error( 'some unexpected error' ) ); - - // If the job throws an unhandled exception it is also handled correctly - throw new Error( 'some unexpected error' ); -} ); - - -var addVideo1Job = videoQueue.add( { video: 'http://example.com/video1.mov' } ); - -addVideo1Job.then((video1Job) => { +videoQueue.add({ video: 'http://example.com/video1.mov' }, { jobId: 1 }) +.then((video1Job) => { // When job has successfully be placed in the queue the job is returned // then wait for completion return video1Job.finished(); }) .then(() => { - // video1Job completed successfully + // completed successfully }) .catch((err) => { // error }); + + +////////////////////////////////////////////////////////////////////////////////// +// +// Typed Event Handlers +// +////////////////////////////////////////////////////////////////////////////////// + + +pdfQueue +.on('ready', () => undefined) +.on('error', (err: Error) => undefined) +.on('active', (job: Queue.Job, jobPromise: Queue.JobPromise) => jobPromise.cancel()) +.on('active', (job: Queue.Job) => undefined) +.on('stalled', (job: Queue.Job) => undefined) +.on('progress', (job: Queue.Job) => undefined) +.on('completed', (job: Queue.Job) => undefined) +.on('failed', (job: Queue.Job) => undefined) +.on('paused', () => undefined) +.on('resumed', () => undefined) +.on('cleaned', (jobs: Queue.Job[], status: Queue.JobStatus) => undefined) diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index 3c89655101..3c49109903 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for bull 2.1.2 +// Type definitions for bull v.3.0.0-rc.2 // Project: https://github.com/OptimalBits/bull -// Definitions by: Bruno Grieder , Cameron Crothers +// Definitions by: Bruno Grieder +// Cameron Crothers +// Marshall Cottrell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -14,22 +16,72 @@ declare module "bull" { * It creates a new Queue that is persisted in Redis. * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session. */ - function Bull(queueName: string, redisPort: number, redisHost: string, redisOpt?: Redis.ClientOpts): Bull.Queue; + var Bull: { + (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; + (queueName: string, url?: string): Bull.Queue; + new (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; + new (queueName: string, url?: string): Bull.Queue; + } namespace Bull { - export interface DoneCallback { - (error?: Error, value?: any): void + export interface QueueOptions { + + /** + * Options passed directly to the `ioredis` constructor + */ + redis?: Redis.ClientOpts; + + /** + * Prefix to use for all redis keys + */ + prefix?: string; + + settings?: AdvancedSettings; } + export interface AdvancedSettings { + + /** + * Key expiration time for job locks + */ + lockDuration?: number; + + /** + * How often check for stalled jobs (use 0 for never checking) + */ + stalledInterval?: number; + + /** + * Max amount of times a stalled job will be re-processed + */ + maxStalledCount?: number; + + /** + * Poll interval for delayed jobs and added jobs + */ + guardInterval?: number; + + /** + * Delay before processing next job in case of internal error + */ + retryProcessDelay?: number; + } + + export interface DoneCallback { + (error?: Error | null, value?: any): void + } + + export type JobId = number | string; + export interface Job { - jobId: string + id: JobId; /** - * The custom data passed when the job was created - */ - data: Object; + * The custom data passed when the job was created + */ + data: any; /** * Report progress on a job @@ -37,13 +89,13 @@ declare module "bull" { progress(value: any): Promise; /** - * Removes a Job from the queue from all the lists where it may be included. + * Removes a job from the queue and from any lists it may be included in. * @returns {Promise} A promise that resolves when the job is removed. */ remove(): Promise; /** - * Rerun a Job that has failed. + * Re-run a job that has failed. * @returns {Promise} A promise that resolves when the job is scheduled for retry. */ retry(): Promise; @@ -56,12 +108,14 @@ declare module "bull" { finished(): Promise; } - export interface Backoff { + export type JobStatus = 'completed' | 'waiting' | 'active' | 'delayed' | 'failed'; + + export interface BackoffOptions { /** * Backoff type, which can be either `fixed` or `exponential` */ - type: string + type: 'fixed' | 'exponential'; /** * Backoff delay, in milliseconds @@ -69,22 +123,52 @@ declare module "bull" { delay: number; } - export interface AddOptions { + export interface RepeatOptions { + + /** + * Cron pattern specifying when the job should execute + */ + cron: string; + + /** + * Timezone + */ + tz?: string; + + /** + * End date when the repeat job should stop repeating + */ + endDate?: Date | string | number; + } + + export interface JobOptions { + + /** + * Optional priority value. ranges from 1 (highest priority) to MAX_INT (lowest priority). + * Note that using priorities has a slight impact on performance, so do not use it if not required + */ + priority?: number; + /** * An amount of miliseconds to wait until this job can be processed. - * Note that for accurate delays, both server and clients should have their clocks synchronized + * Note that for accurate delays, both server and clients should have their clocks synchronized. [optional] */ delay?: number; /** - * A number of attempts to retry if the job fails [optional] + * The total number of attempts to try the job until it completes */ attempts?: number; + /** + * Repeat job according to a cron specification + */ + repeat?: RepeatOptions; + /** * Backoff setting for automatic retries if the job fails */ - backoff?: number | Backoff + backoff?: number | BackoffOptions; /** * A boolean which, if true, adds the job to the right @@ -96,6 +180,35 @@ declare module "bull" { * The number of milliseconds after which the job should be fail with a timeout error */ timeout?: number; + + /** + * Override the job ID - by default, the job ID is a unique + * integer, but you can use this setting to override it. + * If you use this option, it is up to you to ensure the + * jobId is unique. If you attempt to add a job with an id that + * already exists, it will not be added. + */ + jobId?: JobId; + + /** + * A boolean which, if true, removes the job when it successfully completes. + * Default behavior is to keep the job in the completed set. + */ + removeOnComplete?: boolean; + + /** + * A boolean which, if true, removes the job when it fails after all attempts + * Default behavior is to keep the job in the completed set. + */ + removeOnFail?: boolean; + } + + export interface JobCounts { + wait: number; + active: number; + completed: number; + failed: number; + delayed: number; } export interface Queue { @@ -112,7 +225,7 @@ declare module "bull" { * results, as a second argument to the "completed" event. * * concurrency: Bull will then call you handler in parallel respecting this max number. - */ + */ process(concurrency: number, callback: (job: Job, done: DoneCallback) => void): void; /** @@ -125,7 +238,7 @@ declare module "bull" { * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. * Errors will be passed as a second argument to the "failed" event; * results, as a second argument to the "completed" event. - */ + */ process(callback: (job: Job, done: DoneCallback) => void): void; /** @@ -139,7 +252,7 @@ declare module "bull" { * If it is resolved, its value will be the "completed" event's second argument. * * concurrency: Bull will then call you handler in parallel respecting this max number. - */ + */ process(concurrency: number, callback: (job: Job) => void): Promise; /** @@ -151,17 +264,15 @@ declare module "bull" { * A promise must be returned to signal job completion. * If the promise is rejected, the error will be passed as a second argument to the "failed" event. * If it is resolved, its value will be the "completed" event's second argument. - */ + */ process(callback: (job: Job) => void): Promise; - // process(callback: (job: Job, done?: DoneCallback) => void): Promise; - /** * Creates a new job and adds it to the queue. * If the queue is empty the job will be executed directly, * otherwise it will be placed in the queue and executed as soon as possible. */ - add(data: Object, opts?: AddOptions): Promise; + add(data: Object, opts?: JobOptions): Promise; /** * Returns a promise that resolves when the queue is paused. @@ -204,113 +315,118 @@ declare module "bull" { * Returns a promise that will return the job instance associated with the jobId parameter. * If the specified job cannot be located, the promise callback parameter will be set to null. */ - getJob(jobId: string): Promise; + getJob(jobId: JobId): Promise; + + /** + * Returns a promise that resolves with the job counts for the given queue + */ + getJobCounts(): Promise; /** * Tells the queue remove all jobs created outside of a grace period in milliseconds. * You can clean the jobs with the following states: completed, waiting, active, delayed, and failed. */ - clean(gracePeriod: number, jobsState?: string): Promise; + clean(grace: number, status?: JobStatus, limit?: number): Promise; /** * Listens to queue events - * 'ready', 'error', 'activ', 'progress', 'completed', 'failed', 'paused', 'resumed', 'cleaned' */ - on(eventName: string, callback: EventCallback): void; + on(event: string, callback: (...args: any[]) => void): this; + + /** + * Redis is connected and the queue is ready to accept jobs + */ + on(event: 'ready', callback: EventCallback): this; + + /** + * An error occured + */ + on(event: 'error', callback: ErrorEventCallback): this; + + /** + * A job has started. You can use `jobPromise.cancel()` to abort it + */ + on(event: 'active', callback: ActiveEventCallback): this; + + /** + * A job has been marked as stalled. + * This is useful for debugging job workers that crash or pause the event loop. + */ + on(event: 'stalled', callback: StalledEventCallback): this; + + /** + * A job's progress was updated + */ + on(event: 'progress', callback: ProgressEventCallback): this; + + /** + * A job successfully completed with a `result` + */ + on(event: 'completed', callback: CompletedEventCallback): this; + + /** + * A job failed with `err` as the reason + */ + on(event: 'failed', callback: FailedEventCallback): this; + + /** + * The queue has been paused + */ + on(event: 'paused', callback: EventCallback): this; + + /** + * The queue has been resumed + */ + on(event: 'resumed', callback: EventCallback): this; + + /** + * Old jobs have been cleaned from the queue. + * `jobs` is an array of jobs that were removed, and `type` is the type of those jobs. + * + * @see Queue#clean() for details + */ + on(event: 'cleaned', callback: CleanedEventCallback): this; } - interface EventCallback { - (...args: any[]): void - } - - interface ReadyEventCallback extends EventCallback { + export interface EventCallback { (): void; } - interface ErrorEventCallback extends EventCallback { + export interface ErrorEventCallback { (error: Error): void; } - interface JobPromise { + export interface JobPromise { /** * Abort this job */ cancel(): void } - interface ActiveEventCallback extends EventCallback { - (job: Job, jobPromise: JobPromise): void; + export interface ActiveEventCallback { + (job: Job, jobPromise?: JobPromise): void; } - interface ProgressEventCallback extends EventCallback { + export interface StalledEventCallback { + (job: Job): void; + } + + export interface ProgressEventCallback { (job: Job, progress: any): void; } - interface CompletedEventCallback extends EventCallback { - (job: Job, result: Object): void; + export interface CompletedEventCallback { + (job: Job, result: any): void; } - interface FailedEventCallback extends EventCallback { + export interface FailedEventCallback { (job: Job, error: Error): void; } - interface PausedEventCallback extends EventCallback { - (): void; - } - - interface ResumedEventCallback extends EventCallback { - (job?: Job): void; - } - - /** - * @see clean() for details - */ - interface CleanedEventCallback extends EventCallback { - (jobs: Job[], type: string): void; + export interface CleanedEventCallback { + (jobs: Job[], status: JobStatus): void; } } export = Bull; -} - -declare module "bull/lib/priority-queue" { - - import * as Bull from "bull"; - import * as Redis from "redis"; - - /** - * This is the Queue constructor of priority queue. - * - * It works same a normal queue, with same function and parameters. - * The only difference is that the Queue#add() allow an options opts.priority - * that could take ["low", "normal", "medium", "hight", "critical"]. If no options provider, "normal" will be taken. - * - * The priority queue will process more often highter priority jobs than lower. - */ - function PQueue(queueName: string, redisPort: number, redisHost: string, redisOpt?: Redis.ClientOpts): PQueue.PriorityQueue; - - namespace PQueue { - - export interface AddOptions extends Bull.AddOptions { - - /** - * "low", "normal", "medium", "high", "critical" - */ - priority?: string; - } - - - export interface PriorityQueue extends Bull.Queue { - - /** - * Creates a new job and adds it to the queue. - * If the queue is empty the job will be executed directly, - * otherwise it will be placed in the queue and executed as soon as possible. - */ - add(data: Object, opts?: PQueue.AddOptions): Promise; - - } - } - - export = PQueue; -} +} \ No newline at end of file diff --git a/types/bull/v2/bull-tests.tsx b/types/bull/v2/bull-tests.tsx new file mode 100644 index 0000000000..fcf339b3c3 --- /dev/null +++ b/types/bull/v2/bull-tests.tsx @@ -0,0 +1,115 @@ +/** + * Created by Bruno Grieder + */ + +import * as Queue from "bull" + +var videoQueue = Queue( 'video transcoding', 6379, '127.0.0.1' ); +var audioQueue = Queue( 'audio transcoding', 6379, '127.0.0.1' ); +var imageQueue = Queue( 'image transcoding', 6379, '127.0.0.1' ); + +videoQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { + + // job.data contains the custom data passed when the job was created + // job.jobId contains id of this job. + + // transcode video asynchronously and report progress + job.progress( 42 ); + + // call done when finished + done(); + + // or give a error if error + done( Error( 'error transcoding' ) ); + + // or pass it a result + done( null, { framerate: 29.5 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw (Error( 'some unexpected error' )); +} ); + +audioQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { + // transcode audio asynchronously and report progress + job.progress( 42 ); + + // call done when finished + done(); + + // or give a error if error + done( Error( 'error transcoding' ) ); + + // or pass it a result + done( null, { samplerate: 48000 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw (Error( 'some unexpected error' )); +} ); + +imageQueue.process( ( job: Queue.Job, done: Queue.DoneCallback ) => { + // transcode image asynchronously and report progress + job.progress( 42 ); + + // call done when finished + done(); + + // or give a error if error + done( Error( 'error transcoding' ) ); + + // or pass it a result + done( null, { width: 1280, height: 720 /* etc... */ } ); + + // If the job throws an unhandled exception it is also handled correctly + throw (Error( 'some unexpected error' )); +} ); + +videoQueue.add( { video: 'http://example.com/video1.mov' } ); +audioQueue.add( { audio: 'http://example.com/audio1.mp3' } ); +imageQueue.add( { image: 'http://example.com/image1.tiff' } ); + + +////////////////////////////////////////////////////////////////////////////////// +// +// Using Promises +// +////////////////////////////////////////////////////////////////////////////////// + +const fetchVideo = ( url: string ): Promise => { return null } +const transcodeVideo = ( data: any ): Promise => { return null } + +interface VideoJob extends Queue.Job { + data: {url: string} +} + + +videoQueue.process( ( job: VideoJob ) => { // don't forget to remove the done callback! + // Simply return a promise + fetchVideo( job.data.url ).then( transcodeVideo ); + + // Handles promise rejection + Promise.reject( new Error( 'error transcoding' ) ); + + // Passes the value the promise is resolved with to the "completed" event + Promise.resolve( { framerate: 29.5 /* etc... */ } ); + + // same as + Promise.reject( new Error( 'some unexpected error' ) ); + + // If the job throws an unhandled exception it is also handled correctly + throw new Error( 'some unexpected error' ); +} ); + + +var addVideo1Job = videoQueue.add( { video: 'http://example.com/video1.mov' } ); + +addVideo1Job.then((video1Job) => { + // When job has successfully be placed in the queue the job is returned + // then wait for completion + return video1Job.finished(); +}) +.then(() => { + // video1Job completed successfully +}) +.catch((err) => { + // error +}); diff --git a/types/bull/v2/index.d.ts b/types/bull/v2/index.d.ts new file mode 100644 index 0000000000..3c89655101 --- /dev/null +++ b/types/bull/v2/index.d.ts @@ -0,0 +1,316 @@ +// Type definitions for bull 2.1.2 +// Project: https://github.com/OptimalBits/bull +// Definitions by: Bruno Grieder , Cameron Crothers +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "bull" { + + import * as Redis from "redis"; + + /** + * This is the Queue constructor. + * It creates a new Queue that is persisted in Redis. + * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session. + */ + function Bull(queueName: string, redisPort: number, redisHost: string, redisOpt?: Redis.ClientOpts): Bull.Queue; + + namespace Bull { + + export interface DoneCallback { + (error?: Error, value?: any): void + } + + export interface Job { + + jobId: string + + /** + * The custom data passed when the job was created + */ + data: Object; + + /** + * Report progress on a job + */ + progress(value: any): Promise; + + /** + * Removes a Job from the queue from all the lists where it may be included. + * @returns {Promise} A promise that resolves when the job is removed. + */ + remove(): Promise; + + /** + * Rerun a Job that has failed. + * @returns {Promise} A promise that resolves when the job is scheduled for retry. + */ + retry(): Promise; + + /** + * Returns a promise the resolves when the job has been finished. + * TODO: Add a watchdog to check if the job has finished periodically. + * since pubsub does not give any guarantees. + */ + finished(): Promise; + } + + export interface Backoff { + + /** + * Backoff type, which can be either `fixed` or `exponential` + */ + type: string + + /** + * Backoff delay, in milliseconds + */ + delay: number; + } + + export interface AddOptions { + /** + * An amount of miliseconds to wait until this job can be processed. + * Note that for accurate delays, both server and clients should have their clocks synchronized + */ + delay?: number; + + /** + * A number of attempts to retry if the job fails [optional] + */ + attempts?: number; + + /** + * Backoff setting for automatic retries if the job fails + */ + backoff?: number | Backoff + + /** + * A boolean which, if true, adds the job to the right + * of the queue instead of the left (default false) + */ + lifo?: boolean; + + /** + * The number of milliseconds after which the job should be fail with a timeout error + */ + timeout?: number; + } + + export interface Queue { + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * The done callback can be called with an Error instance, to signal that the job did not complete successfully, + * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. + * Errors will be passed as a second argument to the "failed" event; + * results, as a second argument to the "completed" event. + * + * concurrency: Bull will then call you handler in parallel respecting this max number. + */ + process(concurrency: number, callback: (job: Job, done: DoneCallback) => void): void; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * The done callback can be called with an Error instance, to signal that the job did not complete successfully, + * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. + * Errors will be passed as a second argument to the "failed" event; + * results, as a second argument to the "completed" event. + */ + process(callback: (job: Job, done: DoneCallback) => void): void; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * A promise must be returned to signal job completion. + * If the promise is rejected, the error will be passed as a second argument to the "failed" event. + * If it is resolved, its value will be the "completed" event's second argument. + * + * concurrency: Bull will then call you handler in parallel respecting this max number. + */ + process(concurrency: number, callback: (job: Job) => void): Promise; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * A promise must be returned to signal job completion. + * If the promise is rejected, the error will be passed as a second argument to the "failed" event. + * If it is resolved, its value will be the "completed" event's second argument. + */ + process(callback: (job: Job) => void): Promise; + + // process(callback: (job: Job, done?: DoneCallback) => void): Promise; + + /** + * Creates a new job and adds it to the queue. + * If the queue is empty the job will be executed directly, + * otherwise it will be placed in the queue and executed as soon as possible. + */ + add(data: Object, opts?: AddOptions): Promise; + + /** + * Returns a promise that resolves when the queue is paused. + * The pause is global, meaning that all workers in all queue instances for a given queue will be paused. + * A paused queue will not process new jobs until resumed, + * but current jobs being processed will continue until they are finalized. + * + * Pausing a queue that is already paused does nothing. + */ + pause(): Promise; + + /** + * Returns a promise that resolves when the queue is resumed after being paused. + * The resume is global, meaning that all workers in all queue instances for a given queue will be resumed. + * + * Resuming a queue that is not paused does nothing. + */ + resume(): Promise; + + /** + * Returns a promise that returns the number of jobs in the queue, waiting or paused. + * Since there may be other processes adding or processing jobs, this value may be true only for a very small amount of time. + */ + count(): Promise; + + /** + * Empties a queue deleting all the input lists and associated jobs. + */ + empty(): Promise; + + /** + * Closes the underlying redis client. Use this to perform a graceful shutdown. + * + * `close` can be called from anywhere, with one caveat: + * if called from within a job handler the queue won't close until after the job has been processed + */ + close(): Promise; + + /** + * Returns a promise that will return the job instance associated with the jobId parameter. + * If the specified job cannot be located, the promise callback parameter will be set to null. + */ + getJob(jobId: string): Promise; + + /** + * Tells the queue remove all jobs created outside of a grace period in milliseconds. + * You can clean the jobs with the following states: completed, waiting, active, delayed, and failed. + */ + clean(gracePeriod: number, jobsState?: string): Promise; + + /** + * Listens to queue events + * 'ready', 'error', 'activ', 'progress', 'completed', 'failed', 'paused', 'resumed', 'cleaned' + */ + on(eventName: string, callback: EventCallback): void; + } + + interface EventCallback { + (...args: any[]): void + } + + interface ReadyEventCallback extends EventCallback { + (): void; + } + + interface ErrorEventCallback extends EventCallback { + (error: Error): void; + } + + interface JobPromise { + /** + * Abort this job + */ + cancel(): void + } + + interface ActiveEventCallback extends EventCallback { + (job: Job, jobPromise: JobPromise): void; + } + + interface ProgressEventCallback extends EventCallback { + (job: Job, progress: any): void; + } + + interface CompletedEventCallback extends EventCallback { + (job: Job, result: Object): void; + } + + interface FailedEventCallback extends EventCallback { + (job: Job, error: Error): void; + } + + interface PausedEventCallback extends EventCallback { + (): void; + } + + interface ResumedEventCallback extends EventCallback { + (job?: Job): void; + } + + /** + * @see clean() for details + */ + interface CleanedEventCallback extends EventCallback { + (jobs: Job[], type: string): void; + } + } + + export = Bull; +} + +declare module "bull/lib/priority-queue" { + + import * as Bull from "bull"; + import * as Redis from "redis"; + + /** + * This is the Queue constructor of priority queue. + * + * It works same a normal queue, with same function and parameters. + * The only difference is that the Queue#add() allow an options opts.priority + * that could take ["low", "normal", "medium", "hight", "critical"]. If no options provider, "normal" will be taken. + * + * The priority queue will process more often highter priority jobs than lower. + */ + function PQueue(queueName: string, redisPort: number, redisHost: string, redisOpt?: Redis.ClientOpts): PQueue.PriorityQueue; + + namespace PQueue { + + export interface AddOptions extends Bull.AddOptions { + + /** + * "low", "normal", "medium", "high", "critical" + */ + priority?: string; + } + + + export interface PriorityQueue extends Bull.Queue { + + /** + * Creates a new job and adds it to the queue. + * If the queue is empty the job will be executed directly, + * otherwise it will be placed in the queue and executed as soon as possible. + */ + add(data: Object, opts?: PQueue.AddOptions): Promise; + + } + } + + export = PQueue; +} diff --git a/types/bull/v2/tsconfig.json b/types/bull/v2/tsconfig.json new file mode 100644 index 0000000000..2948048b1e --- /dev/null +++ b/types/bull/v2/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "paths": { + "bull": [ "bull/v2" ], + "bull/*": [ "bull/v2/*" ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bull-tests.tsx" + ] +} \ No newline at end of file From 7b31b3d5c3fab990005a8a78e57f986e22195798 Mon Sep 17 00:00:00 2001 From: marshall007 Date: Tue, 6 Jun 2017 12:21:02 -0500 Subject: [PATCH 032/286] @types/bull: add tslint config --- types/bull/tslint.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 types/bull/tslint.json diff --git a/types/bull/tslint.json b/types/bull/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/bull/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file From 92f5e11c43d6867f9138b0c16309bbf4fb670008 Mon Sep 17 00:00:00 2001 From: marshall007 Date: Tue, 6 Jun 2017 13:20:16 -0500 Subject: [PATCH 033/286] @types/bull: fix all linting issues --- types/bull/bull-tests.tsx | 26 +- types/bull/index.d.ts | 813 ++++++++++++++++++-------------------- 2 files changed, 404 insertions(+), 435 deletions(-) diff --git a/types/bull/bull-tests.tsx b/types/bull/bull-tests.tsx index 2ff4579931..1552febf85 100644 --- a/types/bull/bull-tests.tsx +++ b/types/bull/bull-tests.tsx @@ -2,15 +2,14 @@ * Created by Bruno Grieder */ -import * as Queue from "bull" +import * as Queue from "bull"; -var videoQueue = new Queue('video transcoding', 'redis://127.0.0.1:6379'); -var audioQueue = new Queue('audio transcoding', {redis: {port: 6379, host: '127.0.0.1'}}); // Specify Redis connection using object -var imageQueue = new Queue('image transcoding'); -var pdfQueue = new Queue('pdf transcoding'); - -videoQueue.process(function(job, done){ +const videoQueue = new Queue('video transcoding', 'redis://127.0.0.1:6379'); +const audioQueue = new Queue('audio transcoding', {redis: {port: 6379, host: '127.0.0.1'}}); // Specify Redis connection using object +const imageQueue = new Queue('image transcoding'); +const pdfQueue = new Queue('pdf transcoding'); +videoQueue.process((job, done) => { // job.data contains the custom data passed when the job was created // job.jobId contains id of this job. @@ -30,7 +29,7 @@ videoQueue.process(function(job, done){ throw new Error('some unexpected error'); }); -audioQueue.process(function(job, done){ +audioQueue.process((job, done) => { // transcode audio asynchronously and report progress job.progress(42); @@ -47,7 +46,7 @@ audioQueue.process(function(job, done){ throw new Error('some unexpected error'); }); -imageQueue.process(function(job, done){ +imageQueue.process((job, done) => { // transcode image asynchronously and report progress job.progress(42); @@ -68,20 +67,17 @@ videoQueue.add({video: 'http://example.com/video1.mov'}); audioQueue.add({audio: 'http://example.com/audio1.mp3'}); imageQueue.add({image: 'http://example.com/image1.tiff'}); - ////////////////////////////////////////////////////////////////////////////////// // // Using Promises // ////////////////////////////////////////////////////////////////////////////////// - -pdfQueue.process(function(job){ +pdfQueue.process((job) => { // Processors can also return promises instead of using the done callback return Promise.resolve(); }); - videoQueue.add({ video: 'http://example.com/video1.mov' }, { jobId: 1 }) .then((video1Job) => { // When job has successfully be placed in the queue the job is returned @@ -95,14 +91,12 @@ videoQueue.add({ video: 'http://example.com/video1.mov' }, { jobId: 1 }) // error }); - ////////////////////////////////////////////////////////////////////////////////// // // Typed Event Handlers // ////////////////////////////////////////////////////////////////////////////////// - pdfQueue .on('ready', () => undefined) .on('error', (err: Error) => undefined) @@ -114,4 +108,4 @@ pdfQueue .on('failed', (job: Queue.Job) => undefined) .on('paused', () => undefined) .on('resumed', () => undefined) -.on('cleaned', (jobs: Queue.Job[], status: Queue.JobStatus) => undefined) +.on('cleaned', (jobs: Queue.Job[], status: Queue.JobStatus) => undefined); diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index 3c49109903..7959629044 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -1,432 +1,407 @@ -// Type definitions for bull v.3.0.0-rc.2 +// Type definitions for bull 3.0 // Project: https://github.com/OptimalBits/bull // Definitions by: Bruno Grieder // Cameron Crothers // Marshall Cottrell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +import * as Redis from "redis"; -declare module "bull" { +/** + * This is the Queue constructor. + * It creates a new Queue that is persisted in Redis. + * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session. + */ +declare var Bull: { + // tslint:disable:unified-signatures + (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; + (queueName: string, url?: string): Bull.Queue; + new (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; + new (queueName: string, url?: string): Bull.Queue; + // tslint:enable:unified-signatures +}; - import * as Redis from "redis"; +declare namespace Bull { + interface QueueOptions { + /** + * Options passed directly to the `ioredis` constructor + */ + redis?: Redis.ClientOpts; - /** - * This is the Queue constructor. - * It creates a new Queue that is persisted in Redis. - * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session. - */ - var Bull: { - (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; - (queueName: string, url?: string): Bull.Queue; - new (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; - new (queueName: string, url?: string): Bull.Queue; + /** + * Prefix to use for all redis keys + */ + prefix?: string; + + settings?: AdvancedSettings; } - namespace Bull { - - export interface QueueOptions { - - /** - * Options passed directly to the `ioredis` constructor - */ - redis?: Redis.ClientOpts; - - /** - * Prefix to use for all redis keys - */ - prefix?: string; - - settings?: AdvancedSettings; - } - - export interface AdvancedSettings { - - /** - * Key expiration time for job locks - */ - lockDuration?: number; - - /** - * How often check for stalled jobs (use 0 for never checking) - */ - stalledInterval?: number; - - /** - * Max amount of times a stalled job will be re-processed - */ - maxStalledCount?: number; - - /** - * Poll interval for delayed jobs and added jobs - */ - guardInterval?: number; - - /** - * Delay before processing next job in case of internal error - */ - retryProcessDelay?: number; - } - - export interface DoneCallback { - (error?: Error | null, value?: any): void - } - - export type JobId = number | string; - - export interface Job { - - id: JobId; - - /** - * The custom data passed when the job was created - */ - data: any; - - /** - * Report progress on a job - */ - progress(value: any): Promise; - - /** - * Removes a job from the queue and from any lists it may be included in. - * @returns {Promise} A promise that resolves when the job is removed. - */ - remove(): Promise; - - /** - * Re-run a job that has failed. - * @returns {Promise} A promise that resolves when the job is scheduled for retry. - */ - retry(): Promise; - - /** - * Returns a promise the resolves when the job has been finished. - * TODO: Add a watchdog to check if the job has finished periodically. - * since pubsub does not give any guarantees. - */ - finished(): Promise; - } - - export type JobStatus = 'completed' | 'waiting' | 'active' | 'delayed' | 'failed'; - - export interface BackoffOptions { - - /** - * Backoff type, which can be either `fixed` or `exponential` - */ - type: 'fixed' | 'exponential'; - - /** - * Backoff delay, in milliseconds - */ - delay: number; - } - - export interface RepeatOptions { - - /** - * Cron pattern specifying when the job should execute - */ - cron: string; - - /** - * Timezone - */ - tz?: string; - - /** - * End date when the repeat job should stop repeating - */ - endDate?: Date | string | number; - } - - export interface JobOptions { - - /** - * Optional priority value. ranges from 1 (highest priority) to MAX_INT (lowest priority). - * Note that using priorities has a slight impact on performance, so do not use it if not required - */ - priority?: number; - - /** - * An amount of miliseconds to wait until this job can be processed. - * Note that for accurate delays, both server and clients should have their clocks synchronized. [optional] - */ - delay?: number; - - /** - * The total number of attempts to try the job until it completes - */ - attempts?: number; - - /** - * Repeat job according to a cron specification - */ - repeat?: RepeatOptions; - - /** - * Backoff setting for automatic retries if the job fails - */ - backoff?: number | BackoffOptions; - - /** - * A boolean which, if true, adds the job to the right - * of the queue instead of the left (default false) - */ - lifo?: boolean; - - /** - * The number of milliseconds after which the job should be fail with a timeout error - */ - timeout?: number; - - /** - * Override the job ID - by default, the job ID is a unique - * integer, but you can use this setting to override it. - * If you use this option, it is up to you to ensure the - * jobId is unique. If you attempt to add a job with an id that - * already exists, it will not be added. - */ - jobId?: JobId; - - /** - * A boolean which, if true, removes the job when it successfully completes. - * Default behavior is to keep the job in the completed set. - */ - removeOnComplete?: boolean; - - /** - * A boolean which, if true, removes the job when it fails after all attempts - * Default behavior is to keep the job in the completed set. - */ - removeOnFail?: boolean; - } - - export interface JobCounts { - wait: number; - active: number; - completed: number; - failed: number; - delayed: number; - } - - export interface Queue { - - /** - * Defines a processing function for the jobs placed into a given Queue. - * - * The callback is called everytime a job is placed in the queue. - * It is passed an instance of the job as first argument. - * - * The done callback can be called with an Error instance, to signal that the job did not complete successfully, - * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. - * Errors will be passed as a second argument to the "failed" event; - * results, as a second argument to the "completed" event. - * - * concurrency: Bull will then call you handler in parallel respecting this max number. - */ - process(concurrency: number, callback: (job: Job, done: DoneCallback) => void): void; - - /** - * Defines a processing function for the jobs placed into a given Queue. - * - * The callback is called everytime a job is placed in the queue. - * It is passed an instance of the job as first argument. - * - * The done callback can be called with an Error instance, to signal that the job did not complete successfully, - * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. - * Errors will be passed as a second argument to the "failed" event; - * results, as a second argument to the "completed" event. - */ - process(callback: (job: Job, done: DoneCallback) => void): void; - - /** - * Defines a processing function for the jobs placed into a given Queue. - * - * The callback is called everytime a job is placed in the queue. - * It is passed an instance of the job as first argument. - * - * A promise must be returned to signal job completion. - * If the promise is rejected, the error will be passed as a second argument to the "failed" event. - * If it is resolved, its value will be the "completed" event's second argument. - * - * concurrency: Bull will then call you handler in parallel respecting this max number. - */ - process(concurrency: number, callback: (job: Job) => void): Promise; - - /** - * Defines a processing function for the jobs placed into a given Queue. - * - * The callback is called everytime a job is placed in the queue. - * It is passed an instance of the job as first argument. - * - * A promise must be returned to signal job completion. - * If the promise is rejected, the error will be passed as a second argument to the "failed" event. - * If it is resolved, its value will be the "completed" event's second argument. - */ - process(callback: (job: Job) => void): Promise; - - /** - * Creates a new job and adds it to the queue. - * If the queue is empty the job will be executed directly, - * otherwise it will be placed in the queue and executed as soon as possible. - */ - add(data: Object, opts?: JobOptions): Promise; - - /** - * Returns a promise that resolves when the queue is paused. - * The pause is global, meaning that all workers in all queue instances for a given queue will be paused. - * A paused queue will not process new jobs until resumed, - * but current jobs being processed will continue until they are finalized. - * - * Pausing a queue that is already paused does nothing. - */ - pause(): Promise; - - /** - * Returns a promise that resolves when the queue is resumed after being paused. - * The resume is global, meaning that all workers in all queue instances for a given queue will be resumed. - * - * Resuming a queue that is not paused does nothing. - */ - resume(): Promise; - - /** - * Returns a promise that returns the number of jobs in the queue, waiting or paused. - * Since there may be other processes adding or processing jobs, this value may be true only for a very small amount of time. - */ - count(): Promise; - - /** - * Empties a queue deleting all the input lists and associated jobs. - */ - empty(): Promise; - - /** - * Closes the underlying redis client. Use this to perform a graceful shutdown. - * - * `close` can be called from anywhere, with one caveat: - * if called from within a job handler the queue won't close until after the job has been processed - */ - close(): Promise; - - /** - * Returns a promise that will return the job instance associated with the jobId parameter. - * If the specified job cannot be located, the promise callback parameter will be set to null. - */ - getJob(jobId: JobId): Promise; - - /** - * Returns a promise that resolves with the job counts for the given queue - */ - getJobCounts(): Promise; - - /** - * Tells the queue remove all jobs created outside of a grace period in milliseconds. - * You can clean the jobs with the following states: completed, waiting, active, delayed, and failed. - */ - clean(grace: number, status?: JobStatus, limit?: number): Promise; - - /** - * Listens to queue events - */ - on(event: string, callback: (...args: any[]) => void): this; - - /** - * Redis is connected and the queue is ready to accept jobs - */ - on(event: 'ready', callback: EventCallback): this; - - /** - * An error occured - */ - on(event: 'error', callback: ErrorEventCallback): this; - - /** - * A job has started. You can use `jobPromise.cancel()` to abort it - */ - on(event: 'active', callback: ActiveEventCallback): this; - - /** - * A job has been marked as stalled. - * This is useful for debugging job workers that crash or pause the event loop. - */ - on(event: 'stalled', callback: StalledEventCallback): this; - - /** - * A job's progress was updated - */ - on(event: 'progress', callback: ProgressEventCallback): this; - - /** - * A job successfully completed with a `result` - */ - on(event: 'completed', callback: CompletedEventCallback): this; - - /** - * A job failed with `err` as the reason - */ - on(event: 'failed', callback: FailedEventCallback): this; - - /** - * The queue has been paused - */ - on(event: 'paused', callback: EventCallback): this; - - /** - * The queue has been resumed - */ - on(event: 'resumed', callback: EventCallback): this; - - /** - * Old jobs have been cleaned from the queue. - * `jobs` is an array of jobs that were removed, and `type` is the type of those jobs. - * - * @see Queue#clean() for details - */ - on(event: 'cleaned', callback: CleanedEventCallback): this; - } - - export interface EventCallback { - (): void; - } - - export interface ErrorEventCallback { - (error: Error): void; - } - - export interface JobPromise { - /** - * Abort this job - */ - cancel(): void - } - - export interface ActiveEventCallback { - (job: Job, jobPromise?: JobPromise): void; - } - - export interface StalledEventCallback { - (job: Job): void; - } - - export interface ProgressEventCallback { - (job: Job, progress: any): void; - } - - export interface CompletedEventCallback { - (job: Job, result: any): void; - } - - export interface FailedEventCallback { - (job: Job, error: Error): void; - } - - export interface CleanedEventCallback { - (jobs: Job[], status: JobStatus): void; - } + interface AdvancedSettings { + /** + * Key expiration time for job locks + */ + lockDuration?: number; + + /** + * How often check for stalled jobs (use 0 for never checking) + */ + stalledInterval?: number; + + /** + * Max amount of times a stalled job will be re-processed + */ + maxStalledCount?: number; + + /** + * Poll interval for delayed jobs and added jobs + */ + guardInterval?: number; + + /** + * Delay before processing next job in case of internal error + */ + retryProcessDelay?: number; } - export = Bull; -} \ No newline at end of file + type DoneCallback = (error?: Error | null, value?: any) => void; + + type JobId = number | string; + + interface Job { + id: JobId; + + /** + * The custom data passed when the job was created + */ + data: any; + + /** + * Report progress on a job + */ + progress(value: any): Promise; + + /** + * Removes a job from the queue and from any lists it may be included in. + * @returns {Promise} A promise that resolves when the job is removed. + */ + remove(): Promise; + + /** + * Re-run a job that has failed. + * @returns {Promise} A promise that resolves when the job is scheduled for retry. + */ + retry(): Promise; + + /** + * Returns a promise the resolves when the job has been finished. + * TODO: Add a watchdog to check if the job has finished periodically. + * since pubsub does not give any guarantees. + */ + finished(): Promise; + } + + type JobStatus = 'completed' | 'waiting' | 'active' | 'delayed' | 'failed'; + + interface BackoffOptions { + /** + * Backoff type, which can be either `fixed` or `exponential` + */ + type: 'fixed' | 'exponential'; + + /** + * Backoff delay, in milliseconds + */ + delay: number; + } + + interface RepeatOptions { + /** + * Cron pattern specifying when the job should execute + */ + cron: string; + + /** + * Timezone + */ + tz?: string; + + /** + * End date when the repeat job should stop repeating + */ + endDate?: Date | string | number; + } + + interface JobOptions { + /** + * Optional priority value. ranges from 1 (highest priority) to MAX_INT (lowest priority). + * Note that using priorities has a slight impact on performance, so do not use it if not required + */ + priority?: number; + + /** + * An amount of miliseconds to wait until this job can be processed. + * Note that for accurate delays, both server and clients should have their clocks synchronized. [optional] + */ + delay?: number; + + /** + * The total number of attempts to try the job until it completes + */ + attempts?: number; + + /** + * Repeat job according to a cron specification + */ + repeat?: RepeatOptions; + + /** + * Backoff setting for automatic retries if the job fails + */ + backoff?: number | BackoffOptions; + + /** + * A boolean which, if true, adds the job to the right + * of the queue instead of the left (default false) + */ + lifo?: boolean; + + /** + * The number of milliseconds after which the job should be fail with a timeout error + */ + timeout?: number; + + /** + * Override the job ID - by default, the job ID is a unique + * integer, but you can use this setting to override it. + * If you use this option, it is up to you to ensure the + * jobId is unique. If you attempt to add a job with an id that + * already exists, it will not be added. + */ + jobId?: JobId; + + /** + * A boolean which, if true, removes the job when it successfully completes. + * Default behavior is to keep the job in the completed set. + */ + removeOnComplete?: boolean; + + /** + * A boolean which, if true, removes the job when it fails after all attempts + * Default behavior is to keep the job in the completed set. + */ + removeOnFail?: boolean; + } + + interface JobCounts { + wait: number; + active: number; + completed: number; + failed: number; + delayed: number; + } + + interface Queue { + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * The done callback can be called with an Error instance, to signal that the job did not complete successfully, + * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. + * Errors will be passed as a second argument to the "failed" event; + * results, as a second argument to the "completed" event. + * + * concurrency: Bull will then call you handler in parallel respecting this max number. + */ + process(concurrency: number, callback: (job: Job, done: DoneCallback) => void): void; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * The done callback can be called with an Error instance, to signal that the job did not complete successfully, + * or with a result as second argument as second argument (e.g.: done(null, result);) when the job is successful. + * Errors will be passed as a second argument to the "failed" event; + * results, as a second argument to the "completed" event. + */ + process(callback: (job: Job, done: DoneCallback) => void): void; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * A promise must be returned to signal job completion. + * If the promise is rejected, the error will be passed as a second argument to the "failed" event. + * If it is resolved, its value will be the "completed" event's second argument. + * + * concurrency: Bull will then call you handler in parallel respecting this max number. + */ + process(concurrency: number, callback: (job: Job) => void): Promise; + + /** + * Defines a processing function for the jobs placed into a given Queue. + * + * The callback is called everytime a job is placed in the queue. + * It is passed an instance of the job as first argument. + * + * A promise must be returned to signal job completion. + * If the promise is rejected, the error will be passed as a second argument to the "failed" event. + * If it is resolved, its value will be the "completed" event's second argument. + */ + process(callback: (job: Job) => void): Promise; + + /** + * Creates a new job and adds it to the queue. + * If the queue is empty the job will be executed directly, + * otherwise it will be placed in the queue and executed as soon as possible. + */ + add(data: any, opts?: JobOptions): Promise; + + /** + * Returns a promise that resolves when the queue is paused. + * The pause is global, meaning that all workers in all queue instances for a given queue will be paused. + * A paused queue will not process new jobs until resumed, + * but current jobs being processed will continue until they are finalized. + * + * Pausing a queue that is already paused does nothing. + */ + pause(): Promise; + + /** + * Returns a promise that resolves when the queue is resumed after being paused. + * The resume is global, meaning that all workers in all queue instances for a given queue will be resumed. + * + * Resuming a queue that is not paused does nothing. + */ + resume(): Promise; + + /** + * Returns a promise that returns the number of jobs in the queue, waiting or paused. + * Since there may be other processes adding or processing jobs, this value may be true only for a very small amount of time. + */ + count(): Promise; + + /** + * Empties a queue deleting all the input lists and associated jobs. + */ + empty(): Promise; + + /** + * Closes the underlying redis client. Use this to perform a graceful shutdown. + * + * `close` can be called from anywhere, with one caveat: + * if called from within a job handler the queue won't close until after the job has been processed + */ + close(): Promise; + + /** + * Returns a promise that will return the job instance associated with the jobId parameter. + * If the specified job cannot be located, the promise callback parameter will be set to null. + */ + getJob(jobId: JobId): Promise; + + /** + * Returns a promise that resolves with the job counts for the given queue + */ + getJobCounts(): Promise; + + /** + * Tells the queue remove all jobs created outside of a grace period in milliseconds. + * You can clean the jobs with the following states: completed, waiting, active, delayed, and failed. + */ + clean(grace: number, status?: JobStatus, limit?: number): Promise; + + // tslint:disable:unified-signatures + + /** + * Listens to queue events + */ + on(event: string, callback: (...args: any[]) => void): this; + + /** + * Redis is connected and the queue is ready to accept jobs + */ + on(event: 'ready', callback: EventCallback): this; + + /** + * An error occured + */ + on(event: 'error', callback: ErrorEventCallback): this; + + /** + * A job has started. You can use `jobPromise.cancel()` to abort it + */ + on(event: 'active', callback: ActiveEventCallback): this; + + /** + * A job has been marked as stalled. + * This is useful for debugging job workers that crash or pause the event loop. + */ + on(event: 'stalled', callback: StalledEventCallback): this; + + /** + * A job's progress was updated + */ + on(event: 'progress', callback: ProgressEventCallback): this; + + /** + * A job successfully completed with a `result` + */ + on(event: 'completed', callback: CompletedEventCallback): this; + + /** + * A job failed with `err` as the reason + */ + on(event: 'failed', callback: FailedEventCallback): this; + + /** + * The queue has been paused + */ + on(event: 'paused', callback: EventCallback): this; + + /** + * The queue has been resumed + */ + on(event: 'resumed', callback: EventCallback): this; + + /** + * Old jobs have been cleaned from the queue. + * `jobs` is an array of jobs that were removed, and `type` is the type of those jobs. + * + * @see Queue#clean() for details + */ + on(event: 'cleaned', callback: CleanedEventCallback): this; + + // tslint:enable:unified-signatures + } + + type EventCallback = () => void; + + type ErrorEventCallback = (error: Error) => void; + + interface JobPromise { + /** + * Abort this job + */ + cancel(): void; + } + + type ActiveEventCallback = (job: Job, jobPromise?: JobPromise) => void; + + type StalledEventCallback = (job: Job) => void; + + type ProgressEventCallback = (job: Job, progress: any) => void; + + type CompletedEventCallback = (job: Job, result: any) => void; + + type FailedEventCallback = (job: Job, error: Error) => void; + + type CleanedEventCallback = (jobs: Job[], status: JobStatus) => void; +} + +export = Bull; From 68455302694afea03e4ca58d508e35c4444b7d44 Mon Sep 17 00:00:00 2001 From: marshall007 Date: Tue, 6 Jun 2017 13:31:53 -0500 Subject: [PATCH 034/286] @types/bull: fix redis import --- types/bull/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index 7959629044..926952f6c2 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -5,7 +5,7 @@ // Marshall Cottrell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import * as Redis from "redis"; +import * as Redis from "ioredis"; /** * This is the Queue constructor. @@ -26,7 +26,7 @@ declare namespace Bull { /** * Options passed directly to the `ioredis` constructor */ - redis?: Redis.ClientOpts; + redis?: Redis.RedisOptions; /** * Prefix to use for all redis keys From 0ccd259f043e5351db216526dc6ae76205b150b4 Mon Sep 17 00:00:00 2001 From: marshall007 Date: Tue, 6 Jun 2017 14:43:09 -0500 Subject: [PATCH 035/286] @types/bull: fix `typeRoots` and `baseUrl` for v2 --- types/bull/tsconfig.json | 8 ++------ types/bull/v2/tsconfig.json | 10 +++------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/types/bull/tsconfig.json b/types/bull/tsconfig.json index 56a53750f3..0751a977c1 100644 --- a/types/bull/tsconfig.json +++ b/types/bull/tsconfig.json @@ -1,16 +1,12 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": [ "es6" ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": [ "../" ], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true diff --git a/types/bull/v2/tsconfig.json b/types/bull/v2/tsconfig.json index 2948048b1e..12445fc199 100644 --- a/types/bull/v2/tsconfig.json +++ b/types/bull/v2/tsconfig.json @@ -1,16 +1,12 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": [ "es6" ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, - "baseUrl": "../", - "typeRoots": [ - "../" - ], + "baseUrl": "../../", + "typeRoots": [ "../../" ], "types": [], "paths": { "bull": [ "bull/v2" ], From 441c41158ed03faf0a467a72991120f8cd3b01e1 Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 6 Jun 2017 23:29:38 +0100 Subject: [PATCH 036/286] Added revparse --- types/nodegit/index.d.ts | 1 + types/nodegit/rev-parse.d.ts | 16 ++++++++++++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 18 insertions(+) create mode 100644 types/nodegit/rev-parse.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 14d88297c4..c9c349fff0 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -33,6 +33,7 @@ export { Reference } from './reference'; export { RemoteCallbacks } from './remote-callbacks'; export { Remote } from './remote'; export { Repository } from './repository'; +export { Revparse } from './rev-parse'; export { Revwalk } from './rev-walk'; export { Signature } from './signature'; export { Stash } from './stash'; diff --git a/types/nodegit/rev-parse.d.ts b/types/nodegit/rev-parse.d.ts new file mode 100644 index 0000000000..9d0136cac6 --- /dev/null +++ b/types/nodegit/rev-parse.d.ts @@ -0,0 +1,16 @@ +import { Object } from './object'; +import { Repository } from './repository'; +import { Reference } from './reference'; + +export namespace Revparse { + enum MODE { + SINGLE = 1, + RANGE = 2, + MERGE_BASE = 4 + } +} + +export class Revparse { + static ext(object_out: Object, reference_out: Reference, repo: Repository, spec: string): number; + static single(repo: Repository, spec: string): Promise; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 9e3fa9285a..e2307970d6 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -47,6 +47,7 @@ "remote-callbacks.d.ts", "remote.d.ts", "repository.d.ts", + "rev-parse.d.ts", "rev-walk.d.ts", "signature.d.ts", "stash.d.ts", From 332dd084791e96b13e350af56169f556aef84d80 Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 6 Jun 2017 23:32:39 +0100 Subject: [PATCH 037/286] Added Revert --- types/nodegit/index.d.ts | 1 + types/nodegit/revert.d.ts | 17 +++++++++++++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 19 insertions(+) create mode 100644 types/nodegit/revert.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index c9c349fff0..e2962e2cee 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -35,6 +35,7 @@ export { Remote } from './remote'; export { Repository } from './repository'; export { Revparse } from './rev-parse'; export { Revwalk } from './rev-walk'; +export { Revert } from './revert'; export { Signature } from './signature'; export { Stash } from './stash'; export { StatusEntry } from './status-entry'; diff --git a/types/nodegit/revert.d.ts b/types/nodegit/revert.d.ts new file mode 100644 index 0000000000..a1210182eb --- /dev/null +++ b/types/nodegit/revert.d.ts @@ -0,0 +1,17 @@ +import { MergeOptions } from './merge-options'; +import { CheckoutOptions } from './checkout-options'; +import { Repository } from './repository'; +import { Commit } from './commit'; +import { Index } from './index'; + +export interface RevertOptions { + version: number; + mainline: number; + mergeOpts: MergeOptions; + checkoutOpts: CheckoutOptions; +} + +export class Revert { + static revert(repo: Repository, commit: Commit, given_opts: RevertOptions): Promise; + static commit(repo: Repository, revert_commit: Commit, our_commit: Commit, mainline: number, merge_options: MergeOptions): Promise; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index e2307970d6..b8b465f84d 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -49,6 +49,7 @@ "repository.d.ts", "rev-parse.d.ts", "rev-walk.d.ts", + "revert.d.ts", "signature.d.ts", "stash.d.ts", "status-entry.d.ts", From f04f22ac45ccab878a90bba1d0aed98f498ddd0a Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 00:13:49 +0100 Subject: [PATCH 038/286] Added Reset --- types/nodegit/index.d.ts | 1 + types/nodegit/reset.d.ts | 0 types/nodegit/tsconfig.json | 1 + 3 files changed, 2 insertions(+) create mode 100644 types/nodegit/reset.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index e2962e2cee..94aa7fe1ef 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -33,6 +33,7 @@ export { Reference } from './reference'; export { RemoteCallbacks } from './remote-callbacks'; export { Remote } from './remote'; export { Repository } from './repository'; +export { Reset } from './reset'; export { Revparse } from './rev-parse'; export { Revwalk } from './rev-walk'; export { Revert } from './revert'; diff --git a/types/nodegit/reset.d.ts b/types/nodegit/reset.d.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index b8b465f84d..56641e050c 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -47,6 +47,7 @@ "remote-callbacks.d.ts", "remote.d.ts", "repository.d.ts", + "reset.d.ts", "rev-parse.d.ts", "rev-walk.d.ts", "revert.d.ts", From 95a20577f6e937a95a3c1b54e4843456cc1e0811 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 00:19:16 +0100 Subject: [PATCH 039/286] fixed Reset --- types/nodegit/reset.d.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/types/nodegit/reset.d.ts b/types/nodegit/reset.d.ts index e69de29bb2..8af3919ff4 100644 --- a/types/nodegit/reset.d.ts +++ b/types/nodegit/reset.d.ts @@ -0,0 +1,19 @@ +import { AnnotatedCommit } from './annotated-commit'; +import { Repository } from './repository'; +import { Object } from './object'; +import { Strarray } from './str-array'; +import { CheckoutOptions } from './checkout-options'; + +export namespace Reset { + enum TYPE { + SOFT = 1, + MIXED = 2, + HARD = 3 + } +} + +export class Reset { + static reset(repo: Repository, target: Object, reset_type: number, checkout_opts: CheckoutOptions): Promise; + static default(repo: Repository, target: Object, pathspecs: Strarray): Promise; + static fromAnnotated(repo: Repository, commit: AnnotatedCommit, reset_type: number, checkout_opts: CheckoutOptions): number; +} From 9bbd5e983c3e9f1377d5d8cfc6156a5b209df8d4 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 00:26:06 +0100 Subject: [PATCH 040/286] Added Reflog --- types/nodegit/index.d.ts | 1 + types/nodegit/ref-log.d.ts | 23 +++++++++++++++++++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 25 insertions(+) create mode 100644 types/nodegit/ref-log.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 94aa7fe1ef..79c6d60c54 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -28,6 +28,7 @@ export { Oidarray } from './oid-array'; export { Oid } from './oid'; export { PushOptions } from './push-options'; export { Refdb } from './ref-db'; +export { Reflog, ReflogEntry } from './ref-log' import { Refspec } from './ref-spec'; export { Reference } from './reference'; export { RemoteCallbacks } from './remote-callbacks'; diff --git a/types/nodegit/ref-log.d.ts b/types/nodegit/ref-log.d.ts new file mode 100644 index 0000000000..749f0c03a1 --- /dev/null +++ b/types/nodegit/ref-log.d.ts @@ -0,0 +1,23 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Signature } from './signature'; + +export class Reflog { + static delete(repo: Repository, name: string): number; + static entryCommitter(entry: ReflogEntry): Signature; + static entryIdNew(entry: ReflogEntry): Oid; + static entryIdOld(entry: ReflogEntry): Oid; + static entryMessage(entry: ReflogEntry): string; + static read(repo: Repository, name: string): Promise; + static rename(repo: Repository, old_name: string, name: string): number; + + append(id: Oid, committer: Signature, msg: string): number; + drop(idx: number, rewrite_previous_entry: number): number; + entryByIndex(idx: number): ReflogEntry; + entrycount(): number; + free(): void; + write(): number; +} + +export class ReflogEntry { +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 56641e050c..7dba399bca 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -42,6 +42,7 @@ "oid.d.ts", "push-options.d.ts", "ref-db.d.ts", + "ref-log.d.ts", "ref-spec.d.ts", "reference.d.ts", "remote-callbacks.d.ts", From bf5f2294ca8ec46c463511f2b9c45d485f26d8e3 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 00:27:58 +0100 Subject: [PATCH 041/286] Added RebaseOpertation --- types/nodegit/index.d.ts | 3 ++- types/nodegit/rebase-operation.d.ts | 18 ++++++++++++++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 types/nodegit/rebase-operation.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 79c6d60c54..4305b092ac 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -27,9 +27,10 @@ export { Odb } from './odb'; export { Oidarray } from './oid-array'; export { Oid } from './oid'; export { PushOptions } from './push-options'; +export { RebaseOperation } from './rebase-operation'; export { Refdb } from './ref-db'; export { Reflog, ReflogEntry } from './ref-log' -import { Refspec } from './ref-spec'; +export { Refspec } from './ref-spec'; export { Reference } from './reference'; export { RemoteCallbacks } from './remote-callbacks'; export { Remote } from './remote'; diff --git a/types/nodegit/rebase-operation.d.ts b/types/nodegit/rebase-operation.d.ts new file mode 100644 index 0000000000..a6e6e53bfa --- /dev/null +++ b/types/nodegit/rebase-operation.d.ts @@ -0,0 +1,18 @@ +import { Oid } from './oid'; + +export namespace RebaseOperation { + enum REBASE_OPERATION { + PICK = 0, + REWORD = 1, + EDIT = 2, + SQUASH = 3, + FIXUP = 4, + EXEC = 5 + } +} + +export class RebaseOperation { + type: number; + id: Oid; + exec: string; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 7dba399bca..0d52815cb5 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -41,6 +41,7 @@ "oid-array.d.ts", "oid.d.ts", "push-options.d.ts", + "rebase-operation.d.ts", "ref-db.d.ts", "ref-log.d.ts", "ref-spec.d.ts", From cc2fd5a8d85708fa2544c912064c95bbcf7e11ea Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 00:32:18 +0100 Subject: [PATCH 042/286] Added meathods to ref log --- types/nodegit/ref-log.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/nodegit/ref-log.d.ts b/types/nodegit/ref-log.d.ts index 749f0c03a1..8557d02a39 100644 --- a/types/nodegit/ref-log.d.ts +++ b/types/nodegit/ref-log.d.ts @@ -20,4 +20,8 @@ export class Reflog { } export class ReflogEntry { + committer(): Signature; + idNew(): Oid; + idOld(): Oid; + message(): string; } From 09e7e4151994672779e2e92fb7de0259edcf574f Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 00:32:24 +0100 Subject: [PATCH 043/286] Added Rebase --- types/nodegit/index.d.ts | 1 + types/nodegit/rebase.d.ts | 27 +++++++++++++++++++++++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 29 insertions(+) create mode 100644 types/nodegit/rebase.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 4305b092ac..eca21bec1c 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -28,6 +28,7 @@ export { Oidarray } from './oid-array'; export { Oid } from './oid'; export { PushOptions } from './push-options'; export { RebaseOperation } from './rebase-operation'; +export { Rebase, RebaseOptions } from './rebase'; export { Refdb } from './ref-db'; export { Reflog, ReflogEntry } from './ref-log' export { Refspec } from './ref-spec'; diff --git a/types/nodegit/rebase.d.ts b/types/nodegit/rebase.d.ts new file mode 100644 index 0000000000..15862ff17d --- /dev/null +++ b/types/nodegit/rebase.d.ts @@ -0,0 +1,27 @@ +import { CheckoutOptions } from './checkout-options'; +import { AnnotatedCommit } from './annotated-commit'; +import { Repository } from './repository'; +import { Signature } from './signature'; +import { Oid } from './oid'; +import { RebaseOperation } from './rebase-operation'; + +export interface RebaseOptions { + version: number; + quiet: number; + rewriteNotesRef: string; + checkoutOptions: CheckoutOptions; +} + +export class Rebase { + static init(repo: Repository, branch: AnnotatedCommit, upstream: AnnotatedCommit, onto: AnnotatedCommit, opts: RebaseOptions): Promise; + static initOptions(opts: RebaseOptions, version: number): number; + static open(repo: Repository, opts: RebaseOptions): Promise; + + abort(): number; + commit(author: Signature, committer: Signature, message_encoding: string, message: string): Oid; + finish(signature: Signature): number; + next(): Promise; + operationByIndex(idx: number): RebaseOperation; + operationCurrent(): number; + operationEntrycount(): number; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 0d52815cb5..3753e1d693 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -42,6 +42,7 @@ "oid.d.ts", "push-options.d.ts", "rebase-operation.d.ts", + "rebase.d.ts", "ref-db.d.ts", "ref-log.d.ts", "ref-spec.d.ts", From 5c1cf0697d657f4ed0970a8caa72091bbb33728e Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 00:43:37 +0100 Subject: [PATCH 044/286] Added Push --- types/nodegit/index.d.ts | 1 + types/nodegit/push.d.ts | 6 ++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 8 insertions(+) create mode 100644 types/nodegit/push.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index eca21bec1c..db7b3c6ed0 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -27,6 +27,7 @@ export { Odb } from './odb'; export { Oidarray } from './oid-array'; export { Oid } from './oid'; export { PushOptions } from './push-options'; +export { Push } from './push'; export { RebaseOperation } from './rebase-operation'; export { Rebase, RebaseOptions } from './rebase'; export { Refdb } from './ref-db'; diff --git a/types/nodegit/push.d.ts b/types/nodegit/push.d.ts new file mode 100644 index 0000000000..26d8f07b60 --- /dev/null +++ b/types/nodegit/push.d.ts @@ -0,0 +1,6 @@ +import { RemoteCallbacks } from './remote-callbacks'; +import { PushOptions } from './push-options'; + +export class Push { + static initOptions(opts: PushOptions, version: number): number; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 3753e1d693..5022d35c65 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -41,6 +41,7 @@ "oid-array.d.ts", "oid.d.ts", "push-options.d.ts", + "push.d.ts", "rebase-operation.d.ts", "rebase.d.ts", "ref-db.d.ts", From 73b4969fa08305aa8abf8db1de9391c905269d56 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 00:48:34 +0100 Subject: [PATCH 045/286] Added PushUpdate and Pathspec --- types/nodegit/index.d.ts | 2 ++ types/nodegit/path-spec.d.ts | 34 ++++++++++++++++++++++++++++++++++ types/nodegit/push-update.d.ts | 8 ++++++++ types/nodegit/tsconfig.json | 2 ++ 4 files changed, 46 insertions(+) create mode 100644 types/nodegit/path-spec.d.ts create mode 100644 types/nodegit/push-update.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index db7b3c6ed0..8ddc254bc6 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -26,7 +26,9 @@ export { OdbObject } from './odb-object'; export { Odb } from './odb'; export { Oidarray } from './oid-array'; export { Oid } from './oid'; +export { Pathspec } from './path-spec'; export { PushOptions } from './push-options'; +export { PushUpdate } from './push-update'; export { Push } from './push'; export { RebaseOperation } from './rebase-operation'; export { Rebase, RebaseOptions } from './rebase'; diff --git a/types/nodegit/path-spec.d.ts b/types/nodegit/path-spec.d.ts new file mode 100644 index 0000000000..d09d2812da --- /dev/null +++ b/types/nodegit/path-spec.d.ts @@ -0,0 +1,34 @@ +import { DiffDelta } from './diff-delta'; +import { Tree } from './tree'; +import { Diff } from './diff'; +import { Repository } from './repository'; +import { Index } from './index'; +import { Strarray } from './str-array'; + +export namespace Pathspec { + enum FLAG { + DEFAULT = 0, + IGNORE_CASE = 1, + USE_CASE = 2, + NO_GLOB = 4, + NO_MATCH_ERROR = 8, + FIND_FAILURES = 16, + FAILURES_ONLY = 32 + } +} + +export class Pathspec { + static matchListDiffEntry(m: any, pos: number): DiffDelta; + static matchListEntry(m: any, pos: number): string; + static matchListEntrycount(m: any): number; + static matchListFailedEntry(m: any, pos: number): string; + static matchListFailedEntrycount(m: any): number; + static create(pathspec: Strarray): Pathspec; + + free(): void; + matchDiff(diff: Diff, flags: number): Promise; + matchIndex(index: Index, flags: number): Promise; + matchTree(tree: Tree, flags: number): Promise; + matchWorkdir(repo: Repository, flags: number): Promise; + matchesPath(flags: number, path: string): number; +} diff --git a/types/nodegit/push-update.d.ts b/types/nodegit/push-update.d.ts new file mode 100644 index 0000000000..50f46726d5 --- /dev/null +++ b/types/nodegit/push-update.d.ts @@ -0,0 +1,8 @@ +import { Oid } from './oid'; + +export class PushUpdate { + srcRefname: string; + dstRefname: string; + src: Oid; + dst: Oid; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 5022d35c65..7d446ebcbd 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -40,7 +40,9 @@ "odb.d.ts", "oid-array.d.ts", "oid.d.ts", + "path-spec.d.ts", "push-options.d.ts", + "push-update.d.ts", "push.d.ts", "rebase-operation.d.ts", "rebase.d.ts", From bdd0f86ce7033bce36605ac55a451f42e41ece2b Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 00:52:15 +0100 Subject: [PATCH 046/286] Added Packbuilder --- types/nodegit/index.d.ts | 1 + types/nodegit/pack-builder.d.ts | 25 +++++++++++++++++++++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 27 insertions(+) create mode 100644 types/nodegit/pack-builder.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 8ddc254bc6..f343cd5dd6 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -26,6 +26,7 @@ export { OdbObject } from './odb-object'; export { Odb } from './odb'; export { Oidarray } from './oid-array'; export { Oid } from './oid'; +export { Packbuilder } from './pack-builder'; export { Pathspec } from './path-spec'; export { PushOptions } from './push-options'; export { PushUpdate } from './push-update'; diff --git a/types/nodegit/pack-builder.d.ts b/types/nodegit/pack-builder.d.ts new file mode 100644 index 0000000000..0f21f5f328 --- /dev/null +++ b/types/nodegit/pack-builder.d.ts @@ -0,0 +1,25 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Revwalk } from './rev-walk'; + +export namespace Packbuilder { + enum STAGE { + ADDING_OBJECTS = 0, + DELTAFICATION = 1 + } +} + +export class Packbuilder { + static create(repo: Repository): Packbuilder; + + free(): void; + hash(): Oid; + insert(id: Oid, name: string): number; + insertCommit(id: Oid): number; + insertRecur(id: Oid, name: string): number; + insertTree(id: Oid): number; + insertWalk(walk: Revwalk): number; + objectCount(): number; + setThreads(n: number): number; + written(): number; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 7d446ebcbd..6ec7d65565 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -40,6 +40,7 @@ "odb.d.ts", "oid-array.d.ts", "oid.d.ts", + "path-builder.d.ts", "path-spec.d.ts", "push-options.d.ts", "push-update.d.ts", From 4a60f79472da6b0df7f3f0b86c6154bd73a89dc2 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 00:54:30 +0100 Subject: [PATCH 047/286] fixed typo --- types/nodegit/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 6ec7d65565..1f0cfe70f9 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -40,7 +40,7 @@ "odb.d.ts", "oid-array.d.ts", "oid.d.ts", - "path-builder.d.ts", + "pack-builder.d.ts", "path-spec.d.ts", "push-options.d.ts", "push-update.d.ts", From 0fbae92912bcd278082c5cdfa2f510c2e5d647bb Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 00:55:10 +0100 Subject: [PATCH 048/286] Added Openssl --- types/nodegit/index.d.ts | 1 + types/nodegit/open-ssl.d.ts | 3 +++ types/nodegit/tsconfig.json | 1 + 3 files changed, 5 insertions(+) create mode 100644 types/nodegit/open-ssl.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index f343cd5dd6..ff8adee80e 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -26,6 +26,7 @@ export { OdbObject } from './odb-object'; export { Odb } from './odb'; export { Oidarray } from './oid-array'; export { Oid } from './oid'; +export { Openssl } from './open-ssl'; export { Packbuilder } from './pack-builder'; export { Pathspec } from './path-spec'; export { PushOptions } from './push-options'; diff --git a/types/nodegit/open-ssl.d.ts b/types/nodegit/open-ssl.d.ts new file mode 100644 index 0000000000..f8370260d5 --- /dev/null +++ b/types/nodegit/open-ssl.d.ts @@ -0,0 +1,3 @@ +export class Openssl { + static setLocking(): number; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 1f0cfe70f9..0e297fb291 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -40,6 +40,7 @@ "odb.d.ts", "oid-array.d.ts", "oid.d.ts", + "open-ssl.d.ts", "pack-builder.d.ts", "path-spec.d.ts", "push-options.d.ts", From 13e07d9e23849a9b84cd11a154a126790128323c Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 00:58:49 +0100 Subject: [PATCH 049/286] Added Note --- types/nodegit/index.d.ts | 1 + types/nodegit/note.d.ts | 18 ++++++++++++++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 20 insertions(+) create mode 100644 types/nodegit/note.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index ff8adee80e..4f232c4cf7 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -21,6 +21,7 @@ export { IndexEntry } from './index-entry'; export { MergeFileInput } from './merge-file-input'; export { MergeOptions } from './merge-options'; export { Merge } from './merge'; +export { Note } from './note'; export { Object } from './object'; export { OdbObject } from './odb-object'; export { Odb } from './odb'; diff --git a/types/nodegit/note.d.ts b/types/nodegit/note.d.ts new file mode 100644 index 0000000000..2ea74b9df8 --- /dev/null +++ b/types/nodegit/note.d.ts @@ -0,0 +1,18 @@ +import {Repository} from './repository'; +import {Signature} from './signature'; +import {Oid} from './oid'; + +export class Note { + static create(repo: Repository, notes_ref: string, author: Signature, committer: Signature, oid: Oid, note: string, force: number): Promise; + static foreach(repo: Repository, notes_ref: string, note_cb: Function, payload: void): Promise; + static iteratorNew(repo: Repository, notes_ref: string): Promise; + static next(note_id: Oid, annotated_id: Oid, it: any): number; + static read(repo: Repository, notes_ref: string, oid: Oid): Promise; + static remove(repo: Repository, notes_ref: string, author: Signature, committer: Signature, oid: Oid): Promise; + + author(): Signature; + committer(): Signature; + free(): void; + id(): Oid; + message(): string; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 0e297fb291..32102a2de8 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -35,6 +35,7 @@ "merge-options.d.ts", "merge.d.ts", "nodegit-tests.ts", + "note.d.ts", "object.d.ts", "odb-object.d.ts", "odb.d.ts", From 98b385b76d86271b708d9ed0116004bfe60e2c98 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 01:31:28 +0100 Subject: [PATCH 050/286] Added MergeFileResult --- types/nodegit/index.d.ts | 1 + types/nodegit/merge-file-result.d.ts | 7 +++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 9 insertions(+) create mode 100644 types/nodegit/merge-file-result.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 4f232c4cf7..a299e9c4bf 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -19,6 +19,7 @@ export { FetchOptions } from './fetch-options'; export { Index } from './index_'; export { IndexEntry } from './index-entry'; export { MergeFileInput } from './merge-file-input'; +export { MergeFileResult } from './merge-file-result'; export { MergeOptions } from './merge-options'; export { Merge } from './merge'; export { Note } from './note'; diff --git a/types/nodegit/merge-file-result.d.ts b/types/nodegit/merge-file-result.d.ts new file mode 100644 index 0000000000..e6f2efcc3b --- /dev/null +++ b/types/nodegit/merge-file-result.d.ts @@ -0,0 +1,7 @@ +export class MergeFileResult { + automergeable: number; + path: string; + mode: number; + ptr: string; + len: number; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 32102a2de8..0e6b5c6daa 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -32,6 +32,7 @@ "index-entry.d.ts", "index.d.ts", "merge-file-input.d.ts", + "merge-file-result.d.ts", "merge-options.d.ts", "merge.d.ts", "nodegit-tests.ts", From 96568ae6e3bcf8f37d44ff2b09447fd7fc5aecec Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 01:32:50 +0100 Subject: [PATCH 051/286] Added MergeFileOptions --- types/nodegit/index.d.ts | 1 + types/nodegit/merge-file-options.d.ts | 8 ++++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 10 insertions(+) create mode 100644 types/nodegit/merge-file-options.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index a299e9c4bf..a8253f700f 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -19,6 +19,7 @@ export { FetchOptions } from './fetch-options'; export { Index } from './index_'; export { IndexEntry } from './index-entry'; export { MergeFileInput } from './merge-file-input'; +export { MergeFileOptions } from './merge-file-options'; export { MergeFileResult } from './merge-file-result'; export { MergeOptions } from './merge-options'; export { Merge } from './merge'; diff --git a/types/nodegit/merge-file-options.d.ts b/types/nodegit/merge-file-options.d.ts new file mode 100644 index 0000000000..5d8233bcd6 --- /dev/null +++ b/types/nodegit/merge-file-options.d.ts @@ -0,0 +1,8 @@ +export interface MergeFileOptions { + version: number; + ancestorLabel: string; + ourLabel: string; + theirLabel: string; + favor: number; + flags: number; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 0e6b5c6daa..28a3d8e30b 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -32,6 +32,7 @@ "index-entry.d.ts", "index.d.ts", "merge-file-input.d.ts", + "merge-file-options.d.ts", "merge-file-result.d.ts", "merge-options.d.ts", "merge.d.ts", From 59c7f36e1df68a33ff7dd10c20ff4e3a90ce56c1 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 01:34:38 +0100 Subject: [PATCH 052/286] Added Libgit2 --- types/nodegit/index.d.ts | 1 + types/nodegit/lib-git2.d.ts | 25 +++++++++++++++++++++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 27 insertions(+) create mode 100644 types/nodegit/lib-git2.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index a8253f700f..c9e56f125e 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -18,6 +18,7 @@ export { Enums } from './enums'; export { FetchOptions } from './fetch-options'; export { Index } from './index_'; export { IndexEntry } from './index-entry'; +export { Libgit2 } from './lib-git2'; export { MergeFileInput } from './merge-file-input'; export { MergeFileOptions } from './merge-file-options'; export { MergeFileResult } from './merge-file-result'; diff --git a/types/nodegit/lib-git2.d.ts b/types/nodegit/lib-git2.d.ts new file mode 100644 index 0000000000..9d7f1a5281 --- /dev/null +++ b/types/nodegit/lib-git2.d.ts @@ -0,0 +1,25 @@ +export namespace Libgit2 { + enum OPT { + GET_MWINDOW_SIZE = 0, + SET_MWINDOW_SIZE = 1, + GET_MWINDOW_MAPPED_LIMIT = 2, + SET_MWINDOW_MAPPED_LIMIT = 3, + GET_SEARCH_PATH = 4, + SET_SEARCH_PATH = 5, + SET_CACHE_OBJECT_LIMIT = 6, + SET_CACHE_MAX_SIZE = 7, + ENABLE_CACHING = 8, + GET_CACHED_MEMORY = 9, + GET_TEMPLATE_PATH = 10, + SET_TEMPLATE_PATH = 11, + SET_SSL_CERT_LOCATIONS = 12 + } +} + +export class Libgit2 { + static features(): number; + static init(): number; + static opts(option: number): number; + static shutdown(): number; + static version(major: number, minor: number, rev: number): void; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 28a3d8e30b..faae7d850e 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -31,6 +31,7 @@ "fetch-options.d.ts", "index-entry.d.ts", "index.d.ts", + "lib-git2.d.ts", "merge-file-input.d.ts", "merge-file-options.d.ts", "merge-file-result.d.ts", From 498c2392a18eaf36f5b3dc0502a13fb9c2d85d71 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:14:52 +0100 Subject: [PATCH 053/286] Added Indexer --- types/nodegit/index.d.ts | 1 + types/nodegit/indexer.d.ts | 8 ++++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 10 insertions(+) create mode 100644 types/nodegit/indexer.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index c9e56f125e..5539972cfb 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -18,6 +18,7 @@ export { Enums } from './enums'; export { FetchOptions } from './fetch-options'; export { Index } from './index_'; export { IndexEntry } from './index-entry'; +export { Indexer } from './indexer'; export { Libgit2 } from './lib-git2'; export { MergeFileInput } from './merge-file-input'; export { MergeFileOptions } from './merge-file-options'; diff --git a/types/nodegit/indexer.d.ts b/types/nodegit/indexer.d.ts new file mode 100644 index 0000000000..ee3ba9bc69 --- /dev/null +++ b/types/nodegit/indexer.d.ts @@ -0,0 +1,8 @@ +import { TransferProgress } from './transfer-progress'; +import { Oid } from './oid'; + +export class Indexer { + commit(stats: TransferProgress): number; + free(): void; + hash(): Oid; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index faae7d850e..a5e147be73 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -31,6 +31,7 @@ "fetch-options.d.ts", "index-entry.d.ts", "index.d.ts", + "indexer.d.ts", "lib-git2.d.ts", "merge-file-input.d.ts", "merge-file-options.d.ts", From fa9c001d4630bfea938336a415ecb397742fab41 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:16:33 +0100 Subject: [PATCH 054/286] Changed from interface to class --- types/nodegit/index-entry.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/nodegit/index-entry.d.ts b/types/nodegit/index-entry.d.ts index f2ac5cad8a..b121b7a826 100644 --- a/types/nodegit/index-entry.d.ts +++ b/types/nodegit/index-entry.d.ts @@ -5,7 +5,7 @@ export interface IndexTime { nanoseconds: number; } -export interface IndexEntry { +export class IndexEntry { ctime: IndexTime; mtime: IndexTime; dev: number; From f5562c51a6103854e7977292c876fbbd1cc7c794 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:18:54 +0100 Subject: [PATCH 055/286] Added Ignore --- types/nodegit/ignore.d.ts | 7 +++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 9 insertions(+) create mode 100644 types/nodegit/ignore.d.ts diff --git a/types/nodegit/ignore.d.ts b/types/nodegit/ignore.d.ts new file mode 100644 index 0000000000..c38d84d1f3 --- /dev/null +++ b/types/nodegit/ignore.d.ts @@ -0,0 +1,7 @@ +import { Repository } from './repository'; + +export class Ignore { + static addRule(repo: Repository, rules: string): number; + static clearInternalRules(repo: Repository): number; + static pathIsIgnored(repo: Repository, path: string): Promise; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 5539972cfb..6803e441af 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -18,6 +18,7 @@ export { Enums } from './enums'; export { FetchOptions } from './fetch-options'; export { Index } from './index_'; export { IndexEntry } from './index-entry'; +export { Ignore } from './ignore'; export { Indexer } from './indexer'; export { Libgit2 } from './lib-git2'; export { MergeFileInput } from './merge-file-input'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index a5e147be73..17fc3afa54 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -29,6 +29,7 @@ "diff.d.ts", "enums.d.ts", "fetch-options.d.ts", + "ignore.d.ts", "index-entry.d.ts", "index.d.ts", "indexer.d.ts", From aa3eb7c40986b8595a33dcc04bad34f44da7b9d9 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:20:26 +0100 Subject: [PATCH 056/286] Added Hashsig --- types/nodegit/hash-sig.d.ts | 7 +++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 9 insertions(+) create mode 100644 types/nodegit/hash-sig.d.ts diff --git a/types/nodegit/hash-sig.d.ts b/types/nodegit/hash-sig.d.ts new file mode 100644 index 0000000000..7cc6a91c05 --- /dev/null +++ b/types/nodegit/hash-sig.d.ts @@ -0,0 +1,7 @@ +export class Hashsig { + static create(buf: string, buflen: number, opts: number): Promise; + static createFromFile(path: string, opts: number): Promise; + + compare(b: Hashsig): number; + free(): void; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 6803e441af..c863896f24 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -16,6 +16,7 @@ export { DiffPerfdata } from './diff-perf-data'; export { Diff } from './diff'; export { Enums } from './enums'; export { FetchOptions } from './fetch-options'; +export { Hashsig } from './hash-sig'; export { Index } from './index_'; export { IndexEntry } from './index-entry'; export { Ignore } from './ignore'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 17fc3afa54..b7d15c0739 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -29,6 +29,7 @@ "diff.d.ts", "enums.d.ts", "fetch-options.d.ts", + "hash-sig.d.ts", "ignore.d.ts", "index-entry.d.ts", "index.d.ts", From 77b77136272734769a8402824c411fb2f61b0cff Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:21:08 +0100 Subject: [PATCH 057/286] Added namespace for Hashsig --- types/nodegit/hash-sig.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/types/nodegit/hash-sig.d.ts b/types/nodegit/hash-sig.d.ts index 7cc6a91c05..afa9bc121c 100644 --- a/types/nodegit/hash-sig.d.ts +++ b/types/nodegit/hash-sig.d.ts @@ -1,3 +1,12 @@ +export namespace Hashsig { + enum OPTION { + NORMAL = 0, + IGNORE_WHITESPACE = 1, + SMART_WHITESPACE = 2, + ALLOW_SMALL_FILES = 4 + } +} + export class Hashsig { static create(buf: string, buflen: number, opts: number): Promise; static createFromFile(path: string, opts: number): Promise; From a0ed80ee2dd0e272bd7553bde20e1607f902dd0d Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:22:30 +0100 Subject: [PATCH 058/286] Added Giterr --- types/nodegit/git-err.d.ts | 7 +++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 9 insertions(+) create mode 100644 types/nodegit/git-err.d.ts diff --git a/types/nodegit/git-err.d.ts b/types/nodegit/git-err.d.ts new file mode 100644 index 0000000000..5147e7fb3c --- /dev/null +++ b/types/nodegit/git-err.d.ts @@ -0,0 +1,7 @@ +export class Giterr { + static errClear(): void; + static errDetach(cpy: NodeGit.Error): number; + static errLast(): Error; + static errSetOom(): void; + static errSetString(error_class: number, string: string): void; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index c863896f24..b1e5219aa9 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -16,6 +16,7 @@ export { DiffPerfdata } from './diff-perf-data'; export { Diff } from './diff'; export { Enums } from './enums'; export { FetchOptions } from './fetch-options'; +export { Giterr } from './git-err'; export { Hashsig } from './hash-sig'; export { Index } from './index_'; export { IndexEntry } from './index-entry'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index b7d15c0739..9ddbc87a30 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -29,6 +29,7 @@ "diff.d.ts", "enums.d.ts", "fetch-options.d.ts", + "git-err.d.ts", "hash-sig.d.ts", "ignore.d.ts", "index-entry.d.ts", From 4e0dccc6e751b4126ab25489ddab155f1039ed71 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:26:29 +0100 Subject: [PATCH 059/286] Added Filter --- types/nodegit/filter.d.ts | 19 +++++++++++++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 21 insertions(+) create mode 100644 types/nodegit/filter.d.ts diff --git a/types/nodegit/filter.d.ts b/types/nodegit/filter.d.ts new file mode 100644 index 0000000000..391ab00456 --- /dev/null +++ b/types/nodegit/filter.d.ts @@ -0,0 +1,19 @@ +import { Repository } from './repository'; +import { Blob } from './blob'; +import { Buf } from './buf'; + +export class Filter { + static listContains(filters: any, name: string): number; + static listLength(fl: any): number; + static listNew(repo: Repository, mode: number, options: number): Promise; + static listStreamBlob(filters: any, blob: Blob, target: Writestream): number; + static listStreamData(filters: any, data: Buf, target: Writestream): number; + static listStreamFile(filters: any, repo: Repository, path: string, target: Writestream): number; + static unregister(name: string): number; + + lookup(name: string): Filter; + register(name: string, priority: number): number; + version: number; + attributes: string; + stream: Function; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index b1e5219aa9..c1ece4a753 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -16,6 +16,7 @@ export { DiffPerfdata } from './diff-perf-data'; export { Diff } from './diff'; export { Enums } from './enums'; export { FetchOptions } from './fetch-options'; +export { Filter } from './filter'; export { Giterr } from './git-err'; export { Hashsig } from './hash-sig'; export { Index } from './index_'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 9ddbc87a30..9ff8fdea93 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -29,6 +29,7 @@ "diff.d.ts", "enums.d.ts", "fetch-options.d.ts", + "filter.d.ts", "git-err.d.ts", "hash-sig.d.ts", "ignore.d.ts", From bb108937c7faa215dba04fea8d65f7a6741faa4c Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:26:38 +0100 Subject: [PATCH 060/286] Added semi-colon --- types/nodegit/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index c1ece4a753..3a6aef1423 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -44,7 +44,7 @@ export { Push } from './push'; export { RebaseOperation } from './rebase-operation'; export { Rebase, RebaseOptions } from './rebase'; export { Refdb } from './ref-db'; -export { Reflog, ReflogEntry } from './ref-log' +export { Reflog, ReflogEntry } from './ref-log'; export { Refspec } from './ref-spec'; export { Reference } from './reference'; export { RemoteCallbacks } from './remote-callbacks'; From a7d31d8d6b0ced066bb516ccc2109e25c1a8c208 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:27:13 +0100 Subject: [PATCH 061/286] Added namespace to Filter --- types/nodegit/filter.d.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/types/nodegit/filter.d.ts b/types/nodegit/filter.d.ts index 391ab00456..aedc0dbd6f 100644 --- a/types/nodegit/filter.d.ts +++ b/types/nodegit/filter.d.ts @@ -2,6 +2,20 @@ import { Repository } from './repository'; import { Blob } from './blob'; import { Buf } from './buf'; +export namespace Filter { + enum FLAG { + DEFAULT = 0, + ALLOW_UNSAFE = 1 + } + + enum MODE { + TO_WORKTREE = 0, + SMUDGE = 0, + TO_ODB = 1, + CLEAN = 1 + } +} + export class Filter { static listContains(filters: any, name: string): number; static listLength(fl: any): number; From 27d38b770f9fe26386ac4560fa9d175349cb97cd Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:28:47 +0100 Subject: [PATCH 062/286] Added Error --- types/nodegit/error.d.ts | 68 +++++++++++++++++++++++++++++++++++++ types/nodegit/git-err.d.ts | 4 ++- types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 4 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 types/nodegit/error.d.ts diff --git a/types/nodegit/error.d.ts b/types/nodegit/error.d.ts new file mode 100644 index 0000000000..e1267c082b --- /dev/null +++ b/types/nodegit/error.d.ts @@ -0,0 +1,68 @@ +export namespace Error { + enum ERROR { + GITERR_NONE = 0, + GITERR_NOMEMORY = 1, + GITERR_OS = 2, + GITERR_INVALID = 3, + GITERR_REFERENCE = 4, + GITERR_ZLIB = 5, + GITERR_REPOSITORY = 6, + GITERR_CONFIG = 7, + GITERR_REGEX = 8, + GITERR_ODB = 9, + GITERR_INDEX = 10, + GITERR_OBJECT = 11, + GITERR_NET = 12, + GITERR_TAG = 13, + GITERR_TREE = 14, + GITERR_INDEXER = 15, + GITERR_SSL = 16, + GITERR_SUBMODULE = 17, + GITERR_THREAD = 18, + GITERR_STASH = 19, + GITERR_CHECKOUT = 20, + GITERR_FETCHHEAD = 21, + GITERR_MERGE = 22, + GITERR_SSH = 23, + GITERR_FILTER = 24, + GITERR_REVERT = 25, + GITERR_CALLBACK = 26, + GITERR_CHERRYPICK = 27, + GITERR_DESCRIBE = 28, + GITERR_REBASE = 29, + GITERR_FILESYSTEM = 30 + } + + enum CODE { + OK = 0, + ERROR = -1, + ENOTFOUND = -3, + EEXISTS = -4, + EAMBIGUOUS = -5, + EBUFS = -6, + EUSER = -7, + EBAREREPO = -8, + EUNBORNBRANCH = -9, + EUNMERGED = -10, + ENONFASTFORWARD = -11, + EINVALIDSPEC = -12, + ECONFLICT = -13, + ELOCKED = -14, + EMODIFIED = -15, + EAUTH = -16, + ECERTIFICATE = -17, + EAPPLIED = -18, + EPEEL = -19, + EEOF = -20, + EINVALID = -21, + EUNCOMMITTED = -22, + EDIRECTORY = -23, + PASSTHROUGH = -30, + ITEROVER = -31 + } +} + +export class Error { + message: string; + klass: number; +} diff --git a/types/nodegit/git-err.d.ts b/types/nodegit/git-err.d.ts index 5147e7fb3c..6a9da24bb3 100644 --- a/types/nodegit/git-err.d.ts +++ b/types/nodegit/git-err.d.ts @@ -1,6 +1,8 @@ +import { Error } from './error'; + export class Giterr { static errClear(): void; - static errDetach(cpy: NodeGit.Error): number; + static errDetach(cpy: Error): number; static errLast(): Error; static errSetOom(): void; static errSetString(error_class: number, string: string): void; diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 3a6aef1423..df1b2c1f20 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -15,6 +15,7 @@ export { DiffFile } from './diff-file'; export { DiffPerfdata } from './diff-perf-data'; export { Diff } from './diff'; export { Enums } from './enums'; +export { Error } from './error'; export { FetchOptions } from './fetch-options'; export { Filter } from './filter'; export { Giterr } from './git-err'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 9ff8fdea93..21d56ac954 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -28,6 +28,7 @@ "diff-perf-data.d.ts", "diff.d.ts", "enums.d.ts", + "error.d.ts", "fetch-options.d.ts", "filter.d.ts", "git-err.d.ts", From df90245f9953ecf2a7bf3bd48d7117b6295ef619 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:30:05 +0100 Subject: [PATCH 063/286] Added Fetch --- types/nodegit/fetch.d.ts | 13 +++++++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 15 insertions(+) create mode 100644 types/nodegit/fetch.d.ts diff --git a/types/nodegit/fetch.d.ts b/types/nodegit/fetch.d.ts new file mode 100644 index 0000000000..2e71097ba3 --- /dev/null +++ b/types/nodegit/fetch.d.ts @@ -0,0 +1,13 @@ +import { FetchOptions } from './fetch-options'; + +export namespace Fetch { + enum PRUNE { + GIT_FETCH_PRUNE_UNSPECIFIED = 0, + GIT_FETCH_PRUNE = 1, + GIT_FETCH_NO_PRUNE = 2 + } +} + +export class Fetch { + static initOptions(opts: FetchOptions, version: number): number; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index df1b2c1f20..ab802f0246 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -17,6 +17,7 @@ export { Diff } from './diff'; export { Enums } from './enums'; export { Error } from './error'; export { FetchOptions } from './fetch-options'; +export { Fetch } from './fetch'; export { Filter } from './filter'; export { Giterr } from './git-err'; export { Hashsig } from './hash-sig'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 21d56ac954..e97659918d 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -30,6 +30,7 @@ "enums.d.ts", "error.d.ts", "fetch-options.d.ts", + "fetch.d.ts", "filter.d.ts", "git-err.d.ts", "hash-sig.d.ts", From a4d567c6bc4611f5aef76b5b7b9da3d7a75a0439 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:31:43 +0100 Subject: [PATCH 064/286] Added Graph --- types/nodegit/graph.d.ts | 7 +++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 9 insertions(+) create mode 100644 types/nodegit/graph.d.ts diff --git a/types/nodegit/graph.d.ts b/types/nodegit/graph.d.ts new file mode 100644 index 0000000000..d16d7b5dee --- /dev/null +++ b/types/nodegit/graph.d.ts @@ -0,0 +1,7 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; + +export class Graph { + static aheadBehind(repo: Repository, local: Oid, upstream: Oid): Promise; + static descendantOf(repo: Repository, commit: Oid, ancestor: Oid): Promise; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index ab802f0246..bce68c89da 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -20,6 +20,7 @@ export { FetchOptions } from './fetch-options'; export { Fetch } from './fetch'; export { Filter } from './filter'; export { Giterr } from './git-err'; +export { Graph } from './graph'; export { Hashsig } from './hash-sig'; export { Index } from './index_'; export { IndexEntry } from './index-entry'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index e97659918d..6ae8a96742 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -33,6 +33,7 @@ "fetch.d.ts", "filter.d.ts", "git-err.d.ts", + "graph.d.ts", "hash-sig.d.ts", "ignore.d.ts", "index-entry.d.ts", From dbc4d532424fa5728793fee6022638b2e10ddd74 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:33:31 +0100 Subject: [PATCH 065/286] Added DiffOptions --- types/nodegit/diff-options.d.ts | 16 ++++++++++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 18 insertions(+) create mode 100644 types/nodegit/diff-options.d.ts diff --git a/types/nodegit/diff-options.d.ts b/types/nodegit/diff-options.d.ts new file mode 100644 index 0000000000..e78de28aac --- /dev/null +++ b/types/nodegit/diff-options.d.ts @@ -0,0 +1,16 @@ +import { Strarray } from './str-array'; + +export interface DiffOptions { + version: number; + flags: number; + ignoreSubmodules: number; + pathspec: Strarray; + notifyCb: Function; + notifyPayload: void; + contextLines: number; + interhunkLines: number; + idAbbrev: number; + maxSize: number; + oldPrefix: string; + newPrefix: string; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index bce68c89da..bcafde5c65 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -12,6 +12,7 @@ export { Config } from './config'; export { ConvenientPatch } from './convenient-patch'; export { DiffDelta } from './diff-delta'; export { DiffFile } from './diff-file'; +export { DiffOptions } from './diff-options'; export { DiffPerfdata } from './diff-perf-data'; export { Diff } from './diff'; export { Enums } from './enums'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 6ae8a96742..65a9de572d 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -25,6 +25,7 @@ "convenient-patch.d.ts", "diff-delta.d.ts", "diff-file.d.ts", + "diff-options.d.ts", "diff-perf-data.d.ts", "diff.d.ts", "enums.d.ts", From de7e279831066413ec9401911f0afd5f5dbc9305 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:34:30 +0100 Subject: [PATCH 066/286] Added DiffLine --- types/nodegit/diff-line.d.ts | 9 +++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 11 insertions(+) create mode 100644 types/nodegit/diff-line.d.ts diff --git a/types/nodegit/diff-line.d.ts b/types/nodegit/diff-line.d.ts new file mode 100644 index 0000000000..587653b09f --- /dev/null +++ b/types/nodegit/diff-line.d.ts @@ -0,0 +1,9 @@ +export class DiffLine { + content(): string; + origin: number; + oldLineno: number; + newLineno: number; + numLines: number; + contentLen: number; + contentOffset: number; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index bcafde5c65..3001fef55c 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -12,6 +12,7 @@ export { Config } from './config'; export { ConvenientPatch } from './convenient-patch'; export { DiffDelta } from './diff-delta'; export { DiffFile } from './diff-file'; +export { DiffLine } from './diff-line'; export { DiffOptions } from './diff-options'; export { DiffPerfdata } from './diff-perf-data'; export { Diff } from './diff'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 65a9de572d..82a4c1c2f2 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -25,6 +25,7 @@ "convenient-patch.d.ts", "diff-delta.d.ts", "diff-file.d.ts", + "diff-line.d.ts", "diff-options.d.ts", "diff-perf-data.d.ts", "diff.d.ts", From ad664c4773657633a70422ae27d36565c2c7d438 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:37:26 +0100 Subject: [PATCH 067/286] Exported DiffFindOptions --- types/nodegit/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 3001fef55c..f1997a1ecd 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -15,7 +15,7 @@ export { DiffFile } from './diff-file'; export { DiffLine } from './diff-line'; export { DiffOptions } from './diff-options'; export { DiffPerfdata } from './diff-perf-data'; -export { Diff } from './diff'; +export { Diff, DiffFindOptions } from './diff'; export { Enums } from './enums'; export { Error } from './error'; export { FetchOptions } from './fetch-options'; From 037f9f982c00383374233fe4e35a3cc0f05edfbf Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:39:04 +0100 Subject: [PATCH 068/286] Moved out DiffOptions --- types/nodegit/diff.d.ts | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/types/nodegit/diff.d.ts b/types/nodegit/diff.d.ts index d8b60e1c6a..3612e402a4 100644 --- a/types/nodegit/diff.d.ts +++ b/types/nodegit/diff.d.ts @@ -5,6 +5,7 @@ import { Strarray } from './str-array'; import { Index } from './index_'; import { DiffDelta } from './diff-delta'; import { DiffPerfdata } from './diff-perf-data'; +import { DiffOptions } from './diff-options'; export interface DiffFindOptions { version: number; @@ -16,21 +17,6 @@ export interface DiffFindOptions { renameLimit: number; } -export interface DiffOptions { - version: number; - flags: number; - ignoreSubmodules: number; - pathspec: Strarray; - notifyCb: Function; - notifyPayload: undefined; - contextLines: number; - interhunkLines: number; - idAbbrev: number; - maxSize: number; - oldPrefix: string; - newPrefix: string; -} - export namespace Diff { enum DELTA { UNMODIFIED = 0, @@ -140,7 +126,7 @@ export namespace Diff { export class Diff { static blobToBuffer(old_blob: Blob, oldAsPath: string, - buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; + buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; static indexToWorkdir(repo: Repository, index: Index, opts: DiffOptions): Promise; static treeToIndex(repo: Repository, old_tree: Tree, index: Index, opts: DiffOptions): Promise; static treeToTree(repo: Repository, old_tree: Tree, new_tree: Tree, opts: DiffOptions): Promise; From b93979373bfce7a7b3daf9638871f9a5124c419a Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:39:37 +0100 Subject: [PATCH 069/286] Added DiffHunk --- types/nodegit/diff-hunk.d.ts | 8 ++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 10 insertions(+) create mode 100644 types/nodegit/diff-hunk.d.ts diff --git a/types/nodegit/diff-hunk.d.ts b/types/nodegit/diff-hunk.d.ts new file mode 100644 index 0000000000..14a1a9a304 --- /dev/null +++ b/types/nodegit/diff-hunk.d.ts @@ -0,0 +1,8 @@ +export class DiffHunk { + oldStart: number; + oldLines: number; + newStart: number; + newLines: number; + headerLen: number; + header: string; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index f1997a1ecd..2ae963d13e 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -12,6 +12,7 @@ export { Config } from './config'; export { ConvenientPatch } from './convenient-patch'; export { DiffDelta } from './diff-delta'; export { DiffFile } from './diff-file'; +export { DiffHunk } from './diff-hunk'; export { DiffLine } from './diff-line'; export { DiffOptions } from './diff-options'; export { DiffPerfdata } from './diff-perf-data'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 82a4c1c2f2..645c75ffea 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -25,6 +25,7 @@ "convenient-patch.d.ts", "diff-delta.d.ts", "diff-file.d.ts", + "diff-hunk.d.ts", "diff-line.d.ts", "diff-options.d.ts", "diff-perf-data.d.ts", From 41cdc45056d0a4dd9c2f20bb9bcd13780adbb406 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:41:07 +0100 Subject: [PATCH 070/286] Added DiffBinaryFile --- types/nodegit/diff-binary-file.d.ts | 6 ++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 8 insertions(+) create mode 100644 types/nodegit/diff-binary-file.d.ts diff --git a/types/nodegit/diff-binary-file.d.ts b/types/nodegit/diff-binary-file.d.ts new file mode 100644 index 0000000000..46b67f406e --- /dev/null +++ b/types/nodegit/diff-binary-file.d.ts @@ -0,0 +1,6 @@ +export class DiffBinaryFile { + type: number; + data: string; + datalen: number; + inflatedlen: number; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 2ae963d13e..b30891f96f 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -10,6 +10,7 @@ export { CheckoutOptions } from './checkout-options'; export { Commit } from './commit'; export { Config } from './config'; export { ConvenientPatch } from './convenient-patch'; +export { DiffBinaryFile } from './diff-binary-file'; export { DiffDelta } from './diff-delta'; export { DiffFile } from './diff-file'; export { DiffHunk } from './diff-hunk'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 645c75ffea..c9a324a8dc 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -23,6 +23,7 @@ "commit.d.ts", "config.d.ts", "convenient-patch.d.ts", + "diff-binary-file.d.ts", "diff-delta.d.ts", "diff-file.d.ts", "diff-hunk.d.ts", From 9004069b4ea6b7b08808ac2f794b293c95b7805e Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:42:24 +0100 Subject: [PATCH 071/286] Added DiffBinary --- types/nodegit/diff-binary.d.ts | 14 ++++++++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 16 insertions(+) create mode 100644 types/nodegit/diff-binary.d.ts diff --git a/types/nodegit/diff-binary.d.ts b/types/nodegit/diff-binary.d.ts new file mode 100644 index 0000000000..fa6643038d --- /dev/null +++ b/types/nodegit/diff-binary.d.ts @@ -0,0 +1,14 @@ +import { DiffBinaryFile } from './diff-binary-file'; + +export namespace DiffBinary { + enum DIFF_BINARY { + NONE = 0, + LITERAL = 1, + DELTA = 2 + } +} + +export class DiffBinary { + oldFile: DiffBinaryFile; + newFile: DiffBinaryFile; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index b30891f96f..aaf1aa1d3c 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -11,6 +11,7 @@ export { Commit } from './commit'; export { Config } from './config'; export { ConvenientPatch } from './convenient-patch'; export { DiffBinaryFile } from './diff-binary-file'; +export { DiffBinary } from './diff-binary'; export { DiffDelta } from './diff-delta'; export { DiffFile } from './diff-file'; export { DiffHunk } from './diff-hunk'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index c9a324a8dc..4f42f3bdd5 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -24,6 +24,7 @@ "config.d.ts", "convenient-patch.d.ts", "diff-binary-file.d.ts", + "diff-binary.d.ts", "diff-delta.d.ts", "diff-file.d.ts", "diff-hunk.d.ts", From 76aad31da39117bcd737bd2235cc504a3fa255af Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:43:48 +0100 Subject: [PATCH 072/286] Added DescribeOptions --- types/nodegit/describe-options.d.ts | 8 ++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 10 insertions(+) create mode 100644 types/nodegit/describe-options.d.ts diff --git a/types/nodegit/describe-options.d.ts b/types/nodegit/describe-options.d.ts new file mode 100644 index 0000000000..939750eb11 --- /dev/null +++ b/types/nodegit/describe-options.d.ts @@ -0,0 +1,8 @@ +export class DescribeOptions { + version: number; + maxCandidatesTags: number; + describeStrategy: number; + pattern: string; + onlyFollowFirstParent: number; + showCommitOidAsFallback: number; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index aaf1aa1d3c..05c4c74a18 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -10,6 +10,7 @@ export { CheckoutOptions } from './checkout-options'; export { Commit } from './commit'; export { Config } from './config'; export { ConvenientPatch } from './convenient-patch'; +export { DescribeOptions } from './describe-options'; export { DiffBinaryFile } from './diff-binary-file'; export { DiffBinary } from './diff-binary'; export { DiffDelta } from './diff-delta'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 4f42f3bdd5..94f92b7fad 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -23,6 +23,7 @@ "commit.d.ts", "config.d.ts", "convenient-patch.d.ts", + "describe-options.d.ts", "diff-binary-file.d.ts", "diff-binary.d.ts", "diff-delta.d.ts", From 30efc5e44ba9690f595b2c359f942178271684b7 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:44:46 +0100 Subject: [PATCH 073/286] Added DescribeFormatOptions --- types/nodegit/describe-format-options.d.ts | 6 ++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 8 insertions(+) create mode 100644 types/nodegit/describe-format-options.d.ts diff --git a/types/nodegit/describe-format-options.d.ts b/types/nodegit/describe-format-options.d.ts new file mode 100644 index 0000000000..ecb7f4d762 --- /dev/null +++ b/types/nodegit/describe-format-options.d.ts @@ -0,0 +1,6 @@ +export class DescribeFormatOptions { + version: number; + abbreviatedSize: number; + alwaysUseLongFormat: number; + dirtySuffix: string; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 05c4c74a18..5813129fd5 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -10,6 +10,7 @@ export { CheckoutOptions } from './checkout-options'; export { Commit } from './commit'; export { Config } from './config'; export { ConvenientPatch } from './convenient-patch'; +export { DescribeFormatOptions } from './describe-format-options'; export { DescribeOptions } from './describe-options'; export { DiffBinaryFile } from './diff-binary-file'; export { DiffBinary } from './diff-binary'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 94f92b7fad..5d114d2534 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -23,6 +23,7 @@ "commit.d.ts", "config.d.ts", "convenient-patch.d.ts", + "describe-format-options.d.ts", "describe-options.d.ts", "diff-binary-file.d.ts", "diff-binary.d.ts", From e7dc8f352e8301cff84a0527c66867a9821c8915 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:47:37 +0100 Subject: [PATCH 074/286] Added CvarMap --- types/nodegit/cvar-map.d.ts | 5 +++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 7 insertions(+) create mode 100644 types/nodegit/cvar-map.d.ts diff --git a/types/nodegit/cvar-map.d.ts b/types/nodegit/cvar-map.d.ts new file mode 100644 index 0000000000..f7c4b227d0 --- /dev/null +++ b/types/nodegit/cvar-map.d.ts @@ -0,0 +1,5 @@ +export class CvarMap { + cvarType: number; + strMatch: string; + mapValue: number; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 5813129fd5..d69425fc75 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -10,6 +10,7 @@ export { CheckoutOptions } from './checkout-options'; export { Commit } from './commit'; export { Config } from './config'; export { ConvenientPatch } from './convenient-patch'; +export { CvarMap } from './cvar-map'; export { DescribeFormatOptions } from './describe-format-options'; export { DescribeOptions } from './describe-options'; export { DiffBinaryFile } from './diff-binary-file'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 5d114d2534..b35a0c0e7a 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -23,6 +23,7 @@ "commit.d.ts", "config.d.ts", "convenient-patch.d.ts", + "cvar-map.d.ts", "describe-format-options.d.ts", "describe-options.d.ts", "diff-binary-file.d.ts", From 32581a7937486685fb2fbe30650168db8fd17576 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 02:53:17 +0100 Subject: [PATCH 075/286] Added Checkout --- types/nodegit/checkout.d.ts | 51 +++++++++++++++++++++++++++++++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 53 insertions(+) create mode 100644 types/nodegit/checkout.d.ts diff --git a/types/nodegit/checkout.d.ts b/types/nodegit/checkout.d.ts new file mode 100644 index 0000000000..a7bc6d63fc --- /dev/null +++ b/types/nodegit/checkout.d.ts @@ -0,0 +1,51 @@ +import { Repository } from './repository'; +import { CheckoutOptions } from './checkout-options'; +import { Reference } from './reference'; +import { Oid } from './oid'; +import { Tree } from './tree'; +import { Commit } from './commit'; +import { Index } from './index'; + +export namespace Checkout { + enum NOTIFY { + NONE = 0, + CONFLICT = 1, + DIRTY = 2, + UPDATED = 4, + UNTRACKED = 8, + IGNORED = 16, + ALL = 65535 + } + + enum STRATEGY { + NONE = 0, + SAFE = 1, + FORCE = 2, + RECREATE_MISSING = 4, + ALLOW_CONFLICTS = 16, + REMOVE_UNTRACKED = 32, + REMOVE_IGNORED = 64, + UPDATE_ONLY = 128, + DONT_UPDATE_INDEX = 256, + NO_REFRESH = 512, + SKIP_UNMERGED = 1024, + USE_OURS = 2048, + USE_THEIRS = 4096, + DISABLE_PATHSPEC_MATCH = 8192, + SKIP_LOCKED_DIRECTORIES = 262144, + DONT_OVERWRITE_IGNORED = 524288, + CONFLICT_STYLE_MERGE = 1048576, + CONFLICT_STYLE_DIFF3 = 2097152, + DONT_REMOVE_EXISTING = 4194304, + DONT_WRITE_INDEX = 8388608, + UPDATE_SUBMODULES = 65536, + UPDATE_SUBMODULES_IF_CHANGED = 131072 + } +} + +export class Checkout { + static head(repo: Repository, options?: CheckoutOptions): Promise; + static index(repo: Repository, The: Index, options?: CheckoutOptions): Promise; + static initOptions(opts: CheckoutOptions, version: number): number; + static tree(repo: Repository, treeish: Oid | Tree | Commit | Reference, options?: CheckoutOptions): Promise; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index d69425fc75..36e823ec19 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -7,6 +7,7 @@ export { AnnotatedCommit } from './annotated-commit'; export { Blob } from './blob'; export { Buf } from './buf'; export { CheckoutOptions } from './checkout-options'; +export { Checkout } from './checkout'; export { Commit } from './commit'; export { Config } from './config'; export { ConvenientPatch } from './convenient-patch'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index b35a0c0e7a..607f154837 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -20,6 +20,7 @@ "blob.d.ts", "buf.d.ts", "checkout-options.d.ts", + "checkout.d.ts", "commit.d.ts", "config.d.ts", "convenient-patch.d.ts", From 36faaf10771183c4aeec6c6faa4de5fe5d96c5e6 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 03:00:04 +0100 Subject: [PATCH 076/286] Added Branch --- types/nodegit/branch.d.ts | 25 +++++++++++++++++++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 27 insertions(+) create mode 100644 types/nodegit/branch.d.ts diff --git a/types/nodegit/branch.d.ts b/types/nodegit/branch.d.ts new file mode 100644 index 0000000000..d121650864 --- /dev/null +++ b/types/nodegit/branch.d.ts @@ -0,0 +1,25 @@ +import { Repository } from './repository'; +import { Reference } from './reference'; +import { Commit } from './commit'; +import { AnnotatedCommit } from './annotated-commit'; + +export namespace Branch { + enum BRANCH { + LOCAL = 1, + REMOTE = 2, + ALL = 3 + } +} + +export class Branch { + static create(repo: Repository, branch_name: string, target: Commit, force: number): Promise; + static createFromAnnotated(repository: Repository, branch_name: string, commit: AnnotatedCommit, force: number): Reference; + static delete(branch: Reference): number; + static isHead(branch: Reference): number; + static iteratorNew(repo: Repository, list_flags: number): Promise; + static lookup(repo: Repository, branch_name: string, branch_type: number): Promise; + static move(branch: Reference, new_branch_name: string, force: number): Promise; + static name(ref: Reference): Promise; + static setUpstream(branch: Reference, upstream_name: string): Promise; + static upstream(branch: Reference): Promise; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 36e823ec19..feeec58469 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -5,6 +5,7 @@ export { AnnotatedCommit } from './annotated-commit'; export { Blob } from './blob'; +export { Branch } from './branch'; export { Buf } from './buf'; export { CheckoutOptions } from './checkout-options'; export { Checkout } from './checkout'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 607f154837..e57dc2776b 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -18,6 +18,7 @@ "files": [ "annotated-commit.d.ts", "blob.d.ts", + "branch.d.ts", "buf.d.ts", "checkout-options.d.ts", "checkout.d.ts", From 48c8fa3df5a209ad9e78a7967abe9b6a9d0f582e Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 03:00:12 +0100 Subject: [PATCH 077/286] Added Attr --- types/nodegit/attr.d.ts | 18 ++++++++++++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 20 insertions(+) create mode 100644 types/nodegit/attr.d.ts diff --git a/types/nodegit/attr.d.ts b/types/nodegit/attr.d.ts new file mode 100644 index 0000000000..84a701f2b1 --- /dev/null +++ b/types/nodegit/attr.d.ts @@ -0,0 +1,18 @@ +import { Repository } from './repository'; + +export namespace Attr { + enum STATES { + UNSPECIFIED_T = 0, + TRUE_T = 1, + FALSE_T = 2, + VALUE_T = 3 + } +} + +export class Attr { + static addMacro(repo: Repository, name: string, values: string): number; + static cacheFlush(repo: Repository): void; + static get(repo: Repository, flags: number, path: string, name: string): Promise; + static getMany(repo: Repository, flags: number, path: string, num_attr: number, names: string): any[]; + static value(attr: string): number; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index feeec58469..1f672ba3b4 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -4,6 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export { AnnotatedCommit } from './annotated-commit'; +export { Attr } from './attr'; export { Blob } from './blob'; export { Branch } from './branch'; export { Buf } from './buf'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index e57dc2776b..4192e1fc08 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -17,6 +17,7 @@ }, "files": [ "annotated-commit.d.ts", + "attr.d.ts", "blob.d.ts", "branch.d.ts", "buf.d.ts", From 7e79f7358a27bd27e42a6e88d6d6e9255c6c2a30 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 03:03:47 +0100 Subject: [PATCH 078/286] Added Blame and co --- types/nodegit/blame-hunk.d.ts | 13 +++++++++++++ types/nodegit/blame-options.d.ts | 11 +++++++++++ types/nodegit/blame.d.ts | 0 types/nodegit/index.d.ts | 3 +++ types/nodegit/tsconfig.json | 3 +++ 5 files changed, 30 insertions(+) create mode 100644 types/nodegit/blame-hunk.d.ts create mode 100644 types/nodegit/blame-options.d.ts create mode 100644 types/nodegit/blame.d.ts diff --git a/types/nodegit/blame-hunk.d.ts b/types/nodegit/blame-hunk.d.ts new file mode 100644 index 0000000000..601a7dbdfd --- /dev/null +++ b/types/nodegit/blame-hunk.d.ts @@ -0,0 +1,13 @@ +import { Oid } from './oid'; +import { Signature } from './Signature'; + +export class BlameHunk { + linesInHunk: number; + finalCommitId: Oid; + finalStartLineNumber: number; + finalSignature: Signature; + origCommitId: Oid; + origPath: string; + origStartLineNumber: number; + origSignature: Signature; +} diff --git a/types/nodegit/blame-options.d.ts b/types/nodegit/blame-options.d.ts new file mode 100644 index 0000000000..ca5f1f50df --- /dev/null +++ b/types/nodegit/blame-options.d.ts @@ -0,0 +1,11 @@ +import {Oid} from './oid'; + +export interface BlameOptions { + version: number; + flags: number; + minMatchCharacters: number; + newestCommit: Oid; + oldestCommit: Oid; + minLine: number; + maxLine: number; +} diff --git a/types/nodegit/blame.d.ts b/types/nodegit/blame.d.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 1f672ba3b4..e086fe5d4c 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -5,6 +5,9 @@ export { AnnotatedCommit } from './annotated-commit'; export { Attr } from './attr'; +export { BlameHunk } from './blame-hunk'; +export { BlameOptions } from './blame-options'; +export { Blame } from './blame'; export { Blob } from './blob'; export { Branch } from './branch'; export { Buf } from './buf'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 4192e1fc08..c8d5c68fc2 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -18,6 +18,9 @@ "files": [ "annotated-commit.d.ts", "attr.d.ts", + "blame-hunk.d.ts", + "blame-options.d.ts", + "blame.d.ts", "blob.d.ts", "branch.d.ts", "buf.d.ts", From f7b5a33770a261812bae8a442830daed4cd3cf09 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 03:06:21 +0100 Subject: [PATCH 079/286] Changed interface to class --- types/nodegit/checkout-options.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/nodegit/checkout-options.d.ts b/types/nodegit/checkout-options.d.ts index c799ce2047..4122dfbe28 100644 --- a/types/nodegit/checkout-options.d.ts +++ b/types/nodegit/checkout-options.d.ts @@ -2,7 +2,7 @@ import { Strarray } from './str-array'; import { Tree } from './tree'; import { Index } from './index'; -export interface CheckoutOptions { +export class CheckoutOptions { version?: number; checkoutStrategy?: number; disableFilters?: number; From 0c0761a2f4b457788e74260f6a730de4ed785f8e Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 03:09:58 +0100 Subject: [PATCH 080/286] Added Clone and co --- types/nodegit/clone-options.d.ts | 13 +++++++++++++ types/nodegit/clone.d.ts | 16 ++++++++++++++++ types/nodegit/index.d.ts | 2 ++ types/nodegit/tsconfig.json | 2 ++ 4 files changed, 33 insertions(+) create mode 100644 types/nodegit/clone-options.d.ts create mode 100644 types/nodegit/clone.d.ts diff --git a/types/nodegit/clone-options.d.ts b/types/nodegit/clone-options.d.ts new file mode 100644 index 0000000000..b8acc9aad0 --- /dev/null +++ b/types/nodegit/clone-options.d.ts @@ -0,0 +1,13 @@ +import { CheckoutOptions } from './checkout-options'; +import { FetchOptions } from './fetch-options'; + +export class CloneOptions { + version?: number; + checkoutOpts?: CheckoutOptions; + fetchOpts?: FetchOptions; + bare?: number; + local?: number; + checkoutBranch?: string; + repositoryCbPayload?: void; + remoteCbPayload?: void; +} diff --git a/types/nodegit/clone.d.ts b/types/nodegit/clone.d.ts new file mode 100644 index 0000000000..e0b92bb9ea --- /dev/null +++ b/types/nodegit/clone.d.ts @@ -0,0 +1,16 @@ +import { Repository } from './repository'; +import { CloneOptions } from './clone-options'; + +export namespace Clone { + enum LOCAL { + AUTO = 0, + LOCAL = 1, + NO_LOCAL = 2, + NO_LINKS = 3 + } +} + +export class Clone { + static clone(url: string, local_path: string, options?: CloneOptions): Promise; + static initOptions(opts: CloneOptions, version: number): number; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index e086fe5d4c..860d1e9c2f 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -13,6 +13,8 @@ export { Branch } from './branch'; export { Buf } from './buf'; export { CheckoutOptions } from './checkout-options'; export { Checkout } from './checkout'; +export { CloneOptions } from './clone-options'; +export { Clone } from './clone'; export { Commit } from './commit'; export { Config } from './config'; export { ConvenientPatch } from './convenient-patch'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index c8d5c68fc2..39bb95c2fc 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -26,6 +26,8 @@ "buf.d.ts", "checkout-options.d.ts", "checkout.d.ts", + "clone-options.d.ts", + "clone.d.ts", "commit.d.ts", "config.d.ts", "convenient-patch.d.ts", From 74e32b9a5c1c04d086c7547d48ea77ce65a5f33b Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 03:11:15 +0100 Subject: [PATCH 081/286] Added Cert --- types/nodegit/cert.d.ts | 17 +++++++++++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 19 insertions(+) create mode 100644 types/nodegit/cert.d.ts diff --git a/types/nodegit/cert.d.ts b/types/nodegit/cert.d.ts new file mode 100644 index 0000000000..f910453700 --- /dev/null +++ b/types/nodegit/cert.d.ts @@ -0,0 +1,17 @@ +export namespace Cert { + enum TYPE { + NONE = 0, + X509 = 1, + HOSTKEY_LIBSSH2 = 2, + STRARRAY = 3 + } + + enum SSH { + MD5 = 1, + SHA1 = 2 + } +} + +export class Cert { + certType: number; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 860d1e9c2f..7b485e2980 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -11,6 +11,7 @@ export { Blame } from './blame'; export { Blob } from './blob'; export { Branch } from './branch'; export { Buf } from './buf'; +export { Cert } from './cert'; export { CheckoutOptions } from './checkout-options'; export { Checkout } from './checkout'; export { CloneOptions } from './clone-options'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 39bb95c2fc..366b54206a 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -24,6 +24,7 @@ "blob.d.ts", "branch.d.ts", "buf.d.ts", + "cert.d.ts", "checkout-options.d.ts", "checkout.d.ts", "clone-options.d.ts", From 3063a2730a089acb520893b258821186fa2c6e60 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 03:11:44 +0100 Subject: [PATCH 082/286] Added body of Blame --- types/nodegit/blame.d.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/types/nodegit/blame.d.ts b/types/nodegit/blame.d.ts index e69de29bb2..e5b5d90ec8 100644 --- a/types/nodegit/blame.d.ts +++ b/types/nodegit/blame.d.ts @@ -0,0 +1,25 @@ +import { Repository } from './repository'; +import { BlameOptions } from './blame-options'; +import {BlameHunk} from './blame-hunk'; + +export namespace Blame { + enum FLAG { + NORMAL = 0, + TRACK_COPIES_SAME_FILE = 1, + TRACK_COPIES_SAME_COMMIT_MOVES = 2, + TRACK_COPIES_SAME_COMMIT_COPIES = 4, + TRACK_COPIES_ANY_COMMIT_COPIES = 8, + FIRST_PARENT = 16 + } +} + +export class Blame { + static file(repo: Repository, path: string, options?: BlameOptions): Blame; + static initOptions(opts: BlameOptions, version: number): number; + + buffer(buffer: string, buffer_len: number): Promise; + free(): void; + getHunkByIndex(index: number): BlameHunk; + getHunkByLine(lineno: number): BlameHunk; + getHunkCount(): number; +} From 7f9adbee7341408274e0aab325d459d41be4d61a Mon Sep 17 00:00:00 2001 From: Martin Zagora Date: Wed, 7 Jun 2017 16:00:41 +1000 Subject: [PATCH 083/286] express header methods can return undefined --- types/express-serve-static-core/index.d.ts | 6 +++--- types/express-serve-static-core/tsconfig.json | 2 +- types/express/express-tests.ts | 9 +++++++++ types/express/tsconfig.json | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/types/express-serve-static-core/index.d.ts b/types/express-serve-static-core/index.d.ts index 8e1f075f03..3050f080a9 100644 --- a/types/express-serve-static-core/index.d.ts +++ b/types/express-serve-static-core/index.d.ts @@ -197,11 +197,11 @@ interface Request extends http.IncomingMessage, Express.Request { * * @param name */ - get(name: string): string; + get(name: string): string | undefined; - header(name: string): string; + header(name: string): string | undefined; - headers: { [key: string]: string; }; + headers: { [key: string]: string | undefined; }; /** * Check if the given `type(s)` is acceptable, returning diff --git a/types/express-serve-static-core/tsconfig.json b/types/express-serve-static-core/tsconfig.json index 40ee779963..cdb77c3573 100644 --- a/types/express-serve-static-core/tsconfig.json +++ b/types/express-serve-static-core/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/express/express-tests.ts b/types/express/express-tests.ts index 04165d5e09..cc8c63ef81 100644 --- a/types/express/express-tests.ts +++ b/types/express/express-tests.ts @@ -71,6 +71,15 @@ namespace express_tests { language = req.acceptsLanguages(['en', 'ja']); language = req.acceptsLanguages('en', 'ja'); + let existingHeader1 = req.get('existingHeader') as string; + let nonExistingHeader1 = req.get('nonExistingHeader') as undefined; + + let existingHeader2 = req.header('existingHeader') as string; + let nonExistingHeader2 = req.header('nonExistingHeader') as undefined; + + let existingHeader3 = req.headers.existingHeader as string; + let nonExistingHeader3 = req.headers.nonExistingHeader as undefined; + res.send(req.query['token']); }); diff --git a/types/express/tsconfig.json b/types/express/tsconfig.json index 0fc87c2800..009cb9ec00 100644 --- a/types/express/tsconfig.json +++ b/types/express/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From 72af5467eee6dc36dc47b01e229ce3db607adda8 Mon Sep 17 00:00:00 2001 From: Martin Zagora Date: Wed, 7 Jun 2017 16:18:28 +1000 Subject: [PATCH 084/286] set TS version to 2.2 --- types/express/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/express/index.d.ts b/types/express/index.d.ts index 9b913db473..d48d58c0c9 100644 --- a/types/express/index.d.ts +++ b/types/express/index.d.ts @@ -2,6 +2,7 @@ // Project: http://expressjs.com // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /* =================== USAGE =================== From e054978b9cbc30623b8e8b2621319f21dafcc734 Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Wed, 7 Jun 2017 15:17:43 +0200 Subject: [PATCH 085/286] fix type of H.map.Icon.Options.size according the documentation of HERE datalens, size can be a number: https://developer.here.com/visualization/documentation/datalens/h-datalens-objectlayer.html --- types/heremaps/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index bfdd353dd3..1a801d0414 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -1743,7 +1743,7 @@ declare namespace H { * @property crossOrigin {boolean} - Specifies whether to use anonynous Cross-Origin Resource Sharing (CORS) when fetching an image to prevent resulting canvas from tainting, default is false. The option is ignored by IE9-10. */ export interface Options { - size?: H.math.ISize; + size?: H.math.ISize | number; anchor?: H.math.IPoint; hitArea?: H.map.HitArea; asCanvas?: H.map.HitArea; From 75372e077bd4bc115ca6224a5938af7e83ad284d Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Wed, 7 Jun 2017 16:02:25 +0200 Subject: [PATCH 086/286] add tslint and fix all errors --- types/heremaps/index.d.ts | 1142 ++++++++++++++++++++---------------- types/heremaps/tslint.json | 6 + 2 files changed, 642 insertions(+), 506 deletions(-) create mode 100644 types/heremaps/tslint.json diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index 1a801d0414..05895c5d11 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -1,14 +1,16 @@ -// Type definitions for HERE Maps API for JavaScript 3.0s +// Type definitions for HERE Maps API for JavaScript 3.0 // Project: https://developer.here.com/ // Definitions by: Joshua Efiong +// Bernd Hacker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace H { /***** Map *****/ /** - * Map class defines map instance in the application. By creating this object you will initialize a visible map object which is attached to the provided dom element. Map class is an entry point to all operations related to layers, map objects and geo-screen transformations. By specifying options you can initialize map with predefined view. + * Map class defines map instance in the application. By creating this object you will initialize a visible map object which is attached to the provided dom element. + * Map class is an entry point to all operations related to layers, map objects and geo-screen transformations. By specifying options you can initialize map with predefined view. */ - export class Map extends H.util.EventTarget { + class Map extends H.util.EventTarget { /** * Constructor * @param element {Element} - html element into which the map will be rendered @@ -81,7 +83,8 @@ declare namespace H { getCameraDataForBounds(rect: H.geo.Rect): H.map.ViewModel.CameraData; /** - * This method returns current map viewport. Viewport can be used to modify padding and margin which will reflect the position of the viewport center and the amount of extra data loaded (for margin) + * This method returns current map viewport. + * Viewport can be used to modify padding and margin which will reflect the position of the viewport center and the amount of extra data loaded (for margin) * @returns {H.map.ViewPort} */ getViewPort(): H.map.ViewPort; @@ -105,7 +108,8 @@ declare namespace H { getImprint(): H.map.Imprint; /** - * This method captures desired region of the map and objects on it. Result is returned as an HTML5 Canvas element. Origin of coordinate system for capturing is in the top left corner of the viewport. + * This method captures desired region of the map and objects on it. Result is returned as an HTML5 Canvas element. + * Origin of coordinate system for capturing is in the top left corner of the viewport. * @param callback {function(HTMLCanvasElement=)} - Callback function to call once result of the capturing is ready * @param opt_capturables {Array=} - Collection of "capturable" element(s) to draw into the resulting canvas * @param opt_x1 {number=} - The X coordinate of the left edge of the capturing rectangle defaults to 0 @@ -113,7 +117,7 @@ declare namespace H { * @param opt_x2 {number=} - The X coordinate of the right edge of the capturing rectangle defaults to viewport width * @param opt_y2 {number=} - The Y coordinate of the bottom edge of the capturing rectangle defaults to viewport height */ - capture(callback?: (canvas: HTMLCanvasElement) => void, opt_capturables?: Array, opt_x1?: number, opt_y1?: number, opt_x2?: number, opt_y2?: number): void; + capture(callback?: (canvas: HTMLCanvasElement) => void, opt_capturables?: H.util.ICapturable[], opt_x1?: number, opt_y1?: number, opt_x2?: number, opt_y2?: number): void; /** * This method sets the rendering engine type for the map. Rendering engine is responsible for displaying i.e tiles and data on the map. @@ -123,7 +127,8 @@ declare namespace H { setEngineType(type: H.Map.EngineType): H.Map; /** - * To persistently store the content of a map layer for a given area and range of zoom levels. It can be used to enable map rendering when no internet connection is established and also to reduce the download traffic for frequently visited map areas. + * To persistently store the content of a map layer for a given area and range of zoom levels. + * It can be used to enable map rendering when no internet connection is established and also to reduce the download traffic for frequently visited map areas. * @param opt_onprogress {function(H.util.Request)=} - A callback which is invoked every time when the progress state of the returned store request changes. * @param opt_bounds {H.geo.Rect=} - The area to store, default is the current view bounds * @param opt_min {number=} - The minimum zoom level to store, default is the current zoom level @@ -209,21 +214,21 @@ declare namespace H { * This method retrieves the list of all objects which have been added to the map. * @returns {Array} - the list of all use objects which are currently on the map. */ - getObjects(): Array; + getObjects(): H.map.Object[]; /** * This method adds an array of objects or an object group to the map. * @param mapObjects {Array} * @returns {H.Map} - the map instance */ - addObjects(mapObjects: Array): H.Map; + addObjects(mapObjects: H.map.Object[]): H.Map; /** * This method removes an array of object or an object group from the map. * @param mapObjects {(Array | H.map.Group)} * @returns {H.Map} - the map instance */ - removeObjects(mapObjects: (Array | H.map.Group)): H.Map; + removeObjects(mapObjects: (H.map.Object[] | H.map.Group)): H.Map; /** * Returns the top most z-ordered map object found under the specific screen coordinates. Coordinates are viewport pixel coordinates starting from top left corner as (0, 0) point. @@ -239,7 +244,7 @@ declare namespace H { * @param y {number} - map viewport y-axis pixel coordinate * @returns {Array} */ - getObjectsAt(x: number, y: number): Array; + getObjectsAt(x: number, y: number): H.map.Object[]; /** * This method will dispatch event on the event target object @@ -257,16 +262,17 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } - export module Map { + namespace Map { /** - * It defines the number of lower and higher zoom levels, where cached content of the base map is rendered while content of the current zoom level is still loading. Example: if range was set to {lower: 3, higher: 2} and current level is 10 then rendering engine will try to display cached tiles from lower zoom levels 7, 8, 9 and higher levels 11 and 12. + * It defines the number of lower and higher zoom levels, where cached content of the base map is rendered while content of the current zoom level is still loading. + * Example: if range was set to {lower: 3, higher: 2} and current level is 10 then rendering engine will try to display cached tiles from lower zoom levels 7, 8, 9 and higher levels 11 and 12. * @property lower {number} - The number of lower zoom levels to take into account, default is 0 * @property higher {number} - The number of higher zoom levels to take into account, default is 0 */ - export interface BackgroundRange { + interface BackgroundRange { lower: number; higher: number; } @@ -274,7 +280,7 @@ declare namespace H { /** * Types of engines */ - export enum EngineType { + enum EngineType { P2D, PANORAMA, } @@ -288,17 +294,19 @@ declare namespace H { * @property engineType: {H.Map.EngineType=} - The initial engine type to use, default is P2D * @property pixelRatio {number} - The pixelRatio to use for over-sampling in cases of high-resolution displays, default is 1 * @property imprint {H.map.Imprint.Options=} - The imprint options or null to suppress the imprint - * @property renderBaseBackground {H.Map.BackgroundRange=} - Object describes how many cached zoom levels should be used as a base map background while base map tiles are loading. Example: {lower: 3, higher: 2} - * @property autoColor {boolean=} - Indicates whether the UI's colors should automatically adjusted to the base layer, default is true. Up to now only the copyright style will be adjusted. See H.map.layer.Layer.Options#dark + * @property renderBaseBackground {H.Map.BackgroundRange=} - Object describes how many cached zoom levels should be used as a base map background while base map tiles are loading. + * Example: {lower: 3, higher: 2} + * @property autoColor {boolean=} - Indicates whether the UI's colors should automatically adjusted to the base layer, default is true. Up to now only the copyright style will be adjusted. + * See H.map.layer.Layer.Options#dark * @property margin {number=} - The size in pixel of the supplemental area to render for each side of the map * @property padding {H.map.ViewPort.Padding=} - The padding in pixels for each side of the map * @property fixedCenter {boolean=} - Indicates whether the center of the map should remain unchanged if the viewport's size or padding has been changed, default is true */ - export interface Options { + interface Options { center?: H.geo.IPoint; zoom?: number; bounds?: H.geo.Rect; - layers?: Array; + layers?: H.map.layer.Layer[]; engineType?: EngineType; pixelRatio?: number; imprint?: H.map.Imprint.Options; @@ -311,7 +319,7 @@ declare namespace H { } /***** clustering *****/ - export module clustering { + namespace clustering { /** * This class represents the input data structure for data points to be clustered. * @property lat {H.geo.Latitude} - The latitude coordinate of the data point's position @@ -319,7 +327,7 @@ declare namespace H { * @property wt {number} - The weight of the data point * @property data {*} - Data associated with this data point */ - export class DataPoint implements H.geo.IPoint { + class DataPoint implements H.geo.IPoint { /** * Constructor * @param lat {H.geo.Latitude} - The latitude coordinate of the data point's position @@ -340,7 +348,7 @@ declare namespace H { /** * This interface describes a cluster of data points, which fulfill the clustering specification (i.e. data points are within the epsilon and there are enough points to form a cluster). */ - export interface ICluster { + interface ICluster { /** * Returns the maximum zoom level where this cluster doesn't fall apart into sub clusters and/or noise poinst * @returns {number} @@ -354,7 +362,8 @@ declare namespace H { getBounds(): H.geo.Rect; /** - * Invokes the specified callback for each "entry" of the cluster. That "entry" can be either a cluster which implements H.clustering.ICluster interface or a noise point which implements H.clustering.INoisePoint interface. + * Invokes the specified callback for each "entry" of the cluster. + * That "entry" can be either a cluster which implements H.clustering.ICluster interface or a noise point which implements H.clustering.INoisePoint interface. * @param callback {function(H.clustering.IResult)} - The callback gets the currently traversed entry as an argument, which is cluster or noise point. */ forEachEntry(callback: (result: H.clustering.IResult) => void): void; @@ -393,7 +402,7 @@ declare namespace H { /** * This interface represents a data point which does not belong to a cluster. */ - export interface INoisePoint { + interface INoisePoint { /** * This method returns data which coresponds to this noise point. * @returns {*} @@ -428,8 +437,7 @@ declare namespace H { /** * This interface represents the result item of a clustering operation. */ - export interface IResult { - + interface IResult { /** * Returns the geographical position of this cluster result. * @returns {H.geo.Point} @@ -458,8 +466,7 @@ declare namespace H { /** * Interface which specifies the methods a theme must implement. */ - export interface ITheme { - + interface ITheme { /** * Function returns a cluster presentation as a map object. * @param cluster {H.clustering.ICluster} @@ -476,17 +483,18 @@ declare namespace H { } /** - * The clustering provider serves clusters and noise point representation for the map depending on the provided data set. Levels for clustering as well as custom cluster representation can be set via Options. + * The clustering provider serves clusters and noise point representation for the map depending on the provided data set. + * Levels for clustering as well as custom cluster representation can be set via Options. * @property min {number} - Minimum zoom level at which provider can cluster data * @property max {number} - Maximum zoom level at which provider can cluster data */ - export class Provider extends H.util.EventTarget { + class Provider extends H.util.EventTarget { /** * Constructor * @param dataPoints {Array} * @param opt_options {H.clustering.Provider.Options=} */ - constructor(dataPoints: Array, opt_options?: H.clustering.Provider.Options); + constructor(dataPoints: H.clustering.DataPoint[], opt_options?: H.clustering.Provider.Options); /** * This method will dispatch event on the event target object @@ -504,13 +512,13 @@ declare namespace H { * @param callback {Function} * @param opt_scope {Object=} */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; /** * This method sets new data to the provider * @param dataPoints {Array} */ - setDataPoints(dataPoints: Array): void; + setDataPoints(dataPoints: H.clustering.DataPoint[]): void; /** * This method adds a data point to the provider. Beware that this method provokes reclustering of the whole data set. @@ -522,7 +530,7 @@ declare namespace H { * This method adds a list of data points to the provider. Beware that this method provokes reclustering of the whole data set. * @param dataPoints {Array} */ - addDataPoints(dataPoints: Array): void; + addDataPoints(dataPoints: H.clustering.DataPoint[]): void; /** * This method removes a data point from the provider. Beware that this method provokes reclustering of the whole data set. @@ -556,7 +564,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestDomMarkers(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestDomMarkers(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.DomMarker[]; /** * This method always returns true as we don't have information about visual representation until we have the clustering result and apply the theme. @@ -572,7 +580,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestMarkers(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestMarkers(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.Marker[]; /** * This method always returns true as we don't have information about visual representation until we have the clustering result and apply the theme. @@ -588,7 +596,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestSpatials(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestSpatials(bounds: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.Spatial[]; /** * Returns the spatial objects which intersect the given tile @@ -597,7 +605,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestSpatialsByTile(tile: H.map.provider.Tile, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestSpatialsByTile(tile: H.map.provider.Tile, visiblesOnly: boolean, cacheOnly: boolean): H.map.Spatial[]; /** * Returns the accumulate invalidations of this provider's objects that have occurred. @@ -616,15 +624,16 @@ declare namespace H { max: number; } - export module Provider { + namespace Provider { /** * Options which are used within cluster calculations. - * @property eps {number=} - epsilon parameter for cluster calculation. For the FASTGRID strategy it must not exceed 256 and must take values that are power of 2. For the GRID and DYNAMICGRID strategies it can take values from 10 to 127. Default is 32. + * @property eps {number=} - epsilon parameter for cluster calculation. For the FASTGRID strategy it must not exceed 256 and must take values that are power of 2. + * For the GRID and DYNAMICGRID strategies it can take values from 10 to 127. Default is 32. * @property minWeight {number=} - the minimum points weight sum to form a cluster, default is 2 * @property projection {H.geo.IProjection=} - projection to use for clustering, default is H.geo.mercator * @property strategy {H.clustering.Provider.Strategy=} - clustering stretegy, defaults to H.clustering.Provider.Strategy.FASTGRID */ - export interface ClusteringOptions { + interface ClusteringOptions { eps?: number; minWeight?: number; projection?: H.geo.IProjection; @@ -638,7 +647,7 @@ declare namespace H { * @property clusteringOptions {H.clustering.Provider.ClusteringOptions=} - options for clustering algorithm * @property theme {H.clustering.ITheme=} - cluster and noise point graphical representation */ - export interface Options { + interface Options { min?: number; max?: number; clusteringOptions?: H.clustering.Provider.ClusteringOptions; @@ -646,9 +655,12 @@ declare namespace H { } /** - * Enumeration represents possible clustering strategies. FASTGRID clustering is the efficient way to cluster large sets of data points. GRID clustering is slower but has greater precision due to the bigger range of epsilon values, this strategy suitable for clustering smaller data sets (up to 1000 data points) on desktop devices. DYNAMICGRID clustering uses the same algorithm of clustering as the GRID, but clusters on the viewport basis is meant to be used with data sets that are subject to the frequent update operations. + * Enumeration represents possible clustering strategies. FASTGRID clustering is the efficient way to cluster large sets of data points. + * GRID clustering is slower but has greater precision due to the bigger range of epsilon values, this strategy suitable for clustering smaller data sets (up to 1000 data points) + * on desktop devices. DYNAMICGRID clustering uses the same algorithm of clustering as the GRID, but clusters on the viewport basis is meant to be used with data sets that are subject + * to the frequent update operations. */ - export enum Strategy { + enum Strategy { FASTGRID, GRID, DYNAMICGRID, @@ -657,11 +669,11 @@ declare namespace H { } /***** data *****/ - export module data { + namespace data { /** * An abstract reader class defines interface for data readers and has general functionality related to fetching data and reader events. */ - export class AbstractReader extends H.util.EventTarget { + class AbstractReader extends H.util.EventTarget { /** * Constructor * @param opt_url {string=} @@ -669,7 +681,8 @@ declare namespace H { constructor(opt_url?: string); /** - * Method returns H.map.layer.ObjectLayer that contains parsed data, and can be added directly to the map. It returns new instance of the class with every invocation. If data hasn't been parsed it will return H.map.layer.ObjectLayer that contains partial information, and reader will add new parsed objects to the layer's provider later on. + * Method returns H.map.layer.ObjectLayer that contains parsed data, and can be added directly to the map. It returns new instance of the class with every invocation. + * If data hasn't been parsed it will return H.map.layer.ObjectLayer that contains partial information, and reader will add new parsed objects to the layer's provider later on. * @returns {H.map.layer.ObjectLayer} */ getLayer(): H.map.layer.ObjectLayer; @@ -678,7 +691,7 @@ declare namespace H { * Method returns collection of currently parsed, and converted to H.map.Object data objects. Method returns only currently parsed objects if parsing is ongoing. * @returns {Array} */ - getParsedObjects(): Array; + getParsedObjects(): H.map.Object[]; /** * Returns URL of the current file, which is either in process of fetching/parsing or file that has been already parsed. @@ -687,7 +700,8 @@ declare namespace H { getUrl(): string | void; /** - * Method sets reader's URL. Method resets current Reader's state to its initial values (clears data about last parsed objects, etc.), and throws InvalidState exception if Reader's state is not READY or ERROR. + * Method sets reader's URL. Method resets current Reader's state to its initial values (clears data about last parsed objects, etc.), and throws + * InvalidState exception if Reader's state is not READY or ERROR. * @param url {string} - The new URL * @returns {H.data.AbstractReader} */ @@ -700,16 +714,17 @@ declare namespace H { getState(): H.data.AbstractReader.State; /** - * Method launches parsing of the data file at the current url (see H.data.AbstractReader#setUrl or H.data.AbstractReader). Method uses XHR as a transport therefore same origin policy applies, or server should respond with proper CORS headers. + * Method launches parsing of the data file at the current url (see H.data.AbstractReader#setUrl or H.data.AbstractReader). + * Method uses XHR as a transport therefore same origin policy applies, or server should respond with proper CORS headers. */ parse(): void; } - export module AbstractReader { + namespace AbstractReader { /** * The event class for state events that are dispatched by AbstractReader */ - export class Event extends H.util.Event { + class Event extends H.util.Event { /** * Constructor * @param target {(H.data.AbstractReader | H.map.Object)} - The target that's passed to event listeners @@ -723,7 +738,7 @@ declare namespace H { /** * The state types of an Reader. Possible states are: */ - export enum State { + enum State { ERROR, LOADING, VISIT, @@ -733,16 +748,16 @@ declare namespace H { } /***** geo *****/ - export module geo { + namespace geo { /** * A Geographic coordinate that specifies the height of a point in meters. A value of undefined is treated as 0. */ - export type Altitude = number; + type Altitude = number; /** * Contexts for altitudes to specify the contextual origin of an altitude's value */ - export enum AltitudeContext { + enum AltitudeContext { /** Ground level */ undefined, /** Ground level */ @@ -766,14 +781,14 @@ declare namespace H { * @property alt {H.geo.Altitude=} - The altitude coordinate. * @property ctx {H.geo.AltitudeContext=} - The altitude context. */ - export interface IPoint { + interface IPoint { lat: H.geo.Latitude; lng: Longitude; alt?: H.geo.Altitude; ctx?: H.geo.AltitudeContext; } - export interface IProjection { + interface IProjection { latLngToPoint(lat: number, lng: number, opt_out?: H.math.Point): H.math.Point; xyToGeo(x: number, y: number, opt_out?: H.geo.Point): H.geo.Point; pointToGeo(point: H.math.IPoint, opt_out?: H.geo.Point): H.geo.Point; @@ -783,12 +798,12 @@ declare namespace H { /** * A geographic coordinate that specifies the north-south position of a point on the Earth's surface in the range from -90 to + 90 degrees, inclusive. */ - export type Latitude = number; + type Latitude = number; /** * A Geographic coordinate that specifies the east-west position of a point on the Earth's surface in the range from -180 to 180 degrees, inclusive. */ - export type Longitude = number; + type Longitude = number; /** * Class represents a geographical point, which is defined by the latitude, longitude and optional altitude. @@ -797,7 +812,7 @@ declare namespace H { * @property alt {H.geo.Altitude} - The altitude coordinate. * @property ctx {H.geo.AltitudeContext} - The altitude context. */ - export class Point implements IPoint { + class Point implements IPoint { /** * Constructor * @property lat {H.geo.Latitude} - The latitude coordinate. @@ -822,7 +837,8 @@ declare namespace H { distance(other: IPoint): number; /** - * This method calculates the geographic point of a destination point using the distance and bearing specified by the caller. The altitude is ignored, instead the WGS84 Mean Radius is taken. + * This method calculates the geographic point of a destination point using the distance and bearing specified by the caller. + * The altitude is ignored, instead the WGS84 Mean Radius is taken. * @param bearing {number} - The bearing to use in the calculation in degrees. * @param distance {number} - The distance to the destination in meters. * @param opt_overGreatCircle {boolean=} - If true the computation uses the 'Great Circle' otherwise 'Rhumb Line'. @@ -831,13 +847,14 @@ declare namespace H { walk(bearing: number, distance: number, opt_overGreatCircle?: boolean): Point; /** - * This method validates the given IPoint. It checks, if lat, lng, alt and ctx have valid types. Additionally the value of the lat property is clamped into a range of -90 ... +90 and the value of the lng property is modulo into a range of -180 ... +180 plus validates the values of the alt and ctx properties + * This method validates the given IPoint. It checks, if lat, lng, alt and ctx have valid types. Additionally the value of the lat property is clamped into a range of -90 ... +90 + * and the value of the lng property is modulo into a range of -180 ... +180 plus validates the values of the alt and ctx properties * @param point {H.geo.IPoint} - The point to validate * @param opt_caller {Function=} - The caller to use for InvalidArgumentError. If omitted no error is thrown * @param opt_argNr {number=} - The argument number to use for InvalidArgumentError. * @returns {boolean} - if the given point could validate */ - static validate(point: IPoint, opt_caller?: Function, opt_argNr?: number): boolean; + static validate(point: IPoint, opt_caller?: () => void, opt_argNr?: number): boolean; /** * This method creates a Point instance from a given IPoint object. @@ -855,7 +872,7 @@ declare namespace H { /** * This class represents a rectangular geographic area. The area is defined by four geographical coordinates two (left, right) longitudes and two (top, bottom) latitudes. */ - export class Rect { + class Rect { /** * Constructor * @param top {H.geo.Latitude} - the northern-most latitude @@ -1030,7 +1047,8 @@ declare namespace H { * @param opt_out {H.geo.Rect=} - an optional rect to store the results * @returns {H.geo.Rect} - either the opt_out rect or a new rect */ - static merge(topA: H.geo.Latitude, leftA: H.geo.Longitude, bottomA: H.geo.Latitude, rightA: H.geo.Longitude, topB: H.geo.Latitude, leftB: H.geo.Longitude, bottomB: H.geo.Latitude, rightB: H.geo.Longitude, opt_out?: H.geo.Rect): H.geo.Rect; + static merge(topA: H.geo.Latitude, leftA: H.geo.Longitude, bottomA: H.geo.Latitude, rightA: H.geo.Longitude, topB: H.geo.Latitude, leftB: H.geo.Longitude, bottomB: H.geo.Latitude, + rightB: H.geo.Longitude, opt_out?: H.geo.Rect): H.geo.Rect; /** * This method creates a rectangular area from a top-left and bottom-right point pair. @@ -1047,7 +1065,7 @@ declare namespace H { * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments * @returns {H.geo.Rect} - returns the minimum rectangular area covering the points or null if no point is covered */ - static coverPoints(pointArray: Array, opt_skipValidation?: boolean): H.geo.Rect; + static coverPoints(pointArray: H.geo.IPoint[], opt_skipValidation?: boolean): H.geo.Rect; /** * This method creates the minimum rectangular area covering all of the coordinates in the argument array. @@ -1055,7 +1073,7 @@ declare namespace H { * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments * @returns {(H.geo.Rect | undefined)} - returns the minimum rectangular area covering the coordinates */ - static coverLatLngAlts(latLngAltArray: Array, opt_skipValidation?: boolean): H.geo.Rect | void; + static coverLatLngAlts(latLngAltArray: number[], opt_skipValidation?: boolean): H.geo.Rect | void; /** * This method creates the minimum rectangular area covering all of the rectangular areas in the argument array. @@ -1063,7 +1081,7 @@ declare namespace H { * @param opt_skipValidation {boolean=} - a boolean flag indicating whether to check validity of the arguments * @returns {(H.geo.Rect | undefined)} - returns the minimum rectangular area covering the rectangular areas */ - static coverRects(rectArray: Array, opt_skipValidation?: boolean): H.geo.Rect | void; + static coverRects(rectArray: H.geo.Rect[], opt_skipValidation?: boolean): H.geo.Rect | void; /** * This method clones the given bounding rect and resizes the clone if necessary until the location supplied by the caller is at its center. @@ -1077,13 +1095,13 @@ declare namespace H { /** * A strip is a flat list of latitude, longitude, altitude tuples in a fixed order. */ - export class Strip { + class Strip { /** * Constructor * @param opt_latLngAlts {Array=} - An optional array of latitude, longitude and altitude triples to initialize the strip with. * @param opt_ctx {H.geo.AltitudeContext=} - An optional altitude context for all altitudes contained in this strip. */ - constructor(opt_latLngAlts?: Array, opt_ctx?: H.geo.AltitudeContext); + constructor(opt_latLngAlts?: number[], opt_ctx?: H.geo.AltitudeContext); /** * This method pushes a lat, lng, alt to the end of this strip. @@ -1100,7 +1118,7 @@ declare namespace H { * @param opt_latLngAlts {Array=} - The lat, lng, alt values to add * @returns {Array} - an array of removed elements */ - spliceLatLngAlts(index: number, opt_nRemove?: number, opt_latLngAlts?: Array): Array; + spliceLatLngAlts(index: number, opt_nRemove?: number, opt_latLngAlts?: number[]): number[]; /** * This method inserts one set of lat, lng, alt values into the strip at the specified index. @@ -1145,7 +1163,8 @@ declare namespace H { extractPoint(pointIndex: number, opt_out?: H.geo.Point): H.geo.Point; /** - * This method is a utility method that iterates over the lat, lng, alt array and calls the provided function for each 3 elements passing lat, lng and alt and the virtual point index as arguments. + * This method is a utility method that iterates over the lat, lng, alt array and calls the provided function for each 3 elements passing lat, lng and alt and the virtual point + * index as arguments. * @param eachFn {function(H.geo.Latitude, H.geo.Longitude, H.geo.Altitude, number)} - the function to be called for each 3 elements * @param opt_start {number=} - an optional start index to iterate from * @param opt_end {number=} - an optional end index to iterate to @@ -1169,7 +1188,7 @@ declare namespace H { * This method returns the internal array keeping the lat, lng, alt values. Modifying this array directly can destroy the integrity of this strip. Use it only for read access. * @returns {Array} - returns the raw lat, lng, alt values of this strip */ - getLatLngAltArray(): Array; + getLatLngAltArray(): number[]; /** * This method returns the bounding box of this strip. @@ -1190,18 +1209,18 @@ declare namespace H { * @param latLngs {Array} - the array of lat, lng value. * @returns {H.geo.Strip} - the strip containing the lat, lng values */ - static fromLatLngArray(latLngs: Array): H.geo.Strip; + static fromLatLngArray(latLngs: number[]): H.geo.Strip; } } /***** lang *****/ /***** map *****/ - export module map { + namespace map { /** * This class represents marker, which offers a means of identifying a location on the map with an icon. */ - export class AbstractMarker extends H.map.Object { + class AbstractMarker extends H.map.Object { /** * Constructor * @param position {H.geo.IPoint} - The location of this marker @@ -1236,18 +1255,19 @@ declare namespace H { setIcon(icon: (H.map.Icon | H.map.DomIcon)): H.map.AbstractMarker; } - export module AbstractMarker { + namespace AbstractMarker { /** * Options used to initialize a AbstractMarker * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true. * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. + * This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. * @property icon {(H.map.Icon | H.map.DomIcon)=} - The icon to use for the visual representation, if omitted a default icon is used. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. */ - export interface Options { + interface Options { min?: number; max?: number; visibility?: boolean; @@ -1261,7 +1281,7 @@ declare namespace H { /** * This class represents style attributes for arrows to be rendered along a polyline. A ArrowStyle instance is always treated as immutable to avoid inconstiencies and must not modified. */ - export class ArrowStyle { + class ArrowStyle { /** * Constructor * @param opt_options {(H.map.ArrowStyle | H.map.ArrowStyle.Options)=} @@ -1276,15 +1296,18 @@ declare namespace H { equals(other: (H.map.ArrowStyle | H.map.ArrowStyle.Options)): boolean; } - export module ArrowStyle { + namespace ArrowStyle { /** * An object type to specify the style of arrows to render along a polyline * @property fillColor {string=} - The CSS color value used to fill the arrow shapes. If omitted or the value evaluates to false it defaults to "rgba(255, 255, 255, 0.75)" - * @property width {number=} - The width of the arrow shape. The value is taken as a factor of the width of the line, where the arrow description is applied. If omitted or the value is <= 0 it defaults to 1.2 - * @property length {number=} - The length of the arrow shapes. The value is taken as a factor of the width of the line at the end of which the arrow is drawn. If omitted or the value is <= 0 it defaults to 1.6 - * @property frequency {number=} - The frequency of arrow shapes. The value is taken as factor of the length of the arrow. A value of 1 results in gapless arrows. If omitted or the value is false it defaults to 5 + * @property width {number=} - The width of the arrow shape. The value is taken as a factor of the width of the line, where the arrow description is applied. + * If omitted or the value is <= 0 it defaults to 1.2 + * @property length {number=} - The length of the arrow shapes. The value is taken as a factor of the width of the line at the end of which the arrow is drawn. + * If omitted or the value is <= 0 it defaults to 1.6 + * @property frequency {number=} - The frequency of arrow shapes. The value is taken as factor of the length of the arrow. A value of 1 results in gapless arrows. + * If omitted or the value is false it defaults to 5 */ - export interface Options { + interface Options { fillColor?: string; width?: number; length?: number; @@ -1295,17 +1318,18 @@ declare namespace H { /** * A Polygon with a circular shape. */ - export class Circle extends H.map.Polygon { + class Circle extends H.map.Polygon { /** * Constructor * @param center {H.geo.IPoint} - The geographical coordinates of the circle's center * @param radius {number} - The radius of the circle in meters - * @param opt_options {H.map.Circle.Options=} - An object that specifies circle options and their initial values (among these, precision has a significant impact on the shape of the circle - please see + * @param opt_options {H.map.Circle.Options=} - An object that specifies circle options and their initial values (among these, precision has a significant impact on the shape of the circle */ constructor(center: H.geo.IPoint, radius: number, opt_options?: H.map.Circle.Options); /** - * To set the geographical center point of this circle. If the specified center is an instance of H.geo.Point you must not modify this Point instance without calling setCenter immediately afterwards. + * To set the geographical center point of this circle. If the specified center is an instance of H.geo.Point you must not modify this Point instance without calling setCenter + * immediately afterwards. * @param center {H.geo.IPoint} */ setCenter(center: H.geo.IPoint): void; @@ -1341,18 +1365,22 @@ declare namespace H { getPrecision(): number; } - export module Circle { + namespace Circle { /** * @property style {H.map.SpatialStyle=} - the style to be used when tracing the polyline * @property visibility {boolean=} - An optional boolean value indicating whether this map object is visible, default is true - * @property precision {number=} - The precision of a circle as a number of segments to be used when rendering the circle. The value is clamped to the range between [4 ... 360], where 60 is the default. Note that the lower the value the more angular and the less circle-like the shape appears and, conversely, the higher the value the smoother and more rounded the result. Thus, starting at the extreme low end of the possible values, 4 produces a square, 6 a hexagon, while 30 results in a circle-like shape, although it appears increasingly angular as the zoom level increases (as you zoom in), and finally 360 produces a smooth circle. + * @property precision {number=} - The precision of a circle as a number of segments to be used when rendering the circle. The value is clamped to the range between [4 ... 360], where 60 is + * the default. Note that the lower the value the more angular and the less circle-like the shape appears and, conversely, the higher the value the smoother and more rounded the result. + * Thus, starting at the extreme low end of the possible values, 4 produces a square, 6 a hexagon, while 30 results in a circle-like shape, although it appears increasingly angular as + * the zoom level increases (as you zoom in), and finally 360 produces a smooth circle. * @property zIndex {number=} - The z-index value of the circle, default is 0 * @property min {number=} - The minimum zoom level for which the circle is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the circle is visible, default is Infinity - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. + * This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData */ - export interface Options { + interface Options { style?: H.map.SpatialStyle | H.map.SpatialStyle.Options; visibility?: boolean; precision?: number; @@ -1365,20 +1393,21 @@ declare namespace H { } /** - * The class represents data model of the map. It holds list of layers that are rendered by map's RenderEngine. The class listens to 'update' events from layers and dispatches them to the RenderEngine. + * The class represents data model of the map. It holds list of layers that are rendered by map's RenderEngine. + * The class listens to 'update' events from layers and dispatches them to the RenderEngine. */ - export class DataModel extends H.util.OList { + class DataModel extends H.util.OList { /** * Constructor * @param opt_layers {Array=} - array of layers to be added to the data model */ - constructor(opt_layers?: Array); + constructor(opt_layers?: H.map.layer.Layer[]); } /** * A visual representation of the H.map.DomMarker. */ - export class DomIcon { + class DomIcon { /** * Constructor * @param element {!(Element | string)} - The element or markup to use for this icon @@ -1387,22 +1416,25 @@ declare namespace H { constructor(element: (Element | string), opt_options?: H.map.DomIcon.Options); } - export module DomIcon { + namespace DomIcon { /** * Options used to initialize a DomIcon - * @property onAttach {function(Element, H.map.DomIcon, H.map.DomMarker)=} - A callback which is invoked before a clone of the icon's element is appended and displayed on the map. This callback can be used to setup the clone. - * @property onDetach {function(Element, H.map.DomIcon, H.map.DomMarker)=} - A callback which is invoked after a clone of the icon's element is removed from the map. This callback can be used to clean up the clone. + * @property onAttach {function(Element, H.map.DomIcon, H.map.DomMarker)=} - A callback which is invoked before a clone of the icon's element is appended and displayed on the map. + * This callback can be used to setup the clone. + * @property onDetach {function(Element, H.map.DomIcon, H.map.DomMarker)=} - A callback which is invoked after a clone of the icon's element is removed from the map. + * This callback can be used to clean up the clone. */ - export interface Options { - onAttach?: (el: Element, icon: H.map.DomIcon, marker: H.map.DomMarker) => void; - onDetach?: (el: Element, icon: H.map.DomIcon, marker: H.map.DomMarker) => void; + interface Options { + onAttach?(el: Element, icon: H.map.DomIcon, marker: H.map.DomMarker): void; + onDetach?(el: Element, icon: H.map.DomIcon, marker: H.map.DomMarker): void; } } /** - * A marker with a visual representation in the form of a full styleable and scripteable DOM element. DomMarker are predestinated if small amounts of markers with dynamic styled and/or scripted icons should be displayed om the map (e.g. animated interactive SVG). + * A marker with a visual representation in the form of a full styleable and scripteable DOM element. DomMarker are predestinated if small amounts of markers with dynamic styled and/or + * scripted icons should be displayed om the map (e.g. animated interactive SVG). */ - export class DomMarker extends H.map.AbstractMarker { + class DomMarker extends H.map.AbstractMarker { /** * Constructor * @param position {H.geo.IPoint} @@ -1411,18 +1443,19 @@ declare namespace H { constructor(position: H.geo.IPoint, opt_options?: H.map.DomMarker.Options); } - export module DomMarker { + namespace DomMarker { /** * Options used to initialize a DomMarker * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true. * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to + * instantiate an object. * @property icon {H.map.DomIcon=} - The icon to use for the visual representation, if omitted a default icon is used. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData */ - export interface Options { + interface Options { min?: number; max?: number; visibility?: boolean; @@ -1436,7 +1469,7 @@ declare namespace H { /** * This class represents a spatial shape in geographic space. It is defined by a path containing the vertices of the shape (lat, lng, alt values). */ - export class GeoShape extends H.map.Spatial { + class GeoShape extends H.map.Spatial { /** * Constructor * @param isClosed {boolean} - Indicates whether this geographical shape is closed (a polygon) @@ -1468,7 +1501,7 @@ declare namespace H { /** * This class represents a map object which can contain other map objects. It's visibility, zIndex and object-order influences the contained map objects */ - export class Group extends H.map.Object { + class Group extends H.map.Object { /** * Constructor * @param opt_options {H.map.Group.Options=} - an optional object containing initialization values @@ -1488,7 +1521,7 @@ declare namespace H { * @param opt_recursive {boolean=} - Indicates whether objects in sub-groups are also collected . * @returns {!Array} */ - getObjects(opt_recursive?: boolean): Array; + getObjects(opt_recursive?: boolean): H.map.Object[]; /** * Method returns the bounding rectangle for the group. The rectangle is the smallest rectangle that covers all objects. If group doesn't contains objects method returns null. @@ -1507,7 +1540,7 @@ declare namespace H { * Appends a list of objects to this group * @param objects {Array} */ - addObjects(objects: Array): void; + addObjects(objects: H.map.Object[]): void; /** * Removes an object from this group. @@ -1520,7 +1553,7 @@ declare namespace H { * Removes objects from this group. * @param objects {!Array} - The list of objects to remove */ - removeObjects(objects: Array): void; + removeObjects(objects: H.map.Object[]): void; /** * Method removes all objects from the group. @@ -1528,45 +1561,46 @@ declare namespace H { removeAll(): void; } - export module Group { + namespace Group { /** * Options used to initialize a group * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity * @property visibility {boolean=} - Indicates whether the map object is visible, default is true * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate + * an object. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. * @property objects {Array=} - A list of map objects to add initially to this group. */ - export interface Options { + interface Options { min?: number; max?: number; visibility?: boolean; zIndex?: number; provider?: H.map.provider.Provider; data?: any; - objects?: Array; + objects?: H.map.Object[]; } } /** * This class represents an area that objects, like a marker, occupies in the screen space, meaning that object can be probed and returned by H.Map@getObjectsAt method. */ - export class HitArea { + class HitArea { /** * Constructor * @param shapeType {H.map.HitArea.ShapeType} - The shape type of the HitArea * @param opt_values {Array=} - The type-dependent values to define the shape of the hit area. The format for the different types are: */ - constructor(shapeType: H.map.HitArea.ShapeType, opt_values?: Array); + constructor(shapeType: H.map.HitArea.ShapeType, opt_values?: number[]); } - export module HitArea { + namespace HitArea { /** * Enumeration represents possible shape types that HitArea can have. */ - export enum ShapeType { + enum ShapeType { NONE, RECT, CIRCLE, @@ -1577,8 +1611,7 @@ declare namespace H { /** * Control interface defines method which are used for direct view or camera manipulation */ - export interface IControl { - + interface IControl { /** * This method starts control action for camera. This action allows to control camera animation and movement according to provided values in the H.map.IControl#control function * @param opt_kinetics {H.util.kinetics.IKinetics=} - kinetics settings @@ -1588,7 +1621,8 @@ declare namespace H { startControl(opt_kinetics?: H.util.kinetics.IKinetics, opt_atX?: number, opt_atY?: number): void; /** - * This method triggers single control action on engine. This will trigger an animation which will start modification of the view's or camera's properties according to values begin set. Modification will occur at every frame. The speed values are measure by 'levels per frame' were 1 level cooresponds to a distance to next zoom level. + * This method triggers single control action on engine. This will trigger an animation which will start modification of the view's or camera's properties according to values begin set. + * Modification will occur at every frame. The speed values are measure by 'levels per frame' were 1 level cooresponds to a distance to next zoom level. * @param moveX {number} - moves the view/cam in right/left direction * @param moveY {number} - moves the view/cam in bottom/top direction * @param moveZ {number} - moves the view/cam in depth direction (changes zoom level) @@ -1601,9 +1635,11 @@ declare namespace H { control(moveX: number, moveY: number, moveZ: number, angleX: number, angleY: number, angleZ: number, zoom: number, opt_timestamp?: number): void; /** - * This method ends current control, which will stop ongoing animation triggered by the startControl method. This method can prevent kinetics as well as it can adjust the final view if the adjust function is being passed. + * This method ends current control, which will stop ongoing animation triggered by the startControl method. This method can prevent kinetics as well as it can adjust the final view if + * the adjust function is being passed. * @param opt_preventKinetics {boolean=} - if set to true will prevent kinetics animation - * @param opt_adjustView {function(H.map.ViewModel.CameraData)=} - user defined function which can adjust the final view this function takes last requestedData from the view model and should return a modified H.map.ViewModel.CameraData which will be set as the final view + * @param opt_adjustView {function(H.map.ViewModel.CameraData)=} - user defined function which can adjust the final view this function takes last requestedData from the view model and + * should return a modified H.map.ViewModel.CameraData which will be set as the final view */ endControl(opt_preventKinetics?: boolean, opt_adjustView?: (data: H.map.ViewModel.CameraData) => void): void; } @@ -1613,15 +1649,16 @@ declare namespace H { * @property label {string} - A short textual representation of the copyright note, e.g. "DigitalGlobe 2009" * @property alt {string} - A detailed textual representation of the copyright note, e.g. "copyright 2009 DigitalGlobe, Inc." */ - export interface ICopyright { + interface ICopyright { label: string; alt: string; } /** - * Interface describes interaction with the view port. Interaction will reflect view change depending on the interaction coordinates passed and the modifiers which specify the type of interaction. + * Interface describes interaction with the view port. Interaction will reflect view change depending on the interaction coordinates passed and the modifiers which specify the type of + * interaction. */ - export interface IInteraction { + interface IInteraction { /** * This method starts the interaction with the view port. Should be called every time when new interaction is started i.e mouse grab, or touch start. * @param modifiers {number} - a bitmask which specifies what operations should performed during every interaction @@ -1649,7 +1686,7 @@ declare namespace H { /** * A visual representation of the H.map.Marker. */ - export class Icon { + class Icon { /** * Constructor * @param bitmap {!(string | HTMLImageElement | HTMLCanvasElement)} - Either an image URL, a SVG markup, an image or a canvas. @@ -1688,13 +1725,14 @@ declare namespace H { getHitArea(): H.map.HitArea; /** - * This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. Otherwise memory leak is possible. + * This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. + * Otherwise memory leak is possible. * @param type {string} - name of event * @param handler {Function} - event handler function * @param opt_capture {boolean=} - if set to true will listen in the capture phase (bubble otherwise) * @param opt_scope {Object=} - scope for the handler function */ - addEventListener(type: string, handler: Function, opt_capture?: boolean, opt_scope?: Object): void; + addEventListener(type: string, handler: () => void, opt_capture?: boolean, opt_scope?: {}): void; /** * This method will removed previously added listener from the event target @@ -1703,7 +1741,7 @@ declare namespace H { * @param opt_capture {boolean=} - if set to true will listen in the capture phase (bubble otherwise) * @param opt_scope {Object=} - scope for the handler function */ - removeEventListener(type: string, handler: Function, opt_capture?: boolean, opt_scope?: Object): void; + removeEventListener(type: string, handler: () => void, opt_capture?: boolean, opt_scope?: {}): void; /** * This method will dispatch event on the event target object @@ -1721,14 +1759,14 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } - export module Icon { + namespace Icon { /** * The state types of an Icon */ - export enum State { + enum State { ERROR, LOADING, READY, @@ -1739,10 +1777,12 @@ declare namespace H { * @property size {H.math.ISize=} - The icon's size in pixel, default is the bitmap's natural size * @property anchor {H.math.IPoint=} - The anchorage point in pixel, default is bottom-center * @property hitArea {H.map.HitArea=} - The area to use for hit detection, default is the whole rectangular area - * @property asCanvas {H.map.HitArea=} - Indicates whether a non canvas bitmap is converted into a canvas, default is true. The conversion improves the rendering performance but it could also cause a higher memory consumption. - * @property crossOrigin {boolean} - Specifies whether to use anonynous Cross-Origin Resource Sharing (CORS) when fetching an image to prevent resulting canvas from tainting, default is false. The option is ignored by IE9-10. + * @property asCanvas {H.map.HitArea=} - Indicates whether a non canvas bitmap is converted into a canvas, default is true. The conversion improves the rendering performance but it could + * also cause a higher memory consumption. + * @property crossOrigin {boolean} - Specifies whether to use anonynous Cross-Origin Resource Sharing (CORS) when fetching an image to prevent resulting canvas from tainting, default is + * false. The option is ignored by IE9-10. */ - export interface Options { + interface Options { size?: H.math.ISize | number; anchor?: H.math.IPoint; hitArea?: H.map.HitArea; @@ -1754,7 +1794,7 @@ declare namespace H { /** * This class encapsulates the brand, copyright and terms of use elements on the map. */ - export class Imprint { + class Imprint { /** * Constructor * @param map {H.Map} - The map where the imprint is attached to @@ -1785,7 +1825,7 @@ declare namespace H { * @param callback {Function} * @param opt_scope {Object=} */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; /** * This method is used to capture the element view @@ -1797,14 +1837,14 @@ declare namespace H { capture(canvas: HTMLCanvasElement, pixelRatio: number, callback?: (canvas: HTMLCanvasElement) => void, opt_errback?: (s: string) => void): void; } - export module Imprint { + namespace Imprint { /** * Options to style an imprint * @property invert {boolean=} - Indicates whether the logo is inverted. If omitted the current value remains, default is false. * @property font {string=} - The font of the text. If omitted the current value remains, default is "11px Arial,sans-serif". * @property href {string=} - The URL of the "Terms of use" link. If omitted the current value remains, default is "http://here.com/terms". */ - export interface Options { + interface Options { invert?: boolean; font?: string; href?: string; @@ -1814,7 +1854,7 @@ declare namespace H { /** * A marker with a visual representation in the form of a bitmap icon. Marker are predestinated if large amounts of markers with static icons should be displayed om the map. */ - export class Marker extends H.map.AbstractMarker { + class Marker extends H.map.AbstractMarker { /** * Constructor * @param position {H.geo.IPoint} - The location of this marker @@ -1823,18 +1863,19 @@ declare namespace H { constructor(position: H.geo.IPoint, opt_options?: H.map.Marker.Options); } - export module Marker { + namespace Marker { /** * Options used to initialize a Marker * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true. * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate + * an object. * @property icon {H.map.Icon=} - The icon to use for the visual representation, if omitted a default icon is used. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. */ - export interface Options { + interface Options { min?: number; max?: number; visibility?: boolean; @@ -1848,7 +1889,7 @@ declare namespace H { /** * This class represents the abstract base class for map objects such as polylines, polygons, markers, groups etc. */ - export class Object extends H.util.EventTarget { + class Object extends H.util.EventTarget { /** * Constructor * @param opt_options {H.map.Object.Options=} - The values to initialize this object @@ -1963,20 +2004,21 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } - export module Object { + namespace Object { /** * Options used to initialize a map object * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate + * an object. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. */ - export interface Options { + interface Options { min?: number; max?: number; visibility?: boolean; @@ -1988,7 +2030,7 @@ declare namespace H { /** * The major types of map objects */ - export enum Type { + enum Type { /** spatial object */ ANY, /** spatial object */ @@ -2007,7 +2049,7 @@ declare namespace H { /** * This class represents an overlay, which offers a bitmap that covers a geographical reactangular area on the map. */ - export class Overlay extends H.map.Object { + class Overlay extends H.map.Object { /** * Constructor * @param bounds {H.geo.Rect} - The geographical reactangular area of this overlay @@ -2056,7 +2098,7 @@ declare namespace H { setOpacity(opacity: number): H.map.Overlay; } - export module Overlay { + namespace Overlay { /** * Options used to initialize an Overlay * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity @@ -2064,10 +2106,11 @@ declare namespace H { * @property opacity {number=} - The opacity of the object in range from 0 (transparent) to 1 (opaque), default is 1. * @property visibility {boolean=} - Indicates whether the map object is visible at all, default is true. * @property zIndex {number=} - The z-index value of the map object, default is 0 - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate + * an object. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. */ - export interface Options { + interface Options { min?: number; max?: number; opacity?: number; @@ -2079,9 +2122,11 @@ declare namespace H { } /** - * This class represents a polygon in geo-space. It is defined by a strip containing the vertices of a geo shape object (lat, lng, alt values) and a pen to use when rendering the polyline. Polygon represents a closed plane defined by the list of verticies, projected on the map display. List of vericies which define the polygon are is a list of geo coordinates encapsulated by the strip object H.geo.Strip + * This class represents a polygon in geo-space. It is defined by a strip containing the vertices of a geo shape object (lat, lng, alt values) and a pen to use when rendering the polyline. + * Polygon represents a closed plane defined by the list of verticies, projected on the map display. List of vericies which define the polygon are is a list of geo coordinates encapsulated + * by the strip object H.geo.Strip */ - export class Polygon extends H.map.GeoShape { + class Polygon extends H.map.GeoShape { /** * Constructor * @param strip {H.geo.Strip} - the strip describing this polygon's vertices @@ -2090,7 +2135,8 @@ declare namespace H { constructor(strip: H.geo.Strip, opt_options?: H.map.Spatial.Options); /** - * To set the indicator whether this polygon covers the north pole. It's needed for Polygons whose strip is defined as lines arround the world on longitude axis (for example a circle whose center is one of the poles). In this case a additional information is needed to know if the southern or northern part of the world should be covered by the poygon. + * To set the indicator whether this polygon covers the north pole. It's needed for Polygons whose strip is defined as lines arround the world on longitude axis (for example a circle whose + * center is one of the poles). In this case a additional information is needed to know if the southern or northern part of the world should be covered by the poygon. * @param flag {boolean} - A value of true means it covers the north pole, false means south pole * @returns {H.map.Polygon} - the Polygon instance itself */ @@ -2106,7 +2152,7 @@ declare namespace H { /** * This class represents a polyline in geo-space. It is defined by a path containing the vertices of a polyline (lat, lng, alt values) and a pen to use when tracing the path on the map. */ - export class Polyline extends H.map.GeoShape { + class Polyline extends H.map.GeoShape { /** * Constructor * @param strip {H.geo.Strip} - the strip describing this polygon's vertices @@ -2119,10 +2165,10 @@ declare namespace H { * @param geoRect {H.geo.Rect} * @returns {Array>} */ - clip(geoRect: H.geo.Rect): Array>; + clip(geoRect: H.geo.Rect): [number[]]; } - export module Polyline { + namespace Polyline { /** * Options which are used to initialize a polyline * @property style {(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} - the style to be used when tracing the polyline @@ -2131,10 +2177,11 @@ declare namespace H { * @property zIndex {number=} - The z-index value of the map object, default is 0 * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate + * an object. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData */ - export interface Options { + interface Options { style?: (H.map.SpatialStyle | H.map.SpatialStyle.Options); arrows?: (H.map.ArrowStyle | H.map.ArrowStyle.Options); visibility?: boolean; @@ -2149,7 +2196,7 @@ declare namespace H { /** * A Polygon with a rectangular shape. */ - export class Rect extends H.map.Polygon { + class Rect extends H.map.Polygon { /** * Constructor * @param bounds {H.geo.Rect} - The geographical bounding box for this rectangle @@ -2167,7 +2214,7 @@ declare namespace H { /** * This class represents a spatial map object which provides its projected geometry. */ - export class Spatial extends H.map.Object { + class Spatial extends H.map.Object { /** * Constructor * @param isClosed {boolean} - Indicates whether this spatial object represents a closed shape @@ -2182,14 +2229,16 @@ declare namespace H { getStyle(): H.map.SpatialStyle; /** - * To set the drawing style of this object. If the passed opt_style argument is an instance of H.map.SpatialStyle it is treated as immutable and must not be modified afterwards to prevent inconsistancies! . + * To set the drawing style of this object. If the passed opt_style argument is an instance of H.map.SpatialStyle it is treated as immutable and must not be modified afterwards to prevent + * inconsistancies! * @param opt_style {(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} - The style to set. If it evaluates to a falsy the H.map.SpatialStyle.DEFAULT_STYLE is used. * @returns {H.map.Spatial} - the Spatial instance itself */ setStyle(opt_style?: (H.map.SpatialStyle | H.map.SpatialStyle.Options)): H.map.Spatial; /** - * To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow style is treated as immutable and must not be modified afterwards to prevent inconsistancies! + * To get the arrow style of this spatial object or undefined if no style is defined. A returned arrow style is treated as immutable and must not be modified afterwards to prevent + * inconsistancies! * @returns {(H.map.ArrowStyle | undefined)} */ getArrows(): H.map.ArrowStyle | void; @@ -2208,7 +2257,7 @@ declare namespace H { isClosed(): boolean; } - export module Spatial { + namespace Spatial { /** * Data to used as rendering hint for a label * @property x {number} - The X coordinate of the first line's starting point @@ -2219,7 +2268,7 @@ declare namespace H { * @property color {string} - The CSS color * @property text {string} - The text content, new line characters (\u000A) are interpreted as line breaks */ - export interface Label { + interface Label { x: number; y: number; angle: number; @@ -2237,10 +2286,11 @@ declare namespace H { * @property zIndex {number=} - The z-index value of the map object, default is 0 * @property min {number=} - The minimum zoom level for which the object is visible, default is -Infinity * @property max {number=} - The maximum zoom level for which the object is visible, default is Infinity - * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate an object. + * @property provider {(H.map.provider.Provider | null)=} - The provider of this object. This property is only needed if a customized Implementation of ObjectProvider wants to instantiate + * an object. * @property data {*} - Optional arbitrary data to be stored with this map object. This data can be retrieved by calling getData. */ - export interface Options { + interface Options { style?: (H.map.SpatialStyle | H.map.SpatialStyle.Options); arrows?: (H.map.ArrowStyle | H.map.ArrowStyle.Options); visibility?: boolean; @@ -2253,19 +2303,21 @@ declare namespace H { } /** - * The SpatialStyle class represents a style with which spatial objects like polylines and polygons are drawn. A SpatialStyle instance is always treated as immutable to avoid inconstiencies and must not modified. + * The SpatialStyle class represents a style with which spatial objects like polylines and polygons are drawn. A SpatialStyle instance is always treated as immutable to avoid inconstiencies + * and must not modified. * @property strokeColor {string} - The color of the stroke in CSS syntax, default is 'rgba(0, 85, 170, 0.6)'. * @property fillColor {string} - The filling color in CSS syntax, default is 'rgba(0, 85, 170, 0.4)'. * @property lineWidth {number} - The width of the line in pixels, default is 2. * @property lineCap {H.map.SpatialStyle.LineCap} - The style of the end caps for a line, default is 'round'. * @property lineJoin {H.map.SpatialStyle.LineJoin} - The type of corner created, when two lines meet, default is 'miter'. * @property miterLimit {number} - The miter length is the distance between the inner corner and the outer corner where two lines meet. The default is 10. - * @property lineDash {Array} - The line dash pattern as an even numbered list of distances to alternately produce a line and a space. The default is [ ]. + * @property lineDash {Array} - The line dash pattern as an even numbered list of distances to alternately produce a line and a space. The default is []. * @property lineDashOffset {number} - The phase offset of the line dash pattern The default is 0. * @property MAX_LINE_WIDTH {number} - This constant represents the maximum line width which can be used for rendering. - * @property DEFAULT_STYLE {H.map.SpatialStyle} - This static member defines the default style for spatial objects on the map. It's value is { strokeColor: '#05A', fillColor: 'rgba(0, 85, 170, 0.4)' lineWidth: 1, lineCap: 'round', lineJoin: 'miter', miterLimit: 10, lineDash: [ ], lineDashOffset: 0 } + * @property DEFAULT_STYLE {H.map.SpatialStyle} - This static member defines the default style for spatial objects on the map. It's value is + * { strokeColor: '#05A', fillColor: 'rgba(0, 85, 170, 0.4)', lineWidth: 1, lineCap: 'round', lineJoin: 'miter', miterLimit: 10, lineDash: [], lineDashOffset: 0 } */ - export class SpatialStyle { + class SpatialStyle { /** * Constructor * @param opt_options {(H.map.SpatialStyle | H.map.SpatialStyle.Options)=} - The optional style attributes @@ -2292,22 +2344,22 @@ declare namespace H { lineCap: H.map.SpatialStyle.LineCap; lineJoin: H.map.SpatialStyle.LineJoin; miterLimit: number; - lineDash: Array; + lineDash: number[]; lineDashOffset: number; static MAX_LINE_WIDTH: number; static DEFAULT_STYLE: H.map.SpatialStyle; } - export module SpatialStyle { + namespace SpatialStyle { /** * The style of the end caps for a line, one of 'butt', 'round' or 'square'. */ - export type LineCap = 'butt' | 'round' | 'square'; + type LineCap = 'butt' | 'round' | 'square'; /** * The type of corner created, when two lines meet, one of 'round', 'bevel' or 'miter'. */ - export type LineJoin = 'round' | 'bevel' | 'miter'; + type LineJoin = 'round' | 'bevel' | 'miter'; /** * Options used to initialize a style. If a property is not set, the default value from H.map.SpatialStyle is taken. @@ -2317,25 +2369,27 @@ declare namespace H { * @property lineCap {H.map.SpatialStyle.LineCap=} - The style of the end caps for a line. * @property lineJoin {H.map.SpatialStyle.LineJoin=} - The type of corner created, when two lines meet. * @property miterLimit {number=} - The miter limit in pixel, default is 10. The maximum supported miter limit is 100 - * @property lineDash {Array} - The line dash pattern as an even numbered list of distances to alternately produce a line and a space. If the browser doesn't support this feature this style property is ignored. + * @property lineDash {Array} - The line dash pattern as an even numbered list of distances to alternately produce a line and a space. If the browser doesn't support this feature + * this style property is ignored. * @property lineDashOffset {number=} - The phase offset of the line dash pattern */ - export interface Options { + interface Options { strokeColor?: string; fillColor?: string; lineWidth?: number; lineCap?: H.map.SpatialStyle.LineCap; lineJoin?: H.map.SpatialStyle.LineJoin; miterLimit?: number; - lineDash?: Array; + lineDash?: number[]; lineDashOffset?: number; } } /** - * This class represents a view of the map. It consists of a virtual camera and a look-at point both of which have a position in geo-space and orientation angles. The view model allows to change the values of these objects in order to move or rotate the map or zoom in and out. + * This class represents a view of the map. It consists of a virtual camera and a look-at point both of which have a position in geo-space and orientation angles. The view model allows to + * change the values of these objects in order to move or rotate the map or zoom in and out. */ - export class ViewModel extends H.util.EventTarget implements H.map.IControl { + class ViewModel extends H.util.EventTarget implements H.map.IControl { /** * This method returns the camera data, which is currently rendered. * @returns {H.map.ViewModel.CameraData} - the current rendered camera data @@ -2411,10 +2465,10 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } - export module ViewModel { + namespace ViewModel { /** * Defines camera's properties. * @property zoom {number=} - zoom level to be used by rendering engine @@ -2424,7 +2478,7 @@ declare namespace H { * @property roll {number=} - the rotation of the virtual camera along its local z-axis * @property fov {number=} - */ - export interface CameraData { + interface CameraData { zoom?: number; position: H.geo.IPoint; pitch?: number; @@ -2439,7 +2493,7 @@ declare namespace H { * @property zoom {number=} - The requested zoom level * @property animate {boolean=} - indicates if the requested transition should be animated */ - export interface RequestedData { + interface RequestedData { camera?: H.map.ViewModel.CameraData; zoom?: number; animate?: boolean; @@ -2452,7 +2506,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class UpdateEvent extends H.util.Event { + class UpdateEvent extends H.util.Event { /** * Constructor * @param requested {H.map.ViewModel.RequestedData} @@ -2477,7 +2531,8 @@ declare namespace H { } /** - * ViewPort object holds information about the HTML element where the map is rendered. It contains information regarding the element (view port) size and triggers events when the element size is changed. + * ViewPort object holds information about the HTML element where the map is rendered. It contains information regarding the element (view port) size and triggers events when the element size + * is changed. * @property element {Element} - This property holds the HTML element, which defines the viewport. * @property width {number} - This property holds this viewport's current width * @property height {number} - This property holds this viewport's current height @@ -2485,7 +2540,7 @@ declare namespace H { * @property padding {H.map.ViewPort.Padding} - This property holds this viewport's current padding * @property center {H.math.Point} - This property holds this viewport's current center point */ - export class ViewPort extends H.util.EventTarget implements H.map.IInteraction { + class ViewPort extends H.util.EventTarget implements H.map.IInteraction { /** * Constructor * @param element {Element} - html element were map will be rendered @@ -2552,7 +2607,7 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; element: Element; width: number; @@ -2562,14 +2617,14 @@ declare namespace H { center: H.math.Point; } - export module ViewPort { + namespace ViewPort { /** * Options which may be used to initialize new ViewPort instance * @property margin {number=} - The size in pixel of the supplemental area to render for each side of the map * @property padding {H.map.ViewPort.Padding=} - The padding in pixels for each side of the map * @property fixedCenter {boolean=} - Indicates whether the center of the map should remain unchanged if the viewport's size or or padding has been changed, default is true */ - export interface Options { + interface Options { margin?: number; padding?: H.map.ViewPort.Padding; fixedCenter?: boolean; @@ -2582,7 +2637,7 @@ declare namespace H { * @property bottom {number} - the padding on the bottom edge (in pixels) * @property left {number} - the padding on the left edge (in pixels) */ - export interface Padding { + interface Padding { top: number; right: number; bottom: number; @@ -2590,11 +2645,12 @@ declare namespace H { } } - export module layer { + namespace layer { /** - * BaseTileLayer encapsulates funcitonailty that is common to all layers that deliver tiles, such as H.map.layer.TileLayer. The functionality includes geo bounding box to grid calculation, tile request management. + * BaseTileLayer encapsulates funcitonailty that is common to all layers that deliver tiles, such as H.map.layer.TileLayer. The functionality includes geo bounding box to grid + * calculation, tile request management. */ - export class BaseTileLayer extends H.map.layer.Layer { + class BaseTileLayer extends H.map.layer.Layer { /** * Constructor * @param provider {H.map.provider.TileProvider} - data source for the TileLayer @@ -2643,7 +2699,8 @@ declare namespace H { cancelTile(x: number, y: number, z: number): void; /** - * This method requests tiles from the data source (provider). It can return a set of tiles which are currently loaded. All tiles which are not yet loaded will be included in response as soon as they will be available during subsequent calls. + * This method requests tiles from the data source (provider). It can return a set of tiles which are currently loaded. All tiles which are not yet loaded will be included in response + * as soon as they will be available during subsequent calls. * @param tileBounds {H.math.Rect} - bounds in tile grid * @param isCDB {boolean} * @param zoomLevel {number} - The zoom level for which the objects are requested @@ -2657,8 +2714,7 @@ declare namespace H { /** * This interface describes a layer which provides marker objects to the renderer. */ - export interface IMarkerLayer { - + interface IMarkerLayer { /** * This method requests marker objects for provided bounding rectangle. * @param boundingRect {H.geo.Rect} - the bounding rectangle for which marker are to be returned @@ -2677,18 +2733,19 @@ declare namespace H { * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center * @returns {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)} - a response object containing the number of markers and the markers themselves */ - requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse); + requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | + H.map.layer.IMarkerLayer.TiledResponse); } - export module IMarkerLayer { + namespace IMarkerLayer { /** * This type represents a response object returned by the H.map.layer.IMarkerLayer#requestMarkers function. * @property total {number} - The total number of markers, inclusive markers with not ready icons * @property markers {Array} - The marker objects for the bounding rectangle (only ready) */ - export interface Response { + interface Response { total: number; - markers: Array; + markers: H.map.AbstractMarker[]; } /** @@ -2697,17 +2754,18 @@ declare namespace H { * @property requested {number} - number of requested tiles * @property objects {Array} - the marker objects within requested tiled area */ - export interface TiledResponse { + interface TiledResponse { number: number; requested: number; - objects: Array; + objects: H.map.AbstractMarker[]; } } /** - * This interface describes a layer which provides data partitioned in quad-tree tiles in an x, y, z fashion (where z describes the level within the tree and x and y describe the absolute column and row indeces whithin the level). + * This interface describes a layer which provides data partitioned in quad-tree tiles in an x, y, z fashion (where z describes the level within the tree and x and y describe the absolute + * column and row indeces whithin the level). */ - export interface ITileLayer { + interface ITileLayer { /** * This method requests tiles for the current bounding rectangle at the given zoom level (z-value). * @param boundingRect {H.geo.Rect} - the bounding rectangle for which tiles are to be returned @@ -2737,13 +2795,13 @@ declare namespace H { cancelTile(x: number, y: number, z: number): void; } - export module ITileLayer { + namespace ITileLayer { /** * Options which are used to initialize a TileLayer object. * @property projection {H.geo.IProjection=} - an optional projection to be used for this layer, default is H.geo.mercator * @property opacity {number=} - tile layer opacity, default is 1 */ - export interface Options { + interface Options { projection?: H.geo.IProjection; opacity?: number; } @@ -2753,16 +2811,17 @@ declare namespace H { * @property total {number} - the total number of requested tiles * @property tiles {Array} - the tiles which this provider can currently return synchronously */ - export interface Response { + interface Response { total: number; - tiles: Array; + tiles: H.map.provider.Tile[]; } } /** - * The Layer class represents an object that is evaluated by the renderer in the order in which it is added to the layers collection. It provides the basic infrastructure for dispatching update events to the renderer in case new data is available. + * The Layer class represents an object that is evaluated by the renderer in the order in which it is added to the layers collection. It provides the basic infrastructure for dispatching + * update events to the renderer in case new data is available. */ - export class Layer extends H.util.EventTarget { + class Layer extends H.util.EventTarget { /** * Constructor * @param opt_options {H.map.layer.Layer.Options=} - optional configuration object @@ -2796,7 +2855,7 @@ declare namespace H { * @param level {number} - the zoom level for which to retrieve the copyright information * @returns {Array} - a list of copyright information objects for the provided area and zoom level */ - getCopyrights(bounds: H.geo.Rect, level: number): Array; + getCopyrights(bounds: H.geo.Rect, level: number): H.map.ICopyright[]; /** * This method will dispatch event on the event target object @@ -2814,10 +2873,10 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } - export module Layer { + namespace Layer { /** * Options which can be used when creating new layer object. * @property min {number=} - The minimum zoom level for which the layer can provide data, default is 0 @@ -2826,7 +2885,7 @@ declare namespace H { * @property projection {H.geo.IProjection=} - The projection to be used for this layer, default is H.geo.mercator * @property minWorldSize {number=} - The minimal world size at zoom level 0, default is 256 */ - export interface Options { + interface Options { min?: number; max?: number; dark?: boolean; @@ -2838,7 +2897,7 @@ declare namespace H { /** * ObjectTileLayer represents map objects which are requested on a tile basis */ - export class MarkerTileLayer extends H.map.layer.BaseTileLayer implements H.map.layer.IMarkerLayer { + class MarkerTileLayer extends H.map.layer.BaseTileLayer implements H.map.layer.IMarkerLayer { /** * Constructor * @param provider {H.map.provider.MarkerTileProvider} @@ -2864,13 +2923,15 @@ declare namespace H { * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center * @returns {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)} - a response object containing the number of markers and the markers themselves */ - requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse); + requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | + H.map.layer.IMarkerLayer.TiledResponse); } /** - * This class represents a layer which renders map objects. Spatial objects like polygons and polylines a rendered to tiles before being passed to the enigne. Point objects like markers are provided as objects given an rectangular area. + * This class represents a layer which renders map objects. Spatial objects like polygons and polylines a rendered to tiles before being passed to the enigne. Point objects like markers + * are provided as objects given an rectangular area. */ - export class ObjectLayer extends H.map.layer.Layer implements H.map.layer.ITileLayer { + class ObjectLayer extends H.map.layer.Layer implements H.map.layer.ITileLayer { /** * Constructor * @param provider {H.map.provider.ObjectProvider} - the ObjectProvider which provides the map objects to this object layer. @@ -2940,10 +3001,11 @@ declare namespace H { * @param prioCenter {H.math.Point} - The priority center as an offset in screen pixel relative to the center * @returns {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)} - a response object containing the number of markers and the markers themselves */ - requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse); + requestDomMarkers(boundingRect: H.geo.Rect, zoomLevel: number, cacheOnly: boolean, prioCenter: H.math.Point): (H.map.layer.IMarkerLayer.Response | + H.map.layer.IMarkerLayer.TiledResponse); } - export module ObjectLayer { + namespace ObjectLayer { /** * Configuration object which can be use to initialize the ObjectLayer. * @property tileSize {number=} - the size of the tiles rendered by this layer for polylines and polygons (must be power of 2, default is 256) @@ -2951,7 +3013,7 @@ declare namespace H { * @property dataCacheSize {number=} - the number of tiles to cache which have render data only, default is 512 * @property pixelRatio {number=} - The pixelRatio to use for over-sampling in cases of high-resolution displays */ - export interface Options { + interface Options { tileSize?: number; tileCacheSize?: number; dataCacheSize?: number; @@ -2963,9 +3025,9 @@ declare namespace H { * @property total {number} - The total number of overlays within the requested bounds, inclusive overlays which are not ready loaded yet * @property overlays {Array} - A list all overlays which are ready to render */ - export interface OverlaysResponse { + interface OverlaysResponse { total: number; - overlays: Array; + overlays: H.map.Overlay[]; } } @@ -2973,7 +3035,7 @@ declare namespace H { * Tile Layer, represents data shown on map on a tile basis. Can be used to show map tile images or other type of data which is partitioned into tiles. * @event update {H.util.Event} */ - export class TileLayer extends H.map.layer.BaseTileLayer implements H.map.layer.ITileLayer { + class TileLayer extends H.map.layer.BaseTileLayer implements H.map.layer.ITileLayer { /** * Constructor * @param provider {H.map.provider.TileProvider} - data source for the TileLayer @@ -2995,12 +3057,12 @@ declare namespace H { } } - export module provider { + namespace provider { /** * An ImageTileProvider uses network service to provide bitmap images as tiles. * @property tileSize {number} - Size of a tile image supported by the provider */ - export class ImageTileProvider extends H.map.provider.RemoteTileProvider { + class ImageTileProvider extends H.map.provider.RemoteTileProvider { /** * Constructor * @param options {H.map.provider.ImageTileProvider.Options} - configuration for tile provider @@ -3010,25 +3072,27 @@ declare namespace H { tileSize: number; } - export module ImageTileProvider { + namespace ImageTileProvider { /** * Options to initialize an ImageTileProvider instance - * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. If a cross sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. + * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. If a cross + * sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. * @property min {number=} - The minimal supported zoom level, default is 0 * @property max {number=} - The maximal supported zoom level, default is 22 * @property getCopyrights {(function(H.geo.Rect, number) : ?Array)=} - A function to replace the default implementation of H.map.provider.Provider#getCopyrights * @property tileSize {number=} - The size of a tile as edge length in pixels. It must be 2^n where n is in range [0 ... 30], default is 256 * @property getURL {function(number, number, number)} - The function to create an URL for the specified tile. If it returns a falsy the tile is not requested. - * @property crossOrigin {(string | boolean=)} - The CORS settings to use for the crossOrigin attribute for the image, if omitted or if the value evaluates to false no CORS settings are used. + * @property crossOrigin {(string | boolean=)} - The CORS settings to use for the crossOrigin attribute for the image, if omitted or if the value evaluates to false no CORS settings + * are used. */ - export interface Options { + interface Options { uri?: string; min?: number; max?: number; - getCopyrights?: ((rect: H.geo.Rect, n: number) => Array); + getCopyrights?(rect: H.geo.Rect, n: number): H.map.ICopyright[]; tileSize?: number; - getURL: (n1: number, n2: number, n3: number) => string; - crossOrigin?: (string | boolean); + getURL(n1: number, n2: number, n3: number): string; + crossOrigin?: string | boolean; } } @@ -3036,8 +3100,7 @@ declare namespace H { * This class represents invalidation states of a renderable object. A renderer can optimize its rendering strategies based on the information in this object. * @property MARK_INITIAL {H.map.provider.Invalidations.Mark} - This constant represents the initial invalidation mark an invalidations object has. */ - export class Invalidations { - + class Invalidations { /** * To update invalidation marks accordingly to the given the invalidation types. * @param mark {H.map.provider.Invalidations.Mark} - The invalidation mark to set @@ -3096,11 +3159,11 @@ declare namespace H { static MARK_INITIAL: H.map.provider.Invalidations.Mark; } - export module Invalidations { + namespace Invalidations { /** * This enumeration encapsulates bit flags for different invalidations of map objects. */ - export enum Flag { + enum Flag { NONE, VISUAL, SPATIAL, @@ -3112,7 +3175,7 @@ declare namespace H { /** * The invalidation mark represents a counter which is increased whenever an invalidation takes place. */ - export interface Mark { } + type Mark = any; } /** @@ -3125,7 +3188,7 @@ declare namespace H { * @property max {number} - Maximum zoom level at which provider can server data, set at construction time * @property uid {string} - Provider instance unique identifier, generated at construction time */ - export class MarkerTileProvider extends H.map.provider.RemoteTileProvider { + class MarkerTileProvider extends H.map.provider.RemoteTileProvider { /** * Constructor * @param options {H.map.provider.MarkerTileProvider.Options} - configuration for tile provider @@ -3146,18 +3209,19 @@ declare namespace H { providesDomMarkers(): boolean; } - export module MarkerTileProvider { + namespace MarkerTileProvider { /** * Options which are used to initialize the MarkerTileProvider object. * @property min {number=} - The minimal supported zoom level, default is 0 * @property max {number=} - The maximal supported zoom level, default is 22 - * @property requestData {function(number, number, number, function(Array), Function) : H.util.ICancelable} - function that fetches marker data and creates array of H.map.AbstractMarker that is passed success callback, if function fails to fetch data onError callback must be called + * @property requestData {function(number, number, number, function(Array), Function) : H.util.ICancelable} - function that fetches marker data and creates array + * of H.map.AbstractMarker that is passed success callback, if function fails to fetch data onError callback must be called * @property providesDomMarkers {boolean=} - indicates if markers provided are of type H.map.DomMarker or H.map.Marker, default is H.map.Marker */ - export interface Options { + interface Options { min?: number; max?: number; - requestData: (n1: number, n2: number, n3: number, markerCallback: (markers: Array) => void, f: Function) => H.util.ICancelable; + requestData(n1: number, n2: number, n3: number, markerCallback: (markers: H.map.AbstractMarker[]) => void, f: () => void): H.util.ICancelable; providesDomMarkers?: boolean; } } @@ -3165,7 +3229,7 @@ declare namespace H { /** * An abstract class to manage and provide map objects (Marker, Polyline, Polygon) */ - export class ObjectProvider extends H.map.provider.Provider { + class ObjectProvider extends H.map.provider.Provider { /** * Constructor * @param opt_options {H.map.provider.Provider.Options=} @@ -3200,7 +3264,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestOverlays(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestOverlays(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.Overlay[]; /** * Checks whether this provider is currently providing spatial map objects. A concrete implementation of ObjectProvider must override it if it currently provides Spatials. @@ -3216,7 +3280,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestSpatials(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestSpatials(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.Spatial[]; /** * Returns the spatial objects which intersect the given tile @@ -3225,7 +3289,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestSpatialsByTile(tile: H.map.provider.Tile, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestSpatialsByTile(tile: H.map.provider.Tile, visiblesOnly: boolean, cacheOnly: boolean): H.map.Spatial[]; /** * Checks whether this provider is currently providing Marker map objects. A concrete implementation of ObjectProvider must override it if it currently provides Markers. @@ -3241,7 +3305,7 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestMarkers(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestMarkers(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.Marker[]; /** * Checks whether this provider is currently providing DomMarker map objects. A concrete implementation of ObjectProvider must override it if it currently provides Markers. @@ -3257,17 +3321,18 @@ declare namespace H { * @param cacheOnly {boolean} - Indicates whether only cached objects are to be considered * @returns {Array} - a list of intersecting objects */ - requestDomMarkers(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): Array; + requestDomMarkers(geoRect: H.geo.Rect, zoomLevel: number, visiblesOnly: boolean, cacheOnly: boolean): H.map.DomMarker[]; } /** - * A Provider defines an object which works as a database for the map. Providers can exists in different forms they can implement client side object storage or they can request data from the remote service. + * A Provider defines an object which works as a database for the map. Providers can exists in different forms they can implement client side object storage or they can request data from + * the remote service. * @property uri {string} - This provider's unique resource identifier, if not provided at construction time it defaults to provider's uid * @property min {number} - Minimum zoom level at which provider can serve data, set at construction time * @property max {number} - Maximum zoom level at which provider can server data, set at construction time * @property uid {string} - Provider instance unique identifier, generated at construction time */ - export class Provider extends H.util.EventTarget { + class Provider extends H.util.EventTarget { /** * Constructor * @param opt_options {H.map.provider.Provider.Options=} @@ -3280,7 +3345,7 @@ declare namespace H { * @param level {number} - The zoom level for which to retrieve the copyright information * @returns {?Array} - a list of copyright information objects for the provided area and zoom level */ - getCopyrights(bounds: H.geo.Rect, level: number): Array; + getCopyrights(bounds: H.geo.Rect, level: number): H.map.ICopyright[]; /** * This method will dispatch event on the event target object @@ -3298,7 +3363,7 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; uri: string; min: number; @@ -3306,26 +3371,28 @@ declare namespace H { uid: string; } - export module Provider { + namespace Provider { /** * Options to initialize a Provider instance - * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. If a cross sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. + * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. If a cross + * sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. * @property min {number=} - The minimal supported zoom level, default is 0 * @property max {number=} - The maximal supported zoom level, default is 22 * @property getCopyrights {(function(H.geo.Rect, number) : ?Array)=} - A function to replace the default implementation of H.map.provider.Provider#getCopyrights */ - export interface Options { + interface Options { uri?: string; min?: number; max?: number; - getCopyrights?: (rect: H.geo.Rect, n: number) => Array; + getCopyrights?(rect: H.geo.Rect, n: number): H.map.ICopyright[]; } } /** - * RemoteTileProvider is an abstract class which should be used by classes implementing data provision on a tile basis. Every child class needs to implement 'requestInternal' (to request remote tile) and 'getCache' (to provide configured cache object were tiled data is being cached) + * RemoteTileProvider is an abstract class which should be used by classes implementing data provision on a tile basis. Every child class needs to implement 'requestInternal' + * (to request remote tile) and 'getCache' (to provide configured cache object were tiled data is being cached) */ - export class RemoteTileProvider extends H.map.provider.TileProvider { + class RemoteTileProvider extends H.map.provider.TileProvider { /** * Constructor * @param options {H.map.provider.TileProvider.Options} - The options to instantiate this TileProvider @@ -3354,7 +3421,7 @@ declare namespace H { z: number, onResponse?: ( - object: Array | HTMLImageElement | HTMLCanvasElement | ArrayBuffer, + object: H.map.Object[] | HTMLImageElement | HTMLCanvasElement | ArrayBuffer, response: any ) => void, @@ -3370,7 +3437,8 @@ declare namespace H { } /** - * Generic Tile object which represents a part of the world fiting into the Tile area represented by the Tiel coordinates (x - row, y - column) and the zoom level (z). Number of tiles at particular zoom level (which means number of areas into world is being splitted) is defined as following: numberOfRows = numberOfColumns = 2^zoomlevel + * Generic Tile object which represents a part of the world fiting into the Tile area represented by the Tiel coordinates (x - row, y - column) and the zoom level (z). Number of tiles + * at particular zoom level (which means number of areas into world is being splitted) is defined as following: numberOfRows = numberOfColumns = 2^zoomlevel * @property key {string} - Unique tile key generated by provider * @property data {*} - Tile data (an image for example) * @property valid {boolean} - This property holds a boolean flag indicating whether this tile is still valid (true) or whether it should be re-fetched (false) @@ -3378,7 +3446,7 @@ declare namespace H { * @property y {number} - Tile row * @property z {number} - Tile zoom level */ - export class Tile { + class Tile { /** * Constructor * @param x {number} - x tile coordinate (row) @@ -3405,7 +3473,7 @@ declare namespace H { * @property max {number} - Maximum zoom level at which provider can server data, set at construction time * @property uid {string} - Provider instance unique identifier, generated at construction time */ - export class TileProvider extends H.map.provider.Provider { + class TileProvider extends H.map.provider.Provider { /** * Constructor * @param options {H.map.provider.TileProvider.Options} - The options to instantiate this TileProvider @@ -3441,19 +3509,20 @@ declare namespace H { uid: string; } - export module TileProvider { + namespace TileProvider { /** - * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. If a cross sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. + * @property uri {string=} - The provider's unique resource identifier which must not contain an underscore "_". If omitted an auto-generated unique Session ID is used. + * If a cross sessions consistent IDs is needed (e.g. for storing provider data) this property must be specified. * @property min {number=} - The minimal supported zoom level, default is 0 * @property max {number=} - The maximal supported zoom level, default is 22 * @property getCopyrights {(function(H.geo.Rect, number): Array)=} - A function to replace the default implememtation of H.map.provider.Provider#getCopyrights * @property tileSize {number=} - The size of a tile as edge length in pixels. It must be 2^n where n is in range [0 ... 30], default is 256 */ - export interface Options { + interface Options { uri?: string; min?: number; max?: number; - getCopyrights?(rect: H.geo.Rect, number: number): Array; + getCopyrights?(rect: H.geo.Rect, number: number): H.map.ICopyright[]; tileSize?: number; } } @@ -3461,14 +3530,14 @@ declare namespace H { } /***** mapevents *****/ - export module mapevents { + namespace mapevents { /** * Behavior class uses map events and adds behavior functionality to the map. This allows map panning and zooming via using mouse wheel * @property DRAGGING {number} - Map responds to user dragging via mouse or touch * @property WHEELZOOM {number} - Map zooms in or out in respond to mouse wheel events * @property DBLTAPZOOM {number} - Map zooms in or out in response to double click or double tap. For double tap if more that one touches are on the screen map will zoom out. */ - export class Behavior extends H.util.Disposable { + class Behavior extends H.util.Disposable { /** * Constructor * @param mapEvents {H.mapevents.MapEvents} - previously initialized map events instance @@ -3477,7 +3546,8 @@ declare namespace H { constructor(mapEvents: H.mapevents.MapEvents, options?: H.mapevents.Behavior.Options); /** - * This method destroys all map interaction handling. Should be used when the behavior functionality is disposed. Behavior object will also be disposed (this function will be called) when attached H.mapevents.MapEvents object is dispose. + * This method destroys all map interaction handling. Should be used when the behavior functionality is disposed. Behavior object will also be disposed (this function will be called) + * when attached H.mapevents.MapEvents object is dispose. */ dispose(): void; @@ -3505,13 +3575,13 @@ declare namespace H { static DBLTAPZOOM: number; } - export module Behavior { + namespace Behavior { /** * Options which are used to initialize the Behavior class. * @property kinetics {H.util.kinetics.IKinetics=} - The parameters for the kinetic movement. * @property enable {number=} - The bitmask of behaviors to enable like H.mapevents.Behavior.DRAGGING. All are enabled by default. */ - export interface Options { + interface Options { kinetics?: H.util.kinetics.IKinetics; enable?: H.math.BitMask; } @@ -3527,7 +3597,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class ContextMenuEvent extends H.util.Event { + class ContextMenuEvent extends H.util.Event { /** * Constructor * @param viewportX {number} - The x coordinate on the viewport @@ -3537,7 +3607,7 @@ declare namespace H { */ constructor(viewportX: number, viewportY: number, target: (H.Map | H.map.Object), originalEvent: Event); - viewportX: Array; + viewportX: H.util.ContextItem[]; viewportY: number; originalEvent: Event; } @@ -3554,7 +3624,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class Event extends H.util.Event { + class Event extends H.util.Event { /** * Constructor * @param type {string} - type of event @@ -3565,7 +3635,8 @@ declare namespace H { * @param target {(H.Map | H.map.Object)} - target map object which triggered event * @param originalEvent {Event} - original dom event */ - constructor(type: string, pointers: Array, changedPointers: Array, targetPointers: Array, currentPointer: H.mapevents.Pointer, target: (H.Map | H.map.Object), originalEvent: Event); + constructor(type: string, pointers: H.mapevents.Pointer[], changedPointers: H.mapevents.Pointer[], targetPointers: H.mapevents.Pointer[], currentPointer: H.mapevents.Pointer, + target: (H.Map | H.map.Object), originalEvent: Event); /** * Sets defaultPrevented to true. Which can be used to prevent some default behavior. @@ -3577,9 +3648,9 @@ declare namespace H { */ stopPropagation(): void; - pointers: Array; - changedPointers: Array; - targetPointers: Array; + pointers: H.mapevents.Pointer[]; + changedPointers: H.mapevents.Pointer[]; + targetPointers: H.mapevents.Pointer[]; currentPointer: H.mapevents.Pointer; originalEvent: Event; target: (H.map.Object | H.Map); @@ -3589,9 +3660,11 @@ declare namespace H { } /** - * MapEvents enable the events functionality on the map and on the map objects. By using this extension it is possible to listen to events on map objects like markers, polylines, polygons, circles and on the map object itself. Events are triggered depending on user interaction. Please check the Events Summary section for the list of events fired by this class and by the map objects. + * MapEvents enable the events functionality on the map and on the map objects. By using this extension it is possible to listen to events on map objects like markers, polylines, polygons, + * circles and on the map object itself. Events are triggered depending on user interaction. Please check the Events Summary section for the list of events fired by this class and by the map + * objects. */ - export class MapEvents extends H.util.Disposable { + class MapEvents extends H.util.Disposable { /** * Constructor * @param map {H.Map} - map instance which is used for firing events @@ -3599,7 +3672,8 @@ declare namespace H { constructor(map: H.Map); /** - * This method destroys the MapEvents by removing all handlers from the map object. After calling this function mapEvents and map objects will not trigger any events. This object will be disposed automatically if the corresponding map object is disposed. + * This method destroys the MapEvents by removing all handlers from the map object. After calling this function mapEvents and map objects will not trigger any events. This object will be + * disposed automatically if the corresponding map object is disposed. */ dispose(): void; @@ -3620,7 +3694,7 @@ declare namespace H { * @property dragTarget {(H.map.Object | H.Map)} - Object which is currently dragged by the pointer * @property button {H.mapevents.Pointer.Button} - Indicates which pointer device button has changed. */ - export class Pointer { + class Pointer { /** * Constructor * @param viewportX {number} - pointer position on x-axis @@ -3640,11 +3714,11 @@ declare namespace H { static button: H.mapevents.Pointer.Button; } - export module Pointer { + namespace Pointer { /** * Types of a button */ - export enum Button { + enum Button { /** No button */ NONE, /** Left mouse button or touch contact or pen contact */ @@ -3664,7 +3738,7 @@ declare namespace H { * - 4: Middle mouse button pressed */ // TODO not sure this is the right interpretation of the docs - export type Buttons = H.math.BitMask; + type Buttons = H.math.BitMask; } /** @@ -3678,7 +3752,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class WheelEvent extends H.util.Event { + class WheelEvent extends H.util.Event { /** * Constructor * @param deltaY {number} - The wheel move delta on y-axis @@ -3697,18 +3771,18 @@ declare namespace H { } /***** math *****/ - export module math { + namespace math { /** * A signed 32 bit integer (JS restriction) where bit operator can be applied to. The range is [-2,147,483,648 ... 2,147,483,647] or [-2^31 ... 2^31 − 1] */ - export type BitMask = number; + type BitMask = number; /** * An interface for a 2-dimensional point consisting a x and y coordinate. * @property x {number} - The point's coordinate on X-axis. * @property y {number} - The point's coordinate on Y-axis. */ - export interface IPoint { + interface IPoint { x: number; y: number; } @@ -3718,7 +3792,7 @@ declare namespace H { * @property w {number} - The size's width. * @property h {number} - The size's height. */ - export interface ISize { + interface ISize { w: number; h: number; } @@ -3728,7 +3802,7 @@ declare namespace H { * @property x {number} - The point's coordinate on X-axis. * @property y {number} - The point's coordinate on Y-axis. */ - export class Point implements IPoint { + class Point implements IPoint { /** * Constructor * @param x {number} - The point's coordinate on X-axis. @@ -3826,7 +3900,7 @@ declare namespace H { /** * Class defines a rectangle in 2-dimensional geometric space. It is used to represent the area in projected space. */ - export class Rect { + class Rect { /** * Constructor * @param left {number} - The rectangle's left edge x value @@ -3885,7 +3959,7 @@ declare namespace H { * @property w {number} - The size's width value * @property h {number} - The size's height value */ - export class Size { + class Size { /** * Constructor * @param width {number} - Width. @@ -3898,27 +3972,27 @@ declare namespace H { } /***** net *****/ - export module net { - export module Request { - export enum State { + namespace net { + namespace Request { + enum State { DONE = 2, OPENED = 1, UNSENT = 0, } // TODO no idea how this interface is set up, investigate - export interface Priority { } + type Priority = any; } } /***** places *****/ /***** service *****/ - export module service { + namespace service { /** * Abstract rest service class */ - export class AbstractRestService implements H.service.IConfigurable { + class AbstractRestService implements H.service.IConfigurable { /** * Constructor * @param opt_options {H.service.AbstractRestService.Options=} @@ -3931,22 +4005,22 @@ declare namespace H { * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. + * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in + * the opt_baseUrl to use HTTPS. * @returns {H.service.IConfigurable} */ configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; } - export module AbstractRestService { - export interface Options { - - } + namespace AbstractRestService { + type Options = any; } /** - * This class encapsulates Enterprise Routing REST API as a service stub. An instance of this class can be retrieved by calling the factory method on a platform instance. H.service.Platform#getEnterpriseRoutingService. + * This class encapsulates Enterprise Routing REST API as a service stub. An instance of this class can be retrieved by calling the factory method on a platform instance. + * H.service.Platform#getEnterpriseRoutingService. */ - export class EnterpriseRoutingService extends H.service.AbstractRestService { + class EnterpriseRoutingService extends H.service.AbstractRestService { /** * Constructor * @param opt_options {H.service.EnterpriseRoutingService.Options=} @@ -3954,7 +4028,8 @@ declare namespace H { constructor(opt_options?: H.service.EnterpriseRoutingService.Options); /** - * This method sends a "calculateroute" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occurred. + * This method sends a "calculateroute" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing + * a H.service.ServiceResult object - or the onError callback if a communication error occurred. * @param calculateRouteParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Enterprise Routing REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -3962,7 +4037,8 @@ declare namespace H { calculateRoute(calculateRouteParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; /** - * This method sends a "getroute" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occurred. + * This method sends a "getroute" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing + * a H.service.ServiceResult object - or the onError callback if a communication error occurred. * @param getRouteParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Enterprise Routing REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -3970,7 +4046,8 @@ declare namespace H { getRoute(getRouteParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; /** - * This method sends a "getlinkinfo" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. + * This method sends a "getlinkinfo" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing + * a H.service.ServiceResult object - or the onError callback if a communication error occured. * @param getLinkInfoParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Enterprise Routing REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -3978,7 +4055,8 @@ declare namespace H { getLinkInfo(getLinkInfoParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; /** - * This method sends a "calculateisoline" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occurred. + * This method sends a "calculateisoline" request to Enterprise Routing REST API and calls the onResult callback function once the service response was received - providing + * a H.service.ServiceResult object - or the onError callback if a communication error occurred. * @param calculateIsolineParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Enterprise Routing REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -3986,13 +4064,14 @@ declare namespace H { calculateIsoline(calculateIsolineParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; } - export module EnterpriseRoutingService { + namespace EnterpriseRoutingService { /** * @property subDomain {string=} - The sub-domain of the routing service relative to the platform's base URL (default is 'route') * @property path {string=} - The path of the map tile service, default is "routing/7.2" - * @property baseUrl {H.service.Url=} - The base URL of the service, defaults to the the platform's base URL if instance was created using H.service.Platform#getEnterpriseRoutingService method. + * @property baseUrl {H.service.Url=} - The base URL of the service, defaults to the the platform's base URL if instance was created using H.service.Platform#getEnterpriseRoutingService + * method. */ - export interface Options { + interface Options { subDomain?: string; path?: string; baseUrl?: H.service.Url; @@ -4002,7 +4081,7 @@ declare namespace H { /** * This class encapsulates the Geocoding REST API in a service stub with calls to its various resources implemented. */ - export class GeocodingService extends H.service.AbstractRestService { + class GeocodingService extends H.service.AbstractRestService { /** * Constructor * @param opt_options {H.service.GeocodingService.Options=} @@ -4010,7 +4089,8 @@ declare namespace H { constructor(opt_options?: H.service.GeocodingService.Options); /** - * This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. + * This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult + * object - or the onError callback if a communication error occured. * @param geoodingParams {H.service.ServiceParameters} - the service parameters to be sent with the geocoding request. * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Geocoder REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -4019,7 +4099,8 @@ declare namespace H { geocode(geoodingParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; /** - * This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. + * This method sends a reverse geocoding request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult + * object - or the onError callback if a communication error occured. * @param reverseGeocodingParams {H.service.ServiceParameters} - the service parameters to be sent with the reverse geocoding request * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Geocoder REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -4028,7 +4109,8 @@ declare namespace H { reverseGeocode(reverseGeocodingParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; /** - * This method sends a landmark search request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. + * This method sends a landmark search request to Geocoder REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult + * object - or the onError callback if a communication error occured. * @param searchParams {H.service.ServiceParameters} - the service parameters to be sent with the reverse geocoding request * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Geocoder REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -4037,12 +4119,12 @@ declare namespace H { search(searchParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle; } - export module GeocodingService { + namespace GeocodingService { /** * @property subDomain {string=} - the sub-domain of the geo-coding service relative to the platform's base URL, default is 'geocoder' * @property path {string=} - the path of the Geocoding service, default is '6.2' */ - export interface Options { + interface Options { subDomain?: string; path?: string; } @@ -4051,14 +4133,15 @@ declare namespace H { /** * An interface represents an object, that can be configured credentials, settings etc. by H.service.Platform */ - export interface IConfigurable { + interface IConfigurable { /** * This methods receive configuration parameters from the platform, that can be used by the object implementing the interface. * @param appId {string} - The application ID to identify the client against the platform (mandatory to provide) * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. + * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in + * the opt_baseUrl to use HTTPS. * @returns {H.service.IConfigurable} */ configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; @@ -4068,15 +4151,15 @@ declare namespace H { * @property id {number} - the ID associated internally with this request * @property cancel {function()} - this function cancels the request and invokes the errback function */ - export interface JsonpRequestHandle { + interface JsonpRequestHandle { id: number; - cancel: () => void; + cancel(): void; } /** * This class encapsulates a map tile end point of the HERE Map Tile API. */ - export class MapTileService extends H.util.EventTarget implements H.service.IConfigurable { + class MapTileService extends H.util.EventTarget implements H.service.IConfigurable { /** * Constructor * @param opt_options {H.service.MapTileService.Options=} @@ -4111,7 +4194,8 @@ declare namespace H { * @param opt_options {H.service.TileProviderOptions=} - additional set of options for the provider * @returns {H.map.provider.ImageTileProvider} - the image tile provider */ - createTileProvider(tileType: string, scheme: string, tileSize: number, format: string, opt_additionalParameters?: H.service.ServiceParameters, opt_options?: H.service.TileProviderOptions): H.map.provider.ImageTileProvider; + createTileProvider(tileType: string, scheme: string, tileSize: number, format: string, opt_additionalParameters?: H.service.ServiceParameters, opt_options?: H.service.TileProviderOptions): + H.map.provider.ImageTileProvider; /** * This method creates a tile layer. This layer can be used as a layer on a map's data model. @@ -4125,7 +4209,8 @@ declare namespace H { * @param opt_options {H.service.TileProviderOptions=} - additional set of options for the provider * @returns {H.map.layer.TileLayer} - the tile layer */ - createTileLayer(tileType: string, scheme: string, tileSize: number, format: string, opt_additionalParameters?: H.service.ServiceParameters, opt_opacity?: number, opt_dark?: boolean, opt_options?: H.service.TileProviderOptions): H.map.layer.TileLayer; + createTileLayer(tileType: string, scheme: string, tileSize: number, format: string, opt_additionalParameters?: H.service.ServiceParameters, opt_opacity?: number, opt_dark?: boolean, + opt_options?: H.service.TileProviderOptions): H.map.layer.TileLayer; /** * This methods receive configuration parameters from the platform, that can be used by the object implementing the interface. @@ -4133,13 +4218,14 @@ declare namespace H { * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. + * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in + * the opt_baseUrl to use HTTPS. * @returns {H.service.IConfigurable} */ configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; } - export module MapTileService { + namespace MapTileService { /** * @property maps {Object} - * @property schemes {Object} - @@ -4148,7 +4234,7 @@ declare namespace H { * @property resolutions {Object} - * @property languages {Object} - */ - export interface Info { + interface Info { maps: { [key: string]: any }; schemes: { [key: string]: any }; tiletypes: { [key: string]: any }; @@ -4163,7 +4249,7 @@ declare namespace H { * @property subDomain {string=} - the sub-domain of the map tile service relative to the platform's base URL, default is 'maps' * @property path {string=} - the path of the map tile service, default is 'maptile/2.1' */ - export interface Options { + interface Options { type?: string; version?: string; subDomain?: string; @@ -4172,7 +4258,8 @@ declare namespace H { } /** - * A map type is an object holding tile layers corresponding to a map type (e.g. 'normal', 'satellite' or 'terrain'). A map type contains at least a map property which defines the basic map layer for a given map type. In addition it can hold other map layers with the given style, e.g. base, xbase, traffic etc. + * A map type is an object holding tile layers corresponding to a map type (e.g. 'normal', 'satellite' or 'terrain'). A map type contains at least a map property which defines the basic + * map layer for a given map type. In addition it can hold other map layers with the given style, e.g. base, xbase, traffic etc. * @property map {H.map.layer.TileLayer} - the basic map tiles with all features and labels * @property mapnight {H.map.layer.TileLayer} - the basic map tiles with all features and labels (night mode) * @property xbase {H.map.layer.TileLayer=} - map tiles without features and labels @@ -4186,7 +4273,7 @@ declare namespace H { * @property panoramanight {H.map.layer.TileLayer=} - map tiles highlighting areas with HERE StreetLevel coverage (night mode) * @property labels {H.map.layer.TileLayer=} - transparent map tiles with labels only */ - export interface MapType { + interface MapType { map: H.map.layer.TileLayer; mapnight: H.map.layer.TileLayer; xbase?: H.map.layer.TileLayer; @@ -4204,7 +4291,7 @@ declare namespace H { /** * Places service implements a low level places RestApi access. Please refer to Restful API documentation for providing parameters and handling response objects. */ - export class PlacesService extends H.service.AbstractRestService { + class PlacesService extends H.service.AbstractRestService { /** * Constructor * @param opt_options {H.service.PlacesService.Options=} @@ -4214,12 +4301,13 @@ declare namespace H { /** * This is generic method to query places RestAPI. * @param entryPoint {string} - can be one of available entry points H.service.PlacesService.EntryPoint i.e value of H.service.PlacesService.EntryPoint.SEARCH - * @param entryPointParams {Object} - parameter map key value pairs will be transformed into the url key=value parametes. For entry point parameters description please refer to places restful api documentation documentation for available parameters for chose entry point + * @param entryPointParams {Object} - parameter map key value pairs will be transformed into the url key=value parametes. For entry point parameters description please refer to places + * restful api documentation documentation for available parameters for chose entry point * @param onResult {Function} - callback which is called when result is returned * @param onError {Function} - callback which is called when error occured (i.e request timeout) * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - request(entryPoint: string, entryPointParams: Object, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + request(entryPoint: string, entryPointParams: {}, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'search' entry point. Please refer to documentation for parameter specification and response handling. @@ -4228,7 +4316,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - search(searchParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + search(searchParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'suggestions' entry point. Please refer to documentation for parameter specification and response handling. @@ -4237,7 +4325,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - suggest(suggestParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + suggest(suggestParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'explore' entry point. Please refer to documentation for parameter specification and response handling. @@ -4246,7 +4334,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - explore(exploreParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + explore(exploreParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'around' entry point. Please refer to documentation for parameter specification and response handling. @@ -4255,7 +4343,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - around(aroundParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + around(aroundParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'here' entry point. Please refer to documentation for parameter specification and response handling. @@ -4264,7 +4352,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - here(hereParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + here(hereParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * Function triggers places api 'categories' entry point. Please refer to documentation for parameter specification and response handling. @@ -4273,7 +4361,7 @@ declare namespace H { * @param onError {Function} * @returns {H.service.JsonpRequestHandle} - jsonp request handle */ - categories(categoriesParams: H.service.ServiceParameters, onResult: Function, onError: Function): H.service.JsonpRequestHandle; + categories(categoriesParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle; /** * This method should be used to follow hyperlinks available in results returned by dicovery queries. @@ -4283,14 +4371,14 @@ declare namespace H { * @param opt_additionalParameters {Object=} - additional parameters to send with request * @returns {H.service.JsonpRequestHandle} - jsonp resquest handle */ - follow(hyperlink: string, onResult: Function, onError: Function, opt_additionalParameters?: Object): H.service.JsonpRequestHandle; + follow(hyperlink: string, onResult: () => void, onError: () => void, opt_additionalParameters?: {}): H.service.JsonpRequestHandle; } - export module PlacesService { + namespace PlacesService { /** * List of available entry points */ - export enum EntryPoint { + enum EntryPoint { SEARCH, SUGGEST, EXPLORE, @@ -4304,7 +4392,7 @@ declare namespace H { * @property path {string=} - the path of the places service, default is 'places/v1' * @property baseUrl {H.service.Url=} - an optional base URL if it differs from the platform's default base URL */ - export interface Options { + interface Options { subDomain?: string; path?: string; baseUrl?: H.service.Url; @@ -4312,9 +4400,10 @@ declare namespace H { } /** - * The Platform class represents central class from which all other service stubs are created. It also contains the shared settings to be passed to the individual service stubs, for example the root URL of the platform, application credentials, etc. + * The Platform class represents central class from which all other service stubs are created. It also contains the shared settings to be passed to the individual service stubs, for example + * the root URL of the platform, application credentials, etc. */ - export class Platform { + class Platform { /** * Constructor * @param options {H.service.Platform.Options} @@ -4381,15 +4470,18 @@ declare namespace H { /** * This method creates a pre-configured set of HERE tile layers for convenient use with the map. - * @param opt_tileSize {(H.service.Platform.DefaultLayersOptions | number)=} - When a number – optional tile size to be queried from the HERE Map Tile API, default is 256. If the parameter is an object, then it represents options and all remaining below parameters should be omitted. + * @param opt_tileSize {(H.service.Platform.DefaultLayersOptions | number)=} - When a number – optional tile size to be queried from the HERE Map Tile API, default is 256. + * If theparameter is an object, then it represents options and all remaining below parameters should be omitted. * @param opt_ppi {number=} - optional 'ppi' parameter to use when querying tiles, default is not specified * @param opt_lang {string=} - optional primary language parameter, default is not specified * @param opt_secondaryLang {string=} - optional secondary language parameter, default is not specified * @param opt_style {string=} - optional 'style' parameter to use when querying map tiles, default is not specified - * @param opt_pois {(string | boolean)=} - indicates if pois are displayed on the map. Pass true to indicate that all pois should be visible. Alternatively you can specify mask for the POI Categories as described at the Map Tile API documentation POI Categories chapter. + * @param opt_pois {(string | boolean)=} - indicates if pois are displayed on the map. Pass true to indicate that all pois should be visible. Alternatively you can specify mask for the + * POI Categories as described at the Map Tile API documentation POI Categories chapter. * @returns {Object} - a set of tile layers ready to use */ - createDefaultLayers(opt_tileSize?: (H.service.Platform.DefaultLayersOptions | number), opt_ppi?: number, opt_lang?: string, opt_secondaryLang?: string, opt_style?: string, opt_pois?: (string | boolean)): H.service.Platform.MapTypes; + createDefaultLayers(opt_tileSize?: (H.service.Platform.DefaultLayersOptions | number), opt_ppi?: number, opt_lang?: string, opt_secondaryLang?: string, opt_style?: string, + opt_pois?: (string | boolean)): H.service.Platform.MapTypes; /** * This method returns an instance of H.service.RoutingService to query the Routing API. @@ -4419,7 +4511,7 @@ declare namespace H { getEnterpriseRoutingService(opt_options?: H.service.EnterpriseRoutingService.Options): H.service.EnterpriseRoutingService; } - export module Platform { + namespace Platform { /** * Options used to create default layers * @property tileSize {number=} - tile size to be queried from the HERE Map Tile API, default is 256 @@ -4428,9 +4520,10 @@ declare namespace H { * @property lg2 {string=} - optional secondary language parameter, default is not specified * @property style {string=} - optional 'style' parameter to use when querying map tiles, default is not specified * @property pois {boolean=} - indicates if pois are displayed on the map - * @property crossOrigin {(string | boolean=)} - indicates if CORS headers should be used for default layers, if false is specified, CORS headers are not set, defaults to 'anonymous'. Be aware that storing of content is not possible if crossOrigin is not set to true (see H.Map#storeContent). + * @property crossOrigin {(string | boolean=)} - indicates if CORS headers should be used for default layers, if false is specified, CORS headers are not set, defaults to 'anonymous'. + * Be aware that storing of content is not possible if crossOrigin is not set to true (see H.Map#storeContent). */ - export interface DefaultLayersOptions { + interface DefaultLayersOptions { tileSize?: number; ppi?: number; lg?: string; @@ -4447,7 +4540,7 @@ declare namespace H { * @property useCIT {boolean=} - Indicates whether the Customer Integration Testing should be used, default is false * @property useHTTPS {boolean=} - Indicates whether secure communication should be used, default is false */ - export interface Options { + interface Options { app_id: string; app_code: string; baseUrl?: H.service.Url; @@ -4458,7 +4551,7 @@ declare namespace H { /** * pre-configured set of HERE tile layers for convenient use with the map. */ - export interface MapTypes { + interface MapTypes { normal?: H.service.MapType; satellite?: H.service.MapType; terrain?: H.service.MapType; @@ -4467,9 +4560,10 @@ declare namespace H { } /** - * This class encapsulates the Routing REST API as a service stub. An instance of this class can be retrieved by calling the factory method on a platform instance. H.service.Platform#getRoutingService. + * This class encapsulates the Routing REST API as a service stub. An instance of this class can be retrieved by calling the factory method on a platform instance. + * H.service.Platform#getRoutingService. */ - export class RoutingService extends H.service.AbstractRestService { + class RoutingService extends H.service.AbstractRestService { /** * Constructor * @param opt_options {H.service.RoutingService.Options=} @@ -4477,7 +4571,8 @@ declare namespace H { constructor(opt_options?: H.service.RoutingService.Options); /** - * This method sends a "calculateroute" request to Routing REST API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object - or the onError callback if a communication error occured. + * This method sends a "calculateroute" request to Routing REST API and calls the onResult callback function once the service response was received - providing a + * H.service.ServiceResult object - or the onError callback if a communication error occured. * @param calculateRouteParams {H.service.ServiceParameters} - the service parameters to be sent with the routing request. * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Routing REST API provides a response to the request. * @param onError {function(Error)} - this function will be called if a communication error occurs during the JSON-P request @@ -4485,13 +4580,13 @@ declare namespace H { calculateRoute(calculateRouteParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): void; } - export module RoutingService { + namespace RoutingService { /** * @property subDomain {string=} - the sub-domain of the routing service relative to the platform's base URL, default is 'route' * @property path {string=} - the path of the map tile service, default is 'routing/7.2' * @property baseUrl {H.service.Url=} - an optional base URL if it differs from the platform's default base URL */ - export interface Options { + interface Options { subDomain?: string; path?: string; baseUrl?: H.service.Url; @@ -4501,14 +4596,14 @@ declare namespace H { /** * This type encapsulates URL parameters to be sent to a HERE platform service. */ - export interface ServiceParameters { + interface ServiceParameters { [key: string]: string; } /** * This type encapsulates a response object provider by a HERE platform service. */ - export interface ServiceResult { + interface ServiceResult { [key: string]: string; } @@ -4516,14 +4611,15 @@ declare namespace H { * Options which are used to initialize the tile provider. * @property crossOrigin {boolean=} - The string to be set for the crossOrigin attribute for loaded images */ - export interface TileProviderOptions { + interface TileProviderOptions { crossOrigin?: boolean; } /** - * TrafficIncindentsService provides functionality to the low level traffic incidents api Traffic API documentation where it is possible to retrieve traffic incident information on a tile basis + * TrafficIncindentsService provides functionality to the low level traffic incidents api Traffic API documentation where it is possible to retrieve traffic incident information on a + * tile basis */ - export class TrafficIncidentsService extends H.service.AbstractRestService { + class TrafficIncidentsService extends H.service.AbstractRestService { /** * Constructor * @param opt_options {H.service.TrafficIncidentsService.Options=} @@ -4549,16 +4645,17 @@ declare namespace H { * @param opt_serviceParams {H.service.ServiceParameters=} - optional service parameters to be added to the request * @returns {H.service.JsonpRequestHandle} */ - requestIncidentsByTile(x: number, y: number, z: number, onResponse: (result: H.service.ServiceResult) => void, onError: () => void, opt_serviceParams?: H.service.ServiceParameters): H.service.JsonpRequestHandle; + requestIncidentsByTile(x: number, y: number, z: number, onResponse: (result: H.service.ServiceResult) => void, onError: () => void, opt_serviceParams?: H.service.ServiceParameters): + H.service.JsonpRequestHandle; } - export module TrafficIncidentsService { + namespace TrafficIncidentsService { /** * @property subDomain {string=} - the sub-domain of the traffic incidents service relative to the platform's base URL, default is 'traffic' * @property path {string=} - the path of the traffic incidents service, default is 'traffic/6.1' * @property baseUrl {H.service.Url=} - an optional base URL if it differs from the platform's default base URL */ - export interface Options { + interface Options { subDomain?: string; path?: string; baseUrl?: H.service.Url; @@ -4566,9 +4663,10 @@ declare namespace H { } /** - * This class represents a URL giving access to the individual parts that make up a URL,such as the scheme, host/domain, path, etc. Use the static parse method to populate a new URL object from a URL string. Be aware that URLs with user and password like "ftp://user:password@foo.bar/" are not supported! + * This class represents a URL giving access to the individual parts that make up a URL,such as the scheme, host/domain, path, etc. Use the static parse method to populate a new URL object + * from a URL string. Be aware that URLs with user and password like "ftp://user:password@foo.bar/" are not supported! */ - export class Url { + class Url { /** * Constructor * @param scheme {string} - the URL scheme (e.g. "http" or "https" or "mailto") @@ -4578,7 +4676,7 @@ declare namespace H { * @param opt_port {number=} - The port of the host on which the host listens. If a string is passed it must be convertible to an integer. * @param opt_anchor {string=} - an optional anchor part of the URL (usually preceded by '#'); */ - constructor(scheme: string, host: string, opt_path?: string, opt_params?: Object, opt_port?: number, opt_anchor?: string); + constructor(scheme: string, host: string, opt_path?: string, opt_params?: {}, opt_port?: number, opt_anchor?: string); /** * This function parses a URL string and returns a H.service.Url object. The URL string must contain at least a scheme and a host. @@ -4589,7 +4687,8 @@ declare namespace H { static parse(url: string, opt_baseURL?: string): H.service.Url; /** - * Clones this URL object. Optionally, mutations can be passed to this function to modify properties of the cloned object. Note that URL parameters are not replaced but merged with the parameters of this instance. + * Clones this URL object. Optionally, mutations can be passed to this function to modify properties of the cloned object. Note that URL parameters are not replaced but merged with the + * parameters of this instance. * @returns {H.service.Url} - the clone of the URL object */ clone(): H.service.Url; @@ -4634,11 +4733,12 @@ declare namespace H { getPath(): string | void; /** - * This function sets the specified parameters for this URL object. Keys in this object, which are associated with undefined values will be treated as query string parameters with no value. + * This function sets the specified parameters for this URL object. Keys in this object, which are associated with undefined values will be treated as query string parameters + * with no value. * @param params {(Object | undefined)} - a hash of query string parameters specifying the parameters to be set.or a boolean to clear the parameters. * @returns {H.service.Url} - this URL object */ - setQuery(params?: Object | boolean): H.service.Url; + setQuery(params?: {} | boolean): H.service.Url; /** * This function returns a boolean value indicating whether there are any query string parameter associated with this URL. @@ -4650,7 +4750,7 @@ declare namespace H { * This function returns the query object of this Url object. * @returns {Object} - the query object */ - getQuery(): Object; + getQuery(): {}; /** * This function sets the anchor of this URL object. @@ -4666,11 +4766,12 @@ declare namespace H { getAnchor(): string | void; /** - * This function merges the provided parameters into this URL's existing parameters. Key-value pairs which are defined in the argument and this URL's parameters will be overwritten. Key-value pairs which are defined in the argument and are not defined in this URL's parameters will be added. Prototype properties and function properties will not be merged. + * This function merges the provided parameters into this URL's existing parameters. Key-value pairs which are defined in the argument and this URL's parameters will be overwritten. + * Key-value pairs which are defined in the argument and are not defined in this URL's parameters will be added. Prototype properties and function properties will not be merged. * @param other {Object} - the parmeters to be merged into this URL's query string parameters * @returns {H.service.Url} - this URL object */ - mergeQuery(other: Object): H.service.Url; + mergeQuery(other: {}): H.service.Url; /** * This function adds a sub-domain to the host of this URL object. @@ -4693,11 +4794,11 @@ declare namespace H { toString(): string; } - export module metaInfo { + namespace metaInfo { /** * This class encapsulates a Metainfo Tile end point of the HERE Map Tile API. */ - export class Service extends H.util.EventTarget implements H.service.IConfigurable { + class Service extends H.util.EventTarget implements H.service.IConfigurable { /** * Constructor * @param opt_options {H.service.metaInfo.Service.Options=} - additional service parameters @@ -4726,7 +4827,8 @@ declare namespace H { * @param opt_scheme {string=} - the scheme for which the meta info tiles a requested (default is 'normal.day') * @returns {H.map.provider.TileProvider} - the tile provider */ - createTileProvider(tileSize: number, pixelRatio: number, opt_categoryFilter?: Array, opt_additionalParameters?: H.service.ServiceParameters, opt_tileType?: string, opt_scheme?: string): H.map.provider.TileProvider; + createTileProvider(tileSize: number, pixelRatio: number, opt_categoryFilter?: string[], opt_additionalParameters?: H.service.ServiceParameters, opt_tileType?: string, + opt_scheme?: string): H.map.provider.TileProvider; /** * This method creates a tile layer. This layer can be used as a layer on a map's data model. @@ -4738,7 +4840,8 @@ declare namespace H { * @param opt_scheme {string=} - the scheme for which the meta info tiles a requested (default is 'normal.day') * @returns {H.map.layer.TileLayer} - the tile layer */ - createTileLayer(tileSize: number, pixelRatio: number, opt_categoryFilter?: Array, opt_additionalParameters?: H.service.ServiceParameters, opt_tileType?: string, opt_scheme?: string): H.map.layer.TileLayer; + createTileLayer(tileSize: number, pixelRatio: number, opt_categoryFilter?: string[], opt_additionalParameters?: H.service.ServiceParameters, opt_tileType?: string, + opt_scheme?: string): H.map.layer.TileLayer; /** * This methods receive configuration parameters from the platform, that can be used by the object implementing the interface. @@ -4746,13 +4849,14 @@ declare namespace H { * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. + * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified + * in the opt_baseUrl to use HTTPS. * @returns {H.service.IConfigurable} */ configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; } - export module Service { + namespace Service { /** * @property maps {Object} - * @property schemes {Object} - @@ -4761,7 +4865,7 @@ declare namespace H { * @property resolutions {Object} - * @property languages {Object} - */ - export interface Info { + interface Info { maps: { [key: string]: any }; schemes: { [key: string]: any }; tiletypes: { [key: string]: any }; @@ -4771,11 +4875,12 @@ declare namespace H { } /** - * @property type {string=} - the type of the map tile service to communicate with, e.g. 'base' (default), 'aerial', etc. (refer to the Map Tile REST API documentation for available types) + * @property type {string=} - the type of the map tile service to communicate with, e.g. 'base' (default), 'aerial', etc. (refer to the Map Tile REST API documentation for + * available types) * @property version {string=} - the map version hash to use for retrieving tiles, default is newest and will be automatically updated * @property subDomain {string=} - the sub-domain of the map tile service relative to the platform's base URL, default is 'maps' */ - export interface Options { + interface Options { type?: string; version?: string; subDomain?: string; @@ -4785,7 +4890,7 @@ declare namespace H { /** * This class utilizes Metainfo Tiles functionality provided by the Map Tile API to load meta information about map objects (buildings, labels, public transport etc.). */ - export class TileProvider extends H.map.provider.RemoteTileProvider { + class TileProvider extends H.map.provider.RemoteTileProvider { /** * Constructor * @param service {(H.service.metaInfo.Service | H.service.MapTileService)} - the tile service which holds information from about the source of the tiles @@ -4795,7 +4900,7 @@ declare namespace H { constructor(service: (H.service.metaInfo.Service | H.service.MapTileService), opt_params?: H.service.ServiceParameters, opt_options?: H.service.metaInfo.TileProvider.Options); } - export module TileProvider { + namespace TileProvider { /** * Configuration object which can be used to initialize the TileProvider. * @property tileType {string=} - The tile type for which to request meta info @@ -4805,22 +4910,22 @@ declare namespace H { * @property pixelRatio {number=} - The pixel ratio to use for over-sampling in cases of high-resolution displays * @property categoryFilter {Array=} - A list of meta-info category names which should be suppressed. See Metainfo Tile for valid category names. */ - export interface Options { + interface Options { tileType?: string; scheme?: string; tileCacheSize?: number; tileSize?: number; pixelRatio?: number; - categoryFilter?: Array; + categoryFilter?: string[]; } } } - export module venues { + namespace venues { /** * The class represents the building in the venue hiearachy (see H.service.venues.Venue) and holds floors that belong to the building. */ - export class Building extends H.map.Group { + class Building extends H.map.Group { /** * Constructor * @param provider {H.map.provider.ObjectProvider} - The object provider of this venue building @@ -4857,9 +4962,10 @@ declare namespace H { } /** - * The class represents the floor object in the venue hierarchy (see H.service.venues.Venue). The class holds information about floor geometry and spaces (see H.service.venues.Space) that belong to this floor. + * The class represents the floor object in the venue hierarchy (see H.service.venues.Venue). The class holds information about floor geometry and spaces (see H.service.venues.Space) + * that belong to this floor. */ - export class Floor extends H.map.Group { + class Floor extends H.map.Group { /** * Constructor * @param provider {H.map.provider.ObjectProvider} - The object provider of this venue floor @@ -4893,7 +4999,8 @@ declare namespace H { getBuilding(): H.service.venues.Building; /** - * Method returns raw data associated with the floor. For more details on data format see http://developer.here.com/rest-apis/documentation/venue-maps/topics/resource-type-venue-interaction-tile-floor.html + * Method returns raw data associated with the floor. For more details on data format see + * http://developer.here.com/rest-apis/documentation/venue-maps/topics/resource-type-venue-interaction-tile-floor.html * @returns {*} - the raw floor data object */ getData(): any; @@ -4909,7 +5016,7 @@ declare namespace H { /** * This class encapsulates methods to call Venue Maps API endpoints. */ - export class Service extends H.util.EventTarget implements H.service.IConfigurable { + class Service extends H.util.EventTarget implements H.service.IConfigurable { /** * Constructor * @param opt_options {H.service.venues.Service.Options=} - additional service parameters @@ -4917,7 +5024,8 @@ declare namespace H { constructor(opt_options?: H.service.venues.Service.Options); /** - * This method sends a discovery request to the Venue Maps API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult object, or the onError callback if a communication error occured. + * This method sends a discovery request to the Venue Maps API and calls the onResult callback function once the service response was received - providing a H.service.ServiceResult + * object, or the onError callback if a communication error occured. * @param serviceParams {H.service.ServiceParameters} - the service parameters to be sent with the discovery request * @param onResult {function(H.service.ServiceResult)} - this function will be called once the Venue Maps API provides a response to the request * @param onError {function(string)} - this function will be called if a communication error occurs during request and error type is passed as an argument @@ -4925,7 +5033,8 @@ declare namespace H { discover(serviceParams: H.service.ServiceParameters, onResult: (res: H.service.ServiceResult) => void, onError: (s: string) => void): void; /** - * This method creates a tile layer which can be added to the map in order to see the venues. It uses Interaction Tile endpoint of the Venue Maps API, more at http://developer.here.com/rest-apis/documentation/venue-maps/topics/quick-start-get-interaction-tile.html. + * This method creates a tile layer which can be added to the map in order to see the venues. It uses Interaction Tile endpoint of the Venue Maps API, more at + * http://developer.here.com/rest-apis/documentation/venue-maps/topics/quick-start-get-interaction-tile.html. * @param opt_options {H.service.venues.TileProvider.Options=} - Tile provider options * @returns {H.map.layer.TileLayer} - the tile layer */ @@ -4943,18 +5052,19 @@ declare namespace H { * @param appCode {string} - The application code to identify the client against the platform (mandatory to provide) * @param useHTTPS {boolean} - Indicates whether secure communication should be used, default is false * @param useCIT {boolean} - Indicates whether the Customer Integration Testing should be used, default is false - * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified in the opt_baseUrl to use HTTPS. + * @param opt_baseUrl {H.service.Url=} - The base URL of the platform, default is http://api.here.com. Note that if useHTTPS flag is passed it will override the URL scheme specified + * in the opt_baseUrl to use HTTPS. * @returns {H.service.IConfigurable} */ configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, opt_baseUrl?: H.service.Url): H.service.IConfigurable; } - export module Service { + namespace Service { /** * @property subDomain {string=} - the sub-domain of the Venue Maps service relative to the platform's base URL, default is 'venue.maps' * @property path {string=} - the path to append after host name when making requests to the Venue Maps API, default is empty */ - export interface Options { + interface Options { subDomain?: string; path?: string; } @@ -4962,7 +5072,7 @@ declare namespace H { /** * The state types of the H.service.venues.Service. Possible states are: */ - export enum State { + enum State { ERROR, INIT, READY, @@ -4972,7 +5082,7 @@ declare namespace H { /** * Represents a spatial object for this space. Each space object contains data associated with that space and can be retrieved by using H.service.venues.Space#getData method. */ - export class Space { + class Space { /** * Constructor * @param provider {H.map.provider.ObjectProvider} - The provider of this object. @@ -4989,7 +5099,8 @@ declare namespace H { isFloorSpace(): boolean; /** - * This method sets custom style to use for rendering the labels. Should be called before the first render of the space, otherwise has no any effect. Note that due to the design consistency currently it is not allowed to change the font family and the size of the labels. + * This method sets custom style to use for rendering the labels. Should be called before the first render of the space, otherwise has no any effect. Note that due to the design + * consistency currently it is not allowed to change the font family and the size of the labels. * @param labelStyle {(H.map.SpatialStyle | H.map.SpatialStyle.Options)} - Custom label style */ initLabelStyle(labelStyle: (H.map.SpatialStyle | H.map.SpatialStyle.Options)): void; @@ -5001,16 +5112,17 @@ declare namespace H { getFloor(): H.service.venues.Floor; /** - * Method returns raw data associated with the space. For more details on data format see http://developer.here.com/rest-apis/documentation/venue-maps/topics/resource-type-venue-interaction-tile-space.html + * Method returns raw data associated with the space. For more details on data format see + * http://developer.here.com/rest-apis/documentation/venue-maps/topics/resource-type-venue-interaction-tile-space.html * @returns {Object} - raw space data object */ - getData(): Object; + getData(): {}; } /** * This class represents a Venue Maps tile provider which requests venues tiles from a platform venue tile service. */ - export class TileProvider extends H.map.provider.RemoteTileProvider { + class TileProvider extends H.map.provider.RemoteTileProvider { /** * Constructor * @param service {H.service.venues.Service} @@ -5031,24 +5143,27 @@ declare namespace H { getCurrentLevel(): number; } - export module TileProvider { + namespace TileProvider { /** * Configuration object which can be used to initialize the TileProvider. * @property tileCacheSize {number=} - The number of fully rendered spatial tiles that are cached for immediate reuse, default is 32 * @property pixelRatio {number=} - The pixel ratio to use for over-sampling in cases of high-resolution displays - * @property onSpaceCreated {function(H.service.venues.Space)=} - A callback function that is called on every created space (see H.service.venues.Space) object. The function can be used for space object styling. + * @property onSpaceCreated {function(H.service.venues.Space)=} - A callback function that is called on every created space (see H.service.venues.Space) object. The function can be + * used for space object styling. */ - export interface Options { + interface Options { tileCacheSize?: number; pixelRatio?: number; - onSpaceCreated?: (space: H.service.venues.Space) => void; + onSpaceCreated?(space: H.service.venues.Space): void; } } /** - * The class represents the venue, it is a root for the venue object heirarchy. The venue inherits from H.map.Group and holds building objects (see H.service.venues.Building). Building objects hold floor objects (see H.service.venues.Floor) and inherit from H.map.Group as well. Leaf objects are spaces (see H.service.venues.Space) that are spatial map objects and reside inside floor containers. + * The class represents the venue, it is a root for the venue object heirarchy. The venue inherits from H.map.Group and holds building objects (see H.service.venues.Building). + * Building objects hold floor objects (see H.service.venues.Floor) and inherit from H.map.Group as well. Leaf objects are spaces (see H.service.venues.Space) that are spatial map objects + * and reside inside floor containers. */ - export class Venue extends H.map.Group { + class Venue extends H.map.Group { /** * Constructor * @param provider {H.map.provider.ObjectProvider} - The object provider of this venue @@ -5073,11 +5188,11 @@ declare namespace H { } /***** ui *****/ - export module ui { + namespace ui { /** * This class represents the base class for UI controls on the map. */ - export class Control extends H.ui.base.Container { + class Control extends H.ui.base.Container { /** * This abstract method can be overridden by deriving classes to be invoked when the UI object's unit system changes. * @param unitSystem {H.ui.UnitSystem} - the unit system the UI currently uses @@ -5119,7 +5234,7 @@ declare namespace H { /** * This class represents a distance measurement control which helps calculating distances between geographical locations indicated by the user clicks. */ - export class DistanceMeasurement extends H.ui.Control { + class DistanceMeasurement extends H.ui.Control { /** * Constructor * @param opt_options {H.ui.DistanceMeasurement.Options=} - optional parameters to be passed to this control @@ -5127,7 +5242,7 @@ declare namespace H { constructor(opt_options?: H.ui.DistanceMeasurement.Options); } - export module DistanceMeasurement { + namespace DistanceMeasurement { /** * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.RIGHT_BOTTOM * @property startIcon {H.map.Icon=} - the icon to use for the first measurement point @@ -5135,9 +5250,10 @@ declare namespace H { * @property endIcon {H.map.Icon=} - the icon to use for the last measurement point * @property splitIcon {H.map.Icon=} - the icon to use for indicating position under pointer over the line where new point will be created once user clicks * @property lineStyle {(H.map.SpatialStyle | H.map.SpatialStyle.Options)} - the style to use for connecting lines of the measurement points - * @property distanceFormatter {function(number)=} - Optional function used for formatting a distance. By default distance measurement tool will do the formatting according to the specified measurement unit (see H.ui.UI.Options#unitSystem) + * @property distanceFormatter {function(number)=} - Optional function used for formatting a distance. By default distance measurement tool will do the formatting according to the + * specified measurement unit (see H.ui.UI.Options#unitSystem) */ - export interface Options { + interface Options { alignment?: H.ui.LayoutAlignment; startIcon?: H.map.Icon; stopoverIcon?: H.map.Icon; @@ -5151,7 +5267,7 @@ declare namespace H { /** * This class represents an information bubble bound to a geo-position on the map. */ - export class InfoBubble extends base.Element { + class InfoBubble extends base.Element { /** * Constructor * @param position {H.geo.IPoint} - the geo-position to which this info bubble corresponds @@ -5196,24 +5312,25 @@ declare namespace H { getContentElement(): HTMLElement; /** - * This methods sets the content of the info bubble. This can either be a string (applied as innerHTML) to the content element of this info bubble or a HTML node which is appended to the content element. + * This methods sets the content of the info bubble. This can either be a string (applied as innerHTML) to the content element of this info bubble or a HTML node which is appended + * to the content element. * @param content {(string | Node)} - the content for this bubble */ setContent(content: string | Node): void; } - export module InfoBubble { + namespace InfoBubble { /** * This enumeration holds the state an info bubble can have. */ - export enum State { + enum State { /** This value represents the state where an info bubble is open and visible (value: 'open'). */ OPEN, /** This value represents the state where an info bubble is closed and invisible (value: 'closed') */ CLOSED, } - export interface Options { + interface Options { /** * a callback to be invoked when the info bubble's state changes * @param event {H.util.Event} @@ -5230,7 +5347,7 @@ declare namespace H { /** * This enumeration holds the possible layout alignments for the UI elements. */ - export enum LayoutAlignment { + enum LayoutAlignment { TOP_LEFT, TOP_CENTER, TOP_RIGHT, @@ -5248,7 +5365,7 @@ declare namespace H { /** * This class represents a menu control allowing to control which map type the map shows, etc. */ - export class MapSettingsControl extends H.ui.Control { + class MapSettingsControl extends H.ui.Control { /** * Constructor * @param opt_options {H.ui.MapSettingsControl.Options=} - optional parameters to be passed to this control @@ -5262,13 +5379,13 @@ declare namespace H { setIncidentsLayer(incidentsLayer: H.map.layer.Layer): void; } - export module MapSettingsControl { + namespace MapSettingsControl { /** * The map type entry is an object containing a display name and a map type object to which it refers. * @property name {string} - label which describes the map type * @property mapType {H.service.MapType} - reference to map type */ - export interface MapTypeEntry { + interface MapTypeEntry { name: string; mapType: H.service.MapType; } @@ -5278,9 +5395,9 @@ declare namespace H { * @property entries {Array=} - the map type entries to be shown in this map settings control * @property incidents {H.map.layer.Layer} - the traffic incidents layer to be activated by the map settings control */ - export interface Options { + interface Options { alignment?: H.ui.LayoutAlignment; - entries?: Array; + entries?: H.ui.MapSettingsControl.MapTypeEntry[]; incidents: H.map.layer.Layer; } } @@ -5288,7 +5405,7 @@ declare namespace H { /** * This class represents the UI controls for panorama */ - export class Pano extends H.ui.Control { + class Pano extends H.ui.Control { /** * Constructor * @param opt_options {H.ui.Pano.Options=} - optional parameters to be passed to the map. @@ -5296,12 +5413,12 @@ declare namespace H { constructor(opt_options?: H.ui.Pano.Options); } - export module Pano { + namespace Pano { /** * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.RIGHT_BOTTOM * @property mapTypes {H.service.MapTypes} - The map types to use */ - export interface Options { + interface Options { alignment?: H.ui.LayoutAlignment; mapTypes: H.service.MapType; } @@ -5310,7 +5427,7 @@ declare namespace H { /** * This class represents a UI element showing the current zoom scale. */ - export class ScaleBar { + class ScaleBar { /** * Constructor * @param opt_options {H.ui.ScaleBar.Options=} - optional parameters to be passed to this scale bar. @@ -5318,11 +5435,11 @@ declare namespace H { constructor(opt_options?: H.ui.ScaleBar.Options); } - export module ScaleBar { + namespace ScaleBar { /** * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.BOTTOM_RIGHT */ - export interface Options { + interface Options { alignment?: H.ui.LayoutAlignment; } } @@ -5330,7 +5447,7 @@ declare namespace H { /** * This class encapsulates map UI functionality. */ - export class UI implements H.util.ICapturable { + class UI implements H.util.ICapturable { /** * Constructor * @param map {H.Map} @@ -5383,7 +5500,7 @@ declare namespace H { * This method returns a list of info bubble objects which are currently attached to this UI. * @returns {Array} - the list of info bubbles */ - getBubbles(): Array; + getBubbles(): InfoBubble[]; /** * This method appends a control to the UI. @@ -5451,7 +5568,7 @@ declare namespace H { */ } - export module UI { + namespace UI { /** * Optional parameters to be passed to the UI constructor. * @property unitSystem {H.ui.UnitSystem=} - An optional unit system to be used by the UI, default is H.ui.UnitSystem.METRIC @@ -5461,9 +5578,11 @@ declare namespace H { * @property scalebar {(H.ui.ScaleBar.Options | boolean)=} - * @property panorama {(H.ui.Pano.Options | boolean)=} - * @property distancemeasurement {(H.ui.DistanceMeasurement.Options | boolean)=} - - * @property locale {(H.ui.i18n.Localization | string)=} - defines language in which UI can be rendered. It can be predefined H.ui.i18n.Localization object with custom translation map, or a string one of following 'en-US', 'de-DE', 'es-ES', 'fi-FI', 'fr-FR', 'it-IT', 'nl-NL', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'tr-TR', 'zh-CN'. If not defined ui will use 'en-US' by default + * @property locale {(H.ui.i18n.Localization | string)=} - defines language in which UI can be rendered. It can be predefined H.ui.i18n.Localization object with custom translation map, + * or a string one of following 'en-US', 'de-DE', 'es-ES', 'fi-FI', 'fr-FR', 'it-IT', 'nl-NL', 'pl-PL', 'pt-BR', 'pt-PT', 'ru-RU', 'tr-TR', 'zh-CN'. If not defined ui will use 'en-US' + * by default */ - export interface Options { + interface Options { unitSystem?: H.ui.UnitSystem; zoom?: (H.ui.ZoomControl.Options | boolean); zoomrectangle?: (H.ui.ZoomRectangle.Options | boolean); @@ -5478,7 +5597,7 @@ declare namespace H { /** * This enumeration holds the possible unit systems for the UI to display distances. */ - export enum UnitSystem { + enum UnitSystem { /** This value represents the imperial unit system using miles and feet (value: 'imperial'). */ IMPERIAL, /** This value represents the metric unit system using meters and kilometers, etc (value: 'metric'). */ @@ -5488,7 +5607,7 @@ declare namespace H { /** * This class represents the UI controls for zooming in an out of the map. */ - export class ZoomControl extends H.ui.Control { + class ZoomControl extends H.ui.Control { /** * Constructor * @param opt_options {H.ui.ZoomControl.Options=} - optional parameters to be passed to the map. @@ -5502,14 +5621,14 @@ declare namespace H { getZoomSpeed(): number; } - export module ZoomControl { + namespace ZoomControl { /** * @property zoomSpeed {number=} - the speed if zooming in and out in levels per millisecond, defaults to 0.05 * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, defaults to H.ui.LayoutAlignment.RIGHT_MIDDLE * @property slider {boolean=} - flag whether to show the slider (true) or not, defaults to false * @property sliderSnaps {boolean=} - flag whether slider should snap to the integer values or not, defaults to false. This option has effect only if slider is enabled. */ - export interface Options { + interface Options { zoomSpeed?: number; alignment?: H.ui.LayoutAlignment; slider?: boolean; @@ -5520,7 +5639,7 @@ declare namespace H { /** * This class represents a zoom rectangle control element that allows zooming to the selected area on the screen. */ - export class ZoomRectangle extends H.ui.Control { + class ZoomRectangle extends H.ui.Control { /** * Constructor * @param opt_options {H.ui.ZoomRectangle.Options=} - optional parameters to be passed to this control @@ -5528,12 +5647,13 @@ declare namespace H { constructor(opt_options?: H.ui.ZoomRectangle.Options); } - export module ZoomRectangle { + namespace ZoomRectangle { /** * @property alignment {H.ui.LayoutAlignment=} - the layout alignment which should be applied to this control, default is H.ui.LayoutAlignment.BOTTOM_RIGHT - * @property adjustZoom {function(number, H.Map) : number=} - optional function that defines how zoom level should be changed, by default zoom level is picked to fit the bounding rectangle into the view port. + * @property adjustZoom {function(number, H.Map) : number=} - optional function that defines how zoom level should be changed, by default zoom level is picked to fit the + * bounding rectangle into the view port. */ - export interface Options { + interface Options { alignment?: H.ui.LayoutAlignment; adjustZoom?(n: number, m: H.Map): number; } @@ -5544,15 +5664,15 @@ declare namespace H { /** * This namespace contains basic UI elements from which the UI controls are built. */ - export module base { - export class Container extends H.util.EventTarget { + namespace base { + class Container extends H.util.EventTarget { /** * Constructor * @param opt_elementType {string=} - the type of HTML element this UI element renders as, default is 'div' * @param opt_className {string=} - an optional class name to be used on this element * @param opt_children {Array=} - optional child elements to be added to this container */ - constructor(opt_elementType?: string, opt_className?: string, opt_children?: Array); + constructor(opt_elementType?: string, opt_className?: string, opt_children?: Element[]); /** * Adds a child element to be rendered within the container element. @@ -5565,7 +5685,7 @@ declare namespace H { * Returns the child collection of this container. * @returns {Array} - Returns the child collection of this container. */ - getChildren(): Array; + getChildren(): Element[]; /** * Removes a child element from this container's child collection. @@ -5641,7 +5761,7 @@ declare namespace H { removeClass(className: string): Element; } - export class Element extends H.util.EventTarget { + class Element extends H.util.EventTarget { /** * Constructor * @param opt_elementType {string=} - the type of HTML element this UI element renders as, default is 'div' @@ -5721,16 +5841,16 @@ declare namespace H { /** * Namespace contains functionality related to internationalization. */ - export module i18n { + namespace i18n { /** * Default available locales. UI provides default translations for this set of locale codes. */ - export const defaultLocales: Array; + const defaultLocales: string[]; /** * This class is used for internationalization of UI components. */ - export class Localization { + class Localization { constructor(locale: string, opt_translationMap?: any); /** @@ -5743,7 +5863,7 @@ declare namespace H { * This method returns translation keys for current locale. Keys from this set can be used to get translations via translate method. * @returns {Array} */ - getKeys(): Array; + getKeys(): string[]; /** * This method returns a boolean value indicating whether this localization object has a translation for the specified translation key. @@ -5763,11 +5883,13 @@ declare namespace H { } /***** util *****/ - export module util { + namespace util { /** - * The cache represents a in-memory LRU-cache with a fixed size. It stores any data that is added until the cache's content exceeds a maximum size. Once the size of all content elements exceeds the maximum size the cache will drop the least recently retrieved elements until the size of the cache is within the bounds of its maximum size. Data elements are always associated with an identifier that allow to retrieve them at a later stage and their content size. + * The cache represents a in-memory LRU-cache with a fixed size. It stores any data that is added until the cache's content exceeds a maximum size. Once the size of all content elements + * exceeds the maximum size the cache will drop the least recently retrieved elements until the size of the cache is within the bounds of its maximum size. Data elements are always + * associated with an identifier that allow to retrieve them at a later stage and their content size. */ - export class Cache implements H.util.ICache { + class Cache implements H.util.ICache { /** * Constructor * @param maxSize {number} - the maximum size of the cache @@ -5819,7 +5941,8 @@ declare namespace H { drop(id: any): void; /** - * This method will execute the provided callback function on each of the cache's entries. If the optional match predicate is passed to this method the callback will only be executed on those entries for which the predicated returns true. + * This method will execute the provided callback function on each of the cache's entries. If the optional match predicate is passed to this method the callback will only be executed + * on those entries for which the predicated returns true. * @param callback {function(string, ?, number)} - the callback to be invoked for each entry * @param opt_ctx {Object=} - an optional context object to be used as this within the callback * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional match predicate to customize on which entries the callback will be called @@ -5827,8 +5950,10 @@ declare namespace H { forEach(callback: (s: string, i: any, n: number) => void, opt_ctx?: any, opt_matcher?: (s: string, i: any, n: number) => boolean): void; /** - * This method removes all data elements from the cache. If the optional match predicate is passed to this method only those data elements will be removed for which the predicate return true. - * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional function that receives an entries id, data and size and may return true or false to either remove it or leave the entry in the cache respectively + * This method removes all data elements from the cache. If the optional match predicate is passed to this method only those data elements will be removed for which the predicate + * return true. + * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional function that receives an entries id, data and size and may return true or false to either remove it or + * leave the entry in the cache respectively */ removeAll(opt_matcher?: (s: string, i: any, n: number) => boolean): void; @@ -5846,7 +5971,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class ChangeEvent extends H.util.Event { + class ChangeEvent extends H.util.Event { /** * Constructor * @param type {string} - The type of the event @@ -5875,7 +6000,7 @@ declare namespace H { * This class represents a contextual information/action. * @property SEPARATOR {H.util.ContextItem} - Separator for the context items */ - export class ContextItem extends H.util.EventTarget { + class ContextItem extends H.util.EventTarget { /** * Constructor * @param opt_options {H.util.ContextItem.Options=} - The values to initialize this context item @@ -5924,29 +6049,29 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; static SEPARATOR: H.util.ContextItem; } - export module ContextItem { + namespace ContextItem { /** * This type defines options which can be used to initialize the context item. * @property label {string=} - the label of the context item * @property disabled {boolean=} - flag indicatting whether context item is disabled or no, by default false * @property callback {function(H.util.Event)=} - Optional callback function to call once context item is selected */ - export interface Options { + interface Options { label?: string; disabled?: boolean; - callback?: (event: H.util.Event) => void; + callback?(event: H.util.Event): void; } } /** * Object which can be safely disposed. */ - export class Disposable { + class Disposable { /** * Constructor */ @@ -5957,7 +6082,7 @@ declare namespace H { * @param callback {Function} * @param opt_scope {Object=} */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } /** @@ -5967,7 +6092,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class Event { + class Event { /** * Constructor * @param type {string} - Event Type. @@ -5994,14 +6119,15 @@ declare namespace H { /** * EventTarget enabled listening and dispatching events on all instances and derived classes. */ - export class EventTarget { + class EventTarget { /** * Constructor */ constructor(); /** - * This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. Otherwise memory leak is possible. + * This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. + * Otherwise memory leak is possible. * @param type {string} - name of event * @param handler {Function} - event handler function * @param opt_capture {boolean=} - if set to true will listen in the capture phase (bubble otherwise) @@ -6038,9 +6164,10 @@ declare namespace H { } /** - * An interface definition for the generic cache. Any data elements can be stored in the cache. They are always associated with an identifier to retrieve them at a later stage and their content size. + * An interface definition for the generic cache. Any data elements can be stored in the cache. They are always associated with an identifier to retrieve them at a later stage and their + * content size. */ - export interface ICache { + interface ICache { /** * This method adds an element to the cache. * @param id {*} - The identifier of this data element, the value is converted to a string. @@ -6065,16 +6192,19 @@ declare namespace H { drop(id: any): void; /** - * This method will execute the provided callback function on each of the cache's entries. If the optional match predicate is passed to this method the callback will only be executed on those entries for which the predicated returns true. + * This method will execute the provided callback function on each of the cache's entries. If the optional match predicate is passed to this method the callback will only be executed on + * those entries for which the predicated returns true. * @param callback {function(string, ?, number)} - the callback to be invoked for each entry * @param opt_ctx {Object=} - an optional context object to be used as this within the callback * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional match predicate to customize on which entries the callback will be called */ - forEach(callback: (s: string, t: any, n: number) => void, opt_ctx?: Object, opt_matcher?: ((s: string, t: any, n: number) => boolean)): void; + forEach(callback: (s: string, t: any, n: number) => void, opt_ctx?: {}, opt_matcher?: ((s: string, t: any, n: number) => boolean)): void; /** - * This method removes all data elements from the cache. If the optional match predicate is passed to this method only those data elements will be removed for which the predicate return true. - * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional function that receives an entries id, data and size and may return true or false to either remove it or leave the entry in the cache respectively + * This method removes all data elements from the cache. If the optional match predicate is passed to this method only those data elements will be removed for which the predicate + * return true. + * @param opt_matcher {(function(string, ?, number) : boolean)=} - an optional function that receives an entries id, data and size and may return true or false to either remove it or + * leave the entry in the cache respectively */ removeAll(opt_matcher?: ((s: string, t: any, n: number) => boolean)): void; @@ -6088,14 +6218,14 @@ declare namespace H { /** * An interface to cancelable requests and actions. */ - export interface ICancelable { + interface ICancelable { /** * This method is used to cancel current action */ cancel(): void; } - export interface ICapturable { + interface ICapturable { /** * This method is used to capture the element view * @param canvas {HTMLCanvasElement} - HTML Canvas element to draw the view of the capturable element @@ -6123,12 +6253,12 @@ declare namespace H { * @event set {H.util.OList.Event} - Fired when an entry was set in the list. * @event move {H.util.OList.Event} - Fired when an entry was moved within the list. */ - export class OList extends H.util.EventTarget { - + class OList extends H.util.EventTarget { /** * This method inserts an entry to the list. Optionally it can place new entry at provided index. * @param entry {?} - The entry to insert - * @param opt_idx {number=} - The index where the new entry should be inserted; if omitted or greater then the current size of the list, the entry is added at the end of the list; a negative index is treated as being relative from the end of the list + * @param opt_idx {number=} - The index where the new entry should be inserted; if omitted or greater then the current size of the list, the entry is added at the end of the list; + * a negative index is treated as being relative from the end of the list */ add(entry: any, opt_idx?: number): void; @@ -6178,7 +6308,7 @@ declare namespace H { * This method returns all list's entries as an array. * @returns {Array<*>} - The list as an array */ - asArray(): Array; + asArray(): any[]; /** * This method removes all entries from the list. @@ -6201,10 +6331,10 @@ declare namespace H { * @param callback {Function} - The callback function. * @param opt_scope {Object=} - An optional scope to call the callback in. */ - addOnDisposeCallback(callback: Function, opt_scope?: Object): void; + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; } - export module OList { + namespace OList { /** * The event class for events that are dispatched by OList * @property target {*} - Object which triggered the event @@ -6212,7 +6342,7 @@ declare namespace H { * @property type {string} - Name of the dispatched event * @property defaultPrevented {boolean} - Indicates if preventDefault was called on the current event */ - export class Event extends H.util.Event { + class Event extends H.util.Event { /** * Constructor * @param list {H.util.OList} - The OList instance which is emitting the event @@ -6244,7 +6374,7 @@ declare namespace H { /** * A generic class to represent a handle for any kind of asynchronous processed requests */ - export class Request { + class Request { /** * Constructor * @param opt_onprogress {function(H.util.Request)=} - A callback to invoke every time when the request's progress state changes @@ -6277,11 +6407,11 @@ declare namespace H { getFailed(): number; } - export module Request { + namespace Request { /** * The supported states of an request */ - export enum State { + enum State { PENDING, PROCESSING, COMPLETE, @@ -6290,11 +6420,11 @@ declare namespace H { } } - export module animation { + namespace animation { /** * This mamespace contains easing functions used for Animation class. */ - export class ease { + class ease { /** * This function defines linear ease. * @param val {number} - A value in range [0..1] to translate @@ -6332,13 +6462,13 @@ declare namespace H { } } - export module kinetics { + namespace kinetics { /** * This interface defines kinetic move parameters used by map for kinetic drag. * @property power {number} - Power multiplier. Multiplier is used to increase the speed of the kinetic move. By default map uses 1. * @property duration {number} - Defines duration of the kinetic move. */ - export interface IKinetics { + interface IKinetics { /** * Easing function modifies animation progress. In example it can modify the animation in a way it starts rapidly and then slows down at the end. * @param p {number} - current progress diff --git a/types/heremaps/tslint.json b/types/heremaps/tslint.json new file mode 100644 index 0000000000..4ac54521fe --- /dev/null +++ b/types/heremaps/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "interface-name": [false] + } +} \ No newline at end of file From 2b5124dbb32c6525836591038af6f8558fe9d5de Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Wed, 7 Jun 2017 16:03:00 +0200 Subject: [PATCH 087/286] fix tests --- types/heremaps/heremaps-tests.ts | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/types/heremaps/heremaps-tests.ts b/types/heremaps/heremaps-tests.ts index 43c50d417c..24c23b1a82 100644 --- a/types/heremaps/heremaps-tests.ts +++ b/types/heremaps/heremaps-tests.ts @@ -28,19 +28,19 @@ function capture(resultContainer: HTMLElement, map: H.Map, ui: H.ui.UI) { * Boilerplate map initialization code starts below: */ // Step 1: initialize communication with the platform -var platform = new H.service.Platform({ +let platform = new H.service.Platform({ app_id: 'DemoAppId01082013GAL', app_code: 'AJKnXv84fjrb0KIHawS0Tg', useHTTPS: true, useCIT: true }); -var defaultLayers = platform.createDefaultLayers(); +let defaultLayers = platform.createDefaultLayers(); -var mapContainer = document.getElementById('map'); +let mapContainer = document.getElementById('map'); // Step 2: initialize a map -var map = new H.Map(mapContainer, defaultLayers.normal.map, { +let map = new H.Map(mapContainer, defaultLayers.normal.map, { // initial center and zoom level of the map zoom: 16, // Champs-Elysees @@ -50,23 +50,22 @@ var map = new H.Map(mapContainer, defaultLayers.normal.map, { // Step 3: make the map interactive // MapEvents enables the event system // Behavior implements default interactions for pan/zoom (also on mobile touch environments) -var behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map)); +let behavior = new H.mapevents.Behavior(new H.mapevents.MapEvents(map)); // Step 4: Create the default UI -var ui = H.ui.UI.createDefault(map, defaultLayers, 'en-US'); - +let ui = H.ui.UI.createDefault(map, defaultLayers, 'en-US'); // Step 6: Create "Capture" button and place for showing the captured area -var resultContainer = document.getElementById('panel'); +let resultContainer = document.getElementById('panel'); // Create container for the "Capture" button -var containerNode = document.createElement('div'); +let containerNode = document.createElement('div'); containerNode.setAttribute('style', 'position:absolute;top:0;left:0;background-color:#fff; padding:10px;'); containerNode.className = 'btn-group'; // Create the "Capture" button -var captureBtn = document.createElement('input'); +let captureBtn = document.createElement('input'); captureBtn.value = 'Capture'; captureBtn.type = 'button'; captureBtn.className = 'btn btn-sm btn-default'; @@ -76,6 +75,6 @@ containerNode.appendChild(captureBtn); mapContainer.appendChild(containerNode); // Step 7: Handle capture button click event -captureBtn.onclick = function() { +captureBtn.onclick = () => { capture(resultContainer, map, ui); -}; \ No newline at end of file +}; From 3c47bbdafcfbd7855caa71edbf5e61e438e4a210 Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Wed, 7 Jun 2017 16:07:02 +0200 Subject: [PATCH 088/286] add test for #e054978b9cbc30623b8e8b2621319f21dafcc734 [e054978] --- types/heremaps/heremaps-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/heremaps/heremaps-tests.ts b/types/heremaps/heremaps-tests.ts index 24c23b1a82..31d722f042 100644 --- a/types/heremaps/heremaps-tests.ts +++ b/types/heremaps/heremaps-tests.ts @@ -78,3 +78,5 @@ mapContainer.appendChild(containerNode); captureBtn.onclick = () => { capture(resultContainer, map, ui); }; + +let icon = new H.map.Icon('svg', { size: 5, crossOrigin: false }); From c7ec25e724ae31140f45a793f7d5a51ba1d8f24a Mon Sep 17 00:00:00 2001 From: Sean Kelley Date: Tue, 6 Jun 2017 18:07:46 -0400 Subject: [PATCH 089/286] Add react-virtualized-select. --- types/react-virtualized-select/index.d.ts | 34 +++++++++++++++++++ .../react-virtualized-select-tests.tsx | 12 +++++++ types/react-virtualized-select/tsconfig.json | 23 +++++++++++++ types/react-virtualized-select/tslint.json | 1 + 4 files changed, 70 insertions(+) create mode 100644 types/react-virtualized-select/index.d.ts create mode 100644 types/react-virtualized-select/react-virtualized-select-tests.tsx create mode 100644 types/react-virtualized-select/tsconfig.json create mode 100644 types/react-virtualized-select/tslint.json diff --git a/types/react-virtualized-select/index.d.ts b/types/react-virtualized-select/index.d.ts new file mode 100644 index 0000000000..d73b06cfc8 --- /dev/null +++ b/types/react-virtualized-select/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for react-virtualized-select 3.0 +// Project: https://github.com/bvaughn/react-virtualized-select +// Definitions by: Sean Kelley +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import * as React from "react"; +import { ReactSelectProps } from "react-select"; +import { ListProps } from "react-virtualized"; + +export interface VirtualizedOptionRenderOptions { + focusedOption: T; + focusedOptionIndex: number; + focusOption(option: T): void; + key: string; + labelKey: keyof T; + listProps: ListProps; + option: T; + options: T[]; + selectValue(option: T): void; + style: Record; + valueArray: T[]; +} + +export interface VirtualizedSelectProps extends ReactSelectProps { + async?: boolean; + maxHeight?: number; + optionHeight?: number; + optionRenderer?(options: VirtualizedOptionRenderOptions): JSX.Element; + selectComponent?: React.ComponentClass | React.StatelessComponent; +} + +declare class VirtualizedSelect extends React.PureComponent {} +export default VirtualizedSelect; diff --git a/types/react-virtualized-select/react-virtualized-select-tests.tsx b/types/react-virtualized-select/react-virtualized-select-tests.tsx new file mode 100644 index 0000000000..ced2f20b41 --- /dev/null +++ b/types/react-virtualized-select/react-virtualized-select-tests.tsx @@ -0,0 +1,12 @@ +import * as React from "react"; +import Select = require("react-select"); +import VirtualizedSelect from "react-virtualized-select"; + +
} + selectComponent={Select} + options={[]} +/>; diff --git a/types/react-virtualized-select/tsconfig.json b/types/react-virtualized-select/tsconfig.json new file mode 100644 index 0000000000..8795f8aae5 --- /dev/null +++ b/types/react-virtualized-select/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-virtualized-select-tests.tsx" + ] +} diff --git a/types/react-virtualized-select/tslint.json b/types/react-virtualized-select/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-virtualized-select/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e99d48a0e147ab9d4e9c9ae59c87c4299961321e Mon Sep 17 00:00:00 2001 From: marshall007 Date: Wed, 7 Jun 2017 16:47:13 -0500 Subject: [PATCH 090/286] @types/bull: add missing `createClient` option --- types/bull/bull-tests.tsx | 24 +++++++++++++++++++++++- types/bull/index.d.ts | 8 +++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/types/bull/bull-tests.tsx b/types/bull/bull-tests.tsx index 1552febf85..e0854cfafa 100644 --- a/types/bull/bull-tests.tsx +++ b/types/bull/bull-tests.tsx @@ -2,12 +2,12 @@ * Created by Bruno Grieder */ +import * as Redis from "ioredis"; import * as Queue from "bull"; const videoQueue = new Queue('video transcoding', 'redis://127.0.0.1:6379'); const audioQueue = new Queue('audio transcoding', {redis: {port: 6379, host: '127.0.0.1'}}); // Specify Redis connection using object const imageQueue = new Queue('image transcoding'); -const pdfQueue = new Queue('pdf transcoding'); videoQueue.process((job, done) => { // job.data contains the custom data passed when the job was created @@ -67,6 +67,28 @@ videoQueue.add({video: 'http://example.com/video1.mov'}); audioQueue.add({audio: 'http://example.com/audio1.mp3'}); imageQueue.add({image: 'http://example.com/image1.tiff'}); +////////////////////////////////////////////////////////////////////////////////// +// +// Re-using Redis Connections +// +////////////////////////////////////////////////////////////////////////////////// + +const client = new Redis(); +const subscriber = new Redis(); + +const pdfQueue = new Queue('pdf transcoding', { + createClient: (type: string, options: Redis.RedisOptions) => { + switch (type) { + case 'client': + return client; + case 'subscriber': + return subscriber; + default: + return new Redis(options); + } + } +}); + ////////////////////////////////////////////////////////////////////////////////// // // Using Promises diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index 926952f6c2..fcab3c282e 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -12,7 +12,7 @@ import * as Redis from "ioredis"; * It creates a new Queue that is persisted in Redis. * Everytime the same queue is instantiated it tries to process all the old jobs that may exist from a previous unfinished session. */ -declare var Bull: { +declare const Bull: { // tslint:disable:unified-signatures (queueName: string, opts?: Bull.QueueOptions): Bull.Queue; (queueName: string, url?: string): Bull.Queue; @@ -28,6 +28,12 @@ declare namespace Bull { */ redis?: Redis.RedisOptions; + /** + * When specified, the `Queue` will use this function to create new `ioredis` client connections. + * This is useful if you want to re-use connections. + */ + createClient?(type: 'client' | 'subscriber', redisOpts?: Redis.RedisOptions): Redis.Redis; + /** * Prefix to use for all redis keys */ From baf6a3bb98495e3feeb29a3a6b5d6dd36f48ca1a Mon Sep 17 00:00:00 2001 From: marshall007 Date: Wed, 7 Jun 2017 17:34:50 -0500 Subject: [PATCH 091/286] @types/bull: `ready` event was replaced by `Queue#isReady()` --- types/bull/bull-tests.tsx | 1 - types/bull/index.d.ts | 11 ++++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/bull/bull-tests.tsx b/types/bull/bull-tests.tsx index e0854cfafa..cbdcc83e0a 100644 --- a/types/bull/bull-tests.tsx +++ b/types/bull/bull-tests.tsx @@ -120,7 +120,6 @@ videoQueue.add({ video: 'http://example.com/video1.mov' }, { jobId: 1 }) ////////////////////////////////////////////////////////////////////////////////// pdfQueue -.on('ready', () => undefined) .on('error', (err: Error) => undefined) .on('active', (job: Queue.Job, jobPromise: Queue.JobPromise) => jobPromise.cancel()) .on('active', (job: Queue.Job) => undefined) diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index fcab3c282e..82a31a4ff3 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -207,6 +207,12 @@ declare namespace Bull { } interface Queue { + /** + * Returns a promise that resolves when Redis is connected and the queue is ready to accept jobs. + * This replaces the `ready` event emitted on Queue in previous verisons. + */ + isReady(): Promise; + /** * Defines a processing function for the jobs placed into a given Queue. * @@ -329,11 +335,6 @@ declare namespace Bull { */ on(event: string, callback: (...args: any[]) => void): this; - /** - * Redis is connected and the queue is ready to accept jobs - */ - on(event: 'ready', callback: EventCallback): this; - /** * An error occured */ From a586ed6d0c5b431a0d81ad93b770b07af8a81e0e Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 23:43:14 +0100 Subject: [PATCH 092/286] Added CertHostKey --- types/nodegit/cert-host-key.d.ts | 6 ++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 8 insertions(+) create mode 100644 types/nodegit/cert-host-key.d.ts diff --git a/types/nodegit/cert-host-key.d.ts b/types/nodegit/cert-host-key.d.ts new file mode 100644 index 0000000000..428d04b727 --- /dev/null +++ b/types/nodegit/cert-host-key.d.ts @@ -0,0 +1,6 @@ +export class CertHostkey { + certType: number; + type: number; + hashMd5: string; + hashSha1: string; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 7b485e2980..bd7f7791c6 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -11,6 +11,7 @@ export { Blame } from './blame'; export { Blob } from './blob'; export { Branch } from './branch'; export { Buf } from './buf'; +export { CertHostKey } from './cert-host-key'; export { Cert } from './cert'; export { CheckoutOptions } from './checkout-options'; export { Checkout } from './checkout'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 366b54206a..15398d46c4 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -24,6 +24,7 @@ "blob.d.ts", "branch.d.ts", "buf.d.ts", + "cert-host-key.d.ts", "cert.d.ts", "checkout-options.d.ts", "checkout.d.ts", From 7fb59e070da6791587be6733aed6399ac4f81530 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 23:48:32 +0100 Subject: [PATCH 093/286] Added Cert X509 --- types/nodegit/cert-x509.d.ts | 5 +++++ types/nodegit/index.d.ts | 3 ++- types/nodegit/tsconfig.json | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 types/nodegit/cert-x509.d.ts diff --git a/types/nodegit/cert-x509.d.ts b/types/nodegit/cert-x509.d.ts new file mode 100644 index 0000000000..14f38ac5fc --- /dev/null +++ b/types/nodegit/cert-x509.d.ts @@ -0,0 +1,5 @@ +export class CertX509 { + certType: number; + data: Buffer; + len: number; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index bd7f7791c6..9b446aa056 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -11,7 +11,8 @@ export { Blame } from './blame'; export { Blob } from './blob'; export { Branch } from './branch'; export { Buf } from './buf'; -export { CertHostKey } from './cert-host-key'; +export { CertHostkey } from './cert-host-key'; +export { CertX509 } from './cert-x509'; export { Cert } from './cert'; export { CheckoutOptions } from './checkout-options'; export { Checkout } from './checkout'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 15398d46c4..02fa864776 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -25,6 +25,7 @@ "branch.d.ts", "buf.d.ts", "cert-host-key.d.ts", + "cert-x509.d.ts", "cert.d.ts", "checkout-options.d.ts", "checkout.d.ts", From 959bd0bf845e080e2fda767e9edad8dacd35e6a3 Mon Sep 17 00:00:00 2001 From: Dolan Date: Wed, 7 Jun 2017 23:51:00 +0100 Subject: [PATCH 094/286] Added Cherrypick --- types/nodegit/cherry-pick.d.ts | 9 +++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 11 insertions(+) create mode 100644 types/nodegit/cherry-pick.d.ts diff --git a/types/nodegit/cherry-pick.d.ts b/types/nodegit/cherry-pick.d.ts new file mode 100644 index 0000000000..333831a29b --- /dev/null +++ b/types/nodegit/cherry-pick.d.ts @@ -0,0 +1,9 @@ +import { Repository } from './repository'; +import { Commit } from './commit'; +import { MergeOptions } from './merge-options'; + +export class Cherrypick { + static cherrypick(repo: Repository, commit: Commit, options?: CherrypickOptions): Promise; + static commit(repo: Repository, cherrypickCommit: Commit, ourCommit: Commit, mainline: number, mergeOptions?: MergeOptions): Promise; + static initOptions(opts: CherrypickOptions, version: number): number; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 9b446aa056..30e306c5a9 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -16,6 +16,7 @@ export { CertX509 } from './cert-x509'; export { Cert } from './cert'; export { CheckoutOptions } from './checkout-options'; export { Checkout } from './checkout'; +export { Cherrypick } from './cherry-pick'; export { CloneOptions } from './clone-options'; export { Clone } from './clone'; export { Commit } from './commit'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 02fa864776..5fd6456c5e 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -29,6 +29,7 @@ "cert.d.ts", "checkout-options.d.ts", "checkout.d.ts", + "cherry-pick.d.ts", "clone-options.d.ts", "clone.d.ts", "commit.d.ts", From 45e2febe28d41e587bbde6aaf9a21f85ca8981d9 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 00:39:50 +0100 Subject: [PATCH 095/286] Added CherrypickOptions --- types/nodegit/cherry-pick-options.d.ts | 9 +++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 11 insertions(+) create mode 100644 types/nodegit/cherry-pick-options.d.ts diff --git a/types/nodegit/cherry-pick-options.d.ts b/types/nodegit/cherry-pick-options.d.ts new file mode 100644 index 0000000000..7c6ec6976c --- /dev/null +++ b/types/nodegit/cherry-pick-options.d.ts @@ -0,0 +1,9 @@ +import { MergeOptions } from './merge-options'; +import { CheckoutOptions } from './checkout-options'; + +export interface CherrypickOptions { + version: number; + mainline: number; + mergeOpts: MergeOptions; + checkoutOpts: CheckoutOptions; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 30e306c5a9..6fea8d24f3 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -16,6 +16,7 @@ export { CertX509 } from './cert-x509'; export { Cert } from './cert'; export { CheckoutOptions } from './checkout-options'; export { Checkout } from './checkout'; +export { CherrypickOptions } from './cherry-pick-options'; export { Cherrypick } from './cherry-pick'; export { CloneOptions } from './clone-options'; export { Clone } from './clone'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 5fd6456c5e..e1239f9251 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -29,6 +29,7 @@ "cert.d.ts", "checkout-options.d.ts", "checkout.d.ts", + "cherry-pick-options.d.ts", "cherry-pick.d.ts", "clone-options.d.ts", "clone.d.ts", From 41aff746508bce9b830df40fc848cd1619ced261 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 00:43:36 +0100 Subject: [PATCH 096/286] Added Cred --- types/nodegit/cred.d.ts | 22 ++++++++++++++++++++++ types/nodegit/index.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 3 files changed, 24 insertions(+) create mode 100644 types/nodegit/cred.d.ts diff --git a/types/nodegit/cred.d.ts b/types/nodegit/cred.d.ts new file mode 100644 index 0000000000..759e43d814 --- /dev/null +++ b/types/nodegit/cred.d.ts @@ -0,0 +1,22 @@ +export namespace Cred { + enum TYPE { + USERPASS_PLAINTEXT = 1, + SSH_KEY = 2, + SSH_CUSTOM = 4, + DEFAULT = 8, + SSH_INTERACTIVE = 16, + USERNAME = 32, + SSH_MEMORY = 64 + } +} + +export class Cred { + static defaultNew(): Cred; + static sshKeyFromAgent(username: string): Cred; + static sshKeyMemoryNew(username: string, publickey: string, privatekey: string, passphrase: string): Promise; + static sshKeyNew(username: string, publickey: string, privatekey: string, passphrase: string): Cred; + static usernameNew(username: string): Promise; + static userpassPlaintextNew(username: string, password: string): Cred; + + hasUsername(): number; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 6fea8d24f3..79276255c6 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -23,6 +23,7 @@ export { Clone } from './clone'; export { Commit } from './commit'; export { Config } from './config'; export { ConvenientPatch } from './convenient-patch'; +export { Cred } from './cred'; export { CvarMap } from './cvar-map'; export { DescribeFormatOptions } from './describe-format-options'; export { DescribeOptions } from './describe-options'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index e1239f9251..74e9c7ad1c 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -36,6 +36,7 @@ "commit.d.ts", "config.d.ts", "convenient-patch.d.ts", + "cred.d.ts", "cvar-map.d.ts", "describe-format-options.d.ts", "describe-options.d.ts", From 0233c0dd42af75fddf98b65d002f5aa64f726d11 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 01:43:53 +0100 Subject: [PATCH 097/286] Added CredUsername and CredUserpassPayload --- types/nodegit/cred-user-pass-payload.d.ts | 4 ++++ types/nodegit/cred-username.d.ts | 6 ++++++ types/nodegit/index.d.ts | 2 ++ types/nodegit/tsconfig.json | 2 ++ 4 files changed, 14 insertions(+) create mode 100644 types/nodegit/cred-user-pass-payload.d.ts create mode 100644 types/nodegit/cred-username.d.ts diff --git a/types/nodegit/cred-user-pass-payload.d.ts b/types/nodegit/cred-user-pass-payload.d.ts new file mode 100644 index 0000000000..95beeb9f3a --- /dev/null +++ b/types/nodegit/cred-user-pass-payload.d.ts @@ -0,0 +1,4 @@ +export class CredUserpassPayload { + username: string; + password: string; +} diff --git a/types/nodegit/cred-username.d.ts b/types/nodegit/cred-username.d.ts new file mode 100644 index 0000000000..d7b619eb5d --- /dev/null +++ b/types/nodegit/cred-username.d.ts @@ -0,0 +1,6 @@ +import { Cred } from './cred'; + +export class CredUsername { + parent: Cred; + username: string; +} diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 79276255c6..32b86ba19f 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -23,6 +23,8 @@ export { Clone } from './clone'; export { Commit } from './commit'; export { Config } from './config'; export { ConvenientPatch } from './convenient-patch'; +export { CredUserpassPayload } from './cred-user-pass-payload'; +export { CredUsername } from './cred-username'; export { Cred } from './cred'; export { CvarMap } from './cvar-map'; export { DescribeFormatOptions } from './describe-format-options'; diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 74e9c7ad1c..31f9ee0497 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -36,6 +36,8 @@ "commit.d.ts", "config.d.ts", "convenient-patch.d.ts", + "cred-user-pass-payload.d.ts", + "cred-username.d.ts", "cred.d.ts", "cvar-map.d.ts", "describe-format-options.d.ts", From 66a6426d595f70fbf2d00386cb76cea2b93e565d Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 01:44:11 +0100 Subject: [PATCH 098/286] Fixed some errors --- types/nodegit/blame-hunk.d.ts | 2 +- types/nodegit/cherry-pick.d.ts | 1 + types/nodegit/diff.d.ts | 2 +- types/nodegit/filter.d.ts | 8 +++++--- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/types/nodegit/blame-hunk.d.ts b/types/nodegit/blame-hunk.d.ts index 601a7dbdfd..58ab8e7191 100644 --- a/types/nodegit/blame-hunk.d.ts +++ b/types/nodegit/blame-hunk.d.ts @@ -1,5 +1,5 @@ import { Oid } from './oid'; -import { Signature } from './Signature'; +import { Signature } from './signature'; export class BlameHunk { linesInHunk: number; diff --git a/types/nodegit/cherry-pick.d.ts b/types/nodegit/cherry-pick.d.ts index 333831a29b..291c5e0223 100644 --- a/types/nodegit/cherry-pick.d.ts +++ b/types/nodegit/cherry-pick.d.ts @@ -1,6 +1,7 @@ import { Repository } from './repository'; import { Commit } from './commit'; import { MergeOptions } from './merge-options'; +import { CherrypickOptions } from './cherry-pick-options'; export class Cherrypick { static cherrypick(repo: Repository, commit: Commit, options?: CherrypickOptions): Promise; diff --git a/types/nodegit/diff.d.ts b/types/nodegit/diff.d.ts index 3612e402a4..d675b36acf 100644 --- a/types/nodegit/diff.d.ts +++ b/types/nodegit/diff.d.ts @@ -126,7 +126,7 @@ export namespace Diff { export class Diff { static blobToBuffer(old_blob: Blob, oldAsPath: string, - buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; + buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; static indexToWorkdir(repo: Repository, index: Index, opts: DiffOptions): Promise; static treeToIndex(repo: Repository, old_tree: Tree, index: Index, opts: DiffOptions): Promise; static treeToTree(repo: Repository, old_tree: Tree, new_tree: Tree, opts: DiffOptions): Promise; diff --git a/types/nodegit/filter.d.ts b/types/nodegit/filter.d.ts index aedc0dbd6f..da1f71c2b9 100644 --- a/types/nodegit/filter.d.ts +++ b/types/nodegit/filter.d.ts @@ -1,3 +1,5 @@ +import { WriteStream } from 'fs'; + import { Repository } from './repository'; import { Blob } from './blob'; import { Buf } from './buf'; @@ -20,9 +22,9 @@ export class Filter { static listContains(filters: any, name: string): number; static listLength(fl: any): number; static listNew(repo: Repository, mode: number, options: number): Promise; - static listStreamBlob(filters: any, blob: Blob, target: Writestream): number; - static listStreamData(filters: any, data: Buf, target: Writestream): number; - static listStreamFile(filters: any, repo: Repository, path: string, target: Writestream): number; + static listStreamBlob(filters: any, blob: Blob, target: WriteStream): number; + static listStreamData(filters: any, data: Buf, target: WriteStream): number; + static listStreamFile(filters: any, repo: Repository, path: string, target: WriteStream): number; static unregister(name: string): number; lookup(name: string): Filter; From 98e2a4a83f2f327d121369248f22aeb51e64ae9d Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 01:57:03 +0100 Subject: [PATCH 099/286] Added some tests --- types/nodegit/annotated-commit.d.ts | 27 ++++++++++++++++++- types/nodegit/attr.d.ts | 2 +- types/nodegit/nodegit-tests.ts | 42 +++++++++++++++++++++++++++-- 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/types/nodegit/annotated-commit.d.ts b/types/nodegit/annotated-commit.d.ts index f0f9d4d925..0fb5465647 100644 --- a/types/nodegit/annotated-commit.d.ts +++ b/types/nodegit/annotated-commit.d.ts @@ -3,11 +3,36 @@ import { Oid } from './oid'; import { Reference } from './reference'; export class AnnotatedCommit { - static fromFetchhead(repo: Repository, branch_name: string, remote_url: string, id: Oid): Promise; + /** + * + * + * @static + * @param {Repository} repo - repository that contains the given commit + * @param {string} branchName - name of the (remote) branch + * @param {string} remoteUrl - url of the remote + * @param {Oid} id - the commit object id of the remote branch + * @returns {Promise} + * + * @memberof AnnotatedCommit + */ + static fromFetchhead(repo: Repository, branchName: string, remoteUrl: string, id: Oid): Promise; static fromRef(repo: Repository, ref: Reference): Promise; static fromRevspec(repo: Repository, revspec: string): Promise; static lookup(repo: Repository, id: Oid): Promise; + /** + * + * + * + * @memberof AnnotatedCommit + */ free(): void; + /** + * + * + * @returns {Oid} + * + * @memberof AnnotatedCommit + */ id(): Oid; } diff --git a/types/nodegit/attr.d.ts b/types/nodegit/attr.d.ts index 84a701f2b1..4966c407e0 100644 --- a/types/nodegit/attr.d.ts +++ b/types/nodegit/attr.d.ts @@ -13,6 +13,6 @@ export class Attr { static addMacro(repo: Repository, name: string, values: string): number; static cacheFlush(repo: Repository): void; static get(repo: Repository, flags: number, path: string, name: string): Promise; - static getMany(repo: Repository, flags: number, path: string, num_attr: number, names: string): any[]; + static getMany(repo: Repository, flags: number, path: string, numAttr: number, names: string): any[]; static value(attr: string): number; } diff --git a/types/nodegit/nodegit-tests.ts b/types/nodegit/nodegit-tests.ts index c4c57854b7..370369eed4 100644 --- a/types/nodegit/nodegit-tests.ts +++ b/types/nodegit/nodegit-tests.ts @@ -1,9 +1,47 @@ import * as Git from 'nodegit'; Git.Repository.discover("startPath", 1, "ceilingDirs").then((string) => { - // Use string + // Use string }); Git.Repository.init("path", true).then((repository) => { - // Use repository + // Use repository }); + +const repo = new Git.Repository(); +const id = new Git.Oid(); +const ref = new Git.Reference(); + +// AnnotatedCommit Tests + +Git.AnnotatedCommit.fromFetchhead(repo, "branch_name", "remote_url", id).then((annotatedCommit) => { + // Use annotatedCommit +}); + +Git.AnnotatedCommit.fromRef(repo, ref).then((annotatedCommit) => { + // Use annotatedCommit +}); + +Git.AnnotatedCommit.fromRevspec(repo, "revspec").then((annotatedCommit) => { + // Use annotatedCommit +}); + +Git.AnnotatedCommit.lookup(repo, id).then((annotatedCommit) => { + // Use annotatedCommit + annotatedCommit.free(); + annotatedCommit.id(); +}); + +// Attr tests + +let result = Git.Attr.addMacro(repo, "name", "values"); + +Git.Attr.cacheFlush(repo); + +Git.Attr.get(repo, 1, "path", "name").then((string) => { + // Use string +}); + +let array = Git.Attr.getMany(repo, 1, "path", 1, "names"); + +result = Git.Attr.value("attr"); From 73c4f21d978d6c5ea86ed54c56509fac69b52656 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:07:21 +0100 Subject: [PATCH 100/286] Added documentation --- types/nodegit/attr.d.ts | 53 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/types/nodegit/attr.d.ts b/types/nodegit/attr.d.ts index 4966c407e0..41c1aa5eb2 100644 --- a/types/nodegit/attr.d.ts +++ b/types/nodegit/attr.d.ts @@ -10,9 +10,62 @@ export namespace Attr { } export class Attr { + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @param {string} values + * @returns {number} + * + * @memberof Attr + */ static addMacro(repo: Repository, name: string, values: string): number; + /** + * + * + * @static + * @param {Repository} repo + * + * @memberof Attr + */ static cacheFlush(repo: Repository): void; + /** + * + * + * @static + * @param {Repository} repo - The repository containing the path. + * @param {number} flags - A combination of GIT_ATTR_CHECK... flags. + * @param {string} path - The path to check for attributes. Relative paths are interpreted relative to the repo root. The file does not have to exist, but if it does not, then it will be treated as a plain file (not a directory). + * @param {string} name - The name of the attribute to look up. + * @returns {Promise} - Output of the value of the attribute. Use the GIT_ATTR_... + * + * @memberof Attr + */ static get(repo: Repository, flags: number, path: string, name: string): Promise; + /** + * + * + * @static + * @param {Repository} repo - The repository containing the path. + * @param {number} flags - A combination of GIT_ATTR_CHECK... flags. + * @param {string} path - The path to check for attributes. Relative paths are interpreted relative to the repo root. The file does not have to exist, but if it does not, then it will be treated as a plain file (not a directory). + * @param {number} numAttr - The number of attributes being looked up + * @param {string} names - An array of num_attr strings containing attribute names. + * @returns {any[]} + * + * @memberof Attr + */ static getMany(repo: Repository, flags: number, path: string, numAttr: number, names: string): any[]; + /** + * + * + * @static + * @param {string} attr - The attribute + * @returns {number}- the value type for the attribute + * + * @memberof Attr + */ static value(attr: string): number; } From 20499792a7a8215cb4922291466683fed97cf173 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:13:24 +0100 Subject: [PATCH 101/286] Added documentation to Blame --- types/nodegit/blame-hunk.d.ts | 48 ++++++++++++++++++++++++ types/nodegit/blame-options.d.ts | 44 +++++++++++++++++++++- types/nodegit/blame.d.ts | 63 +++++++++++++++++++++++++++++++- types/nodegit/nodegit-tests.ts | 2 + 4 files changed, 154 insertions(+), 3 deletions(-) diff --git a/types/nodegit/blame-hunk.d.ts b/types/nodegit/blame-hunk.d.ts index 58ab8e7191..83dd1cc410 100644 --- a/types/nodegit/blame-hunk.d.ts +++ b/types/nodegit/blame-hunk.d.ts @@ -2,12 +2,60 @@ import { Oid } from './oid'; import { Signature } from './signature'; export class BlameHunk { + /** + * + * + * @type {number} + * @memberof BlameHunk + */ linesInHunk: number; + /** + * + * + * @type {Oid} + * @memberof BlameHunk + */ finalCommitId: Oid; + /** + * + * + * @type {number} + * @memberof BlameHunk + */ finalStartLineNumber: number; + /** + * + * + * @type {Signature} + * @memberof BlameHunk + */ finalSignature: Signature; + /** + * + * + * @type {Oid} + * @memberof BlameHunk + */ origCommitId: Oid; + /** + * + * + * @type {string} + * @memberof BlameHunk + */ origPath: string; + /** + * + * + * @type {number} + * @memberof BlameHunk + */ origStartLineNumber: number; + /** + * + * + * @type {Signature} + * @memberof BlameHunk + */ origSignature: Signature; } diff --git a/types/nodegit/blame-options.d.ts b/types/nodegit/blame-options.d.ts index ca5f1f50df..eac4c2f4f0 100644 --- a/types/nodegit/blame-options.d.ts +++ b/types/nodegit/blame-options.d.ts @@ -1,11 +1,53 @@ import {Oid} from './oid'; -export interface BlameOptions { +export class BlameOptions { + /** + * + * + * @type {number} + * @memberof BlameOptions + */ version: number; + /** + * + * + * @type {number} + * @memberof BlameOptions + */ flags: number; + /** + * + * + * @type {number} + * @memberof BlameOptions + */ minMatchCharacters: number; + /** + * + * + * @type {Oid} + * @memberof BlameOptions + */ newestCommit: Oid; + /** + * + * + * @type {Oid} + * @memberof BlameOptions + */ oldestCommit: Oid; + /** + * + * + * @type {number} + * @memberof BlameOptions + */ minLine: number; + /** + * + * + * @type {number} + * @memberof BlameOptions + */ maxLine: number; } diff --git a/types/nodegit/blame.d.ts b/types/nodegit/blame.d.ts index e5b5d90ec8..c6efdc133b 100644 --- a/types/nodegit/blame.d.ts +++ b/types/nodegit/blame.d.ts @@ -14,12 +14,71 @@ export namespace Blame { } export class Blame { + /** + * Retrieve the blame of a file + * + * @static + * @param {Repository} repo - Repository that contains the file + * @param {string} path - to the file to get the blame of + * @param {BlameOptions} [options] - Options for the blame + * @returns {Blame} + * + * @memberof Blame + */ static file(repo: Repository, path: string, options?: BlameOptions): Blame; + /** + * + * + * @static + * @param {BlameOptions} opts - The git_blame_options struct to initialize + * @param {number} version - Version of struct; pass GIT_BLAME_OPTIONS_VERSION + * @returns {number} + * + * @memberof Blame + */ static initOptions(opts: BlameOptions, version: number): number; - buffer(buffer: string, buffer_len: number): Promise; + /** + * + * + * @param {string} buffer + * @param {number} bufferLen + * @returns {Promise} + * + * @memberof Blame + */ + buffer(buffer: string, bufferLen: number): Promise; + /** + * + * + * + * @memberof Blame + */ free(): void; + /** + * + * + * @param {number} index + * @returns {BlameHunk} - the hunk at the given index, or NULL on error + * + * @memberof Blame + */ getHunkByIndex(index: number): BlameHunk; - getHunkByLine(lineno: number): BlameHunk; + /** + * + * + * @param {number} lineNo + * @returns {BlameHunk} - the hunk that contains the given line, or NULL on error + * + * @memberof Blame + */ + getHunkByLine(lineNo: number): BlameHunk; + /** + * + * + * @returns {number} + * + * @memberof Blame + */ getHunkCount(): number; } diff --git a/types/nodegit/nodegit-tests.ts b/types/nodegit/nodegit-tests.ts index 370369eed4..e9bceb601e 100644 --- a/types/nodegit/nodegit-tests.ts +++ b/types/nodegit/nodegit-tests.ts @@ -45,3 +45,5 @@ Git.Attr.get(repo, 1, "path", "name").then((string) => { let array = Git.Attr.getMany(repo, 1, "path", 1, "names"); result = Git.Attr.value("attr"); + +const blameOptions = new Git.BlameOptions(); From 415a39e089f22a85621b8a58464947ac43e33702 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:20:50 +0100 Subject: [PATCH 102/286] Added documentation and more methods to blob --- types/nodegit/blob.d.ts | 139 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 138 insertions(+), 1 deletion(-) diff --git a/types/nodegit/blob.d.ts b/types/nodegit/blob.d.ts index 32f020b0ce..edd0eb62f7 100644 --- a/types/nodegit/blob.d.ts +++ b/types/nodegit/blob.d.ts @@ -1,20 +1,157 @@ +import { WriteStream } from 'fs'; + import { Repository } from './repository'; import { Oid } from './oid'; export class Blob { + /** + * + * + * @static + * @param {Repository} repo - repository where to blob will be written + * @param {Buffer} buffer - data to be written into the blob + * @param {number} len - length of the data + * @returns {Oid} - return the id of the written blob + * + * @memberof Blob + */ static createFromBuffer(repo: Repository, buffer: Buffer, len: number): Oid; + /** + * + * + * @static + * @param {Oid} id - return the id of the written blob + * @param {Repository} repo - repository where the blob will be written. this repository can be bare or not + * @param {string} path - file from which the blob will be created + * @returns {number} + * + * @memberof Blob + */ static createFromDisk(id: Oid, repo: Repository, path: string): number; - static createFromWorkdir(id: Oid, repo: Repository, relative_path: string): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} hintPath + * @returns {Promise} + * + * @memberof Blob + */ + static createFromStream(repo: Repository, hintPath: string): Promise; + /** + * + * + * @static + * @param {Oid} id - return the id of the written blob + * @param {Repository} repo - repository where the blob will be written. this repository cannot be bare + * @param {string} relativePath - file from which the blob will be created, relative to the repository's working dir + * @returns {number} - 0 or an error code + * + * @memberof Blob + */ + static createFromWorkdir(id: Oid, repo: Repository, relativePath: string): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {(string | Oid | Blob)} id + * @returns {Promise} + * + * @memberof Blob + */ static lookup(repo: Repository, id: string | Oid | Blob): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Oid} id + * @param {number} len + * @returns {Promise} + * + * @memberof Blob + */ static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + /** + * + * + * + * @memberof Blob + */ free(): void; + /** + * + * + * @returns {Oid} + * + * @memberof Blob + */ id(): Oid; + /** + * + * + * @returns {number} + * + * @memberof Blob + */ isBinary(): number; + /** + * + * + * @returns {Repository} + * + * @memberof Blob + */ owner(): Repository; + /** + * + * + * @returns {Buffer} + * + * @memberof Blob + */ rawcontent(): Buffer; + /** + * + * + * @returns {number} + * + * @memberof Blob + */ rawsize(): number; + /** + * + * + * @returns {Buffer} + * + * @memberof Blob + */ content(): Buffer; + /** + * + * + * @returns {string} + * + * @memberof Blob + */ toString(): string; + /** + * + * + * @returns {number} + * + * @memberof Blob + */ filemode(): number; + /** + * + * + * @returns {Promise} + * + * @memberof Blob + */ + dup(): Promise; } From b54f72f4fdc599ec885558653073b74dfa2efd99 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:22:49 +0100 Subject: [PATCH 103/286] Added documentation for Branch --- types/nodegit/branch.d.ts | 114 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 108 insertions(+), 6 deletions(-) diff --git a/types/nodegit/branch.d.ts b/types/nodegit/branch.d.ts index d121650864..4c48d32101 100644 --- a/types/nodegit/branch.d.ts +++ b/types/nodegit/branch.d.ts @@ -12,14 +12,116 @@ export namespace Branch { } export class Branch { - static create(repo: Repository, branch_name: string, target: Commit, force: number): Promise; - static createFromAnnotated(repository: Repository, branch_name: string, commit: AnnotatedCommit, force: number): Reference; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} branchName + * @param {Commit} target + * @param {number} force + * @returns {Promise} + * + * @memberof Branch + */ + static create(repo: Repository, branchName: string, target: Commit, force: number): Promise; + /** + * + * + * @static + * @param {Repository} repository + * @param {string} branchName + * @param {AnnotatedCommit} commit + * @param {number} force + * @returns {Reference} + * + * @memberof Branch + */ + static createFromAnnotated(repository: Repository, branchName: string, commit: AnnotatedCommit, force: number): Reference; + /** + * + * + * @static + * @param {Reference} branch + * @returns {number} + * + * @memberof Branch + */ static delete(branch: Reference): number; + /** + * + * + * @static + * @param {Reference} branch + * @returns {number} + * + * @memberof Branch + */ static isHead(branch: Reference): number; - static iteratorNew(repo: Repository, list_flags: number): Promise; - static lookup(repo: Repository, branch_name: string, branch_type: number): Promise; - static move(branch: Reference, new_branch_name: string, force: number): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {number} listFlags + * @returns {Promise} + * + * @memberof Branch + */ + static iteratorNew(repo: Repository, listFlags: number): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} branchName + * @param {number} branchType + * @returns {Promise} + * + * @memberof Branch + */ + static lookup(repo: Repository, branchName: string, branchType: number): Promise; + /** + * + * + * @static + * @param {Reference} branch + * @param {string} newBranchName + * @param {number} force + * @returns {Promise} + * + * @memberof Branch + */ + static move(branch: Reference, newBranchName: string, force: number): Promise; + /** + * + * + * @static + * @param {Reference} ref + * @returns {Promise} + * + * @memberof Branch + */ static name(ref: Reference): Promise; - static setUpstream(branch: Reference, upstream_name: string): Promise; + /** + * + * + * @static + * @param {Reference} branch + * @param {string} upstreamName + * @returns {Promise} + * + * @memberof Branch + */ + static setUpstream(branch: Reference, upstreamName: string): Promise; + /** + * + * + * @static + * @param {Reference} branch + * @returns {Promise} + * + * @memberof Branch + */ static upstream(branch: Reference): Promise; } From 29a0cd79eb39c9dde5b27833f56a1c1a2653846c Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:27:21 +0100 Subject: [PATCH 104/286] Added documentation --- types/nodegit/attr.d.ts | 6 ++++-- types/nodegit/branch.d.ts | 4 ++-- types/nodegit/nodegit-tests.ts | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/types/nodegit/attr.d.ts b/types/nodegit/attr.d.ts index 41c1aa5eb2..fdcf4dc56b 100644 --- a/types/nodegit/attr.d.ts +++ b/types/nodegit/attr.d.ts @@ -37,7 +37,8 @@ export class Attr { * @static * @param {Repository} repo - The repository containing the path. * @param {number} flags - A combination of GIT_ATTR_CHECK... flags. - * @param {string} path - The path to check for attributes. Relative paths are interpreted relative to the repo root. The file does not have to exist, but if it does not, then it will be treated as a plain file (not a directory). + * @param {string} path - The path to check for attributes. Relative paths are interpreted relative to the repo root. + * The file does not have to exist, but if it does not, then it will be treated as a plain file (not a directory). * @param {string} name - The name of the attribute to look up. * @returns {Promise} - Output of the value of the attribute. Use the GIT_ATTR_... * @@ -50,7 +51,8 @@ export class Attr { * @static * @param {Repository} repo - The repository containing the path. * @param {number} flags - A combination of GIT_ATTR_CHECK... flags. - * @param {string} path - The path to check for attributes. Relative paths are interpreted relative to the repo root. The file does not have to exist, but if it does not, then it will be treated as a plain file (not a directory). + * @param {string} path - The path to check for attributes. Relative paths are interpreted relative to the repo root. + * The file does not have to exist, but if it does not, then it will be treated as a plain file (not a directory). * @param {number} numAttr - The number of attributes being looked up * @param {string} names - An array of num_attr strings containing attribute names. * @returns {any[]} diff --git a/types/nodegit/branch.d.ts b/types/nodegit/branch.d.ts index 4c48d32101..0c52131a51 100644 --- a/types/nodegit/branch.d.ts +++ b/types/nodegit/branch.d.ts @@ -75,12 +75,12 @@ export class Branch { * @static * @param {Repository} repo * @param {string} branchName - * @param {number} branchType + * @param {Branch.BRANCH} branchType * @returns {Promise} * * @memberof Branch */ - static lookup(repo: Repository, branchName: string, branchType: number): Promise; + static lookup(repo: Repository, branchName: string, branchType: Branch.BRANCH): Promise; /** * * diff --git a/types/nodegit/nodegit-tests.ts b/types/nodegit/nodegit-tests.ts index e9bceb601e..c8d296ea09 100644 --- a/types/nodegit/nodegit-tests.ts +++ b/types/nodegit/nodegit-tests.ts @@ -47,3 +47,7 @@ let array = Git.Attr.getMany(repo, 1, "path", 1, "names"); result = Git.Attr.value("attr"); const blameOptions = new Git.BlameOptions(); + +Git.Branch.lookup(repo, "branch_name", Git.Branch.BRANCH.LOCAL).then(function (reference) { + // Use reference +}); From 2dc0287a6b84ed7d177bea46a79e218da9223efd Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:28:00 +0100 Subject: [PATCH 105/286] Made enums all constants --- types/nodegit/attr.d.ts | 2 +- types/nodegit/blame.d.ts | 2 +- types/nodegit/branch.d.ts | 2 +- types/nodegit/cert.d.ts | 4 ++-- types/nodegit/checkout.d.ts | 4 ++-- types/nodegit/clone.d.ts | 2 +- types/nodegit/config.d.ts | 2 +- types/nodegit/cred.d.ts | 2 +- types/nodegit/diff-binary.d.ts | 2 +- types/nodegit/diff.d.ts | 16 ++++++++-------- types/nodegit/enums.d.ts | 10 +++++----- types/nodegit/error.d.ts | 4 ++-- types/nodegit/fetch.d.ts | 2 +- types/nodegit/filter.d.ts | 4 ++-- types/nodegit/hash-sig.d.ts | 2 +- types/nodegit/index_.d.ts | 4 ++-- types/nodegit/lib-git2.d.ts | 2 +- types/nodegit/merge.d.ts | 10 +++++----- types/nodegit/odb.d.ts | 2 +- types/nodegit/pack-builder.d.ts | 2 +- types/nodegit/path-spec.d.ts | 2 +- types/nodegit/rebase-operation.d.ts | 2 +- types/nodegit/reference.d.ts | 4 ++-- types/nodegit/remote.d.ts | 4 ++-- types/nodegit/reset.d.ts | 2 +- types/nodegit/rev-parse.d.ts | 2 +- types/nodegit/rev-walk.d.ts | 2 +- types/nodegit/stash.d.ts | 6 +++--- types/nodegit/status.d.ts | 6 +++--- types/nodegit/submodule.d.ts | 8 ++++---- types/nodegit/transport.d.ts | 2 +- types/nodegit/tree-entry.d.ts | 2 +- types/nodegit/tree.d.ts | 2 +- 33 files changed, 62 insertions(+), 62 deletions(-) diff --git a/types/nodegit/attr.d.ts b/types/nodegit/attr.d.ts index fdcf4dc56b..c7b2d3ea22 100644 --- a/types/nodegit/attr.d.ts +++ b/types/nodegit/attr.d.ts @@ -1,7 +1,7 @@ import { Repository } from './repository'; export namespace Attr { - enum STATES { + const enum STATES { UNSPECIFIED_T = 0, TRUE_T = 1, FALSE_T = 2, diff --git a/types/nodegit/blame.d.ts b/types/nodegit/blame.d.ts index c6efdc133b..684db81b6c 100644 --- a/types/nodegit/blame.d.ts +++ b/types/nodegit/blame.d.ts @@ -3,7 +3,7 @@ import { BlameOptions } from './blame-options'; import {BlameHunk} from './blame-hunk'; export namespace Blame { - enum FLAG { + const enum FLAG { NORMAL = 0, TRACK_COPIES_SAME_FILE = 1, TRACK_COPIES_SAME_COMMIT_MOVES = 2, diff --git a/types/nodegit/branch.d.ts b/types/nodegit/branch.d.ts index 0c52131a51..47bd1ec76f 100644 --- a/types/nodegit/branch.d.ts +++ b/types/nodegit/branch.d.ts @@ -4,7 +4,7 @@ import { Commit } from './commit'; import { AnnotatedCommit } from './annotated-commit'; export namespace Branch { - enum BRANCH { + const enum BRANCH { LOCAL = 1, REMOTE = 2, ALL = 3 diff --git a/types/nodegit/cert.d.ts b/types/nodegit/cert.d.ts index f910453700..fd749beba9 100644 --- a/types/nodegit/cert.d.ts +++ b/types/nodegit/cert.d.ts @@ -1,12 +1,12 @@ export namespace Cert { - enum TYPE { + const enum TYPE { NONE = 0, X509 = 1, HOSTKEY_LIBSSH2 = 2, STRARRAY = 3 } - enum SSH { + const enum SSH { MD5 = 1, SHA1 = 2 } diff --git a/types/nodegit/checkout.d.ts b/types/nodegit/checkout.d.ts index a7bc6d63fc..af5f66faf3 100644 --- a/types/nodegit/checkout.d.ts +++ b/types/nodegit/checkout.d.ts @@ -7,7 +7,7 @@ import { Commit } from './commit'; import { Index } from './index'; export namespace Checkout { - enum NOTIFY { + const enum NOTIFY { NONE = 0, CONFLICT = 1, DIRTY = 2, @@ -17,7 +17,7 @@ export namespace Checkout { ALL = 65535 } - enum STRATEGY { + const enum STRATEGY { NONE = 0, SAFE = 1, FORCE = 2, diff --git a/types/nodegit/clone.d.ts b/types/nodegit/clone.d.ts index e0b92bb9ea..c038a8e26a 100644 --- a/types/nodegit/clone.d.ts +++ b/types/nodegit/clone.d.ts @@ -2,7 +2,7 @@ import { Repository } from './repository'; import { CloneOptions } from './clone-options'; export namespace Clone { - enum LOCAL { + const enum LOCAL { AUTO = 0, LOCAL = 1, NO_LOCAL = 2, diff --git a/types/nodegit/config.d.ts b/types/nodegit/config.d.ts index ad8df1a327..ea61c52d3c 100644 --- a/types/nodegit/config.d.ts +++ b/types/nodegit/config.d.ts @@ -1,7 +1,7 @@ import { Buf } from './buf'; export namespace Config { - enum LEVEL { + const enum LEVEL { SYSTEM = 1, XDG = 2, GLOBAL = 3, diff --git a/types/nodegit/cred.d.ts b/types/nodegit/cred.d.ts index 759e43d814..9de014311b 100644 --- a/types/nodegit/cred.d.ts +++ b/types/nodegit/cred.d.ts @@ -1,5 +1,5 @@ export namespace Cred { - enum TYPE { + const enum TYPE { USERPASS_PLAINTEXT = 1, SSH_KEY = 2, SSH_CUSTOM = 4, diff --git a/types/nodegit/diff-binary.d.ts b/types/nodegit/diff-binary.d.ts index fa6643038d..d01181c92a 100644 --- a/types/nodegit/diff-binary.d.ts +++ b/types/nodegit/diff-binary.d.ts @@ -1,7 +1,7 @@ import { DiffBinaryFile } from './diff-binary-file'; export namespace DiffBinary { - enum DIFF_BINARY { + const enum DIFF_BINARY { NONE = 0, LITERAL = 1, DELTA = 2 diff --git a/types/nodegit/diff.d.ts b/types/nodegit/diff.d.ts index d675b36acf..6926527124 100644 --- a/types/nodegit/diff.d.ts +++ b/types/nodegit/diff.d.ts @@ -18,7 +18,7 @@ export interface DiffFindOptions { } export namespace Diff { - enum DELTA { + const enum DELTA { UNMODIFIED = 0, ADDED = 1, DELETED = 2, @@ -32,7 +32,7 @@ export namespace Diff { CONFLICTED = 10 } - enum FIND { + const enum FIND { BY_CONFIG = 0, RENAMES = 1, RENAMES_FROM_REWRITES = 2, @@ -51,14 +51,14 @@ export namespace Diff { REMOVE_UNMODIFIED = 65536 } - enum FLAG { + const enum FLAG { BINARY = 1, NOT_BINARY = 2, VALID_ID = 4, EXISTS = 8 } - enum FORMAT { + const enum FORMAT { PATCH = 1, PATCH_HEADER = 2, RAW = 3, @@ -66,12 +66,12 @@ export namespace Diff { NAME_STATUS = 5 } - enum FORMAT_EMAIL_FLAGS { + const enum FORMAT_EMAIL_FLAGS { FORMAT_EMAIL_NONE = 0, FORMAT_EMAIL_EXCLUDE_SUBJECT_PATCH_MARKER = 1 } - enum LINE { + const enum LINE { CONTEXT = 32, ADDITION = 43, DELETION = 45, @@ -83,7 +83,7 @@ export namespace Diff { BINARY = 66 } - enum OPTION { + const enum OPTION { NORMAL = 0, REVERSE = 1, INCLUDE_IGNORED = 2, @@ -115,7 +115,7 @@ export namespace Diff { SHOW_BINARY = 1073741824 } - enum STATS_FORMAT { + const enum STATS_FORMAT { STATS_NONE = 0, STATS_FULL = 1, STATS_SHORT = 2, diff --git a/types/nodegit/enums.d.ts b/types/nodegit/enums.d.ts index 850979ac51..4fb44850ca 100644 --- a/types/nodegit/enums.d.ts +++ b/types/nodegit/enums.d.ts @@ -1,23 +1,23 @@ export namespace Enums { - enum CVAR { + const enum CVAR { FALSE = 0, TRUE = 1, INT32 = 2, string = 3 } - enum DIRECTION { + const enum DIRECTION { FETCH = 0, PUSH = 1 } - enum FEATURE { + const enum FEATURE { THREADS = 1, HTTPS = 2, SSH = 4 } - enum IDXENTRY_EXTENDED_FLAG { + const enum IDXENTRY_EXTENDED_FLAG { IDXENTRY_INTENT_TO_ADD = 8192, IDXENTRY_SKIP_WORKTREE = 16384, IDXENTRY_EXTENDED2 = 32768, @@ -34,7 +34,7 @@ export namespace Enums { IDXENTRY_NEW_SKIP_WORKTREE = 512 } - enum INDXENTRY_FLAG { + const enum INDXENTRY_FLAG { IDXENTRY_EXTENDED = 16384, IDXENTRY_VALID = 32768 } diff --git a/types/nodegit/error.d.ts b/types/nodegit/error.d.ts index e1267c082b..c259749e8b 100644 --- a/types/nodegit/error.d.ts +++ b/types/nodegit/error.d.ts @@ -1,5 +1,5 @@ export namespace Error { - enum ERROR { + const enum ERROR { GITERR_NONE = 0, GITERR_NOMEMORY = 1, GITERR_OS = 2, @@ -33,7 +33,7 @@ export namespace Error { GITERR_FILESYSTEM = 30 } - enum CODE { + const enum CODE { OK = 0, ERROR = -1, ENOTFOUND = -3, diff --git a/types/nodegit/fetch.d.ts b/types/nodegit/fetch.d.ts index 2e71097ba3..db0980586f 100644 --- a/types/nodegit/fetch.d.ts +++ b/types/nodegit/fetch.d.ts @@ -1,7 +1,7 @@ import { FetchOptions } from './fetch-options'; export namespace Fetch { - enum PRUNE { + const enum PRUNE { GIT_FETCH_PRUNE_UNSPECIFIED = 0, GIT_FETCH_PRUNE = 1, GIT_FETCH_NO_PRUNE = 2 diff --git a/types/nodegit/filter.d.ts b/types/nodegit/filter.d.ts index da1f71c2b9..066a51183e 100644 --- a/types/nodegit/filter.d.ts +++ b/types/nodegit/filter.d.ts @@ -5,12 +5,12 @@ import { Blob } from './blob'; import { Buf } from './buf'; export namespace Filter { - enum FLAG { + const enum FLAG { DEFAULT = 0, ALLOW_UNSAFE = 1 } - enum MODE { + const enum MODE { TO_WORKTREE = 0, SMUDGE = 0, TO_ODB = 1, diff --git a/types/nodegit/hash-sig.d.ts b/types/nodegit/hash-sig.d.ts index afa9bc121c..5e9897450f 100644 --- a/types/nodegit/hash-sig.d.ts +++ b/types/nodegit/hash-sig.d.ts @@ -1,5 +1,5 @@ export namespace Hashsig { - enum OPTION { + const enum OPTION { NORMAL = 0, IGNORE_WHITESPACE = 1, SMART_WHITESPACE = 2, diff --git a/types/nodegit/index_.d.ts b/types/nodegit/index_.d.ts index 9902b53d35..6fd80f5047 100644 --- a/types/nodegit/index_.d.ts +++ b/types/nodegit/index_.d.ts @@ -5,14 +5,14 @@ import { Tree } from './tree'; import { Strarray } from './str-array'; export namespace Index { - enum ADD_OPTION { + const enum ADD_OPTION { ADD_DEFAULT = 0, ADD_FORCE = 1, ADD_DISABLE_PATHSPEC_MATCH = 2, ADD_CHECK_PATHSPEC = 4 } - enum CAP { + const enum CAP { IGNORE_CASE = 1, NO_FILEMODE = 2, NO_SYMLINKS = 4, diff --git a/types/nodegit/lib-git2.d.ts b/types/nodegit/lib-git2.d.ts index 9d7f1a5281..be5a5d1856 100644 --- a/types/nodegit/lib-git2.d.ts +++ b/types/nodegit/lib-git2.d.ts @@ -1,5 +1,5 @@ export namespace Libgit2 { - enum OPT { + const enum OPT { GET_MWINDOW_SIZE = 0, SET_MWINDOW_SIZE = 1, GET_MWINDOW_MAPPED_LIMIT = 2, diff --git a/types/nodegit/merge.d.ts b/types/nodegit/merge.d.ts index fb135e178f..737d3c5a04 100644 --- a/types/nodegit/merge.d.ts +++ b/types/nodegit/merge.d.ts @@ -10,7 +10,7 @@ import { MergeOptions } from './merge-options'; import { MergeFileInput } from './merge-file-input'; export namespace Merge { - enum ANALYSIS { + const enum ANALYSIS { NONE = 0, NORMAL = 1, UP_TO_DATE = 2, @@ -18,14 +18,14 @@ export namespace Merge { UNBORN = 8 } - enum FILE_FAVOR { + const enum FILE_FAVOR { NORMAL = 0, OURS = 1, THEIRS = 2, UNION = 3 } - enum FILE_FLAGS { + const enum FILE_FLAGS { FILE_DEFAULT = 0, FILE_STYLE_MERGE = 1, FILE_STYLE_DIFF3 = 2, @@ -37,13 +37,13 @@ export namespace Merge { FILE_DIFF_MINIMAL = 128 } - enum PREFERENCE { + const enum PREFERENCE { NONE = 0, NO_FASTFORWARD = 1, FASTFORWARD_ONLY = 2 } - enum TREE_FLAG { + const enum TREE_FLAG { TREE_FIND_RENAMES = 1 } } diff --git a/types/nodegit/odb.d.ts b/types/nodegit/odb.d.ts index f43f1673db..c0cbfd8725 100644 --- a/types/nodegit/odb.d.ts +++ b/types/nodegit/odb.d.ts @@ -2,7 +2,7 @@ import { Oid } from './oid'; import { OdbObject } from './odb-object'; export namespace Odb { - enum STREAM { + const enum STREAM { RDONLY = 2, WRONLY = 4, RW = 6 diff --git a/types/nodegit/pack-builder.d.ts b/types/nodegit/pack-builder.d.ts index 0f21f5f328..ed0fa0a2cc 100644 --- a/types/nodegit/pack-builder.d.ts +++ b/types/nodegit/pack-builder.d.ts @@ -3,7 +3,7 @@ import { Oid } from './oid'; import { Revwalk } from './rev-walk'; export namespace Packbuilder { - enum STAGE { + const enum STAGE { ADDING_OBJECTS = 0, DELTAFICATION = 1 } diff --git a/types/nodegit/path-spec.d.ts b/types/nodegit/path-spec.d.ts index d09d2812da..99435d5e0d 100644 --- a/types/nodegit/path-spec.d.ts +++ b/types/nodegit/path-spec.d.ts @@ -6,7 +6,7 @@ import { Index } from './index'; import { Strarray } from './str-array'; export namespace Pathspec { - enum FLAG { + const enum FLAG { DEFAULT = 0, IGNORE_CASE = 1, USE_CASE = 2, diff --git a/types/nodegit/rebase-operation.d.ts b/types/nodegit/rebase-operation.d.ts index a6e6e53bfa..7144ebe6a9 100644 --- a/types/nodegit/rebase-operation.d.ts +++ b/types/nodegit/rebase-operation.d.ts @@ -1,7 +1,7 @@ import { Oid } from './oid'; export namespace RebaseOperation { - enum REBASE_OPERATION { + const enum REBASE_OPERATION { PICK = 0, REWORD = 1, EDIT = 2, diff --git a/types/nodegit/reference.d.ts b/types/nodegit/reference.d.ts index e2148f6a07..4edd34d2da 100644 --- a/types/nodegit/reference.d.ts +++ b/types/nodegit/reference.d.ts @@ -3,14 +3,14 @@ import { Oid } from './oid'; import { Object } from './object'; export namespace Reference { - enum TYPE { + const enum TYPE { INVALID = 0, OID = 1, SYMBOLIC = 2, LISTALL = 3 } - enum NORMALIZE { + const enum NORMALIZE { REF_FORMAT_NORMAL = 0, REF_FORMAT_ALLOW_ONELEVEL = 1, REF_FORMAT_REFSPEC_PATTERN = 2, diff --git a/types/nodegit/remote.d.ts b/types/nodegit/remote.d.ts index 0c3923c57c..bba1f640fb 100644 --- a/types/nodegit/remote.d.ts +++ b/types/nodegit/remote.d.ts @@ -9,14 +9,14 @@ import { PushOptions } from './push-options'; import { Refspec } from './ref-spec'; export namespace Remote { - enum AUTOTAG_OPTION { + const enum AUTOTAG_OPTION { DOWNLOAD_TAGS_UNSPECIFIED = 0, DOWNLOAD_TAGS_AUTO = 1, DOWNLOAD_TAGS_NONE = 2, DOWNLOAD_TAGS_ALL = 3 } - enum COMPLETION_TYPE { + const enum COMPLETION_TYPE { COMPLETION_DOWNLOAD = 0, COMPLETION_INDEXING = 1, COMPLETION_ERROR = 2 diff --git a/types/nodegit/reset.d.ts b/types/nodegit/reset.d.ts index 8af3919ff4..25ff5ae563 100644 --- a/types/nodegit/reset.d.ts +++ b/types/nodegit/reset.d.ts @@ -5,7 +5,7 @@ import { Strarray } from './str-array'; import { CheckoutOptions } from './checkout-options'; export namespace Reset { - enum TYPE { + const enum TYPE { SOFT = 1, MIXED = 2, HARD = 3 diff --git a/types/nodegit/rev-parse.d.ts b/types/nodegit/rev-parse.d.ts index 9d0136cac6..7bdbc80676 100644 --- a/types/nodegit/rev-parse.d.ts +++ b/types/nodegit/rev-parse.d.ts @@ -3,7 +3,7 @@ import { Repository } from './repository'; import { Reference } from './reference'; export namespace Revparse { - enum MODE { + const enum MODE { SINGLE = 1, RANGE = 2, MERGE_BASE = 4 diff --git a/types/nodegit/rev-walk.d.ts b/types/nodegit/rev-walk.d.ts index ad54969164..643220b492 100644 --- a/types/nodegit/rev-walk.d.ts +++ b/types/nodegit/rev-walk.d.ts @@ -3,7 +3,7 @@ import { Oid } from './oid'; import { Commit } from './commit'; export namespace Revwalk { - enum SORT { + const enum SORT { NONE = 0, TOPOLOGICAL = 1, TIME = 2, diff --git a/types/nodegit/stash.d.ts b/types/nodegit/stash.d.ts index 5208fa7e5f..39a6893140 100644 --- a/types/nodegit/stash.d.ts +++ b/types/nodegit/stash.d.ts @@ -4,12 +4,12 @@ import { Oid } from './oid'; import { CheckoutOptions } from './checkout-options'; export namespace Stash { - enum APPLY_FLAGS { + const enum APPLY_FLAGS { APPLY_DEFAULT = 0, APPLY_REINSTATE_INDEX = 1 } - enum APPLY_PROGRESS { + const enum APPLY_PROGRESS { NONE = 0, LOADING_STASH = 1, ANALYZE_INDEX = 2, @@ -20,7 +20,7 @@ export namespace Stash { DONE = 7 } - enum FLAGS { + const enum FLAGS { DEFAULT = 0, KEEP_INDEX = 1, INCLUDE_UNTRACKED = 2, diff --git a/types/nodegit/status.d.ts b/types/nodegit/status.d.ts index 92bbe564f3..49ad0fd142 100644 --- a/types/nodegit/status.d.ts +++ b/types/nodegit/status.d.ts @@ -4,7 +4,7 @@ import { StatusEntry } from './status-entry'; import { StatusOptions } from './status-options'; export namespace Status { - enum STATUS { + const enum STATUS { CURRENT = 0, INDEX_NEW = 1, INDEX_MODIFIED = 2, @@ -21,7 +21,7 @@ export namespace Status { CONFLICTED = 32768 } - enum OPT { + const enum OPT { INCLUDE_UNTRACKED = 1, INCLUDE_IGNORED = 2, INCLUDE_UNMODIFIED = 4, @@ -40,7 +40,7 @@ export namespace Status { INCLUDE_UNREADABLE_AS_UNTRACKED = 32768 } - enum SHOW { + const enum SHOW { INDEX_AND_WORKDIR = 0, INDEX_ONLY = 1, WORKDIR_ONLY = 2 diff --git a/types/nodegit/submodule.d.ts b/types/nodegit/submodule.d.ts index b3c1576db4..fd64a1c8ac 100644 --- a/types/nodegit/submodule.d.ts +++ b/types/nodegit/submodule.d.ts @@ -4,7 +4,7 @@ import { Oid } from './oid'; import { SubmoduleUpdateOptions } from './submodule-update-options'; export namespace Submodule { - enum IGNORE { + const enum IGNORE { UNSPECIFIED = -1, NONE = 1, UNTRACKED = 2, @@ -12,13 +12,13 @@ export namespace Submodule { ALL = 4 } - enum RECURSE { + const enum RECURSE { NO = 0, YES = 1, ONDEMAND = 2 } - enum STATUS { + const enum STATUS { IN_HEAD = 1, IN_INDEX = 2, IN_CONFIG = 4, @@ -35,7 +35,7 @@ export namespace Submodule { WD_UNTRACKED = 8192 } - enum UPDATE { + const enum UPDATE { CHECKOUT = 1, REBASE = 2, MERGE = 3, diff --git a/types/nodegit/transport.d.ts b/types/nodegit/transport.d.ts index 9d1a82b061..189985c469 100644 --- a/types/nodegit/transport.d.ts +++ b/types/nodegit/transport.d.ts @@ -2,7 +2,7 @@ import { Remote } from './remote'; import { Strarray } from './str-array'; export namespace Transport { - enum FLAGS { + const enum FLAGS { NONE = 0 } } diff --git a/types/nodegit/tree-entry.d.ts b/types/nodegit/tree-entry.d.ts index 8d1b5d553e..844f5da90c 100644 --- a/types/nodegit/tree-entry.d.ts +++ b/types/nodegit/tree-entry.d.ts @@ -3,7 +3,7 @@ import { Oid } from './oid'; import { Blob } from './blob'; export namespace TreeEntry { - enum FILEMODE { + const enum FILEMODE { UNREADABLE = 0, TREE = 16384, BLOB = 33188, diff --git a/types/nodegit/tree.d.ts b/types/nodegit/tree.d.ts index b9ac62f9e2..c20037cb0a 100644 --- a/types/nodegit/tree.d.ts +++ b/types/nodegit/tree.d.ts @@ -6,7 +6,7 @@ import { Treebuilder } from './tree-builder'; import { DiffFile } from './diff-file'; export namespace Tree { - enum WALK_MODE { + const enum WALK_MODE { WALK_PRE = 0, WALK_POST = 1 } From 7097c37505310eb083657671f0e36e681b5ce50c Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:31:06 +0100 Subject: [PATCH 106/286] Fixed tests --- types/nodegit/clone-options.d.ts | 4 ++-- types/nodegit/diff-options.d.ts | 2 +- types/nodegit/nodegit-tests.ts | 2 +- types/nodegit/note.d.ts | 2 +- types/nodegit/stash.d.ts | 4 ++-- types/nodegit/status.d.ts | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/types/nodegit/clone-options.d.ts b/types/nodegit/clone-options.d.ts index b8acc9aad0..8535b28c81 100644 --- a/types/nodegit/clone-options.d.ts +++ b/types/nodegit/clone-options.d.ts @@ -8,6 +8,6 @@ export class CloneOptions { bare?: number; local?: number; checkoutBranch?: string; - repositoryCbPayload?: void; - remoteCbPayload?: void; + repositoryCbPayload?: any; + remoteCbPayload?: any; } diff --git a/types/nodegit/diff-options.d.ts b/types/nodegit/diff-options.d.ts index e78de28aac..32dec9943f 100644 --- a/types/nodegit/diff-options.d.ts +++ b/types/nodegit/diff-options.d.ts @@ -6,7 +6,7 @@ export interface DiffOptions { ignoreSubmodules: number; pathspec: Strarray; notifyCb: Function; - notifyPayload: void; + notifyPayload: any; contextLines: number; interhunkLines: number; idAbbrev: number; diff --git a/types/nodegit/nodegit-tests.ts b/types/nodegit/nodegit-tests.ts index c8d296ea09..c10dfef127 100644 --- a/types/nodegit/nodegit-tests.ts +++ b/types/nodegit/nodegit-tests.ts @@ -48,6 +48,6 @@ result = Git.Attr.value("attr"); const blameOptions = new Git.BlameOptions(); -Git.Branch.lookup(repo, "branch_name", Git.Branch.BRANCH.LOCAL).then(function (reference) { +Git.Branch.lookup(repo, "branch_name", Git.Branch.BRANCH.LOCAL).then((reference) => { // Use reference }); diff --git a/types/nodegit/note.d.ts b/types/nodegit/note.d.ts index 2ea74b9df8..c5c9152bb2 100644 --- a/types/nodegit/note.d.ts +++ b/types/nodegit/note.d.ts @@ -4,7 +4,7 @@ import {Oid} from './oid'; export class Note { static create(repo: Repository, notes_ref: string, author: Signature, committer: Signature, oid: Oid, note: string, force: number): Promise; - static foreach(repo: Repository, notes_ref: string, note_cb: Function, payload: void): Promise; + static foreach(repo: Repository, notes_ref: string, note_cb: Function, payload: any): Promise; static iteratorNew(repo: Repository, notes_ref: string): Promise; static next(note_id: Oid, annotated_id: Oid, it: any): number; static read(repo: Repository, notes_ref: string, oid: Oid): Promise; diff --git a/types/nodegit/stash.d.ts b/types/nodegit/stash.d.ts index 39a6893140..c81e94b7b6 100644 --- a/types/nodegit/stash.d.ts +++ b/types/nodegit/stash.d.ts @@ -33,14 +33,14 @@ export interface StashApplyOptions { flags: number; checkoutOptions: CheckoutOptions; progressCb: Function; - progressPayload: void; + progressPayload: any; } export class Stash { static apply(repo: Repository, index: number, options: StashApplyOptions): Promise; static applyInitOptions(opts: StashApplyOptions, version: number): number; static drop(repo: Repository, index: number): Promise; - static foreach(repo: Repository, callback: Function, payload: void): Promise; + static foreach(repo: Repository, callback: Function, payload: any): Promise; static pop(repo: Repository, index: number, options: StashApplyOptions): Promise; static save(repo: Repository, stasher: Signature, message: string, flags: number): Promise; } diff --git a/types/nodegit/status.d.ts b/types/nodegit/status.d.ts index 49ad0fd142..1059dd6bff 100644 --- a/types/nodegit/status.d.ts +++ b/types/nodegit/status.d.ts @@ -50,7 +50,7 @@ export namespace Status { export class Status { static byIndex(statuslist: StatusList, idx: number): StatusEntry; static file(repo: Repository, path: string): number; - static foreach(repo: Repository, callback: Function, payload: void): Promise; - static foreachExt(repo: Repository, opts: StatusOptions, callback: Function, payload: void): Promise; + static foreach(repo: Repository, callback: Function, payload: any): Promise; + static foreachExt(repo: Repository, opts: StatusOptions, callback: Function, payload: any): Promise; static shouldIgnore(ignored: number, repo: Repository, path: string): number; } From 39a54fd1d7f660cac8fe2d027ab617ed1eaa5a33 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:32:35 +0100 Subject: [PATCH 107/286] Added documentation for Buf --- types/nodegit/buf.d.ts | 55 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/types/nodegit/buf.d.ts b/types/nodegit/buf.d.ts index 53886615ed..d9670bb293 100644 --- a/types/nodegit/buf.d.ts +++ b/types/nodegit/buf.d.ts @@ -1,12 +1,67 @@ /// export class Buf { + /** + * + * + * @returns {number} + * + * @memberof Buf + */ containsNul(): number; + /** + * + * + * + * @memberof Buf + */ free(): void; + /** + * + * + * @param {number} target_size + * @returns {Promise} + * + * @memberof Buf + */ grow(target_size: number): Promise; + /** + * + * + * @returns {number} + * + * @memberof Buf + */ isBinary(): number; + /** + * + * + * @param {Buffer} data + * @param {number} datalen + * @returns {Promise} + * + * @memberof Buf + */ set(data: Buffer, datalen: number): Promise; + /** + * + * + * @type {string} + * @memberof Buf + */ ptr: string; + /** + * + * + * @type {number} + * @memberof Buf + */ asize: number; + /** + * + * + * @type {number} + * @memberof Buf + */ size: number; } From 65727b3bdb9a597acd3b524502a4363c53bac711 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:34:49 +0100 Subject: [PATCH 108/286] Added documentation for CertHostkey --- types/nodegit/cert-host-key.d.ts | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/types/nodegit/cert-host-key.d.ts b/types/nodegit/cert-host-key.d.ts index 428d04b727..c4947d347c 100644 --- a/types/nodegit/cert-host-key.d.ts +++ b/types/nodegit/cert-host-key.d.ts @@ -1,6 +1,32 @@ +import { Cert } from './cert'; + export class CertHostkey { - certType: number; + /** + * + * + * @type {Cert} + * @memberof CertHostkey + */ + parent: Cert; + /** + * + * + * @type {number} + * @memberof CertHostkey + */ type: number; + /** + * + * + * @type {string} + * @memberof CertHostkey + */ hashMd5: string; + /** + * + * + * @type {string} + * @memberof CertHostkey + */ hashSha1: string; } From 5217c986509016f65bcc5f63d2be8c385bd2b9c7 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:35:38 +0100 Subject: [PATCH 109/286] Added documentation for CertX509 --- types/nodegit/cert-x509.d.ts | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/types/nodegit/cert-x509.d.ts b/types/nodegit/cert-x509.d.ts index 14f38ac5fc..dd395a755d 100644 --- a/types/nodegit/cert-x509.d.ts +++ b/types/nodegit/cert-x509.d.ts @@ -1,5 +1,25 @@ +import { Cert } from './cert'; + export class CertX509 { - certType: number; + /** + * + * + * @type {Buffer} + * @memberof CertX509 + */ data: Buffer; + /** + * + * + * @type {number} + * @memberof CertX509 + */ len: number; + /** + * + * + * @type {Cert} + * @memberof CertX509 + */ + parent: Cert; } From d2a75d9ecc969f045494881b55563d11625707b4 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:37:10 +0100 Subject: [PATCH 110/286] Added documentation --- types/nodegit/cert-host-key.d.ts | 8 +------- types/nodegit/cert.d.ts | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/types/nodegit/cert-host-key.d.ts b/types/nodegit/cert-host-key.d.ts index c4947d347c..f69210ca37 100644 --- a/types/nodegit/cert-host-key.d.ts +++ b/types/nodegit/cert-host-key.d.ts @@ -8,13 +8,7 @@ export class CertHostkey { * @memberof CertHostkey */ parent: Cert; - /** - * - * - * @type {number} - * @memberof CertHostkey - */ - type: number; + type: Cert.TYPE; /** * * diff --git a/types/nodegit/cert.d.ts b/types/nodegit/cert.d.ts index fd749beba9..fde86569b9 100644 --- a/types/nodegit/cert.d.ts +++ b/types/nodegit/cert.d.ts @@ -13,5 +13,5 @@ export namespace Cert { } export class Cert { - certType: number; + certType: Cert.TYPE; } From a483653f42fa1be3a0194871803748b8c69ccea7 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:38:37 +0100 Subject: [PATCH 111/286] Added documentation --- types/nodegit/checkout-options.d.ts | 120 ++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/types/nodegit/checkout-options.d.ts b/types/nodegit/checkout-options.d.ts index 4122dfbe28..253755d7fb 100644 --- a/types/nodegit/checkout-options.d.ts +++ b/types/nodegit/checkout-options.d.ts @@ -3,24 +3,144 @@ import { Tree } from './tree'; import { Index } from './index'; export class CheckoutOptions { + /** + * + * + * @type {number} + * @memberof CheckoutOptions + */ version?: number; + /** + * + * + * @type {number} + * @memberof CheckoutOptions + */ checkoutStrategy?: number; + /** + * + * + * @type {number} + * @memberof CheckoutOptions + */ disableFilters?: number; + /** + * + * + * @type {number} + * @memberof CheckoutOptions + */ dirMode?: number; + /** + * + * + * @type {number} + * @memberof CheckoutOptions + */ fileMode?: number; + /** + * + * + * @type {number} + * @memberof CheckoutOptions + */ fileOpenFlags?: number; + /** + * + * + * @type {number} + * @memberof CheckoutOptions + */ notifyFlags?: number; + /** + * + * + * @type {*} + * @memberof CheckoutOptions + */ notifyCb?: any; + /** + * + * + * @type {undefined} + * @memberof CheckoutOptions + */ notifyPayload?: undefined; + /** + * + * + * @type {*} + * @memberof CheckoutOptions + */ progressCb?: any; + /** + * + * + * @type {undefined} + * @memberof CheckoutOptions + */ progressPayload?: undefined; + /** + * + * + * @type {Strarray} + * @memberof CheckoutOptions + */ paths?: Strarray; + /** + * + * + * @type {Tree} + * @memberof CheckoutOptions + */ baseline?: Tree; + /** + * + * + * @type {Index} + * @memberof CheckoutOptions + */ baselineIndex?: Index; + /** + * + * + * @type {string} + * @memberof CheckoutOptions + */ targetDirectory?: string; + /** + * + * + * @type {string} + * @memberof CheckoutOptions + */ ancestorLabel?: string; + /** + * + * + * @type {string} + * @memberof CheckoutOptions + */ ourLabel?: string; + /** + * + * + * @type {string} + * @memberof CheckoutOptions + */ theirLabel?: string; + /** + * + * + * @type {*} + * @memberof CheckoutOptions + */ perfdataCb?: any; + /** + * + * + * @type {undefined} + * @memberof CheckoutOptions + */ perfdataPayload?: undefined; } From 79e1866c4d273eb7e2613665e834370b007656e9 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:40:20 +0100 Subject: [PATCH 112/286] Added documentation for Checkout --- types/nodegit/checkout.d.ts | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/types/nodegit/checkout.d.ts b/types/nodegit/checkout.d.ts index af5f66faf3..a6ce5ff991 100644 --- a/types/nodegit/checkout.d.ts +++ b/types/nodegit/checkout.d.ts @@ -44,8 +44,50 @@ export namespace Checkout { } export class Checkout { + /** + * Patch head checkout to automatically coerce objects. + * + * @static + * @param {Repository} repo + * @param {CheckoutOptions} [options] + * @returns {Promise} + * + * @memberof Checkout + */ static head(repo: Repository, options?: CheckoutOptions): Promise; + /** + * Patch index checkout to automatically coerce objects. + * + * @static + * @param {Repository} repo + * @param {Index} The + * @param {CheckoutOptions} [options] + * @returns {Promise} + * + * @memberof Checkout + */ static index(repo: Repository, The: Index, options?: CheckoutOptions): Promise; + /** + * + * + * @static + * @param {CheckoutOptions} opts + * @param {number} version + * @returns {number} + * + * @memberof Checkout + */ static initOptions(opts: CheckoutOptions, version: number): number; + /** + * Patch tree checkout to automatically coerce objects. + * + * @static + * @param {Repository} repo + * @param {(Oid | Tree | Commit | Reference)} treeish + * @param {CheckoutOptions} [options] + * @returns {Promise} + * + * @memberof Checkout + */ static tree(repo: Repository, treeish: Oid | Tree | Commit | Reference, options?: CheckoutOptions): Promise; } From 9dd615be310d3037e3b81bf8757147909fd0e143 Mon Sep 17 00:00:00 2001 From: Dolan Date: Thu, 8 Jun 2017 02:41:41 +0100 Subject: [PATCH 113/286] Documented Cherrypick --- types/nodegit/cherry-pick-options.d.ts | 24 ++++++++++++++++++ types/nodegit/cherry-pick.d.ts | 34 ++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/types/nodegit/cherry-pick-options.d.ts b/types/nodegit/cherry-pick-options.d.ts index 7c6ec6976c..8743217b47 100644 --- a/types/nodegit/cherry-pick-options.d.ts +++ b/types/nodegit/cherry-pick-options.d.ts @@ -2,8 +2,32 @@ import { MergeOptions } from './merge-options'; import { CheckoutOptions } from './checkout-options'; export interface CherrypickOptions { + /** + * + * + * @type {number} + * @memberof CherrypickOptions + */ version: number; + /** + * + * + * @type {number} + * @memberof CherrypickOptions + */ mainline: number; + /** + * + * + * @type {MergeOptions} + * @memberof CherrypickOptions + */ mergeOpts: MergeOptions; + /** + * + * + * @type {CheckoutOptions} + * @memberof CherrypickOptions + */ checkoutOpts: CheckoutOptions; } diff --git a/types/nodegit/cherry-pick.d.ts b/types/nodegit/cherry-pick.d.ts index 291c5e0223..b895845301 100644 --- a/types/nodegit/cherry-pick.d.ts +++ b/types/nodegit/cherry-pick.d.ts @@ -4,7 +4,41 @@ import { MergeOptions } from './merge-options'; import { CherrypickOptions } from './cherry-pick-options'; export class Cherrypick { + /** + * Cherrypick a commit and, changing the index and working directory + * + * @static + * @param {Repository} repo + * @param {Commit} commit + * @param {CherrypickOptions} [options] + * @returns {Promise} + * + * @memberof Cherrypick + */ static cherrypick(repo: Repository, commit: Commit, options?: CherrypickOptions): Promise; + /** + * Cherrypicks the given commit against "our" commit, producing an index that reflects the result of the cherrypick. The index is not backed by a repo. + * + * @static + * @param {Repository} repo + * @param {Commit} cherrypickCommit + * @param {Commit} ourCommit + * @param {number} mainline + * @param {MergeOptions} [mergeOptions] + * @returns {Promise} + * + * @memberof Cherrypick + */ static commit(repo: Repository, cherrypickCommit: Commit, ourCommit: Commit, mainline: number, mergeOptions?: MergeOptions): Promise; + /** + * + * + * @static + * @param {CherrypickOptions} opts + * @param {number} version + * @returns {number} + * + * @memberof Cherrypick + */ static initOptions(opts: CherrypickOptions, version: number): number; } From da04d8b684e79bcbcc31966fc2c4efdb0f2b64a1 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 10:39:49 -0400 Subject: [PATCH 114/286] Add PouchDB heterogeneous generic test --- types/pouchdb-core/pouchdb-core-tests.ts | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/types/pouchdb-core/pouchdb-core-tests.ts b/types/pouchdb-core/pouchdb-core-tests.ts index ba06de7608..1e5d7ee75a 100644 --- a/types/pouchdb-core/pouchdb-core-tests.ts +++ b/types/pouchdb-core/pouchdb-core-tests.ts @@ -210,3 +210,26 @@ function testRemoteOptions() { skip_setup: true }); } + +interface Cat { + meow: string; +} + +interface Boot { + thud: boolean; +} + +async function heterogeneousGenericsDatabase(db: PouchDB.Database) { + const cats = await db.allDocs({ startkey: 'cat/', endkey: 'cat/\uffff', include_docs: true }); + for (let row of cats.rows) { + if (row.doc) { + row.doc.meow; // $ExpectType string + } + } + const boots = await db.allDocs({ startkey: 'boot/', endkey: 'boot/\uffff', include_docs: true }); + for (let row of boots.rows) { + if (row.doc) { + row.doc.thud; // $ExpectType boolean + } + } +} From 8225b6592b99db3597b1fbc5d32e7ba033fcc707 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 10:40:15 -0400 Subject: [PATCH 115/286] Add DT tslint to PouchDB core --- types/pouchdb-core/tslint.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 types/pouchdb-core/tslint.json diff --git a/types/pouchdb-core/tslint.json b/types/pouchdb-core/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-core/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b19ff51bd2910505ab06c778719015a8543f1ec1 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 10:43:02 -0400 Subject: [PATCH 116/286] Fix lint in PouchDB core tests --- types/pouchdb-core/pouchdb-core-tests.ts | 26 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/types/pouchdb-core/pouchdb-core-tests.ts b/types/pouchdb-core/pouchdb-core-tests.ts index 1e5d7ee75a..a42947dd7d 100644 --- a/types/pouchdb-core/pouchdb-core-tests.ts +++ b/types/pouchdb-core/pouchdb-core-tests.ts @@ -17,7 +17,7 @@ function testAllDocs() { // check document property isNumber(doc!.foo); - }) + }); }); db.allDocs({ startkey: "a", endkey: "b" }); @@ -37,7 +37,9 @@ function testAllDocs() { function testBulkDocs() { const db = new PouchDB(); - type MyModel = { property: string }; + interface MyModel { + property: string; + } let model = { property: 'test' }; let model2 = { property: 'test' }; @@ -59,8 +61,8 @@ function testBulkGet() { } function testRevsDiff() { const db = new PouchDB<{}>(); - db.revsDiff({'a': ['1-a', '2-b']}).then((result) => {}); - db.revsDiff({'a': ['1-a', '2-b']}, (error, response) => {}); + db.revsDiff({a: ['1-a', '2-b']}).then((result) => {}); + db.revsDiff({a: ['1-a', '2-b']}, (error, response) => {}); } function testCompact() { @@ -84,7 +86,9 @@ function testDestroy() { } function testBasics() { - type MyModel = { property: string }; + interface MyModel { + property: string; + } let model = { property: 'test' }; const id = 'model'; @@ -114,7 +118,9 @@ function testBasics() { } function testRemove() { - type MyModel = { property: string }; + interface MyModel { + property: string; + } const id = 'model'; const rev = 'rev'; let model = { _id: id, _rev: rev, existingDocProperty: 'any' }; @@ -141,7 +147,9 @@ function testRemove() { } function testChanges() { - type MyModel = { foo: string }; + interface MyModel { + foo: string; + } const db = new PouchDB(); db.changes({ @@ -164,7 +172,7 @@ function testChanges() { let _id: string = change.id; let _seq: number = change.seq as number; let _seq_couch20: string = change.seq as string; - let _changes: { rev: string }[] = change.changes; + let _changes: Array<{ rev: string }> = change.changes; let _foo: string = change.doc!.foo; let _deleted: boolean | undefined = change.doc!._deleted; let _attachments: PouchDB.Core.Attachments | undefined = change.doc!._attachments; @@ -178,7 +186,7 @@ function testChanges() { let _id: string = change.id; let _seq: number = change.seq as number; let _seq_couch20: string = change.seq as string; - let _changes: { rev: string }[] = change.changes; + let _changes: Array<{ rev: string }> = change.changes; let _deleted: boolean | undefined = change.doc!._deleted; let _attachments: PouchDB.Core.Attachments | undefined = change.doc!._attachments; }); From 121e63d7077eaf9b0c46f0712678db5ad2f5ba16 Mon Sep 17 00:00:00 2001 From: Pascal Brokmeier Date: Thu, 8 Jun 2017 17:47:51 +0200 Subject: [PATCH 117/286] fix(alexa-sdk): added this.i interface for i18n > Once you are done defining and enabling language strings, you can access these > strings using the this.t() function. Strings will be rendered in the language > that matches the locale of the incoming request. Extract from [alexa skills kit sdk readme](https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs) --- types/alexa-sdk/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index c19892425d..7f3f022137 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -39,6 +39,7 @@ interface Handler { context: any; name: any; isOverriden: any; + t: (token: String) => void; } interface Context { From deba2cf9285e0a8b332000eacda53955e96b427c Mon Sep 17 00:00:00 2001 From: Pascal Brokmeier Date: Thu, 8 Jun 2017 17:58:59 +0200 Subject: [PATCH 118/286] fix String -> string obviously --- types/alexa-sdk/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index 7f3f022137..a621634417 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -39,7 +39,7 @@ interface Handler { context: any; name: any; isOverriden: any; - t: (token: String) => void; + t: (token: string) => void; } interface Context { From dc79bd7509ec57e675e3f6c9e84826b1dd80ed2f Mon Sep 17 00:00:00 2001 From: Pascal Brokmeier Date: Thu, 8 Jun 2017 18:27:30 +0200 Subject: [PATCH 119/286] chore: activated tslint and cleaned results up --- types/alexa-sdk/alexa-sdk-tests.ts | 8 ++--- types/alexa-sdk/index.d.ts | 54 ++++++++++++++++-------------- types/alexa-sdk/tslint.json | 1 + 3 files changed, 33 insertions(+), 30 deletions(-) create mode 100644 types/alexa-sdk/tslint.json diff --git a/types/alexa-sdk/alexa-sdk-tests.ts b/types/alexa-sdk/alexa-sdk-tests.ts index 8d309e9e81..c40efa7851 100644 --- a/types/alexa-sdk/alexa-sdk-tests.ts +++ b/types/alexa-sdk/alexa-sdk-tests.ts @@ -2,20 +2,20 @@ import * as Alexa from "alexa-sdk"; -exports.handler = function(event: Alexa.RequestBody, context: Alexa.Context, callback: Function) { +exports.handler = (event: Alexa.RequestBody, context: Alexa.Context, callback: () => void) => { let alexa = Alexa.handler(event, context); alexa.registerHandlers(handlers); alexa.execute(); }; let handlers: Alexa.Handlers = { - 'LaunchRequest': function () { + 'LaunchRequest': function() { this.emit('SayHello'); }, - 'HelloWorldIntent': function () { + 'HelloWorldIntent': function() { this.emit('SayHello'); }, - 'SayHello': function () { + 'SayHello': function() { this.emit(':tell', 'Hello World!'); } }; diff --git a/types/alexa-sdk/index.d.ts b/types/alexa-sdk/index.d.ts index a621634417..256d3fee9a 100644 --- a/types/alexa-sdk/index.d.ts +++ b/types/alexa-sdk/index.d.ts @@ -1,17 +1,19 @@ -// Type definitions for Alexa SDK for Node.js v1.1.0 +// Type definitions for Alexa SDK for Node.js 1.0 // Project: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs -// Definitions by: Pete Beegle , Huw +// Definitions by: Pete Beegle +// Huw +// pascalwhoop // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -export function handler(event: RequestBody, context: Context, callback?: Function): AlexaObject; +export function handler(event: RequestBody, context: Context, callback?: (err: any, response: any) => void ): AlexaObject; export function CreateStateHandler(state: string, obj: any): any; -export var StateString: string; +export let StateString: string; -type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; -type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; +export type ConfirmationStatuses = "NONE" | "DENIED" | "CONFIRMED"; +export type DialogStates = "STARTED" | "IN_PROGRESS" | "COMPLETED"; -interface AlexaObject extends Handler { +export interface AlexaObject extends Handler { _event: any; _context: any; _callback: any; @@ -24,11 +26,11 @@ interface AlexaObject extends Handler { execute: () => void; } -interface Handlers { +export interface Handlers { [intent: string]: (this: Handler) => void; } -interface Handler { +export interface Handler { on: any; emit(event: string, ...args: any[]): boolean; emitWithState: any; @@ -42,7 +44,7 @@ interface Handler { t: (token: string) => void; } -interface Context { +export interface Context { callbackWaitsForEmptyEventLoop: boolean; logGroupName: string; logStreamName: string; @@ -53,13 +55,13 @@ interface Context { awsRequestId: string; } -interface RequestBody { +export interface RequestBody { version: string; session: Session; request: LaunchRequest | IntentRequest | SessionEndedRequest; } -interface Session { +export interface Session { new: boolean; sessionId: string; attributes: any; @@ -67,64 +69,64 @@ interface Session { user: SessionUser; } -interface SessionApplication { +export interface SessionApplication { applicationId: string; } -interface SessionUser { +export interface SessionUser { userId: string; accessToken: string; } -interface LaunchRequest extends IRequest { } +export interface LaunchRequest extends Request { } -interface IntentRequest extends IRequest { +export interface IntentRequest extends Request { dialogState: DialogStates; intent: Intent; } -interface SlotValue { +export interface SlotValue { confirmationStatus: ConfirmationStatuses; name: string; value?: any; } -interface Intent { +export interface Intent { confirmationStatus: ConfirmationStatuses; name: string; slots: Record; } -interface SessionEndedRequest extends IRequest { +export interface SessionEndedRequest extends Request { reason: string; } -interface IRequest { +export interface Request { type: "LaunchRequest" | "IntentRequest" | "SessionEndedRequest"; requestId: string; timeStamp: string; } -interface ResponseBody { +export interface ResponseBody { version: string; sessionAttributes?: any; response: Response; } -interface Response { +export interface Response { outputSpeech?: OutputSpeech; card?: Card; reprompt?: Reprompt; shouldEndSession: boolean; } -interface OutputSpeech { +export interface OutputSpeech { type: "PlainText" | "SSML"; text?: string; ssml?: string; } -interface Card { +export interface Card { type: "Simple" | "Standard" | "LinkAccount"; title?: string; content?: string; @@ -132,11 +134,11 @@ interface Card { image?: Image; } -interface Image { +export interface Image { smallImageUrl: string; largeImageUrl: string; } -interface Reprompt { +export interface Reprompt { outputSpeech: OutputSpeech; } diff --git a/types/alexa-sdk/tslint.json b/types/alexa-sdk/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/alexa-sdk/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 9cb1431127dad715d9e0a8330b936ace465db3ae Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 11:05:35 -0400 Subject: [PATCH 120/286] Add heterogeneous generics to PouchDB Core - Add a default to Database's generic parameter allowing easier "bare" usage (requires Typescript 2.3) - Add a new `` generic to allow narrowing all calls to specific models at call point. (Generic default not needed here because Typescript already defaults to `{}` or `any` depending on noImplicitAny for all of these sorts of calls.) - Expand bulkGet to include return type Resolves #17039 --- types/pouchdb-core/index.d.ts | 104 ++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 48 deletions(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index 556fa71b5b..07c93cabe6 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -2,6 +2,7 @@ // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Jakub Navratil , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Typescript Version: 2.3 /// /// @@ -19,7 +20,7 @@ declare namespace PouchDB { type AttachmentId = string; type RevisionId = string; type Availability = 'available' | 'compacted' | 'not compacted' | 'missing'; - type Encodable = { [propertyName: string]: any }; + type Encodable = {}; type Attachment = string | Blob | Buffer; interface Options { @@ -48,7 +49,7 @@ declare namespace PouchDB { update_seq: number | string; } - interface Revision { + interface Revision { ok: Document & RevisionIdMeta; } interface RevisionInfo { @@ -217,12 +218,18 @@ declare namespace PouchDB { } interface BulkGetOptions extends Options { - docs: any, + docs: Array<{ id: string; rev: RevisionId }>, revs?: boolean, attachments?: boolean, binary?: boolean } + interface BulkGetResponse { + results: { + docs: Array<{ ok: Content & GetMeta } | { error: Error }>; + } + } + interface ChangesMeta { _conflicts?: RevisionId[]; _deleted?: boolean; @@ -458,7 +465,7 @@ declare namespace PouchDB { debug: debug.IDebug; - new(name?: string, + new(name?: string, options?: Configuration.DatabaseConfiguration): Database; /** @@ -466,28 +473,28 @@ declare namespace PouchDB { * except that whenever you invoke it (e.g. with new), the given options will be passed in by default. */ defaults(options: Configuration.DatabaseConfiguration): { - new(name?: string, + new(name?: string, options?: Configuration.DatabaseConfiguration): Database; } } - interface Database { + interface Database { /** Fetch all documents matching the given key. */ - allDocs(options: Core.AllDocsWithKeyOptions): - Promise>; + allDocs(options: Core.AllDocsWithKeyOptions): + Promise>; /** Fetch all documents matching any of the given keys. */ - allDocs(options: Core.AllDocsWithKeysOptions): - Promise>; + allDocs(options: Core.AllDocsWithKeysOptions): + Promise>; /** Fetch all documents matching the given key range. */ - allDocs(options: Core.AllDocsWithinRangeOptions): - Promise>; + allDocs(options: Core.AllDocsWithinRangeOptions): + Promise>; /** Fetch all documents. */ - allDocs(options?: Core.AllDocsOptions): - Promise>; + allDocs(options?: Core.AllDocsOptions): + Promise>; /** * Create, update or delete multiple documents. The docs argument is an array of documents. @@ -496,9 +503,9 @@ declare namespace PouchDB { * which should match the ID and revision of the document on which to base your updates. * Finally, to delete a document, include a _deleted parameter with the value true. */ - bulkDocs(docs: Core.PutDocument[], - options: Core.BulkDocsOptions | null, - callback: Core.Callback): void; + bulkDocs(docs: Core.PutDocument[], + options: Core.BulkDocsOptions | null, + callback: Core.Callback): void; /** * Create, update or delete multiple documents. The docs argument is an array of documents. @@ -507,8 +514,8 @@ declare namespace PouchDB { * which should match the ID and revision of the document on which to base your updates. * Finally, to delete a document, include a _deleted parameter with the value true. */ - bulkDocs(docs: Core.PutDocument[], - options?: Core.BulkDocsOptions): Promise; + bulkDocs(docs: Core.PutDocument[], + options?: Core.BulkDocsOptions): Promise; /** Compact the database */ compact(options?: Core.CompactOptions): Promise; @@ -525,27 +532,27 @@ declare namespace PouchDB { destroy(options?: Core.DestroyOptions | void): Promise; /** Fetch a document */ - get(docId: Core.DocumentId, - options: Core.GetOptions | null, - callback: Core.Callback & Core.GetMeta> - ): void; + get(docId: Core.DocumentId, + options: Core.GetOptions | null, + callback: Core.Callback & Core.GetMeta> + ): void; /** Fetch a document */ - get(docId: Core.DocumentId, - options: Core.GetOptions - ): Promise & Core.GetMeta>; + get(docId: Core.DocumentId, + options: Core.GetOptions + ): Promise & Core.GetMeta>; /** Fetch a document */ - get(docId: Core.DocumentId): Promise & Core.GetMeta>; + get(docId: Core.DocumentId): Promise & Core.GetMeta>; /** Fetch document open revs */ - get(docId: Core.DocumentId, - options: Core.GetOpenRevisions, - callback: Core.Callback[]>): void; + get(docId: Core.DocumentId, + options: Core.GetOpenRevisions, + callback: Core.Callback[]>): void; /** Fetch document open revs */ - get(docId: Core.DocumentId, - options: Core.GetOpenRevisions): Promise[]>; + get(docId: Core.DocumentId, + options: Core.GetOpenRevisions): Promise[]>; /** Create a new document without providing an id. * @@ -555,9 +562,9 @@ declare namespace PouchDB { * * @see {@link https://pouchdb.com/2014/06/17/12-pro-tips-for-better-code-with-pouchdb.html|PouchDB Pro Tips} */ - post(doc: Core.PostDocument, - options: Core.PostOptions | null, - callback: Core.Callback): void; + post(doc: Core.PostDocument, + options: Core.PostOptions | null, + callback: Core.Callback): void; /** Create a new document without providing an id. * @@ -567,8 +574,8 @@ declare namespace PouchDB { * * @see {@link https://pouchdb.com/2014/06/17/12-pro-tips-for-better-code-with-pouchdb.html|PouchDB Pro Tips} */ - post(doc: Core.PostDocument, - options?: Core.PostOptions): Promise; + post(doc: Core.PostDocument, + options?: Core.PostOptions): Promise; /** Create a new document or update an existing document. * @@ -578,9 +585,9 @@ declare namespace PouchDB { * If you try to store non-JSON data (for instance Date objects) you may * see inconsistent results. */ - put(doc: Core.PutDocument, - options: Core.PutOptions | null, - callback: Core.Callback): void; + put(doc: Core.PutDocument, + options: Core.PutOptions | null, + callback: Core.Callback): void; /** Create a new document or update an existing document. * @@ -590,8 +597,8 @@ declare namespace PouchDB { * If you try to store non-JSON data (for instance Date objects) you may * see inconsistent results. */ - put(doc: Core.PutDocument, - options?: Core.PutOptions): Promise; + put(doc: Core.PutDocument, + options?: Core.PutOptions): Promise; /** Remove a doc from the database */ remove(doc: Core.RemoveDocument, @@ -627,8 +634,8 @@ declare namespace PouchDB { * a 'complete' event when all the changes have been processed, and an 'error' event when an error occurs. * Calling cancel() will unsubscribe all event listeners automatically. */ - changes(options: Core.ChangesOptions | null, - callback: Core.Callback>): void; + changes(options: Core.ChangesOptions | null, + callback: Core.Callback>): void; /** * A list of changes made to documents in the database, in the order they were made. @@ -638,7 +645,7 @@ declare namespace PouchDB { * a 'complete' event when all the changes have been processed, and an 'error' event when an error occurs. * Calling cancel() will unsubscribe all event listeners automatically. */ - changes(options?: Core.ChangesOptions): Core.Changes; + changes(options?: Core.ChangesOptions): Core.Changes; /** Close the database */ close(callback: Core.AnyCallback): void; @@ -722,11 +729,11 @@ declare namespace PouchDB { rev: Core.RevisionId): Promise; /** Given a set of document/revision IDs, returns the document bodies (and, optionally, attachment data) for each ID/revision pair specified. */ - bulkGet(options: Core.BulkGetOptions, - callback: Core.Callback): void; + bulkGet(options: Core.BulkGetOptions, + callback: Core.Callback>): void; /** Given a set of document/revision IDs, returns the document bodies (and, optionally, attachment data) for each ID/revision pair specified. */ - bulkGet(options: Core.BulkGetOptions): Promise; + bulkGet(options: Core.BulkGetOptions): Promise>; /** Given a set of document/revision IDs, returns the subset of those that do not correspond to revisions stored in the database */ revsDiff(diff : Core.RevisionDiffOptions, @@ -737,6 +744,7 @@ declare namespace PouchDB { } } +// declare module 'pouchdb-core' { const PouchDb: PouchDB.Static; export = PouchDb; From ef9cfd95370465097132d0a4aea11164f95c0274 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 13:24:28 -0400 Subject: [PATCH 121/286] Fix lint issues in pouchdb-core --- types/pouchdb-core/index.d.ts | 311 +++++++++++------------ types/pouchdb-core/pouchdb-core-tests.ts | 44 ++-- 2 files changed, 167 insertions(+), 188 deletions(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index 07c93cabe6..71fdb011b6 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -1,26 +1,35 @@ -// Type definitions for pouchdb-core v6.1.2 +// Type definitions for pouchdb-core 6.1 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Jakub Navratil , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Typescript Version: 2.3 +// TypeScript Version: 2.3 /// /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare namespace PouchDB { namespace Core { interface Error { + /** + * HTTP Status Code during HTTP or HTTP-like operations + */ + status?: number; + name?: string; + message?: string; + reason?: string; + error?: string | boolean; + id?: string; + rev?: RevisionId; } - interface Callback { - (error: E | void, result: R | void): void; - } - type AnyCallback = Callback; + type Callback = (error: Error | null, result: R | null) => void; type DocumentId = string; type DocumentKey = string; type AttachmentId = string; type RevisionId = string; type Availability = 'available' | 'compacted' | 'not compacted' | 'missing'; - type Encodable = {}; type Attachment = string | Blob | Buffer; interface Options { @@ -49,7 +58,7 @@ declare namespace PouchDB { update_seq: number | string; } - interface Revision { + interface Revision { ok: Document & RevisionIdMeta; } interface RevisionInfo { @@ -57,14 +66,14 @@ declare namespace PouchDB { status: Availability; } interface RevisionDiffOptions { - [DocumentId : string]: string[]; + [DocumentId: string]: string[]; } interface RevisionDiff { missing?: string[]; possible_ancestors?: string[]; } interface RevisionDiffResponse { - [DocumentId : string]: RevisionDiff + [DocumentId: string]: RevisionDiff; } interface IdMeta { @@ -86,7 +95,7 @@ declare namespace PouchDB { _revisions?: { ids: RevisionId[]; start: number; - } + }; /** Attachments where index is attachmentId */ _attachments?: Attachments; @@ -116,15 +125,15 @@ declare namespace PouchDB { [attachmentId: string]: AttachmentResponse; } - type NewDocument = Content; - type Document = Content & IdMeta; - type ExistingDocument = + type NewDocument = Content; + type Document = Content & IdMeta; + type ExistingDocument = Document & RevisionIdMeta; /** Existing doc or just object with `_id` and `_rev` */ - type RemoveDocument = Encodable & IdMeta & RevisionIdMeta; + type RemoveDocument = IdMeta & RevisionIdMeta; - type PostDocument = NewDocument & { + type PostDocument = NewDocument & { filters?: {[filterName: string]: string}; views?: {[viewName: string]: string}; @@ -134,7 +143,7 @@ declare namespace PouchDB { _attachments?: {[attachmentId: string]: PutAttachment}; }; - type PutDocument = PostDocument & ChangesMeta & { + type PutDocument = PostDocument & ChangesMeta & { _id?: DocumentId; }; @@ -155,11 +164,13 @@ declare namespace PouchDB { /** Return attachments as Buffers. * * Requires `include_docs` to be `true`. - * Requires `attachments` to be `true`. */ + * Requires `attachments` to be `true`. + */ binary?: boolean; /** Include conflict information for each document. * - * Requires `include_docs` to be `true`. */ + * Requires `include_docs` to be `true`. + */ conflicts?: boolean; /** Reverse ordering of results. */ descending?: boolean; @@ -169,7 +180,8 @@ declare namespace PouchDB { limit?: number; /** Number of documents to skip before returning. * - * Causes poor performance on IndexedDB and LevelDB. */ + * Causes poor performance on IndexedDB and LevelDB. + */ skip?: number; } interface AllDocsWithKeyOptions extends AllDocsOptions { @@ -187,21 +199,21 @@ declare namespace PouchDB { endkey: DocumentKey; /** Include any documents identified by `endkey`. * - * Defaults to `true`. */ + * Defaults to `true`. + */ inclusive_end?: boolean; } interface AllDocsMeta { - /** Only present if `conflicts` is `true` */ _conflicts?: RevisionId[]; _attachments?: Attachments; } - interface AllDocsResponse { + interface AllDocsResponse { /** The `skip` if provided, or in CouchDB the actual offset */ offset: number; total_rows: number; - rows: { + rows: Array<{ /** Only present if `include_docs` was `true`. */ doc?: Document; id: DocumentId; @@ -210,24 +222,24 @@ declare namespace PouchDB { rev: RevisionId; deleted?: boolean; } - }[]; + }>; } - interface BulkDocsOptions extends PutOptions { + interface BulkDocsOptions extends Options { new_edits?: boolean; } interface BulkGetOptions extends Options { - docs: Array<{ id: string; rev: RevisionId }>, - revs?: boolean, - attachments?: boolean, - binary?: boolean + docs: Array<{ id: string; rev: RevisionId }>; + revs?: boolean; + attachments?: boolean; + binary?: boolean; } - interface BulkGetResponse { + interface BulkGetResponse { results: { docs: Array<{ ok: Content & GetMeta } | { error: Error }>; - } + }; } interface ChangesMeta { @@ -283,7 +295,7 @@ declare namespace PouchDB { * To use a view function, pass '_view' here and provide a reference to the view function in options.view. * See filtered changes for details. */ - filter?: string | {(doc: any, params: any): any}; + filter?: string | ((doc: any, params: any) => any); /** Only show changes for docs with these ids (array of strings). */ doc_ids?: string[]; @@ -303,21 +315,22 @@ declare namespace PouchDB { view?: string; } - interface ChangesResponseChange { + interface ChangesResponseChange { id: string; seq: number | string; - changes: { rev: string }[]; + changes: Array<{ rev: string }>; deleted?: boolean; doc?: ExistingDocument; } - interface ChangesResponse { + interface ChangesResponse { status: string; last_seq: number | string; - results: ChangesResponseChange[]; + results: Array>; } - interface Changes extends EventEmitter, Promise> { + /** @todo: remove nodejs dep. */ + interface Changes extends NodeJS.EventEmitter, Promise> { on(event: 'change', listener: (value: ChangesResponseChange) => any): this; on(event: 'complete', listener: (value: ChangesResponse) => any): this; on(event: 'error', listener: (value: any) => any): this; @@ -325,9 +338,6 @@ declare namespace PouchDB { cancel(): void; } - interface DestroyOptions extends Options { - } - interface GetOptions extends Options { /** Include list of conflicting leaf revisions. */ conflicts?: boolean; @@ -336,7 +346,8 @@ declare namespace PouchDB { /** Include revision history of the document. */ revs?: boolean; /** Include a list of revisions of the document, and their - * availability. */ + * availability. + */ revs_info?: boolean; /** Include attachment data. */ @@ -352,18 +363,14 @@ declare namespace PouchDB { interface GetOpenRevisions extends Options { /** Fetch all leaf revisions if open_revs="all" or fetch all leaf * revisions specified in open_revs array. Leaves will be returned - * in the same order as specified in input array. */ + * in the same order as specified in input array. + */ open_revs: 'all' | Core.RevisionId[]; /** Include revision history of the document. */ revs?: boolean; } - interface PutOptions extends Options { - } - interface PostOptions extends PutOptions { - } - interface CompactOptions extends Core.Options { interval?: number; } @@ -376,7 +383,7 @@ declare namespace PouchDB { /** * Pass this to `PouchDB.plugin()`. */ - export type Plugin = 'This should be passed to PouchDB.plugin()'; + type Plugin = 'This should be passed to PouchDB.plugin()'; namespace Configuration { interface CommonDatabaseConfiguration { @@ -423,7 +430,7 @@ declare namespace PouchDB { */ headers?: { [name: string]: string; - } + }; /** * Enables transferring cookies and HTTP Authorization information. @@ -439,7 +446,7 @@ declare namespace PouchDB { auth?: { username?: string; password?: string; - } + }; /** * Disables automatic creation of databases. */ @@ -451,49 +458,31 @@ declare namespace PouchDB { } /** @todo: remove nodejs dep. */ - interface EventEmitter extends NodeJS.EventEmitter { - - } - - interface Static extends EventEmitter { + interface Static extends NodeJS.EventEmitter { plugin(plugin: Plugin): Static; version: string; - on(event: 'created', listener: (dbName: string) => any): this; - on(event: 'destroyed', listener: (dbName: string) => any): this; + on(event: 'created' | 'destroyed', listener: (dbName: string) => any): this; debug: debug.IDebug; - new(name?: string, - options?: Configuration.DatabaseConfiguration): Database; + new(name?: string, + options?: Configuration.DatabaseConfiguration): Database; /** * The returned object is a constructor function that works the same as PouchDB, * except that whenever you invoke it (e.g. with new), the given options will be passed in by default. */ defaults(options: Configuration.DatabaseConfiguration): { - new(name?: string, - options?: Configuration.DatabaseConfiguration): Database; - } + new(name?: string, + options?: Configuration.DatabaseConfiguration): Database; + }; } - interface Database { - - /** Fetch all documents matching the given key. */ - allDocs(options: Core.AllDocsWithKeyOptions): - Promise>; - - /** Fetch all documents matching any of the given keys. */ - allDocs(options: Core.AllDocsWithKeysOptions): - Promise>; - - /** Fetch all documents matching the given key range. */ - allDocs(options: Core.AllDocsWithinRangeOptions): - Promise>; - - /** Fetch all documents. */ - allDocs(options?: Core.AllDocsOptions): + interface Database { + /** Fetch all documents matching the given options. */ + allDocs(options?: Core.AllDocsWithKeyOptions | Core.AllDocsWithKeysOptions | Core.AllDocsWithinRangeOptions | Core.AllDocsOptions): Promise>; /** @@ -503,9 +492,9 @@ declare namespace PouchDB { * which should match the ID and revision of the document on which to base your updates. * Finally, to delete a document, include a _deleted parameter with the value true. */ - bulkDocs(docs: Core.PutDocument[], + bulkDocs(docs: Array>, options: Core.BulkDocsOptions | null, - callback: Core.Callback): void; + callback: Core.Callback): void; /** * Create, update or delete multiple documents. The docs argument is an array of documents. @@ -514,7 +503,7 @@ declare namespace PouchDB { * which should match the ID and revision of the document on which to base your updates. * Finally, to delete a document, include a _deleted parameter with the value true. */ - bulkDocs(docs: Core.PutDocument[], + bulkDocs(docs: Array>, options?: Core.BulkDocsOptions): Promise; /** Compact the database */ @@ -522,37 +511,37 @@ declare namespace PouchDB { /** Compact the database */ compact(options: Core.CompactOptions, - callback: Core.Callback): void; + callback: Core.Callback): void; /** Destroy the database */ - destroy(options: Core.DestroyOptions | void, - callback: Core.AnyCallback): void; + destroy(options: Core.Options | null, + callback: Core.Callback): void; /** Destroy the database */ - destroy(options?: Core.DestroyOptions | void): Promise; + destroy(options?: Core.Options | null): Promise; /** Fetch a document */ get(docId: Core.DocumentId, - options: Core.GetOptions | null, - callback: Core.Callback & Core.GetMeta> + options: Core.GetOptions | Core.GetOpenRevisions | null, + callback: Core.Callback & Core.GetMeta> ): void; /** Fetch a document */ get(docId: Core.DocumentId, - options: Core.GetOptions + options?: Core.GetOptions | Core.GetOpenRevisions ): Promise & Core.GetMeta>; - /** Fetch a document */ - get(docId: Core.DocumentId): Promise & Core.GetMeta>; - - /** Fetch document open revs */ - get(docId: Core.DocumentId, - options: Core.GetOpenRevisions, - callback: Core.Callback[]>): void; - - /** Fetch document open revs */ - get(docId: Core.DocumentId, - options: Core.GetOpenRevisions): Promise[]>; + /** Create a new document without providing an id. + * + * You should prefer put() to post(), because when you post(), you are + * missing an opportunity to use allDocs() to sort documents by _id + * (because your _ids are random). + * + * @see {@link https://pouchdb.com/2014/06/17/12-pro-tips-for-better-code-with-pouchdb.html|PouchDB Pro Tips} + */ + post(doc: Core.PostDocument, + options: Core.Options | null, + callback: Core.Callback): void; /** Create a new document without providing an id. * @@ -563,19 +552,7 @@ declare namespace PouchDB { * @see {@link https://pouchdb.com/2014/06/17/12-pro-tips-for-better-code-with-pouchdb.html|PouchDB Pro Tips} */ post(doc: Core.PostDocument, - options: Core.PostOptions | null, - callback: Core.Callback): void; - - /** Create a new document without providing an id. - * - * You should prefer put() to post(), because when you post(), you are - * missing an opportunity to use allDocs() to sort documents by _id - * (because your _ids are random). - * - * @see {@link https://pouchdb.com/2014/06/17/12-pro-tips-for-better-code-with-pouchdb.html|PouchDB Pro Tips} - */ - post(doc: Core.PostDocument, - options?: Core.PostOptions): Promise; + options?: Core.Options): Promise; /** Create a new document or update an existing document. * @@ -586,8 +563,8 @@ declare namespace PouchDB { * see inconsistent results. */ put(doc: Core.PutDocument, - options: Core.PutOptions | null, - callback: Core.Callback): void; + options: Core.Options | null, + callback: Core.Callback): void; /** Create a new document or update an existing document. * @@ -598,18 +575,18 @@ declare namespace PouchDB { * see inconsistent results. */ put(doc: Core.PutDocument, - options?: Core.PutOptions): Promise; + options?: Core.Options): Promise; /** Remove a doc from the database */ remove(doc: Core.RemoveDocument, options: Core.Options, - callback: Core.Callback): void; + callback: Core.Callback): void; /** Remove a doc from the database */ remove(docId: Core.DocumentId, revision: Core.RevisionId, options: Core.Options, - callback: Core.Callback): void; + callback: Core.Callback): void; /** Remove a doc from the database */ remove(doc: Core.RemoveDocument, @@ -621,7 +598,7 @@ declare namespace PouchDB { options?: Core.Options): Promise; /** Get database information */ - info(callback: Core.Callback): void; + info(callback: Core.Callback): void; /** Get database information */ info(): Promise; @@ -635,7 +612,7 @@ declare namespace PouchDB { * Calling cancel() will unsubscribe all event listeners automatically. */ changes(options: Core.ChangesOptions | null, - callback: Core.Callback>): void; + callback: Core.Callback>): void; /** * A list of changes made to documents in the database, in the order they were made. @@ -648,7 +625,7 @@ declare namespace PouchDB { changes(options?: Core.ChangesOptions): Core.Changes; /** Close the database */ - close(callback: Core.AnyCallback): void; + close(callback: Core.Callback): void; /** Close the database */ close(): Promise; @@ -659,88 +636,84 @@ declare namespace PouchDB { * If the document doesn’t already exist, then this method will create an empty document containing the attachment. */ putAttachment(docId: Core.DocumentId, - attachmentId: Core.AttachmentId, - rev: Core.RevisionId, - attachment: Core.Attachment, - type: string, - callback: Core.Callback): void; + attachmentId: Core.AttachmentId, + rev: Core.RevisionId, + attachment: Core.Attachment, + type: string, + callback: Core.Callback): void; /** - * Attaches a binary object to a document. - * This method will update an existing document to add the attachment, so it requires a rev if the document already exists. - * If the document doesn’t already exist, then this method will create an empty document containing the attachment. - */ + * Attaches a binary object to a document. + * This method will update an existing document to add the attachment, so it requires a rev if the document already exists. + * If the document doesn’t already exist, then this method will create an empty document containing the attachment. + */ putAttachment(docId: Core.DocumentId, - attachmentId: Core.AttachmentId, - rev: Core.RevisionId, - attachment: Core.Attachment, - type: string): Promise; + attachmentId: Core.AttachmentId, + rev: Core.RevisionId, + attachment: Core.Attachment, + type: string): Promise; /** - * Attaches a binary object to a document. - * This method will update an existing document to add the attachment, so it requires a rev if the document already exists. - * If the document doesn’t already exist, then this method will create an empty document containing the attachment. - */ + * Attaches a binary object to a document. + * This method will update an existing document to add the attachment, so it requires a rev if the document already exists. + * If the document doesn’t already exist, then this method will create an empty document containing the attachment. + */ putAttachment(docId: Core.DocumentId, - attachmentId: Core.AttachmentId, - attachment: Core.Attachment, - type: string, - callback: Core.Callback): void; + attachmentId: Core.AttachmentId, + attachment: Core.Attachment, + type: string, + callback: Core.Callback): void; /** - * Attaches a binary object to a document. - * This method will update an existing document to add the attachment, so it requires a rev if the document already exists. - * If the document doesn’t already exist, then this method will create an empty document containing the attachment. - */ + * Attaches a binary object to a document. + * This method will update an existing document to add the attachment, so it requires a rev if the document already exists. + * If the document doesn’t already exist, then this method will create an empty document containing the attachment. + */ putAttachment(docId: Core.DocumentId, - attachmentId: Core.AttachmentId, - attachment: Core.Attachment, - type: string): Promise; + attachmentId: Core.AttachmentId, + attachment: Core.Attachment, + type: string): Promise; /** Get attachment data */ getAttachment(docId: Core.DocumentId, - attachmentId: Core.AttachmentId, - options: { rev?: Core.RevisionId}, - callback: Core.Callback): void; + attachmentId: Core.AttachmentId, + options: { rev?: Core.RevisionId}, + callback: Core.Callback): void; /** Get attachment data */ getAttachment(docId: Core.DocumentId, - attachmentId: Core.AttachmentId, - options: { rev?: Core.RevisionId}): Promise; + attachmentId: Core.AttachmentId, + options?: { rev?: Core.RevisionId}): Promise; /** Get attachment data */ getAttachment(docId: Core.DocumentId, - attachmentId: Core.AttachmentId, - callback: Core.Callback): void; - - /** Get attachment data */ - getAttachment(docId: Core.DocumentId, - attachmentId: Core.AttachmentId): Promise; + attachmentId: Core.AttachmentId, + callback: Core.Callback): void; /** Delete an attachment from a doc. You must supply the rev of the existing doc. */ removeAttachment(docId: Core.DocumentId, - attachmentId: Core.AttachmentId, - rev: Core.RevisionId, - callback: Core.Callback): void; + attachmentId: Core.AttachmentId, + rev: Core.RevisionId, + callback: Core.Callback): void; /** Delete an attachment from a doc. You must supply the rev of the existing doc. */ removeAttachment(docId: Core.DocumentId, - attachmentId: Core.AttachmentId, - rev: Core.RevisionId): Promise; + attachmentId: Core.AttachmentId, + rev: Core.RevisionId): Promise; /** Given a set of document/revision IDs, returns the document bodies (and, optionally, attachment data) for each ID/revision pair specified. */ bulkGet(options: Core.BulkGetOptions, - callback: Core.Callback>): void; + callback: Core.Callback>): void; /** Given a set of document/revision IDs, returns the document bodies (and, optionally, attachment data) for each ID/revision pair specified. */ bulkGet(options: Core.BulkGetOptions): Promise>; /** Given a set of document/revision IDs, returns the subset of those that do not correspond to revisions stored in the database */ - revsDiff(diff : Core.RevisionDiffOptions, - callback: Core.Callback): void; + revsDiff(diff: Core.RevisionDiffOptions, + callback: Core.Callback): void; /** Given a set of document/revision IDs, returns the subset of those that do not correspond to revisions stored in the database */ - revsDiff(diff : Core.RevisionDiffOptions): Promise; + revsDiff(diff: Core.RevisionDiffOptions): Promise; } } diff --git a/types/pouchdb-core/pouchdb-core-tests.ts b/types/pouchdb-core/pouchdb-core-tests.ts index a42947dd7d..3b2e8d3542 100644 --- a/types/pouchdb-core/pouchdb-core-tests.ts +++ b/types/pouchdb-core/pouchdb-core-tests.ts @@ -1,3 +1,5 @@ +import * as PouchDB from 'pouchdb-core'; + function isString(someString: string) { } function isNumber(someNumber: number) { @@ -219,25 +221,29 @@ function testRemoteOptions() { }); } -interface Cat { - meow: string; -} - -interface Boot { - thud: boolean; -} - -async function heterogeneousGenericsDatabase(db: PouchDB.Database) { - const cats = await db.allDocs({ startkey: 'cat/', endkey: 'cat/\uffff', include_docs: true }); - for (let row of cats.rows) { - if (row.doc) { - row.doc.meow; // $ExpectType string - } +function heterogeneousGenericsDatabase(db: PouchDB.Database) { + interface Cat { + meow: string; } - const boots = await db.allDocs({ startkey: 'boot/', endkey: 'boot/\uffff', include_docs: true }); - for (let row of boots.rows) { - if (row.doc) { - row.doc.thud; // $ExpectType boolean - } + + interface Boot { + thud: boolean; } + + db.allDocs({ startkey: 'cat/', endkey: 'cat/\uffff', include_docs: true }) + .then(cats => { + for (let row of cats.rows) { + if (row.doc) { + row.doc.meow; // $ExpectType string + } + } + }); + db.allDocs({ startkey: 'boot/', endkey: 'boot/\uffff', include_docs: true }) + .then(boots => { + for (let row of boots.rows) { + if (row.doc) { + row.doc.thud; // $ExpectType boolean + } + } + }); } From 63905996fa11e6711c7145c21c4df4428c9fdd49 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 13:37:02 -0400 Subject: [PATCH 122/286] Update and lint pouchdb-find --- types/pouchdb-find/index.d.ts | 45 ++++++++++++------------ types/pouchdb-find/pouchdb-find-tests.ts | 4 +-- types/pouchdb-find/tslint.json | 1 + 3 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 types/pouchdb-find/tslint.json diff --git a/types/pouchdb-find/index.d.ts b/types/pouchdb-find/index.d.ts index a125d42ee4..f598b5311d 100644 --- a/types/pouchdb-find/index.d.ts +++ b/types/pouchdb-find/index.d.ts @@ -1,14 +1,16 @@ -// Type definitions for pouchdb-find v0.10.0 +// Type definitions for pouchdb-find 0.10 // Project: https://pouchdb.com/ // Definitions by: Jakub Navratil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare namespace PouchDB { - namespace Find { - interface ConditionOperators { /** Match fields "less than" this one. */ $lt?: any; @@ -47,7 +49,7 @@ declare namespace PouchDB { * Non-integer values result in a 404 status. * Matches documents where (field % Divisor == Remainder) is true, and only when the document field is an integer. * [divisor, remainder] - * */ + */ $mod?: [number, number]; /** A regular expression pattern to match against the document field. Only matches when the field is a string value and matches the supplied regular expression. */ @@ -79,7 +81,7 @@ declare namespace PouchDB { _id?: ConditionOperators; } - interface FindRequest { + interface FindRequest { /** Defines a selector to filter the results. Required */ selector: Selector; @@ -96,8 +98,8 @@ declare namespace PouchDB { skip?: number; } - interface FindResponse { - docs: Core.Document[]; + interface FindResponse { + docs: Array>; } interface CreateIndexOptions { @@ -113,10 +115,10 @@ declare namespace PouchDB { /** Only supports 'json', and it's also the default */ type?: string; - } + }; } - interface CreateIndexResponse { + interface CreateIndexResponse { result: string; } @@ -131,14 +133,14 @@ declare namespace PouchDB { type: string; def: { - fields: { + fields: Array<{ [fieldName: string]: string - }[] - } + }>; + }; } - interface GetIndexesResponse { - indexes: Index[] + interface GetIndexesResponse { + indexes: Index[]; } interface DeleteIndexOptions { @@ -152,33 +154,30 @@ declare namespace PouchDB { type?: string; } - interface DeleteIndexResponse { + interface DeleteIndexResponse { [propertyName: string]: any; } - } - interface Database { - + interface Database { /** Query the API to find some documents. */ find(request: Find.FindRequest, - callback: Core.Callback>): void; + callback: Core.Callback>): void; find(request?: Find.FindRequest): Promise>; /** Create an index if it doesn't exist, or do nothing if it already exists. */ createIndex(index: Find.CreateIndexOptions, - callback: Core.Callback>): void; + callback: Core.Callback>): void; createIndex(index?: Find.CreateIndexOptions): Promise>; /** Get a list of all the indexes you've created. Also tells you about the special _all_docs index, i.e. the default index on the _id field. */ - getIndexes(callback: Core.Callback>): void; + getIndexes(callback: Core.Callback>): void; getIndexes(): Promise>; /** Delete an index and clean up any leftover data on the disk. */ deleteIndex(index: Find.DeleteIndexOptions, - callback: Core.Callback>): void; + callback: Core.Callback>): void; deleteIndex(index?: Find.DeleteIndexOptions): Promise>; - } } diff --git a/types/pouchdb-find/pouchdb-find-tests.ts b/types/pouchdb-find/pouchdb-find-tests.ts index d9fe07536f..411b6c1b00 100644 --- a/types/pouchdb-find/pouchdb-find-tests.ts +++ b/types/pouchdb-find/pouchdb-find-tests.ts @@ -7,11 +7,11 @@ function testFind() { sort: ['fieldName'], limit: 1, skip: 1 - }) + }); db.find({ selector: {}, - sort: [{'fieldName': 'asc'}] + sort: [{fieldName: 'asc'}] }); // test combinations of selectors diff --git a/types/pouchdb-find/tslint.json b/types/pouchdb-find/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-find/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 0cdc4d77f19201e4d7f042afc0fd11764b1a1526 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 14:18:36 -0400 Subject: [PATCH 123/286] Update and lint PouchDB adapters --- types/pouchdb-adapter-fruitdown/index.d.ts | 12 ++++++++---- .../pouchdb-adapter-fruitdown-tests.ts | 4 +++- types/pouchdb-adapter-fruitdown/tslint.json | 1 + types/pouchdb-adapter-http/index.d.ts | 12 ++++++++---- types/pouchdb-adapter-http/tslint.json | 1 + types/pouchdb-adapter-idb/index.d.ts | 12 ++++++++---- types/pouchdb-adapter-idb/tslint.json | 1 + types/pouchdb-adapter-leveldb/index.d.ts | 12 ++++++++---- .../pouchdb-adapter-leveldb-tests.ts | 5 +++-- types/pouchdb-adapter-leveldb/tslint.json | 1 + types/pouchdb-adapter-localstorage/index.d.ts | 12 ++++++++---- .../pouchdb-adapter-localstorage-tests.ts | 4 +++- types/pouchdb-adapter-localstorage/tslint.json | 1 + types/pouchdb-adapter-memory/index.d.ts | 12 ++++++++---- .../pouchdb-adapter-memory-tests.ts | 4 +++- types/pouchdb-adapter-memory/tslint.json | 1 + types/pouchdb-adapter-node-websql/index.d.ts | 6 +++++- .../pouchdb-adapter-node-websql-tests.ts | 4 +++- types/pouchdb-adapter-node-websql/tslint.json | 1 + types/pouchdb-adapter-websql/index.d.ts | 10 +++++++--- .../pouchdb-adapter-websql-tests.ts | 2 -- types/pouchdb-adapter-websql/tslint.json | 1 + 22 files changed, 83 insertions(+), 36 deletions(-) create mode 100644 types/pouchdb-adapter-fruitdown/tslint.json create mode 100644 types/pouchdb-adapter-http/tslint.json create mode 100644 types/pouchdb-adapter-idb/tslint.json create mode 100644 types/pouchdb-adapter-leveldb/tslint.json create mode 100644 types/pouchdb-adapter-localstorage/tslint.json create mode 100644 types/pouchdb-adapter-memory/tslint.json create mode 100644 types/pouchdb-adapter-node-websql/tslint.json create mode 100644 types/pouchdb-adapter-websql/tslint.json diff --git a/types/pouchdb-adapter-fruitdown/index.d.ts b/types/pouchdb-adapter-fruitdown/index.d.ts index 89fcd9d95b..63484904ac 100644 --- a/types/pouchdb-adapter-fruitdown/index.d.ts +++ b/types/pouchdb-adapter-fruitdown/index.d.ts @@ -1,10 +1,14 @@ -// Type definitions for pouchdb-adapter-fruitdown v6.1.2 +// Type definitions for pouchdb-adapter-fruitdown 6.1 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare namespace PouchDB { namespace FruitDOWNAdapter { interface FruitDOWNAdapterConfiguration @@ -14,9 +18,9 @@ declare namespace PouchDB { } interface Static { - new(name: string | void, - options: FruitDOWNAdapter.FruitDOWNAdapterConfiguration - ): Database; + new(name: string | null, + options: FruitDOWNAdapter.FruitDOWNAdapterConfiguration + ): Database; } } diff --git a/types/pouchdb-adapter-fruitdown/pouchdb-adapter-fruitdown-tests.ts b/types/pouchdb-adapter-fruitdown/pouchdb-adapter-fruitdown-tests.ts index 645ec0b448..437d759d21 100644 --- a/types/pouchdb-adapter-fruitdown/pouchdb-adapter-fruitdown-tests.ts +++ b/types/pouchdb-adapter-fruitdown/pouchdb-adapter-fruitdown-tests.ts @@ -1,5 +1,7 @@ function testConstructor() { - type MyModel = { numericProperty: number }; + interface MyModel { + numericProperty: number; + } let model: PouchDB.Core.Document; let db = new PouchDB(null, { diff --git a/types/pouchdb-adapter-fruitdown/tslint.json b/types/pouchdb-adapter-fruitdown/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-adapter-fruitdown/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/pouchdb-adapter-http/index.d.ts b/types/pouchdb-adapter-http/index.d.ts index f0125baf7c..07eb5bbbfb 100644 --- a/types/pouchdb-adapter-http/index.d.ts +++ b/types/pouchdb-adapter-http/index.d.ts @@ -1,10 +1,14 @@ -// Type definitions for pouchdb-http v6.1.2 +// Type definitions for pouchdb-http 6.1 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare namespace PouchDB { namespace HttpAdapter { interface HttpAdapterConfiguration @@ -14,9 +18,9 @@ declare namespace PouchDB { } interface Static { - new(name: string | void, - options: HttpAdapter.HttpAdapterConfiguration - ): Database; + new(name: string | null, + options: HttpAdapter.HttpAdapterConfiguration + ): Database; } } diff --git a/types/pouchdb-adapter-http/tslint.json b/types/pouchdb-adapter-http/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-adapter-http/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/pouchdb-adapter-idb/index.d.ts b/types/pouchdb-adapter-idb/index.d.ts index a62cef3654..e8ad990b45 100644 --- a/types/pouchdb-adapter-idb/index.d.ts +++ b/types/pouchdb-adapter-idb/index.d.ts @@ -1,10 +1,14 @@ -// Type definitions for pouchdb-adapter-idb v6.1.2 +// Type definitions for pouchdb-adapter-idb 6.1 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare namespace PouchDB { namespace Core { interface DatabaseInfo { @@ -26,9 +30,9 @@ declare namespace PouchDB { } interface Static { - new(name: string | void, - options: IdbAdapter.IdbAdapterConfiguration - ): Database; + new(name: string | null, + options: IdbAdapter.IdbAdapterConfiguration + ): Database; } } diff --git a/types/pouchdb-adapter-idb/tslint.json b/types/pouchdb-adapter-idb/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-adapter-idb/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/pouchdb-adapter-leveldb/index.d.ts b/types/pouchdb-adapter-leveldb/index.d.ts index 6c89d0161e..a3dd9ad6d7 100644 --- a/types/pouchdb-adapter-leveldb/index.d.ts +++ b/types/pouchdb-adapter-leveldb/index.d.ts @@ -1,10 +1,14 @@ -// Type definitions for pouchdb-adapter-leveldb v6.1.2 +// Type definitions for pouchdb-adapter-leveldb 6.1 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare namespace PouchDB { namespace LevelDbAdapter { interface LevelDbAdapterConfiguration extends Configuration.LocalDatabaseConfiguration { @@ -13,9 +17,9 @@ declare namespace PouchDB { } interface Static { - new(name: string | void, - options: LevelDbAdapter.LevelDbAdapterConfiguration - ): Database; + new(name: string | null, + options: LevelDbAdapter.LevelDbAdapterConfiguration + ): Database; } } diff --git a/types/pouchdb-adapter-leveldb/pouchdb-adapter-leveldb-tests.ts b/types/pouchdb-adapter-leveldb/pouchdb-adapter-leveldb-tests.ts index 49c4a84088..f7223616ac 100644 --- a/types/pouchdb-adapter-leveldb/pouchdb-adapter-leveldb-tests.ts +++ b/types/pouchdb-adapter-leveldb/pouchdb-adapter-leveldb-tests.ts @@ -1,5 +1,7 @@ function testConstructor() { - type MyModel = { numericProperty: number }; + interface MyModel { + numericProperty: number; + } let db = new PouchDB(null, { adapter: 'leveldb', @@ -8,4 +10,3 @@ function testConstructor() { adapter: 'leveldb', }); } - diff --git a/types/pouchdb-adapter-leveldb/tslint.json b/types/pouchdb-adapter-leveldb/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-adapter-leveldb/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/pouchdb-adapter-localstorage/index.d.ts b/types/pouchdb-adapter-localstorage/index.d.ts index 9e71c05a77..04823352de 100644 --- a/types/pouchdb-adapter-localstorage/index.d.ts +++ b/types/pouchdb-adapter-localstorage/index.d.ts @@ -1,10 +1,14 @@ -// Type definitions for pouchdb-adapter-localstorage v6.1.2 +// Type definitions for pouchdb-adapter-localstorage 6.1 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare namespace PouchDB { namespace LocalStorageAdapter { interface LocalStorageAdapterConfiguration @@ -14,9 +18,9 @@ declare namespace PouchDB { } interface Static { - new(name: string | void, - options: LocalStorageAdapter.LocalStorageAdapterConfiguration - ): Database; + new(name: string | null, + options: LocalStorageAdapter.LocalStorageAdapterConfiguration + ): Database; } } diff --git a/types/pouchdb-adapter-localstorage/pouchdb-adapter-localstorage-tests.ts b/types/pouchdb-adapter-localstorage/pouchdb-adapter-localstorage-tests.ts index 71a60e987f..77f3701e57 100644 --- a/types/pouchdb-adapter-localstorage/pouchdb-adapter-localstorage-tests.ts +++ b/types/pouchdb-adapter-localstorage/pouchdb-adapter-localstorage-tests.ts @@ -1,5 +1,7 @@ function testConstructor() { - type MyModel = { numericProperty: number }; + interface MyModel { + numericProperty: number; + } let db = new PouchDB(null, { adapter: 'localstorage', diff --git a/types/pouchdb-adapter-localstorage/tslint.json b/types/pouchdb-adapter-localstorage/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-adapter-localstorage/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/pouchdb-adapter-memory/index.d.ts b/types/pouchdb-adapter-memory/index.d.ts index 647ce5b434..3cbc0c664e 100644 --- a/types/pouchdb-adapter-memory/index.d.ts +++ b/types/pouchdb-adapter-memory/index.d.ts @@ -1,10 +1,14 @@ -// Type definitions for pouchdb-adapter-memory v6.1.2 +// Type definitions for pouchdb-adapter-memory 6.1 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare namespace PouchDB { namespace MemoryAdapter { interface MemoryAdapterConfiguration @@ -14,9 +18,9 @@ declare namespace PouchDB { } interface Static { - new(name: string | void, - options: MemoryAdapter.MemoryAdapterConfiguration - ): Database; + new(name: string | null, + options: MemoryAdapter.MemoryAdapterConfiguration + ): Database; } } diff --git a/types/pouchdb-adapter-memory/pouchdb-adapter-memory-tests.ts b/types/pouchdb-adapter-memory/pouchdb-adapter-memory-tests.ts index a920375bb8..82e1d0b5a1 100644 --- a/types/pouchdb-adapter-memory/pouchdb-adapter-memory-tests.ts +++ b/types/pouchdb-adapter-memory/pouchdb-adapter-memory-tests.ts @@ -1,5 +1,7 @@ function testConstructor() { - type MyModel = { numericProperty: number }; + interface MyModel { + numericProperty: number; + } let db = new PouchDB(null, { adapter: 'memory', diff --git a/types/pouchdb-adapter-memory/tslint.json b/types/pouchdb-adapter-memory/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-adapter-memory/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/pouchdb-adapter-node-websql/index.d.ts b/types/pouchdb-adapter-node-websql/index.d.ts index bec01a6d8b..25dcc7d8cf 100644 --- a/types/pouchdb-adapter-node-websql/index.d.ts +++ b/types/pouchdb-adapter-node-websql/index.d.ts @@ -1,11 +1,15 @@ -// Type definitions for pouchdb-adapter-node-websql v6.1.2 +// Type definitions for pouchdb-adapter-node-websql 6.1 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare module 'pouchdb-adapter-node-websql' { const plugin: PouchDB.Plugin; export = plugin; diff --git a/types/pouchdb-adapter-node-websql/pouchdb-adapter-node-websql-tests.ts b/types/pouchdb-adapter-node-websql/pouchdb-adapter-node-websql-tests.ts index b65fabca1b..94cb7b0c0c 100644 --- a/types/pouchdb-adapter-node-websql/pouchdb-adapter-node-websql-tests.ts +++ b/types/pouchdb-adapter-node-websql/pouchdb-adapter-node-websql-tests.ts @@ -6,7 +6,9 @@ function isString(someString: string) { } function testConstructor() { - type MyModel = { numericProperty: number }; + interface MyModel { + numericProperty: number; + } let db = new PouchDB(null, { adapter: 'websql', diff --git a/types/pouchdb-adapter-node-websql/tslint.json b/types/pouchdb-adapter-node-websql/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-adapter-node-websql/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/pouchdb-adapter-websql/index.d.ts b/types/pouchdb-adapter-websql/index.d.ts index 7148d65ea2..b7cc5af65b 100644 --- a/types/pouchdb-adapter-websql/index.d.ts +++ b/types/pouchdb-adapter-websql/index.d.ts @@ -1,10 +1,14 @@ -// Type definitions for pouchdb-adapter-websql v6.1.2 +// Type definitions for pouchdb-adapter-websql 6.1 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare namespace PouchDB { namespace Core { interface DatabaseInfo { @@ -25,8 +29,8 @@ declare namespace PouchDB { } interface Static { - new(name: string | void, - options: AdapterWebSql.Configuration): Database; + new(name: string | null, + options: AdapterWebSql.Configuration): Database; } } diff --git a/types/pouchdb-adapter-websql/pouchdb-adapter-websql-tests.ts b/types/pouchdb-adapter-websql/pouchdb-adapter-websql-tests.ts index 4fcd195669..577b7c7e83 100644 --- a/types/pouchdb-adapter-websql/pouchdb-adapter-websql-tests.ts +++ b/types/pouchdb-adapter-websql/pouchdb-adapter-websql-tests.ts @@ -6,8 +6,6 @@ function isString(someString: string) { } function testConstructor() { - type MyModel = { numericProperty: number }; - let db = new PouchDB('basic'); db = new PouchDB(null, { adapter: 'websql' diff --git a/types/pouchdb-adapter-websql/tslint.json b/types/pouchdb-adapter-websql/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-adapter-websql/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From a9e346334202ce611ffe087b45f786dbe5234ad3 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 14:29:46 -0400 Subject: [PATCH 124/286] Update and lint pouchdb-mapreduce --- types/pouchdb-mapreduce/index.d.ts | 27 ++++++++++--------- .../pouchdb-mapreduce-tests.ts | 15 ++++++----- types/pouchdb-mapreduce/tslint.json | 1 + 3 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 types/pouchdb-mapreduce/tslint.json diff --git a/types/pouchdb-mapreduce/index.d.ts b/types/pouchdb-mapreduce/index.d.ts index 401f70afb0..7b398d730b 100644 --- a/types/pouchdb-mapreduce/index.d.ts +++ b/types/pouchdb-mapreduce/index.d.ts @@ -1,15 +1,18 @@ -// Type definitions for pouchdb-mapreduce v6.1.2 +// Type definitions for pouchdb-mapreduce 6.1 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// -declare namespace PouchDB { +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ +declare namespace PouchDB { interface Filter { - map: (doc: any) => void; - reduce?: (key: string, value: any) => any; + map(doc: any): void; + reduce?(key: string, value: any): any; } namespace Query { @@ -55,19 +58,19 @@ declare namespace PouchDB { stale?: 'ok' | 'update_after'; } - interface Response { + interface Response { total_rows: number; offset: number; - rows: { + rows: Array<{ id: any; key: any; value: any; doc?: Core.ExistingDocument; - }[] + }>; } } - export interface Database { + interface Database { /** * Cleans up any stale map/reduce indexes. * @@ -76,7 +79,7 @@ declare namespace PouchDB { * to take up space on disk. viewCleanup() removes these unnecessary * index files. */ - viewCleanup(callback: PouchDB.Core.Callback): void; + viewCleanup(callback: PouchDB.Core.Callback): void; /** * Cleans up any stale map/reduce indexes. * @@ -91,17 +94,17 @@ declare namespace PouchDB { * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Filter | Function, opts: Query.Options, callback: (err: Core.Error, res: Query.Response) => void): void; + query(fun: string | Filter | ((doc: any) => void), opts: Query.Options, callback: (err: Core.Error, res: Query.Response) => void): void; /** * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Filter | Function, callback: (err: Core.Error, res: Query.Response) => void): void; + query(fun: string | Filter | ((doc: any) => void), callback: (err: Core.Error, res: Query.Response) => void): void; /** * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Filter | Function, opts?: Query.Options): Promise>; + query(fun: string | Filter | ((doc: any) => void), opts?: Query.Options): Promise>; } } diff --git a/types/pouchdb-mapreduce/pouchdb-mapreduce-tests.ts b/types/pouchdb-mapreduce/pouchdb-mapreduce-tests.ts index 6f6d941e83..6c028a5d93 100644 --- a/types/pouchdb-mapreduce/pouchdb-mapreduce-tests.ts +++ b/types/pouchdb-mapreduce/pouchdb-mapreduce-tests.ts @@ -1,5 +1,7 @@ function testConstructor() { - type MyModel = { numericProperty: number }; + interface MyModel { + numericProperty: number; + } let model: PouchDB.Core.Document; let db = new PouchDB('mydb'); @@ -8,14 +10,14 @@ function testConstructor() { } function testQuery() { - let pouch = new PouchDB<{}>('mydb'); + let pouch = new PouchDB('mydb'); // find pokemon with name === 'Pika pi!' pouch.query('my_index/by_name', { key : 'Pika pi!', include_docs : true - }).then(function (result) { + }).then((result) => { // handle result - }).catch(function (err) { + }).catch((err) => { // handle errors }); @@ -25,10 +27,9 @@ function testQuery() { endkey : 'P\uffff', limit : 5, include_docs : true - }).then(function (result) { + }).then((result) => { // handle result - }).catch(function (err) { + }).catch((err) => { // handle errors }); - } diff --git a/types/pouchdb-mapreduce/tslint.json b/types/pouchdb-mapreduce/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-mapreduce/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 12ffcffba5610faed3252cee42093099d498d531 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 14:40:01 -0400 Subject: [PATCH 125/286] Update and lint pouchdb-replication --- types/pouchdb-replication/index.d.ts | 57 ++++++++----------- .../pouchdb-replication-tests.ts | 6 +- types/pouchdb-replication/tslint.json | 1 + 3 files changed, 29 insertions(+), 35 deletions(-) create mode 100644 types/pouchdb-replication/tslint.json diff --git a/types/pouchdb-replication/index.d.ts b/types/pouchdb-replication/index.d.ts index c88ebd4e23..ff9d0051ec 100644 --- a/types/pouchdb-replication/index.d.ts +++ b/types/pouchdb-replication/index.d.ts @@ -1,14 +1,16 @@ -// Type definitions for pouchdb-replication v6.1.2 +// Type definitions for pouchdb-replication 6.1 // Project: https://pouchdb.com/ // Definitions by: Jakub Navratil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare namespace PouchDB { - namespace Replication { - interface ReplicateOptions { /** If true, starts subscribing to future changes in the source database and continue replicating them. */ live?: boolean; @@ -25,7 +27,7 @@ declare namespace PouchDB { * To use a view function, pass '_view' here and provide a reference to the view function in options.view. * See filtered changes for details. */ - filter?: string | {(doc: any, params: any): any}; + filter?: string | ((doc: any, params: any) => any); /** Only show changes for docs with these ids (array of strings). */ doc_ids?: string[]; @@ -76,38 +78,35 @@ declare namespace PouchDB { * Defaults to a function that chooses a random backoff between 0 and 2 seconds and doubles every time it fails to connect. * The default delay will never exceed 10 minutes. */ - back_off_function?: (delay: number) => number; + back_off_function?(delay: number): number; } - interface ReplicationEventEmitter extends EventEmitter { + interface ReplicationEventEmitter extends NodeJS.EventEmitter { on(event: 'change', listener: (info: C) => any): this; - on(event: 'paused', listener: (err: {}) => any): this; + on(event: 'paused' | 'denied' | 'error', listener: (err: {}) => any): this; on(event: 'active', listener: () => any): this; - on(event: 'denied', listener: (err: {}) => any): this; on(event: 'complete', listener: (info: F) => any): this; - on(event: 'error', listener: (err: {}) => any): this; cancel(): void; } - interface Replication + interface Replication extends ReplicationEventEmitter, ReplicationResultComplete>, Promise> { - } - interface ReplicationResult { + interface ReplicationResult { doc_write_failures: number; docs_read: number; docs_written: number; - last_seq: number, - start_time: Date, - ok: boolean, + last_seq: number; + start_time: Date; + ok: boolean; errors: any[]; - docs: Core.ExistingDocument[]; + docs: Array>; } - interface ReplicationResultComplete extends ReplicationResult { + interface ReplicationResultComplete extends ReplicationResult { end_time: Date; status: string; } @@ -117,26 +116,23 @@ declare namespace PouchDB { pull?: ReplicateOptions; } - interface Sync + interface Sync extends ReplicationEventEmitter, SyncResultComplete>, Promise> { - } - interface SyncResult { + interface SyncResult { direction: 'push' | 'pull'; change: ReplicationResult; } - interface SyncResultComplete { + interface SyncResultComplete { push?: ReplicationResultComplete; pull?: ReplicationResultComplete; } - } interface Static { - /** * Replicate data from source to target. Both the source and target can be a PouchDB instance or a string * representing a CouchDB database URL or the name of a local PouchDB database. If options.live is true, @@ -147,7 +143,7 @@ declare namespace PouchDB { source: string | Database, target: string | Database, options?: Replication.ReplicateOptions, - callback?: Core.Callback> + callback?: Core.Callback> ): Replication.Replication; /** @@ -163,13 +159,11 @@ declare namespace PouchDB { source: string | Database, target: string | Database, options?: Replication.SyncOptions, - callback?: Core.Callback> + callback?: Core.Callback> ): Replication.Sync; - } - interface Database { - + interface Database { replicate: { /** * Replicate data to `target`. Both the source and target can be a PouchDB instance @@ -180,7 +174,7 @@ declare namespace PouchDB { to( target: string | Database, options?: Replication.ReplicateOptions, - callback?: Core.Callback> + callback?: Core.Callback> ): Replication.Replication; /** @@ -192,7 +186,7 @@ declare namespace PouchDB { from( source: string | Database, options?: Replication.ReplicateOptions, - callback?: Core.Callback> + callback?: Core.Callback> ): Replication.Replication; }; @@ -208,9 +202,8 @@ declare namespace PouchDB { sync( remote: string | Database, options?: Replication.SyncOptions, - callback?: Core.Callback> + callback?: Core.Callback> ): Replication.Sync; - } } diff --git a/types/pouchdb-replication/pouchdb-replication-tests.ts b/types/pouchdb-replication/pouchdb-replication-tests.ts index 9cf352bed6..3eb4a0d86e 100644 --- a/types/pouchdb-replication/pouchdb-replication-tests.ts +++ b/types/pouchdb-replication/pouchdb-replication-tests.ts @@ -1,13 +1,13 @@ /** @todo make some real tests */ function testReplication() { - type Model = { foo: number }; + interface Model { + foo: number; + } const db = new PouchDB(); db.replicate.to('').then((res: PouchDB.Replication.ReplicationResultComplete) => { - }); db.replicate.from('').then((res: PouchDB.Replication.ReplicationResultComplete) => { - }); } diff --git a/types/pouchdb-replication/tslint.json b/types/pouchdb-replication/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-replication/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 1493b8762b9b55237e28e011737fde28e4369f15 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 14:48:02 -0400 Subject: [PATCH 126/286] Update and lint pouchdb-upsert --- types/pouchdb-upsert/index.d.ts | 25 ++++++++++---------- types/pouchdb-upsert/pouchdb-upsert-tests.ts | 11 +++++---- types/pouchdb-upsert/tslint.json | 1 + 3 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 types/pouchdb-upsert/tslint.json diff --git a/types/pouchdb-upsert/index.d.ts b/types/pouchdb-upsert/index.d.ts index 03f415ea90..e893a052aa 100644 --- a/types/pouchdb-upsert/index.d.ts +++ b/types/pouchdb-upsert/index.d.ts @@ -1,13 +1,16 @@ -// Type definitions for pouchdb-upsert v2.0.1 +// Type definitions for pouchdb-upsert 2.0 // Project: https://github.com/pouchdb/upsert // Definitions by: Keith D. Moore , Andrew Mitchell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// -declare namespace PouchDB { +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ - interface Database { +declare namespace PouchDB { + interface Database { /** * Perform an upsert (update or insert) operation. Returns a Promise. * @@ -17,7 +20,7 @@ declare namespace PouchDB { * If the document does not already exist, then {} will be the input to diffFunc. * */ - upsert(docId: Core.DocumentId, diffFun: UpsertDiffCallback): Promise; + upsert(docId: Core.DocumentId, diffFun: UpsertDiffCallback): Promise; /** * Perform an upsert (update or insert) operation. If a callback is not provided, the Promise based version @@ -29,8 +32,8 @@ declare namespace PouchDB { * If the document does not already exist, then {} will be the input to diffFunc. * @param callback - called with the results after operation is completed. */ - upsert(docId: Core.DocumentId, diffFun: UpsertDiffCallback, - callback: Core.Callback): void; + upsert(docId: Core.DocumentId, diffFun: UpsertDiffCallback, + callback: Core.Callback): void; /** * Put a new document with the given docId, if it doesn't already exist. Returns a Promise. @@ -38,7 +41,7 @@ declare namespace PouchDB { * @param doc - the document to insert. Should contain an _id if docId is not specified * If the document already exists, then the Promise will just resolve immediately. */ - putIfNotExists(doc: Core.Document): Promise; + putIfNotExists(doc: Core.Document): Promise; // /** @@ -51,13 +54,11 @@ declare namespace PouchDB { * If you don't specify a callback, then the Promise version of this function will be invoked and it * will return a Promise. */ - putIfNotExists(doc: Core.Document, - callback: Core.Callback): void; + putIfNotExists(doc: Core.Document, + callback: Core.Callback): void; } - interface UpsertDiffCallback { - (doc: Core.Document): Core.Document|boolean; - } + type UpsertDiffCallback = (doc: Core.Document) => Core.Document | boolean; } declare module 'pouchdb-upsert' { diff --git a/types/pouchdb-upsert/pouchdb-upsert-tests.ts b/types/pouchdb-upsert/pouchdb-upsert-tests.ts index 7da1c46267..52efc75099 100644 --- a/types/pouchdb-upsert/pouchdb-upsert-tests.ts +++ b/types/pouchdb-upsert/pouchdb-upsert-tests.ts @@ -1,7 +1,10 @@ import * as pouchdbUpsert from 'pouchdb-upsert'; PouchDB.plugin(pouchdbUpsert); -type UpsertDocModel = { _id: 'test-doc1', name: 'test' }; +interface UpsertDocModel { + _id: 'test-doc1'; + name: 'test'; +} let docToUpsert: PouchDB.Core.Document; const db = new PouchDB(); @@ -14,7 +17,7 @@ function testUpsert_WithPromise_AndReturnDoc() { } function testUpsert_WithPromise_AndReturnBoolean() { - db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { + db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { // Make some updates.... return false; }).then((res: PouchDB.Core.Response) => { @@ -22,7 +25,7 @@ function testUpsert_WithPromise_AndReturnBoolean() { } function testUpsert_WithCallback_AndReturnDoc() { - db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { + db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { // Make some updates.... return doc; }, (res: PouchDB.Core.Response) => {}); @@ -30,7 +33,7 @@ function testUpsert_WithCallback_AndReturnDoc() { function testUpsert_WithCallback_AndReturnBoolean() { // callback return boolean - db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { + db.upsert(docToUpsert._id, (doc: PouchDB.Core.Document) => { // Make some updates.... return false; }, (res: PouchDB.Core.Response) => {}); diff --git a/types/pouchdb-upsert/tslint.json b/types/pouchdb-upsert/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-upsert/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From fe564f6dcfc7efb6a858e3ba0cd90d9fddf66dd3 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 14:55:10 -0400 Subject: [PATCH 127/286] Update and lint PouchDB metapackages --- types/pouchdb-browser/index.d.ts | 6 +++++- types/pouchdb-browser/pouchdb-browser-tests.ts | 4 +++- types/pouchdb-browser/tslint.json | 1 + types/pouchdb-http/index.d.ts | 6 +++++- types/pouchdb-http/pouchdb-http-tests.ts | 4 +++- types/pouchdb-http/tslint.json | 1 + types/pouchdb-node/index.d.ts | 6 +++++- types/pouchdb-node/pouchdb-node-tests.ts | 4 +++- types/pouchdb-node/tslint.json | 1 + types/pouchdb/index.d.ts | 6 +++++- types/pouchdb/pouchdb-tests.ts | 6 ++++-- types/pouchdb/tslint.json | 1 + 12 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 types/pouchdb-browser/tslint.json create mode 100644 types/pouchdb-http/tslint.json create mode 100644 types/pouchdb-node/tslint.json create mode 100644 types/pouchdb/tslint.json diff --git a/types/pouchdb-browser/index.d.ts b/types/pouchdb-browser/index.d.ts index 94f942302c..3872feef98 100644 --- a/types/pouchdb-browser/index.d.ts +++ b/types/pouchdb-browser/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for pouchdb-browser v6.1.2 +// Type definitions for pouchdb-browser 6.1 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// @@ -10,6 +11,9 @@ /// /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare module 'pouchdb-browser' { const PouchDb: PouchDB.Static; export = PouchDb; diff --git a/types/pouchdb-browser/pouchdb-browser-tests.ts b/types/pouchdb-browser/pouchdb-browser-tests.ts index faaa5b5d21..29b8d55b5a 100644 --- a/types/pouchdb-browser/pouchdb-browser-tests.ts +++ b/types/pouchdb-browser/pouchdb-browser-tests.ts @@ -1,5 +1,7 @@ function testConstructor() { - type MyModel = { numericProperty: number }; + interface MyModel { + numericProperty: number; + } let model: PouchDB.Core.Document; let db = new PouchDB(null, { diff --git a/types/pouchdb-browser/tslint.json b/types/pouchdb-browser/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-browser/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/pouchdb-http/index.d.ts b/types/pouchdb-http/index.d.ts index 8dde8993e9..8c5dfd3104 100644 --- a/types/pouchdb-http/index.d.ts +++ b/types/pouchdb-http/index.d.ts @@ -1,11 +1,15 @@ -// Type definitions for pouchdb-http v6.1.2 +// Type definitions for pouchdb-http 6.1 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare module 'pouchdb-http' { const PouchDb: PouchDB.Static; export = PouchDb; diff --git a/types/pouchdb-http/pouchdb-http-tests.ts b/types/pouchdb-http/pouchdb-http-tests.ts index 05a0f1667d..ebf0b04bed 100644 --- a/types/pouchdb-http/pouchdb-http-tests.ts +++ b/types/pouchdb-http/pouchdb-http-tests.ts @@ -1,5 +1,7 @@ function testConstructor() { - type MyModel = { numericProperty: number }; + interface MyModel { + numericProperty: number; + } let model: PouchDB.Core.Document; let db = new PouchDB('myDb', { diff --git a/types/pouchdb-http/tslint.json b/types/pouchdb-http/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-http/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/pouchdb-node/index.d.ts b/types/pouchdb-node/index.d.ts index aed20c7192..c0f48adb23 100644 --- a/types/pouchdb-node/index.d.ts +++ b/types/pouchdb-node/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for pouchdb-node v6.1.2 +// Type definitions for pouchdb-node 6.1 // Project: https://pouchdb.com/ // Definitions by: Simon Paulger , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// @@ -9,6 +10,9 @@ /// /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare namespace PouchDB { namespace Core { interface DatabaseInfo { diff --git a/types/pouchdb-node/pouchdb-node-tests.ts b/types/pouchdb-node/pouchdb-node-tests.ts index 107dcf00e8..21b42558f0 100644 --- a/types/pouchdb-node/pouchdb-node-tests.ts +++ b/types/pouchdb-node/pouchdb-node-tests.ts @@ -1,5 +1,7 @@ function testConstructor() { - type MyModel = { numericProperty: number }; + interface MyModel { + numericProperty: number; + } let model: PouchDB.Core.Document; let db = new PouchDB('myDb', { diff --git a/types/pouchdb-node/tslint.json b/types/pouchdb-node/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb-node/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/pouchdb/index.d.ts b/types/pouchdb/index.d.ts index e14e4c421f..48bc6279ff 100644 --- a/types/pouchdb/index.d.ts +++ b/types/pouchdb/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for pouchdb v6.1.2 +// Type definitions for pouchdb 6.1 // Project: https://pouchdb.com/ // Definitions by: Andy Brown , Brian Geppert , Frederico Galvão // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// /// @@ -18,6 +19,9 @@ /// /// +// TODO: Fixing this lint error will require a large refactor +/* tslint:disable:no-single-declare-module */ + declare module 'pouchdb' { const plugin: PouchDB.Static; export = plugin; diff --git a/types/pouchdb/pouchdb-tests.ts b/types/pouchdb/pouchdb-tests.ts index ef7da0fd83..25e3861b99 100644 --- a/types/pouchdb/pouchdb-tests.ts +++ b/types/pouchdb/pouchdb-tests.ts @@ -19,7 +19,7 @@ function testAllDocs() { // check document property isNumber(doc.foo); - }) + }); }); db.allDocs({ startkey: "a", endkey: "b" }); @@ -48,7 +48,9 @@ function testDestroy() { } function testBasics() { - type MyModel = { property: 'someProperty '}; + interface MyModel { + property: 'someProperty '; + } let model: PouchDB.Core.Document; const id = 'model'; diff --git a/types/pouchdb/tslint.json b/types/pouchdb/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouchdb/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 3c705e898c7b45cc17386d0ebab0288f8a50cb43 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 15:13:04 -0400 Subject: [PATCH 128/286] Update and lint pouch-redux-middleware --- types/pouch-redux-middleware/index.d.ts | 41 +++++++++---------- .../pouch-redux-middleware-tests.ts | 18 ++++---- types/pouch-redux-middleware/tslint.json | 1 + 3 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 types/pouch-redux-middleware/tslint.json diff --git a/types/pouch-redux-middleware/index.d.ts b/types/pouch-redux-middleware/index.d.ts index 2e940e819d..e0e3691de6 100644 --- a/types/pouch-redux-middleware/index.d.ts +++ b/types/pouch-redux-middleware/index.d.ts @@ -1,34 +1,33 @@ -// Type definitions for pouch-redux-middleware 0.5.0 +// Type definitions for pouch-redux-middleware 0.5 // Project: https://github.com/pgte/pouch-redux-middleware // Definitions by: Adam Charron // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -import { Dispatch, Action, Middleware } from 'redux' -import * as PouchDB from 'pouchdb' +import { Dispatch, Action, Middleware } from 'redux'; +import * as PouchDB from 'pouchdb'; export interface Document { _id: any; - [field: string]: any + [field: string]: any; } export interface Path { - path: string - db: PouchDB.Database - scheduleRemove?: (doc: Document) => void - scheduleInset?: (doc: Document) => void - propagateDelete?: (doc: Document, dispatch: Dispatch) => void - propagateInsert?: (doc: Document, dispatch: Dispatch) => void - propagateUpdate?: (doc: Document, dispatch: Dispatch) => void - handleResponse?: (err: Error, data: any, errorCallback: (err: Error) => void) => void - queue?: Function - docs?: any + path: string; + db: PouchDB.Database; + scheduleRemove?(doc: Document): void; + scheduleInset?(doc: Document): void; + propagateDelete?(doc: Document, dispatch: Dispatch): void; + propagateInsert?(doc: Document, dispatch: Dispatch): void; + propagateUpdate?(doc: Document, dispatch: Dispatch): void; + handleResponse?(err: Error, data: any, errorCallback: (err: Error) => void): void; + queue?(...args: any[]): any; + docs?: any; actions: { - remove: (doc: Document) => Action - update: (doc: Document) => Action - insert: (doc: Document) => Action - } + remove(doc: Document): Action; + update(doc: Document): Action; + insert(doc: Document): Action; + }; } -export default function PouchMiddlewareFactory(paths?: Path[] | Path): Middleware - - +export default function PouchMiddlewareFactory(paths?: Path[] | Path): Middleware; diff --git a/types/pouch-redux-middleware/pouch-redux-middleware-tests.ts b/types/pouch-redux-middleware/pouch-redux-middleware-tests.ts index 1ae6493175..bacd6c4b7a 100644 --- a/types/pouch-redux-middleware/pouch-redux-middleware-tests.ts +++ b/types/pouch-redux-middleware/pouch-redux-middleware-tests.ts @@ -1,22 +1,22 @@ -import * as redux from 'redux' -import makePouchMiddleware, { Document, Path } from 'pouch-redux-middleware' +import * as redux from 'redux'; +import makePouchMiddleware, { Document, Path } from 'pouch-redux-middleware'; import * as PouchDB from 'pouchdb'; const types = { DELETE_TODO: 'delete-todo', INSERT_TODO: 'insert-todo', UPDATE_TODO: 'update-todo' -} +}; const path: Path = { path: "/test", db: new PouchDB('test'), actions: { - remove: doc => { return { type: types.DELETE_TODO, id: doc._id } }, - insert: doc => { return { type: types.INSERT_TODO, todo: doc } }, - update: doc => { return { type: types.UPDATE_TODO, todo: doc } }, + remove: doc => ({ type: types.DELETE_TODO, id: doc._id }), + insert: doc => ({ type: types.INSERT_TODO, todo: doc }), + update: doc => ({ type: types.UPDATE_TODO, todo: doc }), } -} +}; -const middleware: redux.Middleware = makePouchMiddleware(path) -const otherMiddleware: redux.Middleware = makePouchMiddleware([path, path, path]) +const middleware: redux.Middleware = makePouchMiddleware(path); +const otherMiddleware: redux.Middleware = makePouchMiddleware([path, path, path]); diff --git a/types/pouch-redux-middleware/tslint.json b/types/pouch-redux-middleware/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/pouch-redux-middleware/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 270ade8beec568fbe5fbdb0913e8d8a24b9544c8 Mon Sep 17 00:00:00 2001 From: Matthew Tebbs Date: Thu, 8 Jun 2017 13:42:12 -0700 Subject: [PATCH 129/286] three: Fixed declaration for class PolyhedronGeometry in three-core.d.ts to use number arrays and not Vector3/Face3 arrays. --- types/three/three-core.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 5679c4e8c7..4321f11501 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -6488,11 +6488,11 @@ export class PlaneGeometry extends Geometry { } export class PolyhedronGeometry extends Geometry { - constructor(vertices: Vector3[], faces: Face3[], radius?: number, detail?: number); + constructor(vertices: number[], indices: number[], radius?: number, detail?: number); parameters: { - vertices: Vector3[]; - faces: Face3[]; + vertices: number[]; + indices: number[]; radius: number; detail: number; }; From 2a8dcade032af2a718d013185b7e55f9e232f157 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 17:19:16 -0400 Subject: [PATCH 130/286] Replace pouchdb-core get open revision overloads --- types/pouchdb-core/index.d.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index 71fdb011b6..933dfbf6a5 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -522,15 +522,26 @@ declare namespace PouchDB { /** Fetch a document */ get(docId: Core.DocumentId, - options: Core.GetOptions | Core.GetOpenRevisions | null, + options: Core.GetOptions | null, callback: Core.Callback & Core.GetMeta> ): void; + /** Fetch a document */ + get(docId: Core.DocumentId, + options: Core.GetOpenRevisions, + callback: Core.Callback>> + ): void; + /** Fetch a document */ get(docId: Core.DocumentId, options?: Core.GetOptions | Core.GetOpenRevisions ): Promise & Core.GetMeta>; + /** Fetch a document */ + get(docId: Core.DocumentId, + options: Core.GetOpenRevisions + ): Promise>>; + /** Create a new document without providing an id. * * You should prefer put() to post(), because when you post(), you are From 2305d1e38df2c75362d842fd58a3d7267d980a30 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 18:38:05 -0400 Subject: [PATCH 131/286] Remove union type in pouchdb-core The union is covered by the overload. --- types/pouchdb-core/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/pouchdb-core/index.d.ts b/types/pouchdb-core/index.d.ts index 933dfbf6a5..59d60be2e0 100644 --- a/types/pouchdb-core/index.d.ts +++ b/types/pouchdb-core/index.d.ts @@ -534,7 +534,7 @@ declare namespace PouchDB { /** Fetch a document */ get(docId: Core.DocumentId, - options?: Core.GetOptions | Core.GetOpenRevisions + options?: Core.GetOptions ): Promise & Core.GetMeta>; /** Fetch a document */ From 37e857614e2b3c7f622bb305be9ad8f075ff62bf Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 18:59:03 -0400 Subject: [PATCH 132/286] Generic map/reduce parameters for pouchdb-mapreduce --- types/pouchdb-mapreduce/index.d.ts | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/types/pouchdb-mapreduce/index.d.ts b/types/pouchdb-mapreduce/index.d.ts index 7b398d730b..b9a05ff7d6 100644 --- a/types/pouchdb-mapreduce/index.d.ts +++ b/types/pouchdb-mapreduce/index.d.ts @@ -10,9 +10,9 @@ /* tslint:disable:no-single-declare-module */ declare namespace PouchDB { - interface Filter { - map(doc: any): void; - reduce?(key: string, value: any): any; + interface Filter { + map(doc: Content): void; + reduce?(key: string, value: Content): Reduction; } namespace Query { @@ -94,17 +94,32 @@ declare namespace PouchDB { * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Filter | ((doc: any) => void), opts: Query.Options, callback: (err: Core.Error, res: Query.Response) => void): void; + query(fun: string | ((doc: Content & Model) => void), opts: Query.Options, callback: (err: Core.Error, res: Query.Response) => void): void; /** * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Filter | ((doc: any) => void), callback: (err: Core.Error, res: Query.Response) => void): void; + query(fun: Filter, opts: Query.Options, callback: (err: Core.Error, res: Query.Response) => void): void; /** * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Filter | ((doc: any) => void), opts?: Query.Options): Promise>; + query(fun: string | ((doc: Content & Model) => void), callback: (err: Core.Error, res: Query.Response) => void): void; + /** + * Invoke a map/reduce function, which allows you to perform more complex queries + * on PouchDB than what you get with allDocs(). + */ + query(fun: Filter, callback: (err: Core.Error, res: Query.Response) => void): void; + /** + * Invoke a map/reduce function, which allows you to perform more complex queries + * on PouchDB than what you get with allDocs(). + */ + query(fun: string | ((doc: Content & Model) => void), opts?: Query.Options): Promise>; + /** + * Invoke a map/reduce function, which allows you to perform more complex queries + * on PouchDB than what you get with allDocs(). + */ + query(fun: Filter, opts?: Query.Options): Promise>; } } From b47f2db564c54f8145a791fe197d7092c9b677c0 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 9 Jun 2017 01:07:26 +0100 Subject: [PATCH 133/286] Added documentation --- types/nodegit/cert.d.ts | 6 + types/nodegit/clone-options.d.ts | 48 +++ types/nodegit/clone.d.ts | 21 ++ types/nodegit/commit.d.ts | 326 ++++++++++++++++++++- types/nodegit/config.d.ts | 69 +++++ types/nodegit/convenient-patch.d.ts | 119 ++++++++ types/nodegit/cred-user-pass-payload.d.ts | 12 + types/nodegit/cred-username.d.ts | 12 + types/nodegit/cred.d.ts | 78 ++++- types/nodegit/cvar-map.d.ts | 18 ++ types/nodegit/describe-format-options.d.ts | 24 ++ types/nodegit/describe-options.d.ts | 36 +++ types/nodegit/diff-binary-file.d.ts | 24 ++ types/nodegit/diff-binary.d.ts | 19 ++ types/nodegit/diff-file.d.ts | 35 +++ types/nodegit/diff-hunk.d.ts | 36 +++ types/nodegit/diff-line.d.ts | 51 ++++ types/nodegit/diff-options.d.ts | 103 ++++++- types/nodegit/diff-perf-data.d.ts | 18 ++ types/nodegit/diff.d.ts | 212 +++++++++++++- types/nodegit/error.d.ts | 12 + types/nodegit/fetch-options.d.ts | 45 +++ types/nodegit/fetch.d.ts | 10 + types/nodegit/filter.d.ts | 108 +++++++ types/nodegit/git-err.d.ts | 34 ++- types/nodegit/graph.d.ts | 22 ++ types/nodegit/ignore.d.ts | 29 ++ 27 files changed, 1500 insertions(+), 27 deletions(-) diff --git a/types/nodegit/cert.d.ts b/types/nodegit/cert.d.ts index fde86569b9..c368f83bb6 100644 --- a/types/nodegit/cert.d.ts +++ b/types/nodegit/cert.d.ts @@ -13,5 +13,11 @@ export namespace Cert { } export class Cert { + /** + * + * + * @type {Cert.TYPE} + * @memberof Cert + */ certType: Cert.TYPE; } diff --git a/types/nodegit/clone-options.d.ts b/types/nodegit/clone-options.d.ts index 8535b28c81..424a289cbe 100644 --- a/types/nodegit/clone-options.d.ts +++ b/types/nodegit/clone-options.d.ts @@ -2,12 +2,60 @@ import { CheckoutOptions } from './checkout-options'; import { FetchOptions } from './fetch-options'; export class CloneOptions { + /** + * + * + * @type {number} + * @memberof CloneOptions + */ version?: number; + /** + * + * + * @type {CheckoutOptions} + * @memberof CloneOptions + */ checkoutOpts?: CheckoutOptions; + /** + * + * + * @type {FetchOptions} + * @memberof CloneOptions + */ fetchOpts?: FetchOptions; + /** + * + * + * @type {number} + * @memberof CloneOptions + */ bare?: number; + /** + * + * + * @type {number} + * @memberof CloneOptions + */ local?: number; + /** + * + * + * @type {string} + * @memberof CloneOptions + */ checkoutBranch?: string; + /** + * + * + * @type {*} + * @memberof CloneOptions + */ repositoryCbPayload?: any; + /** + * + * + * @type {*} + * @memberof CloneOptions + */ remoteCbPayload?: any; } diff --git a/types/nodegit/clone.d.ts b/types/nodegit/clone.d.ts index c038a8e26a..61f8cfe2cf 100644 --- a/types/nodegit/clone.d.ts +++ b/types/nodegit/clone.d.ts @@ -11,6 +11,27 @@ export namespace Clone { } export class Clone { + /** + * Patch repository cloning to automatically coerce objects. + * + * @static + * @param {string} url + * @param {string} local_path + * @param {CloneOptions} [options] + * @returns {Promise} + * + * @memberof Clone + */ static clone(url: string, local_path: string, options?: CloneOptions): Promise; + /** + * + * + * @static + * @param {CloneOptions} opts + * @param {number} version + * @returns {number} + * + * @memberof Clone + */ static initOptions(opts: CloneOptions, version: number): number; } diff --git a/types/nodegit/commit.d.ts b/types/nodegit/commit.d.ts index 24ee08cc48..247fdb102d 100644 --- a/types/nodegit/commit.d.ts +++ b/types/nodegit/commit.d.ts @@ -10,40 +10,360 @@ import { TreeEntry } from './tree-entry'; import { Diff } from './diff'; export class Commit { - static create(repo: Repository, update_ref: string, author: Signature, committer: Signature, message_encoding: string, message: string, tree: Tree, parent_count: number, parents: any[]): Oid; - static createV(id: Oid, repo: Repository, update_ref: string, author: Signature, committer: Signature, message_encoding: string, message: string, tree: Tree, parent_count: number): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} updateRef + * @param {Signature} author + * @param {Signature} committer + * @param {string} messageEncoding + * @param {string} message + * @param {Tree} tree + * @param {number} parentCount + * @param {any[]} parents + * @returns {Oid} + * + * @memberof Commit + */ + static create(repo: Repository, updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree, parentCount: number, parents: any[]): Oid; + /** + * + * + * @static + * @param {Oid} id + * @param {Repository} repo + * @param {string} updateRef + * @param {Signature} author + * @param {Signature} committer + * @param {string} messageEncoding + * @param {string} message + * @param {Tree} tree + * @param {number} parentCount + * @returns {number} + * + * @memberof Commit + */ + static createV(id: Oid, repo: Repository, updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree, parentCount: number): number; + /** + * Retrieves the commit pointed to by the oid + * + * @static + * @param {Repository} repo + * @param {(string | Oid | Commit)} id + * @returns {Promise} + * + * @memberof Commit + */ static lookup(repo: Repository, id: string | Oid | Commit): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Oid} id + * @param {number} len + * @returns {Promise} + * + * @memberof Commit + */ static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} commitContent + * @param {string} signature + * @param {string} signatureField + * @returns {Promise} + * + * @memberof Commit + */ + static createWithSignature(repo: Repository, commitContent: string, signature: string, signatureField: string): Promise; - amend(update_ref: string, author: Signature, committer: Signature, message_encoding: string, message: string, tree: Tree): Oid; + /** + * + * + * @param {string} updateRef + * @param {Signature} author + * @param {Signature} committer + * @param {string} messageEncoding + * @param {string} message + * @param {Tree} tree + * @returns {Oid} + * + * @memberof Commit + */ + amend(updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree): Oid; + /** + * + * + * @returns {Signature} + * + * @memberof Commit + */ author(): Signature; + /** + * + * + * @returns {Signature} + * + * @memberof Commit + */ committer(): Signature; + /** + * + * + * + * @memberof Commit + */ free(): void; + /** + * + * + * @param {string} field + * @returns {Promise} + * + * @memberof Commit + */ headerField(field: string): Promise; + /** + * + * + * @returns {Oid} + * + * @memberof Commit + */ id(): Oid; + /** + * + * + * @returns {string} + * + * @memberof Commit + */ message(): string; + /** + * + * + * @returns {string} + * + * @memberof Commit + */ messageEncoding(): string; + /** + * + * + * @returns {string} + * + * @memberof Commit + */ messageRaw(): string; + /** + * + * + * @param {number} n + * @returns {Promise} + * + * @memberof Commit + */ nthGenAncestor(n: number): Promise; + /** + * + * + * @returns {Repository} + * + * @memberof Commit + */ owner(): Repository; + /** + * + * + * @param {number} n + * @returns {Promise} + * + * @memberof Commit + */ parent(n: number): Promise; + /** + * + * + * @param {number} n + * @returns {Oid} + * + * @memberof Commit + */ parentId(n: number): Oid; + /** + * + * + * @returns {number} + * + * @memberof Commit + */ parentcount(): number; + /** + * + * + * @returns {string} + * + * @memberof Commit + */ rawHeader(): string; + /** + * + * + * @returns {string} + * + * @memberof Commit + */ summary(): string; + /** + * + * + * @returns {number} + * + * @memberof Commit + */ time(): number; + /** + * + * + * @returns {number} + * + * @memberof Commit + */ timeOffset(): number; + /** + * + * + * @param {Tree} tree_out + * @returns {number} + * + * @memberof Commit + */ tree(tree_out: Tree): number; + /** + * + * + * @returns {Oid} + * + * @memberof Commit + */ treeId(): Oid; + /** + * Retrieve the SHA. + * + * @returns {string} + * + * @memberof Commit + */ sha(): string; + /** + * Retrieve the commit time as a unix timestamp. + * + * @returns {number} + * + * @memberof Commit + */ timeMs(): number; + /** + * Retrieve the commit time as a Date object. + * + * @returns {Date} + * + * @memberof Commit + */ date(): Date; + /** + * Get the tree associated with this commit. + * + * @returns {Promise} + * + * @memberof Commit + */ getTree(): Promise; + /** + * Retrieve the entry represented by path for this commit. Path must be relative to repository root. + * + * @param {string} path + * @returns {Promise} + * + * @memberof Commit + */ getEntry(path: string): Promise; + /** + * Walk the history from this commit backwards. + * An EventEmitter is returned that will emit a "commit" event for each commit in the history, and one "end" + * event when the walk is completed. Don't forget to call start() on the returned event. + * + * @returns {EventEmitter} + * + * @memberof Commit + */ history(): EventEmitter; + /** + * Retrieve the commit's parents as commit objects. + * + * @param {number} limit + * @param {Function} callback + * @returns {Promise} + * + * @memberof Commit + */ getParents(limit: number, callback: Function): Promise; + /** + * Retrieve the commit's parent shas. + * + * @param {Function} callback + * @returns {Oid[]} + * + * @memberof Commit + */ parents(callback: Function): Oid[]; + /** + * Generate an array of diff trees showing changes between this commit and its parent(s). + * + * @param {Function} callback + * @returns {Promise} + * + * @memberof Commit + */ getDiff(callback: Function): Promise; + /** + * Generate an array of diff trees showing changes between this commit and its parent(s). + * + * @param {Object} options + * @param {Function} callback + * @returns {Promise} + * + * @memberof Commit + */ getDiffWithOptions(options: Object, callback: Function): Promise; + /** + * The sha of this commit + * + * @returns {string} + * + * @memberof Commit + */ toString(): string; + /** + * + * + * @returns {Promise} + * + * @memberof Commit + */ + dup(): Promise; + /** + * consists of a summary + * + * @returns {string} + * + * @memberof Commit + */ + body(): string; } diff --git a/types/nodegit/config.d.ts b/types/nodegit/config.d.ts index ea61c52d3c..eea13c6c70 100644 --- a/types/nodegit/config.d.ts +++ b/types/nodegit/config.d.ts @@ -12,11 +12,80 @@ export namespace Config { } export class Config { + /** + * + * + * @static + * @returns {Promise} + * + * @memberof Config + */ static openDefault(): Promise; + /** + * + * + * @static + * @returns {Promise} + * + * @memberof Config + */ + static findProgramdata(): Promise; + /** + * + * + * @param {string} name + * @returns {Promise} + * + * @memberof Config + */ getStringBuf(name: string): Promise; + /** + * + * + * @param {string} name + * @param {number} value + * @returns {number} + * + * @memberof Config + */ setInt64(name: string, value: number): number; + /** + * + * + * @param {string} name + * @param {string} regexp + * @param {string} value + * @returns {number} + * + * @memberof Config + */ setMultivar(name: string, regexp: string, value: string): number; + /** + * + * + * @param {string} name + * @param {string} value + * @returns {Promise} + * + * @memberof Config + */ setString(name: string, value: string): Promise; + /** + * + * + * @returns {Promise} + * + * @memberof Config + */ snapshot(): Promise; + /** + * + * + * @param {*} transaction + * @returns {number} + * + * @memberof Config + */ + lock(transaction: any): number; } diff --git a/types/nodegit/convenient-patch.d.ts b/types/nodegit/convenient-patch.d.ts index 8dee260aa0..b03bb2ff54 100644 --- a/types/nodegit/convenient-patch.d.ts +++ b/types/nodegit/convenient-patch.d.ts @@ -1,21 +1,140 @@ import { DiffFile } from './diff-file'; export class ConvenientPatch { + /** + * Old attributes of the file + * + * @returns {DiffFile} + * + * @memberof ConvenientPatch + */ oldFile(): DiffFile; + /** + * New attributes of the file + * + * @returns {DiffFile} + * + * @memberof ConvenientPatch + */ newFile(): DiffFile; + /** + * The number of hunks in this patch + * + * @returns {number} + * + * @memberof ConvenientPatch + */ size(): number; + /** + * The hunks in this patch + * + * @returns {Promise} + * + * @memberof ConvenientPatch + */ hunks(): Promise; + /** + * The status of this patch (unmodified, added, deleted) + * + * @returns {number} + * + * @memberof ConvenientPatch + */ status(): number; + /** + * The line statistics of this patch (#contexts, #added, #deleted) + * + * @returns {*} + * + * @memberof ConvenientPatch + */ lineStats(): any; + /** + * Is this an unmodified patch? + * + * @returns {Boolean} + * + * @memberof ConvenientPatch + */ isUnmodified(): Boolean; + /** + * Is this an added patch? + * + * @returns {Boolean} + * + * @memberof ConvenientPatch + */ isAdded(): Boolean; + /** + * Is this a deleted patch? + * + * @returns {Boolean} + * + * @memberof ConvenientPatch + */ isDeleted(): Boolean; + /** + * Is this an modified patch? + * + * @returns {Boolean} + * + * @memberof ConvenientPatch + */ isModified(): Boolean; + /** + * Is this a renamed patch? + * + * @returns {Boolean} + * + * @memberof ConvenientPatch + */ isRenamed(): Boolean; + /** + * Is this a copied patch? + * + * @returns {Boolean} + * + * @memberof ConvenientPatch + */ isCopied(): Boolean; + /** + * Is this an ignored patch? + * + * @returns {Boolean} + * + * @memberof ConvenientPatch + */ isIgnored(): Boolean; + /** + * Is this an untracked patch? + * + * @returns {Boolean} + * + * @memberof ConvenientPatch + */ isUntracked(): Boolean; + /** + * Is this a type change? + * + * @returns {Boolean} + * + * @memberof ConvenientPatch + */ isTypeChange(): Boolean; + /** + * Is this an undreadable patch? + * + * @returns {Boolean} + * + * @memberof ConvenientPatch + */ isUnreadable(): Boolean; + /** + * Is this a conflicted patch? + * + * @returns {Boolean} + * + * @memberof ConvenientPatch + */ isConflicted(): Boolean; } diff --git a/types/nodegit/cred-user-pass-payload.d.ts b/types/nodegit/cred-user-pass-payload.d.ts index 95beeb9f3a..fdf65b9342 100644 --- a/types/nodegit/cred-user-pass-payload.d.ts +++ b/types/nodegit/cred-user-pass-payload.d.ts @@ -1,4 +1,16 @@ export class CredUserpassPayload { + /** + * + * + * @type {string} + * @memberof CredUserpassPayload + */ username: string; + /** + * + * + * @type {string} + * @memberof CredUserpassPayload + */ password: string; } diff --git a/types/nodegit/cred-username.d.ts b/types/nodegit/cred-username.d.ts index d7b619eb5d..2522b3968a 100644 --- a/types/nodegit/cred-username.d.ts +++ b/types/nodegit/cred-username.d.ts @@ -1,6 +1,18 @@ import { Cred } from './cred'; export class CredUsername { + /** + * + * + * @type {Cred} + * @memberof CredUsername + */ parent: Cred; + /** + * + * + * @type {string} + * @memberof CredUsername + */ username: string; } diff --git a/types/nodegit/cred.d.ts b/types/nodegit/cred.d.ts index 9de014311b..d7b96c9fd8 100644 --- a/types/nodegit/cred.d.ts +++ b/types/nodegit/cred.d.ts @@ -11,12 +11,86 @@ export namespace Cred { } export class Cred { + /** + * + * + * @static + * @returns {Cred} + * + * @memberof Cred + */ static defaultNew(): Cred; + /** + * + * + * @static + * @param {string} username + * @returns {Cred} + * + * @memberof Cred + */ static sshKeyFromAgent(username: string): Cred; - static sshKeyMemoryNew(username: string, publickey: string, privatekey: string, passphrase: string): Promise; - static sshKeyNew(username: string, publickey: string, privatekey: string, passphrase: string): Cred; + /** + * + * + * @static + * @param {string} username + * @param {string} publicKey + * @param {string} privateKey + * @param {string} passphrase + * @returns {Promise} + * + * @memberof Cred + */ + static sshKeyMemoryNew(username: string, publicKey: string, privateKey: string, passphrase: string): Promise; + /** + * + * + * @static + * @param {string} username + * @param {string} publicKey + * @param {string} privateKey + * @param {string} passphrase + * @returns {Cred} + * + * @memberof Cred + */ + static sshKeyNew(username: string, publicKey: string, privateKey: string, passphrase: string): Cred; + /** + * + * + * @static + * @param {string} username + * @returns {Promise} + * + * @memberof Cred + */ static usernameNew(username: string): Promise; + /** + * + * + * @static + * @param {string} username + * @param {string} password + * @returns {Cred} + * + * @memberof Cred + */ static userpassPlaintextNew(username: string, password: string): Cred; + /** + * + * + * @returns {number} + * + * @memberof Cred + */ hasUsername(): number; + /** + * + * + * + * @memberof Cred + */ + free(): void; } diff --git a/types/nodegit/cvar-map.d.ts b/types/nodegit/cvar-map.d.ts index f7c4b227d0..2a5665dc6b 100644 --- a/types/nodegit/cvar-map.d.ts +++ b/types/nodegit/cvar-map.d.ts @@ -1,5 +1,23 @@ export class CvarMap { + /** + * + * + * @type {number} + * @memberof CvarMap + */ cvarType: number; + /** + * + * + * @type {string} + * @memberof CvarMap + */ strMatch: string; + /** + * + * + * @type {number} + * @memberof CvarMap + */ mapValue: number; } diff --git a/types/nodegit/describe-format-options.d.ts b/types/nodegit/describe-format-options.d.ts index ecb7f4d762..4a67cd9082 100644 --- a/types/nodegit/describe-format-options.d.ts +++ b/types/nodegit/describe-format-options.d.ts @@ -1,6 +1,30 @@ export class DescribeFormatOptions { + /** + * + * + * @type {number} + * @memberof DescribeFormatOptions + */ version: number; + /** + * + * + * @type {number} + * @memberof DescribeFormatOptions + */ abbreviatedSize: number; + /** + * + * + * @type {number} + * @memberof DescribeFormatOptions + */ alwaysUseLongFormat: number; + /** + * + * + * @type {string} + * @memberof DescribeFormatOptions + */ dirtySuffix: string; } diff --git a/types/nodegit/describe-options.d.ts b/types/nodegit/describe-options.d.ts index 939750eb11..f860bb88e9 100644 --- a/types/nodegit/describe-options.d.ts +++ b/types/nodegit/describe-options.d.ts @@ -1,8 +1,44 @@ export class DescribeOptions { + /** + * + * + * @type {number} + * @memberof DescribeOptions + */ version: number; + /** + * + * + * @type {number} + * @memberof DescribeOptions + */ maxCandidatesTags: number; + /** + * + * + * @type {number} + * @memberof DescribeOptions + */ describeStrategy: number; + /** + * + * + * @type {string} + * @memberof DescribeOptions + */ pattern: string; + /** + * + * + * @type {number} + * @memberof DescribeOptions + */ onlyFollowFirstParent: number; + /** + * + * + * @type {number} + * @memberof DescribeOptions + */ showCommitOidAsFallback: number; } diff --git a/types/nodegit/diff-binary-file.d.ts b/types/nodegit/diff-binary-file.d.ts index 46b67f406e..9774b99b87 100644 --- a/types/nodegit/diff-binary-file.d.ts +++ b/types/nodegit/diff-binary-file.d.ts @@ -1,6 +1,30 @@ export class DiffBinaryFile { + /** + * + * + * @type {number} + * @memberof DiffBinaryFile + */ type: number; + /** + * + * + * @type {string} + * @memberof DiffBinaryFile + */ data: string; + /** + * + * + * @type {number} + * @memberof DiffBinaryFile + */ datalen: number; + /** + * + * + * @type {number} + * @memberof DiffBinaryFile + */ inflatedlen: number; } diff --git a/types/nodegit/diff-binary.d.ts b/types/nodegit/diff-binary.d.ts index d01181c92a..f447510165 100644 --- a/types/nodegit/diff-binary.d.ts +++ b/types/nodegit/diff-binary.d.ts @@ -9,6 +9,25 @@ export namespace DiffBinary { } export class DiffBinary { + /** + * + * + * @type {DiffBinaryFile} + * @memberof DiffBinary + */ oldFile: DiffBinaryFile; + /** + * + * + * @type {DiffBinaryFile} + * @memberof DiffBinary + */ newFile: DiffBinaryFile; + /** + * + * + * @type {DiffBinary.DIFF_BINARY} + * @memberof DiffBinary + */ + containsData: DiffBinary.DIFF_BINARY; } diff --git a/types/nodegit/diff-file.d.ts b/types/nodegit/diff-file.d.ts index 99646ec08b..7602f0dba9 100644 --- a/types/nodegit/diff-file.d.ts +++ b/types/nodegit/diff-file.d.ts @@ -1,9 +1,44 @@ import { Oid } from './oid'; export class DiffFile { + /** + * Returns the file's flags + * + * @returns {number} + * + * @memberof DiffFile + */ flags(): number; + /** + * Returns the file's Oid + * + * @returns {Oid} + * + * @memberof DiffFile + */ id(): Oid; + /** + * Returns the file's mode + * + * @returns {number} + * + * @memberof DiffFile + */ mode(): number; + /** + * Returns the file's path + * + * @returns {string} + * + * @memberof DiffFile + */ path(): string; + /** + * Returns the file's size + * + * @returns {number} + * + * @memberof DiffFile + */ size(): number; } diff --git a/types/nodegit/diff-hunk.d.ts b/types/nodegit/diff-hunk.d.ts index 14a1a9a304..1a522ae8c6 100644 --- a/types/nodegit/diff-hunk.d.ts +++ b/types/nodegit/diff-hunk.d.ts @@ -1,8 +1,44 @@ export class DiffHunk { + /** + * + * + * @type {number} + * @memberof DiffHunk + */ oldStart: number; + /** + * + * + * @type {number} + * @memberof DiffHunk + */ oldLines: number; + /** + * + * + * @type {number} + * @memberof DiffHunk + */ newStart: number; + /** + * + * + * @type {number} + * @memberof DiffHunk + */ newLines: number; + /** + * + * + * @type {number} + * @memberof DiffHunk + */ headerLen: number; + /** + * + * + * @type {string} + * @memberof DiffHunk + */ header: string; } diff --git a/types/nodegit/diff-line.d.ts b/types/nodegit/diff-line.d.ts index 587653b09f..612041a92d 100644 --- a/types/nodegit/diff-line.d.ts +++ b/types/nodegit/diff-line.d.ts @@ -1,9 +1,60 @@ export class DiffLine { + /** + * The relevant line + * + * @returns {string} + * + * @memberof DiffLine + */ content(): string; + /** + * The non utf8 translated text + * + * @returns {string} + * + * @memberof DiffLine + */ + rawContent(): string; + /** + * + * + * @type {number} + * @memberof DiffLine + */ origin: number; + /** + * + * + * @type {number} + * @memberof DiffLine + */ oldLineno: number; + /** + * + * + * @type {number} + * @memberof DiffLine + */ newLineno: number; + /** + * + * + * @type {number} + * @memberof DiffLine + */ numLines: number; + /** + * + * + * @type {number} + * @memberof DiffLine + */ contentLen: number; + /** + * + * + * @type {number} + * @memberof DiffLine + */ contentOffset: number; } diff --git a/types/nodegit/diff-options.d.ts b/types/nodegit/diff-options.d.ts index 32dec9943f..c4f28f984f 100644 --- a/types/nodegit/diff-options.d.ts +++ b/types/nodegit/diff-options.d.ts @@ -1,16 +1,95 @@ import { Strarray } from './str-array'; export interface DiffOptions { - version: number; - flags: number; - ignoreSubmodules: number; - pathspec: Strarray; - notifyCb: Function; - notifyPayload: any; - contextLines: number; - interhunkLines: number; - idAbbrev: number; - maxSize: number; - oldPrefix: string; - newPrefix: string; + /** + * + * + * @type {number} + * @memberof DiffOptions + */ + version?: number; + /** + * + * + * @type {number} + * @memberof DiffOptions + */ + flags?: number; + /** + * + * + * @type {number} + * @memberof DiffOptions + */ + ignoreSubmodules?: number; + /** + * + * + * @type {Strarray} + * @memberof DiffOptions + */ + pathspec?: Strarray; + /** + * + * + * @type {Function} + * @memberof DiffOptions + */ + notifyCb?: Function; + /** + * + * + * @type {number} + * @memberof DiffOptions + */ + contextLines?: number; + /** + * + * + * @type {number} + * @memberof DiffOptions + */ + interhunkLines?: number; + /** + * + * + * @type {number} + * @memberof DiffOptions + */ + idAbbrev?: number; + /** + * + * + * @type {number} + * @memberof DiffOptions + */ + maxSize?: number; + /** + * + * + * @type {string} + * @memberof DiffOptions + */ + oldPrefix?: string; + /** + * + * + * @type {string} + * @memberof DiffOptions + */ + newPrefix?: string; + /** + * + * + * @type {*} + * @memberof DiffOptions + */ + payload?: any; + /** + * + * + * @type {*} + * @memberof DiffOptions + */ + progressCb?: any; } diff --git a/types/nodegit/diff-perf-data.d.ts b/types/nodegit/diff-perf-data.d.ts index 5dfca09670..30bae1d2c9 100644 --- a/types/nodegit/diff-perf-data.d.ts +++ b/types/nodegit/diff-perf-data.d.ts @@ -1,5 +1,23 @@ export class DiffPerfdata { + /** + * + * + * @type {number} + * @memberof DiffPerfdata + */ version: number; + /** + * + * + * @type {number} + * @memberof DiffPerfdata + */ statCalls: number; + /** + * + * + * @type {number} + * @memberof DiffPerfdata + */ oidCalculations: number; } diff --git a/types/nodegit/diff.d.ts b/types/nodegit/diff.d.ts index 6926527124..23d3ddf5fc 100644 --- a/types/nodegit/diff.d.ts +++ b/types/nodegit/diff.d.ts @@ -6,15 +6,58 @@ import { Index } from './index_'; import { DiffDelta } from './diff-delta'; import { DiffPerfdata } from './diff-perf-data'; import { DiffOptions } from './diff-options'; +import { Buf } from './buf'; export interface DiffFindOptions { - version: number; - flags: number; - renameThreshold: number; - renameFromRewriteThreshold: number; - copyThreshold: number; - breakRewriteThreshold: number; - renameLimit: number; + /** + * + * + * @type {number} + * @memberof DiffFindOptions + */ + version?: number; + /** + * + * + * @type {number} + * @memberof DiffFindOptions + */ + flags?: number; + /** + * + * + * @type {number} + * @memberof DiffFindOptions + */ + renameThreshold?: number; + /** + * + * + * @type {number} + * @memberof DiffFindOptions + */ + renameFromRewriteThreshold?: number; + /** + * + * + * @type {number} + * @memberof DiffFindOptions + */ + copyThreshold?: number; + /** + * + * + * @type {number} + * @memberof DiffFindOptions + */ + breakRewriteThreshold?: number; + /** + * + * + * @type {number} + * @memberof DiffFindOptions + */ + renameLimit?: number; } export namespace Diff { @@ -125,17 +168,170 @@ export namespace Diff { } export class Diff { + /** + * Directly run a diff between a blob and a buffer. + * + * @static + * @param {Blob} old_blob + * @param {string} oldAsPath + * @param {string} buffer + * @param {string} bufferAsPath + * @param {DiffOptions} opts + * @param {Function} fileCb + * @param {Function} binaryCb + * @param {Function} hunkCb + * @param {Function} lineCb + * @returns {Promise} + * + * @memberof Diff + */ static blobToBuffer(old_blob: Blob, oldAsPath: string, - buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; + buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; + /** + * + * + * @static + * @param {string} content + * @param {number} contentLen + * @returns {Promise} + * + * @memberof Diff + */ + static fromBuffer(content: string, contentLen: number): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Index} index + * @param {DiffOptions} opts + * @returns {Promise} + * + * @memberof Diff + */ static indexToWorkdir(repo: Repository, index: Index, opts: DiffOptions): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Index} oldIndex + * @param {Index} newIndex + * @param {DiffOptions} opts + * @returns {Promise} + * + * @memberof Diff + */ + static indexToIndex(repo: Repository, oldIndex: Index, newIndex: Index, opts: DiffOptions): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Tree} old_tree + * @param {Index} index + * @param {DiffOptions} opts + * @returns {Promise} + * + * @memberof Diff + */ static treeToIndex(repo: Repository, old_tree: Tree, index: Index, opts: DiffOptions): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Tree} old_tree + * @param {Tree} new_tree + * @param {DiffOptions} opts + * @returns {Promise} + * + * @memberof Diff + */ static treeToTree(repo: Repository, old_tree: Tree, new_tree: Tree, opts: DiffOptions): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Tree} old_tree + * @param {DiffOptions} opts + * @returns {Promise} + * + * @memberof Diff + */ static treeToWorkdir(repo: Repository, old_tree: Tree, opts: DiffOptions): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Tree} old_tree + * @param {DiffOptions} opts + * @returns {Promise} + * + * @memberof Diff + */ static treeToWorkdirWithIndex(repo: Repository, old_tree: Tree, opts: DiffOptions): Promise; + /** + * + * + * @param {DiffFindOptions} options + * @returns {Promise} + * + * @memberof Diff + */ findSimilar(options: DiffFindOptions): Promise; + /** + * + * + * @param {number} idx + * @returns {DiffDelta} + * + * @memberof Diff + */ getDelta(idx: number): DiffDelta; + /** + * + * + * @returns {Promise} + * + * @memberof Diff + */ getPerfdata(): Promise; + /** + * + * + * @returns {number} + * + * @memberof Diff + */ numDeltas(): number; + /** + * Retrieve patches in this difflist + * + * @returns {Promise} + * + * @memberof Diff + */ patches(): Promise; + /** + * + * + * @param {Diff} from + * @returns {Promise} + * + * @memberof Diff + */ + merge(from: Diff): Promise; + /** + * + * + * @param {Diff.FORMAT} format + * @returns {Promise} + * + * @memberof Diff + */ + toBuf(format: Diff.FORMAT): Promise; } diff --git a/types/nodegit/error.d.ts b/types/nodegit/error.d.ts index c259749e8b..9acf4cc2cd 100644 --- a/types/nodegit/error.d.ts +++ b/types/nodegit/error.d.ts @@ -63,6 +63,18 @@ export namespace Error { } export class Error { + /** + * + * + * @type {string} + * @memberof Error + */ message: string; + /** + * + * + * @type {number} + * @memberof Error + */ klass: number; } diff --git a/types/nodegit/fetch-options.d.ts b/types/nodegit/fetch-options.d.ts index 1aa26fd974..3b3a1b26c1 100644 --- a/types/nodegit/fetch-options.d.ts +++ b/types/nodegit/fetch-options.d.ts @@ -1,9 +1,54 @@ import { RemoteCallbacks } from './remote-callbacks'; +import { Strarray} from './str-array'; export interface FetchOptions { + /** + * + * + * @type {number} + * @memberof FetchOptions + */ version?: number; + /** + * + * + * @type {RemoteCallbacks} + * @memberof FetchOptions + */ callbacks?: RemoteCallbacks; + /** + * + * + * @type {number} + * @memberof FetchOptions + */ prune?: number; + /** + * + * + * @type {number} + * @memberof FetchOptions + */ updateFetchhead?: number; + /** + * + * + * @type {number} + * @memberof FetchOptions + */ downloadTags?: number; + /** + * + * + * @type {Strarray} + * @memberof FetchOptions + */ + customHeaders?: Strarray; + /** + * + * + * @type {*} + * @memberof FetchOptions + */ + proxyOpts?: any; } diff --git a/types/nodegit/fetch.d.ts b/types/nodegit/fetch.d.ts index db0980586f..b777066629 100644 --- a/types/nodegit/fetch.d.ts +++ b/types/nodegit/fetch.d.ts @@ -9,5 +9,15 @@ export namespace Fetch { } export class Fetch { + /** + * + * + * @static + * @param {FetchOptions} opts + * @param {number} version + * @returns {number} + * + * @memberof Fetch + */ static initOptions(opts: FetchOptions, version: number): number; } diff --git a/types/nodegit/filter.d.ts b/types/nodegit/filter.d.ts index 066a51183e..7b73196ed0 100644 --- a/types/nodegit/filter.d.ts +++ b/types/nodegit/filter.d.ts @@ -19,17 +19,125 @@ export namespace Filter { } export class Filter { + /** + * + * + * @static + * @param {*} filters + * @param {string} name + * @returns {number} + * + * @memberof Filter + */ static listContains(filters: any, name: string): number; + /** + * + * + * @static + * @param {*} fl + * @returns {number} + * + * @memberof Filter + */ static listLength(fl: any): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {number} mode + * @param {number} options + * @returns {Promise} + * + * @memberof Filter + */ static listNew(repo: Repository, mode: number, options: number): Promise; + /** + * + * + * @static + * @param {*} filters + * @param {Blob} blob + * @param {WriteStream} target + * @returns {number} + * + * @memberof Filter + */ static listStreamBlob(filters: any, blob: Blob, target: WriteStream): number; + /** + * + * + * @static + * @param {*} filters + * @param {Buf} data + * @param {WriteStream} target + * @returns {number} + * + * @memberof Filter + */ static listStreamData(filters: any, data: Buf, target: WriteStream): number; + /** + * + * + * @static + * @param {*} filters + * @param {Repository} repo + * @param {string} path + * @param {WriteStream} target + * @returns {number} + * + * @memberof Filter + */ static listStreamFile(filters: any, repo: Repository, path: string, target: WriteStream): number; + /** + * + * + * @static + * @param {string} name + * @returns {number} + * + * @memberof Filter + */ static unregister(name: string): number; + /** + * + * + * @param {string} name + * @returns {Filter} + * + * @memberof Filter + */ lookup(name: string): Filter; + /** + * + * + * @param {string} name + * @param {number} priority + * @returns {number} + * + * @memberof Filter + */ register(name: string, priority: number): number; + /** + * + * + * @type {number} + * @memberof Filter + */ version: number; + /** + * + * + * @type {string} + * @memberof Filter + */ attributes: string; + /** + * + * + * @type {Function} + * @memberof Filter + */ stream: Function; } diff --git a/types/nodegit/git-err.d.ts b/types/nodegit/git-err.d.ts index 6a9da24bb3..541a191e30 100644 --- a/types/nodegit/git-err.d.ts +++ b/types/nodegit/git-err.d.ts @@ -1,9 +1,39 @@ import { Error } from './error'; export class Giterr { + /** + * + * + * @static + * + * @memberof Giterr + */ static errClear(): void; - static errDetach(cpy: Error): number; + /** + * + * + * @static + * @returns {Error} + * + * @memberof Giterr + */ static errLast(): Error; + /** + * + * + * @static + * + * @memberof Giterr + */ static errSetOom(): void; - static errSetString(error_class: number, string: string): void; + /** + * + * + * @static + * @param {number} errorClass + * @param {string} string + * + * @memberof Giterr + */ + static errSetString(errorClass: number, string: string): void; } diff --git a/types/nodegit/graph.d.ts b/types/nodegit/graph.d.ts index d16d7b5dee..90639a5075 100644 --- a/types/nodegit/graph.d.ts +++ b/types/nodegit/graph.d.ts @@ -2,6 +2,28 @@ import { Repository } from './repository'; import { Oid } from './oid'; export class Graph { + /** + * + * + * @static + * @param {Repository} repo + * @param {Oid} local + * @param {Oid} upstream + * @returns {Promise} + * + * @memberof Graph + */ static aheadBehind(repo: Repository, local: Oid, upstream: Oid): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Oid} commit + * @param {Oid} ancestor + * @returns {Promise} + * + * @memberof Graph + */ static descendantOf(repo: Repository, commit: Oid, ancestor: Oid): Promise; } diff --git a/types/nodegit/ignore.d.ts b/types/nodegit/ignore.d.ts index c38d84d1f3..017637c8d2 100644 --- a/types/nodegit/ignore.d.ts +++ b/types/nodegit/ignore.d.ts @@ -1,7 +1,36 @@ import { Repository } from './repository'; export class Ignore { + /** + * + * + * @static + * @param {Repository} repo + * @param {string} rules + * @returns {number} + * + * @memberof Ignore + */ static addRule(repo: Repository, rules: string): number; + /** + * + * + * @static + * @param {Repository} repo + * @returns {number} + * + * @memberof Ignore + */ static clearInternalRules(repo: Repository): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} path + * @returns {Promise} + * + * @memberof Ignore + */ static pathIsIgnored(repo: Repository, path: string): Promise; } From edf46bc72563e170c35fdfddd44e1b73536da873 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 9 Jun 2017 01:07:35 +0100 Subject: [PATCH 134/286] Added ProxyOptions --- types/nodegit/index.d.ts | 1 + types/nodegit/proxy-options.d.ts | 8 ++++++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 10 insertions(+) create mode 100644 types/nodegit/proxy-options.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 32b86ba19f..4efd864946 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -65,6 +65,7 @@ export { Oid } from './oid'; export { Openssl } from './open-ssl'; export { Packbuilder } from './pack-builder'; export { Pathspec } from './path-spec'; +export { ProxyOptions } from './proxy-options'; export { PushOptions } from './push-options'; export { PushUpdate } from './push-update'; export { Push } from './push'; diff --git a/types/nodegit/proxy-options.d.ts b/types/nodegit/proxy-options.d.ts new file mode 100644 index 0000000000..7a4c8f4dd4 --- /dev/null +++ b/types/nodegit/proxy-options.d.ts @@ -0,0 +1,8 @@ +export class ProxyOptions { + certificateCheck?: Function + credentials?: Function + payload?: any + type?: number + url?: string + version?: number +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 31f9ee0497..635c40ac91 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -79,6 +79,7 @@ "open-ssl.d.ts", "pack-builder.d.ts", "path-spec.d.ts", + "proxy-options.d.ts", "push-options.d.ts", "push-update.d.ts", "push.d.ts", From 8f92ae45d43ed9074df3531909eb92f5a4eabe16 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 20:12:24 -0400 Subject: [PATCH 135/286] Further model reduction in pouchdb-mapreduce Reduce should be a CouchDB-style reduction function (keys, values, rereduce). For query, the Model is the Reduction or the currently hidden from types emit(key, value) value. --- types/pouchdb-mapreduce/index.d.ts | 33 ++++++++++-------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/types/pouchdb-mapreduce/index.d.ts b/types/pouchdb-mapreduce/index.d.ts index b9a05ff7d6..4ecf21d370 100644 --- a/types/pouchdb-mapreduce/index.d.ts +++ b/types/pouchdb-mapreduce/index.d.ts @@ -10,15 +10,19 @@ /* tslint:disable:no-single-declare-module */ declare namespace PouchDB { + type Map = (doc: Content) => void; + // The any below would be the value type from emit(key, value), currently hidden from type information in the Map + type Reducer = (keys: Array<[string, any]> | null, values: Content[] | Reduction[], rereduce: boolean) => Reduction[] | Reduction; + interface Filter { - map(doc: Content): void; - reduce?(key: string, value: Content): Reduction; + map: Map; + reduce?: Reducer | '_sum' | '_count' | '_stats' | string; } namespace Query { - interface Options { + interface Options { /** Reduce function, or the string name of a built-in function: '_sum', '_count', or '_stats'. */ - reduce?: ((...args: any[]) => void) | '_sum' | '_count' | '_stats' | boolean; + reduce?: Reducer | '_sum' | '_count' | '_stats' | boolean; /** Include the document in each row in the doc field. */ include_docs?: boolean; /** Include conflicts in the _conflicts field of a doc. */ @@ -94,32 +98,17 @@ declare namespace PouchDB { * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | ((doc: Content & Model) => void), opts: Query.Options, callback: (err: Core.Error, res: Query.Response) => void): void; + query(fun: string | Map | Filter, opts: Query.Options, callback: Core.Callback>): void; /** * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: Filter, opts: Query.Options, callback: (err: Core.Error, res: Query.Response) => void): void; + query(fun: string | Map | Filter, callback: Core.Callback>): void; /** * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | ((doc: Content & Model) => void), callback: (err: Core.Error, res: Query.Response) => void): void; - /** - * Invoke a map/reduce function, which allows you to perform more complex queries - * on PouchDB than what you get with allDocs(). - */ - query(fun: Filter, callback: (err: Core.Error, res: Query.Response) => void): void; - /** - * Invoke a map/reduce function, which allows you to perform more complex queries - * on PouchDB than what you get with allDocs(). - */ - query(fun: string | ((doc: Content & Model) => void), opts?: Query.Options): Promise>; - /** - * Invoke a map/reduce function, which allows you to perform more complex queries - * on PouchDB than what you get with allDocs(). - */ - query(fun: Filter, opts?: Query.Options): Promise>; + query(fun: string | Map | Filter, opts?: Query.Options): Promise>; } } From 307c01282bfc9ff985c63096ac25eb07130eb5f3 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 20:23:23 -0400 Subject: [PATCH 136/286] Reallow heterogeneous query in pouchdb-mapreduce --- types/pouchdb-mapreduce/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/pouchdb-mapreduce/index.d.ts b/types/pouchdb-mapreduce/index.d.ts index 4ecf21d370..4c3d2e8ebf 100644 --- a/types/pouchdb-mapreduce/index.d.ts +++ b/types/pouchdb-mapreduce/index.d.ts @@ -98,17 +98,17 @@ declare namespace PouchDB { * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Map | Filter, opts: Query.Options, callback: Core.Callback>): void; + query(fun: string | Map | Filter, opts: Query.Options, callback: Core.Callback>): void; /** * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Map | Filter, callback: Core.Callback>): void; + query(fun: string | Map | Filter, callback: Core.Callback>): void; /** * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Map | Filter, opts?: Query.Options): Promise>; + query(fun: string | Map | Filter, opts?: Query.Options): Promise>; } } From 21a5f52f750a3034f1a6ff00d98c7979d61fc4f0 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 9 Jun 2017 01:33:54 +0100 Subject: [PATCH 137/286] Added documentation --- types/nodegit/diff-delta.d.ts | 36 ++++ types/nodegit/hash-sig.d.ts | 35 ++++ types/nodegit/index-entry.d.ts | 84 ++++++++ types/nodegit/index_.d.ts | 279 ++++++++++++++++++++++++++ types/nodegit/indexer.d.ts | 21 ++ types/nodegit/lib-git2.d.ts | 43 ++++ types/nodegit/merge-file-input.d.ts | 30 +++ types/nodegit/merge-file-options.d.ts | 48 ++++- types/nodegit/merge-file-result.d.ts | 30 +++ types/nodegit/merge-options.d.ts | 64 +++++- types/nodegit/merge.d.ts | 79 ++++++++ types/nodegit/note.d.ts | 106 ++++++++++ types/nodegit/object.d.ts | 117 +++++++++++ types/nodegit/odb-object.d.ts | 41 ++++ types/nodegit/odb.d.ts | 3 +- types/nodegit/proxy-options.d.ts | 36 ++++ 16 files changed, 1038 insertions(+), 14 deletions(-) diff --git a/types/nodegit/diff-delta.d.ts b/types/nodegit/diff-delta.d.ts index c21d98f430..b09226c064 100644 --- a/types/nodegit/diff-delta.d.ts +++ b/types/nodegit/diff-delta.d.ts @@ -1,10 +1,46 @@ import { DiffFile } from './diff-file'; export class DiffDelta { + /** + * + * + * @type {number} + * @memberof DiffDelta + */ status: number; + /** + * + * + * @type {number} + * @memberof DiffDelta + */ flags: number; + /** + * + * + * @type {number} + * @memberof DiffDelta + */ similarity: number; + /** + * + * + * @type {number} + * @memberof DiffDelta + */ nfiles: number; + /** + * + * + * @type {DiffFile} + * @memberof DiffDelta + */ oldFile: DiffFile; + /** + * + * + * @type {DiffFile} + * @memberof DiffDelta + */ newFile: DiffFile; } diff --git a/types/nodegit/hash-sig.d.ts b/types/nodegit/hash-sig.d.ts index 5e9897450f..86bfe5d64f 100644 --- a/types/nodegit/hash-sig.d.ts +++ b/types/nodegit/hash-sig.d.ts @@ -8,9 +8,44 @@ export namespace Hashsig { } export class Hashsig { + /** + * + * + * @static + * @param {string} buf + * @param {number} buflen + * @param {number} opts + * @returns {Promise} + * + * @memberof Hashsig + */ static create(buf: string, buflen: number, opts: number): Promise; + /** + * + * + * @static + * @param {string} path + * @param {number} opts + * @returns {Promise} + * + * @memberof Hashsig + */ static createFromFile(path: string, opts: number): Promise; + /** + * + * + * @param {Hashsig} b + * @returns {number} + * + * @memberof Hashsig + */ compare(b: Hashsig): number; + /** + * + * + * + * @memberof Hashsig + */ free(): void; } diff --git a/types/nodegit/index-entry.d.ts b/types/nodegit/index-entry.d.ts index b121b7a826..df42f9cbce 100644 --- a/types/nodegit/index-entry.d.ts +++ b/types/nodegit/index-entry.d.ts @@ -1,21 +1,105 @@ import { Oid } from './oid'; export interface IndexTime { + /** + * + * + * @type {number} + * @memberof IndexTime + */ seconds: number; + /** + * + * + * @type {number} + * @memberof IndexTime + */ nanoseconds: number; } export class IndexEntry { + /** + * + * + * @type {IndexTime} + * @memberof IndexEntry + */ ctime: IndexTime; + /** + * + * + * @type {IndexTime} + * @memberof IndexEntry + */ mtime: IndexTime; + /** + * + * + * @type {number} + * @memberof IndexEntry + */ dev: number; + /** + * + * + * @type {number} + * @memberof IndexEntry + */ ino: number; + /** + * + * + * @type {number} + * @memberof IndexEntry + */ mode: number; + /** + * + * + * @type {number} + * @memberof IndexEntry + */ uid: number; + /** + * + * + * @type {number} + * @memberof IndexEntry + */ gid: number; + /** + * + * + * @type {number} + * @memberof IndexEntry + */ fileSize: number; + /** + * + * + * @type {Oid} + * @memberof IndexEntry + */ id: Oid; + /** + * + * + * @type {number} + * @memberof IndexEntry + */ flags: number; + /** + * + * + * @type {number} + * @memberof IndexEntry + */ flagsExtended: number; + /** + * + * + * @type {string} + * @memberof IndexEntry + */ path: string; } diff --git a/types/nodegit/index_.d.ts b/types/nodegit/index_.d.ts index 6fd80f5047..a805a19c97 100644 --- a/types/nodegit/index_.d.ts +++ b/types/nodegit/index_.d.ts @@ -21,36 +21,315 @@ export namespace Index { } export class Index { + /** + * + * + * @static + * @param {IndexEntry} entry + * @returns {number} + * + * @memberof Index + */ static entryIsConflict(entry: IndexEntry): number; + /** + * + * + * @static + * @param {IndexEntry} entry + * @returns {number} + * + * @memberof Index + */ static entryStage(entry: IndexEntry): number; + /** + * + * + * @static + * @param {string} index_path + * @returns {Promise} + * + * @memberof Index + */ static open(index_path: string): Promise; + /** + * + * + * @param {IndexEntry} source_entry + * @returns {number} + * + * @memberof Index + */ add(source_entry: IndexEntry): number; + /** + * + * + * @param {Strarray} pathspec + * @param {number} flags + * @param {Function} callback + * @param {void} payload + * @returns {Promise} + * + * @memberof Index + */ addAll(pathspec: Strarray, flags: number, callback: Function, payload: void): Promise; + /** + * + * + * @param {string} path + * @returns {number} + * + * @memberof Index + */ addByPath(path: string): number; + /** + * + * + * @returns {number} + * + * @memberof Index + */ caps(): number; + /** + * + * + * @returns {Oid} + * + * @memberof Index + */ checksum(): Oid; + /** + * + * + * @returns {number} + * + * @memberof Index + */ clear(): number; + /** + * + * + * @param {IndexEntry} ancestor_entry + * @param {IndexEntry} our_entry + * @param {IndexEntry} their_entry + * @returns {number} + * + * @memberof Index + */ conflictAdd(ancestor_entry: IndexEntry, our_entry: IndexEntry, their_entry: IndexEntry): number; + /** + * + * + * @returns {number} + * + * @memberof Index + */ conflictCleanup(): number; + /** + * + * + * @param {string} path + * @returns {Promise} + * + * @memberof Index + */ conflictGet(path: string): Promise; + /** + * + * + * @param {string} path + * @returns {number} + * + * @memberof Index + */ conflictRemove(path: string): number; + /** + * + * + * @returns {number} + * + * @memberof Index + */ entryCount(): number; + /** + * + * + * @param {number} n + * @returns {IndexEntry} + * + * @memberof Index + */ getByIndex(n: number): IndexEntry; + /** + * + * + * @param {string} path + * @param {number} stage + * @returns {IndexEntry} + * + * @memberof Index + */ getByPath(path: string, stage: number): IndexEntry; + /** + * + * + * @returns {number} + * + * @memberof Index + */ hasConflicts(): number; + /** + * + * + * @returns {Repository} + * + * @memberof Index + */ owner(): Repository; + /** + * + * + * @returns {string} + * + * @memberof Index + */ path(): string; + /** + * + * + * @param {number} force + * @returns {number} + * + * @memberof Index + */ read(force: number): number; + /** + * + * + * @param {Tree} tree + * @returns {number} + * + * @memberof Index + */ readTree(tree: Tree): number; + /** + * + * + * @param {string} path + * @param {number} stage + * @returns {number} + * + * @memberof Index + */ remove(path: string, stage: number): number; + /** + * + * + * @param {Strarray} pathspec + * @param {Function} callback + * @param {void} payload + * @returns {Promise} + * + * @memberof Index + */ removeAll(pathspec: Strarray, callback: Function, payload: void): Promise; + /** + * + * + * @param {string} path + * @returns {number} + * + * @memberof Index + */ removeByPath(path: string): number; + /** + * + * + * @param {string} dir + * @param {number} stage + * @returns {number} + * + * @memberof Index + */ removeDirectory(dir: string, stage: number): number; + /** + * + * + * @param {number} caps + * @returns {number} + * + * @memberof Index + */ setCaps(caps: number): number; + /** + * + * + * @param {Strarray} pathspec + * @param {Function} callback + * @param {void} payload + * @returns {Promise} + * + * @memberof Index + */ updateAll(pathspec: Strarray, callback: Function, payload: void): Promise; + /** + * + * + * @returns {number} + * + * @memberof Index + */ write(): number; + /** + * + * + * @returns {Promise} + * + * @memberof Index + */ writeTree(): Promise; + /** + * + * + * @param {Repository} repo + * @returns {Promise} + * + * @memberof Index + */ writeTreeTo(repo: Repository): Promise; + /** + * + * + * @returns {IndexEntry[]} + * + * @memberof Index + */ entries(): IndexEntry[]; + /** + * + * + * @param {number} at_pos + * @param {string} prefix + * @returns {number} + * + * @memberof Index + */ + findPrefix(at_pos: number, prefix: string): number; + /** + * + * + * @param {number} version + * @returns {number} + * + * @memberof Index + */ + setVersion(version: number): number; + /** + * + * + * @returns {number} + * + * @memberof Index + */ + version(): number; } diff --git a/types/nodegit/indexer.d.ts b/types/nodegit/indexer.d.ts index ee3ba9bc69..e776c0f508 100644 --- a/types/nodegit/indexer.d.ts +++ b/types/nodegit/indexer.d.ts @@ -2,7 +2,28 @@ import { TransferProgress } from './transfer-progress'; import { Oid } from './oid'; export class Indexer { + /** + * + * + * @param {TransferProgress} stats + * @returns {number} + * + * @memberof Indexer + */ commit(stats: TransferProgress): number; + /** + * + * + * + * @memberof Indexer + */ free(): void; + /** + * + * + * @returns {Oid} + * + * @memberof Indexer + */ hash(): Oid; } diff --git a/types/nodegit/lib-git2.d.ts b/types/nodegit/lib-git2.d.ts index be5a5d1856..10ad4f864a 100644 --- a/types/nodegit/lib-git2.d.ts +++ b/types/nodegit/lib-git2.d.ts @@ -17,9 +17,52 @@ export namespace Libgit2 { } export class Libgit2 { + /** + * + * + * @static + * @returns {number} + * + * @memberof Libgit2 + */ static features(): number; + /** + * + * + * @static + * @returns {number} + * + * @memberof Libgit2 + */ static init(): number; + /** + * + * + * @static + * @param {number} option + * @returns {number} + * + * @memberof Libgit2 + */ static opts(option: number): number; + /** + * + * + * @static + * @returns {number} + * + * @memberof Libgit2 + */ static shutdown(): number; + /** + * + * + * @static + * @param {number} major + * @param {number} minor + * @param {number} rev + * + * @memberof Libgit2 + */ static version(major: number, minor: number, rev: number): void; } diff --git a/types/nodegit/merge-file-input.d.ts b/types/nodegit/merge-file-input.d.ts index f49bd446ca..9401f8fd1d 100644 --- a/types/nodegit/merge-file-input.d.ts +++ b/types/nodegit/merge-file-input.d.ts @@ -1,7 +1,37 @@ export interface MergeFileInput { + /** + * + * + * @type {number} + * @memberof MergeFileInput + */ version: number; + /** + * + * + * @type {string} + * @memberof MergeFileInput + */ ptr: string; + /** + * + * + * @type {number} + * @memberof MergeFileInput + */ size: number; + /** + * + * + * @type {string} + * @memberof MergeFileInput + */ path: string; + /** + * + * + * @type {number} + * @memberof MergeFileInput + */ mode: number; } diff --git a/types/nodegit/merge-file-options.d.ts b/types/nodegit/merge-file-options.d.ts index 5d8233bcd6..6212c6275e 100644 --- a/types/nodegit/merge-file-options.d.ts +++ b/types/nodegit/merge-file-options.d.ts @@ -1,8 +1,44 @@ export interface MergeFileOptions { - version: number; - ancestorLabel: string; - ourLabel: string; - theirLabel: string; - favor: number; - flags: number; + /** + * + * + * @type {number} + * @memberof MergeFileOptions + */ + version?: number; + /** + * + * + * @type {string} + * @memberof MergeFileOptions + */ + ancestorLabel?: string; + /** + * + * + * @type {string} + * @memberof MergeFileOptions + */ + ourLabel?: string; + /** + * + * + * @type {string} + * @memberof MergeFileOptions + */ + theirLabel?: string; + /** + * + * + * @type {number} + * @memberof MergeFileOptions + */ + favor?: number; + /** + * + * + * @type {number} + * @memberof MergeFileOptions + */ + flags?: number; } diff --git a/types/nodegit/merge-file-result.d.ts b/types/nodegit/merge-file-result.d.ts index e6f2efcc3b..da2410da01 100644 --- a/types/nodegit/merge-file-result.d.ts +++ b/types/nodegit/merge-file-result.d.ts @@ -1,7 +1,37 @@ export class MergeFileResult { + /** + * + * + * @type {number} + * @memberof MergeFileResult + */ automergeable: number; + /** + * + * + * @type {string} + * @memberof MergeFileResult + */ path: string; + /** + * + * + * @type {number} + * @memberof MergeFileResult + */ mode: number; + /** + * + * + * @type {string} + * @memberof MergeFileResult + */ ptr: string; + /** + * + * + * @type {number} + * @memberof MergeFileResult + */ len: number; } diff --git a/types/nodegit/merge-options.d.ts b/types/nodegit/merge-options.d.ts index a4108c767d..31445857dd 100644 --- a/types/nodegit/merge-options.d.ts +++ b/types/nodegit/merge-options.d.ts @@ -1,8 +1,58 @@ -export interface MergeOptions { - version: number; - treeFlags: number; - renameThreshold: number; - targetLimit: number; - fileFavor: number; - fileFlags: number; +export class MergeOptions { + /** + * + * + * @type {number} + * @memberof MergeOptions + */ + version?: number; + /** + * + * + * @type {number} + * @memberof MergeOptions + */ + renameThreshold?: number; + /** + * + * + * @type {number} + * @memberof MergeOptions + */ + targetLimit?: number; + /** + * + * + * @type {number} + * @memberof MergeOptions + */ + fileFavor?: number; + /** + * + * + * @type {number} + * @memberof MergeOptions + */ + fileFlags?: number; + /** + * + * + * @type {string} + * @memberof MergeOptions + */ + defaultDriver?: string; + /** + * + * + * @type {number} + * @memberof MergeOptions + */ + flags?: number; + /** + * + * + * @type {number} + * @memberof MergeOptions + */ + recursionLimit?: number; } diff --git a/types/nodegit/merge.d.ts b/types/nodegit/merge.d.ts index 737d3c5a04..5603d2b66e 100644 --- a/types/nodegit/merge.d.ts +++ b/types/nodegit/merge.d.ts @@ -49,11 +49,90 @@ export namespace Merge { } export class Merge { + /** + * + * + * @static + * @param {Repository} repo + * @param {AnnotatedCommit} theirHead + * @param {MergeOptions} [mergeOpts] + * @param {CheckoutOptions} [checkoutOpts] + * @returns {*} + * + * @memberof Merge + */ static merge(repo: Repository, theirHead: AnnotatedCommit, mergeOpts?: MergeOptions, checkoutOpts?: CheckoutOptions): any; + /** + * + * + * @static + * @param {Repository} repo + * @param {Oid} one + * @param {Oid} two + * @returns {Promise} + * + * @memberof Merge + */ static base(repo: Repository, one: Oid, two: Oid): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Oid} one + * @param {Oid} two + * @returns {Promise} + * + * @memberof Merge + */ static bases(repo: Repository, one: Oid, two: Oid): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Commit} ourCommit + * @param {Commit} theirCommit + * @param {MergeOptions} [options] + * @returns {*} + * + * @memberof Merge + */ static commits(repo: Repository, ourCommit: Commit, theirCommit: Commit, options?: MergeOptions): any; + /** + * + * + * @static + * @param {MergeFileInput} opts + * @param {number} version + * @returns {number} + * + * @memberof Merge + */ static fileInitInput(opts: MergeFileInput, version: number): number; + /** + * + * + * @static + * @param {MergeOptions} opts + * @param {number} version + * @returns {number} + * + * @memberof Merge + */ static initOptions(opts: MergeOptions, version: number): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {Tree} ancestor_tree + * @param {Tree} our_tree + * @param {Tree} their_tree + * @param {MergeOptions} opts + * @returns {Promise} + * + * @memberof Merge + */ static trees(repo: Repository, ancestor_tree: Tree, our_tree: Tree, their_tree: Tree, opts: MergeOptions): Promise; } diff --git a/types/nodegit/note.d.ts b/types/nodegit/note.d.ts index c5c9152bb2..1e9382b712 100644 --- a/types/nodegit/note.d.ts +++ b/types/nodegit/note.d.ts @@ -3,16 +3,122 @@ import {Signature} from './signature'; import {Oid} from './oid'; export class Note { + /** + * + * + * @static + * @param {Repository} repo + * @param {string} notes_ref + * @param {Signature} author + * @param {Signature} committer + * @param {Oid} oid + * @param {string} note + * @param {number} force + * @returns {Promise} + * + * @memberof Note + */ static create(repo: Repository, notes_ref: string, author: Signature, committer: Signature, oid: Oid, note: string, force: number): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} notes_ref + * @param {Function} note_cb + * @param {*} payload + * @returns {Promise} + * + * @memberof Note + */ static foreach(repo: Repository, notes_ref: string, note_cb: Function, payload: any): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} notes_ref + * @returns {Promise} + * + * @memberof Note + */ static iteratorNew(repo: Repository, notes_ref: string): Promise; + /** + * + * + * @static + * @param {Oid} note_id + * @param {Oid} annotated_id + * @param {*} it + * @returns {number} + * + * @memberof Note + */ static next(note_id: Oid, annotated_id: Oid, it: any): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} notes_ref + * @param {Oid} oid + * @returns {Promise} + * + * @memberof Note + */ static read(repo: Repository, notes_ref: string, oid: Oid): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} notes_ref + * @param {Signature} author + * @param {Signature} committer + * @param {Oid} oid + * @returns {Promise} + * + * @memberof Note + */ static remove(repo: Repository, notes_ref: string, author: Signature, committer: Signature, oid: Oid): Promise; + /** + * + * + * @returns {Signature} + * + * @memberof Note + */ author(): Signature; + /** + * + * + * @returns {Signature} + * + * @memberof Note + */ committer(): Signature; + /** + * + * + * + * @memberof Note + */ free(): void; + /** + * + * + * @returns {Oid} + * + * @memberof Note + */ id(): Oid; + /** + * + * + * @returns {string} + * + * @memberof Note + */ message(): string; } diff --git a/types/nodegit/object.d.ts b/types/nodegit/object.d.ts index 8fabe5fdd2..8030943e0d 100644 --- a/types/nodegit/object.d.ts +++ b/types/nodegit/object.d.ts @@ -3,19 +3,136 @@ import { Repository } from './repository'; import { Buf } from './buf'; export class Object { + /** + * + * + * @static + * @param {number} type + * @returns {number} + * + * @memberof Object + */ static size(type: number): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {Oid} id + * @param {number} type + * @returns {Promise} + * + * @memberof Object + */ static lookup(repo: Repository, id: Oid, type: number): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Oid} id + * @param {number} len + * @param {number} type + * @returns {Promise} + * + * @memberof Object + */ static lookupPrefix(repo: Repository, id: Oid, len: number, type: number): Promise; + /** + * + * + * @static + * @param {string} str + * @returns {number} + * + * @memberof Object + */ static string2type(str: string): number; + /** + * + * + * @static + * @param {number} type + * @returns {string} + * + * @memberof Object + */ static type2string(type: number): string; + /** + * + * + * @static + * @param {number} type + * @returns {number} + * + * @memberof Object + */ static typeisloose(type: number): number; + /** + * + * + * @returns {Promise} + * + * @memberof Object + */ dup(): Promise; + /** + * + * + * + * @memberof Object + */ free(): void; + /** + * + * + * @returns {Oid} + * + * @memberof Object + */ id(): Oid; + /** + * + * + * @param {string} path + * @param {number} type + * @returns {Promise} + * + * @memberof Object + */ lookupByPath(path: string, type: number): Promise; + /** + * + * + * @returns {Repository} + * + * @memberof Object + */ owner(): Repository; + /** + * + * + * @param {number} target_type + * @returns {Promise} + * + * @memberof Object + */ peel(target_type: number): Promise; + /** + * + * + * @returns {Promise} + * + * @memberof Object + */ shortId(): Promise; + /** + * + * + * @returns {number} + * + * @memberof Object + */ type(): number; } diff --git a/types/nodegit/odb-object.d.ts b/types/nodegit/odb-object.d.ts index 361e8c0718..8b76274b00 100644 --- a/types/nodegit/odb-object.d.ts +++ b/types/nodegit/odb-object.d.ts @@ -1,10 +1,51 @@ import { Oid } from './oid'; export class OdbObject { + /** + * + * + * @returns {Buffer} + * + * @memberof OdbObject + */ data(): Buffer; + /** + * + * + * @returns {Promise} + * + * @memberof OdbObject + */ dup(): Promise; + /** + * + * + * + * @memberof OdbObject + */ free(): void; + /** + * + * + * @returns {Oid} + * + * @memberof OdbObject + */ id(): Oid; + /** + * + * + * @returns {number} + * + * @memberof OdbObject + */ size(): number; + /** + * + * + * @returns {number} + * + * @memberof OdbObject + */ type(): number; } diff --git a/types/nodegit/odb.d.ts b/types/nodegit/odb.d.ts index c0cbfd8725..ebaca11b5d 100644 --- a/types/nodegit/odb.d.ts +++ b/types/nodegit/odb.d.ts @@ -10,10 +10,11 @@ export namespace Odb { } export class Odb { - static open(objects_dir: string): Promise; + static open(objectsDir: string): Promise; addDiskAlternate(path: string): number; free(): void; read(id: Oid): Promise; write(data: Buffer, len: number, type: number): Promise; + expandIds(ids, count: number): number; } diff --git a/types/nodegit/proxy-options.d.ts b/types/nodegit/proxy-options.d.ts index 7a4c8f4dd4..512d70c99a 100644 --- a/types/nodegit/proxy-options.d.ts +++ b/types/nodegit/proxy-options.d.ts @@ -1,8 +1,44 @@ export class ProxyOptions { + /** + * + * + * @type {Function} + * @memberof ProxyOptions + */ certificateCheck?: Function + /** + * + * + * @type {Function} + * @memberof ProxyOptions + */ credentials?: Function + /** + * + * + * @type {*} + * @memberof ProxyOptions + */ payload?: any + /** + * + * + * @type {number} + * @memberof ProxyOptions + */ type?: number + /** + * + * + * @type {string} + * @memberof ProxyOptions + */ url?: string + /** + * + * + * @type {number} + * @memberof ProxyOptions + */ version?: number } From 41256279f00c2eeae19da14eadfcf0192b72d1f5 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 9 Jun 2017 01:37:03 +0100 Subject: [PATCH 138/286] Added OdbExpandId --- types/nodegit/index.d.ts | 1 + types/nodegit/odb-expand-id.d.ts | 7 +++++++ types/nodegit/odb.d.ts | 3 ++- types/nodegit/tsconfig.json | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 types/nodegit/odb-expand-id.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 4efd864946..6551907ea4 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -58,6 +58,7 @@ export { MergeOptions } from './merge-options'; export { Merge } from './merge'; export { Note } from './note'; export { Object } from './object'; +export { OdbExpandId } from './odb-expand-id'; export { OdbObject } from './odb-object'; export { Odb } from './odb'; export { Oidarray } from './oid-array'; diff --git a/types/nodegit/odb-expand-id.d.ts b/types/nodegit/odb-expand-id.d.ts new file mode 100644 index 0000000000..842c65774e --- /dev/null +++ b/types/nodegit/odb-expand-id.d.ts @@ -0,0 +1,7 @@ +import { Oid } from './oid'; + +export class OdbExpandId { + id: Oid + length: number + type: number +} diff --git a/types/nodegit/odb.d.ts b/types/nodegit/odb.d.ts index ebaca11b5d..efc4fcbe13 100644 --- a/types/nodegit/odb.d.ts +++ b/types/nodegit/odb.d.ts @@ -1,5 +1,6 @@ import { Oid } from './oid'; import { OdbObject } from './odb-object'; +import { OdbExpandId } from './odb-expand-id'; export namespace Odb { const enum STREAM { @@ -16,5 +17,5 @@ export class Odb { free(): void; read(id: Oid): Promise; write(data: Buffer, len: number, type: number): Promise; - expandIds(ids, count: number): number; + expandIds(ids: OdbExpandId, count: number): number; } diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 635c40ac91..829e49aedd 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -72,6 +72,7 @@ "nodegit-tests.ts", "note.d.ts", "object.d.ts", + "odb-expand-id.d.ts", "odb-object.d.ts", "odb.d.ts", "oid-array.d.ts", From 93a3dc1f476028e223920a32917c5a820e3feeae Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 9 Jun 2017 01:41:43 +0100 Subject: [PATCH 139/286] Documentation and made Option values optional --- types/nodegit/blame-options.d.ts | 14 ++--- types/nodegit/cherry-pick-options.d.ts | 8 +-- types/nodegit/describe-format-options.d.ts | 8 +-- types/nodegit/describe-options.d.ts | 12 ++-- types/nodegit/odb.d.ts | 50 +++++++++++++++++ types/nodegit/oid-array.d.ts | 18 ++++++ types/nodegit/oid.d.ts | 62 +++++++++++++++++++++ types/nodegit/open-ssl.d.ts | 8 +++ types/nodegit/push-options.d.ts | 6 +- types/nodegit/status-options.d.ts | 8 +-- types/nodegit/submodule-update-options.d.ts | 8 +-- 11 files changed, 170 insertions(+), 32 deletions(-) diff --git a/types/nodegit/blame-options.d.ts b/types/nodegit/blame-options.d.ts index eac4c2f4f0..fdebbeff67 100644 --- a/types/nodegit/blame-options.d.ts +++ b/types/nodegit/blame-options.d.ts @@ -7,47 +7,47 @@ export class BlameOptions { * @type {number} * @memberof BlameOptions */ - version: number; + version?: number; /** * * * @type {number} * @memberof BlameOptions */ - flags: number; + flags?: number; /** * * * @type {number} * @memberof BlameOptions */ - minMatchCharacters: number; + minMatchCharacters?: number; /** * * * @type {Oid} * @memberof BlameOptions */ - newestCommit: Oid; + newestCommit?: Oid; /** * * * @type {Oid} * @memberof BlameOptions */ - oldestCommit: Oid; + oldestCommit?: Oid; /** * * * @type {number} * @memberof BlameOptions */ - minLine: number; + minLine?: number; /** * * * @type {number} * @memberof BlameOptions */ - maxLine: number; + maxLine?: number; } diff --git a/types/nodegit/cherry-pick-options.d.ts b/types/nodegit/cherry-pick-options.d.ts index 8743217b47..5e91da0c55 100644 --- a/types/nodegit/cherry-pick-options.d.ts +++ b/types/nodegit/cherry-pick-options.d.ts @@ -8,26 +8,26 @@ export interface CherrypickOptions { * @type {number} * @memberof CherrypickOptions */ - version: number; + version?: number; /** * * * @type {number} * @memberof CherrypickOptions */ - mainline: number; + mainline?: number; /** * * * @type {MergeOptions} * @memberof CherrypickOptions */ - mergeOpts: MergeOptions; + mergeOpts?: MergeOptions; /** * * * @type {CheckoutOptions} * @memberof CherrypickOptions */ - checkoutOpts: CheckoutOptions; + checkoutOpts?: CheckoutOptions; } diff --git a/types/nodegit/describe-format-options.d.ts b/types/nodegit/describe-format-options.d.ts index 4a67cd9082..3f1989f0dd 100644 --- a/types/nodegit/describe-format-options.d.ts +++ b/types/nodegit/describe-format-options.d.ts @@ -5,26 +5,26 @@ export class DescribeFormatOptions { * @type {number} * @memberof DescribeFormatOptions */ - version: number; + version?: number; /** * * * @type {number} * @memberof DescribeFormatOptions */ - abbreviatedSize: number; + abbreviatedSize?: number; /** * * * @type {number} * @memberof DescribeFormatOptions */ - alwaysUseLongFormat: number; + alwaysUseLongFormat?: number; /** * * * @type {string} * @memberof DescribeFormatOptions */ - dirtySuffix: string; + dirtySuffix?: string; } diff --git a/types/nodegit/describe-options.d.ts b/types/nodegit/describe-options.d.ts index f860bb88e9..1a7518cd76 100644 --- a/types/nodegit/describe-options.d.ts +++ b/types/nodegit/describe-options.d.ts @@ -5,40 +5,40 @@ export class DescribeOptions { * @type {number} * @memberof DescribeOptions */ - version: number; + version?: number; /** * * * @type {number} * @memberof DescribeOptions */ - maxCandidatesTags: number; + maxCandidatesTags?: number; /** * * * @type {number} * @memberof DescribeOptions */ - describeStrategy: number; + describeStrategy?: number; /** * * * @type {string} * @memberof DescribeOptions */ - pattern: string; + pattern?: string; /** * * * @type {number} * @memberof DescribeOptions */ - onlyFollowFirstParent: number; + onlyFollowFirstParent?: number; /** * * * @type {number} * @memberof DescribeOptions */ - showCommitOidAsFallback: number; + showCommitOidAsFallback?: number; } diff --git a/types/nodegit/odb.d.ts b/types/nodegit/odb.d.ts index efc4fcbe13..549bba872e 100644 --- a/types/nodegit/odb.d.ts +++ b/types/nodegit/odb.d.ts @@ -11,11 +11,61 @@ export namespace Odb { } export class Odb { + /** + * + * + * @static + * @param {string} objectsDir + * @returns {Promise} + * + * @memberof Odb + */ static open(objectsDir: string): Promise; + /** + * + * + * @param {string} path + * @returns {number} + * + * @memberof Odb + */ addDiskAlternate(path: string): number; + /** + * + * + * + * @memberof Odb + */ free(): void; + /** + * + * + * @param {Oid} id + * @returns {Promise} + * + * @memberof Odb + */ read(id: Oid): Promise; + /** + * + * + * @param {Buffer} data + * @param {number} len + * @param {number} type + * @returns {Promise} + * + * @memberof Odb + */ write(data: Buffer, len: number, type: number): Promise; + /** + * + * + * @param {OdbExpandId} ids + * @param {number} count + * @returns {number} + * + * @memberof Odb + */ expandIds(ids: OdbExpandId, count: number): number; } diff --git a/types/nodegit/oid-array.d.ts b/types/nodegit/oid-array.d.ts index 7a96f24a7a..0b95d31a5d 100644 --- a/types/nodegit/oid-array.d.ts +++ b/types/nodegit/oid-array.d.ts @@ -1,7 +1,25 @@ import { Oid } from './oid'; export class Oidarray { + /** + * + * + * + * @memberof Oidarray + */ free(): void; + /** + * + * + * @type {Oid} + * @memberof Oidarray + */ ids: Oid; + /** + * + * + * @type {number} + * @memberof Oidarray + */ count: number; } diff --git a/types/nodegit/oid.d.ts b/types/nodegit/oid.d.ts index 2aa65905f6..412a931f00 100644 --- a/types/nodegit/oid.d.ts +++ b/types/nodegit/oid.d.ts @@ -1,11 +1,73 @@ export class Oid { static fromString(str: string): Oid; + /** + * + * + * @param {Oid} b + * @returns {number} + * + * @memberof Oid + */ cmp(b: Oid): number; + /** + * + * + * @returns {Oid} + * + * @memberof Oid + */ cpy(): Oid; + /** + * + * + * @param {Oid} b + * @returns {number} + * + * @memberof Oid + */ equal(b: Oid): number; + /** + * + * + * @returns {number} + * + * @memberof Oid + */ iszero(): number; + /** + * + * + * @param {Oid} b + * @param {number} len + * @returns {number} + * + * @memberof Oid + */ ncmp(b: Oid, len: number): number; + /** + * + * + * @param {string} str + * @returns {number} + * + * @memberof Oid + */ strcmp(str: string): number; + /** + * + * + * @param {string} str + * @returns {number} + * + * @memberof Oid + */ streq(str: string): number; + /** + * + * + * @returns {string} + * + * @memberof Oid + */ tostrS(): string; } diff --git a/types/nodegit/open-ssl.d.ts b/types/nodegit/open-ssl.d.ts index f8370260d5..4b604a6f43 100644 --- a/types/nodegit/open-ssl.d.ts +++ b/types/nodegit/open-ssl.d.ts @@ -1,3 +1,11 @@ export class Openssl { + /** + * + * + * @static + * @returns {number} + * + * @memberof Openssl + */ static setLocking(): number; } diff --git a/types/nodegit/push-options.d.ts b/types/nodegit/push-options.d.ts index 5187548b8f..693a310ed0 100644 --- a/types/nodegit/push-options.d.ts +++ b/types/nodegit/push-options.d.ts @@ -1,7 +1,7 @@ import { RemoteCallbacks } from './remote-callbacks'; export interface PushOptions { - version: number; - pbParallelism: number; - callbacks: RemoteCallbacks; + version?: number; + pbParallelism?: number; + callbacks?: RemoteCallbacks; } diff --git a/types/nodegit/status-options.d.ts b/types/nodegit/status-options.d.ts index c4296a5b92..9f75bbe96d 100644 --- a/types/nodegit/status-options.d.ts +++ b/types/nodegit/status-options.d.ts @@ -1,8 +1,8 @@ import { Strarray } from './str-array'; export interface StatusOptions { - version: number; - show: number; - flags: number; - pathspec: Strarray; + version?: number; + show?: number; + flags?: number; + pathspec?: Strarray; } diff --git a/types/nodegit/submodule-update-options.d.ts b/types/nodegit/submodule-update-options.d.ts index 35bbd6b3f8..d96320204b 100644 --- a/types/nodegit/submodule-update-options.d.ts +++ b/types/nodegit/submodule-update-options.d.ts @@ -2,8 +2,8 @@ import { CheckoutOptions } from './checkout-options'; import { FetchOptions } from './fetch-options'; export interface SubmoduleUpdateOptions { - version: number; - checkoutOpts: CheckoutOptions; - fetchOpts: FetchOptions; - cloneCheckoutStrategy: number; + version?: number; + checkoutOpts?: CheckoutOptions; + fetchOpts?: FetchOptions; + cloneCheckoutStrategy?: number; } From 3fe8ca1a01fedceb616e8e2a29678eb6b1cec913 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 9 Jun 2017 02:11:48 +0100 Subject: [PATCH 140/286] Added more documentation --- types/nodegit/pack-builder.d.ts | 86 ++++ types/nodegit/path-spec.d.ts | 108 +++++ types/nodegit/push-options.d.ts | 34 ++ types/nodegit/push-update.d.ts | 24 ++ types/nodegit/push.d.ts | 10 + types/nodegit/rebase-operation.d.ts | 18 + types/nodegit/rebase.d.ts | 98 +++++ types/nodegit/ref-db.d.ts | 22 + types/nodegit/ref-log.d.ts | 110 ++++- types/nodegit/ref-spec.d.ts | 44 ++ types/nodegit/reference.d.ts | 330 +++++++++++++- types/nodegit/remote-callbacks.d.ts | 36 ++ types/nodegit/remote.d.ts | 325 ++++++++++++++ types/nodegit/repository.d.ts | 647 +++++++++++++++++++++++++++- 14 files changed, 1873 insertions(+), 19 deletions(-) diff --git a/types/nodegit/pack-builder.d.ts b/types/nodegit/pack-builder.d.ts index ed0fa0a2cc..e528ccbf38 100644 --- a/types/nodegit/pack-builder.d.ts +++ b/types/nodegit/pack-builder.d.ts @@ -10,16 +10,102 @@ export namespace Packbuilder { } export class Packbuilder { + /** + * + * + * @static + * @param {Repository} repo + * @returns {Packbuilder} + * + * @memberof Packbuilder + */ static create(repo: Repository): Packbuilder; + /** + * + * + * + * @memberof Packbuilder + */ free(): void; + /** + * + * + * @returns {Oid} + * + * @memberof Packbuilder + */ hash(): Oid; + /** + * + * + * @param {Oid} id + * @param {string} name + * @returns {number} + * + * @memberof Packbuilder + */ insert(id: Oid, name: string): number; + /** + * + * + * @param {Oid} id + * @returns {number} + * + * @memberof Packbuilder + */ insertCommit(id: Oid): number; + /** + * + * + * @param {Oid} id + * @param {string} name + * @returns {number} + * + * @memberof Packbuilder + */ insertRecur(id: Oid, name: string): number; + /** + * + * + * @param {Oid} id + * @returns {number} + * + * @memberof Packbuilder + */ insertTree(id: Oid): number; + /** + * + * + * @param {Revwalk} walk + * @returns {number} + * + * @memberof Packbuilder + */ insertWalk(walk: Revwalk): number; + /** + * + * + * @returns {number} + * + * @memberof Packbuilder + */ objectCount(): number; + /** + * + * + * @param {number} n + * @returns {number} + * + * @memberof Packbuilder + */ setThreads(n: number): number; + /** + * + * + * @returns {number} + * + * @memberof Packbuilder + */ written(): number; } diff --git a/types/nodegit/path-spec.d.ts b/types/nodegit/path-spec.d.ts index 99435d5e0d..0581523300 100644 --- a/types/nodegit/path-spec.d.ts +++ b/types/nodegit/path-spec.d.ts @@ -18,17 +18,125 @@ export namespace Pathspec { } export class Pathspec { + /** + * + * + * @static + * @param {*} m + * @param {number} pos + * @returns {DiffDelta} + * + * @memberof Pathspec + */ static matchListDiffEntry(m: any, pos: number): DiffDelta; + /** + * + * + * @static + * @param {*} m + * @param {number} pos + * @returns {string} + * + * @memberof Pathspec + */ static matchListEntry(m: any, pos: number): string; + /** + * + * + * @static + * @param {*} m + * @returns {number} + * + * @memberof Pathspec + */ static matchListEntrycount(m: any): number; + /** + * + * + * @static + * @param {*} m + * @param {number} pos + * @returns {string} + * + * @memberof Pathspec + */ static matchListFailedEntry(m: any, pos: number): string; + /** + * + * + * @static + * @param {*} m + * @returns {number} + * + * @memberof Pathspec + */ static matchListFailedEntrycount(m: any): number; + /** + * + * + * @static + * @param {Strarray} pathspec + * @returns {Pathspec} + * + * @memberof Pathspec + */ static create(pathspec: Strarray): Pathspec; + /** + * + * + * + * @memberof Pathspec + */ free(): void; + /** + * + * + * @param {Diff} diff + * @param {number} flags + * @returns {Promise} + * + * @memberof Pathspec + */ matchDiff(diff: Diff, flags: number): Promise; + /** + * + * + * @param {Index} index + * @param {number} flags + * @returns {Promise} + * + * @memberof Pathspec + */ matchIndex(index: Index, flags: number): Promise; + /** + * + * + * @param {Tree} tree + * @param {number} flags + * @returns {Promise} + * + * @memberof Pathspec + */ matchTree(tree: Tree, flags: number): Promise; + /** + * + * + * @param {Repository} repo + * @param {number} flags + * @returns {Promise} + * + * @memberof Pathspec + */ matchWorkdir(repo: Repository, flags: number): Promise; + /** + * + * + * @param {number} flags + * @param {string} path + * @returns {number} + * + * @memberof Pathspec + */ matchesPath(flags: number, path: string): number; } diff --git a/types/nodegit/push-options.d.ts b/types/nodegit/push-options.d.ts index 693a310ed0..6cf501c84a 100644 --- a/types/nodegit/push-options.d.ts +++ b/types/nodegit/push-options.d.ts @@ -1,7 +1,41 @@ import { RemoteCallbacks } from './remote-callbacks'; +import { Strarray } from './str-array'; +import { ProxyOptions } from './proxy-options'; export interface PushOptions { + /** + * + * + * @type {number} + * @memberof PushOptions + */ version?: number; + /** + * + * + * @type {number} + * @memberof PushOptions + */ pbParallelism?: number; + /** + * + * + * @type {RemoteCallbacks} + * @memberof PushOptions + */ callbacks?: RemoteCallbacks; + /** + * + * + * @type {Strarray} + * @memberof PushOptions + */ + customHeaders: Strarray + /** + * + * + * @type {ProxyOptions} + * @memberof PushOptions + */ + proxyOpts: ProxyOptions } diff --git a/types/nodegit/push-update.d.ts b/types/nodegit/push-update.d.ts index 50f46726d5..cdd393d9ba 100644 --- a/types/nodegit/push-update.d.ts +++ b/types/nodegit/push-update.d.ts @@ -1,8 +1,32 @@ import { Oid } from './oid'; export class PushUpdate { + /** + * + * + * @type {string} + * @memberof PushUpdate + */ srcRefname: string; + /** + * + * + * @type {string} + * @memberof PushUpdate + */ dstRefname: string; + /** + * + * + * @type {Oid} + * @memberof PushUpdate + */ src: Oid; + /** + * + * + * @type {Oid} + * @memberof PushUpdate + */ dst: Oid; } diff --git a/types/nodegit/push.d.ts b/types/nodegit/push.d.ts index 26d8f07b60..4a4ce53dac 100644 --- a/types/nodegit/push.d.ts +++ b/types/nodegit/push.d.ts @@ -2,5 +2,15 @@ import { RemoteCallbacks } from './remote-callbacks'; import { PushOptions } from './push-options'; export class Push { + /** + * + * + * @static + * @param {PushOptions} opts + * @param {number} version + * @returns {number} + * + * @memberof Push + */ static initOptions(opts: PushOptions, version: number): number; } diff --git a/types/nodegit/rebase-operation.d.ts b/types/nodegit/rebase-operation.d.ts index 7144ebe6a9..e52542fb54 100644 --- a/types/nodegit/rebase-operation.d.ts +++ b/types/nodegit/rebase-operation.d.ts @@ -12,7 +12,25 @@ export namespace RebaseOperation { } export class RebaseOperation { + /** + * + * + * @type {number} + * @memberof RebaseOperation + */ type: number; + /** + * + * + * @type {Oid} + * @memberof RebaseOperation + */ id: Oid; + /** + * + * + * @type {string} + * @memberof RebaseOperation + */ exec: string; } diff --git a/types/nodegit/rebase.d.ts b/types/nodegit/rebase.d.ts index 15862ff17d..6e254545bc 100644 --- a/types/nodegit/rebase.d.ts +++ b/types/nodegit/rebase.d.ts @@ -4,6 +4,7 @@ import { Repository } from './repository'; import { Signature } from './signature'; import { Oid } from './oid'; import { RebaseOperation } from './rebase-operation'; +import { Index } from './index'; export interface RebaseOptions { version: number; @@ -13,15 +14,112 @@ export interface RebaseOptions { } export class Rebase { + /** + * + * + * @static + * @param {Repository} repo + * @param {AnnotatedCommit} branch + * @param {AnnotatedCommit} upstream + * @param {AnnotatedCommit} onto + * @param {RebaseOptions} opts + * @returns {Promise} + * + * @memberof Rebase + */ static init(repo: Repository, branch: AnnotatedCommit, upstream: AnnotatedCommit, onto: AnnotatedCommit, opts: RebaseOptions): Promise; + /** + * + * + * @static + * @param {RebaseOptions} opts + * @param {number} version + * @returns {number} + * + * @memberof Rebase + */ static initOptions(opts: RebaseOptions, version: number): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {RebaseOptions} opts + * @returns {Promise} + * + * @memberof Rebase + */ static open(repo: Repository, opts: RebaseOptions): Promise; + /** + * + * + * @returns {number} + * + * @memberof Rebase + */ abort(): number; + /** + * + * + * @param {Signature} author + * @param {Signature} committer + * @param {string} message_encoding + * @param {string} message + * @returns {Oid} + * + * @memberof Rebase + */ commit(author: Signature, committer: Signature, message_encoding: string, message: string): Oid; + /** + * + * + * @param {Signature} signature + * @returns {number} + * + * @memberof Rebase + */ finish(signature: Signature): number; + /** + * + * + * @param {Index} index + * @returns {number} + * + * @memberof Rebase + */ + inmemoryIndex(index: Index): number; + /** + * + * + * @returns {Promise} + * + * @memberof Rebase + */ next(): Promise; + /** + * + * + * @param {number} idx + * @returns {RebaseOperation} + * + * @memberof Rebase + */ operationByIndex(idx: number): RebaseOperation; + /** + * + * + * @returns {number} + * + * @memberof Rebase + */ operationCurrent(): number; + /** + * + * + * @returns {number} + * + * @memberof Rebase + */ operationEntrycount(): number; } diff --git a/types/nodegit/ref-db.d.ts b/types/nodegit/ref-db.d.ts index 8c9046d48d..de927eec58 100644 --- a/types/nodegit/ref-db.d.ts +++ b/types/nodegit/ref-db.d.ts @@ -1,8 +1,30 @@ import { Repository } from './repository'; export class Refdb { + /** + * + * + * @static + * @param {Repository} repo + * @returns {Promise} + * + * @memberof Refdb + */ static open(repo: Repository): Promise; + /** + * + * + * @returns {number} + * + * @memberof Refdb + */ compress(): number; + /** + * + * + * + * @memberof Refdb + */ free(): void; } diff --git a/types/nodegit/ref-log.d.ts b/types/nodegit/ref-log.d.ts index 8557d02a39..dec49731eb 100644 --- a/types/nodegit/ref-log.d.ts +++ b/types/nodegit/ref-log.d.ts @@ -3,25 +3,127 @@ import { Oid } from './oid'; import { Signature } from './signature'; export class Reflog { + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @returns {number} + * + * @memberof Reflog + */ static delete(repo: Repository, name: string): number; - static entryCommitter(entry: ReflogEntry): Signature; - static entryIdNew(entry: ReflogEntry): Oid; - static entryIdOld(entry: ReflogEntry): Oid; - static entryMessage(entry: ReflogEntry): string; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @returns {Promise} + * + * @memberof Reflog + */ static read(repo: Repository, name: string): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} old_name + * @param {string} name + * @returns {number} + * + * @memberof Reflog + */ static rename(repo: Repository, old_name: string, name: string): number; + /** + * + * + * @param {Oid} id + * @param {Signature} committer + * @param {string} msg + * @returns {number} + * + * @memberof Reflog + */ append(id: Oid, committer: Signature, msg: string): number; + /** + * + * + * @param {number} idx + * @param {number} rewrite_previous_entry + * @returns {number} + * + * @memberof Reflog + */ drop(idx: number, rewrite_previous_entry: number): number; + /** + * + * + * @param {number} idx + * @returns {ReflogEntry} + * + * @memberof Reflog + */ entryByIndex(idx: number): ReflogEntry; + /** + * + * + * @returns {number} + * + * @memberof Reflog + */ entrycount(): number; + /** + * + * + * + * @memberof Reflog + */ free(): void; + /** + * + * + * @returns {number} + * + * @memberof Reflog + */ write(): number; } export class ReflogEntry { + /** + * + * + * @returns {Signature} + * + * @memberof ReflogEntry + */ committer(): Signature; + /** + * + * + * @returns {Oid} + * + * @memberof ReflogEntry + */ idNew(): Oid; + /** + * + * + * @returns {Oid} + * + * @memberof ReflogEntry + */ idOld(): Oid; + /** + * + * + * @returns {string} + * + * @memberof ReflogEntry + */ message(): string; } diff --git a/types/nodegit/ref-spec.d.ts b/types/nodegit/ref-spec.d.ts index bf40f21ac2..e48c8cd2ac 100644 --- a/types/nodegit/ref-spec.d.ts +++ b/types/nodegit/ref-spec.d.ts @@ -1,8 +1,52 @@ export class Refspec { + /** + * + * + * @returns {number} + * + * @memberof Refspec + */ direction(): number; + /** + * + * + * @returns {string} + * + * @memberof Refspec + */ dst(): string; + /** + * + * + * @param {string} refname + * @returns {number} + * + * @memberof Refspec + */ dstMatches(refname: string): number; + /** + * + * + * @returns {number} + * + * @memberof Refspec + */ force(): number; + /** + * + * + * @returns {string} + * + * @memberof Refspec + */ src(): string; + /** + * + * + * @param {string} refname + * @returns {number} + * + * @memberof Refspec + */ srcMatches(refname: string): number; } diff --git a/types/nodegit/reference.d.ts b/types/nodegit/reference.d.ts index 4edd34d2da..cb449ee225 100644 --- a/types/nodegit/reference.d.ts +++ b/types/nodegit/reference.d.ts @@ -19,41 +19,365 @@ export namespace Reference { } export class Reference { + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @param {Oid} id + * @param {number} force + * @param {string} logMessage + * @returns {Promise} + * + * @memberof Reference + */ static create(repo: Repository, name: string, id: Oid, force: number, logMessage: string): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @param {Oid} id + * @param {number} force + * @param {Oid} currentId + * @param {string} logMessage + * @returns {Promise} + * + * @memberof Reference + */ static createMatching(repo: Repository, name: string, id: Oid, force: number, currentId: Oid, logMessage: string): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {(string | Reference)} id + * @param {Function} callback + * @returns {Promise} + * + * @memberof Reference + */ static dwim(repo: Repository, id: string | Reference, callback: Function): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} refname + * @returns {number} + * + * @memberof Reference + */ static ensureLog(repo: Repository, refname: string): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} refname + * @returns {number} + * + * @memberof Reference + */ static hasLog(repo: Repository, refname: string): number; + /** + * + * + * @static + * @param {string} refname + * @returns {number} + * + * @memberof Reference + */ static isValidName(refname: string): number; + /** + * + * + * @static + * @param {Repository} repo + * @returns {Promise} + * + * @memberof Reference + */ static list(repo: Repository): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {(string | Reference)} id + * @param {Function} callback + * @returns {Promise} + * + * @memberof Reference + */ static lookup(repo: Repository, id: string | Reference, callback: Function): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @returns {Promise} + * + * @memberof Reference + */ static nameToId(repo: Repository, name: string): Promise; + /** + * + * + * @static + * @param {string} bufferOut + * @param {number} bufferSize + * @param {string} name + * @param {number} flags + * @returns {number} + * + * @memberof Reference + */ static normalizeName(bufferOut: string, bufferSize: number, name: string, flags: number): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @returns {number} + * + * @memberof Reference + */ static remove(repo: Repository, name: string): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @param {string} target + * @param {number} force + * @param {string} logMessage + * @returns {Promise} + * + * @memberof Reference + */ static symbolicCreate(repo: Repository, name: string, target: string, force: number, logMessage: string): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @param {string} target + * @param {number} force + * @param {string} currentValue + * @param {string} logMessage + * @returns {Promise} + * + * @memberof Reference + */ static symbolicCreateMatching(repo: Repository, name: string, target: string, force: number, currentValue: string, logMessage: string): Promise; + /** + * + * + * @param {Reference} ref2 + * @returns {number} + * + * @memberof Reference + */ cmp(ref2: Reference): number; + /** + * + * + * @returns {number} + * + * @memberof Reference + */ delete(): number; + /** + * + * + * @returns {number} + * + * @memberof Reference + */ isBranch(): number; + /** + * + * + * @returns {number} + * + * @memberof Reference + */ isNote(): number; + /** + * + * + * @returns {number} + * + * @memberof Reference + */ isRemote(): number; + /** + * + * + * @returns {number} + * + * @memberof Reference + */ isTag(): number; + /** + * + * + * @returns {string} + * + * @memberof Reference + */ name(): string; + /** + * + * + * @returns {Repository} + * + * @memberof Reference + */ owner(): Repository; + /** + * + * + * @param {number} type + * @returns {Promise} + * + * @memberof Reference + */ peel(type: number): Promise; + /** + * + * + * @param {string} newName + * @param {number} force + * @param {string} logMessage + * @returns {Promise} + * + * @memberof Reference + */ rename(newName: string, force: number, logMessage: string): Promise; + /** + * + * + * @returns {Promise} + * + * @memberof Reference + */ resolve(): Promise; + /** + * + * + * @param {Oid} id + * @param {string} logMessage + * @returns {Promise} + * + * @memberof Reference + */ setTarget(id: Oid, logMessage: string): Promise; + /** + * + * + * @returns {string} + * + * @memberof Reference + */ shorthand(): string; + /** + * + * + * @param {string} target + * @param {string} logMessage + * @returns {Promise} + * + * @memberof Reference + */ symbolicSetTarget(target: string, logMessage: string): Promise; + /** + * + * + * @returns {string} + * + * @memberof Reference + */ symbolicTarget(): string; + /** + * + * + * @returns {Oid} + * + * @memberof Reference + */ target(): Oid; + /** + * + * + * @returns {Oid} + * + * @memberof Reference + */ targetPeel(): Oid; + /** + * + * + * @returns {number} + * + * @memberof Reference + */ type(): number; - isValid(): Boolean; - isConcrete(): Boolean; - isSymbolic(): Boolean; + /** + * + * + * @returns {boolean} + * + * @memberof Reference + */ + isValid(): boolean; + /** + * + * + * @returns {boolean} + * + * @memberof Reference + */ + isConcrete(): boolean; + /** + * + * + * @returns {boolean} + * + * @memberof Reference + */ + isSymbolic(): boolean; + /** + * + * + * @returns {string} + * + * @memberof Reference + */ toString(): string; + /** + * + * + * @returns {boolean} + * + * @memberof Reference + */ isHead(): boolean; + /** + * + * + * @returns {Promise} + * + * @memberof Reference + */ + dup(): Promise; } diff --git a/types/nodegit/remote-callbacks.d.ts b/types/nodegit/remote-callbacks.d.ts index ca244e5c5e..b3cf3d9054 100644 --- a/types/nodegit/remote-callbacks.d.ts +++ b/types/nodegit/remote-callbacks.d.ts @@ -1,8 +1,44 @@ export class RemoteCallbacks { + /** + * + * + * @type {number} + * @memberof RemoteCallbacks + */ version?: number; + /** + * + * + * @type {Function} + * @memberof RemoteCallbacks + */ credentials?: Function; + /** + * + * + * @type {Function} + * @memberof RemoteCallbacks + */ certificateCheck?: Function; + /** + * + * + * @type {Function} + * @memberof RemoteCallbacks + */ transferProgress?: Function; + /** + * + * + * @type {Function} + * @memberof RemoteCallbacks + */ transport?: Function; + /** + * + * + * @type {undefined} + * @memberof RemoteCallbacks + */ payload?: undefined; } diff --git a/types/nodegit/remote.d.ts b/types/nodegit/remote.d.ts index bba1f640fb..165df83036 100644 --- a/types/nodegit/remote.d.ts +++ b/types/nodegit/remote.d.ts @@ -24,42 +24,367 @@ export namespace Remote { } export class Remote { + /** + * + * + * @static + * @param {Repository} repo + * @param {string} remote + * @param {string} refspec + * @returns {number} + * + * @memberof Remote + */ static addFetch(repo: Repository, remote: string, refspec: string): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} remote + * @param {string} refspec + * @returns {number} + * + * @memberof Remote + */ static addPush(repo: Repository, remote: string, refspec: string): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @param {string} url + * @returns {Remote} + * + * @memberof Remote + */ static create(repo: Repository, name: string, url: string): Remote; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} url + * @returns {Promise} + * + * @memberof Remote + */ static createAnonymous(repo: Repository, url: string): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @param {string} url + * @param {string} fetch + * @returns {Promise} + * + * @memberof Remote + */ static createWithFetchspec(repo: Repository, name: string, url: string, fetch: string): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @returns {Promise} + * + * @memberof Remote + */ static delete(repo: Repository, name: string): Promise; + /** + * + * + * @static + * @param {RemoteCallbacks} opts + * @param {number} version + * @returns {number} + * + * @memberof Remote + */ static initCallbacks(opts: RemoteCallbacks, version: number): number; + /** + * + * + * @static + * @param {string} remote_name + * @returns {number} + * + * @memberof Remote + */ static isValidName(remote_name: string): number; + /** + * + * + * @static + * @param {Repository} repo + * @returns {Promise} + * + * @memberof Remote + */ static list(repo: Repository): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {(string | Remote)} name + * @param {Function} callback + * @returns {Promise} + * + * @memberof Remote + */ static lookup(repo: Repository, name: string | Remote, callback: Function): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} remote + * @param {number} value + * @returns {number} + * + * @memberof Remote + */ static setAutotag(repo: Repository, remote: string, value: number): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} remote + * @param {string} url + * @returns {number} + * + * @memberof Remote + */ static setPushurl(repo: Repository, remote: string, url: string): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} remote + * @param {string} url + * @returns {number} + * + * @memberof Remote + */ static setUrl(repo: Repository, remote: string, url: string): number; + /** + * + * + * @returns {number} + * + * @memberof Remote + */ autotag(): number; + /** + * + * + * @param {Enums.DIRECTION} direction + * @param {RemoteCallbacks} callbacks + * @param {Function} callback + * @returns {Promise} + * + * @memberof Remote + */ connect(direction: Enums.DIRECTION, callbacks: RemoteCallbacks, callback: Function): Promise; + /** + * + * + * @returns {number} + * + * @memberof Remote + */ connected(): number; + /** + * + * + * @returns {Promise} + * + * @memberof Remote + */ defaultBranch(): Promise; + /** + * + * + * @returns {Promise} + * + * @memberof Remote + */ disconnect(): Promise; + /** + * + * + * @param {any[]} refSpecs + * @param {FetchOptions} opts + * @param {Function} callback + * @returns {Promise} + * + * @memberof Remote + */ download(refSpecs: any[], opts: FetchOptions, callback: Function): Promise; dup(): Promise; + /** + * + * + * @param {any[]} refSpecs + * @param {FetchOptions} opts + * @param {string} message + * @param {Function} callback + * @returns {Promise} + * + * @memberof Remote + */ fetch(refSpecs: any[], opts: FetchOptions, message: string, callback: Function): Promise; + /** + * + * + * + * @memberof Remote + */ free(): void; + /** + * + * + * @returns {Promise} + * + * @memberof Remote + */ getFetchRefspecs(): Promise; + /** + * + * + * @returns {Promise} + * + * @memberof Remote + */ getPushRefspecs(): Promise; + /** + * + * + * @param {number} n + * @returns {Refspec} + * + * @memberof Remote + */ getRefspec(n: number): Refspec; + /** + * + * + * @returns {string} + * + * @memberof Remote + */ name(): string; + /** + * + * + * @returns {Repository} + * + * @memberof Remote + */ owner(): Repository; + /** + * + * + * @param {RemoteCallbacks} callbacks + * @returns {number} + * + * @memberof Remote + */ prune(callbacks: RemoteCallbacks): number; + /** + * + * + * @returns {number} + * + * @memberof Remote + */ pruneRefs(): number; + /** + * + * + * @param {any[]} refSpecs + * @param {PushOptions} options + * @param {Function} callback + * @returns {Promise} + * + * @memberof Remote + */ push(refSpecs: any[], options: PushOptions, callback: Function): Promise; + /** + * + * + * @returns {string} + * + * @memberof Remote + */ pushurl(): string; + /** + * + * + * @returns {number} + * + * @memberof Remote + */ refspecCount(): number; + /** + * + * + * @returns {TransferProgress} + * + * @memberof Remote + */ stats(): TransferProgress; + /** + * + * + * + * @memberof Remote + */ stop(): void; + /** + * + * + * @param {RemoteCallbacks} callbacks + * @param {number} update_fetchhead + * @param {number} download_tags + * @param {string} reflog_message + * @returns {number} + * + * @memberof Remote + */ updateTips(callbacks: RemoteCallbacks, update_fetchhead: number, download_tags: number, reflog_message: string): number; + /** + * + * + * @param {Strarray} refspecs + * @param {PushOptions} opts + * @returns {number} + * + * @memberof Remote + */ upload(refspecs: Strarray, opts: PushOptions): number; + /** + * + * + * @returns {string} + * + * @memberof Remote + */ url(): string; + /** + * Lists advertised references from a remote. You must connect to the remote before using referenceList. + * + * @returns {Promise} + * + * @memberof Remote + */ + referenceList(): Promise; } diff --git a/types/nodegit/repository.d.ts b/types/nodegit/repository.d.ts index acf5f5b83a..bf598d5a9f 100644 --- a/types/nodegit/repository.d.ts +++ b/types/nodegit/repository.d.ts @@ -17,6 +17,7 @@ import { Config } from './config'; import { Merge } from './merge'; import { MergeOptions } from './merge-options'; import { Refdb } from './ref-db'; +import {Revwalk} from './rev-walk'; export interface RepositoryInitOptions { description: string; @@ -84,80 +85,702 @@ export class Repository { * @memberof Repository */ static openBare(barePath: string): Promise; + /** + * + * + * @static + * @param {string} path + * @param {number} [flags] + * @param {string} [ceilingDirs] + * @returns {Promise} + * + * @memberof Repository + */ static openExt(path: string, flags?: number, ceilingDirs?: string): Promise; + /** + * + * + * @static + * @param {Odb} odb + * @returns {Promise} + * + * @memberof Repository + */ static wrapOdb(odb: Odb): Promise; + /** + * + * + * + * @memberof Repository + */ cleanup(): void; + /** + * + * + * @returns {Promise} + * + * @memberof Repository + */ config(): Promise; + /** + * + * + * @returns {Promise} + * + * @memberof Repository + */ configSnapshot(): Promise; + /** + * + * + * @returns {number} + * + * @memberof Repository + */ detachHead(): number; + /** + * + * + * @param {Function} callback + * @returns {Promise} + * + * @memberof Repository + */ fetchheadForeach(callback: Function): Promise; + /** + * + * + * + * @memberof Repository + */ free(): void; + /** + * + * + * @returns {string} + * + * @memberof Repository + */ getNamespace(): string; + /** + * + * + * @returns {Promise} + * + * @memberof Repository + */ head(): Promise; + /** + * + * + * @returns {number} + * + * @memberof Repository + */ headDetached(): number; + /** + * + * + * @returns {number} + * + * @memberof Repository + */ headUnborn(): number; + /** + * + * + * @returns {Promise} + * + * @memberof Repository + */ index(): Promise; + /** + * + * + * @returns {number} + * + * @memberof Repository + */ isBare(): number; + /** + * + * + * @returns {number} + * + * @memberof Repository + */ isEmpty(): number; + /** + * + * + * @returns {number} + * + * @memberof Repository + */ isShallow(): number; + /** + * + * + * @param {Function} callback + * @returns {Promise} + * + * @memberof Repository + */ mergeheadForeach(callback: Function): Promise; + /** + * + * + * @returns {number} + * + * @memberof Repository + */ messageRemove(): number; + /** + * + * + * @returns {Promise} + * + * @memberof Repository + */ odb(): Promise; + /** + * + * + * @returns {string} + * + * @memberof Repository + */ path(): string; + /** + * + * + * @returns {Promise} + * + * @memberof Repository + */ refdb(): Promise; + /** + * + * + * @param {string} refname + * @returns {Promise} + * + * @memberof Repository + */ setHead(refname: string): Promise; + /** + * + * + * @param {Oid} commitish + * @returns {number} + * + * @memberof Repository + */ setHeadDetached(commitish: Oid): number; + /** + * + * + * @param {AnnotatedCommit} commitish + * @returns {number} + * + * @memberof Repository + */ setHeadDetachedFromAnnotated(commitish: AnnotatedCommit): number; + /** + * + * + * @param {string} name + * @param {string} email + * @returns {number} + * + * @memberof Repository + */ setIdent(name: string, email: string): number; + /** + * + * + * @param {string} nmspace + * @returns {number} + * + * @memberof Repository + */ setNamespace(nmspace: string): number; + /** + * + * + * @param {string} workdir + * @param {number} update_gitlink + * @returns {number} + * + * @memberof Repository + */ setWorkdir(workdir: string, update_gitlink: number): number; + /** + * + * + * @returns {number} + * + * @memberof Repository + */ state(): number; + /** + * + * + * @returns {number} + * + * @memberof Repository + */ stateCleanup(): number; + /** + * + * + * @returns {string} + * + * @memberof Repository + */ workdir(): string; + /** + * Creates a branch with the passed in name pointing to the commit + * + * @param {string} name + * @param {(Commit | string | Oid)} commit + * @param {boolean} force + * @param {Signature} signature + * @param {string} logMessage + * @returns {Promise} + * + * @memberof Repository + */ createBranch(name: string, commit: Commit | string | Oid, force: boolean, signature: Signature, logMessage: string): Promise; + /** + * Look up a refs's commit. + * + * @param {(string | Reference)} name + * @returns {Promise} + * + * @memberof Repository + */ getReferenceCommit(name: string | Reference): Promise; + /** + * Look up a branch. Alias for getReference + * + * @param {(string | Reference)} name + * @returns {Promise} + * + * @memberof Repository + */ getBranch(name: string | Reference): Promise; + /** + * Look up a branch's most recent commit. Alias to getReferenceCommit + * + * @param {(string | Reference)} name + * @returns {Promise} + * + * @memberof Repository + */ getBranchCommit(name: string | Reference): Promise; + /** + * Gets the branch that HEAD currently points to Is an alias to head() + * + * @returns {Promise} + * + * @memberof Repository + */ getCurrentBranch(): Promise; + /** + * Lookup the reference with the given name. + * + * @param {(string | Reference)} name + * @returns {Promise} + * + * @memberof Repository + */ getReference(name: string | Reference): Promise; + /** + * Lookup references for a repository. + * + * @param {Reference.TYPE} type + * @returns {Promise} + * + * @memberof Repository + */ getReferences(type: Reference.TYPE): Promise; + /** + * Lookup reference names for a repository. + * + * @param {Reference.TYPE} type + * @returns {Promise} + * + * @memberof Repository + */ getReferenceNames(type: Reference.TYPE): Promise; + /** + * + * + * @param {(string | Oid)} string + * @returns {Promise} + * + * @memberof Repository + */ getCommit(string: string | Oid): Promise; + /** + * Retrieve the blob represented by the oid. + * + * @param {(string | Oid)} string + * @returns {Promise} + * + * @memberof Repository + */ getBlob(string: string | Oid): Promise; + /** + * Retrieve the tree represented by the oid. + * + * @param {(string | Oid)} string + * @returns {Promise} + * + * @memberof Repository + */ getTree(string: string | Oid): Promise; + /** + * + * + * @param {(string | Oid)} string + * @param {string} name + * @param {string} message + * @returns {Promise} + * + * @memberof Repository + */ createTag(string: string | Oid, name: string, message: string): Promise; + /** + * Creates a new lightweight tag + * + * @param {(string | Oid)} string + * @param {string} name + * @returns {Promise} + * + * @memberof Repository + */ createLightweightTag(string: string | Oid, name: string): Promise; + /** + * Retrieve the tag represented by the oid. + * + * @param {(string | Oid)} string + * @returns {Promise} + * + * @memberof Repository + */ getTag(string: string | Oid): Promise; + /** + * Retrieve the tag represented by the tag name. + * + * @param {string} Short + * @returns {Promise} + * + * @memberof Repository + */ getTagByName(Short: string): Promise; + /** + * Deletes a tag from a repository by the tag name. + * + * @param {string} Short + * @returns {Promise} + * + * @memberof Repository + */ deleteTagByName(Short: string): Promise; - createRevWalk(string: string | Oid): any; + /** + * Instantiate a new revision walker for browsing the Repository"s history. See also Commit.prototype.history() + * + * @param {(string | Oid)} string + * @returns {Revwalk} + * + * @memberof Repository + */ + createRevWalk(string: string | Oid): Revwalk; + /** + * Retrieve the master branch commit. + * + * @returns {Promise} + * + * @memberof Repository + */ getMasterCommit(): Promise; + /** + * Retrieve the commit that HEAD is currently pointing to + * + * @returns {Promise} + * + * @memberof Repository + */ getHeadCommit(): Promise; + /** + * + * + * @param {string} updateRef + * @param {Signature} author + * @param {Signature} committer + * @param {string} message + * @param {(Tree | Oid | string)} Tree + * @param {any[]} parents + * @returns {Promise} + * + * @memberof Repository + */ createCommit(updateRef: string, author: Signature, committer: Signature, message: string, Tree: Tree | Oid | string, parents: any[]): Promise; + /** + * Creates a new commit on HEAD from the list of passed in files + * + * @param {any[]} filesToAdd + * @param {Signature} author + * @param {Signature} committer + * @param {string} message + * @returns {Promise} + * + * @memberof Repository + */ createCommitOnHead(filesToAdd: any[], author: Signature, committer: Signature, message: string): Promise; + /** + * Create a blob from a buffer + * + * @param {Buffer} buffer + * @returns {Oid} + * + * @memberof Repository + */ createBlobFromBuffer(buffer: Buffer): Oid; + /** + * + * + * @param {Tree} tree + * @returns {*} + * + * @memberof Repository + */ treeBuilder(tree: Tree): any; + /** + * Gets the default signature for the default user and now timestamp + * + * @returns {Signature} + * + * @memberof Repository + */ defaultSignature(): Signature; + /** + * Lists out the remotes in the given repository. + * + * @param {Function} Optional + * @returns {Promise} + * + * @memberof Repository + */ getRemotes(Optional: Function): Promise; + /** + * Gets a remote from the repo + * + * @param {(string | Remote)} remote + * @param {Function} callback + * @returns {Promise} + * + * @memberof Repository + */ getRemote(remote: string | Remote, callback: Function): Promise; - fetch(remote: string | Remote, fetchOptions: Object | FetchOptions): Promise; - fetchAll(fetchOptions: Object | FetchOptions, callback: Function): Promise; + /** + * Fetches from a remote + * + * @param {(string | Remote)} remote + * @param {(Object | FetchOptions)} fetchOptions + * @returns {Promise} + * + * @memberof Repository + */ + fetch(remote: string | Remote, fetchOptions: Object | FetchOptions): Promise; + /** + * Fetches from all remotes. This is done in series due to deadlocking issues with fetching from many remotes that can happen. + * + * @param {(Object | FetchOptions)} fetchOptions + * @param {Function} callback + * @returns {Promise} + * + * @memberof Repository + */ + fetchAll(fetchOptions: Object | FetchOptions, callback: Function): Promise; + /** + * + * + * @param {(string | Reference)} to + * @param {(string | Reference)} from + * @param {Signature} signature + * @param {Merge.PREFERENCE} mergePreference + * @param {MergeOptions} mergeOptions + * @returns {Promise} + * + * @memberof Repository + */ mergeBranches(to: string | Reference, from: string | Reference, signature: Signature, mergePreference: Merge.PREFERENCE, mergeOptions: MergeOptions): Promise; + /** + * Rebases a branch onto another branch + * + * @param {string} branch + * @param {string} upstream + * @param {string} onto + * @param {Signature} signature + * @param {Function} beforeNextFn + * @returns {Promise} + * + * @memberof Repository + */ rebaseBranches(branch: string, upstream: string, onto: string, signature: Signature, beforeNextFn: Function): Promise; + /** + * + * + * @param {Signature} signature + * @param {Function} beforeNextFn + * @returns {Promise} + * + * @memberof Repository + */ continueRebase(signature: Signature, beforeNextFn: Function): Promise; + /** + * Get the status of a repo to it's working directory + * + * @param {*} opts + * @returns {Promise} + * + * @memberof Repository + */ getStatus(opts: any): Promise; + /** + * Get extended statuses of a repo to it's working directory. Status entries have status, headToIndex delta, and indexToWorkdir deltas + * + * @param {*} opts + * @returns {Promise} + * + * @memberof Repository + */ getStatusExt(opts: any): Promise; + /** + * Get the names of the submodules in the repository. + * + * @returns {Promise} + * + * @memberof Repository + */ getSubmoduleNames(): Promise; + /** + * This will set the HEAD to point to the reference and then attempt to update the index and working tree to match the content of the latest commit on that reference + * + * @param {Reference} reference + * @param {(Object | CheckoutOptions)} opts + * @returns {Promise} + * + * @memberof Repository + */ checkoutRef(reference: Reference, opts: Object | CheckoutOptions): Promise; + /** + * This will set the HEAD to point to the local branch and then attempt to update the index and working tree to match the content of the latest commit on that branch + * + * @param {(string | Reference)} branch + * @param {(Object | CheckoutOptions)} opts + * @returns {Promise} + * + * @memberof Repository + */ checkoutBranch(branch: string | Reference, opts: Object | CheckoutOptions): Promise; - stageFilemode(filePath: string | any[], stageNew: Boolean): Promise; - stageLines(filePath: string, newLines: any[], isStaged: Boolean): Promise; - isDefaultState(): Boolean; - isApplyingMailbox(): Boolean; - isBisecting(): Boolean; - isCherrypicking(): Boolean; - isMerging(): Boolean; - isRebasing(): Boolean; - isReverting(): Boolean; + /** + * Stages or unstages line selection of a specified file + * + * @param {(string | any[])} filePath + * @param {boolean} stageNew + * @returns {Promise} + * + * @memberof Repository + */ + stageFilemode(filePath: string | any[], stageNew: boolean): Promise; + /** + * Stages or unstages line selection of a specified file + * + * @param {string} filePath + * @param {any[]} newLines + * @param {boolean} isStaged + * @returns {Promise} + * + * @memberof Repository + */ + stageLines(filePath: string, newLines: any[], isStaged: boolean): Promise; + /** + * Returns true if the repository is in the default NONE state. + * + * @returns {boolean} + * + * @memberof Repository + */ + isDefaultState(): boolean; + /** + * Returns true if the repository is in the APPLY_MAILBOX or APPLY_MAILBOX_OR_REBASE state. + * + * @returns {boolean} + * + * @memberof Repository + */ + isApplyingMailbox(): boolean; + /** + * Returns true if the repository is in the BISECT state. + * + * @returns {boolean} + * + * @memberof Repository + */ + isBisecting(): boolean; + /** + * Returns true if the repository is in the CHERRYPICK state. + * + * @returns {boolean} + * + * @memberof Repository + */ + isCherrypicking(): boolean; + /** + * Returns true if the repository is in the MERGE state. + * + * @returns {boolean} + * + * @memberof Repository + */ + isMerging(): boolean; + /** + * Returns true if the repository is in the REBASE, REBASE_INTERACTIVE, or REBASE_MERGE state. + * + * @returns {boolean} + * + * @memberof Repository + */ + isRebasing(): boolean; + /** + * Returns true if the repository is in the REVERT state. + * + * @returns {boolean} + * + * @memberof Repository + */ + isReverting(): boolean; + /** + * Discard line selection of a specified file. Assumes selected lines are unstaged. + * + * @param {string} filePath + * @param {any[]} selectedLines + * @returns {Promise} + * + * @memberof Repository + */ + discardLines(filePath: string, selectedLines: any[]): Promise; + /** + * Grabs a fresh copy of the index from the repository. Invalidates all previously grabbed indexes + * + * @returns {Promise} + * + * @memberof Repository + */ + refreshIndex(): Promise; } From 21c17befd38a6b37d8dd93a06f5a2887c81b087a Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 9 Jun 2017 02:11:59 +0100 Subject: [PATCH 141/286] Changed Boolean to boolean --- types/nodegit/convenient-patch.d.ts | 44 ++++++++++++++--------------- types/nodegit/tree-entry.d.ts | 8 +++--- types/nodegit/tree.d.ts | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/types/nodegit/convenient-patch.d.ts b/types/nodegit/convenient-patch.d.ts index b03bb2ff54..5d3a9fd03f 100644 --- a/types/nodegit/convenient-patch.d.ts +++ b/types/nodegit/convenient-patch.d.ts @@ -52,89 +52,89 @@ export class ConvenientPatch { /** * Is this an unmodified patch? * - * @returns {Boolean} + * @returns {boolean} * * @memberof ConvenientPatch */ - isUnmodified(): Boolean; + isUnmodified(): boolean; /** * Is this an added patch? * - * @returns {Boolean} + * @returns {boolean} * * @memberof ConvenientPatch */ - isAdded(): Boolean; + isAdded(): boolean; /** * Is this a deleted patch? * - * @returns {Boolean} + * @returns {boolean} * * @memberof ConvenientPatch */ - isDeleted(): Boolean; + isDeleted(): boolean; /** * Is this an modified patch? * - * @returns {Boolean} + * @returns {boolean} * * @memberof ConvenientPatch */ - isModified(): Boolean; + isModified(): boolean; /** * Is this a renamed patch? * - * @returns {Boolean} + * @returns {boolean} * * @memberof ConvenientPatch */ - isRenamed(): Boolean; + isRenamed(): boolean; /** * Is this a copied patch? * - * @returns {Boolean} + * @returns {boolean} * * @memberof ConvenientPatch */ - isCopied(): Boolean; + isCopied(): boolean; /** * Is this an ignored patch? * - * @returns {Boolean} + * @returns {boolean} * * @memberof ConvenientPatch */ - isIgnored(): Boolean; + isIgnored(): boolean; /** * Is this an untracked patch? * - * @returns {Boolean} + * @returns {boolean} * * @memberof ConvenientPatch */ - isUntracked(): Boolean; + isUntracked(): boolean; /** * Is this a type change? * - * @returns {Boolean} + * @returns {boolean} * * @memberof ConvenientPatch */ - isTypeChange(): Boolean; + isTypeChange(): boolean; /** * Is this an undreadable patch? * - * @returns {Boolean} + * @returns {boolean} * * @memberof ConvenientPatch */ - isUnreadable(): Boolean; + isUnreadable(): boolean; /** * Is this a conflicted patch? * - * @returns {Boolean} + * @returns {boolean} * * @memberof ConvenientPatch */ - isConflicted(): Boolean; + isConflicted(): boolean; } diff --git a/types/nodegit/tree-entry.d.ts b/types/nodegit/tree-entry.d.ts index 844f5da90c..a56a658ce1 100644 --- a/types/nodegit/tree-entry.d.ts +++ b/types/nodegit/tree-entry.d.ts @@ -14,10 +14,10 @@ export namespace TreeEntry { } export class TreeEntry { - isFile(): Boolean; - isTree(): Boolean; - isDirectory(): Boolean; - isBlob(): Boolean; + isFile(): boolean; + isTree(): boolean; + isDirectory(): boolean; + isBlob(): boolean; sha(): string; getTree(): Promise; getBlob(): Promise; diff --git a/types/nodegit/tree.d.ts b/types/nodegit/tree.d.ts index c20037cb0a..a4101217d3 100644 --- a/types/nodegit/tree.d.ts +++ b/types/nodegit/tree.d.ts @@ -38,7 +38,7 @@ export class Tree { entryByIndex(i: number): TreeEntry; getEntry(filePath: string): TreeEntry; entries(): TreeEntry[]; - walk(blobsOnly?: Boolean): NodeJS.EventEmitter; + walk(blobsOnly?: boolean): NodeJS.EventEmitter; path(): string; builder(): Treebuilder; } From f904d66dab540a5d5fd2d0ca7a8e9feb2f0e1ce9 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 21:47:13 -0400 Subject: [PATCH 142/286] Correct Reducer in pouchdb-mapreduce Confused between too much different documentation descriptions and not enough code examples. --- types/pouchdb-mapreduce/index.d.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/types/pouchdb-mapreduce/index.d.ts b/types/pouchdb-mapreduce/index.d.ts index 4c3d2e8ebf..92ea09e172 100644 --- a/types/pouchdb-mapreduce/index.d.ts +++ b/types/pouchdb-mapreduce/index.d.ts @@ -11,11 +11,17 @@ declare namespace PouchDB { type Map = (doc: Content) => void; - // The any below would be the value type from emit(key, value), currently hidden from type information in the Map - type Reducer = (keys: Array<[string, any]> | null, values: Content[] | Reduction[], rereduce: boolean) => Reduction[] | Reduction; + /** + * CouchDB-style Reduction function + * + * @param keys From CouchDB documentation: Array of pairs of docid-key for related map function results; + * PouchDB may pass a simple array and also supports complex keys. + */ + type Reducer = (keys: any | null, values: Content[] | Reduction[], rereduce: boolean) => Reduction[] | Reduction; interface Filter { map: Map; + // Assume that Content[] | Reduction[] is enough leverage in most cases to handle intermediate map emits reduce?: Reducer | '_sum' | '_count' | '_stats' | string; } From 851aeea04ae2c6e83abea3b64fdbf68680c5fdb4 Mon Sep 17 00:00:00 2001 From: Dolan Date: Fri, 9 Jun 2017 02:57:41 +0100 Subject: [PATCH 143/286] Added documentation --- types/nodegit/reset.d.ts | 37 +++++ types/nodegit/rev-parse.d.ts | 22 +++ types/nodegit/rev-walk.d.ts | 157 +++++++++++++++++++- types/nodegit/revert.d.ts | 28 +++- types/nodegit/signature.d.ts | 79 ++++++++++ types/nodegit/stash.d.ts | 105 ++++++++++++- types/nodegit/status-entry.d.ts | 18 +++ types/nodegit/status-list.d.ts | 30 ++++ types/nodegit/status-options.d.ts | 24 +++ types/nodegit/status.d.ts | 54 +++++++ types/nodegit/str-array.d.ts | 26 ++++ types/nodegit/submodule-update-options.d.ts | 24 +++ 12 files changed, 596 insertions(+), 8 deletions(-) diff --git a/types/nodegit/reset.d.ts b/types/nodegit/reset.d.ts index 25ff5ae563..1335eb8365 100644 --- a/types/nodegit/reset.d.ts +++ b/types/nodegit/reset.d.ts @@ -13,7 +13,44 @@ export namespace Reset { } export class Reset { + /** + * Look up a refs's commit. + * + * @static + * @param {Repository} repo + * @param {Object} target + * @param {number} reset_type + * @param {CheckoutOptions} checkout_opts + * @returns {Promise} + * + * @memberof Reset + */ static reset(repo: Repository, target: Object, reset_type: number, checkout_opts: CheckoutOptions): Promise; + /** + * Look up a refs's commit. + * + * @static + * @param {Repository} repo + * @param {Object} target + * @param {Strarray} pathspecs + * @returns {Promise} + * + * @memberof Reset + */ static default(repo: Repository, target: Object, pathspecs: Strarray): Promise; + /** + * Sets the current head to the specified commit oid and optionally resets the index and working tree to match. + * This behaves like reset but takes an annotated commit, which lets you specify which extended sha syntax string was specified by a user, allowing for more exact reflog messages. + * See the documentation for reset. + * + * @static + * @param {Repository} repo + * @param {AnnotatedCommit} commit + * @param {number} reset_type + * @param {CheckoutOptions} checkout_opts + * @returns {number} + * + * @memberof Reset + */ static fromAnnotated(repo: Repository, commit: AnnotatedCommit, reset_type: number, checkout_opts: CheckoutOptions): number; } diff --git a/types/nodegit/rev-parse.d.ts b/types/nodegit/rev-parse.d.ts index 7bdbc80676..b4ef63f2f2 100644 --- a/types/nodegit/rev-parse.d.ts +++ b/types/nodegit/rev-parse.d.ts @@ -11,6 +11,28 @@ export namespace Revparse { } export class Revparse { + /** + * + * + * @static + * @param {Object} object_out + * @param {Reference} reference_out + * @param {Repository} repo + * @param {string} spec + * @returns {number} + * + * @memberof Revparse + */ static ext(object_out: Object, reference_out: Reference, repo: Repository, spec: string): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} spec + * @returns {Promise} + * + * @memberof Revparse + */ static single(repo: Repository, spec: string): Promise; } diff --git a/types/nodegit/rev-walk.d.ts b/types/nodegit/rev-walk.d.ts index 643220b492..8ba18bf83a 100644 --- a/types/nodegit/rev-walk.d.ts +++ b/types/nodegit/rev-walk.d.ts @@ -12,25 +12,180 @@ export namespace Revwalk { } export class Revwalk { + /** + * + * + * @static + * @param {Repository} repo + * @returns {Revwalk} + * + * @memberof Revwalk + */ static create(repo: Repository): Revwalk; + /** + * + * + * @param {Oid} commit_id + * @returns {number} + * + * @memberof Revwalk + */ hide(commit_id: Oid): number; + /** + * + * + * @param {string} glob + * @returns {number} + * + * @memberof Revwalk + */ hideGlob(glob: string): number; + /** + * + * + * @returns {number} + * + * @memberof Revwalk + */ hideHead(): number; + /** + * + * + * @param {string} refname + * @returns {number} + * + * @memberof Revwalk + */ hideRef(refname: string): number; + /** + * + * + * @returns {Promise} + * + * @memberof Revwalk + */ next(): Promise; + /** + * + * + * @param {Oid} id + * @returns {number} + * + * @memberof Revwalk + */ push(id: Oid): number; + /** + * + * + * @param {string} glob + * @returns {number} + * + * @memberof Revwalk + */ pushGlob(glob: string): number; + /** + * + * + * @returns {number} + * + * @memberof Revwalk + */ pushHead(): number; + /** + * + * + * @param {string} range + * @returns {number} + * + * @memberof Revwalk + */ pushRange(range: string): number; + /** + * + * + * @param {string} refname + * @returns {number} + * + * @memberof Revwalk + */ pushRef(refname: string): number; + /** + * + * + * @returns {Repository} + * + * @memberof Revwalk + */ repository(): Repository; + /** + * + * + * + * @memberof Revwalk + */ reset(): void; + /** + * + * + * + * @memberof Revwalk + */ simplifyFirstParent(): void; - sorting(sort: number): any; + /** + * Set the sort order for the revwalk. This function takes variable arguments like revwalk.sorting(NodeGit.RevWalk.Topological, NodeGit.RevWalk.Reverse). + * + * @param {number} sort + * + * @memberof Revwalk + */ + sorting(sort: number): void; + /** + * + * + * @param {number} max_count + * @returns {Promise} + * + * @memberof Revwalk + */ fastWalk(max_count: number): Promise; + /** + * + * + * @param {string} filePath + * @param {number} max_count + * @returns {Promise} + * + * @memberof Revwalk + */ fileHistoryWalk(filePath: string, max_count: number): Promise; + /** + * Walk the history from the given oid. The callback is invoked for each commit; When the walk is over, the callback is invoked with (null, null). + * + * @param {Oid} oid + * @param {Function} callback + * @returns {Commit} + * + * @memberof Revwalk + */ walk(oid: Oid, callback: Function): Commit; + /** + * Walk the history grabbing commits until the checkFn called with the current commit returns false. + * + * @param {Function} checkFn + * @returns {Promise} + * + * @memberof Revwalk + */ getCommitsUntil(checkFn: Function): Promise; + /** + * + * + * @param {number} count + * @returns {Promise} + * + * @memberof Revwalk + */ getCommits(count: number): Promise; + } diff --git a/types/nodegit/revert.d.ts b/types/nodegit/revert.d.ts index a1210182eb..ac0cbf531a 100644 --- a/types/nodegit/revert.d.ts +++ b/types/nodegit/revert.d.ts @@ -12,6 +12,30 @@ export interface RevertOptions { } export class Revert { - static revert(repo: Repository, commit: Commit, given_opts: RevertOptions): Promise; - static commit(repo: Repository, revert_commit: Commit, our_commit: Commit, mainline: number, merge_options: MergeOptions): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Commit} commit + * @param {RevertOptions} givenOpts + * @returns {Promise} + * + * @memberof Revert + */ + static revert(repo: Repository, commit: Commit, givenOpts: RevertOptions): Promise; + /** + * Reverts the given commit against the given "our" commit, producing an index that reflects the result of the revert. + * + * @static + * @param {Repository} repo + * @param {Commit} revert_commit + * @param {Commit} ourCommit + * @param {number} mainline + * @param {MergeOptions} mergeOptions + * @returns {Promise} + * + * @memberof Revert + */ + static commit(repo: Repository, revert_commit: Commit, ourCommit: Commit, mainline: number, mergeOptions: MergeOptions): Promise; } diff --git a/types/nodegit/signature.d.ts b/types/nodegit/signature.d.ts index c18ccb45ff..6854760004 100644 --- a/types/nodegit/signature.d.ts +++ b/types/nodegit/signature.d.ts @@ -2,14 +2,93 @@ import { Repository } from './repository'; import { Time } from './time'; export class Signature { + /** + * + * + * @static + * @param {Repository} repo + * @returns {Signature} + * + * @memberof Signature + */ static default(repo: Repository): Signature; + /** + * + * + * @static + * @param {string} name + * @param {string} email + * @param {number} time + * @param {number} offset + * @returns {Signature} + * + * @memberof Signature + */ static create(name: string, email: string, time: number, offset: number): Signature; + /** + * + * + * @static + * @param {string} name + * @param {string} email + * @returns {Signature} + * + * @memberof Signature + */ static now(name: string, email: string): Signature; + /** + * + * + * @static + * @param {string} buf + * @returns {Promise} + * + * @memberof Signature + */ + static fromBuffer(buf: string): Promise; + /** + * + * + * @returns {Promise} + * + * @memberof Signature + */ dup(): Promise; + /** + * + * + * + * @memberof Signature + */ free(): void; + /** + * + * + * @returns {string} + * + * @memberof Signature + */ toString(): string; + /** + * + * + * @type {string} + * @memberof Signature + */ name: string; + /** + * + * + * @type {string} + * @memberof Signature + */ email: string; + /** + * + * + * @type {Time} + * @memberof Signature + */ when: Time; } diff --git a/types/nodegit/stash.d.ts b/types/nodegit/stash.d.ts index c81e94b7b6..1aae88bd85 100644 --- a/types/nodegit/stash.d.ts +++ b/types/nodegit/stash.d.ts @@ -29,18 +29,113 @@ export namespace Stash { } export interface StashApplyOptions { - version: number; - flags: number; - checkoutOptions: CheckoutOptions; - progressCb: Function; - progressPayload: any; + /** + * + * + * @type {number} + * @memberof StashApplyOptions + */ + version?: number; + /** + * + * + * @type {number} + * @memberof StashApplyOptions + */ + flags?: number; + /** + * + * + * @type {CheckoutOptions} + * @memberof StashApplyOptions + */ + checkoutOptions?: CheckoutOptions; + /** + * + * + * @type {Function} + * @memberof StashApplyOptions + */ + progressCb?: Function; + /** + * + * + * @type {*} + * @memberof StashApplyOptions + */ + progressPayload?: any; } export class Stash { + /** + * + * + * @static + * @param {Repository} repo + * @param {number} index + * @param {StashApplyOptions} options + * @returns {Promise} + * + * @memberof Stash + */ static apply(repo: Repository, index: number, options: StashApplyOptions): Promise; + /** + * + * + * @static + * @param {StashApplyOptions} opts + * @param {number} version + * @returns {number} + * + * @memberof Stash + */ static applyInitOptions(opts: StashApplyOptions, version: number): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {number} index + * @returns {Promise} + * + * @memberof Stash + */ static drop(repo: Repository, index: number): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Function} callback + * @param {*} payload + * @returns {Promise} + * + * @memberof Stash + */ static foreach(repo: Repository, callback: Function, payload: any): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {number} index + * @param {StashApplyOptions} options + * @returns {Promise} + * + * @memberof Stash + */ static pop(repo: Repository, index: number, options: StashApplyOptions): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Signature} stasher + * @param {string} message + * @param {number} flags + * @returns {Promise} + * + * @memberof Stash + */ static save(repo: Repository, stasher: Signature, message: string, flags: number): Promise; } diff --git a/types/nodegit/status-entry.d.ts b/types/nodegit/status-entry.d.ts index bc2ab62a12..70435d5de1 100644 --- a/types/nodegit/status-entry.d.ts +++ b/types/nodegit/status-entry.d.ts @@ -1,7 +1,25 @@ import { DiffDelta } from './diff-delta'; export class StatusEntry { + /** + * + * + * @type {number} + * @memberof StatusEntry + */ status: number; + /** + * + * + * @type {DiffDelta} + * @memberof StatusEntry + */ headToIndex: DiffDelta; + /** + * + * + * @type {DiffDelta} + * @memberof StatusEntry + */ indexToWorkdir: DiffDelta; } diff --git a/types/nodegit/status-list.d.ts b/types/nodegit/status-list.d.ts index 6d83044801..7847da4d1d 100644 --- a/types/nodegit/status-list.d.ts +++ b/types/nodegit/status-list.d.ts @@ -3,9 +3,39 @@ import { DiffPerfdata } from './diff-perf-data'; import { StatusOptions } from './status-options'; export class StatusList { + /** + * + * + * @static + * @param {Repository} repo + * @param {StatusOptions} opts + * @returns {Promise} + * + * @memberof StatusList + */ static create(repo: Repository, opts: StatusOptions): Promise; + /** + * + * + * @returns {number} + * + * @memberof StatusList + */ entrycount(): number; + /** + * + * + * + * @memberof StatusList + */ free(): void; + /** + * + * + * @returns {Promise} + * + * @memberof StatusList + */ getPerfdata(): Promise; } diff --git a/types/nodegit/status-options.d.ts b/types/nodegit/status-options.d.ts index 9f75bbe96d..fe2f728737 100644 --- a/types/nodegit/status-options.d.ts +++ b/types/nodegit/status-options.d.ts @@ -1,8 +1,32 @@ import { Strarray } from './str-array'; export interface StatusOptions { + /** + * + * + * @type {number} + * @memberof StatusOptions + */ version?: number; + /** + * + * + * @type {number} + * @memberof StatusOptions + */ show?: number; + /** + * + * + * @type {number} + * @memberof StatusOptions + */ flags?: number; + /** + * + * + * @type {Strarray} + * @memberof StatusOptions + */ pathspec?: Strarray; } diff --git a/types/nodegit/status.d.ts b/types/nodegit/status.d.ts index 1059dd6bff..892b1f1c36 100644 --- a/types/nodegit/status.d.ts +++ b/types/nodegit/status.d.ts @@ -48,9 +48,63 @@ export namespace Status { } export class Status { + /** + * + * + * @static + * @param {StatusList} statuslist + * @param {number} idx + * @returns {StatusEntry} + * + * @memberof Status + */ static byIndex(statuslist: StatusList, idx: number): StatusEntry; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} path + * @returns {number} + * + * @memberof Status + */ static file(repo: Repository, path: string): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {Function} callback + * @param {*} payload + * @returns {Promise} + * + * @memberof Status + */ static foreach(repo: Repository, callback: Function, payload: any): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {StatusOptions} opts + * @param {Function} callback + * @param {*} payload + * @returns {Promise} + * + * @memberof Status + */ static foreachExt(repo: Repository, opts: StatusOptions, callback: Function, payload: any): Promise; + /** + * + * + * @static + * @param {number} ignored + * @param {Repository} repo + * @param {string} path + * @returns {number} + * + * @memberof Status + */ static shouldIgnore(ignored: number, repo: Repository, path: string): number; } diff --git a/types/nodegit/str-array.d.ts b/types/nodegit/str-array.d.ts index 525667fbcb..603889f756 100644 --- a/types/nodegit/str-array.d.ts +++ b/types/nodegit/str-array.d.ts @@ -1,6 +1,32 @@ export class Strarray { + /** + * + * + * @param {Strarray} src + * @returns {number} + * + * @memberof Strarray + */ copy(src: Strarray): number; + /** + * + * + * + * @memberof Strarray + */ free(): void; + /** + * + * + * @type {string[]} + * @memberof Strarray + */ strings: string[]; + /** + * + * + * @type {number} + * @memberof Strarray + */ count: number; } diff --git a/types/nodegit/submodule-update-options.d.ts b/types/nodegit/submodule-update-options.d.ts index d96320204b..3b07383090 100644 --- a/types/nodegit/submodule-update-options.d.ts +++ b/types/nodegit/submodule-update-options.d.ts @@ -2,8 +2,32 @@ import { CheckoutOptions } from './checkout-options'; import { FetchOptions } from './fetch-options'; export interface SubmoduleUpdateOptions { + /** + * + * + * @type {number} + * @memberof SubmoduleUpdateOptions + */ version?: number; + /** + * + * + * @type {CheckoutOptions} + * @memberof SubmoduleUpdateOptions + */ checkoutOpts?: CheckoutOptions; + /** + * + * + * @type {FetchOptions} + * @memberof SubmoduleUpdateOptions + */ fetchOpts?: FetchOptions; + /** + * + * + * @type {number} + * @memberof SubmoduleUpdateOptions + */ cloneCheckoutStrategy?: number; } From 35013236c78c0c5ecd7e024e84e8221a8b56b2f1 Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 21:58:45 -0400 Subject: [PATCH 144/286] Make a type for built-in reducers in pouchdb-mapreduce --- types/pouchdb-mapreduce/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/pouchdb-mapreduce/index.d.ts b/types/pouchdb-mapreduce/index.d.ts index 92ea09e172..883339bc82 100644 --- a/types/pouchdb-mapreduce/index.d.ts +++ b/types/pouchdb-mapreduce/index.d.ts @@ -10,6 +10,7 @@ /* tslint:disable:no-single-declare-module */ declare namespace PouchDB { + type BuiltInReducers = '_sum' | '_count' | '_stats'; type Map = (doc: Content) => void; /** * CouchDB-style Reduction function @@ -22,13 +23,13 @@ declare namespace PouchDB { interface Filter { map: Map; // Assume that Content[] | Reduction[] is enough leverage in most cases to handle intermediate map emits - reduce?: Reducer | '_sum' | '_count' | '_stats' | string; + reduce?: Reducer | BuiltInReducers | string; } namespace Query { interface Options { /** Reduce function, or the string name of a built-in function: '_sum', '_count', or '_stats'. */ - reduce?: Reducer | '_sum' | '_count' | '_stats' | boolean; + reduce?: Reducer | BuiltInReducers | boolean; /** Include the document in each row in the doc field. */ include_docs?: boolean; /** Include conflicts in the _conflicts field of a doc. */ From 31df86f74f9afc29f6fb7a98c045ae1598d2844d Mon Sep 17 00:00:00 2001 From: Max Battcher Date: Thu, 8 Jun 2017 22:17:00 -0400 Subject: [PATCH 145/286] Support PouchDB emit-included maps Include a note that CouchDB does not support them and they always run locally. --- types/pouchdb-mapreduce/index.d.ts | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/types/pouchdb-mapreduce/index.d.ts b/types/pouchdb-mapreduce/index.d.ts index 883339bc82..3ac60c8293 100644 --- a/types/pouchdb-mapreduce/index.d.ts +++ b/types/pouchdb-mapreduce/index.d.ts @@ -11,7 +11,12 @@ declare namespace PouchDB { type BuiltInReducers = '_sum' | '_count' | '_stats'; - type Map = (doc: Content) => void; + /** + * CouchDB-style Map function + * + * @param emit CouchDB does not support emit as an argument and maps defined this way will always run locally + */ + type Map = (doc: Content, emit?: (key: any, value: Content | Result) => void) => void; /** * CouchDB-style Reduction function * @@ -21,8 +26,8 @@ declare namespace PouchDB { type Reducer = (keys: any | null, values: Content[] | Reduction[], rereduce: boolean) => Reduction[] | Reduction; interface Filter { - map: Map; - // Assume that Content[] | Reduction[] is enough leverage in most cases to handle intermediate map emits + // Assume that Content | Reduction is enough leverage in most cases to handle intermediate map emits + map: Map; reduce?: Reducer | BuiltInReducers | string; } @@ -105,17 +110,17 @@ declare namespace PouchDB { * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Map | Filter, opts: Query.Options, callback: Core.Callback>): void; + query(fun: string | Map | Filter, opts: Query.Options, callback: Core.Callback>): void; /** * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Map | Filter, callback: Core.Callback>): void; + query(fun: string | Map | Filter, callback: Core.Callback>): void; /** * Invoke a map/reduce function, which allows you to perform more complex queries * on PouchDB than what you get with allDocs(). */ - query(fun: string | Map | Filter, opts?: Query.Options): Promise>; + query(fun: string | Map | Filter, opts?: Query.Options): Promise>; } } From 8c19e8e8862acb0fff191b9d7413ead46bed7c5b Mon Sep 17 00:00:00 2001 From: David Sanders Date: Fri, 9 Jun 2017 19:03:28 +1000 Subject: [PATCH 146/286] Added InvalidEvent, onInvalid & onInvalidCapture https://developer.mozilla.org/en-US/docs/Web/Events/invalid --- types/react/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 7d71c2d183..d533a67bf4 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -330,6 +330,10 @@ declare namespace React { interface FormEvent extends SyntheticEvent { } + interface InvalidEvent extends SyntheticEvent { + target: EventTarget & T; + } + interface ChangeEvent extends SyntheticEvent { target: EventTarget & T; } @@ -502,6 +506,8 @@ declare namespace React { onResetCapture?: FormEventHandler; onSubmit?: FormEventHandler; onSubmitCapture?: FormEventHandler; + onInvalid?: FormEventHandler; + onInvalidCapture?: FormEventHandler; // Image Events onLoad?: ReactEventHandler; From 9515215657a10f849f42b27cf74b46f315b58c72 Mon Sep 17 00:00:00 2001 From: andraaspar Date: Fri, 9 Jun 2017 13:57:00 +0200 Subject: [PATCH 147/286] Make Mithril component use more strict. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Removed ‘[s: string]: any’ from Lifecycle. * Added tests for component use. ‘Object literal may only specify known properties’ is the important piece. --- types/mithril/index.d.ts | 1 - types/mithril/test/test-component.ts | 29 +++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/types/mithril/index.d.ts b/types/mithril/index.d.ts index 1179db4fbc..e17064abfc 100644 --- a/types/mithril/index.d.ts +++ b/types/mithril/index.d.ts @@ -44,7 +44,6 @@ declare namespace Mithril { onbeforeupdate?(this: State, vnode: Vnode, old: VnodeDOM): boolean | void; /** The onremove hook is called before a DOM element is removed from the document. */ onupdate?(this: State, vnode: VnodeDOM): any; - [s: string]: any; } interface Hyperscript { diff --git a/types/mithril/test/test-component.ts b/types/mithril/test/test-component.ts index 40fdfdfd5a..67e271329e 100644 --- a/types/mithril/test/test-component.ts +++ b/types/mithril/test/test-component.ts @@ -1,5 +1,6 @@ import * as m from 'mithril'; -import {Component, Comp} from 'mithril'; + +import {Comp, Component} from 'mithril'; /////////////////////////////////////////////////////////// // 0. @@ -45,6 +46,32 @@ const comp2: Component = { } }; +// Correct use +m(comp2, {title: '', description: ''}); + +// Correct use with lifecycle method +m(comp2, {title: '', description: '', oncreate: (v) => v.attrs.title + '\n' + v.attrs.description}); + +// Properties missing +// $ExpectError +m(comp2, {}); + +// Property 'description' is missing in type '{ title: string; }'. +// $ExpectError +m(comp2, {title: ''}); + +// Property 'title' is missing in type '{ description: string; }'. +// $ExpectError +m(comp2, {description: ''}); + +// Type 'boolean' is not assignable to type 'string'. +// $ExpectError +m(comp2, {title: '', description: true}); + +// Object literal may only specify known properties, and 'foo' does not exist in type 'Comp2Attrs & Lifecycle & { key?: string | number | undefined; }'. +// $ExpectError +m(comp2, {title: '', description: '', foo: ''}); + /////////////////////////////////////////////////////////// // 3. // Declares attrs type inline. From 9878248e8d2bf54e2015d4f7f380d46a23a8102f Mon Sep 17 00:00:00 2001 From: StefanSchoof Date: Fri, 9 Jun 2017 14:15:16 +0200 Subject: [PATCH 148/286] Use ts 2.1 keyof Feature --- types/sharepoint/index.d.ts | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/types/sharepoint/index.d.ts b/types/sharepoint/index.d.ts index 3520e12f06..1d056448a4 100644 --- a/types/sharepoint/index.d.ts +++ b/types/sharepoint/index.d.ts @@ -2,6 +2,7 @@ // Project: https://msdn.microsoft.com/en-us/library/office/jj193034.aspx // Definitions by: Stanislav Vyshchepan , Andrey Markeev // Definitions: https:// github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1. /// @@ -3538,7 +3539,7 @@ declare namespace SP { newMode } /** Represents a list on a SharePoint Web site. */ - class List extends SP.SecurableObject { + class List extends SP.SecurableObject { /** Gets item by id. */ getItemById(id: number): SP.ListItem; /** Gets a value that specifies whether the list supports content types. */ @@ -3750,20 +3751,20 @@ declare namespace SP { /** Sends the list to the site recycle bin. */ recycle(): SP.GuidResult; /** Returns collection of list items based on the specified CAML query. */ - getItems(query: SP.CamlQuery): SP.ListItemCollection; + getItems(query: SP.CamlQuery): SP.ListItemCollection; /** Creates a new list item in the list. */ addItem(parameters: SP.ListItemCreationInformation): SP.ListItem; } /** Represents a collection of SP.List objects */ class ListCollection extends SP.ClientObjectCollection { /** Gets the list at the specified index in the collection. */ - itemAt(index: number): SP.List; + itemAt(index: number): SP.List; /** Gets the list at the specified index in the collection. */ - get_item(index: number): SP.List; + get_item(index: number): SP.List; /** Returns the list with the specified title from the collection. */ - getByTitle(title: string): SP.List; + getByTitle(title: string): SP.List; /** Returns the list with the specified list identifier. */ - getById(id: string | SP.Guid): SP.List; + getById(id: string | SP.Guid): SP.List; /** Creates a new list or a document library. */ add(parameters: SP.ListCreationInformation): SP.List; /** Gets a list that is the default location for wiki pages. */ @@ -3830,12 +3831,12 @@ declare namespace SP { textField, } /** Represents an item or row in a list. */ - class ListItem extends SP.SecurableObject { - get_fieldValues(): any; + class ListItem extends SP.SecurableObject { + get_fieldValues(): T; /** Gets the specified field value for the list item. Field value is returned as string, but it can be casted to a specific field value type, e.g. SP.LookupFieldValue, etc. */ - get_item(fieldInternalName: string): any; + get_item(fieldInternalName: K): T[K]; /** Sets the specified field value for the list item. Consider using parseAndSetFieldValue instead. */ - set_item(fieldInternalName: string, value: any): void; + set_item(fieldInternalName: K, value: T[K]): void; /** Gets collection of objects that represent attachments for the list item. */ get_attachmentFiles(): SP.AttachmentCollection; /** Gets the content type of the item. */ @@ -3878,10 +3879,10 @@ declare namespace SP { /** Validates form values specified for the list item. Errors are returned through hasException and errorMessage properties of the ListItemFormUpdateValue objects */ validateUpdateListItem(formValues: SP.ListItemFormUpdateValue[], bNewDocumentUpdate: boolean): SP.ListItemFormUpdateValue[]; } - class ListItemCollection extends SP.ClientObjectCollection { - itemAt(index: number): SP.ListItem; - get_item(index: number): SP.ListItem; - getById(id: number | string): SP.ListItem; + class ListItemCollection extends SP.ClientObjectCollection> { + itemAt(index: number): SP.ListItem; + get_item(index: number): SP.ListItem; + getById(id: number | string): SP.ListItem; get_listItemCollectionPosition(): SP.ListItemCollectionPosition; } class ListItemCollectionPosition extends SP.ClientValueObject { From 13f2c9175e0eb8f98687dea92a9a437daba4c950 Mon Sep 17 00:00:00 2001 From: StefanSchoof Date: Fri, 9 Jun 2017 14:21:31 +0200 Subject: [PATCH 149/286] Bump required version to 2.3 --- types/sharepoint/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/sharepoint/index.d.ts b/types/sharepoint/index.d.ts index 1d056448a4..dca11083a6 100644 --- a/types/sharepoint/index.d.ts +++ b/types/sharepoint/index.d.ts @@ -2,7 +2,7 @@ // Project: https://msdn.microsoft.com/en-us/library/office/jj193034.aspx // Definitions by: Stanislav Vyshchepan , Andrey Markeev // Definitions: https:// github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1. +// TypeScript Version: 2.3 /// From e13ac9613f37db7a3ba35230ad66f80bffa9017a Mon Sep 17 00:00:00 2001 From: StefanSchoof Date: Fri, 9 Jun 2017 14:26:08 +0200 Subject: [PATCH 150/286] Add Test --- types/sharepoint/sharepoint-tests.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/sharepoint/sharepoint-tests.ts b/types/sharepoint/sharepoint-tests.ts index 20555d0cd5..63fd693fcc 100644 --- a/types/sharepoint/sharepoint-tests.ts +++ b/types/sharepoint/sharepoint-tests.ts @@ -370,11 +370,16 @@ function deleteFolder(resultpanel: HTMLElement) { } } +interface Announcements { + Title: string; + Body: string; +} + // List item tasks function readItems(resultpanel: HTMLElement) { const clientContext = SP.ClientContext.get_current(); const oWebsite = clientContext.get_web(); - const oList = oWebsite.get_lists().getByTitle("Announcements"); + const oList = oWebsite.get_lists().getByTitle("Announcements"); const camlQuery = new SP.CamlQuery(); camlQuery.set_viewXml( '' + From 887c45291d89b832ad02b6fbfba0da5da32248b2 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 9 Jun 2017 13:38:36 +0100 Subject: [PATCH 151/286] Adds fallback param to lookup function --- types/mime/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/mime/index.d.ts b/types/mime/index.d.ts index 73a094492b..449875034b 100644 --- a/types/mime/index.d.ts +++ b/types/mime/index.d.ts @@ -6,7 +6,7 @@ // Imported from: https://github.com/soywiz/typescript-node-definitions/mime.d.ts -export declare function lookup(path: string): string; +export declare function lookup(path: string, fallback: string): string; export declare function extension(mime: string): string; export declare function load(filepath: string): void; export declare function define(mimes: Object): void; From 4a53abc938f80e180f3a64fdcafc33363bf1a0f4 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 9 Jun 2017 14:02:31 +0100 Subject: [PATCH 152/286] Adds tslint.json --- types/mime/tslint.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 types/mime/tslint.json diff --git a/types/mime/tslint.json b/types/mime/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mime/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From f3ac12f02833a829de49996083df54d52af1a986 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 9 Jun 2017 14:02:55 +0100 Subject: [PATCH 153/286] Fixes linting errors --- types/mime/index.d.ts | 17 ++++++++--------- types/mime/mime-tests.ts | 8 ++++---- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/types/mime/index.d.ts b/types/mime/index.d.ts index 449875034b..b0fb1c8735 100644 --- a/types/mime/index.d.ts +++ b/types/mime/index.d.ts @@ -1,19 +1,18 @@ -// Type definitions for mime +// Type definitions for mime 1.3 // Project: https://github.com/broofa/node-mime // Definitions by: Jeff Goddard // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Imported from: https://github.com/soywiz/typescript-node-definitions/mime.d.ts +export function lookup(path: string, fallback: string): string; +export function extension(mime: string): string; +export function load(filepath: string): void; +export function define(mimes: { [key: string]: any }): void; -export declare function lookup(path: string, fallback: string): string; -export declare function extension(mime: string): string; -export declare function load(filepath: string): void; -export declare function define(mimes: Object): void; - -interface Charsets { +export interface Charsets { lookup(mime: string): string; } -export declare var charsets: Charsets; -export declare var default_type: string; +export const charsets: Charsets; +export const default_type: string; diff --git a/types/mime/mime-tests.ts b/types/mime/mime-tests.ts index abffa341f7..2eee9d9b12 100644 --- a/types/mime/mime-tests.ts +++ b/types/mime/mime-tests.ts @@ -1,10 +1,10 @@ - import * as mime from "mime"; -var str: string; -var obj: Object; +let str: string; +const obj: {} = {}; +const fallback: string = ''; -str = mime.lookup(str); +str = mime.lookup(str, fallback); str = mime.extension(str); mime.load(str); mime.define(obj); From c144d1caaf3c8f78e696a0121a9474735dee1e99 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 9 Jun 2017 14:55:57 +0100 Subject: [PATCH 154/286] Fixes declarations to namespace --- types/mime/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/mime/index.d.ts b/types/mime/index.d.ts index b0fb1c8735..71b4677ac6 100644 --- a/types/mime/index.d.ts +++ b/types/mime/index.d.ts @@ -5,6 +5,8 @@ // Imported from: https://github.com/soywiz/typescript-node-definitions/mime.d.ts +export as namespace mime; + export function lookup(path: string, fallback: string): string; export function extension(mime: string): string; export function load(filepath: string): void; From 4f8942e318d76352cf0e2e9a68e72ba4b21cee55 Mon Sep 17 00:00:00 2001 From: baywet Date: Fri, 9 Jun 2017 10:41:27 -0400 Subject: [PATCH 155/286] Adding missing properties on _spPageContextINfo --- types/sharepoint/index.d.ts | 58 ++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/types/sharepoint/index.d.ts b/types/sharepoint/index.d.ts index b4e4e4cb9d..be020bf4b5 100644 --- a/types/sharepoint/index.d.ts +++ b/types/sharepoint/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Microsoft SharePoint: 2013.1 // Project: https://msdn.microsoft.com/en-us/library/office/jj193034.aspx -// Definitions by: Stanislav Vyshchepan , Andrey Markeev +// Definitions by: Stanislav Vyshchepan , Andrey Markeev , Vincent Biret // Definitions: https:// github.com/DefinitelyTyped/DefinitelyTyped /// @@ -153,23 +153,79 @@ declare class JSRequest { declare class _spPageContextInfo { static alertsEnabled: boolean; // true static allowSilverlightPrompt: string; // "True" + static blockDownloadsExperienceEnabled: boolean; // true + static canUserCreateMicrosoftForm: boolean; // true + static cdnPrefix: string; // "static.sharepointonline.com/bld" static clientServerTimeDelta: number; // -182 + static CorrelationId: string; // "6161f99d-10e5-4000-ad30-1016270fe31d" static crossDomainPhotosEnabled: boolean; // true static currentCultureName: string; // "ru-RU" static currentLanguage: number; // 1049 static currentUICultureName: string; // "ru-RU" + static disableAppViews: boolean; // true + static disableFlows: boolean; // true + static env: string // "prod" + static farmLabel: string; // "US_4_Content" + static formDigestValue: string; // "0x5F3FE84E7EE9089C7D11DCDAFFB9E69CF8241E68B9EF071FA92CD419E878AC4F7C16E34696EFA667EFD0712FC1DF4945DDC0D09B5D23153A698A727AF076B5DE,07 Jun 2017 18:55:22 -0000" + static formDigestTimeoutSeconds: number; // 1800 + static groupColor: string; // "#d40ac7" + static groupHasHomepage: boolean; // true + static groupId: string; // + static guestsEnabled: boolean; // true + static hasManageWebPermissions: boolean; // true + static isAnonymousGuestUser: boolean; // true + static isAppWeb: boolean; // true + static isExternalGuestUser: boolean; // true + static isNoScriptEnabled: boolean; // true + static isSiteAdmin: boolean; //true + static isSPO: boolean; // true + static isTenantDevSite: boolean; // true + static isWebWelcomePage: boolean; // true static layoutsUrl: string; // "_layouts/15" + static listBaseTemplate: number; // 119 + static listId: string; // "{06ee6d96-f27f-4160-b6bb-c18f187b18a7}" + static listPermsMask: { High: number; Low: number; }; + static listTitle: string; // "Site Pages" + static listUrl: string; // "/sites/site/list" + static maximumFileSize: number; // 15360 + static openInClient: boolean; // true static pageListId: string; // "{06ee6d96-f27f-4160-b6bb-c18f187b18a7}" static pageItemId: number; + static pagePermsMask: { High: number; Low: number; }; static pagePersonalizationScope: string; // 1 + static PreviewFeaturesEnabled: boolean; // true + static preferUserTimeZone: boolean; // false + static ProfileUrl: string; // "https://tenant-my.sharepoint.com/person.aspx" + static PublishingFeatureOn: boolean; // true + static RecycleBinItemCount: number; // -1 + static serverRedirectedUrl: string; static serverRequestPath: string; // "/SPTypeScript/Lists/ConditionalFormattingTasksList/AllItems.aspx" + static serverTime: string; // "2017-06-07T18:55:22.3499459Z" static siteAbsoluteUrl: string; // "https:// gandjustas-7b20d3715e8ed4.sharepoint.com" + static siteClassification: string; // static siteClientTag: string; // "0$$15.0.4454.1021" + static siteColor: string; // "#d40ac7" + static siteId: string; // "{3e09a056-f68f-44a3-8e0f-ff2c123b82cb}" + static sitePagesEnabled: boolean; // true static siteServerRelativeUrl: string; // "/" + static siteSubscriptionId: string; // 4eedf5f3-f71f-4e73-82ee-e19081363c8c + static supportPoundStorePath: boolean; // true + static supportPercentStorePath: boolean; // true static systemUserKey: string; // "i:0h.f|membership|10033fff84e7cb2b@live.com" static tenantAppVersion: string; // "0" + static themeCacheToken: string; // "/sites/site::0:16.0.6525.1206" + static themedCssFolderUrl: string; + static themedImageFileNames: string; + static updateFormDigestPageLoaded: string; // "2017-06-07T18:55:25.821Z" + static userDisplayName: string; // "John Doe" + static userEmail: string; // "john.doe@fabrikam.onmicrosoft.com" static userId: number; // 12 + static userLoginName: string; // "john.doe@fabrikam.onmicrosoft.com" + static viewOnlyExperienceEnabled: boolean; // true + static viewId: string; // "{06ee6d96-f27f-4160-b6bb-c18f187b18a7}" static webAbsoluteUrl: string; // "https:// gandjustas-7b20d3715e8ed4.sharepoint.com/SPTypeScript" + static webDescription: string; // "Some description" + static webId: string; // "{06ee6d96-f27f-4160-b6bb-c18f187b18a7}" static webLanguage: number; // 1049 static webLogoUrl: string; // "/_layouts/15/images/siteIcon.png?rev=23" static webPermMasks: { High: number; Low: number; }; From dbb4004c484e0a6643bebb3a76e38288fb8844bd Mon Sep 17 00:00:00 2001 From: baywet Date: Fri, 9 Jun 2017 10:48:48 -0400 Subject: [PATCH 156/286] fixing linting issues on sharepoint types additions --- types/sharepoint/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/sharepoint/index.d.ts b/types/sharepoint/index.d.ts index be020bf4b5..f343a65d06 100644 --- a/types/sharepoint/index.d.ts +++ b/types/sharepoint/index.d.ts @@ -164,7 +164,7 @@ declare class _spPageContextInfo { static currentUICultureName: string; // "ru-RU" static disableAppViews: boolean; // true static disableFlows: boolean; // true - static env: string // "prod" + static env: string; // "prod" static farmLabel: string; // "US_4_Content" static formDigestValue: string; // "0x5F3FE84E7EE9089C7D11DCDAFFB9E69CF8241E68B9EF071FA92CD419E878AC4F7C16E34696EFA667EFD0712FC1DF4945DDC0D09B5D23153A698A727AF076B5DE,07 Jun 2017 18:55:22 -0000" static formDigestTimeoutSeconds: number; // 1800 @@ -177,7 +177,7 @@ declare class _spPageContextInfo { static isAppWeb: boolean; // true static isExternalGuestUser: boolean; // true static isNoScriptEnabled: boolean; // true - static isSiteAdmin: boolean; //true + static isSiteAdmin: boolean; // true static isSPO: boolean; // true static isTenantDevSite: boolean; // true static isWebWelcomePage: boolean; // true From 16170e275bfeb77d67a1c5756e4b520772e495c8 Mon Sep 17 00:00:00 2001 From: Emily Xiong Date: Fri, 9 Jun 2017 16:05:58 -0400 Subject: [PATCH 157/286] update ramda to include ascend, descend, sortWith functions --- types/ramda/index.d.ts | 23 +++++++++++++++++++++-- types/ramda/ramda-tests.ts | 8 ++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 9666c1b78f..3b4bcf098e 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -212,6 +212,12 @@ declare namespace R { */ applySpec(obj: any): (...args: any[]) => T; + /** + * Makes an ascending comparator function out of a function that returns a value that can be compared with < and >. + */ + ascend(fn: (obj: T) => any, a: T, b: T): number; + ascend(fn: (obj: T) => any): (a: T, b: T) => number; + /** * Makes a shallow clone of an object, setting or overriding the specified property with the given value. */ @@ -416,8 +422,15 @@ declare namespace R { * Returns the second argument if it is not null or undefined. If it is null or undefined, the * first (default) argument is returned. */ - defaultTo(a: T, b: U): T|U - defaultTo(a: T): (b: U) => T|U + defaultTo(a: T, b: U): T|U; + defaultTo(a: T): (b: U) => T|U; + + + /** + * Makes a descending comparator function out of a function that returns a value that can be compared with < and >. + */ + descend(fn: (obj: T) => any, a: T, b: T): number; + descend(fn: (obj: T) => any): (a: T, b: T) => number; /** * Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list. @@ -1406,6 +1419,12 @@ declare namespace R { sortBy(fn: (a: any) => Ord, list: T[]): T[]; sortBy(fn: (a: any) => Ord): (list: T[]) => T[]; + /** + * Sorts a list according to a list of comparators. + */ + sortWith(fns: ((a: T, b: T) => number)[], list: T[]): T[]; + sortWith(fns: ((a: T, b: T) => number)[]): (list: T[]) => T[]; + /** * Splits a string into an array of strings based on the given * separator. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index f9b272f8ca..755a5db06c 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1517,6 +1517,14 @@ class Rectangle { R.sort(cmp, people); } +() => { + var people = [ + {name: 'Agy', age:33}, {name: 'Bib', age: 15}, {name: 'Cari', age: 16} + ]; + + R.sortWith([R.ascend(R.prop('age')), R.descend(R.prop('name'))], people); +} + () => { var add = function(a: number, b: number) { return a + b; }; var multiply = function(a: number, b: number) { return a * b; }; From d6d2799379f556296eec72ba396506e14bb8e5da Mon Sep 17 00:00:00 2001 From: Dvorscak Date: Fri, 9 Jun 2017 15:39:57 -0500 Subject: [PATCH 158/286] Make second parameter optional --- types/jquery/index.d.ts | 2 +- types/jquery/jquery-tests.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index 39d75e1eaf..ccfc0c0f38 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -682,7 +682,7 @@ interface JQueryCoordinates { /** * The interface used to specify the properties parameter in css() */ -type cssPropertySetter = (index: number, value: string) => string | number; +type cssPropertySetter = (index: number, value?: string) => string | number; interface JQueryCssProperties { [propertyName: string]: string | number | cssPropertySetter; } diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 3a2d2a74bc..4b6fc4e0db 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -1062,6 +1062,9 @@ function test_css() { var color = $(this).css("background-color"); $("#result").html("That div is " + color + "."); }); + $('div.example').css('width', function (index) { + return index * 50; + }); $('div.example').css('width', function (index, style) { return style.length > 0 ? style : index * 50; }); From b6905e84ead153338cce390369842ec7ae761e74 Mon Sep 17 00:00:00 2001 From: Fang-Pen Lin Date: Fri, 9 Jun 2017 13:42:46 -0700 Subject: [PATCH 159/286] Add Transitioner for react-navigation --- types/react-navigation/index.d.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index e343d092c6..58519400fe 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -625,3 +625,32 @@ export interface NavigationComponentProps { export const TabBarTop: React.ReactElement; export const TabBarBottom: React.ReactElement; + +interface TransitionerProps { + configureTransition: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => NavigationTransitionSpec + navigation: NavigationProp + onTransitionEnd?: () => void + onTransitionStart?: () => void + render: ( + transitionProps: NavigationTransitionProps, + prevTransitionProps?: NavigationTransitionProps + ) => any + style?: ViewStyle +} + +interface TransitionerState { + layout: NavigationLayout + position: Animated.Value + progress: Animated.Value + scenes: Array +} + +export class Transitioner extends React.Component< + TransitionerProps, + TransitionerState +> { + +} From 0ed23c222c80638ad2b4d6bec09b4a91b5208a2b Mon Sep 17 00:00:00 2001 From: Fang-Pen Lin Date: Fri, 9 Jun 2017 13:50:42 -0700 Subject: [PATCH 160/286] Update test for Transitioner --- .../react-navigation-tests.tsx | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 2493d92f84..c27533a6f3 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -7,6 +7,10 @@ import { TabNavigatorConfig, TabBarTop, TabBarBottom, + NavigationProp, + NavigationAction, + NavigationTransitionProps, + Transitioner } from 'react-navigation'; const Start = ( @@ -44,3 +48,28 @@ const tabNavigatorConfig: TabNavigatorConfig = { lazy: true, tabBarComponent: TabBarTop, } + +interface CustomTransitionerProps { + navigation: NavigationProp +} + +const configureTransition = ( + _transitionProps: NavigationTransitionProps, + _prevTransitionProps: NavigationTransitionProps + ) => { + return {} + } + +const renderTransitioner = (props: NavigationTransitionProps, prevProps: NavigationTransitionProps) => { + return +} + +const CustomTransitioner = (props: CustomTransitionerProps) => { + { }} + onTransitionEnd={() => { }} + /> +} From b15fc38fcb90be8a470890db28c30dad1f43d114 Mon Sep 17 00:00:00 2001 From: Fang-Pen Lin Date: Fri, 9 Jun 2017 13:52:12 -0700 Subject: [PATCH 161/286] Update author list --- types/react-navigation/index.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 58519400fe..93a72b7f61 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for react-navigation 1.0 // Project: https://github.com/react-community/react-navigation -// Definitions by: Huhuanming , mhcgrq +// Definitions by: Huhuanming +// mhcgrq +// fangpenlin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as React from 'react' From 00f84a213f0235b308654451e7fa1cb0de81d6bb Mon Sep 17 00:00:00 2001 From: Fred Morel Date: Fri, 9 Jun 2017 19:54:36 -0400 Subject: [PATCH 162/286] Range.getColumnIndex, documentation --- .../google-apps-script.spreadsheet.d.ts | 99 ++++++++++++++++++- .../google-apps-script.types.d.ts | 1 + 2 files changed, 98 insertions(+), 2 deletions(-) diff --git a/types/google-apps-script/google-apps-script.spreadsheet.d.ts b/types/google-apps-script/google-apps-script.spreadsheet.d.ts index 74ca8b2e79..e710fcfb4a 100644 --- a/types/google-apps-script/google-apps-script.spreadsheet.d.ts +++ b/types/google-apps-script/google-apps-script.spreadsheet.d.ts @@ -9,6 +9,11 @@ /// declare namespace GoogleAppsScript { + /** + * This service allows scripts to create, access, and modify Google Sheets files. See also the guide to storing data in spreadsheets. + * + * https://developers.google.com/apps-script/guides/sheets + */ export module Spreadsheet { /** * Styles that can be set on a range using @@ -24,9 +29,25 @@ declare namespace GoogleAppsScript { * sheet.updateChart(chart); */ export interface ContainerInfo { + /** + * The chart's left side will be anchored to this column. + * @returns {Integer} 1-indexed column (i.e. column C will be 3) + */ getAnchorColumn(): Integer; + /** + * The chart's top side will be anchored to this row. + * @returns {Integer} 1-indexed row (i.e. row 5 will return 5) + */ getAnchorRow(): Integer; + /** + * The chart's upper left hand corner will be offset from the anchor column by this many pixels. + * @returns {Integer} the horizontal offset in pixels for the upper left hand corner of the chart + */ getOffsetX(): Integer; + /** + * Chart's upper left hand corner will be offset from the anchor row by this many pixels. + * @returns {Integer} the vertical offset in pixels for the upper left hand corner of the chart + */ getOffsetY(): Integer; } @@ -573,16 +594,31 @@ declare namespace GoogleAppsScript { * Data > Named ranges... menu. */ export interface NamedRange { + /** + * Gets the name of this named range. + */ getName(): string; + /** + * Gets teh range referenced by this named range. + */ getRange(): Range; + /** + * Deletes this named range. + */ remove(): void; + /** + * Sets/updates the name of this named range. + */ setName(name: string): NamedRange; + /** + * Sets/updates the range for this named range. + */ setRange(range: Range): NamedRange; } /** - * - * Deprecated. For spreadsheets created in the newer version of Google Sheets, use the more powerful + * @deprecated + * For spreadsheets created in the newer version of Google Sheets, use the more powerful * Protection class instead. Although this class is deprecated, it will remain * available for compatibility with the older version of Sheets. * Access and modify protected sheets in the older version of Google Sheets. @@ -713,6 +749,7 @@ declare namespace GoogleAppsScript { getBackgrounds(): String[][]; getCell(row: Integer, column: Integer): Range; getColumn(): Integer; + getColumnIndex(): Integer; getDataSourceUrl(): string; getDataTable(): Charts.DataTable; getDataTable(firstRowIsHeader: boolean): Charts.DataTable; @@ -1021,27 +1058,85 @@ declare namespace GoogleAppsScript { * the parent class for the Spreadsheet service. */ export interface SpreadsheetApp { + /** + * An enumeration of the valid styles for setting borders on a Range. + */ BorderStyle: typeof BorderStyle; + /** + * An enumeration representing the data-validation criteria that can be set on a range. + */ DataValidationCriteria: typeof DataValidationCriteria; + /** + * An enumeration representing the parts of a spreadsheet that can be protected from edits. + */ ProtectionType: typeof ProtectionType; + /** + * Creates a new spreadsheet with the given name. + */ create(name: string): Spreadsheet; + /** + * Creates a new spreadsheet with the given name and the specified number of rows and columns. + */ create(name: string, rows: Integer, columns: Integer): Spreadsheet; + /** + * Applies all pending Spreadsheet changes. + */ flush(): void; + /** + * Returns the currently active spreadsheet, or null if there is none. + */ getActive(): Spreadsheet; + /** + * Returns the range of cells that is currently considered active. + */ getActiveRange(): Range; + /** + * Gets the active sheet in a spreadsheet. + */ getActiveSheet(): Sheet; + /** + * Returns the currently active spreadsheet, or null if there is none. + */ getActiveSpreadsheet(): Spreadsheet; + /** + * Returns an instance of the spreadsheet's user-interface environment that allows the script to add features like menus, dialogs, and sidebars. + */ getUi(): Base.Ui; + /** + * Creates a builder for a data-validation rule. + */ newDataValidation(): DataValidationBuilder; + /** + * Opens the spreadsheet that corresponds to the given File object. + */ open(file: Drive.File): Spreadsheet; + /** + * Opens the spreadsheet with the given ID. + */ openById(id: string): Spreadsheet; + /** + * Opens the spreadsheet with the given url. + */ openByUrl(url: string): Spreadsheet; + /** + * Sets the active range for the application. + */ setActiveRange(range: Range): Range; + /** + * Sets the active sheet in a spreadsheet. + */ setActiveSheet(sheet: Sheet): Sheet; + /** + * Sets the active spreadsheet. + */ setActiveSpreadsheet(newActiveSpreadsheet: Spreadsheet): void; } } } +/** + * This class allows users to open Google Sheets files and to create new ones. This class is + * the parent class for the Spreadsheet service. + */ declare var SpreadsheetApp: GoogleAppsScript.Spreadsheet.SpreadsheetApp; diff --git a/types/google-apps-script/google-apps-script.types.d.ts b/types/google-apps-script/google-apps-script.types.d.ts index 5204a8a2a4..3c7bfb550c 100644 --- a/types/google-apps-script/google-apps-script.types.d.ts +++ b/types/google-apps-script/google-apps-script.types.d.ts @@ -8,5 +8,6 @@ declare module GoogleAppsScript { type Byte = number; type Integer = number; type Char = string; + type String = string; type JdbcSQL_XML = any; } From 5015d80ab505d59941a5dbd9dd45829b159ac1b2 Mon Sep 17 00:00:00 2001 From: Michael Strobel Date: Sat, 10 Jun 2017 09:05:34 +0800 Subject: [PATCH 163/286] [webpack] Add types for CommonsChunkPlugin.Options --- types/webpack/index.d.ts | 54 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index 9e5d106b80..1793eeef4f 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -907,7 +907,59 @@ declare namespace webpack { } class CommonsChunkPlugin extends Plugin { - constructor(options?: any); + constructor(options?: CommonsChunkPlugin.Options); + } + + namespace CommonsChunkPlugin { + type MinChunksFn = (module: any, count: number) => boolean; + + interface Options { + /** + * The chunk name of the commons chunk. An existing chunk can be selected by passing a name of an existing chunk. + * If an array of strings is passed this is equal to invoking the plugin multiple times for each chunk name. + * If omitted and `options.async` or `options.children` is set all chunks are used, + * otherwise `options.filename` is used as chunk name. + */ + name?: string; + names?: string[]; + + /** + * The filename template for the commons chunk. Can contain the same placeholders as `output.filename`. + * If omitted the original filename is not modified (usually `output.filename` or `output.chunkFilename`). + */ + filename?: string; + + /** + * The minimum number of chunks which need to contain a module before it's moved into the commons chunk. + * The number must be greater than or equal 2 and lower than or equal to the number of chunks. + * Passing `Infinity` just creates the commons chunk, but moves no modules into it. + * By providing a `function` you can add custom logic. (Defaults to the number of chunks) + */ + minChunks?: number | MinChunksFn; + + /** + * Select the source chunks by chunk names. The chunk must be a child of the commons chunk. + * If omitted all entry chunks are selected. + */ + chunks?: string[]; + + /** + * If `true` all children of the commons chunk are selected + */ + children?: boolean; + + /** + * If `true` a new async commons chunk is created as child of `options.name` and sibling of `options.chunks`. + * It is loaded in parallel with `options.chunks`. It is possible to change the name of the output file + * by providing the desired string instead of `true`. + */ + async?: boolean | string; + + /** + * Minimum size of all common module before a commons chunk is created. + */ + minSize?: number; + } } /** @deprecated */ From 8b6097d1ddf500ee2f69173cded1b13919c5e7f2 Mon Sep 17 00:00:00 2001 From: Michael Strobel Date: Sat, 10 Jun 2017 09:27:15 +0800 Subject: [PATCH 164/286] Fix whitespace linting error --- types/webpack/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index 1793eeef4f..8d4c7282ca 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -922,7 +922,7 @@ declare namespace webpack { */ name?: string; names?: string[]; - + /** * The filename template for the commons chunk. Can contain the same placeholders as `output.filename`. * If omitted the original filename is not modified (usually `output.filename` or `output.chunkFilename`). From b74bf960f39d7ec7a086b3a92ea4cf6a207ec920 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 10 Jun 2017 02:30:11 +0100 Subject: [PATCH 165/286] Added more documentation --- types/nodegit/submodule.d.ts | 271 +++++++++++++++++++++++++++ types/nodegit/tag.d.ts | 170 ++++++++++++++++- types/nodegit/time.d.ts | 12 ++ types/nodegit/transfer-progress.d.ts | 42 +++++ types/nodegit/transport.d.ts | 39 ++++ types/nodegit/tree-builder.d.ts | 62 ++++++ types/nodegit/tree-entry.d.ts | 152 ++++++++++++++- types/nodegit/tree.d.ts | 203 +++++++++++++++++++- 8 files changed, 932 insertions(+), 19 deletions(-) diff --git a/types/nodegit/submodule.d.ts b/types/nodegit/submodule.d.ts index fd64a1c8ac..b9293f6bae 100644 --- a/types/nodegit/submodule.d.ts +++ b/types/nodegit/submodule.d.ts @@ -45,37 +45,308 @@ export namespace Submodule { } export class Submodule { + /** + * + * + * @static + * @param {Repository} repo + * @param {string} url + * @param {string} path + * @param {number} use_gitlink + * @returns {Promise} + * + * @memberof Submodule + */ static addSetup(repo: Repository, url: string, path: string, use_gitlink: number): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Function} callback + * @param {*} payload + * @returns {Promise} + * + * @memberof Submodule + */ static foreach(repo: Repository, callback: Function, payload: any): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @returns {Promise} + * + * @memberof Submodule + */ static lookup(repo: Repository, name: string): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} url + * @returns {Promise} + * + * @memberof Submodule + */ static resolveUrl(repo: Repository, url: string): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @param {string} branch + * @returns {number} + * + * @memberof Submodule + */ static setBranch(repo: Repository, name: string, branch: string): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @param {number} fetch_recurse_submodules + * @returns {number} + * + * @memberof Submodule + */ static setFetchRecurseSubmodules(repo: Repository, name: string, fetch_recurse_submodules: number): number; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @param {number} ignore + * @returns {Promise} + * + * @memberof Submodule + */ static setIgnore(repo: Repository, name: string, ignore: number): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @param {number} update + * @returns {Promise} + * + * @memberof Submodule + */ static setUpdate(repo: Repository, name: string, update: number): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @param {string} url + * @returns {Promise} + * + * @memberof Submodule + */ static setUrl(repo: Repository, name: string, url: string): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} name + * @param {number} ignore + * @returns {Promise} + * + * @memberof Submodule + */ static status(repo: Repository, name: string, ignore: number): Promise; + /** + * + * + * @static + * @param {SubmoduleUpdateOptions} opts + * @param {number} version + * @returns {number} + * + * @memberof Submodule + */ static updateInitOptions(opts: SubmoduleUpdateOptions, version: number): number; + /** + * + * + * @returns {Promise} + * + * @memberof Submodule + */ addFinalize(): Promise; + /** + * + * + * @param {number} write_index + * @returns {Promise} + * + * @memberof Submodule + */ addToIndex(write_index: number): Promise; + /** + * + * + * @returns {string} + * + * @memberof Submodule + */ branch(): string; + /** + * + * + * @returns {number} + * + * @memberof Submodule + */ fetchRecurseSubmodules(): number; + /** + * + * + * + * @memberof Submodule + */ free(): void; + /** + * + * + * @returns {Oid} + * + * @memberof Submodule + */ headId(): Oid; + /** + * + * + * @returns {number} + * + * @memberof Submodule + */ ignore(): number; + /** + * + * + * @returns {Oid} + * + * @memberof Submodule + */ indexId(): Oid; + /** + * + * + * @param {number} overwrite + * @returns {Promise} + * + * @memberof Submodule + */ init(overwrite: number): Promise; + /** + * + * + * @returns {Promise} + * + * @memberof Submodule + */ location(): Promise; + /** + * + * + * @returns {string} + * + * @memberof Submodule + */ name(): string; + /** + * + * + * @returns {Promise} + * + * @memberof Submodule + */ open(): Promise; + /** + * + * + * @returns {Repository} + * + * @memberof Submodule + */ owner(): Repository; + /** + * + * + * @returns {string} + * + * @memberof Submodule + */ path(): string; + /** + * + * + * @param {number} force + * @returns {number} + * + * @memberof Submodule + */ reload(force: number): number; + /** + * + * + * @param {number} use_gitlink + * @returns {Promise} + * + * @memberof Submodule + */ repoInit(use_gitlink: number): Promise; + /** + * + * + * @returns {Promise} + * + * @memberof Submodule + */ sync(): Promise; + /** + * Updates a submodule + * + * @param {number} init + * @param {SubmoduleUpdateOptions} options + * @returns {Promise} + * + * @memberof Submodule + */ update(init: number, options: SubmoduleUpdateOptions): Promise; + /** + * + * + * @returns {number} + * + * @memberof Submodule + */ updateStrategy(): number; + /** + * + * + * @returns {string} + * + * @memberof Submodule + */ url(): string; + /** + * + * + * @returns {Oid} + * + * @memberof Submodule + */ wdId(): Oid; } diff --git a/types/nodegit/tag.d.ts b/types/nodegit/tag.d.ts index d8f98953a0..8c419ce15f 100644 --- a/types/nodegit/tag.d.ts +++ b/types/nodegit/tag.d.ts @@ -5,23 +5,191 @@ import { Signature } from './signature'; import { Strarray } from './str-array'; export class Tag { + /** + * + * + * @static + * @param {Repository} repo + * @param {string} tag_name + * @param {Object} target + * @param {Signature} tagger + * @param {string} message + * @returns {Promise} + * + * @memberof Tag + */ static annotationCreate(repo: Repository, tag_name: string, target: Object, tagger: Signature, message: string): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} tag_name + * @param {Object} target + * @param {Signature} tagger + * @param {string} message + * @param {number} force + * @returns {Promise} + * + * @memberof Tag + */ static create(repo: Repository, tag_name: string, target: Object, tagger: Signature, message: string, force: number): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} tag_name + * @param {Object} target + * @param {number} force + * @returns {Promise} + * + * @memberof Tag + */ static createLightweight(repo: Repository, tag_name: string, target: Object, force: number): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {string} tag_name + * @returns {Promise} + * + * @memberof Tag + */ static delete(repo: Repository, tag_name: string): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @returns {Promise} + * + * @memberof Tag + */ static list(repo: Repository): Promise; + /** + * + * + * @static + * @param {Strarray} tag_names + * @param {string} pattern + * @param {Repository} repo + * @returns {number} + * + * @memberof Tag + */ static listMatch(tag_names: Strarray, pattern: string, repo: Repository): number; + /** + * Retrieves the tag pointed to by the oid + * + * @static + * @param {Repository} repo + * @param {(string | Oid | Tag)} id + * @returns {Promise} + * + * @memberof Tag + */ static lookup(repo: Repository, id: string | Oid | Tag): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Oid} id + * @param {number} len + * @returns {Promise} + * + * @memberof Tag + */ static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + /** + * + * + * @returns {Promise} + * + * @memberof Tag + */ + dup(): Promise; + /** + * + * + * + * @memberof Tag + */ free(): void; + /** + * + * + * @returns {Oid} + * + * @memberof Tag + */ id(): Oid; + /** + * + * + * @returns {string} + * + * @memberof Tag + */ message(): string; + /** + * + * + * @returns {string} + * + * @memberof Tag + */ name(): string; + /** + * + * + * @returns {Repository} + * + * @memberof Tag + */ owner(): Repository; - peel(tag_target_out: Object): number; + /** + * + * + * @param {Object} tagTargetOut + * @returns {number} + * + * @memberof Tag + */ + peel(tagTargetOut: Object): number; + /** + * + * + * @returns {Signature} + * + * @memberof Tag + */ tagger(): Signature; + /** + * + * + * @returns {Object} + * + * @memberof Tag + */ target(): Object; + /** + * + * + * @returns {Oid} + * + * @memberof Tag + */ targetId(): Oid; + /** + * + * + * @returns {number} + * + * @memberof Tag + */ targetType(): number; } diff --git a/types/nodegit/time.d.ts b/types/nodegit/time.d.ts index 575c005781..299bcfa35e 100644 --- a/types/nodegit/time.d.ts +++ b/types/nodegit/time.d.ts @@ -1,4 +1,16 @@ export class Time { + /** + * + * + * @type {number} + * @memberof Time + */ time: number; + /** + * + * + * @type {number} + * @memberof Time + */ offset: number; } diff --git a/types/nodegit/transfer-progress.d.ts b/types/nodegit/transfer-progress.d.ts index 1589d4b6c6..f4c0d21065 100644 --- a/types/nodegit/transfer-progress.d.ts +++ b/types/nodegit/transfer-progress.d.ts @@ -1,9 +1,51 @@ export class TransferProgress { + /** + * + * + * @type {number} + * @memberof TransferProgress + */ totalObjects: number; + /** + * + * + * @type {number} + * @memberof TransferProgress + */ indexedObjects: number; + /** + * + * + * @type {number} + * @memberof TransferProgress + */ receivedObjects: number; + /** + * + * + * @type {number} + * @memberof TransferProgress + */ localObjects: number; + /** + * + * + * @type {number} + * @memberof TransferProgress + */ totalDeltas: number; + /** + * + * + * @type {number} + * @memberof TransferProgress + */ indexedDeltas: number; + /** + * + * + * @type {number} + * @memberof TransferProgress + */ receivedBytes: number; } diff --git a/types/nodegit/transport.d.ts b/types/nodegit/transport.d.ts index 189985c469..01dd4312ef 100644 --- a/types/nodegit/transport.d.ts +++ b/types/nodegit/transport.d.ts @@ -1,5 +1,6 @@ import { Remote } from './remote'; import { Strarray } from './str-array'; +import { Cert } from './cert'; export namespace Transport { const enum FLAGS { @@ -8,7 +9,45 @@ export namespace Transport { } export class Transport { + /** + * å + * + * @static + * @param {Remote} owner + * @param {Strarray} payload + * @returns {Promise} + * + * @memberof Transport + */ static sshWithPaths(owner: Remote, payload: Strarray): Promise; + /** + * + * + * @static + * @param {string} prefix + * @returns {number} + * + * @memberof Transport + */ static unregister(prefix: string): number; + /** + * + * + * @param {number} version + * @returns {number} + * + * @memberof Transport + */ init(version: number): number; + /** + * + * + * @param {Cert} cert + * @param {number} valid + * @param {string} hostName + * @returns {number} + * + * @memberof Transport + */ + smartCertificateCheck(cert: Cert, valid: number, hostName: string): number; } diff --git a/types/nodegit/tree-builder.d.ts b/types/nodegit/tree-builder.d.ts index 03d11db900..4c50cdbd65 100644 --- a/types/nodegit/tree-builder.d.ts +++ b/types/nodegit/tree-builder.d.ts @@ -4,13 +4,75 @@ import { Tree } from './tree'; import { TreeEntry } from './tree-entry'; export class Treebuilder { + /** + * + * + * @static + * @param {Repository} repo + * @param {Tree} source + * @returns {Promise} + * + * @memberof Treebuilder + */ static create(repo: Repository, source: Tree): Promise; + /** + * + * + * + * @memberof Treebuilder + */ clear(): void; + /** + * + * + * @returns {number} + * + * @memberof Treebuilder + */ entrycount(): number; + /** + * + * + * + * @memberof Treebuilder + */ free(): void; + /** + * + * + * @param {string} filename + * @returns {TreeEntry} + * + * @memberof Treebuilder + */ get(filename: string): TreeEntry; + /** + * + * + * @param {string} filename + * @param {Oid} id + * @param {number} filemode + * @returns {Promise} + * + * @memberof Treebuilder + */ insert(filename: string, id: Oid, filemode: number): Promise; + /** + * + * + * @param {string} filename + * @returns {number} + * + * @memberof Treebuilder + */ remove(filename: string): number; + /** + * + * + * @returns {Oid} + * + * @memberof Treebuilder + */ write(): Oid; } diff --git a/types/nodegit/tree-entry.d.ts b/types/nodegit/tree-entry.d.ts index a56a658ce1..3cf20499d3 100644 --- a/types/nodegit/tree-entry.d.ts +++ b/types/nodegit/tree-entry.d.ts @@ -1,6 +1,7 @@ import { Tree } from './tree'; import { Oid } from './oid'; import { Blob } from './blob'; +import { Repository } from './repository'; export namespace TreeEntry { const enum FILEMODE { @@ -14,17 +15,148 @@ export namespace TreeEntry { } export class TreeEntry { - isFile(): boolean; - isTree(): boolean; - isDirectory(): boolean; - isBlob(): boolean; - sha(): string; - getTree(): Promise; + /** + * + * + * @returns {TreeEntry.FILEMODE} + * + * @memberof TreeEntry + */ + filemode(): TreeEntry.FILEMODE; + /** + * + * + * @returns {TreeEntry.FILEMODE} + * + * @memberof TreeEntry + */ + filemodeRaw(): TreeEntry.FILEMODE; + /** + * + * + * + * @memberof TreeEntry + */ + free(): void; + /** + * + * + * @returns {Promise} + * + * @memberof TreeEntry + */ getBlob(): Promise; + /** + * + * + * @returns {Promise} + * + * @memberof TreeEntry + */ + getTree(): Promise; + /** + * + * + * @returns {Oid} + * + * @memberof TreeEntry + */ + id(): Oid; + /** + * + * + * @returns {boolean} + * + * @memberof TreeEntry + */ + isBlob(): boolean; + /** + * + * + * @returns {boolean} + * + * @memberof TreeEntry + */ + isFile(): boolean; + /** + * + * + * @returns {boolean} + * + * @memberof TreeEntry + */ + isTree(): boolean; + /** + * + * + * @returns {boolean} + * + * @memberof TreeEntry + */ + isDirectory(): boolean; + /** + * + * + * @returns {boolean} + * + * @memberof TreeEntry + */ + isSubmodule(): boolean; + /** + * Retrieve the SHA for this TreeEntry. + * + * @returns {string} + * + * @memberof TreeEntry + */ + sha(): string; + /** + * + * + * @returns {string} + * + * @memberof TreeEntry + */ + name(): string; + /** + * Retrieve the SHA for this TreeEntry. Alias for sha + * + * @returns {string} + * + * @memberof TreeEntry + */ + oid(): string; + /** + * Returns the path for this entry. + * + * @returns {string} + * + * @memberof TreeEntry + */ path(): string; + /** + * Alias for path + * + * @returns {string} + * + * @memberof TreeEntry + */ toString(): string; - attr: number; - oid: Oid; - filenameLen: number; - filename: string; + /** + * + * + * @param {Repository} repo + * @returns {Object} + * + * @memberof TreeEntry + */ + toObject(repo: Repository): Object; + /** + * + * + * @returns {number} + * + * @memberof TreeEntry + */ + type(): number; } diff --git a/types/nodegit/tree.d.ts b/types/nodegit/tree.d.ts index a4101217d3..eaa0c65ed3 100644 --- a/types/nodegit/tree.d.ts +++ b/types/nodegit/tree.d.ts @@ -13,32 +13,219 @@ export namespace Tree { } export class Tree { - static entryCmp(e1: TreeEntry, e2: TreeEntry): number; + /** + * + * + * @static + * @param {TreeEntry} tree1 + * @param {TreeEntry} tree2 + * @returns {number} + * + * @memberof Tree + */ + static entryCmp(tree1: TreeEntry, tree2: TreeEntry): number; + /** + * + * + * @static + * @param {TreeEntry} dest + * @param {TreeEntry} source + * @returns {number} + * + * @memberof Tree + */ static entryDup(dest: TreeEntry, source: TreeEntry): number; - static entryFilemode(entry: TreeEntry): number; - static entryFilemodeRaw(entry: TreeEntry): number; - static entryFree(entry: TreeEntry): void; - static entryId(entry: TreeEntry): Oid; - static entryName(entry: TreeEntry): string; - static entryToObject(object_out: Object, repo: Repository, entry: TreeEntry): number; - static entryType(entry: TreeEntry): number; + /** + * Retrieves the tree pointed to by the oid + * + * @static + * @returns {Promise} + * + * @memberof Tree + */ + static lookup(): Promise; + /** + * + * + * @static + * @param {Repository} repo + * @param {Oid} id + * @param {number} len + * @returns {Promise} + * + * @memberof Tree + */ + static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + + /** + * Retrieves the tree pointed to by the oid + * + * @static + * @param {Repository} repo + * @param {(string | Oid | Tree)} id + * @param {Function} callback + * @returns {Promise} + * + * @memberof Tree + */ static lookup(repo: Repository, id: string | Oid | Tree, callback: Function): Promise; static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + /** + * + * + * @param {Oid} id + * @returns {TreeEntry} + * + * @memberof Tree + */ entryById(id: Oid): TreeEntry; + /** + * + * + * @param {number} idx + * @returns {TreeEntry} + * + * @memberof Tree + */ _entryByIndex(idx: number): TreeEntry; + /** + * Get an entry by name; if the tree is a directory, the name is the filename. + * + * @param {string} name + * @returns {TreeEntry} + * + * @memberof Tree + */ entryByName(name: string): TreeEntry; + /** + * + * + * @param {string} filename + * @returns {TreeEntry} + * + * @memberof Tree + */ + _entryByName(filename: string): TreeEntry; + /** + * + * + * @param {string} path + * @returns {Promise} + * + * @memberof Tree + */ entryByPath(path: string): Promise; + /** + * + * + * @returns {number} + * + * @memberof Tree + */ entryCount(): number; + /** + * + * + * + * @memberof Tree + */ free(): void; + /** + * + * + * @returns {Oid} + * + * @memberof Tree + */ id(): Oid; + /** + * + * + * @returns {Repository} + * + * @memberof Tree + */ owner(): Repository; + /** + * Diff two trees + * + * @param {Tree} tree + * @param {Function} callback + * @returns {Promise} + * + * @memberof Tree + */ diff(tree: Tree, callback: Function): Promise; + /** + * Diff two trees with options + * + * @param {Tree} tree + * @param {Object} options + * @param {Function} callback + * @returns {Promise} + * + * @memberof Tree + */ diffWithOptions(tree: Tree, options: Object, callback: Function): Promise; + /** + * Get an entry at the ith position. + * + * @param {number} i + * @returns {TreeEntry} + * + * @memberof Tree + */ entryByIndex(i: number): TreeEntry; + /** + * Get an entry at a path. Unlike by name, this takes a fully qualified path, like /foo/bar/baz.javascript + * + * @param {string} filePath + * @returns {TreeEntry} + * + * @memberof Tree + */ getEntry(filePath: string): TreeEntry; + /** + * Return an array of the entries in this tree (excluding its children). + * + * @returns {TreeEntry[]} + * + * @memberof Tree + */ entries(): TreeEntry[]; + /** + * Recursively walk the tree in breadth-first order. Fires an event for each entry. + * + * @param {boolean} [blobsOnly] + * @returns {NodeJS.EventEmitter} + * + * @memberof Tree + */ walk(blobsOnly?: boolean): NodeJS.EventEmitter; + /** + * Return the path of this tree, like /lib/foo/bar + * + * @returns {string} + * + * @memberof Tree + */ path(): string; + /** + * Make builder. This is helpful for modifying trees. + * + * @returns {Treebuilder} + * + * @memberof Tree + */ builder(): Treebuilder; + /** + * + * + * @returns {Promise} + * + * @memberof Tree + */ + dup(): Promise; + createUpdated(repo: Repository, nUpdates: number, updates: TreeUpdate): Promise; } From e9fbe7110a21a0a5663b2f07d5018d82d377d2d7 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 10 Jun 2017 02:32:54 +0100 Subject: [PATCH 166/286] Added TreeUpdate --- types/nodegit/index.d.ts | 1 + types/nodegit/tree-update.d.ts | 8 ++++++++ types/nodegit/tree.d.ts | 1 + types/nodegit/tsconfig.json | 1 + 4 files changed, 11 insertions(+) create mode 100644 types/nodegit/tree-update.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 6551907ea4..2c955933d1 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -98,4 +98,5 @@ export { TransferProgress } from './transfer-progress'; export { Transport } from './transport'; export { Treebuilder } from './tree-builder'; export { TreeEntry } from './tree-entry'; +export { TreeUpdate } from './tree-update'; export { Tree } from './tree'; diff --git a/types/nodegit/tree-update.d.ts b/types/nodegit/tree-update.d.ts new file mode 100644 index 0000000000..fde63d064e --- /dev/null +++ b/types/nodegit/tree-update.d.ts @@ -0,0 +1,8 @@ +import { Oid } from './oid'; + +export class TreeUpdate { + action: number; + filemode: number; + id: Oid; + path: string; +} diff --git a/types/nodegit/tree.d.ts b/types/nodegit/tree.d.ts index eaa0c65ed3..d6fca995de 100644 --- a/types/nodegit/tree.d.ts +++ b/types/nodegit/tree.d.ts @@ -4,6 +4,7 @@ import { Repository } from './repository'; import { Object } from './object'; import { Treebuilder } from './tree-builder'; import { DiffFile } from './diff-file'; +import { TreeUpdate } from './tree-update'; export namespace Tree { const enum WALK_MODE { diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 829e49aedd..17b5c3fa6e 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -112,6 +112,7 @@ "transport.d.ts", "tree-builder.d.ts", "tree-entry.d.ts", + "tree-update.d.ts", "tree.d.ts" ] } From a38a576c6eb4f06bafe5489dbd1339cbfccffecc Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 10 Jun 2017 02:36:24 +0100 Subject: [PATCH 167/286] Added proxy --- types/nodegit/index.d.ts | 1 + types/nodegit/proxy.d.ts | 5 +++++ types/nodegit/tsconfig.json | 1 + 3 files changed, 7 insertions(+) create mode 100644 types/nodegit/proxy.d.ts diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 2c955933d1..b0a68f67b5 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -67,6 +67,7 @@ export { Openssl } from './open-ssl'; export { Packbuilder } from './pack-builder'; export { Pathspec } from './path-spec'; export { ProxyOptions } from './proxy-options'; +export { Proxy } from './proxy'; export { PushOptions } from './push-options'; export { PushUpdate } from './push-update'; export { Push } from './push'; diff --git a/types/nodegit/proxy.d.ts b/types/nodegit/proxy.d.ts new file mode 100644 index 0000000000..8b4806a2e0 --- /dev/null +++ b/types/nodegit/proxy.d.ts @@ -0,0 +1,5 @@ +import { ProxyOptions } from './proxy-options'; + +export class Proxy { + static initOptions(opts: ProxyOptions, version: number): number; +} diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index 17b5c3fa6e..394ec731df 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -81,6 +81,7 @@ "pack-builder.d.ts", "path-spec.d.ts", "proxy-options.d.ts", + "proxy.d.ts", "push-options.d.ts", "push-update.d.ts", "push.d.ts", From 8f535fe731495a8019b7f6816fcad22accb5e205 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 10 Jun 2017 02:37:21 +0100 Subject: [PATCH 168/286] Added documentation for TreeUpdate --- types/nodegit/tree-update.d.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/types/nodegit/tree-update.d.ts b/types/nodegit/tree-update.d.ts index fde63d064e..f8834513f4 100644 --- a/types/nodegit/tree-update.d.ts +++ b/types/nodegit/tree-update.d.ts @@ -1,8 +1,32 @@ import { Oid } from './oid'; export class TreeUpdate { + /** + * + * + * @type {number} + * @memberof TreeUpdate + */ action: number; + /** + * + * + * @type {number} + * @memberof TreeUpdate + */ filemode: number; + /** + * + * + * @type {Oid} + * @memberof TreeUpdate + */ id: Oid; + /** + * + * + * @type {string} + * @memberof TreeUpdate + */ path: string; } From 0aaac09a4471f1906b4c341cb7d5cfe38b5cfce5 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 10 Jun 2017 02:42:46 +0100 Subject: [PATCH 169/286] fixed linting errors --- types/nodegit/diff.d.ts | 6 +++--- types/nodegit/odb-expand-id.d.ts | 6 +++--- types/nodegit/proxy-options.d.ts | 12 ++++++------ types/nodegit/push-options.d.ts | 4 ++-- types/nodegit/rev-walk.d.ts | 1 - types/nodegit/tree.d.ts | 11 ----------- 6 files changed, 14 insertions(+), 26 deletions(-) diff --git a/types/nodegit/diff.d.ts b/types/nodegit/diff.d.ts index 23d3ddf5fc..0150313cfb 100644 --- a/types/nodegit/diff.d.ts +++ b/types/nodegit/diff.d.ts @@ -172,7 +172,7 @@ export class Diff { * Directly run a diff between a blob and a buffer. * * @static - * @param {Blob} old_blob + * @param {Blob} oldBlob * @param {string} oldAsPath * @param {string} buffer * @param {string} bufferAsPath @@ -185,8 +185,8 @@ export class Diff { * * @memberof Diff */ - static blobToBuffer(old_blob: Blob, oldAsPath: string, - buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; + static blobToBuffer(oldBlob: Blob, oldAsPath: string, + buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; /** * * diff --git a/types/nodegit/odb-expand-id.d.ts b/types/nodegit/odb-expand-id.d.ts index 842c65774e..d4fe264c3a 100644 --- a/types/nodegit/odb-expand-id.d.ts +++ b/types/nodegit/odb-expand-id.d.ts @@ -1,7 +1,7 @@ import { Oid } from './oid'; export class OdbExpandId { - id: Oid - length: number - type: number + id: Oid; + length: number; + type: number; } diff --git a/types/nodegit/proxy-options.d.ts b/types/nodegit/proxy-options.d.ts index 512d70c99a..600b34cd04 100644 --- a/types/nodegit/proxy-options.d.ts +++ b/types/nodegit/proxy-options.d.ts @@ -5,40 +5,40 @@ export class ProxyOptions { * @type {Function} * @memberof ProxyOptions */ - certificateCheck?: Function + certificateCheck?: Function; /** * * * @type {Function} * @memberof ProxyOptions */ - credentials?: Function + credentials?: Function; /** * * * @type {*} * @memberof ProxyOptions */ - payload?: any + payload?: any; /** * * * @type {number} * @memberof ProxyOptions */ - type?: number + type?: number; /** * * * @type {string} * @memberof ProxyOptions */ - url?: string + url?: string; /** * * * @type {number} * @memberof ProxyOptions */ - version?: number + version?: number; } diff --git a/types/nodegit/push-options.d.ts b/types/nodegit/push-options.d.ts index 6cf501c84a..e9cc6e2dcb 100644 --- a/types/nodegit/push-options.d.ts +++ b/types/nodegit/push-options.d.ts @@ -30,12 +30,12 @@ export interface PushOptions { * @type {Strarray} * @memberof PushOptions */ - customHeaders: Strarray + customHeaders: Strarray; /** * * * @type {ProxyOptions} * @memberof PushOptions */ - proxyOpts: ProxyOptions + proxyOpts: ProxyOptions; } diff --git a/types/nodegit/rev-walk.d.ts b/types/nodegit/rev-walk.d.ts index 8ba18bf83a..82b322cd79 100644 --- a/types/nodegit/rev-walk.d.ts +++ b/types/nodegit/rev-walk.d.ts @@ -187,5 +187,4 @@ export class Revwalk { * @memberof Revwalk */ getCommits(count: number): Promise; - } diff --git a/types/nodegit/tree.d.ts b/types/nodegit/tree.d.ts index d6fca995de..057d3b2907 100644 --- a/types/nodegit/tree.d.ts +++ b/types/nodegit/tree.d.ts @@ -36,15 +36,6 @@ export class Tree { * @memberof Tree */ static entryDup(dest: TreeEntry, source: TreeEntry): number; - /** - * Retrieves the tree pointed to by the oid - * - * @static - * @returns {Promise} - * - * @memberof Tree - */ - static lookup(): Promise; /** * * @@ -57,7 +48,6 @@ export class Tree { * @memberof Tree */ static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; - /** * Retrieves the tree pointed to by the oid * @@ -70,7 +60,6 @@ export class Tree { * @memberof Tree */ static lookup(repo: Repository, id: string | Oid | Tree, callback: Function): Promise; - static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; /** * From 0a0206e30123f7efa74f501619e7eed4120ddd76 Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 10 Jun 2017 02:51:39 +0100 Subject: [PATCH 170/286] Use camelCase for variables --- types/nodegit/buf.d.ts | 4 ++-- types/nodegit/clone.d.ts | 4 ++-- types/nodegit/commit.d.ts | 4 ++-- types/nodegit/diff.d.ts | 16 ++++++++-------- types/nodegit/index_.d.ts | 20 ++++++++++---------- types/nodegit/merge.d.ts | 8 ++++---- types/nodegit/note.d.ts | 28 ++++++++++++++-------------- types/nodegit/object.d.ts | 4 ++-- types/nodegit/rebase.d.ts | 4 ++-- types/nodegit/ref-log.d.ts | 8 ++++---- types/nodegit/remote.d.ts | 12 ++++++------ types/nodegit/repository.d.ts | 6 +++--- types/nodegit/reset.d.ts | 12 ++++++------ types/nodegit/rev-parse.d.ts | 6 +++--- types/nodegit/rev-walk.d.ts | 12 ++++++------ types/nodegit/revert.d.ts | 4 ++-- types/nodegit/submodule.d.ts | 16 ++++++++-------- types/nodegit/tag.d.ts | 20 ++++++++++---------- 18 files changed, 94 insertions(+), 94 deletions(-) diff --git a/types/nodegit/buf.d.ts b/types/nodegit/buf.d.ts index d9670bb293..380d76172b 100644 --- a/types/nodegit/buf.d.ts +++ b/types/nodegit/buf.d.ts @@ -19,12 +19,12 @@ export class Buf { /** * * - * @param {number} target_size + * @param {number} targetSize * @returns {Promise} * * @memberof Buf */ - grow(target_size: number): Promise; + grow(targetSize: number): Promise; /** * * diff --git a/types/nodegit/clone.d.ts b/types/nodegit/clone.d.ts index 61f8cfe2cf..7fe3b00a37 100644 --- a/types/nodegit/clone.d.ts +++ b/types/nodegit/clone.d.ts @@ -16,13 +16,13 @@ export class Clone { * * @static * @param {string} url - * @param {string} local_path + * @param {string} localPath * @param {CloneOptions} [options] * @returns {Promise} * * @memberof Clone */ - static clone(url: string, local_path: string, options?: CloneOptions): Promise; + static clone(url: string, localPath: string, options?: CloneOptions): Promise; /** * * diff --git a/types/nodegit/commit.d.ts b/types/nodegit/commit.d.ts index 247fdb102d..59928817a6 100644 --- a/types/nodegit/commit.d.ts +++ b/types/nodegit/commit.d.ts @@ -239,12 +239,12 @@ export class Commit { /** * * - * @param {Tree} tree_out + * @param {Tree} treeOut * @returns {number} * * @memberof Commit */ - tree(tree_out: Tree): number; + tree(treeOut: Tree): number; /** * * diff --git a/types/nodegit/diff.d.ts b/types/nodegit/diff.d.ts index 0150313cfb..5c2b29a33b 100644 --- a/types/nodegit/diff.d.ts +++ b/types/nodegit/diff.d.ts @@ -228,51 +228,51 @@ export class Diff { * * @static * @param {Repository} repo - * @param {Tree} old_tree + * @param {Tree} oldTree * @param {Index} index * @param {DiffOptions} opts * @returns {Promise} * * @memberof Diff */ - static treeToIndex(repo: Repository, old_tree: Tree, index: Index, opts: DiffOptions): Promise; + static treeToIndex(repo: Repository, oldTree: Tree, index: Index, opts: DiffOptions): Promise; /** * * * @static * @param {Repository} repo - * @param {Tree} old_tree + * @param {Tree} oldTree * @param {Tree} new_tree * @param {DiffOptions} opts * @returns {Promise} * * @memberof Diff */ - static treeToTree(repo: Repository, old_tree: Tree, new_tree: Tree, opts: DiffOptions): Promise; + static treeToTree(repo: Repository, oldTree: Tree, new_tree: Tree, opts: DiffOptions): Promise; /** * * * @static * @param {Repository} repo - * @param {Tree} old_tree + * @param {Tree} oldTree * @param {DiffOptions} opts * @returns {Promise} * * @memberof Diff */ - static treeToWorkdir(repo: Repository, old_tree: Tree, opts: DiffOptions): Promise; + static treeToWorkdir(repo: Repository, oldTree: Tree, opts: DiffOptions): Promise; /** * * * @static * @param {Repository} repo - * @param {Tree} old_tree + * @param {Tree} oldTree * @param {DiffOptions} opts * @returns {Promise} * * @memberof Diff */ - static treeToWorkdirWithIndex(repo: Repository, old_tree: Tree, opts: DiffOptions): Promise; + static treeToWorkdirWithIndex(repo: Repository, oldTree: Tree, opts: DiffOptions): Promise; /** * diff --git a/types/nodegit/index_.d.ts b/types/nodegit/index_.d.ts index a805a19c97..ebc7f692f2 100644 --- a/types/nodegit/index_.d.ts +++ b/types/nodegit/index_.d.ts @@ -45,22 +45,22 @@ export class Index { * * * @static - * @param {string} index_path + * @param {string} indexPath * @returns {Promise} * * @memberof Index */ - static open(index_path: string): Promise; + static open(indexPath: string): Promise; /** * * - * @param {IndexEntry} source_entry + * @param {IndexEntry} sourceEntry * @returns {number} * * @memberof Index */ - add(source_entry: IndexEntry): number; + add(sourceEntry: IndexEntry): number; /** * * @@ -109,14 +109,14 @@ export class Index { /** * * - * @param {IndexEntry} ancestor_entry - * @param {IndexEntry} our_entry - * @param {IndexEntry} their_entry + * @param {IndexEntry} ancestorEntry + * @param {IndexEntry} ourEntry + * @param {IndexEntry} theirEntry * @returns {number} * * @memberof Index */ - conflictAdd(ancestor_entry: IndexEntry, our_entry: IndexEntry, their_entry: IndexEntry): number; + conflictAdd(ancestorEntry: IndexEntry, ourEntry: IndexEntry, theirEntry: IndexEntry): number; /** * * @@ -308,13 +308,13 @@ export class Index { /** * * - * @param {number} at_pos + * @param {number} atPos * @param {string} prefix * @returns {number} * * @memberof Index */ - findPrefix(at_pos: number, prefix: string): number; + findPrefix(atPos: number, prefix: string): number; /** * * diff --git a/types/nodegit/merge.d.ts b/types/nodegit/merge.d.ts index 5603d2b66e..ae4a7d053c 100644 --- a/types/nodegit/merge.d.ts +++ b/types/nodegit/merge.d.ts @@ -126,13 +126,13 @@ export class Merge { * * @static * @param {Repository} repo - * @param {Tree} ancestor_tree - * @param {Tree} our_tree - * @param {Tree} their_tree + * @param {Tree} ancestorTree + * @param {Tree} ourTree + * @param {Tree} theirTree * @param {MergeOptions} opts * @returns {Promise} * * @memberof Merge */ - static trees(repo: Repository, ancestor_tree: Tree, our_tree: Tree, their_tree: Tree, opts: MergeOptions): Promise; + static trees(repo: Repository, ancestorTree: Tree, ourTree: Tree, theirTree: Tree, opts: MergeOptions): Promise; } diff --git a/types/nodegit/note.d.ts b/types/nodegit/note.d.ts index 1e9382b712..e1412afe3c 100644 --- a/types/nodegit/note.d.ts +++ b/types/nodegit/note.d.ts @@ -8,7 +8,7 @@ export class Note { * * @static * @param {Repository} repo - * @param {string} notes_ref + * @param {string} notesRef * @param {Signature} author * @param {Signature} committer * @param {Oid} oid @@ -18,61 +18,61 @@ export class Note { * * @memberof Note */ - static create(repo: Repository, notes_ref: string, author: Signature, committer: Signature, oid: Oid, note: string, force: number): Promise; + static create(repo: Repository, notesRef: string, author: Signature, committer: Signature, oid: Oid, note: string, force: number): Promise; /** * * * @static * @param {Repository} repo - * @param {string} notes_ref - * @param {Function} note_cb + * @param {string} notesRef + * @param {Function} noteCb * @param {*} payload * @returns {Promise} * * @memberof Note */ - static foreach(repo: Repository, notes_ref: string, note_cb: Function, payload: any): Promise; + static foreach(repo: Repository, notesRef: string, noteCb: Function, payload: any): Promise; /** * * * @static * @param {Repository} repo - * @param {string} notes_ref + * @param {string} notesRef * @returns {Promise} * * @memberof Note */ - static iteratorNew(repo: Repository, notes_ref: string): Promise; + static iteratorNew(repo: Repository, notesRef: string): Promise; /** * * * @static - * @param {Oid} note_id - * @param {Oid} annotated_id + * @param {Oid} noteId + * @param {Oid} annotatedId * @param {*} it * @returns {number} * * @memberof Note */ - static next(note_id: Oid, annotated_id: Oid, it: any): number; + static next(noteId: Oid, annotatedId: Oid, it: any): number; /** * * * @static * @param {Repository} repo - * @param {string} notes_ref + * @param {string} notesRef * @param {Oid} oid * @returns {Promise} * * @memberof Note */ - static read(repo: Repository, notes_ref: string, oid: Oid): Promise; + static read(repo: Repository, notesRef: string, oid: Oid): Promise; /** * * * @static * @param {Repository} repo - * @param {string} notes_ref + * @param {string} notesRef * @param {Signature} author * @param {Signature} committer * @param {Oid} oid @@ -80,7 +80,7 @@ export class Note { * * @memberof Note */ - static remove(repo: Repository, notes_ref: string, author: Signature, committer: Signature, oid: Oid): Promise; + static remove(repo: Repository, notesRef: string, author: Signature, committer: Signature, oid: Oid): Promise; /** * diff --git a/types/nodegit/object.d.ts b/types/nodegit/object.d.ts index 8030943e0d..747e4ffc28 100644 --- a/types/nodegit/object.d.ts +++ b/types/nodegit/object.d.ts @@ -113,12 +113,12 @@ export class Object { /** * * - * @param {number} target_type + * @param {number} targetType * @returns {Promise} * * @memberof Object */ - peel(target_type: number): Promise; + peel(targetType: number): Promise; /** * * diff --git a/types/nodegit/rebase.d.ts b/types/nodegit/rebase.d.ts index 6e254545bc..e1d64ede01 100644 --- a/types/nodegit/rebase.d.ts +++ b/types/nodegit/rebase.d.ts @@ -64,13 +64,13 @@ export class Rebase { * * @param {Signature} author * @param {Signature} committer - * @param {string} message_encoding + * @param {string} messageEncoding * @param {string} message * @returns {Oid} * * @memberof Rebase */ - commit(author: Signature, committer: Signature, message_encoding: string, message: string): Oid; + commit(author: Signature, committer: Signature, messageEncoding: string, message: string): Oid; /** * * diff --git a/types/nodegit/ref-log.d.ts b/types/nodegit/ref-log.d.ts index dec49731eb..78367ffccd 100644 --- a/types/nodegit/ref-log.d.ts +++ b/types/nodegit/ref-log.d.ts @@ -30,13 +30,13 @@ export class Reflog { * * @static * @param {Repository} repo - * @param {string} old_name + * @param {string} oldName * @param {string} name * @returns {number} * * @memberof Reflog */ - static rename(repo: Repository, old_name: string, name: string): number; + static rename(repo: Repository, oldName: string, name: string): number; /** * @@ -53,12 +53,12 @@ export class Reflog { * * * @param {number} idx - * @param {number} rewrite_previous_entry + * @param {number} rewritePreviousEntry * @returns {number} * * @memberof Reflog */ - drop(idx: number, rewrite_previous_entry: number): number; + drop(idx: number, rewritePreviousEntry: number): number; /** * * diff --git a/types/nodegit/remote.d.ts b/types/nodegit/remote.d.ts index 165df83036..d1bee99365 100644 --- a/types/nodegit/remote.d.ts +++ b/types/nodegit/remote.d.ts @@ -110,12 +110,12 @@ export class Remote { * * * @static - * @param {string} remote_name + * @param {string} remoteName * @returns {number} * * @memberof Remote */ - static isValidName(remote_name: string): number; + static isValidName(remoteName: string): number; /** * * @@ -353,14 +353,14 @@ export class Remote { * * * @param {RemoteCallbacks} callbacks - * @param {number} update_fetchhead - * @param {number} download_tags - * @param {string} reflog_message + * @param {number} updateFetchhead + * @param {number} downloadTags + * @param {string} reflogMessage * @returns {number} * * @memberof Remote */ - updateTips(callbacks: RemoteCallbacks, update_fetchhead: number, download_tags: number, reflog_message: string): number; + updateTips(callbacks: RemoteCallbacks, updateFetchhead: number, downloadTags: number, reflogMessage: string): number; /** * * diff --git a/types/nodegit/repository.d.ts b/types/nodegit/repository.d.ts index bf598d5a9f..a8882b5d55 100644 --- a/types/nodegit/repository.d.ts +++ b/types/nodegit/repository.d.ts @@ -17,7 +17,7 @@ import { Config } from './config'; import { Merge } from './merge'; import { MergeOptions } from './merge-options'; import { Refdb } from './ref-db'; -import {Revwalk} from './rev-walk'; +import { Revwalk } from './rev-walk'; export interface RepositoryInitOptions { description: string; @@ -310,12 +310,12 @@ export class Repository { * * * @param {string} workdir - * @param {number} update_gitlink + * @param {number} updateGitLink * @returns {number} * * @memberof Repository */ - setWorkdir(workdir: string, update_gitlink: number): number; + setWorkdir(workdir: string, updateGitLink: number): number; /** * * diff --git a/types/nodegit/reset.d.ts b/types/nodegit/reset.d.ts index 1335eb8365..0fb3af1088 100644 --- a/types/nodegit/reset.d.ts +++ b/types/nodegit/reset.d.ts @@ -19,13 +19,13 @@ export class Reset { * @static * @param {Repository} repo * @param {Object} target - * @param {number} reset_type - * @param {CheckoutOptions} checkout_opts + * @param {number} resetType + * @param {CheckoutOptions} checkoutOpts * @returns {Promise} * * @memberof Reset */ - static reset(repo: Repository, target: Object, reset_type: number, checkout_opts: CheckoutOptions): Promise; + static reset(repo: Repository, target: Object, resetType: number, checkoutOpts: CheckoutOptions): Promise; /** * Look up a refs's commit. * @@ -46,11 +46,11 @@ export class Reset { * @static * @param {Repository} repo * @param {AnnotatedCommit} commit - * @param {number} reset_type - * @param {CheckoutOptions} checkout_opts + * @param {number} resetType + * @param {CheckoutOptions} checkoutOpts * @returns {number} * * @memberof Reset */ - static fromAnnotated(repo: Repository, commit: AnnotatedCommit, reset_type: number, checkout_opts: CheckoutOptions): number; + static fromAnnotated(repo: Repository, commit: AnnotatedCommit, resetType: number, checkoutOpts: CheckoutOptions): number; } diff --git a/types/nodegit/rev-parse.d.ts b/types/nodegit/rev-parse.d.ts index b4ef63f2f2..098f880cd0 100644 --- a/types/nodegit/rev-parse.d.ts +++ b/types/nodegit/rev-parse.d.ts @@ -15,15 +15,15 @@ export class Revparse { * * * @static - * @param {Object} object_out - * @param {Reference} reference_out + * @param {Object} objectOut + * @param {Reference} referenceOut * @param {Repository} repo * @param {string} spec * @returns {number} * * @memberof Revparse */ - static ext(object_out: Object, reference_out: Reference, repo: Repository, spec: string): number; + static ext(objectOut: Object, referenceOut: Reference, repo: Repository, spec: string): number; /** * * diff --git a/types/nodegit/rev-walk.d.ts b/types/nodegit/rev-walk.d.ts index 82b322cd79..2736f57323 100644 --- a/types/nodegit/rev-walk.d.ts +++ b/types/nodegit/rev-walk.d.ts @@ -26,12 +26,12 @@ export class Revwalk { /** * * - * @param {Oid} commit_id + * @param {Oid} commitId * @returns {number} * * @memberof Revwalk */ - hide(commit_id: Oid): number; + hide(commitId: Oid): number; /** * * @@ -143,22 +143,22 @@ export class Revwalk { /** * * - * @param {number} max_count + * @param {number} maxCount * @returns {Promise} * * @memberof Revwalk */ - fastWalk(max_count: number): Promise; + fastWalk(maxCount: number): Promise; /** * * * @param {string} filePath - * @param {number} max_count + * @param {number} maxCount * @returns {Promise} * * @memberof Revwalk */ - fileHistoryWalk(filePath: string, max_count: number): Promise; + fileHistoryWalk(filePath: string, maxCount: number): Promise; /** * Walk the history from the given oid. The callback is invoked for each commit; When the walk is over, the callback is invoked with (null, null). * diff --git a/types/nodegit/revert.d.ts b/types/nodegit/revert.d.ts index ac0cbf531a..2e04f78758 100644 --- a/types/nodegit/revert.d.ts +++ b/types/nodegit/revert.d.ts @@ -29,7 +29,7 @@ export class Revert { * * @static * @param {Repository} repo - * @param {Commit} revert_commit + * @param {Commit} revertCommit * @param {Commit} ourCommit * @param {number} mainline * @param {MergeOptions} mergeOptions @@ -37,5 +37,5 @@ export class Revert { * * @memberof Revert */ - static commit(repo: Repository, revert_commit: Commit, ourCommit: Commit, mainline: number, mergeOptions: MergeOptions): Promise; + static commit(repo: Repository, revertCommit: Commit, ourCommit: Commit, mainline: number, mergeOptions: MergeOptions): Promise; } diff --git a/types/nodegit/submodule.d.ts b/types/nodegit/submodule.d.ts index b9293f6bae..a946e28fa4 100644 --- a/types/nodegit/submodule.d.ts +++ b/types/nodegit/submodule.d.ts @@ -52,12 +52,12 @@ export class Submodule { * @param {Repository} repo * @param {string} url * @param {string} path - * @param {number} use_gitlink + * @param {number} useGitLink * @returns {Promise} * * @memberof Submodule */ - static addSetup(repo: Repository, url: string, path: string, use_gitlink: number): Promise; + static addSetup(repo: Repository, url: string, path: string, useGitLink: number): Promise; /** * * @@ -110,12 +110,12 @@ export class Submodule { * @static * @param {Repository} repo * @param {string} name - * @param {number} fetch_recurse_submodules + * @param {number} fetchRecurseSubmodules * @returns {number} * * @memberof Submodule */ - static setFetchRecurseSubmodules(repo: Repository, name: string, fetch_recurse_submodules: number): number; + static setFetchRecurseSubmodules(repo: Repository, name: string, fetchRecurseSubmodules: number): number; /** * * @@ -187,12 +187,12 @@ export class Submodule { /** * * - * @param {number} write_index + * @param {number} writeIndex * @returns {Promise} * * @memberof Submodule */ - addToIndex(write_index: number): Promise; + addToIndex(writeIndex: number): Promise; /** * * @@ -301,12 +301,12 @@ export class Submodule { /** * * - * @param {number} use_gitlink + * @param {number} useGitLink * @returns {Promise} * * @memberof Submodule */ - repoInit(use_gitlink: number): Promise; + repoInit(useGitLink: number): Promise; /** * * diff --git a/types/nodegit/tag.d.ts b/types/nodegit/tag.d.ts index 8c419ce15f..f676c72ab5 100644 --- a/types/nodegit/tag.d.ts +++ b/types/nodegit/tag.d.ts @@ -10,7 +10,7 @@ export class Tag { * * @static * @param {Repository} repo - * @param {string} tag_name + * @param {string} tagName * @param {Object} target * @param {Signature} tagger * @param {string} message @@ -18,13 +18,13 @@ export class Tag { * * @memberof Tag */ - static annotationCreate(repo: Repository, tag_name: string, target: Object, tagger: Signature, message: string): Promise; + static annotationCreate(repo: Repository, tagName: string, target: Object, tagger: Signature, message: string): Promise; /** * * * @static * @param {Repository} repo - * @param {string} tag_name + * @param {string} tagName * @param {Object} target * @param {Signature} tagger * @param {string} message @@ -33,31 +33,31 @@ export class Tag { * * @memberof Tag */ - static create(repo: Repository, tag_name: string, target: Object, tagger: Signature, message: string, force: number): Promise; + static create(repo: Repository, tagName: string, target: Object, tagger: Signature, message: string, force: number): Promise; /** * * * @static * @param {Repository} repo - * @param {string} tag_name + * @param {string} tagName * @param {Object} target * @param {number} force * @returns {Promise} * * @memberof Tag */ - static createLightweight(repo: Repository, tag_name: string, target: Object, force: number): Promise; + static createLightweight(repo: Repository, tagName: string, target: Object, force: number): Promise; /** * * * @static * @param {Repository} repo - * @param {string} tag_name + * @param {string} tagName * @returns {Promise} * * @memberof Tag */ - static delete(repo: Repository, tag_name: string): Promise; + static delete(repo: Repository, tagName: string): Promise; /** * * @@ -72,14 +72,14 @@ export class Tag { * * * @static - * @param {Strarray} tag_names + * @param {Strarray} tagNames * @param {string} pattern * @param {Repository} repo * @returns {number} * * @memberof Tag */ - static listMatch(tag_names: Strarray, pattern: string, repo: Repository): number; + static listMatch(tagNames: Strarray, pattern: string, repo: Repository): number; /** * Retrieves the tag pointed to by the oid * From 5db985c075eea3380543f14dd2d74dc7cee2c45d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20Parditka?= Date: Sat, 10 Jun 2017 07:27:37 +0200 Subject: [PATCH 171/286] Added workaround for TS 2.4. --- types/mithril/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/mithril/index.d.ts b/types/mithril/index.d.ts index e17064abfc..006e649d6e 100644 --- a/types/mithril/index.d.ts +++ b/types/mithril/index.d.ts @@ -44,6 +44,8 @@ declare namespace Mithril { onbeforeupdate?(this: State, vnode: Vnode, old: VnodeDOM): boolean | void; /** The onremove hook is called before a DOM element is removed from the document. */ onupdate?(this: State, vnode: VnodeDOM): any; + /** WORKAROUND: TypeScript 2.4 does not allow extending an interface with all-optional properties. */ + [_: number]: any; } interface Hyperscript { From be064f6e2f98d29d5af2e3eecfbadaaa3a193c73 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Sat, 10 Jun 2017 20:57:06 -0700 Subject: [PATCH 172/286] Add rudimentary `hubot` type definitions --- types/hubot/index.d.ts | 53 +++++++++++++++++++++++++++++++++++++++ types/hubot/tsconfig.json | 21 ++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 types/hubot/index.d.ts create mode 100644 types/hubot/tsconfig.json diff --git a/types/hubot/index.d.ts b/types/hubot/index.d.ts new file mode 100644 index 0000000000..6e81398a33 --- /dev/null +++ b/types/hubot/index.d.ts @@ -0,0 +1,53 @@ +// Type definitions for hubot 2.19.0 +// Project: https://hubot.github.com +// Definitions by: Dirk Gadsden +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'hubot' { + interface Brain { + userForId: (id: any) => any + } + + interface User { + id: any + name: string + } + + interface Message { + user: User + text: string + id: string + } + + interface Response { + match: RegExpMatchArray + message: Message + send: (...strings: string[]) => void + reply: (...strings: string[]) => void + random: (items: T[]) => T + } + + interface ListenerCallback { + (response: Response): void + } + + interface HearWithOptions { + (regex: RegExp, options: any, callback: ListenerCallback): void + } + interface HearWithoutOptions { + (regex: RegExp, callback: ListenerCallback): void + } + + interface RespondWithOptions { + (regex: RegExp, options: any, callback: ListenerCallback): void + } + interface RespondWithoutOptions { + (regex: RegExp, callback: ListenerCallback): void + } + + export interface Robot { + brain: Brain + hear: HearWithOptions & HearWithoutOptions + respond: RespondWithOptions & RespondWithoutOptions + } +} diff --git a/types/hubot/tsconfig.json b/types/hubot/tsconfig.json new file mode 100644 index 0000000000..7a0988e344 --- /dev/null +++ b/types/hubot/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts" + ] +} From e65b10905d5ec66f9fcae5c5d69160a9e9057e97 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Sat, 10 Jun 2017 21:09:49 -0700 Subject: [PATCH 173/286] Add semicolons to match style --- types/hubot/index.d.ts | 50 ++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/types/hubot/index.d.ts b/types/hubot/index.d.ts index 6e81398a33..b3c58947ba 100644 --- a/types/hubot/index.d.ts +++ b/types/hubot/index.d.ts @@ -3,51 +3,53 @@ // Definitions by: Dirk Gadsden // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module 'hubot' { - interface Brain { - userForId: (id: any) => any +declare namespace Hubot { + class Brain { + userForId: (id: any) => any; } - interface User { - id: any - name: string + class User { + id: any; + name: string; } - interface Message { - user: User - text: string - id: string + class Message { + user: User; + text: string; + id: string; } - interface Response { - match: RegExpMatchArray - message: Message - send: (...strings: string[]) => void - reply: (...strings: string[]) => void - random: (items: T[]) => T + class Response { + match: RegExpMatchArray; + message: Message; + send: (...strings: string[]) => void; + reply: (...strings: string[]) => void; + random: (items: T[]) => T; } interface ListenerCallback { - (response: Response): void + (response: Response): void; } interface HearWithOptions { - (regex: RegExp, options: any, callback: ListenerCallback): void + (regex: RegExp, options: any, callback: ListenerCallback): void; } interface HearWithoutOptions { - (regex: RegExp, callback: ListenerCallback): void + (regex: RegExp, callback: ListenerCallback): void; } interface RespondWithOptions { - (regex: RegExp, options: any, callback: ListenerCallback): void + (regex: RegExp, options: any, callback: ListenerCallback): void; } interface RespondWithoutOptions { - (regex: RegExp, callback: ListenerCallback): void + (regex: RegExp, callback: ListenerCallback): void; } export interface Robot { - brain: Brain - hear: HearWithOptions & HearWithoutOptions - respond: RespondWithOptions & RespondWithoutOptions + brain: Brain; + hear: HearWithOptions & HearWithoutOptions; + respond: RespondWithOptions & RespondWithoutOptions; } } + +export = Hubot; From 0cdc06e03f287d97f313b3427151fd0df5df1da4 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Sat, 10 Jun 2017 21:14:57 -0700 Subject: [PATCH 174/286] Add more complete type definitions for classes' methods --- types/hubot/index.d.ts | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/types/hubot/index.d.ts b/types/hubot/index.d.ts index b3c58947ba..f136d88ceb 100644 --- a/types/hubot/index.d.ts +++ b/types/hubot/index.d.ts @@ -5,7 +5,8 @@ declare namespace Hubot { class Brain { - userForId: (id: any) => any; + userForId(id: any): any; + userForName(name: string): any; } class User { @@ -22,33 +23,24 @@ declare namespace Hubot { class Response { match: RegExpMatchArray; message: Message; - send: (...strings: string[]) => void; - reply: (...strings: string[]) => void; - random: (items: T[]) => T; + + constructor(robot: Robot, message: Message, match: RegExpMatchArray); + send(...strings: string[]): void; + reply(...strings: string[]): void; + random(items: T[]): T; } interface ListenerCallback { (response: Response): void; } - interface HearWithOptions { - (regex: RegExp, options: any, callback: ListenerCallback): void; - } - interface HearWithoutOptions { - (regex: RegExp, callback: ListenerCallback): void; - } - - interface RespondWithOptions { - (regex: RegExp, options: any, callback: ListenerCallback): void; - } - interface RespondWithoutOptions { - (regex: RegExp, callback: ListenerCallback): void; - } - export interface Robot { brain: Brain; - hear: HearWithOptions & HearWithoutOptions; - respond: RespondWithOptions & RespondWithoutOptions; + + hear(regex: RegExp, callback: ListenerCallback): void; + hear(regex: RegExp, options: any, callback: ListenerCallback): void; + response(regex: RegExp, callback: ListenerCallback): void; + response(regex: RegExp, options: any, callback: ListenerCallback): void; } } From 9bb3726120be4d4c0da629fb37943541fb848df8 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Sat, 10 Jun 2017 21:21:53 -0700 Subject: [PATCH 175/286] Convert to class definition for `Robot` --- types/hubot/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/hubot/index.d.ts b/types/hubot/index.d.ts index f136d88ceb..2126f7a2ff 100644 --- a/types/hubot/index.d.ts +++ b/types/hubot/index.d.ts @@ -34,9 +34,10 @@ declare namespace Hubot { (response: Response): void; } - export interface Robot { + class Robot { brain: Brain; + constructor(adapterPath: string, adapter: string, httpd: boolean, name: string, alias?: string); hear(regex: RegExp, callback: ListenerCallback): void; hear(regex: RegExp, options: any, callback: ListenerCallback): void; response(regex: RegExp, callback: ListenerCallback): void; From a2e65d34905fb1a0f36c6c9ecbb99d60251912b3 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Sat, 10 Jun 2017 21:22:12 -0700 Subject: [PATCH 176/286] Add basic tests file for `hubot` --- types/hubot/hubot-tests.ts | 13 +++++++++++++ types/hubot/tsconfig.json | 3 ++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 types/hubot/hubot-tests.ts diff --git a/types/hubot/hubot-tests.ts b/types/hubot/hubot-tests.ts new file mode 100644 index 0000000000..98307f1097 --- /dev/null +++ b/types/hubot/hubot-tests.ts @@ -0,0 +1,13 @@ +import * as Hubot from "hubot"; + +var brain = new Hubot.Brain(); // $ExpectType Hubot.Brain +brain.userForName('someone'); // $ExpectType any + +// $ExpectType Hubot.Robot +var robot = new Hubot.Robot( + 'src/adapters', + 'slack', + false, + 'hubot', +); +robot.hear(/hello/, () => null); // $ExpectType void diff --git a/types/hubot/tsconfig.json b/types/hubot/tsconfig.json index 7a0988e344..3477a2bde8 100644 --- a/types/hubot/tsconfig.json +++ b/types/hubot/tsconfig.json @@ -16,6 +16,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "index.d.ts" + "index.d.ts", + "hubot-tests.ts" ] } From c34ad711717c8df439438c38a7640da6cc82c766 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Sat, 10 Jun 2017 21:28:25 -0700 Subject: [PATCH 177/286] `dts-gen` template for type definitions for `hubot` --- types/hubot/hubot-tests.ts | 0 types/hubot/index.d.ts | 4 ++++ types/hubot/tsconfig.json | 22 ++++++++++++++++++++++ types/hubot/tslint.json | 1 + 4 files changed, 27 insertions(+) create mode 100644 types/hubot/hubot-tests.ts create mode 100644 types/hubot/index.d.ts create mode 100644 types/hubot/tsconfig.json create mode 100644 types/hubot/tslint.json diff --git a/types/hubot/hubot-tests.ts b/types/hubot/hubot-tests.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/types/hubot/index.d.ts b/types/hubot/index.d.ts new file mode 100644 index 0000000000..220809d09d --- /dev/null +++ b/types/hubot/index.d.ts @@ -0,0 +1,4 @@ +// Type definitions for hubot 2.19 +// Project: https://github.com/github/hubot +// Definitions by: Dirk Gadsden +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/hubot/tsconfig.json b/types/hubot/tsconfig.json new file mode 100644 index 0000000000..0e3faa4c35 --- /dev/null +++ b/types/hubot/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", + "hubot-tests.ts" + ] +} diff --git a/types/hubot/tslint.json b/types/hubot/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/hubot/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From b1b4c8a64f3d881c73ef08cc39b330108235cbc8 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Sat, 10 Jun 2017 21:43:26 -0700 Subject: [PATCH 178/286] Reorder export and fix function type --- types/hubot/index.d.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/types/hubot/index.d.ts b/types/hubot/index.d.ts index f0daff69b6..bf21fd6160 100644 --- a/types/hubot/index.d.ts +++ b/types/hubot/index.d.ts @@ -3,6 +3,8 @@ // Definitions by: Dirk Gadsden // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +export = Hubot; + declare namespace Hubot { class Brain { userForId(id: any): any; @@ -30,9 +32,7 @@ declare namespace Hubot { random(items: T[]): T; } - interface ListenerCallback { - (response: Response): void; - } + type ListenerCallback = (response: Response) => void; class Robot { brain: Brain; @@ -44,5 +44,3 @@ declare namespace Hubot { response(regex: RegExp, options: any, callback: ListenerCallback): void; } } - -export = Hubot; From 8e110b17d0e02f148a25bae1afb907f6be513bcf Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Sat, 10 Jun 2017 21:43:49 -0700 Subject: [PATCH 179/286] Improve tests for `hubot` definitions --- types/hubot/hubot-tests.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/types/hubot/hubot-tests.ts b/types/hubot/hubot-tests.ts index 98307f1097..9c5e832bc2 100644 --- a/types/hubot/hubot-tests.ts +++ b/types/hubot/hubot-tests.ts @@ -1,13 +1,14 @@ import * as Hubot from "hubot"; -var brain = new Hubot.Brain(); // $ExpectType Hubot.Brain +const brain = new Hubot.Brain(); +brain; // $ExpectType Brain brain.userForName('someone'); // $ExpectType any -// $ExpectType Hubot.Robot -var robot = new Hubot.Robot( +const robot = new Hubot.Robot( 'src/adapters', 'slack', false, 'hubot', ); +robot; // $ExpectType Robot robot.hear(/hello/, () => null); // $ExpectType void From 79c97393ebe7ca776d41fb603dade05f37035948 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Sat, 10 Jun 2017 22:04:57 -0700 Subject: [PATCH 180/286] Maintain compatibility with CommonJS export pattern from `hubot`'s CoffeeScript --- types/hubot/index.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/types/hubot/index.d.ts b/types/hubot/index.d.ts index bf21fd6160..6ed71de50c 100644 --- a/types/hubot/index.d.ts +++ b/types/hubot/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: Dirk Gadsden // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export = Hubot; - declare namespace Hubot { class Brain { userForId(id: any): any; @@ -44,3 +42,8 @@ declare namespace Hubot { response(regex: RegExp, options: any, callback: ListenerCallback): void; } } + +// Compatibility with CommonJS syntax exported by Hubot's CoffeeScript. +// tslint:disable-next-line export-just-namespace +export = Hubot; +export as namespace Hubot; From 1aed6f7d4ef58d0088aa99d1559a7cfe42b14b28 Mon Sep 17 00:00:00 2001 From: Dirk Gadsden Date: Sat, 10 Jun 2017 22:07:41 -0700 Subject: [PATCH 181/286] Fix typo for `Hubot.Robot` --- types/hubot/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/hubot/index.d.ts b/types/hubot/index.d.ts index 6ed71de50c..e0a809f69a 100644 --- a/types/hubot/index.d.ts +++ b/types/hubot/index.d.ts @@ -38,8 +38,8 @@ declare namespace Hubot { constructor(adapterPath: string, adapter: string, httpd: boolean, name: string, alias?: string); hear(regex: RegExp, callback: ListenerCallback): void; hear(regex: RegExp, options: any, callback: ListenerCallback): void; - response(regex: RegExp, callback: ListenerCallback): void; - response(regex: RegExp, options: any, callback: ListenerCallback): void; + respond(regex: RegExp, callback: ListenerCallback): void; + respond(regex: RegExp, options: any, callback: ListenerCallback): void; } } From 640742de3b44921d7b282b4c331329cc9d32f793 Mon Sep 17 00:00:00 2001 From: clarenceh Date: Sun, 11 Jun 2017 15:43:56 +0800 Subject: [PATCH 182/286] Add and fix types definition for massive js 3.0 --- types/massive/index.d.ts | 46 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/types/massive/index.d.ts b/types/massive/index.d.ts index 1ed6b62ac6..1bf0550b2c 100644 --- a/types/massive/index.d.ts +++ b/types/massive/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for massive 3.x +// Type definitions for massive 3.0 // Project: https://github.com/dmfay/massive-js.git // Definitions by: Pascal Birchler // Clarence Ho @@ -10,7 +10,7 @@ export = massive; declare function massive( - connection: object | string, + connection: massive.ConnectionInfo | string, loaderConfig?: object, driverConfig?: object): Promise; @@ -26,17 +26,55 @@ declare namespace massive { fallback_application_name?: boolean; } + interface QueryOptions { + columns?: string[]; + limit?: number; + offset?: number; + only?: boolean; + order?: string[]; + orderBody?: boolean; + build?: boolean; + document?: boolean; + single?: boolean; + stream?: boolean; + } + + interface SearchCriteria { + fields: string[]; + term: string; + } + + interface Table { + find(criteria: object | {}, queryOptions?: QueryOptions): Promise; + findOne(criteria: number | object, queryOptions?: QueryOptions): Promise; + count(criteria: object): Promise; + where(query: string, params: any[] | object): Promise; + search(criteria: SearchCriteria, queryOptions?: QueryOptions): Promise; + save(data: object): Promise; + insert(data: object): Promise; + update(dataOrCriteria: object, changesMap?: object): Promise; + destroy(criteria: object): Promise; + } + + interface Document { + countDoc(criteria: object): Promise; + findDoc(criteria: number | string| object): Promise; + searchDoc(criteria: SearchCriteria): Promise; + saveDoc(doc: object): Promise; + modify(docId: number | string, doc: object, fieldName?: string): Promise; + } + interface Database { attach(ctor: any, ...sources: any[]): Promise; detach(entity: string, collection: string): void; reload(): void; query(query: any, params: any, options: any): Promise; - saveDoc(collection: any, doc: any): any; + saveDoc(collectionName: string, doc: object): Promise; createDocumentTable(path: any): Promise; getObject(path: any, collection: any): object; dropTable(table: string, options: any): void; createSchema(schemaName: string): void; dropSchema(schemaName: string, options: any): void; - [name: string]: any; + run(query: string, params: any[] | object): Promise; } } From cb9c454213520c636c594e99b043647e7d01ac8a Mon Sep 17 00:00:00 2001 From: Marks Polakovs Date: Sun, 11 Jun 2017 10:50:12 +0200 Subject: [PATCH 183/286] Add missing triangle prop to react-color GitHub GithubPicker has the "triangle" prop, missing from the types. From the docs: > triangle - String, Either hide, top-left or top-right. Default top-left --- types/react-color/index.d.ts | 2 +- types/react-color/lib/components/github/Github.d.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-color/index.d.ts b/types/react-color/index.d.ts index 798f44d6eb..579ec8e73a 100644 --- a/types/react-color/index.d.ts +++ b/types/react-color/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-color 2.11 // Project: https://github.com/casesandberg/react-color/ -// Definitions by: Karol Janyst +// Definitions by: Karol Janyst , Marks Polakovs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 diff --git a/types/react-color/lib/components/github/Github.d.ts b/types/react-color/lib/components/github/Github.d.ts index fd1479abad..05df2f01a9 100644 --- a/types/react-color/lib/components/github/Github.d.ts +++ b/types/react-color/lib/components/github/Github.d.ts @@ -4,6 +4,7 @@ import { ColorPickerProps } from "react-color"; export interface GithubPickerProps extends ColorPickerProps { colors?: string[]; width?: string; + triangle?: 'hide' | 'top-left' | 'top-right'; } export default class GithubPicker extends Component {} From a87ec5fe4911f3979cdcee9fa5b3ee6fbba1f8b8 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Sun, 11 Jun 2017 12:31:34 +0200 Subject: [PATCH 184/286] Update bunnymq definition (2.3.2). --- types/bunnymq/bunnymq-tests.ts | 21 ++++------------ types/bunnymq/index.d.ts | 45 +++++++++------------------------- 2 files changed, 16 insertions(+), 50 deletions(-) diff --git a/types/bunnymq/bunnymq-tests.ts b/types/bunnymq/bunnymq-tests.ts index 4105363f25..e83fe606da 100644 --- a/types/bunnymq/bunnymq-tests.ts +++ b/types/bunnymq/bunnymq-tests.ts @@ -4,31 +4,20 @@ import * as bunnymq from "bunnymq"; var instance = bunnymq({ host: 'amqp://localhost' }); // Publisher -instance.producer.produce('queue:name', 'Hello World!'); +instance.publish("queue:name", "message"); // Subscriber -instance.consumer.consume('queue:name', message => { }); +instance.subscribe('queue:name', (message: string) => "hello,world"); // RPC Support -instance.producer.produce('queue:name', { message: 'content' }, { rpc: true }) - .then(function (consumerResponse) { - console.log(consumerResponse); - }); - -// Routing keys -instance.producer.produce('queue:name', { message: 'content' }, { routingKey: 'my-routing-key' }); +instance.publish('queue:name', { message: 'content' }, { routingKey: 'my-routing-key', rpc: true }).then((consumerResponse: string) => { }); // Config var custom = bunnymq({ host: 'amqp://localhost', - //number of fetched messages at once on the channel prefetch: 5, - //requeue put back message into the broker if consumer crashes/trigger exception requeue: true, - //time between two reconnect (ms) timeout: 1000, - consumerSuffix: '', - //generate a hostname so we can track this connection on the broker (rabbitmq management plugin) + consumerSuffix: "", hostname: "", - //the transport to use to debug. if provided, bunnymq will show some logs transport: new Object() -}); \ No newline at end of file +}); diff --git a/types/bunnymq/index.d.ts b/types/bunnymq/index.d.ts index 1167db21ed..867ebfd82c 100644 --- a/types/bunnymq/index.d.ts +++ b/types/bunnymq/index.d.ts @@ -1,25 +1,10 @@ -// Type definitions for node-bunnymq 2.2.1 +// Type definitions for node-bunnymq 2.3.2 // Project: https://github.com/dial-once/node-bunnymq // Definitions by: Cyril Schumacher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "bunnymq" { namespace bunnymq { - export type ConsumerCallback = (message: Object) => void; - - /** - * Consumer. - * @interface - */ - export interface Consumer { - /** - * Handle messages from a named queue. - * @param {string} queue A named queue. - * @param {ConsumerCallback} callback A callback. - */ - consume(queue: string, callback: ConsumerCallback): void; - } - /** * bunnymq instance. * @interface @@ -29,13 +14,13 @@ declare module "bunnymq" { * Consumer. * @type {Consumer} */ - consumer: Consumer; + subscribe(queueName: string, callback: (...args: any[]) => T): void; /** * Producer. * @type {Producer} */ - producer: Producer; + publish(queueName: string, message: any, options?: PublisherOptions): Promise; } /** @@ -73,6 +58,12 @@ declare module "bunnymq" { */ requeue?: boolean; + /** + * Default timeout for RPC calls. + * @type {number} + */ + rpcTimeout?: number; + /** * Time between two reconnect (in milliseconds). * @type {number} @@ -87,24 +78,10 @@ declare module "bunnymq" { } /** - * Producer. - * @inteface - */ - export interface Producer { - /** - * Send messages to a named queue. - * @param {string} queue A named queue. - * @param {Object} message A message. - * @return {Object} The consumer response. - */ - produce(queue: string, message: Object, options?: ProducerOptions): PromiseLike; - } - - /** - * Options for producer. + * Options for publisher. * @interface */ - export interface ProducerOptions { + export interface PublisherOptions { routingKey?: string; rpc?: boolean; } From 94330023d9fe246f72c306086d683c3a4b4946e6 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Sun, 11 Jun 2017 13:37:59 +0200 Subject: [PATCH 185/286] Update bunnymq definition and tests. --- types/bunnymq/bunnymq-tests.ts | 12 ++-- types/bunnymq/index.d.ts | 113 +++++++++++++++++---------------- 2 files changed, 65 insertions(+), 60 deletions(-) diff --git a/types/bunnymq/bunnymq-tests.ts b/types/bunnymq/bunnymq-tests.ts index e83fe606da..3ab71dbb80 100644 --- a/types/bunnymq/bunnymq-tests.ts +++ b/types/bunnymq/bunnymq-tests.ts @@ -1,19 +1,23 @@ import * as bunnymq from "bunnymq"; // Basic usage -var instance = bunnymq({ host: 'amqp://localhost' }); +var instance = bunnymq({ host: "amqp://localhost" }); // Publisher instance.publish("queue:name", "message"); +instance.producer.produce("queue:name", "message"); + // Subscriber -instance.subscribe('queue:name', (message: string) => "hello,world"); +instance.subscribe("queue:name", (message: string) => "response"); +instance.consumer.consume("queue:name", (message: string) => "response"); // RPC Support -instance.publish('queue:name', { message: 'content' }, { routingKey: 'my-routing-key', rpc: true }).then((consumerResponse: string) => { }); +instance.publish("queue:name", { message: "content" }, { routingKey: "my-routing-key", rpc: true, timeout: 1000 }).then((consumerResponse: string) => "response"); +instance.producer.produce("queue:name", { message: "content" }, { rpc: true, routingKey: "my-routing-key", timeout: 1000 }); // Config var custom = bunnymq({ - host: 'amqp://localhost', + host: "amqp://localhost", prefetch: 5, requeue: true, timeout: 1000, diff --git a/types/bunnymq/index.d.ts b/types/bunnymq/index.d.ts index 867ebfd82c..62b96144b8 100644 --- a/types/bunnymq/index.d.ts +++ b/types/bunnymq/index.d.ts @@ -5,93 +5,94 @@ declare module "bunnymq" { namespace bunnymq { - /** - * bunnymq instance. - * @interface - */ - export interface Instance { - /** - * Consumer. - * @type {Consumer} - */ - subscribe(queueName: string, callback: (...args: any[]) => T): void; + export type ConsumerCallback = (...args: any[]) => T; + export type LoggerOutput = (format: any, ...args: any[]) => void; + export interface Connection { + [address: string]: any; + startedAt: string; + } + export interface Consumer { /** - * Producer. - * @type {Producer} + * Handle messages from a named queue. + * + * @param {string} queue A named queue. + * @param {ConsumerCallback} callback A callback. */ - publish(queueName: string, message: any, options?: PublisherOptions): Promise; + consume(queue: string, callback: ConsumerCallback): void; + } + + export interface Instance { + connection: Connection; + consumer: Consumer; + producer: Producer; + + /** + * Subscriber to handle messages from a named queue. + * + * @param {string} queue A named queue. + * @param {ConsumerCallback} callback A callback. + */ + subscribe(queueName: string, callback: ConsumerCallback): void; + + /** + * Publisher to send messages to a named queue. + * + * @type {Producer} + * @return {Promise} The consumer response. + */ + publish(queueName: string, message: any, options?: ProducerOptions): Promise; + } + + export interface Logger { + debug: LoggerOutput; + error: LoggerOutput; + info: LoggerOutput; + log: LoggerOutput; + warn: LoggerOutput; } - /** - * Options. - * @interface - */ export interface Options { - /** - * Consumer suffix. - * @type {string} - */ consumerSuffix?: string; - - /** - * Host. - * @type {string} - */ host?: string; - - /** - * Hostname. - * @type {string} - */ hostname?: string; /** * Number of fetched messages at once on the channel. + * * @type {number} */ prefetch?: number; /** * Requeue put back message into the broker if consumer crashes/trigger exception. + * * @type {boolean} */ requeue?: boolean; - - /** - * Default timeout for RPC calls. - * @type {number} - */ rpcTimeout?: number; - - /** - * Time between two reconnect (in milliseconds). - * @type {number} - */ timeout?: number; - - /** - * Transport. - * @type {any} - */ transport?: any; } - /** - * Options for publisher. - * @interface - */ - export interface PublisherOptions { + export interface Producer { + /** + * Send messages to a named queue. + * + * @param {string} queue A named queue. + * @param {any} message A message. + * @return {Promise} The consumer response. + */ + produce(queue: string, message: any, options?: ProducerOptions): Promise; + } + + export interface ProducerOptions { routingKey?: string; rpc?: boolean; + timeout?: number; } } - /** - * Constructor. - * @param {Options} [options] Options. - * @return {Instance} A instance of bunnymq. - */ function bunnymq(options?: bunnymq.Options): bunnymq.Instance; export = bunnymq; } From d290995d52892fe613621a59c91ad8c7b0847bba Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Sun, 11 Jun 2017 13:49:55 +0200 Subject: [PATCH 186/286] Add file: "tslint.json". Fix tslint errors. --- types/bunnymq/bunnymq-tests.ts | 4 +- types/bunnymq/index.d.ts | 180 ++++++++++++++++----------------- types/bunnymq/tslint.json | 3 + 3 files changed, 95 insertions(+), 92 deletions(-) create mode 100644 types/bunnymq/tslint.json diff --git a/types/bunnymq/bunnymq-tests.ts b/types/bunnymq/bunnymq-tests.ts index 3ab71dbb80..960c0b6949 100644 --- a/types/bunnymq/bunnymq-tests.ts +++ b/types/bunnymq/bunnymq-tests.ts @@ -1,7 +1,7 @@ import * as bunnymq from "bunnymq"; // Basic usage -var instance = bunnymq({ host: "amqp://localhost" }); +const instance = bunnymq({ host: "amqp://localhost" }); // Publisher instance.publish("queue:name", "message"); @@ -16,7 +16,7 @@ instance.publish("queue:name", { message: "content" }, { routingKey: "my-routing instance.producer.produce("queue:name", { message: "content" }, { rpc: true, routingKey: "my-routing-key", timeout: 1000 }); // Config -var custom = bunnymq({ +const instanceWithCustomOptions = bunnymq({ host: "amqp://localhost", prefetch: 5, requeue: true, diff --git a/types/bunnymq/index.d.ts b/types/bunnymq/index.d.ts index 62b96144b8..c4c0a770e1 100644 --- a/types/bunnymq/index.d.ts +++ b/types/bunnymq/index.d.ts @@ -1,98 +1,98 @@ -// Type definitions for node-bunnymq 2.3.2 +// Type definitions for node-bunnymq 2.3 // Project: https://github.com/dial-once/node-bunnymq // Definitions by: Cyril Schumacher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module "bunnymq" { - namespace bunnymq { - export type ConsumerCallback = (...args: any[]) => T; - export type LoggerOutput = (format: any, ...args: any[]) => void; +declare function bunnymq(options?: bunnymq.Options): bunnymq.Instance; +declare namespace bunnymq { + type ConsumerCallback = (...args: any[]) => T; + type LoggerOutput = (format: any, ...args: any[]) => void; - export interface Connection { - [address: string]: any; - startedAt: string; - } - export interface Consumer { - /** - * Handle messages from a named queue. - * - * @param {string} queue A named queue. - * @param {ConsumerCallback} callback A callback. - */ - consume(queue: string, callback: ConsumerCallback): void; - } - - export interface Instance { - connection: Connection; - consumer: Consumer; - producer: Producer; - - /** - * Subscriber to handle messages from a named queue. - * - * @param {string} queue A named queue. - * @param {ConsumerCallback} callback A callback. - */ - subscribe(queueName: string, callback: ConsumerCallback): void; - - /** - * Publisher to send messages to a named queue. - * - * @type {Producer} - * @return {Promise} The consumer response. - */ - publish(queueName: string, message: any, options?: ProducerOptions): Promise; - } - - export interface Logger { - debug: LoggerOutput; - error: LoggerOutput; - info: LoggerOutput; - log: LoggerOutput; - warn: LoggerOutput; - } - - export interface Options { - consumerSuffix?: string; - host?: string; - hostname?: string; - - /** - * Number of fetched messages at once on the channel. - * - * @type {number} - */ - prefetch?: number; - - /** - * Requeue put back message into the broker if consumer crashes/trigger exception. - * - * @type {boolean} - */ - requeue?: boolean; - rpcTimeout?: number; - timeout?: number; - transport?: any; - } - - export interface Producer { - /** - * Send messages to a named queue. - * - * @param {string} queue A named queue. - * @param {any} message A message. - * @return {Promise} The consumer response. - */ - produce(queue: string, message: any, options?: ProducerOptions): Promise; - } - - export interface ProducerOptions { - routingKey?: string; - rpc?: boolean; - timeout?: number; - } + interface Connection { + [address: string]: any; + startedAt: string; } - function bunnymq(options?: bunnymq.Options): bunnymq.Instance; - export = bunnymq; + interface Consumer { + /** + * Handle messages from a named queue. + * + * @param {string} queue A named queue. + * @param {ConsumerCallback} callback A callback. + */ + consume(queue: string, callback: ConsumerCallback): void; + } + + interface Instance { + connection: Connection; + consumer: Consumer; + producer: Producer; + + /** + * Subscriber to handle messages from a named queue. + * + * @param {string} queue A named queue. + * @param {ConsumerCallback} callback A callback. + */ + subscribe(queueName: string, callback: ConsumerCallback): void; + + /** + * Publisher to send messages to a named queue. + * + * @type {Producer} + * @return {Promise} The consumer response. + */ + publish(queueName: string, message: any, options?: ProducerOptions): Promise; + } + + interface Logger { + debug: LoggerOutput; + error: LoggerOutput; + info: LoggerOutput; + log: LoggerOutput; + warn: LoggerOutput; + } + + interface Options { + consumerSuffix?: string; + host?: string; + hostname?: string; + + /** + * Number of fetched messages at once on the channel. + * + * @type {number} + */ + prefetch?: number; + + /** + * Requeue put back message into the broker if consumer crashes/trigger exception. + * + * @type {boolean} + */ + requeue?: boolean; + rpcTimeout?: number; + timeout?: number; + transport?: any; + } + + interface Producer { + /** + * Send messages to a named queue. + * + * @param {string} queue A named queue. + * @param {any} message A message. + * @return {Promise} The consumer response. + */ + produce(queue: string, message: any, options?: ProducerOptions): Promise; + } + + interface ProducerOptions { + routingKey?: string; + rpc?: boolean; + timeout?: number; + } } + +export = bunnymq; +export as namespace bunnymq; diff --git a/types/bunnymq/tslint.json b/types/bunnymq/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/bunnymq/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 6c22ae1eb60d33c225ac30a14b4090a1d47d69d0 Mon Sep 17 00:00:00 2001 From: Kasidit Iamthong Date: Sun, 11 Jun 2017 20:28:00 +0700 Subject: [PATCH 187/286] Update `getBounds()`'s return type According to Google Maps JavaScript API V3 Reference, `getBounds()` method on `Map` class can also return `null` or `undefined`. --- types/googlemaps/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/googlemaps/index.d.ts b/types/googlemaps/index.d.ts index e2a4f89922..e2017523ad 100644 --- a/types/googlemaps/index.d.ts +++ b/types/googlemaps/index.d.ts @@ -32,7 +32,7 @@ declare namespace google.maps { export class Map extends MVCObject { constructor(mapDiv: Element|null, opts?: MapOptions); fitBounds(bounds: LatLngBounds|LatLngBoundsLiteral): void; - getBounds(): LatLngBounds; + getBounds(): LatLngBounds|null|undefined; getCenter(): LatLng; getDiv(): Element; getHeading(): number; From feff9f9c3813b2a285a1fd31e0a672507fd92ee9 Mon Sep 17 00:00:00 2001 From: afractal Date: Sun, 11 Jun 2017 19:29:58 +0200 Subject: [PATCH 188/286] add declarations for sharp-timer --- types/sharp-timer/index.d.ts | 52 ++++++++++++++++++++++++++ types/sharp-timer/sharp-timer-tests.ts | 11 ++++++ types/sharp-timer/tsconfig.json | 22 +++++++++++ types/sharp-timer/tslint.json | 3 ++ 4 files changed, 88 insertions(+) create mode 100644 types/sharp-timer/index.d.ts create mode 100644 types/sharp-timer/sharp-timer-tests.ts create mode 100644 types/sharp-timer/tsconfig.json create mode 100644 types/sharp-timer/tslint.json diff --git a/types/sharp-timer/index.d.ts b/types/sharp-timer/index.d.ts new file mode 100644 index 0000000000..65cf798feb --- /dev/null +++ b/types/sharp-timer/index.d.ts @@ -0,0 +1,52 @@ +// Type definitions for sharp-timer 0.3 +// Project: https://github.com/afractal/SharpTimer +// Definitions by: Hermes Gjini - afractal +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export type ElapsedEvent = () => void; +export type ElapsingEvent = (intervalValue: number) => void; + +export class Timer { + private _enabled; + private _stopped; + private _interval; + private _intervalElapsedEvents; + private _intervalElapsingEvents; + constructor(interval: number); + readonly enabled: boolean; + readonly stopped: boolean; + interval: number; + start(): void; + pause(): void; + resume(): void; + stop(): void; + onIntervalElapsed(intervalElapsedHandler: any): void; + onIntervalElapsing(intervalElapsingHandler: any): void; + toString(): string; + private getDoubleDigit(number); + private checkForValidInterval(interval); +} + +export class Stopwatch { + private _isRunning; + private _elapsedMilliseconds; + private _startedTimeInMillis; + private _intervalIds; + private static readonly millisPerSecond; + private static readonly millisPerMinute; + private static readonly millisPerHour; + constructor(); + readonly elapsed: string; + readonly elapsedMilliseconds: number; + readonly elapsedSeconds: number; + readonly elapsedMinutes: number; + readonly elapsedHours: number; + readonly isRunning: boolean; + static startNew(): Stopwatch; + start(): void; + stop(): void; + reset(): void; + restart(): void; + dispose(): void; + private getDoubleDigit(num); +} diff --git a/types/sharp-timer/sharp-timer-tests.ts b/types/sharp-timer/sharp-timer-tests.ts new file mode 100644 index 0000000000..685bf1b1d9 --- /dev/null +++ b/types/sharp-timer/sharp-timer-tests.ts @@ -0,0 +1,11 @@ +import { Timer, Stopwatch } from 'sharp-timer'; + +let timer = new Timer(10); + +timer.onIntervalElapsing(i => { }); +timer.onIntervalElapsed(() => { + timer.stop(); + timer = null; +}); + +timer.start(); diff --git a/types/sharp-timer/tsconfig.json b/types/sharp-timer/tsconfig.json new file mode 100644 index 0000000000..851bf69389 --- /dev/null +++ b/types/sharp-timer/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": false, + "noImplicitThis": false, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "sharp-timer-tests.ts" + ] +} diff --git a/types/sharp-timer/tslint.json b/types/sharp-timer/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/sharp-timer/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From bec4cf3ed07fd50e6a0d85bb4f7b627a99272f7c Mon Sep 17 00:00:00 2001 From: clarenceh Date: Mon, 12 Jun 2017 09:26:29 +0800 Subject: [PATCH 189/286] Updated Table type to support generics --- types/massive/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/massive/index.d.ts b/types/massive/index.d.ts index 1bf0550b2c..67be093bb0 100644 --- a/types/massive/index.d.ts +++ b/types/massive/index.d.ts @@ -44,16 +44,16 @@ declare namespace massive { term: string; } - interface Table { - find(criteria: object | {}, queryOptions?: QueryOptions): Promise; - findOne(criteria: number | object, queryOptions?: QueryOptions): Promise; + interface Table { + find(criteria: object | {}, queryOptions?: QueryOptions): Promise; + findOne(criteria: number | object, queryOptions?: QueryOptions): Promise; count(criteria: object): Promise; - where(query: string, params: any[] | object): Promise; + where(query: string, params: any[] | object): Promise; search(criteria: SearchCriteria, queryOptions?: QueryOptions): Promise; - save(data: object): Promise; - insert(data: object): Promise; - update(dataOrCriteria: object, changesMap?: object): Promise; - destroy(criteria: object): Promise; + save(data: object): Promise; + insert(data: object): Promise; + update(dataOrCriteria: object, changesMap?: object): Promise; + destroy(criteria: object): Promise; } interface Document { From 05ddcaf6c234ee861b0f59d5f6b27acc4b914cfe Mon Sep 17 00:00:00 2001 From: Yui T Date: Sun, 11 Jun 2017 20:46:11 -0700 Subject: [PATCH 190/286] Update Cordova breaking on 2.4 --- .../cordova-plugin-battery-status/index.d.ts | 119 +++--------------- types/cordova-plugin-inappbrowser/index.d.ts | 95 +------------- 2 files changed, 18 insertions(+), 196 deletions(-) diff --git a/types/cordova-plugin-battery-status/index.d.ts b/types/cordova-plugin-battery-status/index.d.ts index 9baedc8cb0..60480135df 100644 --- a/types/cordova-plugin-battery-status/index.d.ts +++ b/types/cordova-plugin-battery-status/index.d.ts @@ -6,114 +6,25 @@ // Copyright (c) Microsoft Open Technologies Inc // Licensed under the MIT license. +interface WindowEventMap { + /** + * batterystatus: event fires when the percentage of battery charge changes by at least 1 percent, or if the device is plugged in or unplugged. + */ + "batterystatus" : BatteryStatusEvent; + /** + * batterycritical: event fires when the percentage of battery charge has reached the critical battery threshold. The value is device-specific. + */ + "batterycritical": BatteryStatusEvent; + /** + * batterylow: event fires when the percentage of battery charge has reached the low battery threshold, device-specific value. + */ + "batterylow": BatteryStatusEvent; +} + interface Window { onbatterystatus: (type: BatteryStatusEvent) => void; onbatterycritical: (type: BatteryStatusEvent) => void; onbatterylow: (type: BatteryStatusEvent) => void; - /** - * Adds a listener for an event from the BatteryStatus plugin. - * @param type the event to listen for - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param listener the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - addEventListener(type: "batterystatus", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void; - /** - * Adds a listener for an event from the BatteryStatus plugin. - * @param type the event to listen for - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param listener the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - addEventListener(type: "batterycritical", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void; - /** - * Adds a listener for an event from the BatteryStatus plugin. - * @param type the event to listen for - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param listener the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - addEventListener(type: "batterylow", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void; - /** - * Adds a listener for an event from the BatteryStatus plugin. - * @param type the event to listen for - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param listener the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - addEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void; - /** - * Removes a listener for an event from the BatteryStatus plugin. - * @param type The event to stop listening for. - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param callback the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - removeEventListener(type: "batterystatus", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void; - /** - * Removes a listener for an event from the BatteryStatus plugin. - * @param type The event to stop listening for. - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param callback the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - removeEventListener(type: "batterycritical", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void; - /** - * Removes a listener for an event from the BatteryStatus plugin. - * @param type The event to stop listening for. - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param callback the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - removeEventListener(type: "batterylow", listener: (ev: BatteryStatusEvent) => any, useCapture?: boolean): void; - /** - * Removes a listener for an event from the BatteryStatus plugin. - * @param type The event to stop listening for. - * batterystatus: event fires when the percentage of battery charge - * changes by at least 1 percent, or if the device is plugged in or unplugged. - * batterycritical: event fires when the percentage of battery charge has reached - * the critical battery threshold. The value is device-specific. - * batterylow: event fires when the percentage of battery charge has - * reached the low battery threshold, device-specific value. - * @param callback the function that executes when the event fires. The function is - * passed an BatteryStatusEvent object as a parameter. - */ - removeEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void; } /** Object, that passed into battery event listener */ diff --git a/types/cordova-plugin-inappbrowser/index.d.ts b/types/cordova-plugin-inappbrowser/index.d.ts index ea3d3adba8..78859d4209 100644 --- a/types/cordova-plugin-inappbrowser/index.d.ts +++ b/types/cordova-plugin-inappbrowser/index.d.ts @@ -57,59 +57,14 @@ interface InAppBrowser extends Window { // addEventListener overloads /** * Adds a listener for an event from the InAppBrowser. - * @param type the event to listen for - * loadstart: event fires when the InAppBrowser starts to load a URL. + * @param type loadstart: event fires when the InAppBrowser starts to load a URL. * loadstop: event fires when the InAppBrowser finishes loading a URL. * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. * exit: event fires when the InAppBrowser window is closed. * @param callback the function that executes when the event fires. The function is * passed an InAppBrowserEvent object as a parameter. */ - addEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void; - /** - * Adds a listener for an event from the InAppBrowser. - * @param type the event to listen for - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - addEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void; - /** - * Adds a listener for an event from the InAppBrowser. - * @param type the event to listen for - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - addEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void; - /** - * Adds a listener for an event from the InAppBrowser. - * @param type the event to listen for - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - addEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void; - /** - * Adds a listener for an event from the InAppBrowser. - * @param type the event to listen for - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an Event object as a parameter. - */ - addEventListener(type: string, callback: (event: Event) => void): void; + addEventListener(type: "loadstart" | "loadstop" | "loaderror" | "exit", callback: (event: InAppBrowserEvent) => void): void; // removeEventListener overloads /** * Removes a listener for an event from the InAppBrowser. @@ -121,51 +76,7 @@ interface InAppBrowser extends Window { * @param callback the function that executes when the event fires. The function is * passed an InAppBrowserEvent object as a parameter. */ - removeEventListener(type: "loadstart", callback: (event: InAppBrowserEvent) => void): void; - /** - * Removes a listener for an event from the InAppBrowser. - * @param type The event to stop listening for. - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - removeEventListener(type: "loadstop", callback: (event: InAppBrowserEvent) => void): void; - /** - * Removes a listener for an event from the InAppBrowser. - * @param type The event to stop listening for. - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - removeEventListener(type: "loaderror", callback: (event: InAppBrowserEvent) => void): void; - /** - * Removes a listener for an event from the InAppBrowser. - * @param type The event to stop listening for. - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an InAppBrowserEvent object as a parameter. - */ - removeEventListener(type: "exit", callback: (event: InAppBrowserEvent) => void): void; - /** - * Removes a listener for an event from the InAppBrowser. - * @param type The event to stop listening for. - * loadstart: event fires when the InAppBrowser starts to load a URL. - * loadstop: event fires when the InAppBrowser finishes loading a URL. - * loaderror: event fires when the InAppBrowser encounters an error when loading a URL. - * exit: event fires when the InAppBrowser window is closed. - * @param callback the function that executes when the event fires. The function is - * passed an Event object as a parameter. - */ - removeEventListener(type: string, callback: (event: Event) => void): void; + removeEventListener(type: "loadstart" | "loadstop" | "loaderror" | "exit", callback: (event: InAppBrowserEvent) => void): void; /** Closes the InAppBrowser window. */ close(): void; /** Hides the InAppBrowser window. Calling this has no effect if the InAppBrowser was already hidden. */ From 127ed8a779e7f6d7c84c09134be141a3122524bc Mon Sep 17 00:00:00 2001 From: Yui T Date: Sun, 11 Jun 2017 20:46:21 -0700 Subject: [PATCH 191/286] Update tests --- .../cordova-plugin-battery-status-tests.ts | 10 ++++++++-- .../cordova-plugin-inappbrowser-tests.ts | 11 ++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts b/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts index 1c62521293..4d31c36a7f 100644 --- a/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts +++ b/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts @@ -1,5 +1,11 @@ -window.addEventListener('batterystatus', - (ev: BatteryStatusEvent) => { console.log('Battery level is ' + ev.level); }); +/// +window.addEventListener('batterystatus', (ev) => { console.log('Battery level is ' + ev.level); }); +window.addEventListener('batterycritical', (ev) => { console.log('Battery is critical: ' + ev.level); }); +window.addEventListener('batterylow', (ev) => { console.log('Battery is low: ' + ev.level); }); + +window.removeEventListener('batterystatus', (ev) => { console.log('Remove: Battery level is ' + ev.level); }); +window.removeEventListener('batterycritical', (ev) => { console.log('Remove: Battery is critical: ' + ev.level); }); +window.removeEventListener('batterylow', (ev) => { console.log('Remove: Battery is low: ' + ev.level); }); window.addEventListener('batterycritical', () => { alert('Battery is critical low!'); }); \ No newline at end of file diff --git a/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts b/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts index cef288c921..ec98249893 100644 --- a/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts +++ b/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts @@ -1,3 +1,4 @@ +/// // InAppBrowser plugin //---------------------------------------------------------------------- @@ -5,7 +6,15 @@ // is similar to native window.open signature, so the compiler can's // select proper overload, but we cast result to InAppBrowser manually. var iab = window.open('google.com', '_self'); -iab.addEventListener('loadstart', (ev: InAppBrowserEvent) => { console.log('Start opening ' + ev.url); }); +iab.addEventListener('loadstart', (ev) => { console.log('loadstart' + ev.url); }); +iab.addEventListener('loadstop', (ev) => { console.log('loadstop' + ev.code); }); +iab.addEventListener('loaderror', (ev) => { console.log('loaderror' + ev.code); }); +iab.addEventListener('exit', (ev) => { console.log('exit' + ev.code); }); + +iab.removeEventListener('loadstart', (ev) => { console.log('Remove loadstart' + ev.url); }); +iab.removeEventListener('loadstop', (ev) => { console.log('Remove loadstop ' + ev.code); }); +iab.removeEventListener('loaderror', (ev) => { console.log('Remove loaderror ' + ev.code); }); +iab.removeEventListener('exit', (ev) => { console.log('Remove exit ' + ev.code); }); iab.show(); iab.executeScript( { code: "console.log('Injected script in action')" }, From d898918cc6eda557a3a874434397d5529c585ef4 Mon Sep 17 00:00:00 2001 From: Yui T Date: Sun, 11 Jun 2017 21:09:56 -0700 Subject: [PATCH 192/286] Add removeEventListener --- types/cordova-plugin-battery-status/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/cordova-plugin-battery-status/index.d.ts b/types/cordova-plugin-battery-status/index.d.ts index 60480135df..4bf3115fe4 100644 --- a/types/cordova-plugin-battery-status/index.d.ts +++ b/types/cordova-plugin-battery-status/index.d.ts @@ -25,6 +25,8 @@ interface Window { onbatterystatus: (type: BatteryStatusEvent) => void; onbatterycritical: (type: BatteryStatusEvent) => void; onbatterylow: (type: BatteryStatusEvent) => void; + removeEventListener(type: K, listener: (ev: WindowEventMap[K]) => any, useCapture?: boolean): void; + removeEventListener(type: string, listener: (ev: Event) => any, useCapture?: boolean): void; } /** Object, that passed into battery event listener */ From 16cb5a4a1436787091b7f8a589beaff13af8fb7d Mon Sep 17 00:00:00 2001 From: Yui T Date: Sun, 11 Jun 2017 21:23:41 -0700 Subject: [PATCH 193/286] Remove test failure cause --- .../cordova-plugin-inappbrowser-tests.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts b/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts index ec98249893..d381f52375 100644 --- a/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts +++ b/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts @@ -1,4 +1,3 @@ -/// // InAppBrowser plugin //---------------------------------------------------------------------- From 86e7e14c723a59c30c7ad5ef2fc5cdaf4a7813b2 Mon Sep 17 00:00:00 2001 From: Yui T Date: Sun, 11 Jun 2017 21:27:18 -0700 Subject: [PATCH 194/286] Remove test failure cause --- .../cordova-plugin-battery-status-tests.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts b/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts index 4d31c36a7f..e0433bf89b 100644 --- a/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts +++ b/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts @@ -1,4 +1,3 @@ -/// window.addEventListener('batterystatus', (ev) => { console.log('Battery level is ' + ev.level); }); window.addEventListener('batterycritical', (ev) => { console.log('Battery is critical: ' + ev.level); }); window.addEventListener('batterylow', (ev) => { console.log('Battery is low: ' + ev.level); }); From 61dd4d34f82c5a0f2bb86bd444c0fdd8a1d2255a Mon Sep 17 00:00:00 2001 From: Yui T Date: Sun, 11 Jun 2017 21:43:52 -0700 Subject: [PATCH 195/286] Add Typescript Version 2.3 --- types/cordova-plugin-battery-status/index.d.ts | 3 ++- types/cordova-plugin-inappbrowser/index.d.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/types/cordova-plugin-battery-status/index.d.ts b/types/cordova-plugin-battery-status/index.d.ts index 4bf3115fe4..f120d3d7e9 100644 --- a/types/cordova-plugin-battery-status/index.d.ts +++ b/types/cordova-plugin-battery-status/index.d.ts @@ -4,7 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // // Copyright (c) Microsoft Open Technologies Inc -// Licensed under the MIT license. +// Licensed under the MIT license. +// TypeScript Version: 2.3 interface WindowEventMap { /** diff --git a/types/cordova-plugin-inappbrowser/index.d.ts b/types/cordova-plugin-inappbrowser/index.d.ts index 78859d4209..91dc61314f 100644 --- a/types/cordova-plugin-inappbrowser/index.d.ts +++ b/types/cordova-plugin-inappbrowser/index.d.ts @@ -5,6 +5,7 @@ // // Copyright (c) Microsoft Open Technologies Inc // Licensed under the MIT license. +// TypeScript Version: 2.3 interface Window { /** From e77bb4a004e634f6649b75109b1d978026314e88 Mon Sep 17 00:00:00 2001 From: Christopher Mckay Date: Mon, 12 Jun 2017 15:39:11 +1000 Subject: [PATCH 196/286] ramda find functions can return undefined http://ramdajs.com/docs/#find --- types/ramda/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 79d1b1f6cf..4d6be6138f 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -587,8 +587,8 @@ declare namespace R { * Returns the first element of the list which matches the predicate, or `undefined` if no * element matches. */ - find(fn: (a: T) => boolean, list: T[]): T; - find(fn: (a: T) => boolean): (list: T[]) => T; + find(fn: (a: T) => boolean, list: T[]): T | undefined; + find(fn: (a: T) => boolean): (list: T[]) => T | undefined; /** @@ -602,8 +602,8 @@ declare namespace R { * Returns the last element of the list which matches the predicate, or `undefined` if no * element matches. */ - findLast(fn: (a: T) => boolean, list: T[]): T; - findLast(fn: (a: T) => boolean): (list: T[]) => T; + findLast(fn: (a: T) => boolean, list: T[]): T | undefined; + findLast(fn: (a: T) => boolean): (list: T[]) => T | undefined; /** * Returns the index of the last element of the list which matches the predicate, or From 6e5e672d9234372b9eb07e66af7a9809eebd80cf Mon Sep 17 00:00:00 2001 From: Anton Cholakov Date: Mon, 12 Jun 2017 11:43:50 +0300 Subject: [PATCH 197/286] Update select2.d.ts to support some functions/props - disabled property of main options - headers object, templateResult and templateSelection functions --- types/select2/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/select2/index.d.ts b/types/select2/index.d.ts index 5828dba2e9..15c4def81a 100644 --- a/types/select2/index.d.ts +++ b/types/select2/index.d.ts @@ -25,10 +25,13 @@ interface Select2AjaxOptions { url?: any; dataType?: string; delay?: number; + headers?: any; cache?: boolean; data?: (params: Select2QueryOptions, page: number, context: any) => any; results?: (term: any, page: number, context: any) => any; processResults?:(data: any, params: any) => any; + templateResult?: (data: any) => any; + templateSelection?: (data: any) => any; } interface IdTextPair { @@ -49,6 +52,7 @@ interface Select2Options { separator?: string; allowClear?: boolean; multiple?: boolean; + disabled?: boolean; closeOnSelect?: boolean; openOnEnter?: boolean; id?: (object: any) => string; From dc4db8db5668cad7d50209f2438fa84954b9036d Mon Sep 17 00:00:00 2001 From: afractal Date: Mon, 12 Jun 2017 10:58:49 +0200 Subject: [PATCH 198/286] update definitions for sharp-timer --- types/sharp-timer/index.d.ts | 4 ++-- types/sharp-timer/tsconfig.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/sharp-timer/index.d.ts b/types/sharp-timer/index.d.ts index 65cf798feb..928a47eed7 100644 --- a/types/sharp-timer/index.d.ts +++ b/types/sharp-timer/index.d.ts @@ -20,8 +20,8 @@ export class Timer { pause(): void; resume(): void; stop(): void; - onIntervalElapsed(intervalElapsedHandler: any): void; - onIntervalElapsing(intervalElapsingHandler: any): void; + onIntervalElapsed(intervalElapsedHandler: ElapsedEvent): void; + onIntervalElapsing(intervalElapsingHandler: ElapsingEvent): void; toString(): string; private getDoubleDigit(number); private checkForValidInterval(interval); diff --git a/types/sharp-timer/tsconfig.json b/types/sharp-timer/tsconfig.json index 851bf69389..3306511dec 100644 --- a/types/sharp-timer/tsconfig.json +++ b/types/sharp-timer/tsconfig.json @@ -4,7 +4,7 @@ "lib": [ "es6" ], - "noImplicitAny": false, + "noImplicitAny": true, "noImplicitThis": false, "strictNullChecks": false, "baseUrl": "../", From 4c8419ee78c8dd5a61e97dbd7fb0d756f773a4f7 Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 12 Jun 2017 10:12:31 +0100 Subject: [PATCH 199/286] Removes whitespace from multer to fix linting issues --- types/multer/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/multer/index.d.ts b/types/multer/index.d.ts index 1199fbe181..fb9bee6c0d 100644 --- a/types/multer/index.d.ts +++ b/types/multer/index.d.ts @@ -41,7 +41,6 @@ declare namespace multer { headerPairs?: number; /** Keep the full path of files instead of just the base name (Default: false) */ preservePath?: boolean; - }; /** A function to control which files to upload and which to skip. */ fileFilter?(req: Express.Request, file: Express.Multer.File, callback: (error: Error, acceptFile: boolean) => void): void; From a0d5848d4ba7f1063431b3f7b04027516dddce19 Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 12 Jun 2017 10:48:01 +0100 Subject: [PATCH 200/286] send: removes setting default_type on mime in test.. .. as this is not possible (anymore) on the current library --- types/send/send-tests.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/send/send-tests.ts b/types/send/send-tests.ts index 22e3e171f2..da41697e96 100644 --- a/types/send/send-tests.ts +++ b/types/send/send-tests.ts @@ -5,7 +5,6 @@ import * as send from 'send'; var app = express(); -send.mime.default_type = 'text/plain'; send.mime.define({ 'application/x-my-type': ['x-mt', 'x-mtt'] }); @@ -34,4 +33,4 @@ app.get('/test.html', (req, res) => { res.setHeader('Content-Disposition', 'attachment'); }) .pipe(res); -}); \ No newline at end of file +}); From 14a0bee08cdded4f8cb67dc0fbca9b11e8290add Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Mon, 12 Jun 2017 15:27:49 +0200 Subject: [PATCH 201/286] fix return value of Polyline.clip() --- types/heremaps/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index 05895c5d11..fee3bbab04 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -2165,7 +2165,7 @@ declare namespace H { * @param geoRect {H.geo.Rect} * @returns {Array>} */ - clip(geoRect: H.geo.Rect): [number[]]; + clip(geoRect: H.geo.Rect): number[][]; } namespace Polyline { From 98faf31f6471a6da8a01d889d1ec496d02e704ae Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Mon, 12 Jun 2017 15:39:29 +0200 Subject: [PATCH 202/286] add test for Polyline.clip() --- types/heremaps/heremaps-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/heremaps/heremaps-tests.ts b/types/heremaps/heremaps-tests.ts index 31d722f042..216040c68a 100644 --- a/types/heremaps/heremaps-tests.ts +++ b/types/heremaps/heremaps-tests.ts @@ -80,3 +80,7 @@ captureBtn.onclick = () => { }; let icon = new H.map.Icon('svg', { size: 5, crossOrigin: false }); + +let polyline = new H.map.Polyline(new H.geo.Strip()); +let clipArr: Array>; +clipArr = polyline.clip(new H.geo.Rect(5, 5, 5, 5)); From 59dfc1e43456fd4e853ff92335a21390ad140ee3 Mon Sep 17 00:00:00 2001 From: Bernd Hacker Date: Mon, 12 Jun 2017 15:54:08 +0200 Subject: [PATCH 203/286] fix failing test --- types/heremaps/heremaps-tests.ts | 1 + types/heremaps/index.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/types/heremaps/heremaps-tests.ts b/types/heremaps/heremaps-tests.ts index 216040c68a..01360c1bdf 100644 --- a/types/heremaps/heremaps-tests.ts +++ b/types/heremaps/heremaps-tests.ts @@ -82,5 +82,6 @@ captureBtn.onclick = () => { let icon = new H.map.Icon('svg', { size: 5, crossOrigin: false }); let polyline = new H.map.Polyline(new H.geo.Strip()); +// tslint:disable-next-line:array-type let clipArr: Array>; clipArr = polyline.clip(new H.geo.Rect(5, 5, 5, 5)); diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index fee3bbab04..28b29bfc09 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Joshua Efiong // Bernd Hacker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 declare namespace H { /***** Map *****/ From d0e32728038891ef24559d819affc53699a5cc1d Mon Sep 17 00:00:00 2001 From: Albert Kurniawan Date: Mon, 12 Jun 2017 23:06:46 +1000 Subject: [PATCH 204/286] Updated RedisStoreOptions in @types/connect-redis --- types/connect-redis/connect-redis-tests.ts | 6 ++++++ types/connect-redis/index.d.ts | 3 +++ 2 files changed, 9 insertions(+) diff --git a/types/connect-redis/connect-redis-tests.ts b/types/connect-redis/connect-redis-tests.ts index 3c50074117..11cd583a74 100644 --- a/types/connect-redis/connect-redis-tests.ts +++ b/types/connect-redis/connect-redis-tests.ts @@ -2,3 +2,9 @@ import * as connectRedis from "connect-redis"; import * as session from "express-session"; let RedisStore = connectRedis(session); +const store = new RedisStore({ + host: 'localhost', + port: 6379, + logErrors: error => console.warn(error), + scanCount: 80, +}); diff --git a/types/connect-redis/index.d.ts b/types/connect-redis/index.d.ts index f66314a083..b5084609a2 100644 --- a/types/connect-redis/index.d.ts +++ b/types/connect-redis/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for connect-redis // Project: https://npmjs.com/package/connect-redis // Definitions by: Xavier Stouder +// Albert Kurniawan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -32,6 +33,8 @@ declare module "connect-redis" { prefix?: string; unref?: boolean; serializer?: Serializer | JSON; + logErrors?: boolean | ((error: string) => void); + scanCount?: number; } interface Serializer { stringify: Function; From 3d7140921aad06c309ba0d5bd4800b196d5087e4 Mon Sep 17 00:00:00 2001 From: Fabien Lavocat Date: Mon, 12 Jun 2017 08:28:17 -0700 Subject: [PATCH 205/286] Remove the interface LinearChartData and move the properties to ChartData --- types/chart.js/chart.js-tests.ts | 6 ++++-- types/chart.js/index.d.ts | 4 ---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/types/chart.js/chart.js-tests.ts b/types/chart.js/chart.js-tests.ts index 2b38efaa25..447e3cb79e 100644 --- a/types/chart.js/chart.js-tests.ts +++ b/types/chart.js/chart.js-tests.ts @@ -1,4 +1,4 @@ -import { Chart, LinearChartData } from 'chart.js'; +import { Chart, ChartData } from 'chart.js'; //alternative: //import chartjs = require('chart.js'); @@ -6,10 +6,12 @@ import { Chart, LinearChartData } from 'chart.js'; var chart = new Chart(new CanvasRenderingContext2D(), { type: 'bar', - data: { + data: { labels: ['group 1'], datasets: [ { + backgroundColor: '#000000', + borderWidth: 1, label: 'test', data: [1] } diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index ec8a7c0c03..3de99408d9 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -128,10 +128,6 @@ declare namespace Chart { } export interface ChartData { - - } - - export interface LinearChartData extends ChartData { labels?: string[]; datasets?: ChartDataSets[]; } From f6e5448b48ec8a71bdaecda65404d7affccb0705 Mon Sep 17 00:00:00 2001 From: Fabien Lavocat Date: Mon, 12 Jun 2017 08:33:30 -0700 Subject: [PATCH 206/286] Add Definition By in header --- types/chart.js/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 3de99408d9..b2899cd851 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Chart.js 2.4.0 // Project: https://github.com/nnnick/Chart.js // Definitions by: Alberto Nuti +// Fabien Lavocat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From aad041f57f0ae79d4788a87897fde8dbf4ff0070 Mon Sep 17 00:00:00 2001 From: Fabien Lavocat Date: Mon, 12 Jun 2017 09:05:39 -0700 Subject: [PATCH 207/286] Add tslint and fix errors --- types/chart.js/chart.js-tests.ts | 6 +- types/chart.js/index.d.ts | 205 ++++++++++++++++--------------- types/chart.js/tslint.json | 6 + 3 files changed, 112 insertions(+), 105 deletions(-) create mode 100644 types/chart.js/tslint.json diff --git a/types/chart.js/chart.js-tests.ts b/types/chart.js/chart.js-tests.ts index 447e3cb79e..b9ffd7a8f6 100644 --- a/types/chart.js/chart.js-tests.ts +++ b/types/chart.js/chart.js-tests.ts @@ -1,10 +1,10 @@ import { Chart, ChartData } from 'chart.js'; -//alternative: -//import chartjs = require('chart.js'); +// alternative: +// import chartjs = require('chart.js'); // => chartjs.Chart -var chart = new Chart(new CanvasRenderingContext2D(), { +let chart: Chart = new Chart(new CanvasRenderingContext2D(), { type: 'bar', data: { labels: ['group 1'], diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index b2899cd851..f5ce46728a 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Chart.js 2.4.0 +// Type definitions for Chart.js 2.4 // Project: https://github.com/nnnick/Chart.js // Definitions by: Alberto Nuti // Fabien Lavocat @@ -23,63 +23,63 @@ declare class Chart { toBase64: () => string; generateLegend: () => {}; getElementAtEvent: (e: any) => {}; - getElementsAtEvent: (e: any) => {}[]; - getDatasetAtEvent: (e: any) => {}[]; + getElementsAtEvent: (e: any) => Array<{}>; + getDatasetAtEvent: (e: any) => Array<{}>; static pluginService: PluginServiceStatic; static defaults: { global: Chart.ChartOptions; - } + }; } declare class PluginServiceStatic { register(plugin?: PluginServiceRegistrationOptions): void; } -declare interface PluginServiceRegistrationOptions { - beforeInit?: (chartInstance: Chart) => void, - afterInit?: (chartInstance: Chart) => void, +interface PluginServiceRegistrationOptions { + beforeInit?(chartInstance: Chart): void; + afterInit?(chartInstance: Chart): void; - resize?: (chartInstance: Chart, newChartSize: Size) => void, + resize?(chartInstance: Chart, newChartSize: Size): void; - beforeUpdate?: (chartInstance: Chart) => void, - afterScaleUpdate?: (chartInstance: Chart) => void, - beforeDatasetsUpdate?: (chartInstance: Chart) => void, - afterDatasetsUpdate?: (chartInstance: Chart) => void, - afterUpdate?: (chartInstance: Chart) => void, + beforeUpdate?(chartInstance: Chart): void; + afterScaleUpdate?(chartInstance: Chart): void; + beforeDatasetsUpdate?(chartInstance: Chart): void; + afterDatasetsUpdate?(chartInstance: Chart): void; + afterUpdate?(chartInstance: Chart): void; // This is called at the start of a render. It is only called once, even if the animation will run for a number of frames. Use beforeDraw or afterDraw // to do something on each animation frame - beforeRender?: (chartInstance: Chart) => void, + beforeRender?(chartInstance: Chart): void; // Easing is for animation - beforeDraw?: (chartInstance: Chart, easing: string) => void, - afterDraw?: (chartInstance: Chart, easing: string) => void, + beforeDraw?(chartInstance: Chart, easing: string): void; + afterDraw?(chartInstance: Chart, easing: string): void; // Before the datasets are drawn but after scales are drawn - beforeDatasetsDraw?: (chartInstance: Chart, easing: string) => void, - afterDatasetsDraw?: (chartInstance: Chart, easing: string) => void, + beforeDatasetsDraw?(chartInstance: Chart, easing: string): void; + afterDatasetsDraw?(chartInstance: Chart, easing: string): void; - destroy?: (chartInstance: Chart) => void, + destroy?(chartInstance: Chart): void; // Called when an event occurs on the chart - beforeEvent?: (chartInstance: Chart, event: Event) => void, - afterEvent?: (chartInstance: Chart, event: Event) => void + beforeEvent?(chartInstance: Chart, event: Event): void; + afterEvent?(chartInstance: Chart, event: Event): void; } -declare interface Size { +interface Size { height: number; width: number; } declare namespace Chart { - export type ChartType = 'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble'; + type ChartType = 'line' | 'bar' | 'radar' | 'doughnut' | 'polarArea' | 'bubble'; - export type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'; + type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year'; - export type ScaleType = 'category' | 'linear' | 'logarithmic' | 'time' | 'radialLinear'; + type ScaleType = 'category' | 'linear' | 'logarithmic' | 'time' | 'radialLinear'; - export type PositionType = 'left' | 'right' | 'top' | 'bottom'; + type PositionType = 'left' | 'right' | 'top' | 'bottom'; - export interface ChartLegendItem { + interface ChartLegendItem { text?: string; fillStyle?: string; hidden?: boolean; @@ -91,54 +91,54 @@ declare namespace Chart { strokeStyle?: string; } - export interface ChartTooltipItem { + interface ChartTooltipItem { xLabel?: string; yLabel?: string; datasetIndex?: number; index?: number; } - export interface ChartTooltipCallback { - beforeTitle?: (item?: ChartTooltipItem[], data?: any) => void; - title?: (item?: ChartTooltipItem[], data?: any) => void; - afterTitle?: (item?: ChartTooltipItem[], data?: any) => void; - beforeBody?: (item?: ChartTooltipItem[], data?: any) => void; - beforeLabel?: (tooltipItem?: ChartTooltipItem, data?: any) => void; - label?: (tooltipItem?: ChartTooltipItem, data?: any) => void; - afterLabel?: (tooltipItem?: ChartTooltipItem, data?: any) => void; - afterBody?: (item?: ChartTooltipItem[], data?: any) => void; - beforeFooter?: (item?: ChartTooltipItem[], data?: any) => void; - footer?: (item?: ChartTooltipItem[], data?: any) => void; - afterFooter?: (item?: ChartTooltipItem[], data?: any) => void; + interface ChartTooltipCallback { + beforeTitle?(item?: ChartTooltipItem[], data?: any): void; + title?(item?: ChartTooltipItem[], data?: any): void; + afterTitle?(item?: ChartTooltipItem[], data?: any): void; + beforeBody?(item?: ChartTooltipItem[], data?: any): void; + beforeLabel?(tooltipItem?: ChartTooltipItem, data?: any): void; + label?(tooltipItem?: ChartTooltipItem, data?: any): void; + afterLabel?(tooltipItem?: ChartTooltipItem, data?: any): void; + afterBody?(item?: ChartTooltipItem[], data?: any): void; + beforeFooter?(item?: ChartTooltipItem[], data?: any): void; + footer?(item?: ChartTooltipItem[], data?: any): void; + afterFooter?(item?: ChartTooltipItem[], data?: any): void; } - export interface ChartAnimationParameter { + interface ChartAnimationParameter { chartInstance?: any; animationObject?: any; } - export interface ChartPoint { + interface ChartPoint { x?: number | string | Date; y?: number; } - export interface ChartConfiguration { + interface ChartConfiguration { type?: ChartType | string; data?: ChartData; options?: ChartOptions; } - export interface ChartData { + interface ChartData { labels?: string[]; datasets?: ChartDataSets[]; } - export interface ChartOptions { + interface ChartOptions { responsive?: boolean; responsiveAnimationDuration?: number; maintainAspectRatio?: boolean; events?: string[]; - onClick?: (any?: any) => any; + onClick?(any?: any): any; title?: ChartTitleOptions; legend?: ChartLegendOptions; tooltips?: ChartTooltipOptions; @@ -149,14 +149,14 @@ declare namespace Chart { cutoutPercentage?: number; } - export interface ChartFontOptions { + interface ChartFontOptions { defaultFontColor?: ChartColor; defaultFontFamily?: string; defaultFontSize?: number; defaultFontStyle?: string; } - export interface ChartTitleOptions { + interface ChartTitleOptions { display?: boolean; position?: string; fullWdith?: boolean; @@ -168,27 +168,27 @@ declare namespace Chart { text?: string; } - export interface ChartLegendOptions { + interface ChartLegendOptions { display?: boolean; position?: string; fullWidth?: boolean; - onClick?: (event: any, legendItem: any) => void; + onClick?(event: any, legendItem: any): void; labels?: ChartLegendLabelOptions; } - export interface ChartLegendLabelOptions { + interface ChartLegendLabelOptions { boxWidth?: number; fontSize?: number; fontStyle?: number; fontColor?: ChartColor; fontFamily?: string; padding?: number; - generateLabels?: (chart: any) => any; + generateLabels?(chart: any): any; } - export interface ChartTooltipOptions { + interface ChartTooltipOptions { enabled?: boolean; - custom?: (a: any) => void; + custom?(a: any): void; mode?: string; backgroundColor?: ChartColor; titleFontFamily?: string; @@ -216,42 +216,42 @@ declare namespace Chart { callbacks?: ChartTooltipCallback; } - export interface ChartHoverOptions { + interface ChartHoverOptions { mode?: string; animationDuration?: number; - onHover?: (active: any) => void; + onHover?(active: any): void; } - export interface ChartAnimationObject { + interface ChartAnimationObject { currentStep?: number; numSteps?: number; easing?: string; - render?: (arg: any) => void; - onAnimationProgress?: (arg: any) => void; - onAnimationComplete?: (arg: any) => void; + render?(arg: any): void; + onAnimationProgress?(arg: any): void; + onAnimationComplete?(arg: any): void; } - export interface ChartAnimationOptions { + interface ChartAnimationOptions { duration?: number; easing?: string; - onProgress?: (chart: any) => void; - onComplete?: (chart: any) => void; + onProgress?(chart: any): void; + onComplete?(chart: any): void; } - export interface ChartElementsOptions { + interface ChartElementsOptions { point?: ChartPointOptions; line?: ChartLineOptions; arc?: ChartArcOptions; rectangle?: ChartRectangleOptions; } - export interface ChartArcOptions { + interface ChartArcOptions { backgroundColor?: ChartColor; borderColor?: ChartColor; borderWidth?: number; } - export interface ChartLineOptions { + interface ChartLineOptions { tension?: number; backgroundColor?: ChartColor; borderWidth?: number; @@ -262,7 +262,7 @@ declare namespace Chart { borderJoinStyle?: string; } - export interface ChartPointOptions { + interface ChartPointOptions { radius?: number; pointStyle?: string; backgroundColor?: ChartColor; @@ -273,13 +273,13 @@ declare namespace Chart { hoverBorderWidth?: number; } - export interface ChartRectangleOptions { + interface ChartRectangleOptions { backgroundColor?: ChartColor; borderWidth?: number; borderColor?: ChartColor; borderSkipped?: string; } - export interface GridLineOptions { + interface GridLineOptions { display?: boolean; color?: ChartColor; lineWidth?: number; @@ -292,7 +292,7 @@ declare namespace Chart { offsetGridLines?: boolean; } - export interface ScaleTitleOptions { + interface ScaleTitleOptions { display?: boolean; labelString?: string; fontColor?: ChartColor; @@ -301,9 +301,9 @@ declare namespace Chart { fontStyle?: string; } - export interface TickOptions { + interface TickOptions { autoSkip?: boolean; - callback?: (value: any, index: any, values: any) => string; + callback?(value: any, index: any, values: any): string; display?: boolean; fontColor?: ChartColor; fontFamily?: string; @@ -318,28 +318,28 @@ declare namespace Chart { min?: any; max?: any; } - export interface AngleLineOptions { + interface AngleLineOptions { display?: boolean; color?: ChartColor; lineWidth?: number; } - export interface PointLabelOptions { - callback?: (arg: any) => any; + interface PointLabelOptions { + callback?(arg: any): any; fontColor?: ChartColor; fontFamily?: string; fontSize?: number; fontStyle?: string; } - export interface TickOptions { + interface TickOptions { backdropColor?: ChartColor; backdropPaddingX?: number; backdropPaddingY?: number; maxTicksLimit?: number; showLabelBackdrop?: boolean; } - export interface LinearTickOptions extends TickOptions { + interface LinearTickOptions extends TickOptions { beginAtZero?: boolean; min?: number; max?: number; @@ -349,14 +349,14 @@ declare namespace Chart { suggestedMax?: number; } - export interface LogarithmicTickOptions extends TickOptions { + interface LogarithmicTickOptions extends TickOptions { min?: number; max?: number; } type ChartColor = string | CanvasGradient | CanvasPattern; - export interface ChartDataSets { + interface ChartDataSets { backgroundColor?: ChartColor; borderWidth?: number; borderColor?: ChartColor; @@ -382,24 +382,24 @@ declare namespace Chart { yAxisID?: string; } - export interface ChartScales { + interface ChartScales { type?: ScaleType | string; display?: boolean; position?: PositionType | string; - beforeUpdate?: (scale?: any) => void; - beforeSetDimension?: (scale?: any) => void; - beforeDataLimits?: (scale?: any) => void; - beforeBuildTicks?: (scale?: any) => void; - beforeTickToLabelConversion?: (scale?: any) => void; - beforeCalculateTickRotation?: (scale?: any) => void; - beforeFit?: (scale?: any) => void; - afterUpdate?: (scale?: any) => void; - afterSetDimension?: (scale?: any) => void; - afterDataLimits?: (scale?: any) => void; - afterBuildTicks?: (scale?: any) => void; - afterTickToLabelConversion?: (scale?: any) => void; - afterCalculateTickRotation?: (scale?: any) => void; - afterFit?: (scale?: any) => void; + beforeUpdate?(scale?: any): void; + beforeSetDimension?(scale?: any): void; + beforeDataLimits?(scale?: any): void; + beforeBuildTicks?(scale?: any): void; + beforeTickToLabelConversion?(scale?: any): void; + beforeCalculateTickRotation?(scale?: any): void; + beforeFit?(scale?: any): void; + afterUpdate?(scale?: any): void; + afterSetDimension?(scale?: any): void; + afterDataLimits?(scale?: any): void; + afterBuildTicks?(scale?: any): void; + afterTickToLabelConversion?(scale?: any): void; + afterCalculateTickRotation?(scale?: any): void; + afterFit?(scale?: any): void; gridLines?: GridLineOptions; scaleLabel?: ScaleTitleOptions; ticks?: TickOptions; @@ -407,7 +407,7 @@ declare namespace Chart { yAxes?: ChartYAxe[]; } - export interface CommonAxe { + interface CommonAxe { type?: ScaleType | string; display?: boolean; id?: string; @@ -419,24 +419,25 @@ declare namespace Chart { scaleLabel?: ScaleTitleOptions; } - export interface ChartXAxe extends CommonAxe { + interface ChartXAxe extends CommonAxe { categoryPercentage?: number; barPercentage?: number; time?: TimeScale; } - export interface ChartYAxe extends CommonAxe { + // tslint:disable-next-line no-empty-interface + interface ChartYAxe extends CommonAxe { } - export interface LinearScale extends ChartScales { + interface LinearScale extends ChartScales { ticks?: LinearTickOptions; } - export interface LogarithmicScale extends ChartScales { + interface LogarithmicScale extends ChartScales { ticks?: LogarithmicTickOptions; } - export interface TimeDisplayFormat { + interface TimeDisplayFormat { millisecond?: string; second?: string; minute?: string; @@ -448,7 +449,7 @@ declare namespace Chart { year?: string; } - export interface TimeScale extends ChartScales { + interface TimeScale extends ChartScales { displayFormats?: TimeDisplayFormat; isoWeekday?: boolean; max?: string; @@ -461,7 +462,7 @@ declare namespace Chart { minUnit?: TimeUnit; } - export interface RadialLinearScale { + interface RadialLinearScale { lineArc?: boolean; angleLines?: AngleLineOptions; pointLabels?: PointLabelOptions; diff --git a/types/chart.js/tslint.json b/types/chart.js/tslint.json new file mode 100644 index 0000000000..a62d0d4e68 --- /dev/null +++ b/types/chart.js/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "ban-types": false + } +} From d807e9544ab77f97ef2bfab336161def61bc113f Mon Sep 17 00:00:00 2001 From: esplo Date: Tue, 13 Jun 2017 01:06:28 +0900 Subject: [PATCH 208/286] [material-ui] add iconStyle to CardHeader --- types/material-ui/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index 7308c0f089..560b21f2ca 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -832,6 +832,7 @@ declare namespace __MaterialUI { className?: string; openIcon?: React.ReactNode; closeIcon?: React.ReactNode; + iconStyle?: React.CSSProperties; } export class CardHeader extends React.Component { } From c8d5eeea73c42274e6a2cada1c40578334baa9b7 Mon Sep 17 00:00:00 2001 From: Fabien Lavocat Date: Mon, 12 Jun 2017 09:23:01 -0700 Subject: [PATCH 209/286] Update the library react-chartjs-2 that depends on chart.js --- types/react-chartjs-2/index.d.ts | 3 ++- types/react-chartjs-2/test/doughnut.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/react-chartjs-2/index.d.ts b/types/react-chartjs-2/index.d.ts index e3e2da896c..1814a34932 100644 --- a/types/react-chartjs-2/index.d.ts +++ b/types/react-chartjs-2/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for react-chartjs-2 2.0 // Project: https://github.com/gor181/react-chartjs-2 // Definitions by: Alexandre Paré +// Fabien Lavocat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -25,7 +26,7 @@ export interface ChartComponentProps { } export interface LinearComponentProps extends ChartComponentProps { - data: ChartData; + data: ChartData; } export default class ChartComponent

extends React.Component { diff --git a/types/react-chartjs-2/test/doughnut.tsx b/types/react-chartjs-2/test/doughnut.tsx index 4051310185..268ddfe40e 100755 --- a/types/react-chartjs-2/test/doughnut.tsx +++ b/types/react-chartjs-2/test/doughnut.tsx @@ -14,7 +14,7 @@ const data = { '#36A2EB', '#FFCE56' ], - hoverBackgroundColor: [ + pointHoverBackgroundColor: [ '#FF6384', '#36A2EB', '#FFCE56' From 8ac784aac5ddbc67b9724f3d0bc9e177c965eca6 Mon Sep 17 00:00:00 2001 From: Fabien Lavocat Date: Mon, 12 Jun 2017 09:36:25 -0700 Subject: [PATCH 210/286] Add missing file in last commit --- types/chart.js/index.d.ts | 2 +- types/react-chartjs-2/test/pie.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index f5ce46728a..0b1f70beae 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -357,7 +357,7 @@ declare namespace Chart { type ChartColor = string | CanvasGradient | CanvasPattern; interface ChartDataSets { - backgroundColor?: ChartColor; + backgroundColor?: ChartColor | ChartColor[]; borderWidth?: number; borderColor?: ChartColor; borderCapStyle?: string; diff --git a/types/react-chartjs-2/test/pie.tsx b/types/react-chartjs-2/test/pie.tsx index ba0a23ffb3..454088331d 100755 --- a/types/react-chartjs-2/test/pie.tsx +++ b/types/react-chartjs-2/test/pie.tsx @@ -14,7 +14,7 @@ const data = { '#36A2EB', '#FFCE56' ], - hoverBackgroundColor: [ + pointHoverBackgroundColor: [ '#FF6384', '#36A2EB', '#FFCE56' From 2b9d93ec88f7da5e427ab7f81910dbdf7946e2e5 Mon Sep 17 00:00:00 2001 From: krister Date: Mon, 12 Jun 2017 21:57:51 +0300 Subject: [PATCH 211/286] Enable linting --- types/react-intl/index.d.ts | 64 +++++++++++++-------------- types/react-intl/react-intl-tests.tsx | 28 +++++++----- types/react-intl/tslint.json | 1 + 3 files changed, 49 insertions(+), 44 deletions(-) create mode 100644 types/react-intl/tslint.json diff --git a/types/react-intl/index.d.ts b/types/react-intl/index.d.ts index 9777987c8d..644e9c9450 100644 --- a/types/react-intl/index.d.ts +++ b/types/react-intl/index.d.ts @@ -1,22 +1,22 @@ -// Type definitions for react-intl 2.2 +// Type definitions for react-intl 2.3 // Project: http://formatjs.io/react/ // Definitions by: Bruno Grieder , // Christian Droulers , // Fedor Nezhivoi , // Till Wolff , // Karol Janyst , -// Brian Houser +// Brian Houser , +// Krister Kari // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 declare namespace ReactIntl { - type DateSource = Date | string | number; interface Locale { locale: string; - fields?: { [key: string]: string }, - pluralRuleFunction?: (n: number, ord: boolean) => string; + fields?: { [key: string]: string }; + pluralRuleFunction?(n: number, ord: boolean): string; } type LocaleData = Locale[]; @@ -26,7 +26,7 @@ declare namespace ReactIntl { withRef?: boolean; } - type ComponentConstructor

= React.ComponentClass

| React.StatelessComponent

+ type ComponentConstructor

= React.ComponentClass

| React.StatelessComponent

; function injectIntl

(component: ComponentConstructor

, options?: InjectIntlConfig): React.ComponentClass

& { WrappedComponent: ComponentConstructor

}; @@ -34,7 +34,7 @@ declare namespace ReactIntl { function addLocaleData(data: Locale[] | Locale): void; interface Messages { - [key: string]: FormattedMessage.MessageDescriptor + [key: string]: FormattedMessage.MessageDescriptor; } function defineMessages(messages: T): T; @@ -64,19 +64,19 @@ declare namespace ReactIntl { const intlShape: IntlShape; interface InjectedIntl { - formatDate: (value: DateSource, options?: FormattedDate.PropsBase) => string; - formatTime: (value: DateSource, options?: FormattedTime.PropsBase) => string; - formatRelative: (value: DateSource, options?: FormattedRelative.PropsBase & { now?: any }) => string; - formatNumber: (value: number, options?: FormattedNumber.PropsBase) => string; - formatPlural: (value: number, options?: FormattedPlural.Base) => keyof FormattedPlural.PropsBase; - formatMessage: (messageDescriptor: FormattedMessage.MessageDescriptor, values?: {[key: string]: string | number}) => string; - formatHTMLMessage: (messageDescriptor: FormattedMessage.MessageDescriptor, values?: {[key: string]: string}) => string; + formatDate(value: DateSource, options?: FormattedDate.PropsBase): string; + formatTime(value: DateSource, options?: FormattedTime.PropsBase): string; + formatRelative(value: DateSource, options?: FormattedRelative.PropsBase & { now?: any }): string; + formatNumber(value: number, options?: FormattedNumber.PropsBase): string; + formatPlural(value: number, options?: FormattedPlural.Base): keyof FormattedPlural.PropsBase; + formatMessage(messageDescriptor: FormattedMessage.MessageDescriptor, values?: {[key: string]: string | number}): string; + formatHTMLMessage(messageDescriptor: FormattedMessage.MessageDescriptor, values?: {[key: string]: string}): string; locale: string; formats: any; messages: { [id: string]: string }; defaultLocale: string; defaultFormats: any; - now : () => number; + now(): number; } interface InjectedIntlProps { @@ -90,9 +90,9 @@ declare namespace ReactIntl { } namespace FormattedDate { - export interface PropsBase extends IntlComponent.DateTimeFormatProps {} + type PropsBase = IntlComponent.DateTimeFormatProps; - export interface Props extends PropsBase { + interface Props extends PropsBase { value: DateSource; } } @@ -100,16 +100,16 @@ declare namespace ReactIntl { class FormattedDate extends React.Component { } namespace FormattedTime { - export interface PropsBase extends IntlComponent.DateTimeFormatProps {} + type PropsBase = IntlComponent.DateTimeFormatProps; - export interface Props extends PropsBase { + interface Props extends PropsBase { value: DateSource; } } class FormattedTime extends React.Component { } namespace FormattedRelative { - export interface PropsBase { + interface PropsBase { /* * one of "second", "minute", "hour", "day", "month" or "year" */ @@ -123,7 +123,7 @@ declare namespace ReactIntl { initialNow?: any; } - export interface Props extends PropsBase { + interface Props extends PropsBase { value: DateSource; } } @@ -131,13 +131,13 @@ declare namespace ReactIntl { class FormattedRelative extends React.Component { } namespace FormattedMessage { - export interface MessageDescriptor { + interface MessageDescriptor { id: string; description?: string; defaultMessage?: string; } - export interface Props extends MessageDescriptor { + interface Props extends MessageDescriptor { values?: {[key: string]: string | number | JSX.Element}; tagName?: string; } @@ -147,26 +147,25 @@ declare namespace ReactIntl { class FormattedHTMLMessage extends React.Component { } namespace FormattedNumber { - export interface PropsBase extends Intl.NumberFormatOptions { + interface PropsBase extends Intl.NumberFormatOptions { format?: string; } - export interface Props extends PropsBase { + interface Props extends PropsBase { value: number; } } class FormattedNumber extends React.Component { } - namespace FormattedPlural { - export interface Base { + interface Base { /* * one of "cardinal" (default) | "ordinal" */ style?: "cardinal" | "ordinal"; } - export interface PropsBase extends Base { + interface PropsBase extends Base { other?: any; zero?: any; one?: any; @@ -175,15 +174,14 @@ declare namespace ReactIntl { many?: any; } - export interface Props extends PropsBase { + interface Props extends PropsBase { value: number; } } class FormattedPlural extends React.Component { } - namespace IntlProvider { - export interface Props { + interface Props { locale?: string; formats?: any; messages?: any; @@ -196,12 +194,12 @@ declare namespace ReactIntl { class IntlProvider extends React.Component { getChildContext(): { intl: InjectedIntl; - } + }; } } declare module "react-intl" { - export = ReactIntl + export = ReactIntl; } declare module "react-intl/locale-data/af" { diff --git a/types/react-intl/react-intl-tests.tsx b/types/react-intl/react-intl-tests.tsx index 8b21ef8651..42305ef571 100644 --- a/types/react-intl/react-intl-tests.tsx +++ b/types/react-intl/react-intl-tests.tsx @@ -3,8 +3,8 @@ * Updated by Fedor Nezhivoi */ -import * as React from "react" -import * as reactMixin from "react-mixin" +import * as React from "react"; +import * as reactMixin from "react-mixin"; import { IntlProvider, @@ -21,14 +21,14 @@ import { FormattedPlural, FormattedDate, FormattedTime -} from "react-intl" +} from "react-intl"; import reactIntlEn = require("react-intl/locale-data/en"); addLocaleData(reactIntlEn); interface SomeComponentProps { - className: string + className: string; } const SomeFunctionalComponentWithIntl: React.ComponentClass = injectIntl(({ @@ -51,7 +51,10 @@ const SomeFunctionalComponentWithIntl: React.ComponentClass const formattedNumber = formatNumber(123, { format: "short" }); const formattedPlural = formatPlural(1, { style: "ordinal" }); const formattedMessage = formatMessage({ id: "hello", defaultMessage: "Hello {name}!" }, { name: "Roger" }); - const formattedMessagePlurals = formatMessage({ id: "hello", defaultMessage: "Hello {name} you have {unreadCount, number} {unreadCount, plural, one {message} other {messages}}!" }, { name: "Roger", unreadCount: 123 }); + const formattedMessagePlurals = formatMessage({ + id: "hello", + defaultMessage: "Hello {name} you have {unreadCount, number} {unreadCount, plural, one {message} other {messages}}!" }, + { name: "Roger", unreadCount: 123 }); const formattedHTMLMessage = formatHTMLMessage({ id: "hello", defaultMessage: "Hello {name}!" }, { name: "Roger" }); return (

@@ -71,7 +74,10 @@ class SomeComponent extends React.Component{name}!" }, { name: "Roger" }); return
{formattedNum} )} -
+
; } } @@ -230,14 +236,14 @@ const SomeComponentWithIntl = injectIntl(SomeComponent); class TestApp extends React.Component<{}, {}> { render(): React.ReactElement<{}> { const definedMessages = defineMessages({ - "sup": { + sup: { id: "sup", defaultMessage: "Hai mom" } }); const messages = { - "hello": "Hello, {name}!" + hello: "Hello, {name}!" }; return ( @@ -250,9 +256,9 @@ class TestApp extends React.Component<{}, {}> { const intlProvider = new IntlProvider({ locale: 'en' }, {}); const { intl } = intlProvider.getChildContext(); -const wrappedComponent = +const wrappedComponent = ; export default { TestApp, SomeComponent: SomeComponentWithIntl -} +}; diff --git a/types/react-intl/tslint.json b/types/react-intl/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-intl/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 81e990d1d742f9f2a4e8f1b9cf787624a77327fd Mon Sep 17 00:00:00 2001 From: krister Date: Mon, 12 Jun 2017 22:08:09 +0300 Subject: [PATCH 212/286] Allow booleans, dates and numbers when formatting a message --- types/react-intl/index.d.ts | 4 ++-- types/react-intl/react-intl-tests.tsx | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/types/react-intl/index.d.ts b/types/react-intl/index.d.ts index 644e9c9450..f52fbc1cbc 100644 --- a/types/react-intl/index.d.ts +++ b/types/react-intl/index.d.ts @@ -69,8 +69,8 @@ declare namespace ReactIntl { formatRelative(value: DateSource, options?: FormattedRelative.PropsBase & { now?: any }): string; formatNumber(value: number, options?: FormattedNumber.PropsBase): string; formatPlural(value: number, options?: FormattedPlural.Base): keyof FormattedPlural.PropsBase; - formatMessage(messageDescriptor: FormattedMessage.MessageDescriptor, values?: {[key: string]: string | number}): string; - formatHTMLMessage(messageDescriptor: FormattedMessage.MessageDescriptor, values?: {[key: string]: string}): string; + formatMessage(messageDescriptor: FormattedMessage.MessageDescriptor, values?: {[key: string]: string | number | boolean | Date}): string; + formatHTMLMessage(messageDescriptor: FormattedMessage.MessageDescriptor, values?: {[key: string]: string | number | boolean | Date}): string; locale: string; formats: any; messages: { [id: string]: string }; diff --git a/types/react-intl/react-intl-tests.tsx b/types/react-intl/react-intl-tests.tsx index 42305ef571..1550aafcbe 100644 --- a/types/react-intl/react-intl-tests.tsx +++ b/types/react-intl/react-intl-tests.tsx @@ -74,11 +74,17 @@ class SomeComponent extends React.Component{name}!" }, { name: "Roger" }); + const formattedHTMLMessageNumber = intl.formatHTMLMessage({ id: "hello", defaultMessage: "Hello {num}!" }, { num: 1 }); + const formattedHTMLMessageDate = intl.formatHTMLMessage({ id: "hello", defaultMessage: "Hello {date}!" }, { date: new Date() }); + const formattedHTMLMessageBool = intl.formatHTMLMessage({ id: "hello", defaultMessage: "Hello {bool}!" }, { bool: true }); return
Date: Mon, 12 Jun 2017 23:52:00 +0300 Subject: [PATCH 213/286] add jasmine-given --- types/jasmine-given/index.d.ts | 10 ++++++++++ types/jasmine-given/jasmine-given-tests.ts | 9 +++++++++ types/jasmine-given/tsconfig.json | 22 ++++++++++++++++++++++ types/jasmine-given/tslint.json | 1 + 4 files changed, 42 insertions(+) create mode 100644 types/jasmine-given/index.d.ts create mode 100644 types/jasmine-given/jasmine-given-tests.ts create mode 100644 types/jasmine-given/tsconfig.json create mode 100644 types/jasmine-given/tslint.json diff --git a/types/jasmine-given/index.d.ts b/types/jasmine-given/index.d.ts new file mode 100644 index 0000000000..70a23d7e07 --- /dev/null +++ b/types/jasmine-given/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for jasmine-given 2.6 +// Project: https://github.com/searls/jasmine-given +// Definitions by: Shai Reznik +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function Given(func: () => void): void; +declare function When(func: () => void): void; +declare function Then(func: () => void): void; +declare function And(func: () => void): void; +declare function Invariant(func: () => void): void; diff --git a/types/jasmine-given/jasmine-given-tests.ts b/types/jasmine-given/jasmine-given-tests.ts new file mode 100644 index 0000000000..8a994ecbbe --- /dev/null +++ b/types/jasmine-given/jasmine-given-tests.ts @@ -0,0 +1,9 @@ +Given(() => { }); + +When(() => { }); + +Then(() => { }); + +And(() => { }); + +Invariant(() => {}); diff --git a/types/jasmine-given/tsconfig.json b/types/jasmine-given/tsconfig.json new file mode 100644 index 0000000000..cb1571590b --- /dev/null +++ b/types/jasmine-given/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", + "jasmine-given-tests.ts" + ] +} \ No newline at end of file diff --git a/types/jasmine-given/tslint.json b/types/jasmine-given/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/jasmine-given/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file From 1e6529ab1f13540ccfbc91936bb04f311868855a Mon Sep 17 00:00:00 2001 From: Bryan Johnson Date: Mon, 12 Jun 2017 16:36:39 -0600 Subject: [PATCH 214/286] fix parts of mapbox-gl def for v0.38.0 --- types/mapbox-gl/index.d.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/types/mapbox-gl/index.d.ts b/types/mapbox-gl/index.d.ts index 41c7f84d98..9438bfafac 100644 --- a/types/mapbox-gl/index.d.ts +++ b/types/mapbox-gl/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Mapbox GL JS v0.35.1 +// Type definitions for Mapbox GL JS v0.38.0 // Project: https://github.com/mapbox/mapbox-gl-js // Definitions by: Dominik Bruderer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -57,10 +57,14 @@ declare namespace mapboxgl { getStyle(): mapboxgl.Style; + isStyleLoaded(): boolean; + addSource(id: string, source: VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource | GeoJSONSourceRaw): this; isSourceLoaded(id: string): boolean; + areTilesLoaded(): boolean; + removeSource(id: string): this; getSource(id: string): VectorSource | RasterSource | GeoJSONSource | ImageSource | VideoSource; @@ -252,7 +256,7 @@ declare namespace mapboxgl { zoom?: number; } - export class PaddingOptions extends Evented { + export interface PaddingOptions { top: number; bottom: number; left: number; @@ -600,8 +604,6 @@ declare namespace mapboxgl { /** Return a new LngLat object whose longitude is wrapped to the range (-180, 180). */ wrap(): mapboxgl.LngLat; - wrapToBestWorld(center: mapboxgl.LngLat): mapboxgl.LngLat; - /** Return a LngLat as an array */ toArray(): number[]; From dea10c7a6de3226a981d7c75c3391a6e2db38369 Mon Sep 17 00:00:00 2001 From: e020873 Date: Tue, 13 Jun 2017 01:50:09 +0200 Subject: [PATCH 215/286] [request] fix for Typescript 2.4 --- types/request/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/request/index.d.ts b/types/request/index.d.ts index d27e2e89ed..97a58531c5 100644 --- a/types/request/index.d.ts +++ b/types/request/index.d.ts @@ -131,8 +131,8 @@ declare namespace request { export type RequiredUriUrl = UriOptions | UrlOptions; interface OptionalUriUrl { - uri?: string; - url?: string; + uri?: string | Url; + url?: string | Url; } export type OptionsWithUri = UriOptions & CoreOptions; From d2af6a8f5a937f3764eacee4f01f1f4c54ff60d0 Mon Sep 17 00:00:00 2001 From: Yui T Date: Mon, 12 Jun 2017 17:17:49 -0700 Subject: [PATCH 216/286] Add Type annotation to tests --- .../cordova-plugin-battery-status-tests.ts | 2 ++ .../cordova-plugin-inappbrowser-tests.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts b/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts index e0433bf89b..bc2d516697 100644 --- a/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts +++ b/types/cordova-plugin-battery-status/cordova-plugin-battery-status-tests.ts @@ -1,7 +1,9 @@ +window.addEventListener('batterystatus', (ev: BatteryStatusEvent) => { console.log('Battery level is ' + ev.level); }); window.addEventListener('batterystatus', (ev) => { console.log('Battery level is ' + ev.level); }); window.addEventListener('batterycritical', (ev) => { console.log('Battery is critical: ' + ev.level); }); window.addEventListener('batterylow', (ev) => { console.log('Battery is low: ' + ev.level); }); +window.removeEventListener('batterystatus', (ev: BatteryStatusEvent) => { console.log('Remove: Battery level is ' + ev.level); }); window.removeEventListener('batterystatus', (ev) => { console.log('Remove: Battery level is ' + ev.level); }); window.removeEventListener('batterycritical', (ev) => { console.log('Remove: Battery is critical: ' + ev.level); }); window.removeEventListener('batterylow', (ev) => { console.log('Remove: Battery is low: ' + ev.level); }); diff --git a/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts b/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts index d381f52375..12914e4110 100644 --- a/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts +++ b/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts @@ -5,11 +5,13 @@ // is similar to native window.open signature, so the compiler can's // select proper overload, but we cast result to InAppBrowser manually. var iab = window.open('google.com', '_self'); +iab.addEventListener('loadstart', (ev: InAppBrowserEvent) => { console.log('Start opening ' + ev.url); }); iab.addEventListener('loadstart', (ev) => { console.log('loadstart' + ev.url); }); iab.addEventListener('loadstop', (ev) => { console.log('loadstop' + ev.code); }); iab.addEventListener('loaderror', (ev) => { console.log('loaderror' + ev.code); }); iab.addEventListener('exit', (ev) => { console.log('exit' + ev.code); }); +iab.removeEventListener('loadstart', (ev: InAppBrowserEvent) => { console.log('Remove loadstart' + ev.url); }); iab.removeEventListener('loadstart', (ev) => { console.log('Remove loadstart' + ev.url); }); iab.removeEventListener('loadstop', (ev) => { console.log('Remove loadstop ' + ev.code); }); iab.removeEventListener('loaderror', (ev) => { console.log('Remove loaderror ' + ev.code); }); From eb27ec80abcab66fbe3e3fd6ecec15b05736558f Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Tue, 13 Jun 2017 01:56:39 -0300 Subject: [PATCH 217/286] [ofe] Add type declaration file --- types/ofe/index.d.ts | 6 ++++++ types/ofe/ofe-tests.ts | 8 ++++++++ types/ofe/tsconfig.json | 22 ++++++++++++++++++++++ types/ofe/tslint.json | 3 +++ 4 files changed, 39 insertions(+) create mode 100644 types/ofe/index.d.ts create mode 100644 types/ofe/ofe-tests.ts create mode 100644 types/ofe/tsconfig.json create mode 100644 types/ofe/tslint.json diff --git a/types/ofe/index.d.ts b/types/ofe/index.d.ts new file mode 100644 index 0000000000..663bc0510c --- /dev/null +++ b/types/ofe/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for ofe 0.5 +// Project: https://github.com/trevnorris/node-ofe +// Definitions by: Ben Davies +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function call(): 'done'; diff --git a/types/ofe/ofe-tests.ts b/types/ofe/ofe-tests.ts new file mode 100644 index 0000000000..002aecba23 --- /dev/null +++ b/types/ofe/ofe-tests.ts @@ -0,0 +1,8 @@ +/// + +import * as ofe from 'ofe'; + +let ret = ofe.call(); +if (ret === 'done') { + console.log('The ofe module was successfully called to create a heapdump if the process runs out of memory.'); +} diff --git a/types/ofe/tsconfig.json b/types/ofe/tsconfig.json new file mode 100644 index 0000000000..9c1f9c174a --- /dev/null +++ b/types/ofe/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", + "ofe-tests.ts" + ] +} diff --git a/types/ofe/tslint.json b/types/ofe/tslint.json new file mode 100644 index 0000000000..b4b47a0378 --- /dev/null +++ b/types/ofe/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From fc7026e3bfa90ac77aafe5909b90705427c026ff Mon Sep 17 00:00:00 2001 From: Ben Davies Date: Mon, 12 Jun 2017 23:20:53 -0300 Subject: [PATCH 218/286] [node-static] Add type declaration file --- types/node-static/index.d.ts | 56 ++++++++++++++++++++++++++ types/node-static/node-static-tests.ts | 7 ++++ types/node-static/tsconfig.json | 19 +++++++++ types/node-static/tslint.json | 3 ++ 4 files changed, 85 insertions(+) create mode 100644 types/node-static/index.d.ts create mode 100644 types/node-static/node-static-tests.ts create mode 100644 types/node-static/tsconfig.json create mode 100644 types/node-static/tslint.json diff --git a/types/node-static/index.d.ts b/types/node-static/index.d.ts new file mode 100644 index 0000000000..23e5ba1f87 --- /dev/null +++ b/types/node-static/index.d.ts @@ -0,0 +1,56 @@ +// Type definitions for node-static 0.7 +// Project: https://github.com/cloudhead/node-static +// Definitions by: Ben Davies +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as events from 'events'; +import * as fs from 'fs'; +import * as http from 'http'; +import * as mime from 'mime'; + +export interface Headers { [k: string]: any; } +export type Finish = (status: number, headers?: Headers) => void; +export type Callback = (e: Error) => void; + +export interface Options { + headers?: Headers; + indexFile?: string; + cache?: number | boolean; + serverInfo?: Buffer; + server?: string; + "cache-control"?: string; +} + +export interface ByteRange { + from: number; + to: number; + valid: boolean; +} + +export class Server { + root: string; + options: Options; + cache: number | boolean; + defaultHeaders: Headers; + serverInfo: string; + constructor(root: string, options?: Options); + + serveDir: (pathname: string, req: http.ServerRequest, res: http.ServerResponse, finish: Finish) => void; + serveFile: (pathname: string, status: number, headers: Headers, req: http.ServerRequest, res: http.ServerResponse) => events.EventEmitter; + finish: (status: number, headers: Headers, req: http.ServerRequest, res: http.ServerResponse, promise: events.EventEmitter, callback: Callback) => void; + servePath: (pathname: string, status: number, headers: Headers, req: http.ServerRequest, res: http.ServerResponse, finish: Finish) => events.EventEmitter; + resolve: (pathname: string) => string; + serve: (req: http.ServerRequest, res: http.ServerResponse, callback: Callback) => events.EventEmitter; + gzipOk: (req: http.ServerRequest, contentType: string) => boolean; + respondGzip: (pathname: string, status: number, contentType: string, _headers: Headers, files: string[], stat: fs.Stats, req: http.ServerRequest, res: http.ServerResponse, finish: Finish) => void; + parseByteRange: (req: http.ServerRequest, stat: fs.Stats) => ByteRange; + // tslint:disable-next-line max-line-length + respondNoGzip: (pathname: string, status: number, contentType: string, _headers: Headers, files: string[], stat: fs.Stats, req: http.ServerRequest, res: http.ServerResponse, finish: Finish) => void; + respond: (pathname: string, status: number, _headers: Headers, files: string[], stat: fs.Stats, req: http.ServerRequest, res: http.ServerResponse, finish: Finish) => void; + stream: (pathname: string, files: string[], length: number, startByte: number, res: http.ServerResponse, callback: Callback) => void; +} + +export const version: [number, number, number]; +export {mime}; diff --git a/types/node-static/node-static-tests.ts b/types/node-static/node-static-tests.ts new file mode 100644 index 0000000000..4bf2673ab4 --- /dev/null +++ b/types/node-static/node-static-tests.ts @@ -0,0 +1,7 @@ +import {Server, version, mime} from 'node-static'; + +let server = new Server(__dirname); +let pathname = server.resolve('./tsconfig.json'); +let mimetype = mime.lookup(pathname); +let versionNum = version.join('.'); +console.log(`The node-static server constructed an instance of itself, fetched the mimetype of ${pathname} (${mimetype}), and has a version of ${versionNum}! The package is working.`); diff --git a/types/node-static/tsconfig.json b/types/node-static/tsconfig.json new file mode 100644 index 0000000000..e857fac482 --- /dev/null +++ b/types/node-static/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "node-static-tests.ts" + ] +} diff --git a/types/node-static/tslint.json b/types/node-static/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/node-static/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 58875cb0cd86570e684e196f5e05e1cb8d467887 Mon Sep 17 00:00:00 2001 From: afractal Date: Tue, 13 Jun 2017 12:14:28 +0200 Subject: [PATCH 219/286] update sharp-timer types to be more strict --- types/sharp-timer/sharp-timer-tests.ts | 1 - types/sharp-timer/tsconfig.json | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/types/sharp-timer/sharp-timer-tests.ts b/types/sharp-timer/sharp-timer-tests.ts index 685bf1b1d9..5d8976e474 100644 --- a/types/sharp-timer/sharp-timer-tests.ts +++ b/types/sharp-timer/sharp-timer-tests.ts @@ -5,7 +5,6 @@ let timer = new Timer(10); timer.onIntervalElapsing(i => { }); timer.onIntervalElapsed(() => { timer.stop(); - timer = null; }); timer.start(); diff --git a/types/sharp-timer/tsconfig.json b/types/sharp-timer/tsconfig.json index 3306511dec..ffaeaf9685 100644 --- a/types/sharp-timer/tsconfig.json +++ b/types/sharp-timer/tsconfig.json @@ -5,8 +5,8 @@ "es6" ], "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, + "noImplicitThis": true, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From b2368b04db607eddf965c2bcb52dac9a8a05bb9f Mon Sep 17 00:00:00 2001 From: Pascal Brokmeier Date: Tue, 13 Jun 2017 13:58:06 +0200 Subject: [PATCH 220/286] fix(alexa-sdk): updated lint rules --- types/alexa-sdk/tslint.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/types/alexa-sdk/tslint.json b/types/alexa-sdk/tslint.json index 3db14f85ea..0c1ca3b5b4 100644 --- a/types/alexa-sdk/tslint.json +++ b/types/alexa-sdk/tslint.json @@ -1 +1,9 @@ -{ "extends": "dtslint/dt.json" } +{ "extends": "dtslint/dt.json", + "rules": { + "object-literal-shorthand": false, + "object-literal-key-quote": false, + "no-empty-interface": false, + "prefer-method-signature": false, + "object-literal-key-quotes": false + } +} From eb7cfc536a90c8bbf0274d255b31f9b796fb15f1 Mon Sep 17 00:00:00 2001 From: Parvez Date: Tue, 13 Jun 2017 08:12:21 -0700 Subject: [PATCH 221/286] Added a missing type on Question interface (#17094) --- types/inquirer/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/inquirer/index.d.ts b/types/inquirer/index.d.ts index dd2f4ad3c7..2a0b9f60f4 100644 --- a/types/inquirer/index.d.ts +++ b/types/inquirer/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Inquirer.js // Project: https://github.com/SBoudrias/Inquirer.js // Definitions by: Qubo +// Parvez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -110,6 +111,10 @@ declare namespace inquirer { * Change the number of lines that will be rendered when using list, rawList, expand or checkbox. */ pageSize?: number; + /** + * Add a mask when password will entered + */ + mask?: string; } /** From 6a556da667ad5eac21c171c50d26bd81c75a99a5 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Tue, 13 Jun 2017 11:49:07 -0400 Subject: [PATCH 222/286] [jquery] Update type definitions (new for v3). --- types/jquery/index.d.ts | 8082 +++++++++++++++------------ types/jquery/jquery-tests.ts | 3614 +----------- types/jquery/test/example-tests.ts | 5003 +++++++++++++++++ types/jquery/test/longdesc-tests.ts | 2524 +++++++++ types/jquery/test/module-tests.ts | 7 + types/jquery/tsconfig.json | 14 +- types/jquery/tslint.json | 9 + types/jquery/v1/index.d.ts | 3817 +++++++++++++ types/jquery/v1/jquery-tests.ts | 3552 ++++++++++++ types/jquery/v1/tsconfig.json | 28 + types/jquery/v2/index.d.ts | 3817 +++++++++++++ types/jquery/v2/jquery-tests.ts | 3552 ++++++++++++ types/jquery/v2/tsconfig.json | 28 + 13 files changed, 26886 insertions(+), 7161 deletions(-) create mode 100644 types/jquery/test/example-tests.ts create mode 100644 types/jquery/test/longdesc-tests.ts create mode 100644 types/jquery/test/module-tests.ts create mode 100644 types/jquery/tslint.json create mode 100644 types/jquery/v1/index.d.ts create mode 100644 types/jquery/v1/jquery-tests.ts create mode 100644 types/jquery/v1/tsconfig.json create mode 100644 types/jquery/v2/index.d.ts create mode 100644 types/jquery/v2/jquery-tests.ts create mode 100644 types/jquery/v2/tsconfig.json diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index a8b2895d6b..89d8b873fa 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -1,513 +1,4470 @@ -// Type definitions for jQuery 2.0 -// Project: http://jquery.com/ -// Definitions by: Boris Yankov -// Christian Hoffmeister -// Steve Fenton -// Diullei Gomes -// Tass Iliopoulos -// Jason Swearingen -// Sean Hill -// Guus Goossens -// Kelly Summerlin -// Basarat Ali Syed -// Nicholas Wolverson -// Derek Cicerone -// Andrew Gaspar -// Seikichi Kondo -// Benjamin Jackman -// Poul Sorensen -// Josh Strobl -// John Reilly -// Dick van den Brink -// Thomas Schulz -// Leonard Thieu +// Type definitions for jquery 3.2 +// Project: https://jquery.com +// Definitions by: Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -/* ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - - -/** - * Interface for the AJAX setting that will configure the AJAX request - * @see {@link https://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings} - */ -interface JQueryAjaxSettings { - /** - * The content type sent in the request header that tells the server what kind of response it will accept in return. If the accepts setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. - */ - accepts?: any; - /** - * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done() or the deprecated jqXHR.success(). - */ - async?: boolean; - /** - * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request. - */ - beforeSend? (jqXHR: JQueryXHR, settings: JQueryAjaxSettings): any; - /** - * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET. - */ - cache?: boolean; - /** - * A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. - */ - complete? (jqXHR: JQueryXHR, textStatus: string): any; - /** - * An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type. (version added: 1.5) - */ - contents?: { [key: string]: any; }; - //According to jQuery.ajax source code, ajax's option actually allows contentType to set to "false" - // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/742 - /** - * When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding. - */ - contentType?: any; - /** - * This object will be made the context of all Ajax-related callbacks. By default, the context is an object that represents the ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax). - */ - context?: any; - /** - * An object containing dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response. (version added: 1.5) - */ - converters?: { [key: string]: any; }; - /** - * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain. (version added: 1.5) - */ - crossDomain?: boolean; - /** - * Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be key-value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below). - */ - data?: any; - /** - * A function to be used to handle the raw response data of XMLHttpRequest.This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter. - */ - dataFilter? (data: any, ty: any): any; - /** - * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). - */ - dataType?: string; - /** - * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. - */ - error? (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any; - /** - * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events. - */ - global?: boolean; - /** - * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest is always added, but its default XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from within the beforeSend function. (version added: 1.5) - */ - headers?: { [key: string]: any; }; - /** - * Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data. - */ - ifModified?: boolean; - /** - * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method. (version added: 1.5.1) - */ - isLocal?: boolean; - /** - * Override the callback function name in a jsonp request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" } - */ - jsonp?: any; - /** - * Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function. - */ - jsonpCallback?: any; - /** - * The HTTP method to use for the request (e.g. "POST", "GET", "PUT"). (version added: 1.9.0) - */ - method?: string; - /** - * A MIME type to override the XHR MIME type. (version added: 1.5.1) - */ - mimeType?: string; - /** - * A password to be used with XMLHttpRequest in response to an HTTP access authentication request. - */ - password?: string; - /** - * By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false. - */ - processData?: boolean; - /** - * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script. - */ - scriptCharset?: string; - /** - * An object of numeric HTTP codes and functions to be called when the response has the corresponding code. f the request is successful, the status code functions take the same parameters as the success callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback. (version added: 1.5) - */ - statusCode?: { [key: string]: any; }; - /** - * A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event. - */ - success? (data: any, textStatus: string, jqXHR: JQueryXHR): any; - /** - * Set a timeout (in milliseconds) for the request. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period. - */ - timeout?: number; - /** - * Set this to true if you wish to use the traditional style of parameter serialization. - */ - traditional?: boolean; - /** - * The type of request to make ("POST" or "GET"), default is "GET". Note: Other HTTP request methods, such as PUT and DELETE, can also be used here, but they are not supported by all browsers. - */ - type?: string; - /** - * A string containing the URL to which the request is sent. - */ - url?: string; - /** - * A username to be used with XMLHttpRequest in response to an HTTP access authentication request. - */ - username?: string; - /** - * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or enhancements to the factory. - */ - xhr?: any; - /** - * An object of fieldName-fieldValue pairs to set on the native XHR object. For example, you can use it to set withCredentials to true for cross-domain requests if needed. In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ should you require the use of it. (version added: 1.5.1) - */ - xhrFields?: { [key: string]: any; }; +declare module 'jquery' { + export = factory; } -/** - * Interface for the jqXHR object - * @see {@link https://api.jquery.com/jQuery.ajax/#jqXHR} - */ -interface JQueryXHR extends XMLHttpRequest, JQueryPromise { - /** - * The .overrideMimeType() method may be used in the beforeSend() callback function, for example, to modify the response content-type header. As of jQuery 1.5.1, the jqXHR object also contains the overrideMimeType() method (it was available in jQuery 1.4.x, as well, but was temporarily removed in jQuery 1.5). - */ - overrideMimeType(mimeType: string): any; - /** - * Cancel the request. - * - * @param statusText A string passed as the textStatus parameter for the done callback. Default value: "canceled" - */ - abort(statusText?: string): void; - /** - * Incorporates the functionality of the .done() and .fail() methods, allowing (as of jQuery 1.8) the underlying Promise to be manipulated. Refer to deferred.then() for implementation details. - */ - then(doneCallback: (data: any, textStatus: string, jqXHR: JQueryXHR) => R|JQueryPromise, failCallback?: (jqXHR: JQueryXHR, textStatus: string, errorThrown: any) => void): JQueryPromise; - /** - * Property containing the parsed response if the response content type is json - */ - responseJSON?: any; - /** - * A function to be called if the request fails. - */ - error(xhr: JQueryXHR, textStatus: string, errorThrown: string): void; +declare module 'jquery/dist/jquery.slim' { + export = factory; } -/** - * Interface for the JQuery callback - * @see {@link https://api.jquery.com/category/callbacks-object/} - */ -interface JQueryCallback { +declare function factory(window: Window, noGlobal?: boolean): JQueryStatic; + +declare const jQuery: JQueryStatic; +declare const $: JQueryStatic; + +// Used by JQuery.Event +type _Event = Event; + +interface JQuery { /** - * Add a callback or a collection of callbacks to a callback list. + * A string containing the jQuery version number. * - * @param callbacks A function, or array of functions, that are to be added to the callback list. - * @see {@link https://api.jquery.com/callbacks.add/} + * @see {@link https://api.jquery.com/jquery/} + * @since 1.0 */ - add(callbacks: Function): JQueryCallback; + jquery: string; /** - * Add a callback or a collection of callbacks to a callback list. + * The number of elements in the jQuery object. * - * @param callbacks A function, or array of functions, that are to be added to the callback list. - * @see {@link https://api.jquery.com/callbacks.add/} + * @see {@link https://api.jquery.com/length/} + * @since 1.0 */ - add(callbacks: Function[]): JQueryCallback; - + length: number; /** - * Disable a callback list from doing anything more. - * @see {@link https://api.jquery.com/callbacks.disable/} - */ - disable(): JQueryCallback; - - /** - * Determine if the callbacks list has been disabled. - * @see {@link https://api.jquery.com/callbacks.disabled/} - */ - disabled(): boolean; - - /** - * Remove all of the callbacks from a list. - * @see {@link https://api.jquery.com/callbacks.empty/} - */ - empty(): JQueryCallback; - - /** - * Call all of the callbacks with the given arguments + * Create a new jQuery object with elements added to the set of matched elements. * - * @param arguments The argument or list of arguments to pass back to the callback list. - * @see {@link https://api.jquery.com/callbacks.fire/} + * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. + * @param context The point in the document at which the selector should begin matching; similar to the context + * argument of the $(selector, context) method. + * @see {@link https://api.jquery.com/add/} + * @since 1.4 */ - fire(...arguments: any[]): JQueryCallback; - + add(selector: JQuery.Selector, context: Element): JQuery; /** - * Determine if the callbacks have already been called at least once. - * @see {@link https://api.jquery.com/callbacks.fired/} - */ - fired(): boolean; - - /** - * Call all callbacks in a list with the given context and arguments. + * Create a new jQuery object with elements added to the set of matched elements. * - * @param context A reference to the context in which the callbacks in the list should be fired. - * @param arguments An argument, or array of arguments, to pass to the callbacks in the list. - * @see {@link https://api.jquery.com/callbacks.fireWith/} + * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. + * One or more elements to add to the set of matched elements. + * An HTML fragment to add to the set of matched elements. + * An existing jQuery object to add to the set of matched elements. + * @see {@link https://api.jquery.com/add/} + * @since 1.0 + * @since 1.3.2 */ - fireWith(context?: any, args?: any[]): JQueryCallback; - + add(selector: JQuery.Selector | JQuery.TypeOrArray | JQuery.htmlString | JQuery): JQuery; /** - * Determine whether a supplied callback is in a list + * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. * - * @param callback The callback to search for. - * @see {@link https://api.jquery.com/callbacks.has/} + * @param selector A string containing a selector expression to match the current set of elements against. + * @see {@link https://api.jquery.com/addBack/} + * @since 1.8 */ - has(callback: Function): boolean; - + addBack(selector?: JQuery.Selector): this; /** - * Lock a callback list in its current state. - * @see {@link https://api.jquery.com/callbacks.lock/} - */ - lock(): JQueryCallback; - - /** - * Determine if the callbacks list has been locked. - * @see {@link https://api.jquery.com/callbacks.locked/} - */ - locked(): boolean; - - /** - * Remove a callback or a collection of callbacks from a callback list. + * Adds the specified class(es) to each element in the set of matched elements. * - * @param callbacks A function, or array of functions, that are to be removed from the callback list. - * @see {@link https://api.jquery.com/callbacks.remove/} + * @param className One or more space-separated classes to be added to the class attribute of each matched element. + * A function returning one or more space-separated class names to be added to the existing class + * name(s). Receives the index position of the element in the set and the existing class name(s) as + * arguments. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/addClass/} + * @since 1.0 + * @since 1.4 */ - remove(callbacks: Function): JQueryCallback; + addClass(className: string | ((this: TElement, index: number, currentClassName: string) => string)): this; /** - * Remove a callback or a collection of callbacks from a callback list. + * Insert content, specified by the parameter, after each element in the set of matched elements. * - * @param callbacks A function, or array of functions, that are to be removed from the callback list. - * @see {@link https://api.jquery.com/callbacks.remove/} + * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or + * jQuery objects to insert after each element in the set of matched elements. + * @see {@link https://api.jquery.com/after/} + * @since 1.0 */ - remove(callbacks: Function[]): JQueryCallback; + after(...contents: Array | JQuery>): this; + /** + * Insert content, specified by the parameter, after each element in the set of matched elements. + * + * @param fn A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert + * after each element in the set of matched elements. Receives the index position of the element in the + * set and the old HTML value of the element as arguments. Within the function, this refers to the + * current element in the set. + * @see {@link https://api.jquery.com/after/} + * @since 1.4 + * @since 1.10 + */ + after(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Register a handler to be called when Ajax requests complete. This is an AjaxEvent. + * + * @param handler The function to be invoked. + * @see {@link https://api.jquery.com/ajaxComplete/} + * @since 1.0 + */ + ajaxComplete(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this; + /** + * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. + * + * @param handler The function to be invoked. + * @see {@link https://api.jquery.com/ajaxError/} + * @since 1.0 + */ + ajaxError(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxSettings: JQuery.AjaxSettings, thrownError: string) => void | false): this; + /** + * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. + * + * @param handler The function to be invoked. + * @see {@link https://api.jquery.com/ajaxSend/} + * @since 1.0 + */ + ajaxSend(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings) => void | false): this; + /** + * Register a handler to be called when the first Ajax request begins. This is an Ajax Event. + * + * @param handler The function to be invoked. + * @see {@link https://api.jquery.com/ajaxStart/} + * @since 1.0 + */ + ajaxStart(handler: (this: Document) => void | false): this; + /** + * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. + * + * @param handler The function to be invoked. + * @see {@link https://api.jquery.com/ajaxStop/} + * @since 1.0 + */ + ajaxStop(handler: (this: Document) => void | false): this; + /** + * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. + * + * @param handler The function to be invoked. + * @see {@link https://api.jquery.com/ajaxSuccess/} + * @since 1.0 + */ + ajaxSuccess(handler: (this: Document, event: JQuery.Event, jqXHR: JQuery.jqXHR, ajaxOptions: JQuery.AjaxSettings, data: JQuery.PlainObject) => void | false): this; + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/animate/} + * @since 1.0 + */ + animate(properties: JQuery.PlainObject, + duration: JQuery.Duration, + easing: string, + complete?: (this: TElement) => void): this; + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @param duration_easing A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/animate/} + * @since 1.0 + */ + animate(properties: JQuery.PlainObject, + duration_easing: JQuery.Duration | string, + complete?: (this: TElement) => void): this; + /** + * Perform a custom animation of a set of CSS properties. + * + * @param properties An object of CSS properties and values that the animation will move toward. + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * A function to call once the animation is complete, called once per matched element. + * A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/animate/} + * @since 1.0 + */ + animate(properties: JQuery.PlainObject, + duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Insert content, specified by the parameter, to the end of each element in the set of matched elements. + * + * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or + * jQuery objects to insert at the end of each element in the set of matched elements. + * @see {@link https://api.jquery.com/append/} + * @since 1.0 + */ + append(...contents: Array | JQuery>): this; + /** + * Insert content, specified by the parameter, to the end of each element in the set of matched elements. + * + * @param fn A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert at + * the end of each element in the set of matched elements. Receives the index position of the element + * in the set and the old HTML value of the element as arguments. Within the function, this refers to + * the current element in the set. + * @see {@link https://api.jquery.com/append/} + * @since 1.4 + */ + append(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Insert every element in the set of matched elements to the end of the target. + * + * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements + * will be inserted at the end of the element(s) specified by this parameter. + * @see {@link https://api.jquery.com/appendTo/} + * @since 1.0 + */ + appendTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributeName The name of the attribute to set. + * @param value A value to set for the attribute. If null, the specified attribute will be removed (as in .removeAttr()). + * A function returning the value to set. this is the current element. Receives the index position of + * the element in the set and the old attribute value as arguments. + * @see {@link https://api.jquery.com/attr/} + * @since 1.0 + * @since 1.1 + */ + attr(attributeName: string, + value: string | number | null | ((this: TElement, index: number, attr: string) => string | number | void | undefined)): this; + /** + * Set one or more attributes for the set of matched elements. + * + * @param attributes An object of attribute-value pairs to set. + * @see {@link https://api.jquery.com/attr/} + * @since 1.0 + */ + attr(attributes: JQuery.PlainObject): this; + /** + * Get the value of an attribute for the first element in the set of matched elements. + * + * @param attributeName The name of the attribute to get. + * @see {@link https://api.jquery.com/attr/} + * @since 1.0 + */ + attr(attributeName: string): string | undefined; + /** + * Insert content, specified by the parameter, before each element in the set of matched elements. + * + * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or + * jQuery objects to insert before each element in the set of matched elements. + * @see {@link https://api.jquery.com/before/} + * @since 1.0 + */ + before(...contents: Array | JQuery>): this; + /** + * Insert content, specified by the parameter, before each element in the set of matched elements. + * + * @param fn A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert + * before each element in the set of matched elements. Receives the index position of the element in + * the set and the old HTML value of the element as arguments. Within the function, this refers to the + * current element in the set. + * @see {@link https://api.jquery.com/before/} + * @since 1.4 + * @since 1.10 + */ + before(fn: (this: TElement, index: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/bind/} + * @since 1.0 + * @deprecated 3.0 + */ + bind(eventType: string, eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param eventData An object containing data that will be passed to the event handler. + * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from + * occurring and stops the event from bubbling. The default is true. + * @see {@link https://api.jquery.com/bind/} + * @since 1.4.3 + * @deprecated 3.0 + */ + bind(eventType: string, eventData: any, preventBubble: boolean): this; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/bind/} + * @since 1.0 + * @deprecated 3.0 + */ + bind(eventType: string, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to an event for the elements. + * + * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param preventBubble_eventData Setting the third argument to false will attach a function that prevents the default action from + * occurring and stops the event from bubbling. The default is true. + * An object containing data that will be passed to the event handler. + * @see {@link https://api.jquery.com/bind/} + * @since 1.0 + * @deprecated 3.0 + */ + bind(eventType: string, preventBubble_eventData?: boolean | any): this; + /** + * Attach a handler to an event for the elements. + * + * @param events An object containing one or more DOM event types and functions to execute for them. + * @see {@link https://api.jquery.com/bind/} + * @since 1.4 + * @deprecated 3.0 + */ + bind(events: JQuery.PlainObject | false>): this; + /** + * Bind an event handler to the "blur" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/blur/} + * @since 1.4.3 + */ + blur(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "blur" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/blur/} + * @since 1.0 + */ + blur(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "change" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/change/} + * @since 1.4.3 + */ + change(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "change" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/change/} + * @since 1.0 + */ + change(handler?: JQuery.EventHandler | false): this; + /** + * Get the children of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/children/} + * @since 1.0 + */ + children(selector?: JQuery.Selector): this; + /** + * Remove from the queue all items that have not yet been run. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see {@link https://api.jquery.com/clearQueue/} + * @since 1.4 + */ + clearQueue(queueName?: string): this; + /** + * Bind an event handler to the "click" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/click/} + * @since 1.4.3 + */ + click(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "click" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/click/} + * @since 1.0 + */ + click(handler?: JQuery.EventHandler | false): this; + /** + * Create a deep copy of the set of matched elements. + * + * @param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The + * default value is false. *In jQuery 1.5.0 the default value was incorrectly true; it was changed back + * to false in 1.5.1 and up. + * @param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should + * be copied. By default its value matches the first argument's value (which defaults to false). + * @see {@link https://api.jquery.com/clone/} + * @since 1.0 + * @since 1.5 + */ + clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): this; + /** + * For each element in the set, get the first element that matches the selector by testing the element + * itself and traversing up through its ancestors in the DOM tree. + * + * @param selector A string containing a selector expression to match elements against. + * @param context A DOM element within which a matching element may be found. + * @see {@link https://api.jquery.com/closest/} + * @since 1.4 + */ + closest(selector: JQuery.Selector, context: Element): this; + /** + * For each element in the set, get the first element that matches the selector by testing the element + * itself and traversing up through its ancestors in the DOM tree. + * + * @param selector A string containing a selector expression to match elements against. + * A jQuery object to match elements against. + * An element to match elements against. + * @see {@link https://api.jquery.com/closest/} + * @since 1.3 + * @since 1.6 + */ + closest(selector: JQuery.Selector | JQuery | Element): this; + /** + * Get the children of each element in the set of matched elements, including text and comment nodes. + * + * @see {@link https://api.jquery.com/contents/} + * @since 1.2 + */ + contents(): this; + /** + * 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. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/contextmenu/} + * @since 1.4.3 + */ + contextmenu(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "contextmenu" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/contextmenu/} + * @since 1.0 + */ + contextmenu(handler?: JQuery.EventHandler | false): this; + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param propertyName A CSS property name. + * @param value A value to set for the property. + * A function returning the value to set. this is the current element. Receives the index position of + * the element in the set and the old value as arguments. + * @see {@link https://api.jquery.com/css/} + * @since 1.0 + * @since 1.4 + */ + css(propertyName: string, + value: string | number | ((this: TElement, index: number, value: string) => string | number | void | undefined)): this; + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param properties An object of property-value pairs to set. + * @see {@link https://api.jquery.com/css/} + * @since 1.0 + */ + css(properties: JQuery.PlainObject string | number | void | undefined)>): this; + /** + * Get the computed style properties for the first element in the set of matched elements. + * + * @param propertyName A CSS property. + * An array of one or more CSS properties. + * @see {@link https://api.jquery.com/css/} + * @since 1.0 + */ + css(propertyName: string): string; + /** + * Get the computed style properties for the first element in the set of matched elements. + * + * @param propertyNames An array of one or more CSS properties. + * @see {@link https://api.jquery.com/css/} + * @since 1.9 + */ + css(propertyNames: string[]): JQuery.PlainObject; + /** + * Return the value at the named data store for the first element in the jQuery collection, as set by + * data(name, value) or by an HTML5 data-* attribute. + * + * @param key Name of the data stored. + * @param undefined + * @see {@link https://api.jquery.com/data/} + * @since 1.2.3 + */ + // tslint:disable-next-line:unified-signatures + data(key: string, undefined: undefined): any; + /** + * Store arbitrary data associated with the matched elements. + * + * @param key A string naming the piece of data to set. + * @param value The new data value; this can be any Javascript type except undefined. + * @see {@link https://api.jquery.com/data/} + * @since 1.2.3 + */ + data(key: string, value: any): this; + /** + * Store arbitrary data associated with the matched elements. + * + * @param obj An object of key-value pairs of data to update. + * @see {@link https://api.jquery.com/data/} + * @since 1.4.3 + */ + data(obj: JQuery.PlainObject): this; + /** + * Return the value at the named data store for the first element in the jQuery collection, as set by + * data(name, value) or by an HTML5 data-* attribute. + * + * @param key Name of the data stored. + * @see {@link https://api.jquery.com/data/} + * @since 1.2.3 + */ + data(key: string): any; + /** + * Return the value at the named data store for the first element in the jQuery collection, as set by + * data(name, value) or by an HTML5 data-* attribute. + * + * @see {@link https://api.jquery.com/data/} + * @since 1.4 + */ + data(): JQuery.PlainObject; + /** + * Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/dblclick/} + * @since 1.4.3 + */ + dblclick(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/dblclick/} + * @since 1.0 + */ + dblclick(handler?: JQuery.EventHandler | false): this; + /** + * Set a timer to delay execution of subsequent items in the queue. + * + * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see {@link https://api.jquery.com/delay/} + * @since 1.4 + */ + delay(duration: JQuery.Duration, queueName?: string): this; + /** + * Attach a handler to one or more events for all elements that match the selector, now or in the + * future, based on a specific set of root elements. + * + * @param selector A selector to filter the elements that trigger the event. + * @param eventType A string containing one or more space-separated JavaScript event types, such as "click" or + * "keydown," or custom event names. + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/delegate/} + * @since 1.4.2 + * @deprecated 3.0 + */ + delegate(selector: string, eventType: string, eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to one or more events for all elements that match the selector, now or in the + * future, based on a specific set of root elements. + * + * @param selector A selector to filter the elements that trigger the event. + * @param eventType A string containing one or more space-separated JavaScript event types, such as "click" or + * "keydown," or custom event names. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/delegate/} + * @since 1.4.2 + * @deprecated 3.0 + */ + delegate(selector: string, eventType: string, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to one or more events for all elements that match the selector, now or in the + * future, based on a specific set of root elements. + * + * @param selector A selector to filter the elements that trigger the event. + * @param events A plain object of one or more event types and functions to execute for them. + * @see {@link https://api.jquery.com/delegate/} + * @since 1.4.3 + * @deprecated 3.0 + */ + delegate(selector: string, events: JQuery.PlainObject | false>): this; + /** + * Execute the next function on the queue for the matched elements. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see {@link https://api.jquery.com/dequeue/} + * @since 1.2 + */ + dequeue(queueName?: string): this; + /** + * Remove the set of matched elements from the DOM. + * + * @param selector A selector expression that filters the set of matched elements to be removed. + * @see {@link https://api.jquery.com/detach/} + * @since 1.4 + */ + detach(selector?: JQuery.Selector): this; + /** + * Iterate over a jQuery object, executing a function for each matched element. + * + * @param fn A function to execute for each matched element. + * @see {@link https://api.jquery.com/each/} + * @since 1.0 + */ + each(fn: (this: TElement, index: number, element: Element) => void | false): this; + /** + * Remove all child nodes of the set of matched elements from the DOM. + * + * @see {@link https://api.jquery.com/empty/} + * @since 1.0 + */ + empty(): this; + /** + * End the most recent filtering operation in the current chain and return the set of matched elements + * to its previous state. + * + * @see {@link https://api.jquery.com/end/} + * @since 1.0 + */ + end(): this; + /** + * Reduce the set of matched elements to the one at the specified index. + * + * @param index An integer indicating the 0-based position of the element. + * @see {@link https://api.jquery.com/eq/} + * @since 1.1.2 + */ + eq(index: number): this; + /** + * Reduce the set of matched elements to the one at the specified index. + * + * @param indexFromEnd An integer indicating the position of the element, counting backwards from the last element in the set. + * @see {@link https://api.jquery.com/eq/} + * @since 1.4 + */ + eq(indexFromEnd: number): this; + /** + * Merge the contents of an object onto the jQuery prototype to provide new jQuery instance methods. + * + * @param obj An object to merge onto the jQuery prototype. + * @see {@link https://api.jquery.com/jQuery.fn.extend/} + * @since 1.0 + */ + extend(obj: object): JQuery; + /** + * Display the matched elements by fading them to opaque. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/fadeIn/} + * @since 1.4.3 + */ + fadeIn(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display the matched elements by fading them to opaque. + * + * @param duration_easing A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/fadeIn/} + * @since 1.0 + * @since 1.4.3 + */ + fadeIn(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this; + /** + * Display the matched elements by fading them to opaque. + * + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * A function to call once the animation is complete, called once per matched element. + * A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/fadeIn/} + * @since 1.0 + * @since 1.4.3 + */ + fadeIn(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Hide the matched elements by fading them to transparent. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/fadeOut/} + * @since 1.4.3 + */ + fadeOut(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Hide the matched elements by fading them to transparent. + * + * @param duration_easing A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/fadeOut/} + * @since 1.0 + * @since 1.4.3 + */ + fadeOut(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this; + /** + * Hide the matched elements by fading them to transparent. + * + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * A function to call once the animation is complete, called once per matched element. + * A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/fadeOut/} + * @since 1.0 + * @since 1.4.3 + */ + fadeOut(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Adjust the opacity of the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param opacity A number between 0 and 1 denoting the target opacity. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/fadeTo/} + * @since 1.4.3 + */ + fadeTo(duration: JQuery.Duration, opacity: number, easing: string, complete?: (this: TElement) => void): this; + /** + * Adjust the opacity of the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param opacity A number between 0 and 1 denoting the target opacity. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/fadeTo/} + * @since 1.0 + */ + fadeTo(duration: JQuery.Duration, opacity: number, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements by animating their opacity. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/fadeToggle/} + * @since 1.4.4 + */ + fadeToggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements by animating their opacity. + * + * @param duration_easing A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/fadeToggle/} + * @since 1.0 + * @since 1.4.3 + */ + fadeToggle(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements by animating their opacity. + * + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * A function to call once the animation is complete, called once per matched element. + * A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/fadeToggle/} + * @since 1.0 + * @since 1.4.3 + */ + fadeToggle(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Reduce the set of matched elements to those that match the selector or pass the function's test. + * + * @param selector A string containing a selector expression to match the current set of elements against. + * One or more DOM elements to match the current set of elements against. + * An existing jQuery object to match the current set of elements against. + * A function used as a test for each element in the set. this is the current DOM element. + * @see {@link https://api.jquery.com/filter/} + * @since 1.0 + * @since 1.4 + */ + filter(selector: JQuery.Selector | JQuery.TypeOrArray | JQuery | ((this: TElement, index: number, element: TElement) => boolean)): this; + /** + * Get the descendants of each element in the current set of matched elements, filtered by a selector, + * jQuery object, or element. + * + * @param selector A string containing a selector expression to match elements against. + * An element or a jQuery object to match elements against. + * @see {@link https://api.jquery.com/find/} + * @since 1.0 + * @since 1.6 + */ + find(selector: JQuery.Selector | Element | JQuery): JQuery; + /** + * Stop the currently-running animation, remove all queued animations, and complete all animations for + * the matched elements. + * + * @param queue The name of the queue in which to stop animations. + * @see {@link https://api.jquery.com/finish/} + * @since 1.9 + */ + finish(queue?: string): this; + /** + * Reduce the set of matched elements to the first in the set. + * + * @see {@link https://api.jquery.com/first/} + * @since 1.4 + */ + first(): this; + /** + * Bind an event handler to the "focus" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/focus/} + * @since 1.4.3 + */ + focus(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "focus" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/focus/} + * @since 1.0 + */ + focus(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "focusin" event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/focusin/} + * @since 1.4.3 + */ + focusin(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "focusin" event. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/focusin/} + * @since 1.4 + */ + focusin(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "focusout" JavaScript event. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/focusout/} + * @since 1.4.3 + */ + focusout(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "focusout" JavaScript event. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/focusout/} + * @since 1.4 + */ + focusout(handler?: JQuery.EventHandler | false): this; + /** + * Retrieve one of the elements matched by the jQuery object. + * + * @param index A zero-based integer indicating which element to retrieve. + * @see {@link https://api.jquery.com/get/} + * @since 1.0 + */ + get(index: number): TElement; + /** + * Retrieve the elements matched by the jQuery object. + * + * @see {@link https://api.jquery.com/get/} + * @since 1.0 + */ + get(): TElement[]; + /** + * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. + * + * @param selector A string containing a selector expression to match elements against. + * A DOM element to match elements against. + * @see {@link https://api.jquery.com/has/} + * @since 1.4 + */ + has(selector: string | Element): this; + /** + * Determine whether any of the matched elements are assigned the given class. + * + * @param className The class name to search for. + * @see {@link https://api.jquery.com/hasClass/} + * @since 1.2 + */ + hasClass(className: string): boolean; + /** + * Set the CSS height of every matched element. + * + * @param value An integer representing the number of pixels, or an integer with an optional unit of measure + * appended (as a string). + * A function returning the height to set. Receives the index position of the element in the set and + * the old height as arguments. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/height/} + * @since 1.0 + * @since 1.4.1 + */ + height(value: string | number | ((this: TElement, index: number, height: number) => string | number)): this; + /** + * Get the current computed height for the first element in the set of matched elements. + * + * @see {@link https://api.jquery.com/height/} + * @since 1.0 + */ + height(): number; + /** + * Hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/hide/} + * @since 1.4.3 + */ + hide(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): this; + /** + * Hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing_complete A string indicating which easing function to use for the transition. + * A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/hide/} + * @since 1.0 + * @since 1.4.3 + */ + hide(duration: JQuery.Duration, easing_complete: string | ((this: TElement) => void)): this; + /** + * Hide the matched elements. + * + * @param duration_complete_options A string or number determining how long the animation will run. + * A function to call once the animation is complete, called once per matched element. + * A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/hide/} + * @since 1.0 + */ + hide(duration_complete_options?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Bind one or two handlers to the matched elements, to be executed when the mouse pointer enters and + * leaves the elements. + * + * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element. + * @param handlerOut A function to execute when the mouse pointer leaves the element. + * @see {@link https://api.jquery.com/hover/} + * @since 1.0 + * @since 1.4 + */ + hover(handlerInOut: (this: TElement, eventObject: JQuery.Event) => void | false, + handlerOut?: (this: TElement, eventObject: JQuery.Event) => void | false): this; + /** + * Set the HTML contents of each element in the set of matched elements. + * + * @param htmlString A string of HTML to set as the content of each matched element. + * A function returning the HTML content to set. Receives the index position of the element in the set + * and the old HTML value as arguments. jQuery empties the element before calling the function; use the + * oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/html/} + * @since 1.0 + * @since 1.4 + */ + html(htmlString: JQuery.htmlString | ((this: TElement, index: number, oldhtml: JQuery.htmlString) => JQuery.htmlString)): this; + /** + * Get the HTML contents of the first element in the set of matched elements. + * + * @see {@link https://api.jquery.com/html/} + * @since 1.0 + */ + html(): string; + /** + * Search for a given element from among the matched elements. + * + * @param element The DOM element or first element within the jQuery object to look for. + * A selector representing a jQuery collection in which to look for an element. + * @see {@link https://api.jquery.com/index/} + * @since 1.0 + * @since 1.4 + */ + index(element?: Element | JQuery | JQuery.Selector): number; + /** + * Set the CSS inner height of each element in the set of matched elements. + * + * @param value A number representing the number of pixels, or a number along with an optional unit of measure + * appended (as a string). + * A function returning the inner height (including padding but not border) to set. Receives the index + * position of the element in the set and the old inner height as arguments. Within the function, this + * refers to the current element in the set. + * @see {@link https://api.jquery.com/innerHeight/} + * @since 1.8.0 + */ + innerHeight(value: string | number | ((this: TElement, index: number, height: number) => string | number)): this; + /** + * Get the current computed height for the first element in the set of matched elements, including + * padding but not border. + * + * @see {@link https://api.jquery.com/innerHeight/} + * @since 1.2.6 + */ + innerHeight(): number; + /** + * Set the CSS inner width of each element in the set of matched elements. + * + * @param value A number representing the number of pixels, or a number along with an optional unit of measure + * appended (as a string). + * A function returning the inner width (including padding but not border) to set. Receives the index + * position of the element in the set and the old inner width as arguments. Within the function, this + * refers to the current element in the set. + * @see {@link https://api.jquery.com/innerWidth/} + * @since 1.8.0 + */ + innerWidth(value: string | number | ((this: TElement, index: number, width: number) => string | number)): this; + /** + * Get the current computed inner width for the first element in the set of matched elements, including + * padding but not border. + * + * @see {@link https://api.jquery.com/innerWidth/} + * @since 1.2.6 + */ + innerWidth(): number; + /** + * Insert every element in the set of matched elements after the target. + * + * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements + * will be inserted after the element(s) specified by this parameter. + * @see {@link https://api.jquery.com/insertAfter/} + * @since 1.0 + */ + insertAfter(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Insert every element in the set of matched elements before the target. + * + * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements + * will be inserted before the element(s) specified by this parameter. + * @see {@link https://api.jquery.com/insertBefore/} + * @since 1.0 + */ + insertBefore(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Check the current matched set of elements against a selector, element, or jQuery object and return + * true if at least one of these elements matches the given arguments. + * + * @param selector A string containing a selector expression to match elements against. + * A function used as a test for every element in the set. It accepts two arguments, index, which is + * the element's index in the jQuery collection, and element, which is the DOM element. Within the + * function, this refers to the current DOM element. + * An existing jQuery object to match the current set of elements against. + * One or more elements to match the current set of elements against. + * @see {@link https://api.jquery.com/is/} + * @since 1.0 + * @since 1.6 + */ + is(selector: JQuery.Selector | ((this: TElement, index: number, element: TElement) => boolean) | JQuery | Element | Element[]): boolean; + /** + * Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/keydown/} + * @since 1.4.3 + */ + keydown(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/keydown/} + * @since 1.0 + */ + keydown(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/keypress/} + * @since 1.4.3 + */ + keypress(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/keypress/} + * @since 1.0 + */ + keypress(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/keyup/} + * @since 1.4.3 + */ + keyup(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/keyup/} + * @since 1.0 + */ + keyup(handler?: JQuery.EventHandler | false): this; + /** + * Reduce the set of matched elements to the final one in the set. + * + * @see {@link https://api.jquery.com/last/} + * @since 1.4 + */ + last(): this; + /** + * Load data from the server and place the returned HTML into the matched element. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param complete A callback function that is executed when the request completes. + * @see {@link https://api.jquery.com/load/} + * @since 1.0 + */ + load(url: string, + data: string | JQuery.PlainObject, + complete: (this: TElement, responseText: string, textStatus: string, jqXHR: JQuery.jqXHR) => void): this; + /** + * Load data from the server and place the returned HTML into the matched element. + * + * @param url A string containing the URL to which the request is sent. + * @param complete_data A callback function that is executed when the request completes. + * A plain object or string that is sent to the server with the request. + * @see {@link https://api.jquery.com/load/} + * @since 1.0 + */ + load(url: string, + complete_data?: ((this: TElement, responseText: string, textStatus: string, jqXHR: JQuery.jqXHR) => void) | string | JQuery.PlainObject): this; + /** + * Pass each element in the current matched set through a function, producing a new jQuery object + * containing the return values. + * + * @param callback A function object that will be invoked for each element in the current set. + * @see {@link https://api.jquery.com/map/} + * @since 1.2 + */ + map(callback: (this: TElement, index: number, domElement: TElement) => any | any[] | null | undefined): JQuery; + /** + * Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mousedown/} + * @since 1.4.3 + */ + mousedown(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mousedown/} + * @since 1.0 + */ + mousedown(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mouseenter/} + * @since 1.4.3 + */ + mouseenter(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mouseenter/} + * @since 1.0 + */ + mouseenter(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mouseleave/} + * @since 1.4.3 + */ + mouseleave(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mouseleave/} + * @since 1.0 + */ + mouseleave(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mousemove/} + * @since 1.4.3 + */ + mousemove(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mousemove/} + * @since 1.0 + */ + mousemove(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mouseout/} + * @since 1.4.3 + */ + mouseout(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mouseout/} + * @since 1.0 + */ + mouseout(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mouseover/} + * @since 1.4.3 + */ + mouseover(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mouseover/} + * @since 1.0 + */ + mouseover(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mouseup/} + * @since 1.4.3 + */ + mouseup(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/mouseup/} + * @since 1.0 + */ + mouseup(handler?: JQuery.EventHandler | false): this; + /** + * Get the immediately following sibling of each element in the set of matched elements. If a selector + * is provided, it retrieves the next sibling only if it matches that selector. + * + * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/next/} + * @since 1.0 + */ + next(selector?: JQuery.Selector): this; + /** + * Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/nextAll/} + * @since 1.2 + */ + nextAll(selector?: string): this; + /** + * Get all following siblings of each element up to but not including the element matched by the + * selector, DOM node, or jQuery object passed. + * + * @param selector A string containing a selector expression to indicate where to stop matching following sibling elements. + * A DOM node or jQuery object indicating where to stop matching following sibling elements. + * @param filter A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/nextUntil/} + * @since 1.4 + * @since 1.6 + */ + nextUntil(selector?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this; + /** + * Remove elements from the set of matched elements. + * + * @param selector A string containing a selector expression, a DOM element, or an array of elements to match against the set. + * A function used as a test for each element in the set. It accepts two arguments, index, which is the + * element's index in the jQuery collection, and element, which is the DOM element. Within the + * function, this refers to the current DOM element. + * An existing jQuery object to match the current set of elements against. + * @see {@link https://api.jquery.com/not/} + * @since 1.0 + * @since 1.4 + */ + not(selector: JQuery.Selector | JQuery.TypeOrArray | ((this: TElement, index: number, element: TElement) => boolean) | JQuery): this; + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as + * "click", "keydown.myPlugin", or ".myPlugin". + * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/off/} + * @since 1.7 + */ + off(events: string, selector: string, handler: JQuery.EventHandler | false): this; + /** + * Remove an event handler. + * + * @param events An object where the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent handler functions previously attached for the event(s). + * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. + * @see {@link https://api.jquery.com/off/} + * @since 1.7 + */ + off(events: JQuery.PlainObject | false>, selector: string): this; + /** + * Remove an event handler. + * + * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as + * "click", "keydown.myPlugin", or ".myPlugin". + * @param selector_handler A selector which should match the one originally passed to .on() when attaching event handlers. + * A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/off/} + * @since 1.7 + */ + off(events: string, selector_handler?: string | JQuery.EventHandler | false): this; + /** + * Remove an event handler. + * + * @param events A jQuery.Event object. + * An object where the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent handler functions previously attached for the event(s). + * @see {@link https://api.jquery.com/off/} + * @since 1.7 + */ + off(events?: JQuery.Event | JQuery.PlainObject | false>): this; + /** + * Set the current coordinates of every element in the set of matched elements, relative to the document. + * + * @param coordinates An object containing the properties top and left, which are numbers indicating the new top and left + * coordinates for the elements. + * A function to return the coordinates to set. Receives the index of the element in the collection as + * the first argument and the current coordinates as the second argument. The function should return an + * object with the new top and left properties. + * @see {@link https://api.jquery.com/offset/} + * @since 1.4 + */ + offset(coordinates: JQuery.Coordinates | ((this: TElement, index: number, coords: JQuery.Coordinates) => JQuery.Coordinates)): this; + /** + * Get the current coordinates of the first element in the set of matched elements, relative to the document. + * + * @see {@link https://api.jquery.com/offset/} + * @since 1.2 + */ + offset(): JQuery.Coordinates; + /** + * Get the closest ancestor element that is positioned. + * + * @see {@link https://api.jquery.com/offsetParent/} + * @since 1.2.6 + */ + offsetParent(): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the + * selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see {@link https://api.jquery.com/on/} + * @since 1.7 + */ + on(events: string, selector: string | null, data: TData, handler: JQuery.EventHandler | false): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events An object in which the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent a handler function to be called for the event(s). + * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If + * the selector is null or omitted, the handler is always called when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event occurs. + * @see {@link https://api.jquery.com/on/} + * @since 1.7 + */ + on(events: JQuery.PlainObject | false>, selector: string | null, data: TData): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector_data A selector string to filter the descendants of the selected elements that trigger the event. If the + * selector is null or omitted, the event is always triggered when it reaches the selected element. + * Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see {@link https://api.jquery.com/on/} + * @since 1.7 + */ + on(events: string, selector_data: string | null | TData, handler: JQuery.EventHandler | false): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see {@link https://api.jquery.com/on/} + * @since 1.7 + */ + on(events: string, handler: JQuery.EventHandler | false): this; + /** + * Attach an event handler function for one or more events to the selected elements. + * + * @param events An object in which the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent a handler function to be called for the event(s). + * @param selector_data A selector string to filter the descendants of the selected elements that will call the handler. If + * the selector is null or omitted, the handler is always called when it reaches the selected element. + * Data to be passed to the handler in event.data when an event occurs. + * @see {@link https://api.jquery.com/on/} + * @since 1.7 + */ + on(events: JQuery.PlainObject | false>, selector_data?: string | null | TData): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the + * selector is null or omitted, the event is always triggered when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see {@link https://api.jquery.com/one/} + * @since 1.7 + */ + one(events: string, selector: string | null, data: TData, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param selector_data A selector string to filter the descendants of the selected elements that trigger the event. If the + * selector is null or omitted, the event is always triggered when it reaches the selected element. + * Data to be passed to the handler in event.data when an event is triggered. + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see {@link https://api.jquery.com/one/} + * @since 1.7 + */ + one(events: string, selector_data: string | null | TData, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events An object in which the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent a handler function to be called for the event(s). + * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If + * the selector is null or omitted, the handler is always called when it reaches the selected element. + * @param data Data to be passed to the handler in event.data when an event occurs. + * @see {@link https://api.jquery.com/one/} + * @since 1.7 + */ + one(events: JQuery.PlainObject | false>, selector: string | null, data: TData): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". + * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand + * for a function that simply does return false. + * @see {@link https://api.jquery.com/one/} + * @since 1.7 + */ + one(events: string, handler: JQuery.EventHandler | false): this; + /** + * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. + * + * @param events An object in which the string keys represent one or more space-separated event types and optional + * namespaces, and the values represent a handler function to be called for the event(s). + * @param selector_data A selector string to filter the descendants of the selected elements that will call the handler. If + * the selector is null or omitted, the handler is always called when it reaches the selected element. + * Data to be passed to the handler in event.data when an event occurs. + * @see {@link https://api.jquery.com/one/} + * @since 1.7 + */ + one(events: JQuery.PlainObject | false>, selector_data?: string | null | TData): this; + /** + * Set the CSS outer height of each element in the set of matched elements. + * + * @param value A number representing the number of pixels, or a number along with an optional unit of measure + * appended (as a string). + * @see {@link https://api.jquery.com/outerHeight/} + * @since 1.8.0 + */ + outerHeight(value: string | number | ((this: TElement, index: number, height: number) => string | number)): this; + /** + * Get the current computed outer height (including padding, border, and optionally margin) for the + * first element in the set of matched elements. + * + * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. + * @see {@link https://api.jquery.com/outerHeight/} + * @since 1.2.6 + */ + outerHeight(includeMargin?: boolean): number; + /** + * Set the CSS outer width of each element in the set of matched elements. + * + * @param value A number representing the number of pixels, or a number along with an optional unit of measure + * appended (as a string). + * A function returning the outer width to set. Receives the index position of the element in the set + * and the old outer width as arguments. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/outerWidth/} + * @since 1.8.0 + */ + outerWidth(value: string | number | ((this: TElement, index: number, width: number) => string | number)): this; + /** + * Get the current computed outer width (including padding, border, and optionally margin) for the + * first element in the set of matched elements. + * + * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. + * @see {@link https://api.jquery.com/outerWidth/} + * @since 1.2.6 + */ + outerWidth(includeMargin?: boolean): number; + /** + * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/parent/} + * @since 1.0 + */ + parent(selector?: JQuery.Selector): this; + /** + * Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/parents/} + * @since 1.0 + */ + parents(selector?: JQuery.Selector): this; + /** + * Get the ancestors of each element in the current set of matched elements, up to but not including + * the element matched by the selector, DOM node, or jQuery object. + * + * @param selector A string containing a selector expression to indicate where to stop matching ancestor elements. + * A DOM node or jQuery object indicating where to stop matching ancestor elements. + * @param filter A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/parentsUntil/} + * @since 1.4 + * @since 1.6 + */ + parentsUntil(selector?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this; + /** + * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. + * + * @see {@link https://api.jquery.com/position/} + * @since 1.2 + */ + position(): JQuery.Coordinates; + /** + * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. + * + * @param contents One or more additional DOM elements, text nodes, arrays of elements and text nodes, HTML strings, or + * jQuery objects to insert at the beginning of each element in the set of matched elements. + * @see {@link https://api.jquery.com/prepend/} + * @since 1.0 + */ + prepend(...contents: Array | JQuery>): this; + /** + * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. + * + * @param fn A function that returns an HTML string, DOM element(s), text node(s), or jQuery object to insert at + * the beginning of each element in the set of matched elements. Receives the index position of the + * element in the set and the old HTML value of the element as arguments. Within the function, this + * refers to the current element in the set. + * @see {@link https://api.jquery.com/prepend/} + * @since 1.4 + */ + prepend(fn: (this: TElement, elementOfArray: number, html: string) => JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Insert every element in the set of matched elements to the beginning of the target. + * + * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements + * will be inserted at the beginning of the element(s) specified by this parameter. + * @see {@link https://api.jquery.com/prependTo/} + * @since 1.0 + */ + prependTo(target: JQuery.Selector | JQuery.htmlString | JQuery.TypeOrArray | JQuery): this; + /** + * Get the immediately preceding sibling of each element in the set of matched elements. If a selector + * is provided, it retrieves the previous sibling only if it matches that selector. + * + * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/prev/} + * @since 1.0 + */ + prev(selector?: JQuery.Selector): this; + /** + * Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/prevAll/} + * @since 1.2 + */ + prevAll(selector?: JQuery.Selector): this; + /** + * Get all preceding siblings of each element up to but not including the element matched by the + * selector, DOM node, or jQuery object. + * + * @param selector A string containing a selector expression to indicate where to stop matching preceding sibling elements. + * A DOM node or jQuery object indicating where to stop matching preceding sibling elements. + * @param filter A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/prevUntil/} + * @since 1.4 + * @since 1.6 + */ + prevUntil(selector?: JQuery.Selector | Element | JQuery, filter?: JQuery.Selector): this; + /** + * Return a Promise object to observe when all actions of a certain type bound to the collection, + * queued or not, have finished. + * + * @param type The type of queue that needs to be observed. + * @param target Object onto which the promise methods have to be attached + * @see {@link https://api.jquery.com/promise/} + * @since 1.6 + */ + promise(type: string, target: T): T & JQuery.Promise; + /** + * Return a Promise object to observe when all actions of a certain type bound to the collection, + * queued or not, have finished. + * + * @param target Object onto which the promise methods have to be attached + * @see {@link https://api.jquery.com/promise/} + * @since 1.6 + */ + promise(target: T): T & JQuery.Promise; + /** + * Return a Promise object to observe when all actions of a certain type bound to the collection, + * queued or not, have finished. + * + * @param type The type of queue that needs to be observed. + * @see {@link https://api.jquery.com/promise/} + * @since 1.6 + */ + promise(type?: string): JQuery.Promise; + /** + * Set one or more properties for the set of matched elements. + * + * @param propertyName The name of the property to set. + * @param value A function returning the value to set. Receives the index position of the element in the set and the + * old property value as arguments. Within the function, the keyword this refers to the current element. + * @see {@link https://api.jquery.com/prop/} + * @since 1.6 + */ + prop(propertyName: string, value: (this: TElement, index: number, oldPropertyValue: any) => any): this; + /** + * Set one or more properties for the set of matched elements. + * + * @param propertyName The name of the property to set. + * @param value A value to set for the property. + * @see {@link https://api.jquery.com/prop/} + * @since 1.6 + */ + // tslint:disable-next-line:unified-signatures + prop(propertyName: string, value: any): this; + /** + * Set one or more properties for the set of matched elements. + * + * @param properties An object of property-value pairs to set. + * @see {@link https://api.jquery.com/prop/} + * @since 1.6 + */ + prop(properties: JQuery.PlainObject): this; + /** + * Get the value of a property for the first element in the set of matched elements. + * + * @param propertyName The name of the property to get. + * @see {@link https://api.jquery.com/prop/} + * @since 1.6 + */ + prop(propertyName: string): any | undefined; + /** + * Add a collection of DOM elements onto the jQuery stack. + * + * @param elements An array of elements to push onto the stack and make into a new jQuery object. + * @param name The name of a jQuery method that generated the array of elements. + * @param args The arguments that were passed in to the jQuery method (for serialization). + * @see {@link https://api.jquery.com/pushStack/} + * @since 1.3 + */ + pushStack(elements: ArrayLike, name: string, args: any[]): JQuery; + /** + * Add a collection of DOM elements onto the jQuery stack. + * + * @param elements An array of elements to push onto the stack and make into a new jQuery object. + * @see {@link https://api.jquery.com/pushStack/} + * @since 1.0 + */ + pushStack(elements: ArrayLike): JQuery; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param newQueue The new function to add to the queue, with a function to call that will dequeue the next item. + * An array of functions to replace the current queue contents. + * @see {@link https://api.jquery.com/queue/} + * @since 1.2 + */ + queue(queueName: string, newQueue: JQuery.TypeOrArray>): this; + /** + * Manipulate the queue of functions to be executed, once for each matched element. + * + * @param newQueue The new function to add to the queue, with a function to call that will dequeue the next item. + * An array of functions to replace the current queue contents. + * @see {@link https://api.jquery.com/queue/} + * @since 1.2 + */ + queue(newQueue: JQuery.TypeOrArray>): this; + /** + * Show the queue of functions to be executed on the matched elements. + * + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see {@link https://api.jquery.com/queue/} + * @since 1.2 + */ + queue(queueName?: string): JQuery.Queue; + /** + * Specify a function to execute when the DOM is fully loaded. + * + * @param handler A function to execute after the DOM is ready. + * @see {@link https://api.jquery.com/ready/} + * @since 1.0 + */ + ready(handler: ($: JQueryStatic) => void): this; + /** + * Remove the set of matched elements from the DOM. + * + * @param selector A selector expression that filters the set of matched elements to be removed. + * @see {@link https://api.jquery.com/remove/} + * @since 1.0 + */ + remove(selector?: string): this; + /** + * Remove an attribute from each element in the set of matched elements. + * + * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. + * @see {@link https://api.jquery.com/removeAttr/} + * @since 1.0 + */ + removeAttr(attributeName: string): this; + /** + * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. + * + * @param className One or more space-separated classes to be removed from the class attribute of each matched element. + * A function returning one or more space-separated class names to be removed. Receives the index + * position of the element in the set and the old class value as arguments. + * @see {@link https://api.jquery.com/removeClass/} + * @since 1.0 + * @since 1.4 + */ + removeClass(className?: string | ((this: TElement, index: number, className: string) => string)): this; + /** + * Remove a previously-stored piece of data. + * + * @param name A string naming the piece of data to delete. + * An array or space-separated string naming the pieces of data to delete. + * @see {@link https://api.jquery.com/removeData/} + * @since 1.2.3 + * @since 1.7 + */ + removeData(name?: JQuery.TypeOrArray): this; + /** + * Remove a property for the set of matched elements. + * + * @param propertyName The name of the property to remove. + * @see {@link https://api.jquery.com/removeProp/} + * @since 1.6 + */ + removeProp(propertyName: string): this; + /** + * Replace each target element with the set of matched elements. + * + * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. + * @see {@link https://api.jquery.com/replaceAll/} + * @since 1.2 + */ + replaceAll(target: JQuery.Selector | JQuery | JQuery.TypeOrArray): this; + /** + * Replace each element in the set of matched elements with the provided new content and return the set + * of elements that was removed. + * + * @param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. + * A function that returns content with which to replace the set of matched elements. + * @see {@link https://api.jquery.com/replaceWith/} + * @since 1.2 + * @since 1.4 + */ + replaceWith(newContent: JQuery.htmlString | JQuery.TypeOrArray | JQuery | ((this: TElement) => any)): JQuery; + /** + * Bind an event handler to the "resize" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/resize/} + * @since 1.4.3 + */ + resize(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "resize" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/resize/} + * @since 1.0 + */ + resize(handler?: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/scroll/} + * @since 1.4.3 + */ + scroll(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/scroll/} + * @since 1.0 + */ + scroll(handler?: JQuery.EventHandler | false): this; + /** + * Set the current horizontal position of the scroll bar for each of the set of matched elements. + * + * @param value An integer indicating the new position to set the scroll bar to. + * @see {@link https://api.jquery.com/scrollLeft/} + * @since 1.2.6 + */ + scrollLeft(value: number): this; + /** + * Get the current horizontal position of the scroll bar for the first element in the set of matched elements. + * + * @see {@link https://api.jquery.com/scrollLeft/} + * @since 1.2.6 + */ + scrollLeft(): number; + /** + * Set the current vertical position of the scroll bar for each of the set of matched elements. + * + * @param value A number indicating the new position to set the scroll bar to. + * @see {@link https://api.jquery.com/scrollTop/} + * @since 1.2.6 + */ + scrollTop(value: number): this; + /** + * Get the current vertical position of the scroll bar for the first element in the set of matched + * elements or set the vertical position of the scroll bar for every matched element. + * + * @see {@link https://api.jquery.com/scrollTop/} + * @since 1.2.6 + */ + scrollTop(): number; + /** + * Bind an event handler to the "select" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/select/} + * @since 1.4.3 + */ + select(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "select" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/select/} + * @since 1.0 + */ + select(handler?: JQuery.EventHandler | false): this; + /** + * Encode a set of form elements as a string for submission. + * + * @see {@link https://api.jquery.com/serialize/} + * @since 1.0 + */ + serialize(): string; + /** + * Encode a set of form elements as an array of names and values. + * + * @see {@link https://api.jquery.com/serializeArray/} + * @since 1.2 + */ + serializeArray(): JQuery.NameValuePair[]; + /** + * Display the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/show/} + * @since 1.4.3 + */ + show(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): this; + /** + * Display the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing_complete A string indicating which easing function to use for the transition. + * A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/show/} + * @since 1.0 + * @since 1.4.3 + */ + show(duration: JQuery.Duration, easing_complete: string | ((this: TElement) => void)): this; + /** + * Display the matched elements. + * + * @param duration_complete_options A string or number determining how long the animation will run. + * A function to call once the animation is complete, called once per matched element. + * A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/show/} + * @since 1.0 + */ + show(duration_complete_options?: JQuery.Duration | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. + * + * @param selector A string containing a selector expression to match elements against. + * @see {@link https://api.jquery.com/siblings/} + * @since 1.0 + */ + siblings(selector?: JQuery.Selector): this; + /** + * Reduce the set of matched elements to a subset specified by a range of indices. + * + * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, + * it indicates an offset from the end of the set. + * @param end An integer indicating the 0-based position at which the elements stop being selected. If negative, + * it indicates an offset from the end of the set. If omitted, the range continues until the end of the set. + * @see {@link https://api.jquery.com/slice/} + * @since 1.1.4 + */ + slice(start: number, end?: number): this; + /** + * Display the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/slideDown/} + * @since 1.4.3 + */ + slideDown(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display the matched elements with a sliding motion. + * + * @param duration_easing A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/slideDown/} + * @since 1.0 + * @since 1.4.3 + */ + slideDown(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this; + /** + * Display the matched elements with a sliding motion. + * + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * A function to call once the animation is complete, called once per matched element. + * A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/slideDown/} + * @since 1.0 + * @since 1.4.3 + */ + slideDown(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Display or hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/slideToggle/} + * @since 1.4.3 + */ + slideToggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements with a sliding motion. + * + * @param duration_easing A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/slideToggle/} + * @since 1.0 + * @since 1.4.3 + */ + slideToggle(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements with a sliding motion. + * + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * A function to call once the animation is complete, called once per matched element. + * A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/slideToggle/} + * @since 1.0 + * @since 1.4.3 + */ + slideToggle(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Hide the matched elements with a sliding motion. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/slideUp/} + * @since 1.4.3 + */ + slideUp(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Hide the matched elements with a sliding motion. + * + * @param duration_easing A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/slideUp/} + * @since 1.0 + * @since 1.4.3 + */ + slideUp(duration_easing: JQuery.Duration | string, complete?: (this: TElement) => void): this; + /** + * Hide the matched elements with a sliding motion. + * + * @param duration_easing_complete_options A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * A function to call once the animation is complete, called once per matched element. + * A map of additional options to pass to the method. + * @see {@link https://api.jquery.com/slideUp/} + * @since 1.0 + * @since 1.4.3 + */ + slideUp(duration_easing_complete_options?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.EffectsOptions): this; + /** + * Stop the currently-running animation on the matched elements. + * + * @param queue The name of the queue in which to stop animations. + * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. + * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. + * @see {@link https://api.jquery.com/stop/} + * @since 1.7 + */ + stop(queue: string, clearQueue?: boolean, jumpToEnd?: boolean): this; + /** + * Stop the currently-running animation on the matched elements. + * + * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. + * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. + * @see {@link https://api.jquery.com/stop/} + * @since 1.2 + */ + stop(clearQueue?: boolean, jumpToEnd?: boolean): this; + /** + * Bind an event handler to the "submit" JavaScript event, or trigger that event on an element. + * + * @param eventData An object containing data that will be passed to the event handler. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/submit/} + * @since 1.4.3 + */ + submit(eventData: TData, handler: JQuery.EventHandler | false): this; + /** + * Bind an event handler to the "submit" JavaScript event, or trigger that event on an element. + * + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/submit/} + * @since 1.0 + */ + submit(handler?: JQuery.EventHandler | false): this; + /** + * Set the content of each element in the set of matched elements to the specified text. + * + * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will + * be converted to a String representation. + * A function returning the text content to set. Receives the index position of the element in the set + * and the old text value as arguments. + * @see {@link https://api.jquery.com/text/} + * @since 1.0 + * @since 1.4 + */ + text(text: string | number | boolean | ((this: TElement, index: number, text: string) => string | number | boolean)): this; + /** + * Get the combined text contents of each element in the set of matched elements, including their descendants. + * + * @see {@link https://api.jquery.com/text/} + * @since 1.0 + */ + text(): string; + /** + * Retrieve all the elements contained in the jQuery set, as an array. + * + * @see {@link https://api.jquery.com/toArray/} + * @since 1.4 + */ + toArray(): TElement[]; + /** + * Display or hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/toggle/} + * @since 1.4.3 + */ + toggle(duration: JQuery.Duration, easing: string, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements. + * + * @param duration A string or number determining how long the animation will run. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/toggle/} + * @since 1.0 + */ + toggle(duration: JQuery.Duration, complete?: (this: TElement) => void): this; + /** + * Display or hide the matched elements. + * + * @param options A map of additional options to pass to the method. + * Use true to show the element or false to hide it. + * @see {@link https://api.jquery.com/toggle/} + * @since 1.0 + * @since 1.3 + */ + toggle(options?: JQuery.EffectsOptions | boolean): this; + /** + * Add or remove one or more classes from each element in the set of matched elements, depending on + * either the class's presence or the value of the state argument. + * + * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. + * A function that returns class names to be toggled in the class attribute of each element in the + * matched set. Receives the index position of the element in the set, the old class value, and the state as arguments. + * @param state A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. + * @see {@link https://api.jquery.com/toggleClass/} + * @since 1.0 + * @since 1.3 + * @since 1.4 + */ + toggleClass(className: string | ((this: TElement, index: number, className: string, state: boolean) => string), + state?: boolean): this; + /** + * + * + * @param state A boolean value to determine whether the class should be added or removed. + * @see {@link https://api.jquery.com/toggleClass/} + * @since 1.4 + * @deprecated 3.0 + */ + toggleClass(state?: boolean): this; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * A jQuery.Event object. + * @param extraParameters Additional parameters to pass along to the event handler. + * @see {@link https://api.jquery.com/trigger/} + * @since 1.0 + * @since 1.3 + */ + trigger(eventType: string | JQuery.Event, extraParameters?: any[] | JQuery.PlainObject): this; + /** + * Execute all handlers attached to an element for an event. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * A jQuery.Event object. + * @param extraParameters Additional parameters to pass along to the event handler. + * @see {@link https://api.jquery.com/triggerHandler/} + * @since 1.2 + * @since 1.3 + */ + triggerHandler(eventType: string | JQuery.Event, extraParameters?: any[] | JQuery.PlainObject): undefined | any; + /** + * Remove a previously-attached event handler from the elements. + * + * @param event A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/unbind/} + * @since 1.0 + * @since 1.4.3 + * @deprecated 3.0 + */ + unbind(event: string, handler: JQuery.EventHandler | false | false): this; + /** + * Remove a previously-attached event handler from the elements. + * + * @param event A string containing one or more DOM event types, such as "click" or "submit," or custom event names. + * A jQuery.Event object. + * @see {@link https://api.jquery.com/unbind/} + * @since 1.0 + * @deprecated 3.0 + */ + unbind(event?: string | JQuery.Event): this; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a + * specific set of root elements. + * + * @param selector A selector which will be used to filter the event results. + * @param eventType A string containing a JavaScript event type, such as "click" or "keydown" + * @param handler A function to execute each time the event is triggered. + * @see {@link https://api.jquery.com/undelegate/} + * @since 1.4.2 + * @deprecated 3.0 + */ + undelegate(selector: JQuery.Selector, eventType: string, handler: JQuery.EventHandler | false): this; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a + * specific set of root elements. + * + * @param selector A selector which will be used to filter the event results. + * @param eventTypes A string containing a JavaScript event type, such as "click" or "keydown" + * An object of one or more event types and previously bound functions to unbind from them. + * @see {@link https://api.jquery.com/undelegate/} + * @since 1.4.2 + * @since 1.4.3 + * @deprecated 3.0 + */ + undelegate(selector: JQuery.Selector, eventTypes: string | JQuery.PlainObject | false>): this; + /** + * Remove a handler from the event for all elements which match the current selector, based upon a + * specific set of root elements. + * + * @param namespace A selector which will be used to filter the event results. + * @see {@link https://api.jquery.com/undelegate/} + * @since 1.4.2 + * @since 1.6 + * @deprecated 3.0 + */ + undelegate(namespace?: string): this; + /** + * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. + * + * @param selector A selector to check the parent element against. If an element's parent does not match the selector, + * the element won't be unwrapped. + * @see {@link https://api.jquery.com/unwrap/} + * @since 1.4 + * @since 3.0 + */ + unwrap(selector?: string): this; + /** + * Set the value of each element in the set of matched elements. + * + * @param value A string of text, a number, or an array of strings corresponding to the value of each matched + * element to set as selected/checked. + * A function returning the value to set. this is the current element. Receives the index position of + * the element in the set and the old value as arguments. + * @see {@link https://api.jquery.com/val/} + * @since 1.0 + * @since 1.4 + */ + val(value: string | number | string[] | ((this: TElement, index: number, value: string) => string)): this; + /** + * Get the current value of the first element in the set of matched elements. + * + * @see {@link https://api.jquery.com/val/} + * @since 1.0 + */ + val(): string | number | string[] | undefined; + /** + * Set the CSS width of each element in the set of matched elements. + * + * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure + * appended (as a string). + * A function returning the width to set. Receives the index position of the element in the set and the + * old width as arguments. Within the function, this refers to the current element in the set. + * @see {@link https://api.jquery.com/width/} + * @since 1.0 + * @since 1.4.1 + */ + width(value: string | number | ((this: TElement, index: number, value: number) => string | number)): this; + /** + * Get the current computed width for the first element in the set of matched elements. + * + * @see {@link https://api.jquery.com/width/} + * @since 1.0 + */ + width(): number; + /** + * Wrap an HTML structure around each element in the set of matched elements. + * + * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the + * matched elements. When you pass a jQuery collection containing more than one element, or a selector + * matching more than one element, the first element will be used. + * A callback function returning the HTML content or jQuery object to wrap around the matched elements. + * Receives the index position of the element in the set as an argument. Within the function, this + * refers to the current element in the set. + * @see {@link https://api.jquery.com/wrap/} + * @since 1.0 + * @since 1.4 + */ + wrap(wrappingElement: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement, index: number) => string | JQuery)): this; + /** + * Wrap an HTML structure around all elements in the set of matched elements. + * + * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. + * A callback function returning the HTML content or jQuery object to wrap around all the matched + * elements. Within the function, this refers to the first element in the set. Prior to jQuery 3.0, the + * callback was incorrectly called for every element in the set and received the index position of the + * element in the set as an argument. + * @see {@link https://api.jquery.com/wrapAll/} + * @since 1.2 + * @since 1.4 + */ + wrapAll(wrappingElement: JQuery.Selector | JQuery.htmlString | Element | JQuery | ((this: TElement) => string | JQuery)): this; + /** + * Wrap an HTML structure around the content of each element in the set of matched elements. + * + * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap + * around the content of the matched elements. + * A callback function which generates a structure to wrap around the content of the matched elements. + * Receives the index position of the element in the set as an argument. Within the function, this + * refers to the current element in the set. + * @see {@link https://api.jquery.com/wrapInner/} + * @since 1.2 + * @since 1.4 + */ + wrapInner(wrappingElement: JQuery.htmlString | JQuery.Selector | JQuery | Element | ((this: TElement, index: number) => string)): this; } -/** - * Allows jQuery Promises to interop with non-jQuery promises - */ -interface JQueryGenericPromise { - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @see {@link https://api.jquery.com/deferred.then/#deferred-then-doneFilter-failFilter-progressFilter} - */ - then(doneFilter: (value?: T, ...values: any[]) => U|JQueryPromise, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; +interface JQuery extends ArrayLike, Iterable { } +interface JQueryStatic { + Event: JQuery.Event; /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize + * CSS property naming, or create custom properties. * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @see {@link https://api.jquery.com/deferred.then/#deferred-then-doneFilter-failFilter-progressFilter} + * @see {@link https://api.jquery.com/jQuery.cssHooks/} + * @since 1.4.3 */ - then(doneFilter: (value?: T, ...values: any[]) => void, failFilter?: (...reasons: any[]) => any, progressFilter?: (...progression: any[]) => any): JQueryPromise; + cssHooks: JQuery.PlainObject>; + /** + * An object containing all CSS properties that may be used without a unit. The .css() method uses this + * object to see if it may append px to unitless values. + * + * @see {@link https://api.jquery.com/jQuery.cssNumber/} + * @since 1.4.3 + */ + cssNumber: JQuery.PlainObject; + readonly fn: JQuery; + fx: { + /** + * The rate (in milliseconds) at which animations fire. + * + * @see {@link https://api.jquery.com/jQuery.fx.interval/} + * @since 1.4.3 + * @deprecated 3.0 + */ + interval: number; + /** + * Globally disable all animations. + * + * @see {@link https://api.jquery.com/jQuery.fx.off/} + * @since 1.3 + */ + off: boolean; + step: JQuery.PlainObject>; + }; + /** + * A Promise-like object (or "thenable") that resolves when the document is ready. + * + * @see {@link https://api.jquery.com/jQuery.ready/} + * @since 1.8 + */ + ready: JQuery.Thenable; + /** + * A collection of properties that represent the presence of different browser features or bugs. + * Intended for jQuery's internal use; specific properties may be removed when they are no longer + * needed internally to improve page startup performance. For your own project's feature-detection + * needs, we strongly recommend the use of an external library such as Modernizr instead of dependency + * on properties in jQuery.support. + * + * @see {@link https://api.jquery.com/jQuery.support/} + * @since 1.3 + * @deprecated 1.9 + */ + support: JQuery.PlainObject; + valHooks: JQuery.PlainObject>; + /** + * Creates DOM elements on the fly from the provided string of raw HTML. + * + * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML. + * A string defining a single, standalone, HTML element (e.g.
or
). + * @param ownerDocument_attributes A document in which the new elements will be created. + * An object of attributes, events, and methods to call on the newly-created element. + * @see {@link https://api.jquery.com/jQuery/} + * @since 1.0 + * @since 1.4 + */ + (html: JQuery.htmlString, ownerDocument_attributes: Document | JQuery.PlainObject): JQuery; + /** + * Accepts a string containing a CSS selector which is then used to match a set of elements. + * + * @param selector A string containing a selector expression + * @param context A DOM Element, Document, or jQuery to use as context + * @see {@link https://api.jquery.com/jQuery/} + * @since 1.0 + */ + (selector: JQuery.Selector, context: Element | Document | JQuery): JQuery; + /** + * Creates DOM elements on the fly from the provided string of raw HTML. + * + * Binds a function to be executed when the DOM has finished loading. + * + * @param selector_object_callback A string containing a selector expression + * A DOM element to wrap in a jQuery object. + * An array containing a set of DOM elements to wrap in a jQuery object. + * A plain object to wrap in a jQuery object. + * An existing jQuery object to clone. + * The function to execute when the DOM is ready. + * @see {@link https://api.jquery.com/jQuery/} + * @since 1.0 + * @since 1.4 + */ + (selector_object_callback?: JQuery.Selector | JQuery.TypeOrArray | JQuery.PlainObject | JQuery | (($: JQueryStatic) => void)): JQuery; + /** + * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. + * + * @param flags An optional list of space-separated flags that change how the callback list behaves. + * @see {@link https://api.jquery.com/jQuery.Callbacks/} + * @since 1.7 + */ + Callbacks(flags?: string): JQuery.Callbacks; + /** + * A factory function that returns a chainable utility object with methods to register multiple + * callbacks into callback queues, invoke callback queues, and relay the success or failure state of + * any synchronous or asynchronous function. + * + * @param beforeStart A function that is called just before the constructor returns. + * @see {@link https://api.jquery.com/jQuery.Deferred/} + * @since 1.5 + */ + Deferred(beforeStart?: (this: JQuery.Deferred, + deferred: JQuery.Deferred) => void): JQuery.Deferred; + /** + * Perform an asynchronous HTTP (Ajax) request. + * + * @param url A string containing the URL to which the request is sent. + * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can + * be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) below for a complete list of all settings. + * @see {@link https://api.jquery.com/jQuery.ajax/} + * @since 1.5 + */ + ajax(url: string, settings?: JQuery.AjaxSettings): JQuery.jqXHR; + /** + * Perform an asynchronous HTTP (Ajax) request. + * + * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can + * be set for any option with $.ajaxSetup(). + * @see {@link https://api.jquery.com/jQuery.ajax/} + * @since 1.0 + */ + ajax(settings?: JQuery.AjaxSettings): JQuery.jqXHR; + /** + * Handle custom Ajax options or modify existing options before each request is sent and before they + * are processed by $.ajax(). + * + * @param dataTypes An optional string containing one or more space-separated dataTypes + * @param handler A handler to set default values for future Ajax requests. + * @see {@link https://api.jquery.com/jQuery.ajaxPrefilter/} + * @since 1.5 + */ + ajaxPrefilter(dataTypes: string, + handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => string | void): void; + /** + * Handle custom Ajax options or modify existing options before each request is sent and before they + * are processed by $.ajax(). + * + * @param handler A handler to set default values for future Ajax requests. + * @see {@link https://api.jquery.com/jQuery.ajaxPrefilter/} + * @since 1.5 + */ + ajaxPrefilter(handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => string | void): void; + /** + * Set default values for future Ajax requests. Its use is not recommended. + * + * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. + * @see {@link https://api.jquery.com/jQuery.ajaxSetup/} + * @since 1.1 + */ + ajaxSetup(options: JQuery.AjaxSettings): JQuery.AjaxSettings; + /** + * Creates an object that handles the actual transmission of Ajax data. + * + * @param dataType A string identifying the data type to use + * @param handler A handler to return the new transport object to use with the data type provided in the first argument. + * @see {@link https://api.jquery.com/jQuery.ajaxTransport/} + * @since 1.5 + */ + ajaxTransport(dataType: string, + handler: (options: JQuery.AjaxSettings, originalOptions: JQuery.AjaxSettings, jqXHR: JQuery.jqXHR) => JQuery.Transport | void): void; + /** + * Check to see if a DOM element is a descendant of another DOM element. + * + * @param container The DOM element that may contain the other element. + * @param contained The DOM element that may be contained by (a descendant of) the other element. + * @see {@link https://api.jquery.com/jQuery.contains/} + * @since 1.4 + */ + contains(container: Element, contained: Element): boolean; + css(elem: Element, unknown: any): any; + /** + * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or + * the full data store for the element. + * + * @param element The DOM element to query for the data. + * @param key Name of the data stored. + * @param undefined + * @see {@link https://api.jquery.com/jQuery.data/} + * @since 1.2.3 + */ + // tslint:disable-next-line:unified-signatures + data(element: Element, key: string, undefined: undefined): any; + /** + * Store arbitrary data associated with the specified element. Returns the value that was set. + * + * @param element The DOM element to associate with the data. + * @param key A string naming the piece of data to set. + * @param value The new data value; this can be any Javascript type except undefined. + * @see {@link https://api.jquery.com/jQuery.data/} + * @since 1.2.3 + */ + data(element: Element, key: string, value: T): T; + /** + * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or + * the full data store for the element. + * + * @param element The DOM element to query for the data. + * @param key Name of the data stored. + * @see {@link https://api.jquery.com/jQuery.data/} + * @since 1.2.3 + * @since 1.4 + */ + data(element: Element, key?: string): any; + /** + * Execute the next function on the queue for the matched element. + * + * @param element A DOM element from which to remove and execute a queued function. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see {@link https://api.jquery.com/jQuery.dequeue/} + * @since 1.3 + */ + dequeue(element: Element, queueName?: string): void; + /** + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. + * Arrays and array-like objects with a length property (such as a function's arguments object) are + * iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. + * + * @param array The array to iterate over. + * @param callback The function that will be executed on every object. + * @see {@link https://api.jquery.com/jQuery.each/} + * @since 1.0 + */ + each(array: ArrayLike, callback: (indexInArray: number, value: T) => false | any): ArrayLike; + /** + * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. + * Arrays and array-like objects with a length property (such as a function's arguments object) are + * iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. + * + * @param obj The object to iterate over. + * @param callback The function that will be executed on every object. + * @see {@link https://api.jquery.com/jQuery.each/} + * @since 1.0 + */ + each(obj: T, callback: (propertyName: K, valueOfProperty: T[K]) => false | any): T; + /** + * Takes a string and throws an exception containing it. + * + * @param message The message to send out. + * @see {@link https://api.jquery.com/jQuery.error/} + * @since 1.4.1 + */ + error(message: string): never; + /** + * Escapes any character that has a special meaning in a CSS selector. + * + * @param selector A string containing a selector expression to escape. + * @see {@link https://api.jquery.com/jQuery.escapeSelector/} + * @since 3.0 + */ + escapeSelector(selector: JQuery.Selector): JQuery.Selector; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.1.4 + */ + extend(deep: true, target: T, object1: U, object2: V, object3: W, object4: X, object5: Y, object6: Z): T & U & V & W & X & Y & Z; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.1.4 + */ + extend(deep: true, target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.1.4 + */ + extend(deep: true, target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.1.4 + */ + extend(deep: true, target: T, object1: U, object2: V, object3: W): T & U & V & W; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.1.4 + */ + extend(deep: true, target: T, object1: U, object2: V): T & U & V; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.1.4 + */ + extend(deep: true, target: T, object1: U): T & U; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param deep If true, the merge becomes recursive (aka. deep copy). Passing false for this argument is not supported. + * @param target The object to extend. It will receive the new properties. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.1.4 + */ + extend(deep: true, target: T, ...objects: U[]): T & U; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.0 + */ + extend(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y, object6: Z): T & U & V & W & X & Y & Z; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.0 + */ + extend(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.0 + */ + extend(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.0 + */ + extend(target: T, object1: U, object2: V, object3: W): T & U & V & W; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.0 + */ + extend(target: T, object1: U, object2: V): T & U & V; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.0 + */ + extend(target: T, object1: U): T & U; + /** + * Merge the contents of two or more objects together into the first object. + * + * @param target An object that will receive the new properties if additional objects are passed in or that will + * extend the jQuery namespace if it is the sole argument. + * @see {@link https://api.jquery.com/jQuery.extend/} + * @since 1.0 + */ + extend(target: T, ...objects: U[]): T & U; + /** + * Load data from the server using a HTTP GET request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but + * you can use null or jQuery.noop as a placeholder. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + * @see {@link https://api.jquery.com/jQuery.get/} + * @since 1.0 + */ + get(url: string, + data: JQuery.PlainObject | string, + success: JQuery.jqXHR.DoneCallback | null, + dataType?: string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP GET request. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but + * you can use null or jQuery.noop as a placeholder. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + * @see {@link https://api.jquery.com/jQuery.get/} + * @since 1.0 + */ + get(url: string, + success: JQuery.jqXHR.DoneCallback | null, + dataType: string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP GET request. + * + * @param url A string containing the URL to which the request is sent. + * @param success_data A callback function that is executed if the request succeeds. Required if dataType is provided, but + * you can use null or jQuery.noop as a placeholder. + * A plain object or string that is sent to the server with the request. + * @see {@link https://api.jquery.com/jQuery.get/} + * @since 1.0 + */ + get(url: string, + success_data: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP GET request. + * + * @param url_settings A string containing the URL to which the request is sent. + * A set of key/value pairs that configure the Ajax request. All properties except for url are + * optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) for a + * complete list of all settings. The type option will automatically be set to GET. + * @see {@link https://api.jquery.com/jQuery.get/} + * @since 1.0 + * @since 1.12 + * @since 2.2 + */ + get(url_settings?: string | JQuery.AjaxSettings): JQuery.jqXHR; + /** + * Load JSON-encoded data from the server using a GET HTTP request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. + * @see {@link https://api.jquery.com/jQuery.getJSON/} + * @since 1.0 + */ + getJSON(url: string, + data: JQuery.PlainObject | string, + success: JQuery.jqXHR.DoneCallback): JQuery.jqXHR; + /** + * Load JSON-encoded data from the server using a GET HTTP request. + * + * @param url A string containing the URL to which the request is sent. + * @param success_data A callback function that is executed if the request succeeds. + * A plain object or string that is sent to the server with the request. + * @see {@link https://api.jquery.com/jQuery.getJSON/} + * @since 1.0 + */ + getJSON(url: string, + success_data?: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR; + /** + * Load a JavaScript file from the server using a GET HTTP request, then execute it. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. + * @see {@link https://api.jquery.com/jQuery.getScript/} + * @since 1.0 + */ + getScript(url: string, + success?: JQuery.jqXHR.DoneCallback): JQuery.jqXHR; + /** + * Execute some JavaScript code globally. + * + * @param code The JavaScript code to execute. + * @see {@link https://api.jquery.com/jQuery.globalEval/} + * @since 1.0.4 + */ + globalEval(code: string): void; + /** + * Finds the elements of an array which satisfy a filter function. The original array is not affected. + * + * @param array The array-like object to search through. + * @param fn The function to process each item against. The first argument to the function is the item, and the + * second argument is the index. The function should return a Boolean value. this will be the global window object. + * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements + * for which "callback" returns true. If "invert" is true, then the function returns an array + * consisting of all elements for which "callback" returns false. + * @see {@link https://api.jquery.com/jQuery.grep/} + * @since 1.0 + */ + grep(array: ArrayLike, + fn: (elementOfArray: T, indexInArray: number) => boolean, + invert?: boolean): T[]; + /** + * Determine whether an element has any jQuery data associated with it. + * + * @param element A DOM element to be checked for data. + * @see {@link https://api.jquery.com/jQuery.hasData/} + * @since 1.5 + */ + hasData(element: Element): boolean; + /** + * Holds or releases the execution of jQuery's ready event. + * + * @param hold Indicates whether the ready hold is being requested or released + * @see {@link https://api.jquery.com/jQuery.holdReady/} + * @since 1.6 + */ + holdReady(hold: boolean): void; + /** + * Modify and filter HTML strings passed through jQuery manipulation methods. + * + * @param html The HTML string on which to operate. + * @see {@link https://api.jquery.com/jQuery.htmlPrefilter/} + * @since 1.12/2.2 + */ + htmlPrefilter(html: string): string; + /** + * Search for a specified value within an array and return its index (or -1 if not found). + * + * @param value The value to search for. + * @param array An array through which to search. + * @param fromIndex The index of the array at which to begin the search. The default is 0, which will search the whole array. + * @see {@link https://api.jquery.com/jQuery.inArray/} + * @since 1.2 + */ + inArray(value: T, array: T[], fromIndex?: number): number; + /** + * Determine whether the argument is an array. + * + * @param obj Object to test whether or not it is an array. + * @see {@link https://api.jquery.com/jQuery.isArray/} + * @since 1.3 + */ + isArray(obj: any): obj is any[]; + /** + * Check to see if an object is empty (contains no enumerable properties). + * + * @param obj The object that will be checked to see if it's empty. + * @see {@link https://api.jquery.com/jQuery.isEmptyObject/} + * @since 1.4 + */ + isEmptyObject(obj: any): boolean; + /** + * Determine if the argument passed is a JavaScript function object. + * + * @param obj Object to test whether or not it is a function. + * @see {@link https://api.jquery.com/jQuery.isFunction/} + * @since 1.2 + */ + isFunction(obj: any): obj is Function; + /** + * Determines whether its argument represents a JavaScript number. + * + * @param value The value to be tested. + * @see {@link https://api.jquery.com/jQuery.isNumeric/} + * @since 1.7 + */ + isNumeric(value: any): value is number; + /** + * Check to see if an object is a plain object (created using "{}" or "new Object"). + * + * @param obj The object that will be checked to see if it's a plain object. + * @see {@link https://api.jquery.com/jQuery.isPlainObject/} + * @since 1.4 + */ + isPlainObject(obj: any): obj is JQuery.PlainObject; + /** + * Determine whether the argument is a window. + * + * @param obj Object to test whether or not it is a window. + * @see {@link https://api.jquery.com/jQuery.isWindow/} + * @since 1.4.3 + */ + isWindow(obj: any): obj is Window; + /** + * Check to see if a DOM node is within an XML document (or is an XML document). + * + * @param node The DOM node that will be checked to see if it's in an XML document. + * @see {@link https://api.jquery.com/jQuery.isXMLDoc/} + * @since 1.1.4 + */ + isXMLDoc(node: Node): boolean; + /** + * Convert an array-like object into a true JavaScript array. + * + * @param obj Any object to turn into a native Array. + * @see {@link https://api.jquery.com/jQuery.makeArray/} + * @since 1.2 + */ + makeArray(obj: ArrayLike): T[]; + /** + * Translate all items in an array or object to new array of items. + * + * @param array The Array to translate. + * @param callback The function to process each item against. The first argument to the function is the array item, the + * second argument is the index in array The function can return any value. A returned array will be + * flattened into the resulting array. Within the function, this refers to the global (window) object. + * @see {@link https://api.jquery.com/jQuery.map/} + * @since 1.0 + */ + map(array: T[], callback: (elementOfArray: T, indexInArray: number) => R): R[]; + /** + * Translate all items in an array or object to new array of items. + * + * @param obj The Object to translate. + * @param callback The function to process each item against. The first argument to the function is the value; the + * second argument is the key of the object property. The function can return any value to add to the + * array. A returned array will be flattened into the resulting array. Within the function, this refers + * to the global (window) object. + * @see {@link https://api.jquery.com/jQuery.map/} + * @since 1.6 + */ + map(obj: T, callback: (propertyOfObject: T[K], key: K) => R): R[]; + /** + * Merge the contents of two arrays together into the first array. + * + * @param first The first array-like object to merge, the elements of second added. + * @param second The second array-like object to merge into the first, unaltered. + * @see {@link https://api.jquery.com/jQuery.merge/} + * @since 1.0 + */ + merge(first: ArrayLike, second: ArrayLike): Array; + /** + * Relinquish jQuery's control of the $ variable. + * + * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). + * @see {@link https://api.jquery.com/jQuery.noConflict/} + * @since 1.0 + */ + noConflict(removeAll?: boolean): JQueryStatic; + /** + * An empty function. + * + * @see {@link https://api.jquery.com/jQuery.noop/} + * @since 1.4 + */ + noop(): undefined; + /** + * Return a number representing the current time. + * + * @see {@link https://api.jquery.com/jQuery.now/} + * @since 1.4.3 + */ + now(): number; + /** + * Create a serialized representation of an array, a plain object, or a jQuery object suitable for use + * in a URL query string or Ajax request. In case a jQuery object is passed, it should contain input + * elements with name/value properties. + * + * @param obj An array, a plain object, or a jQuery object to serialize. + * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. + * @see {@link https://api.jquery.com/jQuery.param/} + * @since 1.2 + * @since 1.4 + */ + param(obj: any[] | JQuery.PlainObject | JQuery, traditional?: boolean): string; + /** + * Parses a string into an array of DOM nodes. + * + * @param data HTML string to be parsed + * @param context Document element to serve as the context in which the HTML fragment will be created + * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string + * @see {@link https://api.jquery.com/jQuery.parseHTML/} + * @since 1.8 + */ + parseHTML(data: string, context: Document | null | undefined, keepScripts: boolean): Node[]; + /** + * Parses a string into an array of DOM nodes. + * + * @param data HTML string to be parsed + * @param context_keepScripts Document element to serve as the context in which the HTML fragment will be created + * A Boolean indicating whether to include scripts passed in the HTML string + * @see {@link https://api.jquery.com/jQuery.parseHTML/} + * @since 1.8 + */ + parseHTML(data: string, context_keepScripts?: Document | null | undefined | boolean): Node[]; + /** + * Takes a well-formed JSON string and returns the resulting JavaScript value. + * + * @param json The JSON string to parse. + * @see {@link https://api.jquery.com/jQuery.parseJSON/} + * @since 1.4.1 + * @deprecated 3.0 + */ + parseJSON(json: string): any; + /** + * Parses a string into an XML document. + * + * @param data a well-formed XML string to be parsed + * @see {@link https://api.jquery.com/jQuery.parseXML/} + * @since 1.5 + */ + parseXML(data: string): XMLDocument; + /** + * Load data from the server using a HTTP POST request. + * + * @param url A string containing the URL to which the request is sent. + * @param data A plain object or string that is sent to the server with the request. + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but + * can be null in that case. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + * @see {@link https://api.jquery.com/jQuery.post/} + * @since 1.0 + */ + post(url: string, + data: JQuery.PlainObject | string, + success: JQuery.jqXHR.DoneCallback | null, + dataType?: string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP POST request. + * + * @param url A string containing the URL to which the request is sent. + * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but + * can be null in that case. + * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). + * @see {@link https://api.jquery.com/jQuery.post/} + * @since 1.0 + */ + post(url: string, + success: JQuery.jqXHR.DoneCallback | null, + dataType: string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP POST request. + * + * @param url A string containing the URL to which the request is sent. + * @param success_data A callback function that is executed if the request succeeds. Required if dataType is provided, but + * can be null in that case. + * A plain object or string that is sent to the server with the request. + * @see {@link https://api.jquery.com/jQuery.post/} + * @since 1.0 + */ + post(url: string, + success_data: JQuery.jqXHR.DoneCallback | JQuery.PlainObject | string): JQuery.jqXHR; + /** + * Load data from the server using a HTTP POST request. + * + * @param url_settings A string containing the URL to which the request is sent. + * A set of key/value pairs that configure the Ajax request. All properties except for url are + * optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) for a + * complete list of all settings. Type will automatically be set to POST. + * @see {@link https://api.jquery.com/jQuery.post/} + * @since 1.0 + * @since 1.12 + * @since 2.2 + */ + post(url_settings?: string | JQuery.AjaxSettings): JQuery.jqXHR; + /** + * Takes a function and returns a new one that will always have a particular context. + * + * @param fn The function whose context will be changed. + * @param context The object to which the context (this) of the function should be set. + * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. + * @see {@link https://api.jquery.com/jQuery.proxy/} + * @since 1.4 + * @since 1.6 + */ + proxy(fn: Function, context: object, ...additionalArguments: any[]): Function; + /** + * Takes a function and returns a new one that will always have a particular context. + * + * @param context The object to which the context of the function should be set. + * @param name The name of the function whose context will be changed (should be a property of the context object). + * @param additionalArguments Any number of arguments to be passed to the function named in the name argument. + * @see {@link https://api.jquery.com/jQuery.proxy/} + * @since 1.4 + * @since 1.6 + */ + proxy(context: T, name: keyof T, ...additionalArguments: any[]): Function; + /** + * Manipulate the queue of functions to be executed on the matched element. + * + * @param element A DOM element where the array of queued functions is attached. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @param newQueue The new function to add to the queue. + * An array of functions to replace the current queue contents. + * @see {@link https://api.jquery.com/jQuery.queue/} + * @since 1.3 + */ + queue(element: Element, queueName: string, newQueue: JQuery.TypeOrArray>): JQuery; + /** + * Show the queue of functions to be executed on the matched element. + * + * @param element A DOM element to inspect for an attached queue. + * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. + * @see {@link https://api.jquery.com/jQuery.queue/} + * @since 1.3 + */ + queue(element: Element, queueName?: string): JQuery.Queue; + /** + * Handles errors thrown synchronously in functions wrapped in jQuery(). + * + * @param error An error thrown in the function wrapped in jQuery(). + * @see {@link https://api.jquery.com/jQuery.readyException/} + * @since 3.1 + */ + readyException(error: Error): any; + /** + * Remove a previously-stored piece of data. + * + * @param element A DOM element from which to remove data. + * @param name A string naming the piece of data to remove. + * @see {@link https://api.jquery.com/jQuery.removeData/} + * @since 1.2.3 + */ + removeData(element: Element, name?: string): JQuery; + /** + * Creates an object containing a set of properties ready to be used in the definition of custom animations. + * + * @param duration A string or number determining how long the animation will run. + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/jQuery.speed/} + * @since 1.1 + */ + speed(duration: JQuery.Duration, easing: string, complete: (this: TElement) => void): JQuery.EffectsOptions; + /** + * Creates an object containing a set of properties ready to be used in the definition of custom animations. + * + * @param easing A string indicating which easing function to use for the transition. + * @param complete A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/jQuery.speed/} + * @since 1.1 + */ + speed(easing: string, complete: (this: TElement) => void): JQuery.EffectsOptions; + /** + * Creates an object containing a set of properties ready to be used in the definition of custom animations. + * + * @param duration A string or number determining how long the animation will run. + * @param easing_complete_settings A string indicating which easing function to use for the transition. + * A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/jQuery.speed/} + * @since 1.0 + * @since 1.1 + */ + speed(duration: JQuery.Duration, + easing_complete_settings: string | ((this: TElement) => void) | JQuery.SpeedSettings): JQuery.EffectsOptions; + /** + * Creates an object containing a set of properties ready to be used in the definition of custom animations. + * + * @param duration_easing_complete_settings A string or number determining how long the animation will run. + * A string indicating which easing function to use for the transition. + * A function to call once the animation is complete, called once per matched element. + * @see {@link https://api.jquery.com/jQuery.speed/} + * @since 1.0 + * @since 1.1 + */ + speed(duration_easing_complete_settings?: JQuery.Duration | string | ((this: TElement) => void) | JQuery.SpeedSettings): JQuery.EffectsOptions; + /** + * Remove the whitespace from the beginning and end of a string. + * + * @param str The string to trim. + * @see {@link https://api.jquery.com/jQuery.trim/} + * @since 1.0 + */ + trim(str: string): string; + /** + * Determine the internal JavaScript [[Class]] of an object. + * + * @param obj Object to get the internal JavaScript [[Class]] of. + * @see {@link https://api.jquery.com/jQuery.type/} + * @since 1.4.3 + */ + type(obj: any): 'array' | 'boolean' | 'date' | 'error' | 'function' | 'null' | 'number' | 'object' | 'regexp' | 'string' | 'symbol' | 'undefined'; + /** + * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on + * arrays of DOM elements, not strings or numbers. + * + * @param array The Array of DOM elements. + * @see {@link https://api.jquery.com/jQuery.unique/} + * @since 1.1.3 + * @deprecated 3.0 + */ + unique(array: T[]): T[]; + /** + * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on + * arrays of DOM elements, not strings or numbers. + * + * @param array The Array of DOM elements. + * @see {@link https://api.jquery.com/jQuery.uniqueSort/} + * @since 1.12-2.2 + */ + uniqueSort(array: T[]): T[]; + when(jqxhr1: JQuery.jqXHR, jqxhr2: JQuery.jqXHR, jqxhr3: JQuery.jqXHR): JQuery.Promise<[T | U | V, string, JQuery.jqXHR]>; + when(jqxhr1: JQuery.jqXHR, jqxhr2: JQuery.jqXHR): JQuery.Promise<[T | U, string, JQuery.jqXHR]>; + when(jqxhr1: JQuery.jqXHR): JQuery.Promise>; + /** + * Provides a way to execute callback functions based on zero or more Thenable objects, usually + * Deferred objects that represent asynchronous events. + * + * @param deferreds Zero or more Thenable objects. + * @see {@link https://api.jquery.com/jQuery.when/} + * @since 1.5 + */ + when(...deferreds: any[]): JQuery.Promise; } +declare namespace JQuery { + type TypeOrArray = T | T[]; + + /** + * A string is designated htmlString in jQuery documentation when it is used to represent one or more + * DOM elements, typically to be created and inserted in the document. When passed as an argument of + * the jQuery() function, the string is identified as HTML if it starts with ) and is parsed + * as such until the final > character. Prior to jQuery 1.9, a string was considered to be HTML if it + * contained anywhere within the string. + */ + type htmlString = string; + /** + * A selector is used in jQuery to select DOM elements from a DOM document. That document is, in most + * cases, the DOM document present in all browsers, but can also be an XML document received via Ajax. + */ + type Selector = string; + + /** + * The PlainObject type is a JavaScript object containing zero or more key-value pairs. The plain + * object is, in other words, an Object object. It is designated "plain" in jQuery documentation to + * distinguish it from other kinds of JavaScript objects: for example, null, user-defined arrays, and + * host objects such as document, all of which have a typeof value of "object." + */ + interface PlainObject { + [key: string]: T; + } + + // region Ajax + + /** + * @see {@link http://api.jquery.com/jquery.ajax/#jQuery-ajax-settings} + */ + interface AjaxSettings { + /** + * A set of key/value pairs that map a given dataType to its MIME type, which gets sent in the Accept + * request header. This header tells the server what kind of response it will accept in return. + */ + accepts?: PlainObject; + /** + * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need + * synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests + * do not support synchronous operation. Note that synchronous requests may temporarily lock the + * browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: + * false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback + * options instead of the corresponding methods of the jqXHR object such as jqXHR.done(). + */ + async?: boolean; + /** + * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, + * XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and + * settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend + * function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless + * of the type of request. + */ + beforeSend?(this: TContext, jqXHR: jqXHR, settings: AjaxSettings): false | void; + /** + * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache + * to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" + * to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a + * POST is made to a URL that has already been requested by a GET. + */ + cache?: boolean; + /** + * A function to be called when the request finishes (after success and error callbacks are executed). + * The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a + * string categorizing the status of the request ("success", "notmodified", "nocontent", "error", + * "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of + * functions. Each function will be called in turn. This is an Ajax Event. + */ + complete?: TypeOrArray>; + /** + * An object of string/regular-expression pairs that determine how jQuery will parse the response, + * given its content type. + */ + contents?: PlainObject; + /** + * When sending data to the server, use this content type. Default is + * "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly + * pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). + * As of jQuery 1.6 you can pass false to tell jQuery to not set any content type header. Note: The W3C + * XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset + * will not force the browser to change the encoding. Note: For cross-domain requests, setting the + * content type to anything other than application/x-www-form-urlencoded, multipart/form-data, or + * text/plain will trigger the browser to send a preflight OPTIONS request to the server. + */ + contentType?: string | false; + /** + * This object will be the context of all Ajax-related callbacks. By default, the context is an object + * that represents the Ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax). + */ + context?: TContext; + /** + * An object containing dataType-to-dataType converters. Each converter's value is a function that + * returns the transformed value of the response. + */ + converters?: PlainObject<((value: any) => any) | true>; + /** + * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of + * crossDomain to true. This allows, for example, server-side redirection to another domain. + */ + crossDomain?: boolean; + /** + * Data to be sent to the server. It is converted to a query string, if not already a string. It's + * appended to the url for GET-requests. See processData option to prevent this automatic processing. + * Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same + * key based on the value of the traditional setting (described below). + */ + data?: PlainObject | string | any[]; + /** + * A function to be used to handle the raw response data of XMLHttpRequest. This is a pre-filtering + * function to sanitize the response. You should return the sanitized data. The function accepts two + * arguments: The raw data returned from the server and the 'dataType' parameter. + */ + dataFilter?(data: string, type: string): any; + /** + * The type of data that you're expecting back from the server. If none is specified, jQuery will try + * to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON + * will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be + * returned as a string). The available types (and the result passed as the first argument to your + * success callback) are: + * + * "xml": Returns a XML document that can be processed via jQuery. + * + * "html": Returns HTML as plain text; included script tags are evaluated when inserted in the DOM. + * + * "script": Evaluates the response as JavaScript and returns it as plain text. Disables caching by + * appending a query string parameter, _=[TIMESTAMP], to the URL unless the cache option is set to + * true. Note: This will turn POSTs into GETs for remote-domain requests. + * + * "json": Evaluates the response as JSON and returns a JavaScript object. Cross-domain "json" requests + * are converted to "jsonp" unless the request includes jsonp: false in its request options. The JSON + * data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of + * jQuery 1.9, an empty response is also rejected; the server should return a response of null or {} + * instead. (See json.org for more information on proper JSON formatting.) + * + * "jsonp": Loads in a JSON block using JSONP. Adds an extra "?callback=?" to the end of your URL to + * specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]", to + * the URL unless the cache option is set to true. + * + * "text": A plain text string. + * + * multiple, space-separated values: As of jQuery 1.5, jQuery can convert a dataType from what it + * received in the Content-Type header to what you require. For example, if you want a text response to + * be treated as XML, use "text xml" for the dataType. You can also make a JSONP request, have it + * received as text, and interpreted by jQuery as XML: "jsonp text xml". Similarly, a shorthand string + * such as "jsonp xml" will first attempt to convert from jsonp to xml, and, failing that, convert from + * jsonp to text, and then from text to xml. + */ + dataType?: 'xml' | 'html' | 'script' | 'json' | 'jsonp' | 'text' | string; + /** + * A function to be called if the request fails. The function receives three arguments: The jqXHR (in + * jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an + * optional exception object, if one occurred. Possible values for the second argument (besides null) + * are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives + * the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery + * 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: + * This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. + */ + error?: TypeOrArray>; + /** + * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to + * prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to + * control various Ajax Events. + */ + global?: boolean; + /** + * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest + * transport. The header X-Requested-With: XMLHttpRequest is always added, but its default + * XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from + * within the beforeSend function. + */ + headers?: PlainObject; + /** + * Allow the request to be successful only if the response has changed since the last request. This is + * done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery + * 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data. + */ + ifModified?: boolean; + /** + * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery + * does not recognize it as such by default. The following protocols are currently recognized as local: + * file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so + * once in the $.ajaxSetup() method. + */ + isLocal?: boolean; + /** + * Override the callback function name in a JSONP request. This value will be used instead of + * 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would + * result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false + * prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for + * transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, + * { jsonp: false, jsonpCallback: "callbackName" }. If you don't trust the target of your Ajax + * requests, consider setting the jsonp property to false for security reasons. + */ + jsonp?: string | boolean; + /** + * Specify the callback function name for a JSONP request. This value will be used instead of the + * random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name + * as it'll make it easier to manage the requests and provide callbacks and error handling. You may + * want to specify the callback when you want to enable better browser caching of GET requests. As of + * jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback + * is set to the return value of that function. + */ + jsonpCallback?: string | ((this: TContext) => string); + /** + * The HTTP method to use for the request (e.g. "POST", "GET", "PUT"). + */ + method?: string; + /** + * A mime type to override the XHR mime type. + */ + mimeType?: string; + /** + * A password to be used with XMLHttpRequest in response to an HTTP access authentication request. + */ + password?: string; + /** + * By default, data passed in to the data option as an object (technically, anything other than a + * string) will be processed and transformed into a query string, fitting to the default content-type + * "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, + * set this option to false. + */ + processData?: boolean; + /** + * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or + * "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. + * Used when the character set on the local page is not the same as the one on the remote script. + */ + scriptCharset?: string; + /** + * An object of numeric HTTP codes and functions to be called when the response has the corresponding + * code. + * + * If the request is successful, the status code functions take the same parameters as the success + * callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback. + */ + statusCode?: PlainObject | Ajax.ErrorCallback>; + /** + * A function to be called if the request succeeds. The function gets passed three arguments: The data + * returned from the server, formatted according to the dataType parameter or the dataFilter callback + * function, if specified; a string describing the status; and the jqXHR (in jQuery 1.4.x, + * XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each + * function will be called in turn. This is an Ajax Event. + */ + success?: TypeOrArray>; + /** + * Set a timeout (in milliseconds) for the request. A value of 0 means there will be no timeout. This + * will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the + * $.ajax call is made; if several other requests are in progress and the browser has no connections + * available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and + * below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any + * object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be + * cancelled by a timeout; the script will run even if it arrives after the timeout period. + */ + timeout?: number; + /** + * Set this to true if you wish to use the traditional style of param serialization. + */ + traditional?: boolean; + /** + * An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0. + */ + type?: string; + /** + * A string containing the URL to which the request is sent. + */ + url?: string; + /** + * A username to be used with XMLHttpRequest in response to an HTTP access authentication request. + */ + username?: string; + /** + * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), + * the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or + * enhancements to the factory. + */ + xhr?(): XMLHttpRequest; + /** + * An object of fieldName-fieldValue pairs to set on the native XHR object. + * + * In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS + * requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ + * should you require the use of it. + */ + xhrFields?: PlainObject; + } + + namespace Ajax { + type SuccessTextStatus = 'success' | 'notmodified' | 'nocontent'; + type ErrorTextStatus = 'timeout' | 'error' | 'abort' | 'parsererror'; + type TextStatus = SuccessTextStatus | ErrorTextStatus; + + interface SuccessCallback { + (this: TContext, data: any, textStatus: SuccessTextStatus, jqXHR: JQuery.jqXHR): void; + } + + interface ErrorCallback { + (this: TContext, jqXHR: jqXHR, textStatus: ErrorTextStatus | null, errorThrown: string): void; + } + + interface CompleteCallback { + (this: TContext, jqXHR: jqXHR, textStatus: SuccessTextStatus | ErrorTextStatus): void; + } + } + + interface Transport { + send(headers: PlainObject, completeCallback: Transport.SuccessCallback): void; + abort(): void; + } + + namespace Transport { + interface SuccessCallback { + (status: number, statusText: Ajax.TextStatus, responses?: PlainObject, headers?: string): void; + } + } + + /** + * @see {@link http://api.jquery.com/jquery.ajax/#jqXHR} + */ + interface jqXHR extends Pick { + responseJSON: any; + statusCode(map: PlainObject | Ajax.ErrorCallback>): void; + + /** + * Add handlers to be called when the Deferred object is either resolved or rejected. + * + * @param alwaysCallback A function, or array of functions, that is called when the Deferred is resolved or rejected. + * @param alwaysCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. + * @see {@link https://api.jquery.com/deferred.always/} + * @since 1.6 + */ + always(alwaysCallback: TypeOrArray>, + ...alwaysCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @param failFilter A function that is called when the Deferred is rejected. + * @see {@link https://api.jquery.com/deferred.catch/} + * @since 3.0 + */ + catch(failFilter: (reason: any) => UReject | Thenable): this; + /** + * Add handlers to be called when the Deferred object is resolved. + * + * @param doneCallback A function, or array of functions, that are called when the Deferred is resolved. + * @param doneCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. + * @see {@link https://api.jquery.com/deferred.done/} + * @since 1.5 + */ + done(doneCallback: TypeOrArray>, + ...doneCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @param failCallback A function, or array of functions, that are called when the Deferred is rejected. + * @param failCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. + * @see {@link https://api.jquery.com/deferred.fail/} + * @since 1.5 + */ + fail(failCallback: TypeOrArray, + ...failCallbacks: Array>): this; + /** + * Utility method to filter and/or chain Deferreds. + * + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see {@link https://api.jquery.com/deferred.pipe/} + * @since 1.6 + * @since 1.7 + * @deprecated 1.8 + */ + pipe(doneFilter: ((data: TResolve, textStatus: Ajax.SuccessTextStatus, jqXHR: this) => UResolve | Thenable) | null, + failFilter?: ((jqXHR: this, textStatus: Ajax.ErrorTextStatus, errorThrown: string) => UReject | Thenable) | null): jqXHR; + /** + * Add handlers to be called when the Deferred object generates progress notifications. + * + * @param progressCallback A function, or array of functions, to be called when the Deferred generates progress notifications. + * @param progressCallbacks Optional additional functions, or arrays of functions, to be called when the Deferred generates + * progress notifications. + * @see {@link https://api.jquery.com/deferred.progress/} + * @since 1.7 + */ + progress(progressCallback: TypeOrArray, + ...progressCallbacks: Array>): this; + /** + * Return a Deferred's Promise object. + * + * @param target Object onto which the promise methods have to be attached + * @see {@link https://api.jquery.com/deferred.promise/} + * @since 1.5 + */ + promise(target: TTarget): JQuery.Promise & TTarget; + /** + * Return a Deferred's Promise object. + * + * @see {@link https://api.jquery.com/deferred.promise/} + * @since 1.5 + */ + promise(): JQuery.Promise; + /** + * Determine the current state of a Deferred object. + * + * @see {@link https://api.jquery.com/deferred.state/} + * @since 1.7 + */ + state(): 'pending' | 'resolved' | 'rejected'; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * + * @param doneFilter A function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see {@link https://api.jquery.com/deferred.then/} + * @since 1.8 + */ + then(doneFilter: ((data: TResolve, textStatus: Ajax.SuccessTextStatus, jqXHR: this) => UResolve | Thenable) | null, + failFilter?: ((jqXHR: this, textStatus: Ajax.ErrorTextStatus, errorThrown: string) => UReject | Thenable) | null): jqXHR; + } + + namespace jqXHR { + interface DoneCallback { + (data: TResolve, textStatus: Ajax.SuccessTextStatus, jqXHR: jqXHR): void; + } + + interface FailCallback { + (jqXHR: this, textStatus: Ajax.ErrorTextStatus | null, errorThrown: string): void; + } + + interface AlwaysCallback { + (data_jqXHR: TResolve | jqXHR, textStatus: Ajax.TextStatus, jqXHR_errorThrown: jqXHR | string): void; + } + + interface ProgressCallback { + (...values: any[]): void; + } + } + + // endregion + + // region Callbacks + + interface Callbacks { + /** + * Add a callback or a collection of callbacks to a callback list. + * + * @param callbacks A function, or array of functions, that are to be added to the callback list. + * @see {@link https://api.jquery.com/callbacks.add/} + * @since 1.7 + */ + add(callbacks: TypeOrArray): this; + /** + * Disable a callback list from doing anything more. + * + * @see {@link https://api.jquery.com/callbacks.disable/} + * @since 1.7 + */ + disable(): this; + /** + * Determine if the callbacks list has been disabled. + * + * @see {@link https://api.jquery.com/callbacks.disabled/} + * @since 1.7 + */ + disabled(): boolean; + /** + * Remove all of the callbacks from a list. + * + * @see {@link https://api.jquery.com/callbacks.empty/} + * @since 1.7 + */ + empty(): this; + /** + * Call all of the callbacks with the given arguments. + * + * @param args The argument or list of arguments to pass back to the callback list. + * @see {@link https://api.jquery.com/callbacks.fire/} + * @since 1.7 + */ + fire(...args: any[]): this; + /** + * Call all callbacks in a list with the given context and arguments. + * + * @param context A reference to the context in which the callbacks in the list should be fired. + * @param args An argument, or array of arguments, to pass to the callbacks in the list. + * @see {@link https://api.jquery.com/callbacks.fireWith/} + * @since 1.7 + */ + fireWith(context?: object, args?: TypeOrArray): this; + /** + * Determine if the callbacks have already been called at least once. + * + * @see {@link https://api.jquery.com/callbacks.fired/} + * @since 1.7 + */ + fired(): boolean; + /** + * Determine whether or not the list has any callbacks attached. If a callback is provided as an + * argument, determine whether it is in a list. + * + * @param callback The callback to search for. + * @see {@link https://api.jquery.com/callbacks.has/} + * @since 1.7 + */ + has(callback?: Function): boolean; + /** + * Lock a callback list in its current state. + * + * @see {@link https://api.jquery.com/callbacks.lock/} + * @since 1.7 + */ + lock(): this; + /** + * Determine if the callbacks list has been locked. + * + * @see {@link https://api.jquery.com/callbacks.locked/} + * @since 1.7 + */ + locked(): boolean; + /** + * Remove a callback or a collection of callbacks from a callback list. + * + * @param callbacks A function, or array of functions, that are to be removed from the callback list. + * @see {@link https://api.jquery.com/callbacks.remove/} + * @since 1.7 + */ + remove(callbacks: TypeOrArray): this; + } + + // endregion + + // region CSS + + interface CSSHook { + get(this: this, elem: TElement, computed: any, extra: any): any; + set(this: this, elem: TElement, value: any): void; + } + + // endregion + + // region Deferred + + /** + * Any object that has a then method. + */ + interface Thenable extends PromiseLike { } + + interface Deferred { + /** + * Add handlers to be called when the Deferred object is either resolved or rejected. + * + * @param alwaysCallback A function, or array of functions, that is called when the Deferred is resolved or rejected. + * @param alwaysCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. + * @see {@link https://api.jquery.com/deferred.always/} + * @since 1.6 + */ + always(alwaysCallback: TypeOrArray>, + ...alwaysCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @param failFilter A function that is called when the Deferred is rejected. + * @see {@link https://api.jquery.com/deferred.catch/} + * @since 3.0 + */ + catch(failFilter: (...reasons: TReject[]) => UReject | Thenable): Deferred; + /** + * Add handlers to be called when the Deferred object is resolved. + * + * @param doneCallback A function, or array of functions, that are called when the Deferred is resolved. + * @param doneCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. + * @see {@link https://api.jquery.com/deferred.done/} + * @since 1.5 + */ + done(doneCallback: TypeOrArray>, + ...doneCallbacks: Array>>): this; + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @param failCallback A function, or array of functions, that are called when the Deferred is rejected. + * @param failCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. + * @see {@link https://api.jquery.com/deferred.fail/} + * @since 1.5 + */ + fail(failCallback: TypeOrArray>, + ...failCallbacks: Array>>): this; + /** + * Call the progressCallbacks on a Deferred object with the given args. + * + * @param args Optional arguments that are passed to the progressCallbacks. + * @see {@link https://api.jquery.com/deferred.notify/} + * @since 1.7 + */ + notify(...args: TNotify[]): this; + /** + * Call the progressCallbacks on a Deferred object with the given context and args. + * + * @param context Context passed to the progressCallbacks as the this object. + * @param args An optional array of arguments that are passed to the progressCallbacks. + * @see {@link https://api.jquery.com/deferred.notifyWith/} + * @since 1.7 + */ + notifyWith(context: object, ...args: TNotify[]): this; + /** + * Utility method to filter and/or chain Deferreds. + * + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see {@link https://api.jquery.com/deferred.pipe/} + * @since 1.6 + * @since 1.7 + * @deprecated 1.8 + */ + pipe(doneFilter: ((...values: TResolve[]) => UResolve | Thenable) | null, + failFilter?: ((...reasons: TReject[]) => UReject | Thenable) | null, + progressFilter?: ((...values: TNotify[]) => TNotify | Thenable) | null): Deferred; + /** + * Add handlers to be called when the Deferred object generates progress notifications. + * + * @param progressCallback A function, or array of functions, to be called when the Deferred generates progress notifications. + * @param progressCallbacks Optional additional functions, or arrays of functions, to be called when the Deferred generates + * progress notifications. + * @see {@link https://api.jquery.com/deferred.progress/} + * @since 1.7 + */ + progress(progressCallback: TypeOrArray>, + ...progressCallbacks: Array>>): this; + /** + * Return a Deferred's Promise object. + * + * @param target Object onto which the promise methods have to be attached + * @see {@link https://api.jquery.com/deferred.promise/} + * @since 1.5 + */ + promise(target: TTarget): JQuery.Promise & TTarget; + /** + * Return a Deferred's Promise object. + * + * @see {@link https://api.jquery.com/deferred.promise/} + * @since 1.5 + */ + promise(): JQuery.Promise; + /** + * Reject a Deferred object and call any failCallbacks with the given args. + * + * @param args Optional arguments that are passed to the failCallbacks. + * @see {@link https://api.jquery.com/deferred.reject/} + * @since 1.5 + */ + reject(...args: TReject[]): this; + /** + * Reject a Deferred object and call any failCallbacks with the given context and args. + * + * @param context Context passed to the failCallbacks as the this object. + * @param args An optional array of arguments that are passed to the failCallbacks. + * @see {@link https://api.jquery.com/deferred.rejectWith/} + * @since 1.5 + */ + rejectWith(context: object, ...args: TReject[]): this; + /** + * Resolve a Deferred object and call any doneCallbacks with the given args. + * + * @param args Optional arguments that are passed to the doneCallbacks. + * @see {@link https://api.jquery.com/deferred.resolve/} + * @since 1.5 + */ + resolve(...args: TResolve[]): this; + /** + * Resolve a Deferred object and call any doneCallbacks with the given context and args. + * + * @param context Context passed to the doneCallbacks as the this object. + * @param args An optional array of arguments that are passed to the doneCallbacks. + * @see {@link https://api.jquery.com/deferred.resolveWith/} + * @since 1.5 + */ + resolveWith(context: object, ...args: TResolve[]): this; + /** + * Determine the current state of a Deferred object. + * + * @see {@link https://api.jquery.com/deferred.state/} + * @since 1.7 + */ + state(): 'pending' | 'resolved' | 'rejected'; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * + * @param doneFilter A function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see {@link https://api.jquery.com/deferred.then/} + * @since 1.8 + */ + then(doneFilter: ((...values: TResolve[]) => UResolve | Thenable) | null, + failFilter?: ((...reasons: TReject[]) => UReject | Thenable) | null, + progressFilter?: ((...values: TNotify[]) => TNotify | Thenable) | null): Deferred; + } + + namespace Deferred { + interface DoneCallback { + (...values: TResolve[]): void; + } + + interface FailCallback { + (...reasons: TReject[]): void; + } + + interface AlwaysCallback { + (...values_reasons: Array): void; + } + + interface ProgressCallback { + (...values: TNotify[]): void; + } + } + + /** + * This object provides a subset of the methods of the Deferred object (then, done, fail, always, + * pipe, progress, state and promise) to prevent users from changing the state of the Deferred. + * + * @see {@link http://api.jquery.com/Types/#Promise} + */ + interface Promise extends Pick, + 'always' | 'done' | 'fail' | 'progress' | 'promise' | 'state'> { + /** + * Add handlers to be called when the Deferred object is rejected. + * + * @param failFilter A function that is called when the Deferred is rejected. + * @see {@link https://api.jquery.com/deferred.catch/} + * @since 3.0 + */ + catch(failFilter: (...reasons: TReject[]) => UReject | Thenable): Promise; + /** + * Utility method to filter and/or chain Deferreds. + * + * @param doneFilter An optional function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see {@link https://api.jquery.com/deferred.pipe/} + * @since 1.6 + * @since 1.7 + * @deprecated 1.8 + */ + pipe(doneFilter: ((...values: TResolve[]) => UResolve | Thenable) | null, + failFilter?: ((...reasons: TReject[]) => UReject | Thenable) | null, + progressFilter?: ((...values: TNotify[]) => TNotify | Thenable) | null): Promise; + /** + * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. + * + * @param doneFilter A function that is called when the Deferred is resolved. + * @param failFilter An optional function that is called when the Deferred is rejected. + * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. + * @see {@link https://api.jquery.com/deferred.then/} + * @since 1.8 + */ + then(doneFilter: ((...values: TResolve[]) => UResolve | Thenable) | null, + failFilter?: ((...reasons: TReject[]) => UReject | Thenable) | null, + progressFilter?: ((...values: TNotify[]) => TNotify | Thenable) | null): Promise; + } + + // endregion + + // region Effects + + type Duration = number | 'fast' | 'slow'; + type Queue = { 0: string; } & Array>; + + interface QueueFunction { + (this: TElement, next: () => void): void; + } + + /** + * @see {@link https://api.jquery.com/animate/#animate-properties-options} + */ + interface EffectsOptions { + /** + * A function to be called when the animation on an element completes or stops without completing (its + * Promise object is either resolved or rejected). + */ + always?(this: TElement, animation: JQuery.Promise, jumpedToEnd: boolean): void; + /** + * A function that is called once the animation on an element is complete. + */ + complete?(this: TElement): void; + /** + * A function to be called when the animation on an element completes (its Promise object is resolved). + */ + done?(this: TElement, animation: JQuery.Promise, jumpedToEnd: boolean): void; + /** + * A string or number determining how long the animation will run. + */ + duration?: Duration; + /** + * A string indicating which easing function to use for the transition. + */ + easing?: string; + /** + * A function to be called when the animation on an element fails to complete (its Promise object is rejected). + */ + fail?(this: TElement, animation: JQuery.Promise, jumpedToEnd: boolean): void; + /** + * A function to be called after each step of the animation, only once per animated element regardless + * of the number of animated properties. + */ + progress?(this: TElement, animation: JQuery.Promise, progress: number, remainingMs: number): void; + /** + * A Boolean indicating whether to place the animation in the effects queue. If false, the animation + * will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case + * the animation is added to the queue represented by that string. When a custom queue name is used the + * animation does not automatically start; you must call .dequeue("queuename") to start it. + */ + queue?: boolean | string; + /** + * An object containing one or more of the CSS properties defined by the properties argument and their + * corresponding easing functions. + */ + specialEasing?: PlainObject; + /** + * A function to call when the animation on an element begins. + */ + start?(this: TElement, animation: JQuery.Promise): void; + /** + * A function to be called for each animated property of each animated element. This function provides + * an opportunity to modify the Tween object to change the value of the property before it is set. + */ + step?(this: TElement, now: number, tween: Tween): void; + } + + interface SpeedSettings { + /** + * A string or number determining how long the animation will run. + */ + duration?: Duration; + /** + * A string indicating which easing function to use for the transition. + */ + easing?: string; + /** + * A function to call once the animation is complete. + */ + complete?(this: TElement): void; + } + + // Undocumented + // https://github.com/jquery/api.jquery.com/issues/391 + // https://github.com/jquery/api.jquery.com/issues/61 + class Tween { + easing: string; + elem: TElement; + end: number; + now: number; + options: EffectsOptions; + pos: number; + prop: string; + start: number; + unit: string; + } + + interface AnimationHook { + (fx: JQuery.Tween): void; + } + + // endregion + + // region Events + + class Event { + /** + * The current DOM element within the event bubbling phase. + * + * @see {@link https://api.jquery.com/event.currentTarget/} + * @since 1.3 + */ + currentTarget: TElement; + /** + * An optional object of data passed to an event method when the current executing handler is bound. + * + * @see {@link https://api.jquery.com/event.data/} + * @since 1.1 + */ + data: TData; + /** + * The element where the currently-called jQuery event handler was attached. + * + * @see {@link https://api.jquery.com/event.delegateTarget/} + * @since 1.7 + */ + delegateTarget: TElement; + /** + * Indicates whether the META key was pressed when the event fired. + * + * @see {@link https://api.jquery.com/event.metaKey/} + * @since 1.0.4 + */ + metaKey: boolean; + /** + * The namespace specified when the event was triggered. + * + * @see {@link https://api.jquery.com/event.namespace/} + * @since 1.4.3 + */ + namespace: string; + /** + * The mouse position relative to the left edge of the document. + * + * @see {@link https://api.jquery.com/event.pageX/} + * @since 1.0.4 + */ + pageX: number; + /** + * The mouse position relative to the top edge of the document. + * + * @see {@link https://api.jquery.com/event.pageY/} + * @since 1.0.4 + */ + pageY: number; + /** + * The other DOM element involved in the event, if any. + * + * @see {@link https://api.jquery.com/event.relatedTarget/} + * @since 1.1.4 + */ + relatedTarget: TElement | null; + /** + * 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/} + * @since 1.3 + */ + result: any; + /** + * The DOM element that initiated the event. + * + * @see {@link https://api.jquery.com/event.target/} + * @since 1.0 + */ + target: TElement; + /** + * The difference in milliseconds between the time the browser created the event and January 1, 1970. + * + * @see {@link https://api.jquery.com/event.timeStamp/} + * @since 1.2.6 + */ + timeStamp: number; + /** + * Describes the nature of the event. + * + * @see {@link https://api.jquery.com/event.type/} + * @since 1.0 + */ + type: string; + /** + * For key or mouse events, this property indicates the specific key or button that was pressed. + * + * @see {@link https://api.jquery.com/event.which/} + * @since 1.1.3 + */ + which: number; + + /** + * Returns whether event.preventDefault() was ever called on this event object. + * + * @see {@link https://api.jquery.com/event.isDefaultPrevented/} + * @since 1.3 + */ + isDefaultPrevented(): boolean; + + /** + * Returns whether event.stopImmediatePropagation() was ever called on this event object. + * + * @see {@link https://api.jquery.com/event.isImmediatePropagationStopped/} + * @since 1.3 + */ + isImmediatePropagationStopped(): boolean; + + /** + * Returns whether event.stopPropagation() was ever called on this event object. + * + * @see {@link https://api.jquery.com/event.isPropagationStopped/} + * @since 1.3 + */ + isPropagationStopped(): boolean; + + /** + * If this method is called, the default action of the event will not be triggered. + * + * @see {@link https://api.jquery.com/event.preventDefault/} + * @since 1.0 + */ + preventDefault(): void; + + /** + * Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree. + * + * @see {@link https://api.jquery.com/event.stopImmediatePropagation/} + * @since 1.3 + */ + stopImmediatePropagation(): void; + + /** + * Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. + * + * @see {@link https://api.jquery.com/event.stopPropagation/} + * @since 1.0 + */ + stopPropagation(): void; + } + + interface Event extends Partial> { + originalTarget?: TElement; + originalEvent: _Event; + new(event: string, properties?: T): JQuery.Event & T; + new(properties: T): JQuery.Event & T; + (event: string, properties?: T): JQuery.Event & T; + (properties: T): JQuery.Event & T; + } + + // Extra parameters can be passed from trigger() + interface EventHandler { + (this: TElement, eventObject: JQuery.Event, ...args: any[]): void | false | any; + } + + // Provided for convenience for use with jQuery.Event.which + const enum Mouse { + None = 0, + Left = 1, + Middle = 2, + Right = 3 + } + + // Provided for convenience for use with jQuery.Event.which + const enum Key { + Backspace = 8, + Tab = 9, + Enter = 13, + Shift = 16, + Control = 17, + Alt = 18, + CapsLock = 20, + Escape = 27, + Space = 32, + PageUp = 33, + PageDown = 34, + End = 35, + Home = 36, + ArrowLeft = 37, + ArrowUp = 38, + ArrowRight = 39, + ArrowDown = 40, + + Semicolon = 186, + Colon = 186, + EqualsSign = 187, + Plus = 187, + Comma = 188, + LessThanSign = 188, + Minus = 189, + Underscore = 189, + Period = 190, + GreaterThanSign = 190, + ForwardSlash = 191, + QuestionMark = 191, + Backtick = 192, + Tilde = 192, + OpeningSquareBracket = 219, + OpeningCurlyBrace = 219, + Backslash = 220, + Pipe = 220, + ClosingSquareBracket = 221, + ClosingCurlyBrace = 221, + SingleQuote = 222, + DoubleQuote = 222, + + Pause = 19, + PrintScreen = 44, + Insert = 45, + Delete = 46, + Num0 = 48, + Num1 = 49, + Num2 = 50, + Num3 = 51, + Num4 = 52, + Num5 = 53, + Num6 = 54, + Num7 = 55, + Num8 = 56, + Num9 = 57, + A = 65, + B = 66, + C = 67, + D = 68, + E = 69, + F = 70, + G = 71, + H = 72, + I = 73, + J = 74, + K = 75, + L = 76, + M = 77, + N = 78, + O = 79, + P = 80, + Q = 81, + R = 82, + S = 83, + T = 84, + U = 85, + V = 86, + W = 87, + X = 88, + Y = 89, + Z = 90, + MetaLeft = 91, + MetaRight = 92, + ContextMenu = 93, + Numpad0 = 96, + Numpad1 = 97, + Numpad2 = 98, + Numpad3 = 99, + Numpad4 = 100, + Numpad5 = 101, + Numpad6 = 102, + Numpad7 = 103, + Numpad8 = 104, + Numpad9 = 105, + NumpadMultiply = 106, + NumpadAdd = 107, + NumpadSubtract = 109, + NumpadDecimal = 110, + NumpadDivide = 111, + F1 = 112, + F2 = 113, + F3 = 114, + F4 = 115, + F5 = 116, + F6 = 117, + F7 = 118, + F8 = 119, + F9 = 120, + F10 = 121, + F11 = 122, + F12 = 123, + NumLock = 144, + ScrollLock = 145 + } + + // endregion + + interface NameValuePair { + name: string; + value: string; + } + + interface Coordinates { + left: number; + top: number; + } + + interface ValHook { + get?(elem: TElement): any; + set?(elem: TElement, value: any): any; + } +} + +// region Legacy types + +interface JQueryCallback extends JQuery.Callbacks { } +interface JQueryDeferred extends JQuery.Deferred { } +interface JQueryEventObject extends JQuery.Event { } +interface JQueryEventConstructor extends JQuery.Event { } +interface JQueryDeferred extends JQuery.Deferred { } +interface JQueryAjaxSettings extends JQuery.AjaxSettings { } +interface JQueryAnimationOptions extends JQuery.EffectsOptions { } +interface JQueryCoordinates extends JQuery.Coordinates { } +interface JQueryGenericPromise extends JQuery.Thenable { } +interface JQueryXHR extends JQuery.jqXHR { } +interface JQueryPromise extends JQuery.Promise { } +interface JQuerySerializeArrayElement extends JQuery.NameValuePair { } + /** - * Interface for the JQuery promise/deferred callbacks + * @deprecated 1.9 + */ +interface JQuerySupport extends JQuery.PlainObject { } + +// Legacy types that are not represented in the current type definitions are marked deprecated. + +/** + * @deprecated */ interface JQueryPromiseCallback { (value?: T, ...args: any[]): void; } - -interface JQueryPromiseOperator { - (callback1: JQueryPromiseCallback|JQueryPromiseCallback[], ...callbacksN: Array|JQueryPromiseCallback[]>): JQueryPromise; -} - /** - * Interface for the JQuery promise, part of callbacks - * @see {@link https://api.jquery.com/category/deferred-object/} + * @deprecated */ -interface JQueryPromise extends JQueryGenericPromise { +interface JQueryParam { /** - * Determine the current state of a Deferred object. - * @see {@link https://api.jquery.com/deferred.state/} - */ - state(): string; - /** - * Add handlers to be called when the Deferred object is either resolved or rejected. + * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. * - * @param alwaysCallback1 A function, or array of functions, that is called when the Deferred is resolved or rejected. - * @param alwaysCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. - * @see {@link https://api.jquery.com/deferred.always/} + * @param obj An array or object to serialize. + * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is resolved. - * - * @param doneCallback1 A function, or array of functions, that are called when the Deferred is resolved. - * @param doneCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - * @see {@link https://api.jquery.com/deferred.done/} - */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is rejected. - * - * @param failCallback1 A function, or array of functions, that are called when the Deferred is rejected. - * @param failCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - * @see {@link https://api.jquery.com/deferred.fail/} - */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; - /** - * Add handlers to be called when the Deferred object generates progress notifications. - * - * @param progressCallback1 A function, or array of functions, to be called when the Deferred generates progress notifications. - * @param progressCallbackN Optional additional functions, or arrays of functions, to be called when the Deferred generates progress notifications. - * @see {@link https://api.jquery.com/deferred.progress/} - */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryPromise; - - // Deprecated - given no typings - pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; - - /** - * Return a Deferred's Promise object. - * - * @param target Object onto which the promise methods have to be attached - * @see {@link https://api.jquery.com/deferred.promise/} - */ - promise(target?: any): JQueryPromise; + (obj: any, traditional?: boolean): string; } - /** - * Interface for the JQuery deferred, part of callbacks - * @see {@link https://api.jquery.com/category/deferred-object/} - */ -interface JQueryDeferred extends JQueryGenericPromise { - /** - * Determine the current state of a Deferred object. - * @see {@link https://api.jquery.com/deferred.state/} - */ - state(): string; - /** - * Add handlers to be called when the Deferred object is either resolved or rejected. - * - * @param alwaysCallback1 A function, or array of functions, that is called when the Deferred is resolved or rejected. - * @param alwaysCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected. - * @see {@link https://api.jquery.com/deferred.always/} - */ - always(alwaysCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...alwaysCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object is resolved. - * - * @param doneCallback1 A function, or array of functions, that are called when the Deferred is resolved. - * @param doneCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is resolved. - * @see {@link https://api.jquery.com/deferred.done/} - */ - done(doneCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...doneCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object is rejected. - * - * @param failCallback1 A function, or array of functions, that are called when the Deferred is rejected. - * @param failCallbackN Optional additional functions, or arrays of functions, that are called when the Deferred is rejected. - * @see {@link https://api.jquery.com/deferred.fail/} - */ - fail(failCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...failCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - /** - * Add handlers to be called when the Deferred object generates progress notifications. - * - * @param progressCallback1 A function, or array of functions, to be called when the Deferred generates progress notifications. - * @param progressCallbackN Optional additional functions, or arrays of functions, to be called when the Deferred generates progress notifications. - * @see {@link https://api.jquery.com/deferred.progress/} - */ - progress(progressCallback1?: JQueryPromiseCallback|JQueryPromiseCallback[], ...progressCallbackN: Array|JQueryPromiseCallback[]>): JQueryDeferred; - - /** - * Call the progressCallbacks on a Deferred object with the given args. - * - * @param args Optional arguments that are passed to the progressCallbacks. - * @see {@link https://api.jquery.com/deferred.notify/} - */ - notify(value?: any, ...args: any[]): JQueryDeferred; - - /** - * Call the progressCallbacks on a Deferred object with the given context and args. - * - * @param context Context passed to the progressCallbacks as the this object. - * @param args Optional arguments that are passed to the progressCallbacks. - * @see {@link https://api.jquery.com/deferred.notifyWith/} - */ - notifyWith(context: any, args?: any[]): JQueryDeferred; - - /** - * Reject a Deferred object and call any failCallbacks with the given args. - * - * @param args Optional arguments that are passed to the failCallbacks. - * @see {@link https://api.jquery.com/deferred.reject/} - */ - reject(value?: any, ...args: any[]): JQueryDeferred; - /** - * Reject a Deferred object and call any failCallbacks with the given context and args. - * - * @param context Context passed to the failCallbacks as the this object. - * @param args An optional array of arguments that are passed to the failCallbacks. - * @see {@link https://api.jquery.com/deferred.rejectWith/} - */ - rejectWith(context: any, args?: any[]): JQueryDeferred; - - /** - * Resolve a Deferred object and call any doneCallbacks with the given args. - * - * @param value First argument passed to doneCallbacks. - * @param args Optional subsequent arguments that are passed to the doneCallbacks. - * @see {@link https://api.jquery.com/deferred.resolve/} - */ - resolve(value?: T, ...args: any[]): JQueryDeferred; - - /** - * Resolve a Deferred object and call any doneCallbacks with the given context and args. - * - * @param context Context passed to the doneCallbacks as the this object. - * @param args An optional array of arguments that are passed to the doneCallbacks. - * @see {@link https://api.jquery.com/deferred.resolveWith/} - */ - resolveWith(context: any, args?: T[]): JQueryDeferred; - - /** - * Return a Deferred's Promise object. - * - * @param target Object onto which the promise methods have to be attached - * @see {@link https://api.jquery.com/deferred.promise/} - */ - promise(target?: any): JQueryPromise; - - // Deprecated - given no typings - pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise; -} - -/** - * Interface of the JQuery extension of the W3C event object - * @see {@link https://api.jquery.com/category/events/event-object/} + * @deprecated */ interface BaseJQueryEventObject extends Event { /** @@ -601,14 +4558,18 @@ interface BaseJQueryEventObject extends Event { */ metaKey: boolean; } - +/** + * @deprecated + */ interface JQueryInputEventObject extends BaseJQueryEventObject { altKey: boolean; ctrlKey: boolean; metaKey: boolean; shiftKey: boolean; } - +/** + * @deprecated + */ interface JQueryMouseEventObject extends JQueryInputEventObject { button: number; clientX: number; @@ -620,3198 +4581,35 @@ interface JQueryMouseEventObject extends JQueryInputEventObject { screenX: number; screenY: number; } - +/** + * @deprecated + */ interface JQueryKeyEventObject extends JQueryInputEventObject { char: any; charCode: number; key: any; keyCode: number; } - -interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject{ -} - /** - * A collection of properties that represent the presence of different browser features or bugs. - * - * Intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally - * to improve page startup performance. For your own project's feature-detection needs, we strongly recommend the - * use of an external library such as {@link http://modernizr.com/|Modernizr} instead of dependency on properties - * in jQuery.support. - * - * @deprecated since version 1.9 + * @deprecated */ -interface JQuerySupport { - ajax?: boolean; - boxModel?: boolean; - changeBubbles?: boolean; - checkClone?: boolean; - checkOn?: boolean; - cors?: boolean; - cssFloat?: boolean; - hrefNormalized?: boolean; - htmlSerialize?: boolean; - leadingWhitespace?: boolean; - noCloneChecked?: boolean; - noCloneEvent?: boolean; - opacity?: boolean; - optDisabled?: boolean; - optSelected?: boolean; - scriptEval? (): boolean; - style?: boolean; - submitBubbles?: boolean; - tbody?: boolean; +interface JQueryPromiseOperator { + (callback1: JQuery.TypeOrArray>, + ...callbacksN: Array>>): JQueryPromise; } - -interface JQueryParam { - /** - * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * - * @param obj An array or object to serialize. - */ - (obj: any): string; - - /** - * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * - * @param obj An array or object to serialize. - * @param traditional A Boolean indicating whether to perform a traditional "shallow" serialization. - */ - (obj: any, traditional: boolean): string; -} - /** - * The interface used to construct jQuery events (with $.Event). It is - * defined separately instead of inline in JQueryStatic to allow - * overriding the construction function with specific strings - * returning specific event objects. + * @deprecated */ -interface JQueryEventConstructor { - (name: string, eventProperties?: any): JQueryEventObject; - new (name: string, eventProperties?: any): JQueryEventObject; -} - -/** - * The interface used to specify coordinates. - */ -interface JQueryCoordinates { - left: number; - top: number; -} - -/** - * Elements in the array returned by serializeArray() - */ -interface JQuerySerializeArrayElement { - name: string; - value: string; -} - -/** - * @see {@link https://api.jquery.com/animate/} - */ -interface JQueryAnimationOptions { - /** - * A string or number determining how long the animation will run. - */ - duration?: any; - /** - * A string indicating which easing function to use for the transition. - */ - easing?: string; - /** - * A function to call once the animation is complete. - */ - complete?: Function; - /** - * A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set. - */ - step?: (now: number, tween: any) => any; - /** - * A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties. (version added: 1.8) - */ - progress?: (animation: JQueryPromise, progress: number, remainingMs: number) => any; - /** - * A function to call when the animation begins. (version added: 1.8) - */ - start?: (animation: JQueryPromise) => any; - /** - * A function to be called when the animation completes (its Promise object is resolved). (version added: 1.8) - */ - done?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; - /** - * A function to be called when the animation fails to complete (its Promise object is rejected). (version added: 1.8) - */ - fail?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; - /** - * A function to be called when the animation completes or stops without completing (its Promise object is either resolved or rejected). (version added: 1.8) - */ - always?: (animation: JQueryPromise, jumpedToEnd: boolean) => any; - /** - * A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it. - */ - queue?: any; - /** - * A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions. (version added: 1.4) - */ - specialEasing?: Object; -} - interface JQueryEasingFunction { - ( percent: number ): number; + (percent: number): number; } - +/** + * @deprecated + */ interface JQueryEasingFunctions { - [ name: string ]: JQueryEasingFunction; + [name: string]: JQueryEasingFunction; linear: JQueryEasingFunction; swing: JQueryEasingFunction; } -/** - * Static members of jQuery (those on $ and jQuery themselves) - * - * @see {@link https://api.jquery.com/Types/#jQuery} - */ -interface JQueryStatic { - - /** - * Perform an asynchronous HTTP (Ajax) request. - * - * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). - * @see {@link https://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings} - */ - ajax(settings: JQueryAjaxSettings): JQueryXHR; - /** - * Perform an asynchronous HTTP (Ajax) request. - * - * @param url A string containing the URL to which the request is sent. - * @param settings A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). - * @see {@link https://api.jquery.com/jQuery.ajax/#jQuery-ajax-url-settings} - */ - ajax(url: string, settings?: JQueryAjaxSettings): JQueryXHR; - - /** - * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). - * - * @param dataTypes An optional string containing one or more space-separated dataTypes - * @param handler A handler to set default values for future Ajax requests. - * @see {@link https://api.jquery.com/jQuery.ajaxPrefilter/} - */ - ajaxPrefilter(dataTypes: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; - /** - * Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax(). - * - * @param handler A handler to set default values for future Ajax requests. - * @see {@link https://api.jquery.com/jQuery.ajaxPrefilter/} - */ - ajaxPrefilter(handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; - - /** - * Creates an object that handles the actual transmission of Ajax data. - * - * @param dataType A string identifying the data type to use. - * @param handler A handler to return the new transport object to use with the data type provided in the first argument. - * @see {@link https://api.jquery.com/jQuery.ajaxTransport/} - */ - ajaxTransport(dataType: string, handler: (opts: any, originalOpts: JQueryAjaxSettings, jqXHR: JQueryXHR) => any): void; - - ajaxSettings: JQueryAjaxSettings; - - /** - * Set default values for future Ajax requests. Its use is not recommended. - * - * @param options A set of key/value pairs that configure the default Ajax request. All options are optional. - * @see {@link https://api.jquery.com/jQuery.ajaxSetup/} - */ - ajaxSetup(options: JQueryAjaxSettings): void; - - /** - * Load data from the server using a HTTP GET request. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). - * @see {@link https://api.jquery.com/jQuery.get/#jQuery-get-url-data-success-dataType} - */ - get(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP GET request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). - * @see {@link https://api.jquery.com/jQuery.get/#jQuery-get-url-data-success-dataType} - */ - get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP GET request. - * - * @param settings The JQueryAjaxSettings to be used for the request - * @see {@link https://api.jquery.com/jQuery.get/#jQuery-get-settings} - */ - get(settings : JQueryAjaxSettings): JQueryXHR; - /** - * Load JSON-encoded data from the server using a GET HTTP request. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. - * @see {@link https://api.jquery.com/jQuery.getJSON/} - */ - getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; - /** - * Load JSON-encoded data from the server using a GET HTTP request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. - * @see {@link https://api.jquery.com/jQuery.getJSON/} - */ - getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; - /** - * Load a JavaScript file from the server using a GET HTTP request, then execute it. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. - * @see {@link https://api.jquery.com/jQuery.getScript/} - */ - getScript(url: string, success?: (script: string, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; - - /** - * Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request. - * - * @see {@link https://api.jquery.com/jQuery.param/} - */ - param: JQueryParam; - - /** - * Load data from the server using a HTTP POST request. - * - * @param url A string containing the URL to which the request is sent. - * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - * @see {@link https://api.jquery.com/jQuery.post/#jQuery-post-url-data-success-dataType} - */ - post(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP POST request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - * @see {@link https://api.jquery.com/jQuery.post/#jQuery-post-url-data-success-dataType} - */ - post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP POST request. - * - * @param settings The JQueryAjaxSettings to be used for the request - * @see {@link https://api.jquery.com/jQuery.post/#jQuery-post-settings} - */ - post(settings : JQueryAjaxSettings): JQueryXHR; - /** - * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. - * - * @param flags An optional list of space-separated flags that change how the callback list behaves. - * @see {@link https://api.jquery.com/jQuery.Callbacks/} - */ - Callbacks(flags?: string): JQueryCallback; - - /** - * Holds or releases the execution of jQuery's ready event. - * - * @param hold Indicates whether the ready hold is being requested or released - * @see {@link https://api.jquery.com/jQuery.holdReady/} - */ - holdReady(hold: boolean): void; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param selector A string containing a selector expression - * @param context A DOM Element, Document, or jQuery to use as context - * @see {@link https://api.jquery.com/jQuery/#jQuery-selector-context} - */ - (selector: string, context?: Element|JQuery): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param element A DOM element to wrap in a jQuery object. - * @see {@link https://api.jquery.com/jQuery/#jQuery-element} - */ - (element: Element): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param elementArray An array containing a set of DOM elements to wrap in a jQuery object. - * @see {@link https://api.jquery.com/jQuery/#jQuery-elementArray} - */ - (elementArray: Element[]): JQuery; - - /** - * Binds a function to be executed when the DOM has finished loading. - * - * @param callback A function to execute after the DOM is ready. - * @see {@link https://api.jquery.com/jQuery/#jQuery-callback} - */ - (callback: (jQueryAlias?: JQueryStatic) => any): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param object A plain object to wrap in a jQuery object. - * @see {@link https://api.jquery.com/jQuery/#jQuery-object} - */ - (object: {}): JQuery; - - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param object An existing jQuery object to clone. - * @see {@link https://api.jquery.com/jQuery/#jQuery-object} - */ - (object: JQuery): JQuery; - - /** - * Specify a function to execute when the DOM is fully loaded. - * @see {@link https://api.jquery.com/jQuery/#jQuery} - */ - (): JQuery; - - /** - * Creates DOM elements on the fly from the provided string of raw HTML. - * - * @param html A string of HTML to create on the fly. Note that this parses HTML, not XML. - * @param ownerDocument A document in which the new elements will be created. - * @see {@link https://api.jquery.com/jQuery/#jQuery-html-ownerDocument} - */ - (html: string, ownerDocument?: Document): JQuery; - - /** - * Creates DOM elements on the fly from the provided string of raw HTML. - * - * @param html A string defining a single, standalone, HTML element (e.g.
or
). - * @param attributes An object of attributes, events, and methods to call on the newly-created element. - * @see {@link https://api.jquery.com/jQuery/#jQuery-html-attributes} - */ - (html: string, attributes: Object): JQuery; - - /** - * Relinquish jQuery's control of the $ variable. - * - * @param removeAll A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself). - * @see {@link https://api.jquery.com/jQuery.noConflict/} - */ - noConflict(removeAll?: boolean): JQueryStatic; - - /** - * Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events. - * - * @param deferreds One or more Deferred objects, or plain JavaScript objects. - * @see {@link https://api.jquery.com/jQuery.when/} - */ - when(...deferreds: Array/* as JQueryDeferred */>): JQueryPromise; - - /** - * Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties. - * @see {@link https://api.jquery.com/jQuery.cssHooks/} - */ - cssHooks: { [key: string]: any; }; - - /** - * An object containing all CSS properties that may be used without a unit. The .css() method uses this object to see if it may append px to unitless values. - * @see {@link https://api.jquery.com/jQuery.cssNumber/} - */ - cssNumber: any; - - /** - * Store arbitrary data associated with the specified element. Returns the value that was set. - * - * @param element The DOM element to associate with the data. - * @param key A string naming the piece of data to set. - * @param value The new data value. - * @see {@link https://api.jquery.com/jQuery.data/#jQuery-data-element-key-value} - */ - data(element: Element, key: string, value: T): T; - /** - * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. - * - * @param element The DOM element to associate with the data. - * @param key A string naming the piece of data to set. - * @see {@link https://api.jquery.com/jQuery.data/#jQuery-data-element-key} - */ - data(element: Element, key: string): any; - /** - * Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element. - * - * @param element The DOM element to associate with the data. - * @see {@link https://api.jquery.com/jQuery.data/#jQuery-data-element} - */ - data(element: Element): any; - - /** - * Execute the next function on the queue for the matched element. - * - * @param element A DOM element from which to remove and execute a queued function. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see {@link https://api.jquery.com/jQuery.dequeue/} - */ - dequeue(element: Element, queueName?: string): void; - - /** - * Determine whether an element has any jQuery data associated with it. - * - * @param element A DOM element to be checked for data. - * @see {@link https://api.jquery.com/jQuery.hasData/} - */ - hasData(element: Element): boolean; - - /** - * Show the queue of functions to be executed on the matched element. - * - * @param element A DOM element to inspect for an attached queue. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see {@link https://api.jquery.com/jQuery.queue/#jQuery-queue-element-queueName} - */ - queue(element: Element, queueName?: string): any[]; - /** - * Manipulate the queue of functions to be executed on the matched element. - * - * @param element A DOM element where the array of queued functions is attached. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param newQueue An array of functions to replace the current queue contents. - * @see {@link https://api.jquery.com/jQuery.queue/#jQuery-queue-element-queueName-newQueue} - */ - queue(element: Element, queueName: string, newQueue: Function[]): JQuery; - /** - * Manipulate the queue of functions to be executed on the matched element. - * - * @param element A DOM element on which to add a queued function. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param callback The new function to add to the queue. - * @see {@link https://api.jquery.com/jQuery.queue/#jQuery-queue-element-queueName-callback} - */ - queue(element: Element, queueName: string, callback: Function): JQuery; - - /** - * Remove a previously-stored piece of data. - * - * @param element A DOM element from which to remove data. - * @param name A string naming the piece of data to remove. - * @see {@link https://api.jquery.com/jQuery.removeData/} - */ - removeData(element: Element, name?: string): JQuery; - - /** - * A constructor function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. - * - * @param beforeStart A function that is called just before the constructor returns. - * @see {@link https://api.jquery.com/jQuery.Deferred/} - */ - Deferred(beforeStart?: (deferred: JQueryDeferred) => any): JQueryDeferred; - - /** - * Effects - */ - - easing: JQueryEasingFunctions; - - fx: { - tick: () => void; - /** - * The rate (in milliseconds) at which animations fire. - * @see {@link https://api.jquery.com/jQuery.fx.interval/} - */ - interval: number; - stop: () => void; - speeds: { slow: number; fast: number; }; - /** - * Globally disable all animations. - * @see {@link https://api.jquery.com/jQuery.fx.off/} - */ - off: boolean; - step: any; - }; - - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param func The function whose context will be changed. - * @param context The object to which the context (this) of the function should be set. - * @param additionalArguments Any number of arguments to be passed to the function referenced in the function argument. - * @see {@link https://api.jquery.com/jQuery.proxy/#jQuery-proxy-function-context-additionalArguments} - */ - proxy(func: (...args: any[]) => any, context: Object, ...additionalArguments: any[]): any; - /** - * Takes a function and returns a new one that will always have a particular context. - * - * @param context The object to which the context (this) of the function should be set. - * @param name The name of the function whose context will be changed (should be a property of the context object). - * @param additionalArguments Any number of arguments to be passed to the function named in the name argument. - * @see {@link https://api.jquery.com/jQuery.proxy/#jQuery-proxy-context-name-additionalArguments} - */ - proxy(context: Object, name: string, ...additionalArguments: any[]): any; - - Event: JQueryEventConstructor; - - /** - * Takes a string and throws an exception containing it. - * - * @param message The message to send out. - * @see {@link https://api.jquery.com/jQuery.error/} - */ - error(message: any): JQuery; - - expr: any; - readonly fn: JQuery; - - isReady: boolean; - - // Properties - support: JQuerySupport; - - /** - * Check to see if a DOM element is a descendant of another DOM element. - * - * @param container The DOM element that may contain the other element. - * @param contained The DOM element that may be contained by (a descendant of) the other element. - * @see {@link https://api.jquery.com/jQuery.contains/} - */ - contains(container: Element, contained: Element): boolean; - - /** - * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * - * @param collection The object or array to iterate over. - * @param callback The function that will be executed on every object. Will break the loop by returning false. - * @returns the first argument, the object that is iterated. - * @see {@link https://api.jquery.com/jQuery.each/#jQuery-each-array-callback} - */ - each( - collection: T[], - callback: (indexInArray: number, valueOfElement: T) => boolean | void - ): T[]; - - /** - * A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties. - * - * @param collection The object or array to iterate over. - * @param callback The function that will be executed on every object. Will break the loop by returning false. - * @returns the first argument, the object that is iterated. - * @see {@link https://api.jquery.com/jQuery.each/#jQuery-each-object-callback} - */ - each( - collection: T, - // TODO: `(keyInObject: keyof T, valueOfElement: T[keyof T])`, when TypeScript 2.1 allowed in repository - callback: (keyInObject: string, valueOfElement: any) => boolean | void - ): T; - - /** - * Merge the contents of two or more objects together into the first object. - * - * @param target An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument. - * @param object1 An object containing additional properties to merge in. - * @param objectN Additional objects containing properties to merge in. - * @see {@link https://api.jquery.com/jQuery.extend/#jQuery-extend-target-object1-objectN} - */ - extend(target: any, object1?: any, ...objectN: any[]): any; - /** - * Merge the contents of two or more objects together into the first object. - * - * @param deep If true, the merge becomes recursive (aka. deep copy). - * @param target The object to extend. It will receive the new properties. - * @param object1 An object containing additional properties to merge in. - * @param objectN Additional objects containing properties to merge in. - * @see {@link https://api.jquery.com/jQuery.extend/#jQuery-extend-deep-target-object1-objectN} - */ - extend(deep: boolean, target: any, object1?: any, ...objectN: any[]): any; - - /** - * Execute some JavaScript code globally. - * - * @param code The JavaScript code to execute. - * @see {@link https://api.jquery.com/jQuery.globalEval/} - */ - globalEval(code: string): any; - - /** - * Finds the elements of an array which satisfy a filter function. The original array is not affected. - * - * @param array The array to search through. - * @param func The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object. - * @param invert If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false. - * @see {@link https://api.jquery.com/jQuery.grep/} - */ - grep(array: T[], func: (elementOfArray?: T, indexInArray?: number) => boolean, invert?: boolean): T[]; - - /** - * Search for a specified value within an array and return its index (or -1 if not found). - * - * @param value The value to search for. - * @param array An array through which to search. - * @param fromIndex The index of the array at which to begin the search. The default is 0, which will search the whole array. - * @see {@link https://api.jquery.com/jQuery.inArray/} - */ - inArray(value: T, array: T[], fromIndex?: number): number; - - /** - * Determine whether the argument is an array. - * - * @param obj Object to test whether or not it is an array. - * @see {@link https://api.jquery.com/jQuery.isArray/} - */ - isArray(obj: any): obj is Array; - /** - * Check to see if an object is empty (contains no enumerable properties). - * - * @param obj The object that will be checked to see if it's empty. - * @see {@link https://api.jquery.com/jQuery.isEmptyObject/} - */ - isEmptyObject(obj: any): boolean; - /** - * Determine if the argument passed is a JavaScript function object. - * - * @param obj Object to test whether or not it is a function. - * @see {@link https://api.jquery.com/jQuery.isFunction/} - */ - isFunction(obj: any): obj is Function; - /** - * Determines whether its argument is a number. - * - * @param value The value to be tested. - * @see {@link https://api.jquery.com/jQuery.isNumeric/} - */ - isNumeric(value: any): boolean; - /** - * Check to see if an object is a plain object (created using "{}" or "new Object"). - * - * @param obj The object that will be checked to see if it's a plain object. - * @see {@link https://api.jquery.com/jQuery.isPlainObject/} - */ - isPlainObject(obj: any): boolean; - /** - * Determine whether the argument is a window. - * - * @param obj Object to test whether or not it is a window. - * @see {@link https://api.jquery.com/jQuery.isWindow/} - */ - isWindow(obj: any): obj is Window; - /** - * Check to see if a DOM node is within an XML document (or is an XML document). - * - * @param node The DOM node that will be checked to see if it's in an XML document. - * @see {@link https://api.jquery.com/jQuery.isXMLDoc/} - */ - isXMLDoc(node: Node): boolean; - - /** - * Convert an array-like object into a true JavaScript array. - * - * @param obj Any object to turn into a native Array. - * @see {@link https://api.jquery.com/jQuery.makeArray/} - */ - makeArray(obj: any): any[]; - - /** - * Translate all items in an array or object to new array of items. - * - * @param array The Array to translate. - * @param callback The function to process each item against. The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object. - * @see {@link https://api.jquery.com/jQuery.map/#jQuery-map-array-callback} - */ - map(array: T[], callback: (elementOfArray?: T, indexInArray?: number) => U): U[]; - /** - * Translate all items in an array or object to new array of items. - * - * @param arrayOrObject The Array or Object to translate. - * @param callback The function to process each item against. The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object. - * @see {@link https://api.jquery.com/jQuery.map/#jQuery-map-object-callback} - */ - map(arrayOrObject: any, callback: (value?: any, indexOrKey?: any) => any): any; - - /** - * Merge the contents of two arrays together into the first array. - * - * @param first The first array to merge, the elements of second added. - * @param second The second array to merge into the first, unaltered. - * @see {@link https://api.jquery.com/jQuery.merge/} - */ - merge(first: T[], second: T[]): T[]; - - /** - * An empty function. - * @see {@link https://api.jquery.com/jQuery.noop/} - */ - noop(): any; - - /** - * Return a number representing the current time. - * @see {@link https://api.jquery.com/jQuery.now/} - */ - now(): number; - - /** - * Takes a well-formed JSON string and returns the resulting JavaScript object. - * - * @param json The JSON string to parse. - * @see {@link https://api.jquery.com/jQuery.parseJSON/} - */ - parseJSON(json: string): any; - - /** - * Parses a string into an XML document. - * - * @param data a well-formed XML string to be parsed - * @see {@link https://api.jquery.com/jQuery.parseXML/} - */ - parseXML(data: string): XMLDocument; - - /** - * Remove the whitespace from the beginning and end of a string. - * - * @param str Remove the whitespace from the beginning and end of a string. - * @see {@link https://api.jquery.com/jQuery.trim/} - */ - trim(str: string): string; - - /** - * Determine the internal JavaScript [[Class]] of an object. - * - * @param obj Object to get the internal JavaScript [[Class]] of. - * @see {@link https://api.jquery.com/jQuery.type/} - */ - type(obj: any): "array" | "boolean" | "date" | "error" | "function" | "null" | "number" | "object" | "regexp" | "string" | "symbol" | "undefined"; - - /** - * Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers. - * - * @param array The Array of DOM elements. - * @see {@link https://api.jquery.com/jQuery.unique/} - */ - unique(array: T[]): T[]; - - /** - * Parses a string into an array of DOM nodes. - * - * @param data HTML string to be parsed - * @param context DOM element to serve as the context in which the HTML fragment will be created - * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string - * @see {@link https://api.jquery.com/jQuery.parseHTML/} - */ - parseHTML(data: string, context?: HTMLElement, keepScripts?: boolean): any[]; - - /** - * Parses a string into an array of DOM nodes. - * - * @param data HTML string to be parsed - * @param context DOM element to serve as the context in which the HTML fragment will be created - * @param keepScripts A Boolean indicating whether to include scripts passed in the HTML string - * @see {@link https://api.jquery.com/jQuery.parseHTML/} - */ - parseHTML(data: string, context?: Document, keepScripts?: boolean): any[]; -} - -/** - * The jQuery instance members - * - * @see {@link https://api.jquery.com/Types/#jQuery} - */ -interface JQuery { - /** - * Register a handler to be called when Ajax requests complete. This is an AjaxEvent. - * - * @param handler The function to be invoked. - * @see {@link https://api.jquery.com/ajaxComplete/} - */ - ajaxComplete(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: any) => any): JQuery; - /** - * Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event. - * - * @param handler The function to be invoked. - * @see {@link https://api.jquery.com/ajaxError/} - */ - ajaxError(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxSettings: JQueryAjaxSettings, thrownError: any) => any): JQuery; - /** - * Attach a function to be executed before an Ajax request is sent. This is an Ajax Event. - * - * @param handler The function to be invoked. - * @see {@link https://api.jquery.com/ajaxSend/} - */ - ajaxSend(handler: (event: JQueryEventObject, jqXHR: JQueryXHR, ajaxOptions: JQueryAjaxSettings) => any): JQuery; - /** - * Register a handler to be called when the first Ajax request begins. This is an Ajax Event. - * - * @param handler The function to be invoked. - * @see {@link https://api.jquery.com/ajaxStart/} - */ - ajaxStart(handler: () => any): JQuery; - /** - * Register a handler to be called when all Ajax requests have completed. This is an Ajax Event. - * - * @param handler The function to be invoked. - * @see {@link https://api.jquery.com/ajaxStop/} - */ - ajaxStop(handler: () => any): JQuery; - /** - * Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event. - * - * @param handler The function to be invoked. - * @see {@link https://api.jquery.com/ajaxSuccess/} - */ - ajaxSuccess(handler: (event: JQueryEventObject, XMLHttpRequest: XMLHttpRequest, ajaxOptions: JQueryAjaxSettings) => any): JQuery; - - /** - * Load data from the server and place the returned HTML into the matched element. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param complete A callback function that is executed when the request completes. - * @see {@link https://api.jquery.com/load/} - */ - load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery; - - /** - * Encode a set of form elements as a string for submission. - * @see {@link https://api.jquery.com/serialize/} - */ - serialize(): string; - /** - * Encode a set of form elements as an array of names and values. - * @see {@link https://api.jquery.com/serializeArray/} - */ - serializeArray(): JQuerySerializeArrayElement[]; - - /** - * Adds the specified class(es) to each of the set of matched elements. - * - * @param className One or more space-separated classes to be added to the class attribute of each matched element. - * @see {@link https://api.jquery.com/addClass/#addClass-className} - */ - addClass(className: string): JQuery; - /** - * Adds the specified class(es) to each of the set of matched elements. - * - * @param func A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/addClass/#addClass-function} - */ - addClass(func: (index: number, className: string) => string): JQuery; - - /** - * Add the previous set of elements on the stack to the current set, optionally filtered by a selector. - * @see {@link https://api.jquery.com/addBack/} - */ - addBack(selector?: string): JQuery; - - /** - * Get the value of an attribute for the first element in the set of matched elements. - * - * @param attributeName The name of the attribute to get. - * @see {@link https://api.jquery.com/attr/#attr-attributeName} - */ - attr(attributeName: string): string; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributeName The name of the attribute to set. - * @param value A value to set for the attribute. If this is `null`, the attribute will be deleted. - * @see {@link https://api.jquery.com/attr/#attr-attributeName-value} - */ - attr(attributeName: string, value: string|number|null): JQuery; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributeName The name of the attribute to set. - * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments. - * @see {@link https://api.jquery.com/attr/#attr-attributeName-function} - */ - attr(attributeName: string, func: (index: number, attr: string) => string|number): JQuery; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributes An object of attribute-value pairs to set. - * @see {@link https://api.jquery.com/attr/#attr-attributes} - */ - attr(attributes: Object): JQuery; - - /** - * Determine whether any of the matched elements are assigned the given class. - * - * @param className The class name to search for. - * @see {@link https://api.jquery.com/hasClass/} - */ - hasClass(className: string): boolean; - - /** - * Get the HTML contents of the first element in the set of matched elements. - * @see {@link https://api.jquery.com/html/#html} - */ - html(): string; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param htmlString A string of HTML to set as the content of each matched element. - * @see {@link https://api.jquery.com/html/#html-htmlString} - */ - html(htmlString: string): JQuery; - /** - * Set the HTML contents of each element in the set of matched elements. - * - * @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/html/#html-function} - */ - html(func: (index: number, oldhtml: string) => string): JQuery; - - /** - * Get the value of a property for the first element in the set of matched elements. - * - * @param propertyName The name of the property to get. - * @see {@link https://api.jquery.com/prop/#prop-propertyName} - */ - prop(propertyName: string): any; - /** - * Set one or more properties for the set of matched elements. - * - * @param propertyName The name of the property to set. - * @param value A value to set for the property. - * @see {@link https://api.jquery.com/prop/#prop-propertyName-value} - */ - prop(propertyName: string, value: string|number|boolean): JQuery; - /** - * Set one or more properties for the set of matched elements. - * - * @param properties An object of property-value pairs to set. - * @see {@link https://api.jquery.com/prop/#prop-properties} - */ - prop(properties: Object): JQuery; - /** - * Set one or more properties for the set of matched elements. - * - * @param propertyName The name of the property to set. - * @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element. - * @see {@link https://api.jquery.com/prop/#prop-propertyName-function} - */ - prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): JQuery; - - /** - * Remove an attribute from each element in the set of matched elements. - * - * @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes. - * @see {@link https://api.jquery.com/removeAttr/} - */ - removeAttr(attributeName: string): JQuery; - - /** - * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. - * - * @param className One or more space-separated classes to be removed from the class attribute of each matched element. - * @see {@link https://api.jquery.com/removeClass/#removeClass-className} - */ - removeClass(className?: string): JQuery; - /** - * Remove a single class, multiple classes, or all classes from each element in the set of matched elements. - * - * @param func A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments. - * @see {@link https://api.jquery.com/removeClass/#removeClass-function} - */ - removeClass(func: (index: number, className: string) => string): JQuery; - - /** - * Remove a property for the set of matched elements. - * - * @param propertyName The name of the property to remove. - * @see {@link https://api.jquery.com/removeProp/} - */ - removeProp(propertyName: string): JQuery; - - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param className One or more class names (separated by spaces) to be toggled for each element in the matched set. - * @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed. - * @see {@link https://api.jquery.com/toggleClass/#toggleClass-className} - */ - toggleClass(className: string, swtch?: boolean): JQuery; - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param swtch A boolean value to determine whether the class should be added or removed. - * @see {@link https://api.jquery.com/toggleClass/#toggleClass-state} - */ - toggleClass(swtch?: boolean): JQuery; - /** - * Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument. - * - * @param func A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments. - * @param swtch A boolean value to determine whether the class should be added or removed. - * @see {@link https://api.jquery.com/toggleClass/#toggleClass-function-state} - */ - toggleClass(func: (index: number, className: string, swtch: boolean) => string, swtch?: boolean): JQuery; - - /** - * Get the current value of the first element in the set of matched elements. - * @see {@link https://api.jquery.com/val/#val} - */ - val(): any; - /** - * Set the value of each element in the set of matched elements. - * - * @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked. - * @see {@link https://api.jquery.com/val/#val-value} - */ - val(value: string|string[]|number): JQuery; - /** - * Set the value of each element in the set of matched elements. - * - * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - * @see {@link https://api.jquery.com/val/#val-function} - */ - val(func: (index: number, value: string) => string): JQuery; - - /** - * Get the value of style properties for the first element in the set of matched elements. - * - * @param propertyName A CSS property. - * @see {@link https://api.jquery.com/css/#css-propertyName} - */ - css(propertyName: string): string; - /** - * Get the value of style properties for the first element in the set of matched elements. - * Results in an object of property-value pairs. - * - * @param propertyNames An array of one or more CSS properties. - * @see {@link https://api.jquery.com/css/#css-propertyNames} - */ - css(propertyNames: string[]): any; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A value to set for the property. - * @see {@link https://api.jquery.com/css/#css-propertyName-value} - */ - css(propertyName: string, value: string|number): JQuery; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - * @see {@link https://api.jquery.com/css/#css-propertyName-function} - */ - css(propertyName: string, value: (index: number, value: string) => string|number): JQuery; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param properties An object of property-value pairs to set. - * @see {@link https://api.jquery.com/css/#css-properties} - */ - css(properties: Object): JQuery; - - /** - * Get the current computed height for the first element in the set of matched elements. - * @see {@link https://api.jquery.com/height/#height} - */ - height(): number; - /** - * Set the CSS height of every matched element. - * - * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). - * @see {@link https://api.jquery.com/height/#height-value} - */ - height(value: number|string): JQuery; - /** - * Set the CSS height of every matched element. - * - * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/height/#height-function} - */ - height(func: (index: number, height: number) => number|string): JQuery; - - /** - * Get the current computed height for the first element in the set of matched elements, including padding but not border. - * @see {@link https://api.jquery.com/innerHeight/#innerHeight} - */ - innerHeight(): number; - - /** - * Sets the inner height on elements in the set of matched elements, including padding but not border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - * @see {@link https://api.jquery.com/innerHeight/#innerHeight-value} - */ - innerHeight(value: number|string): JQuery; - - /** - * Get the current computed width for the first element in the set of matched elements, including padding but not border. - * @see {@link https://api.jquery.com/innerWidth/#innerWidth} - */ - innerWidth(): number; - - /** - * Sets the inner width on elements in the set of matched elements, including padding but not border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - * @see {@link https://api.jquery.com/innerWidth/#innerWidth-value} - */ - innerWidth(value: number|string): JQuery; - - /** - * Get the current coordinates of the first element in the set of matched elements, relative to the document. - * @see {@link https://api.jquery.com/offset/#offset} - */ - offset(): JQueryCoordinates; - /** - * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. - * - * @param coordinates An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. - * @see {@link https://api.jquery.com/offset/#offset-coordinates} - */ - offset(coordinates: JQueryCoordinates): JQuery; - /** - * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. - * - * @param func A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties. - * @see {@link https://api.jquery.com/offset/#offset-function} - */ - offset(func: (index: number, coords: JQueryCoordinates) => JQueryCoordinates): JQuery; - - /** - * Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without "px") representation of the value or null if called on an empty set of elements. - * - * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. - * @see {@link https://api.jquery.com/outerHeight/#outerHeight-includeMargin} - */ - outerHeight(includeMargin?: boolean): number; - - /** - * Sets the outer height on elements in the set of matched elements, including padding and border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - * @see {@link https://api.jquery.com/outerHeight/#outerHeight-value} - */ - outerHeight(value: number|string): JQuery; - - /** - * Get the current computed width for the first element in the set of matched elements, including padding and border. - * - * @param includeMargin A Boolean indicating whether to include the element's margin in the calculation. - * @see {@link https://api.jquery.com/outerWidth/#outerWidth-includeMargin} - */ - outerWidth(includeMargin?: boolean): number; - - /** - * Sets the outer width on elements in the set of matched elements, including padding and border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - * @see {@link https://api.jquery.com/outerWidth/#outerWidth-value} - */ - outerWidth(value: number|string): JQuery; - - /** - * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. - * @see {@link https://api.jquery.com/position/} - */ - position(): JQueryCoordinates; - - /** - * Get the current horizontal position of the scroll bar for the first element in the set of matched elements or set the horizontal position of the scroll bar for every matched element. - * @see {@link https://api.jquery.com/scrollLeft/#scrollLeft} - */ - scrollLeft(): number; - /** - * Set the current horizontal position of the scroll bar for each of the set of matched elements. - * - * @param value An integer indicating the new position to set the scroll bar to. - * @see {@link https://api.jquery.com/scrollLeft/#scrollLeft-value} - */ - scrollLeft(value: number): JQuery; - - /** - * Get the current vertical position of the scroll bar for the first element in the set of matched elements or set the vertical position of the scroll bar for every matched element. - * @see {@link https://api.jquery.com/scrollTop/#scrollTop} - */ - scrollTop(): number; - /** - * Set the current vertical position of the scroll bar for each of the set of matched elements. - * - * @param value An integer indicating the new position to set the scroll bar to. - * @see {@link https://api.jquery.com/scrollTop/#scrollTop-value} - */ - scrollTop(value: number): JQuery; - - /** - * Get the current computed width for the first element in the set of matched elements. - * @see {@link https://api.jquery.com/width/#width} - */ - width(): number; - /** - * Set the CSS width of each element in the set of matched elements. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - * @see {@link https://api.jquery.com/width/#width-value} - */ - width(value: number|string): JQuery; - /** - * Set the CSS width of each element in the set of matched elements. - * - * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/width/#width-function} - */ - width(func: (index: number, width: number) => number|string): JQuery; - - /** - * Remove from the queue all items that have not yet been run. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see {@link https://api.jquery.com/clearQueue/} - */ - clearQueue(queueName?: string): JQuery; - - /** - * Store arbitrary data associated with the matched elements. - * - * @param key A string naming the piece of data to set. - * @param value The new data value; it can be any JavaScript type including Array or Object. - * @see {@link https://api.jquery.com/data/#data-key-value} - */ - data(key: string, value: any): JQuery; - /** - * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. - * - * @param key Name of the data stored. - * @see {@link https://api.jquery.com/data/#data-key} - */ - data(key: string): any; - /** - * Store arbitrary data associated with the matched elements. - * - * @param obj An object of key-value pairs of data to update. - * @see {@link https://api.jquery.com/data/#data-obj} - */ - data(obj: { [key: string]: any; }): JQuery; - /** - * Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute. - * @see {@link https://api.jquery.com/data/#data} - */ - data(): any; - - /** - * Execute the next function on the queue for the matched elements. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see {@link https://api.jquery.com/dequeue/} - */ - dequeue(queueName?: string): JQuery; - - /** - * Remove a previously-stored piece of data. - * - * @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete. - * @see {@link https://api.jquery.com/removeData/#removeData-name} - */ - removeData(name: string): JQuery; - /** - * Remove a previously-stored piece of data. - * - * @param list An array of strings naming the pieces of data to delete. - * @see {@link https://api.jquery.com/removeData/#removeData-list} - */ - removeData(list: string[]): JQuery; - /** - * Remove all previously-stored piece of data. - * @see {@link https://api.jquery.com/removeData/} - */ - removeData(): JQuery; - - /** - * Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished. - * - * @param type The type of queue that needs to be observed. (default: fx) - * @param target Object onto which the promise methods have to be attached - * @see {@link https://api.jquery.com/promise/} - */ - promise(type?: string, target?: Object): JQueryPromise; - - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/animate/#animate-properties-duration-easing-complete} - */ - animate(properties: Object, duration?: string|number, complete?: Function): JQuery; - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. (default: swing) - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/animate/#animate-properties-duration-easing-complete} - */ - animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): JQuery; - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/animate/#animate-properties-options} - */ - animate(properties: Object, options: JQueryAnimationOptions): JQuery; - - /** - * Set a timer to delay execution of subsequent items in the queue. - * - * @param duration An integer indicating the number of milliseconds to delay execution of the next item in the queue. - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see {@link https://api.jquery.com/delay/} - */ - delay(duration: number, queueName?: string): JQuery; - - /** - * Display the matched elements by fading them to opaque. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/fadeIn/#fadeIn-duration-complete} - */ - fadeIn(duration?: number|string, complete?: Function): JQuery; - /** - * Display the matched elements by fading them to opaque. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/fadeIn/#fadeIn-duration-easing-complete} - */ - fadeIn(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements by fading them to opaque. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/fadeIn/#fadeIn-options} - */ - fadeIn(options: JQueryAnimationOptions): JQuery; - - /** - * Hide the matched elements by fading them to transparent. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/fadeOut/#fadeOut-duration-complete} - */ - fadeOut(duration?: number|string, complete?: Function): JQuery; - /** - * Hide the matched elements by fading them to transparent. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/fadeOut/#fadeOut-duration-easing-complete} - */ - fadeOut(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements by fading them to transparent. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/fadeOut/#fadeOut-options} - */ - fadeOut(options: JQueryAnimationOptions): JQuery; - - /** - * Adjust the opacity of the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param opacity A number between 0 and 1 denoting the target opacity. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/fadeTo/#fadeTo-duration-opacity-complete} - */ - fadeTo(duration: string|number, opacity: number, complete?: Function): JQuery; - /** - * Adjust the opacity of the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param opacity A number between 0 and 1 denoting the target opacity. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/fadeTo/#fadeTo-duration-opacity-easing-complete} - */ - fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): JQuery; - - /** - * Display or hide the matched elements by animating their opacity. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/fadeToggle/#fadeToggle-duration-easing-complete} - */ - fadeToggle(duration?: number|string, complete?: Function): JQuery; - /** - * Display or hide the matched elements by animating their opacity. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/fadeToggle/#fadeToggle-duration-easing-complete} - */ - fadeToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements by animating their opacity. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/fadeToggle/#fadeToggle-options} - */ - fadeToggle(options: JQueryAnimationOptions): JQuery; - - /** - * Stop the currently-running animation, remove all queued animations, and complete all animations for the matched elements. - * - * @param queue The name of the queue in which to stop animations. - * @see {@link https://api.jquery.com/finish/} - */ - finish(queue?: string): JQuery; - - /** - * Hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/hide/#hide} - */ - hide(duration?: number|string, complete?: Function): JQuery; - /** - * Hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/hide/#hide-duration-easing-complete} - */ - hide(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/hide/#hide-options} - */ - hide(options: JQueryAnimationOptions): JQuery; - - /** - * Display the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/show/#show} - */ - show(duration?: number|string, complete?: Function): JQuery; - /** - * Display the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/show/#show-duration-easing-complete} - */ - show(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/show/#show-options} - */ - show(options: JQueryAnimationOptions): JQuery; - - /** - * Display the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/slideDown/#slideDown-duration-complete} - */ - slideDown(duration?: number|string, complete?: Function): JQuery; - /** - * Display the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/slideDown/#slideDown-duration-easing-complete} - */ - slideDown(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements with a sliding motion. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/slideDown/#slideDown-options} - */ - slideDown(options: JQueryAnimationOptions): JQuery; - - /** - * Display or hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/slideToggle/#slideToggle-duration-complete} - */ - slideToggle(duration?: number|string, complete?: Function): JQuery; - /** - * Display or hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/slideToggle/#slideToggle-duration-easing-complete} - */ - slideToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements with a sliding motion. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/slideToggle/#slideToggle-options} - */ - slideToggle(options: JQueryAnimationOptions): JQuery; - - /** - * Hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/slideUp/#slideUp-duration-complete} - */ - slideUp(duration?: number|string, complete?: Function): JQuery; - /** - * Hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/slideUp/#slideUp-duration-easing-complete} - */ - slideUp(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements with a sliding motion. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/slideUp/#slideUp-options} - */ - slideUp(options: JQueryAnimationOptions): JQuery; - - /** - * Stop the currently-running animation on the matched elements. - * - * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. - * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. - * @see {@link https://api.jquery.com/stop/#stop-clearQueue-jumpToEnd} - */ - stop(clearQueue?: boolean, jumpToEnd?: boolean): JQuery; - /** - * Stop the currently-running animation on the matched elements. - * - * @param queue The name of the queue in which to stop animations. - * @param clearQueue A Boolean indicating whether to remove queued animation as well. Defaults to false. - * @param jumpToEnd A Boolean indicating whether to complete the current animation immediately. Defaults to false. - * @see {@link https://api.jquery.com/stop/#stop-queue-clearQueue-jumpToEnd} - */ - stop(queue?: string, clearQueue?: boolean, jumpToEnd?: boolean): JQuery; - - /** - * Display or hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/toggle/#toggle-duration-complete} - */ - toggle(duration?: number|string, complete?: Function): JQuery; - /** - * Display or hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - * @see {@link https://api.jquery.com/toggle/#toggle-duration-easing-complete} - */ - toggle(duration?: number|string, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements. - * - * @param options A map of additional options to pass to the method. - * @see {@link https://api.jquery.com/toggle/#toggle-options} - */ - toggle(options: JQueryAnimationOptions): JQuery; - /** - * Display or hide the matched elements. - * - * @param showOrHide A Boolean indicating whether to show or hide the elements. - * @see {@link https://api.jquery.com/toggle/#toggle-display} - */ - toggle(showOrHide: boolean): JQuery; - - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler} - */ - bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler} - */ - bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param eventData An object containing data that will be passed to the event handler. - * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. - * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-preventBubble} - */ - bind(eventType: string, eventData: any, preventBubble: boolean): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names. - * @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true. - * @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-preventBubble} - */ - bind(eventType: string, preventBubble: boolean): JQuery; - /** - * Attach a handler to an event for the elements. - * - * @param events An object containing one or more DOM event types and functions to execute for them. - * @see {@link https://api.jquery.com/bind/#bind-events} - */ - bind(events: any): JQuery; - - /** - * Trigger the "blur" event on an element - * @see {@link https://api.jquery.com/blur/#blur} - */ - blur(): JQuery; - /** - * Bind an event handler to the "blur" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/blur/#blur-handler} - */ - blur(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "blur" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/blur/#blur-eventData-handler} - */ - blur(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "change" event on an element. - * @see {@link https://api.jquery.com/change/#change} - */ - change(): JQuery; - /** - * Bind an event handler to the "change" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/change/#change-handler} - */ - change(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "change" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/change/#change-eventData-handler} - */ - change(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "click" event on an element. - * @see {@link https://api.jquery.com/click/#click} - */ - click(): JQuery; - /** - * Bind an event handler to the "click" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/click/#click-handler} - */ - click(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "click" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/click/#click-eventData-handler} - */ - click(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "contextmenu" event on an element. - * @see {@link https://api.jquery.com/contextmenu/#contextmenu} - */ - contextmenu(): JQuery; - /** - * Bind an event handler to the "contextmenu" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/contextmenu/#contextmenu-handler} - */ - contextmenu(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "contextmenu" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/contextmenu/#contextmenu-eventData-handler} - */ - contextmenu(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "dblclick" event on an element. - * @see {@link https://api.jquery.com/dblclick/#dblclick} - */ - dblclick(): JQuery; - /** - * Bind an event handler to the "dblclick" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/dblclick/#dblclick-handler} - */ - dblclick(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "dblclick" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/dblclick/#dblclick-eventData-handler} - */ - dblclick(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. - * @see {@link https://api.jquery.com/delegate/#delegate-selector-eventType-handler} - */ - delegate(selector: any, eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements. - * @see {@link https://api.jquery.com/delegate/#delegate-selector-eventType-eventData-handler} - */ - delegate(selector: any, eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "focus" event on an element. - * @see {@link https://api.jquery.com/focus/#focus} - */ - focus(): JQuery; - /** - * Bind an event handler to the "focus" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focus/#focus-handler} - */ - focus(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "focus" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focus/#focus-eventData-handler} - */ - focus(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "focusin" event on an element. - * @see {@link https://api.jquery.com/focusin/#focusin} - */ - focusin(): JQuery; - /** - * Bind an event handler to the "focusin" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focusin/#focusin-handler} - */ - focusin(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "focusin" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focusin/#focusin-eventData-handler} - */ - focusin(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "focusout" event on an element. - * @see {@link https://api.jquery.com/focusout/#focusout} - */ - focusout(): JQuery; - /** - * Bind an event handler to the "focusout" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focusout/#focusout-handler} - */ - focusout(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "focusout" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/focusout/#focusout-eventData-handler} - */ - focusout(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements. - * - * @param handlerIn A function to execute when the mouse pointer enters the element. - * @param handlerOut A function to execute when the mouse pointer leaves the element. - * @see {@link https://api.jquery.com/hover/#hover-handlerIn-handlerOut} - */ - hover(handlerIn: (eventObject: JQueryEventObject) => any, handlerOut: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements. - * - * @param handlerInOut A function to execute when the mouse pointer enters or leaves the element. - * @see {@link https://api.jquery.com/hover/#hover-handlerInOut} - */ - hover(handlerInOut: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "keydown" event on an element. - * @see {@link https://api.jquery.com/keydown/#keydown} - */ - keydown(): JQuery; - /** - * Bind an event handler to the "keydown" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keydown/#keydown-handler} - */ - keydown(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; - /** - * Bind an event handler to the "keydown" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keydown/#keydown-eventData-handler} - */ - keydown(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; - - /** - * Trigger the "keypress" event on an element. - * @see {@link https://api.jquery.com/keypress/#keypress} - */ - keypress(): JQuery; - /** - * Bind an event handler to the "keypress" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keypress/#keypress-handler} - */ - keypress(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; - /** - * Bind an event handler to the "keypress" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keypress/#keypress-eventData-handler} - */ - keypress(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; - - /** - * Trigger the "keyup" event on an element. - * @see {@link https://api.jquery.com/keyup/#keyup} - */ - keyup(): JQuery; - /** - * Bind an event handler to the "keyup" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keyup/#keyup-handler} - */ - keyup(handler: (eventObject: JQueryKeyEventObject) => any): JQuery; - /** - * Bind an event handler to the "keyup" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/keyup/#keyup-eventData-handler} - */ - keyup(eventData?: any, handler?: (eventObject: JQueryKeyEventObject) => any): JQuery; - - /** - * Bind an event handler to the "load" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/load/} - */ - load(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "load" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/load/} - */ - load(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "mousedown" event on an element. - * @see {@link https://api.jquery.com/mousedown/#mousedown} - */ - mousedown(): JQuery; - /** - * Bind an event handler to the "mousedown" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mousedown/#mousedown-handler} - */ - mousedown(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mousedown" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mousedown/#mousedown-eventData-handler} - */ - mousedown(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseenter" event on an element. - * @see {@link https://api.jquery.com/mouseenter/#mouseenter} - */ - mouseenter(): JQuery; - /** - * Bind an event handler to be fired when the mouse enters an element. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseenter/#mouseenter-handler} - */ - mouseenter(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to be fired when the mouse enters an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseenter/#mouseenter-eventData-handler} - */ - mouseenter(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseleave" event on an element. - * @see {@link https://api.jquery.com/mouseleave/#mouseleave} - */ - mouseleave(): JQuery; - /** - * Bind an event handler to be fired when the mouse leaves an element. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseleave/#mouseleave-handler} - */ - mouseleave(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to be fired when the mouse leaves an element. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseleave/#mouseleave-eventData-handler} - */ - mouseleave(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mousemove" event on an element. - * @see {@link https://api.jquery.com/mousemove/#mousemove} - */ - mousemove(): JQuery; - /** - * Bind an event handler to the "mousemove" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mousemove/#mousemove-handler} - */ - mousemove(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mousemove" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mousemove/#mousemove-eventData-handler} - */ - mousemove(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseout" event on an element. - * @see {@link https://api.jquery.com/mouseout/#mouseout} - */ - mouseout(): JQuery; - /** - * Bind an event handler to the "mouseout" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseout/#mouseout-handler} - */ - mouseout(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mouseout" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseout/#mouseout-eventData-handler} - */ - mouseout(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseover" event on an element. - * @see {@link https://api.jquery.com/mouseover/#mouseover} - */ - mouseover(): JQuery; - /** - * Bind an event handler to the "mouseover" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseover/#mouseover-handler} - */ - mouseover(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mouseover" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseover/#mouseover-eventData-handler} - */ - mouseover(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Trigger the "mouseup" event on an element. - * @see {@link https://api.jquery.com/mouseup/#mouseup} - */ - mouseup(): JQuery; - /** - * Bind an event handler to the "mouseup" JavaScript event. - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseup/#mouseup-handler} - */ - mouseup(handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - /** - * Bind an event handler to the "mouseup" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/mouseup/#mouseup-eventData-handler} - */ - mouseup(eventData: Object, handler: (eventObject: JQueryMouseEventObject) => any): JQuery; - - /** - * Remove an event handler. - * @see {@link https://api.jquery.com/off/#off} - */ - off(): JQuery; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". - * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. - * @param handler A handler function previously attached for the event(s), or the special value false. - * @see {@link https://api.jquery.com/off/#off-events-selector-handler} - */ - off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". - * @param handler A handler function previously attached for the event(s), or the special value false. Takes handler with extra args that can be attached with on(). - * @see {@link https://api.jquery.com/off/#off-events-selector-handler} - */ - off(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; - /** - * Remove an event handler. - * - * @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin". - * @param handler A handler function previously attached for the event(s), or the special value false. - * @see {@link https://api.jquery.com/off/#off-events-selector-handler} - */ - off(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove an event handler. - * - * @param events An object where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s). - * @param selector A selector which should match the one originally passed to .on() when attaching event handlers. - * @see {@link https://api.jquery.com/off/#off-events-selector} - */ - off(events: { [key: string]: any; }, selector?: string): JQuery; - - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax). - * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} - */ - on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} - */ - on(events: string, data : any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} - */ - on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/on/#on-events-selector-data-handler} - */ - on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event occurs. - * @see {@link https://api.jquery.com/on/#on-events-selector-data} - */ - on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, selector?: string, data?: any): JQuery; - /** - * Attach an event handler function for one or more events to the selected elements. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param data Data to be passed to the handler in event.data when an event occurs. - * @see {@link https://api.jquery.com/on/#on-events-selector-data} - */ - on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, data?: any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. - * @param handler A function to execute at the time the event is triggered. - * @see {@link https://api.jquery.com/one/#one-events-data-handler} - */ - one(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names. - * @param data An object containing data that will be passed to the event handler. - * @param handler A function to execute at the time the event is triggered. - * @see {@link https://api.jquery.com/one/#one-events-data-handler} - */ - one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler} - */ - one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin". - * @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event is triggered. - * @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. - * @see {@link https://api.jquery.com/one/#one-events-selector-data-handler} - */ - one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element. - * @param data Data to be passed to the handler in event.data when an event occurs. - * @see {@link https://api.jquery.com/one/#one-events-selector-data} - */ - one(events: { [key: string]: any; }, selector?: string, data?: any): JQuery; - - /** - * Attach a handler to an event for the elements. The handler is executed at most once per element per event type. - * - * @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s). - * @param data Data to be passed to the handler in event.data when an event occurs. - * @see {@link https://api.jquery.com/one/#one-events-selector-data} - */ - one(events: { [key: string]: any; }, data?: any): JQuery; - - - /** - * Specify a function to execute when the DOM is fully loaded. - * - * @param handler A function to execute after the DOM is ready. - * @see {@link https://api.jquery.com/ready/} - */ - ready(handler: (jQueryAlias?: JQueryStatic) => any): JQuery; - - /** - * Trigger the "resize" event on an element. - * @see {@link https://api.jquery.com/resize/#resize} - */ - resize(): JQuery; - /** - * Bind an event handler to the "resize" JavaScript event. - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/resize/#resize-handler} - */ - resize(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "resize" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/resize/#resize-eventData-handler} - */ - resize(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "scroll" event on an element. - * @see {@link https://api.jquery.com/scroll/#scroll} - */ - scroll(): JQuery; - /** - * Bind an event handler to the "scroll" JavaScript event. - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/scroll/#scroll-handler} - */ - scroll(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "scroll" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/scroll/#scroll-eventData-handler} - */ - scroll(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "select" event on an element. - * @see {@link https://api.jquery.com/select/#select} - */ - select(): JQuery; - /** - * Bind an event handler to the "select" JavaScript event. - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/select/#select-handler} - */ - select(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "select" JavaScript event. - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/select/#select-eventData-handler} - */ - select(eventData: Object, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Trigger the "submit" event on an element. - * @see {@link https://api.jquery.com/submit/#submit} - */ - submit(): JQuery; - /** - * Bind an event handler to the "submit" JavaScript event - * - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/submit/#submit-handler} - */ - submit(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "submit" JavaScript event - * - * @param eventData An object containing data that will be passed to the event handler. - * @param handler A function to execute each time the event is triggered. - * @see {@link https://api.jquery.com/submit/#submit-eventData-handler} - */ - submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Execute all handlers and behaviors attached to the matched elements for the given event type. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param extraParameters Additional parameters to pass along to the event handler. - * @see {@link https://api.jquery.com/trigger/#trigger-eventType-extraParameters} - */ - trigger(eventType: string, extraParameters?: any[]|Object): JQuery; - /** - * Execute all handlers and behaviors attached to the matched elements for the given event type. - * - * @param event A jQuery.Event object. - * @param extraParameters Additional parameters to pass along to the event handler. - * @see {@link https://api.jquery.com/trigger/#trigger-event-extraParameters} - */ - trigger(event: JQueryEventObject, extraParameters?: any[]|Object): JQuery; - - /** - * Execute all handlers attached to an element for an event. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param extraParameters An array of additional parameters to pass along to the event handler. - * @see {@link https://api.jquery.com/triggerHandler/#triggerHandler-eventType-extraParameters} - */ - triggerHandler(eventType: string, ...extraParameters: any[]): Object; - - /** - * Execute all handlers attached to an element for an event. - * - * @param event A jQuery.Event object. - * @param extraParameters An array of additional parameters to pass along to the event handler. - * @see {@link https://api.jquery.com/triggerHandler/#triggerHandler-event-extraParameters} - */ - triggerHandler(event: JQueryEventObject, ...extraParameters: any[]): Object; - - /** - * Remove a previously-attached event handler from the elements. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param handler The function that is to be no longer executed. - * @see {@link https://api.jquery.com/unbind/#unbind-eventType-handler} - */ - unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove a previously-attached event handler from the elements. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ). - * @see {@link https://api.jquery.com/unbind/#unbind-eventType-false} - */ - unbind(eventType: string, fls: boolean): JQuery; - /** - * Remove a previously-attached event handler from the elements. - * - * @param evt A JavaScript event object as passed to an event handler. - * @see {@link https://api.jquery.com/unbind/#unbind-event} - */ - unbind(evt: any): JQuery; - - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * @see {@link https://api.jquery.com/undelegate/#undelegate} - */ - undelegate(): JQuery; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * - * @param selector A selector which will be used to filter the event results. - * @param eventType A string containing a JavaScript event type, such as "click" or "keydown" - * @param handler A function to execute at the time the event is triggered. - * @see {@link https://api.jquery.com/undelegate/#undelegate-selector-eventType} - */ - undelegate(selector: string, eventType: string, handler?: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * - * @param selector A selector which will be used to filter the event results. - * @param events An object of one or more event types and previously bound functions to unbind from them. - * @see {@link https://api.jquery.com/undelegate/#undelegate-selector-events} - */ - undelegate(selector: string, events: Object): JQuery; - /** - * Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements. - * - * @param namespace A string containing a namespace to unbind all events from. - * @see {@link https://api.jquery.com/undelegate/#undelegate-namespace} - */ - undelegate(namespace: string): JQuery; - - /** - * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/unload/#unload-handler} - */ - unload(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "unload" JavaScript event. (DEPRECATED from v1.8) - * - * @param eventData A plain object of data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/unload/#unload-eventData-handler} - */ - unload(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document. (DEPRECATED from v1.10) - * @see {@link https://api.jquery.com/context/} - */ - context: Element; - - jquery: string; - - /** - * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) - * - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/error/#error-handler} - */ - error(handler: (eventObject: JQueryEventObject) => any): JQuery; - /** - * Bind an event handler to the "error" JavaScript event. (DEPRECATED from v1.8) - * - * @param eventData A plain object of data that will be passed to the event handler. - * @param handler A function to execute when the event is triggered. - * @see {@link https://api.jquery.com/error/#error-eventData-handler} - */ - error(eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; - - /** - * Add a collection of DOM elements onto the jQuery stack. - * - * @param elements An array of elements to push onto the stack and make into a new jQuery object. - * @see {@link https://api.jquery.com/pushStack/#pushStack-elements} - */ - pushStack(elements: any[]): JQuery; - /** - * Add a collection of DOM elements onto the jQuery stack. - * - * @param elements An array of elements to push onto the stack and make into a new jQuery object. - * @param name The name of a jQuery method that generated the array of elements. - * @param arguments The arguments that were passed in to the jQuery method (for serialization). - * @see {@link https://api.jquery.com/pushStack/#pushStack-elements-name-arguments} - */ - pushStack(elements: any[], name: string, arguments: any[]): JQuery; - - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * @param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert after each element in the set of matched elements. - * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. - * @see {@link https://api.jquery.com/after/#after-content-content} - */ - after(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/after/#after-function} - */ - after(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * @param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. - * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. - * @see {@link https://api.jquery.com/append/#append-content-content} - */ - append(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/append/#append-function} - */ - append(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Insert every element in the set of matched elements to the end of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. - * @see {@link https://api.jquery.com/appendTo/} - */ - appendTo(target: JQuery|any[]|Element|string): JQuery; - - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * @param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert before each element in the set of matched elements. - * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. - * @see {@link https://api.jquery.com/before/#before-content-content} - */ - before(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/before/#before-function} - */ - before(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Create a deep copy of the set of matched elements. - * - * @param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. - * @param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false). - * @see {@link https://api.jquery.com/clone/} - */ - clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): JQuery; - - /** - * Remove the set of matched elements from the DOM. - * - * @param selector A selector expression that filters the set of matched elements to be removed. - * @see {@link https://api.jquery.com/detach/} - */ - detach(selector?: string): JQuery; - - /** - * Remove all child nodes of the set of matched elements from the DOM. - * @see {@link https://api.jquery.com/empty/} - */ - empty(): JQuery; - - /** - * Insert every element in the set of matched elements after the target. - * - * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. - * @see {@link https://api.jquery.com/insertAfter/} - */ - insertAfter(target: JQuery|any[]|Element|Text|string): JQuery; - - /** - * Insert every element in the set of matched elements before the target. - * - * @param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. - * @see {@link https://api.jquery.com/insertBefore/} - */ - insertBefore(target: JQuery|any[]|Element|Text|string): JQuery; - - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * @param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. - * @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. - * @see {@link https://api.jquery.com/prepend/#prepend-content-content} - */ - prepend(content1: JQuery|any[]|Element|DocumentFragment|Text|string, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/prepend/#prepend-function} - */ - prepend(func: (index: number, html: string) => string|Element|JQuery): JQuery; - - /** - * Insert every element in the set of matched elements to the beginning of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. - * @see {@link https://api.jquery.com/prependTo/} - */ - prependTo(target: JQuery|any[]|Element|string): JQuery; - - /** - * Remove the set of matched elements from the DOM. - * - * @param selector A selector expression that filters the set of matched elements to be removed. - * @see {@link https://api.jquery.com/remove/} - */ - remove(selector?: string): JQuery; - - /** - * Replace each target element with the set of matched elements. - * - * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. - * @see {@link https://api.jquery.com/replaceAll/} - */ - replaceAll(target: JQuery|any[]|Element|string): JQuery; - - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * @param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. - * @see {@link https://api.jquery.com/replaceWith/#replaceWith-newContent} - */ - replaceWith(newContent: JQuery|any[]|Element|Text|string): JQuery; - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * @param func A function that returns content with which to replace the set of matched elements. - * @see {@link https://api.jquery.com/replaceWith/#replaceWith-function} - */ - replaceWith(func: () => Element|JQuery): JQuery; - - /** - * Get the combined text contents of each element in the set of matched elements, including their descendants. - * @see {@link https://api.jquery.com/text/#text} - */ - text(): string; - /** - * Set the content of each element in the set of matched elements to the specified text. - * - * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation. - * @see {@link https://api.jquery.com/text/#text-text} - */ - text(text: string|number|boolean): JQuery; - /** - * Set the content of each element in the set of matched elements to the specified text. - * - * @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments. - * @see {@link https://api.jquery.com/text/#text-function} - */ - text(func: (index: number, text: string) => string): JQuery; - - /** - * Retrieve all the elements contained in the jQuery set, as an array. - * @name toArray - * @see {@link https://api.jquery.com/toArray/} - */ - toArray(): HTMLElement[]; - - /** - * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. - * @see {@link https://api.jquery.com/unwrap/} - */ - unwrap(): JQuery; - - /** - * Wrap an HTML structure around each element in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - * @see {@link https://api.jquery.com/wrap/#wrap-wrappingElement} - */ - wrap(wrappingElement: JQuery|Element|string): JQuery; - /** - * Wrap an HTML structure around each element in the set of matched elements. - * - * @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/wrap/#wrap-function} - */ - wrap(func: (index: number) => string|JQuery): JQuery; - - /** - * Wrap an HTML structure around all elements in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - * @see {@link https://api.jquery.com/wrapAll/#wrapAll-wrappingElement} - */ - wrapAll(wrappingElement: JQuery|Element|string): JQuery; - /** - * Wrap an HTML structure around all elements in the set of matched elements. - * - * @param func A callback function returning the HTML content or jQuery object to wrap around all the matched elements. Within the function, this refers to the first element in the set. - * @see {@link https://api.jquery.com/wrapAll/#wrapAll-function} - */ - wrapAll(func: (index: number) => string): JQuery; - - /** - * Wrap an HTML structure around the content of each element in the set of matched elements. - * - * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. - * @see {@link https://api.jquery.com/wrapInner/#wrapInner-wrappingElement} - */ - wrapInner(wrappingElement: JQuery|Element|string): JQuery; - /** - * Wrap an HTML structure around the content of each element in the set of matched elements. - * - * @param func A callback function which generates a structure to wrap around the content of the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set. - * @see {@link https://api.jquery.com/wrapInner/#wrapInner-function} - */ - wrapInner(func: (index: number) => string): JQuery; - - /** - * Iterate over a jQuery object, executing a function for each matched element. - * - * @param func A function to execute for each matched element. Can stop the loop by returning false. - * @see {@link https://api.jquery.com/each/} - */ - each(func: (index: number, elem: Element) => boolean | void): JQuery; - - /** - * Retrieve one of the elements matched by the jQuery object. - * - * @param index A zero-based integer indicating which element to retrieve. - * @see {@link https://api.jquery.com/get/#get-index} - */ - get(index: number): HTMLElement; - /** - * Retrieve the elements matched by the jQuery object. - * @alias toArray - * @see {@link https://api.jquery.com/get/#get} - */ - get(): HTMLElement[]; - - /** - * Search for a given element from among the matched elements. - * @see {@link https://api.jquery.com/index/#index} - */ - index(): number; - /** - * Search for a given element from among the matched elements. - * - * @param selector A selector representing a jQuery collection in which to look for an element. - * @see {@link https://api.jquery.com/index/#index-selector} - */ - index(selector: string|JQuery|Element): number; - - /** - * The number of elements in the jQuery object. - * @see {@link https://api.jquery.com/length/} - */ - length: number; - /** - * A selector representing selector passed to jQuery(), if any, when creating the original set. - * version deprecated: 1.7, removed: 1.9 - * @see {@link https://api.jquery.com/selector/} - */ - selector: string; - [index: number]: HTMLElement; - - /** - * Add elements to the set of matched elements. - * - * @param selector A string representing a selector expression to find additional elements to add to the set of matched elements. - * @param context The point in the document at which the selector should begin matching; similar to the context argument of the $(selector, context) method. - * @see {@link https://api.jquery.com/add/#add-selector} - */ - add(selector: string, context?: Element): JQuery; - /** - * Add elements to the set of matched elements. - * - * @param elements One or more elements to add to the set of matched elements. - * @see {@link https://api.jquery.com/add/#add-elements} - */ - add(...elements: Element[]): JQuery; - /** - * Add elements to the set of matched elements. - * - * @param html An HTML fragment to add to the set of matched elements. - * @see {@link https://api.jquery.com/add/#add-html} - */ - add(html: string): JQuery; - /** - * Add elements to the set of matched elements. - * - * @param obj An existing jQuery object to add to the set of matched elements. - * @see {@link https://api.jquery.com/add/#add-selection} - */ - add(obj: JQuery): JQuery; - - /** - * Get the children of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/children/} - */ - children(selector?: string): JQuery; - - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/closest/#closest-selector} - */ - closest(selector: string): JQuery; - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param selector A string containing a selector expression to match elements against. - * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. - * @see {@link https://api.jquery.com/closest/#closest-selector-context} - */ - closest(selector: string, context?: Element): JQuery; - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param obj A jQuery object to match elements against. - * @see {@link https://api.jquery.com/closest/#closest-selection} - */ - closest(obj: JQuery): JQuery; - /** - * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. - * - * @param element An element to match elements against. - * @see {@link https://api.jquery.com/closest/#closest-element} - */ - closest(element: Element): JQuery; - - /** - * Get an array of all the elements and selectors matched against the current element up through the DOM tree. - * - * @param selectors An array or string containing a selector expression to match elements against (can also be a jQuery object). - * @param context A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead. - * @see {@link https://api.jquery.com/closest/#closest-selectors-context} - */ - closest(selectors: any, context?: Element): any[]; - - /** - * Get the children of each element in the set of matched elements, including text and comment nodes. - * @see {@link https://api.jquery.com/contents/} - */ - contents(): JQuery; - - /** - * End the most recent filtering operation in the current chain and return the set of matched elements to its previous state. - * @see {@link https://api.jquery.com/end/} - */ - end(): JQuery; - - /** - * Reduce the set of matched elements to the one at the specified index. - * - * @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set. - * @see {@link https://api.jquery.com/eq/} - */ - eq(index: number): JQuery; - - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param selector A string containing a selector expression to match the current set of elements against. - * @see {@link https://api.jquery.com/filter/#filter-selector} - */ - filter(selector: string): JQuery; - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param func A function used as a test for each element in the set. this is the current DOM element. - * @see {@link https://api.jquery.com/filter/#filter-function} - */ - filter(func: (index: number, element: Element) => boolean): JQuery; - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param element An element to match the current set of elements against. - * @see {@link https://api.jquery.com/filter/#filter-elements} - */ - filter(element: Element): JQuery; - /** - * Reduce the set of matched elements to those that match the selector or pass the function's test. - * - * @param obj An existing jQuery object to match the current set of elements against. - * @see {@link https://api.jquery.com/filter/#filter-selection} - */ - filter(obj: JQuery): JQuery; - - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/find/#find-selector} - */ - find(selector: string): JQuery; - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * - * @param element An element to match elements against. - * @see {@link https://api.jquery.com/find/#find-element} - */ - find(element: Element): JQuery; - /** - * Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element. - * - * @param obj A jQuery object to match elements against. - * @see {@link https://api.jquery.com/find/#find-element} - */ - find(obj: JQuery): JQuery; - - /** - * Reduce the set of matched elements to the first in the set. - * @see {@link https://api.jquery.com/first/} - */ - first(): JQuery; - - /** - * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/has/#has-selector} - */ - has(selector: string): JQuery; - /** - * Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element. - * - * @param contained A DOM element to match elements against. - * @see {@link https://api.jquery.com/has/#has-contained} - */ - has(contained: Element): JQuery; - - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/is/#is-selector} - */ - is(selector: string): boolean; - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param func A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element. - * @see {@link https://api.jquery.com/is/#is-function} - */ - is(func: (index: number, element: Element) => boolean): boolean; - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param obj An existing jQuery object to match the current set of elements against. - * @see {@link https://api.jquery.com/is/#is-selection} - */ - is(obj: JQuery): boolean; - /** - * Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments. - * - * @param elements One or more elements to match the current set of elements against. - * @see {@link https://api.jquery.com/is/#is-elements} - */ - is(elements: any): boolean; - - /** - * Reduce the set of matched elements to the final one in the set. - * @see {@link https://api.jquery.com/last/} - */ - last(): JQuery; - - /** - * Pass each element in the current matched set through a function, producing a new jQuery object containing the return values. - * - * @param callback A function object that will be invoked for each element in the current set. - * @see {@link https://api.jquery.com/map/} - */ - map(callback: (index: number, domElement: Element) => any): JQuery; - - /** - * Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/next/} - */ - next(selector?: string): JQuery; - - /** - * Get all following siblings of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/nextAll/} - */ - nextAll(selector?: string): JQuery; - - /** - * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * - * @param selector A string containing a selector expression to indicate where to stop matching following sibling elements. - * @param filter A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/nextUntil/#nextUntil-selector-filter} - */ - nextUntil(selector?: string, filter?: string): JQuery; - /** - * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * - * @param element A DOM node or jQuery object indicating where to stop matching following sibling elements. - * @param filter A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/nextUntil/#nextUntil-element-filter} - */ - nextUntil(element?: Element, filter?: string): JQuery; - /** - * Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed. - * - * @param obj A DOM node or jQuery object indicating where to stop matching following sibling elements. - * @param filter A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/nextUntil/#nextUntil-element-filter} - */ - nextUntil(obj?: JQuery, filter?: string): JQuery; - - /** - * Remove elements from the set of matched elements. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/not/#not-selector} - */ - not(selector: string): JQuery; - /** - * Remove elements from the set of matched elements. - * - * @param func A function used as a test for each element in the set. this is the current DOM element. - * @see {@link https://api.jquery.com/not/#not-function} - */ - not(func: (index: number, element: Element) => boolean): JQuery; - /** - * Remove elements from the set of matched elements. - * - * @param elements One or more DOM elements to remove from the matched set. - * @see {@link https://api.jquery.com/not/#not-selection} - */ - not(elements: Element|Element[]): JQuery; - /** - * Remove elements from the set of matched elements. - * - * @param obj An existing jQuery object to match the current set of elements against. - * @see {@link https://api.jquery.com/not/#not-selection} - */ - not(obj: JQuery): JQuery; - - /** - * Get the closest ancestor element that is positioned. - * @see {@link https://api.jquery.com/offsetParent/} - */ - offsetParent(): JQuery; - - /** - * Get the parent of each element in the current set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/parent/} - */ - parent(selector?: string): JQuery; - - /** - * Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/parents/} - */ - parents(selector?: string): JQuery; - - /** - * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param selector A string containing a selector expression to indicate where to stop matching ancestor elements. - * @param filter A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/parentsUntil/#parentsUntil-selector-filter} - */ - parentsUntil(selector?: string, filter?: string): JQuery; - /** - * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param element A DOM node or jQuery object indicating where to stop matching ancestor elements. - * @param filter A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/parentsUntil/#parentsUntil-element-filter} - */ - parentsUntil(element?: Element, filter?: string): JQuery; - /** - * Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param obj A DOM node or jQuery object indicating where to stop matching ancestor elements. - * @param filter A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/parentsUntil/#parentsUntil-element-filter} - */ - parentsUntil(obj?: JQuery, filter?: string): JQuery; - - /** - * Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/prev/} - */ - prev(selector?: string): JQuery; - - /** - * Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/prevAll/} - */ - prevAll(selector?: string): JQuery; - - /** - * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param selector A string containing a selector expression to indicate where to stop matching preceding sibling elements. - * @param filter A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/prevUntil/#prevUntil-selector-filter} - */ - prevUntil(selector?: string, filter?: string): JQuery; - /** - * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param element A DOM node or jQuery object indicating where to stop matching preceding sibling elements. - * @param filter A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/prevUntil/#prevUntil-element-filter} - */ - prevUntil(element?: Element, filter?: string): JQuery; - /** - * Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object. - * - * @param obj A DOM node or jQuery object indicating where to stop matching preceding sibling elements. - * @param filter A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/prevUntil/#prevUntil-element-filter} - */ - prevUntil(obj?: JQuery, filter?: string): JQuery; - - /** - * Get the siblings of each element in the set of matched elements, optionally filtered by a selector. - * - * @param selector A string containing a selector expression to match elements against. - * @see {@link https://api.jquery.com/siblings/} - */ - siblings(selector?: string): JQuery; - - /** - * Reduce the set of matched elements to a subset specified by a range of indices. - * - * @param start An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set. - * @param end An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set. - * @see {@link https://api.jquery.com/slice/} - */ - slice(start: number, end?: number): JQuery; - - /** - * Show the queue of functions to be executed on the matched elements. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @see {@link https://api.jquery.com/queue/#queue-queueName} - */ - queue(queueName?: string): any[]; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param newQueue An array of functions to replace the current queue contents. - * @see {@link https://api.jquery.com/queue/#queue-queueName-newQueue} - */ - queue(newQueue: Function[]): JQuery; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. - * @see {@link https://api.jquery.com/queue/#queue-queueName-callback} - */ - queue(callback: Function): JQuery; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param newQueue An array of functions to replace the current queue contents. - * @see {@link https://api.jquery.com/queue/#queue-queueName-newQueue} - */ - queue(queueName: string, newQueue: Function[]): JQuery; - /** - * Manipulate the queue of functions to be executed, once for each matched element. - * - * @param queueName A string containing the name of the queue. Defaults to fx, the standard effects queue. - * @param callback The new function to add to the queue, with a function to call that will dequeue the next item. - * @see {@link https://api.jquery.com/queue/#queue-queueName-callback} - */ - queue(queueName: string, callback: Function): JQuery; - - /** - * Merge the contents of an object onto the jQuery prototype to provide new jQuery instance methods. - * - * @param object An object to merge onto the jQuery prototype. - * @see {@link https://api.jquery.com/jQuery.fn.extend/#jQuery-fn-extend-object} - */ - extend(object: { [method: string]: (...args: any[]) => any; }): JQuery; -} -declare module "jquery" { - export = $; -} -declare var jQuery: JQueryStatic; -declare var $: JQueryStatic; +// endregion diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index d2d58aa2a2..062b89f655 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -1,3552 +1,138 @@ - - -function test_add() { - $("p").add("div").addClass("widget"); - var pdiv = $("p").add("div"); - - $('li').add('p').css('background-color', 'red'); - $('li').add(document.getElementsByTagName('p')[0]) - .css('background-coailor', 'red'); - $('li').add('

new paragraph

') - .css('background-color', 'red'); - $("div").css("border", "2px solid red") - .add("p") - .css("background", "yellow"); - $("p").add("span").css("background", "yellow"); - $("p").clone().add("Again").appendTo(document.body); - $("p").add(document.getElementById("a")).css("background", "yellow"); - var collection = $("p"); - - collection = collection.add(document.getElementById("a")); - collection.css("background", "yellow"); -} - -function test_addClass() { - $("p").addClass("myClass yourClass"); - $("p").removeClass("myClass noClass").addClass("yourClass"); - $("ul li:last").addClass(function (index) { - return "item-" + index; - }); - $("p:last").addClass("selected"); - $("p:last").addClass("selected highlight"); - $("div").addClass(function (index, currentClass) { - var addedClass: string; - if (currentClass === "red") { - addedClass = "green"; - $("p").text("There is one green div"); +function JQuery() { + function iterable() { + for (const a of $('div')) { + a.textContent = 'myDiv'; } - return addedClass; - }); -} + } -function test_after() { - $('.inner').after('

Test

'); - $('
').after('

').after(document.createDocumentFragment()); - $('
').after('

').addClass('foo') - .filter('p').attr('id', 'bar').html('hello') - .end() - .appendTo('body'); - $('p').after(function () { - return '
' + this.className + '
'; - }); - var $newdiv1 = $('
'), - newdiv2 = document.createElement('div'), - existingdiv1 = document.getElementById('foo'); - $('p').first().after($newdiv1, [newdiv2, existingdiv1]); - $("p").after(document.createTextNode("Hello")); - $("p").after($("b")); -} + function arrayLike() { + $('div')[0] === new HTMLElement(); + } -function test_ajax() { - $.ajax({ - url: "test.html", - context: document.body - }).done(function () { - $(this).addClass("done"); - }); - $.ajax({ - statusCode: { - 404: function () { - alert("page not found"); - } + function on() { + function false_handler_shorthand() { + $().on('events', false); } - }); - $.ajax({ - url: "http://fiddle.jshell.net/favicon.png", - beforeSend: function (xhr) { - xhr.overrideMimeType("text/plain; charset=x-user-defined"); - } - }).done(function (data) { - if (console && console.log) { - console.log("Sample of data:", data.slice(0, 100)); - } - }); - $.ajax({ - url: 'ajax/test.html', - success: function (data) { - $('.result').html(data); - alert('Load was performed.'); - }, - error: function (jqXHR, textStatus, errorThrown) { - alert('Load failed. responseJSON=' + jqXHR.responseJSON); - } - }); - var _super = jQuery.ajaxSettings.xhr; - jQuery.ajaxSettings.xhr = function () { - var xhr = _super(), - getAllResponseHeaders = xhr.getAllResponseHeaders; - xhr.getAllResponseHeaders = function () { - if (getAllResponseHeaders()) { - return getAllResponseHeaders(); - } - - var allHeaders = ""; - var headersFieldNames = ["Cache-Control", "Content-Language", "Content-Type", - "Expires", "Last-Modified", "Pragma"]; - $(headersFieldNames).each(function (i, header_name) { - if (xhr.getResponseHeader(header_name)) { - allHeaders += header_name + ": " + xhr.getResponseHeader(header_name) + "\n"; - } + function typed_event_data() { + $('#myElement').on('custom', 45, (event, data) => { + event.data === 23; }); - return allHeaders; - }; - - return xhr; - }; - $.ajax({ - type: "POST", - url: "some.php", - data: { name: "John", location: "Boston" } - }).done(function (msg) { - alert("Data Saved: " + msg); - }); - $.ajax({ - method: "POST", - url: "some.php", - data: { name: "John", location: "Boston" } - }); - $.ajax({ - url: "test.html", - cache: false - }).done(function (html) { - $("#results").append(html); - }); - var xmlDocument = []; - var xmlRequest = $.ajax({ - url: "page.php", - processData: false, - data: xmlDocument - }); - var handleResponse; - xmlRequest.done(handleResponse); - - var menuId = $("ul.nav").first().attr("id"); - var request = $.ajax({ - url: "script.php", - type: "POST", - data: { id: menuId }, - dataType: "html" - }); - request.done(function (msg) { - $("#log").html(msg); - }); - request.fail(function (jqXHR, textStatus) { - alert("Request failed: " + textStatus); - }); - - $.ajax({ - type: "GET", - url: "test.js", - dataType: "script" - }); - - // Test the jqXHR object returned by $.ajax() as of 1.5 - // More details: http://api.jquery.com/jQuery.ajax/#jqXHR - - // done method - $.ajax({ - url: "test.js" - }).done((data, textStatus, jqXHR) => { - console.log(data, textStatus, jqXHR); - }); - - // then method can change promise type through promise chaining - var chainedValuePromise : JQueryPromise; - chainedValuePromise = $.ajax({ - url: "test.js" - }).then(() => $.when(1)); - - // fail method - $.ajax({ - url: "test.js" - }).fail((jqXHR, textStatus, errorThrown) => { - console.log(jqXHR, textStatus, errorThrown); - }); - - // always method with successful request - $.ajax({ - url: "test.js" - }).always((data, textStatus, jqXHR) => { - console.log(data, textStatus, jqXHR); - }); - - // always method with failed request - $.ajax({ - url: "test.js" - }).always((jqXHR, textStatus, errorThrown) => { - console.log(jqXHR, textStatus, errorThrown); - }); - - // then method (as of 1.8) - $.ajax({ - url: "test.js" - }).then((data, textStatus, jqXHR) => { - console.log(data, textStatus, jqXHR); - }, (jqXHR, textStatus, errorThrown) => { - console.log(jqXHR, textStatus, errorThrown); - }); - - // generic then method - var p: JQueryPromise = $.ajax({ url: "test.js" }) - .then(() => "Hello") - .then((x) => x.length); - - // jqXHR object - var jqXHR = $.ajax({ - url: "test.js" - }); - jqXHR.abort('aborting because I can'); - - //Test the promise exposed by the jqXHR object - - // done method - $.ajax({ - url: "test.js" - }).promise().done((data, textStatus, jqXHR) => { - console.log(data, textStatus, jqXHR); - }); - - // fail method - $.ajax({ - url: "test.js" - }).promise().fail((jqXHR, textStatus, errorThrown) => { - console.log(jqXHR, textStatus, errorThrown); - }); - - // always method with successful request - $.ajax({ - url: "test.js" - }).promise().always((data, textStatus, jqXHR) => { - console.log(data, textStatus, jqXHR); - }); - - // always method with failed request - $.ajax({ - url: "test.js" - }).promise().always((jqXHR, textStatus, errorThrown) => { - console.log(jqXHR, textStatus, errorThrown); - }); - - // then method (as of 1.8) - $.ajax({ - url: "test.js" - }).promise().then((data, textStatus, jqXHR) => { - console.log(data, textStatus, jqXHR); - }, (jqXHR, textStatus, errorThrown) => { - console.log(jqXHR, textStatus, errorThrown); - }); - - // generic then method - var p: JQueryPromise = $.ajax({ url: "test.js" }).promise() - .then(() => "Hello") - .then((x) => x.length); -} - -function test_ajaxComplete() { - $('.log').ajaxComplete(function () { - $(this).text('Triggered ajaxComplete handler.'); - }); - $('.trigger').click(function () { - $('.result').load('ajax/test.html'); - }); - $('.log').ajaxComplete(function (e, xhr, settings) { - if (settings.url == 'ajax/test.html') { - $(this).text('Triggered ajaxComplete handler. The result is ' + xhr.responseText); } - }); - $("#msg").ajaxComplete(function (event, request, settings) { - $(this).append("
  • Request Complete.
  • "); - }); + } } -function test_ajaxError() { - $("div.log").ajaxError(function () { - $(this).text("Triggered ajaxError handler."); - }); - $("button.trigger").click(function () { - $("div.result").load("ajax/missing.html"); - }); - $("div.log").ajaxError(function (e, jqxhr, settings, exception) { - if (settings.url == "ajax/missing.html") { - $(this).text("Triggered ajaxError handler."); +function JQueryStatic() { + function type_annotation() { + const jq: JQueryStatic = $; + } + + function Callbacks() { + const cb = $.Callbacks(); + + cb.add(console.log); + } + + function Event() { + function constructor() { + const e = $.Event('click'); + e.stopPropagation(); } - }); - $("#msg").ajaxError(function (event, request, settings) { - $(this).append("
  • Error requesting page " + settings.url + "
  • "); - }); -} -function test_ajaxPrefilter() { - var currentRequests = {}; - $.ajaxPrefilter(function (options, originalOptions, jqXHR) { - if (options.abortOnRetry) { - if (currentRequests[options.url]) { - currentRequests[options.url].abort(); + function type_guard(e: object) { + if (e instanceof JQuery.Event) { + e.isDefaultPrevented() === true; } - currentRequests[options.url] = jqXHR; } - }); - $.ajaxPrefilter(function (options) { - if (options.crossDomain) { - options.url = "http://mydomain.net/proxy/" + encodeURIComponent(options.url); - options.crossDomain = false; + + function mixin() { + const e = $.Event('keydown', { + mySpecialKeyCode: JQuery.Key.CapsLock, + }); + + e.mySpecialKeyCode === JQuery.Key.NumLock; } - }); - $.ajaxPrefilter("json script", function (options, originalOptions, jqXHR) { + } - }); - var isActuallyScript; - $.ajaxPrefilter(function (options) { - if (isActuallyScript(options.url)) { - return "script"; + function each() { + function arrayLike() { + $.each({ length: 3 }, (index, val) => { + index === 3; + }); } - }); -} + } -function test_ajaxSend() { - $('.log').ajaxSend(function () { - $(this).text('Triggered ajaxSend handler.'); - }); - $('.trigger').click(function () { - $('.result').load('ajax/test.html'); - }); - $('.log').ajaxSend(function (e, jqxhr, settings) { - if (settings.url == 'ajax/test.html') { - $(this).text('Triggered ajaxSend handler.'); - } - }); - $("#msg").ajaxSend(function (evt, request, settings) { - $(this).append("
  • Starting request at " + settings.url + "
  • "); - }); -} - -function test_ajaxSetup() { - $.ajaxSetup({ - url: 'ping.php' - }); - $.ajax({ - data: { 'name': 'Dan' } - }); - $.ajaxSetup({ - url: "/xmlhttp/", - global: false, - type: "POST" - }); -} - -function test_ajaxStart() { - $('.log').ajaxStart(function () { - $(this).text('Triggered ajaxStart handler.'); - }); - $('.trigger').click(function () { - $('.result').load('ajax/test.html'); - }); - $("#loading").ajaxStart(function () { - $(this).show(); - }); -} - -function test_ajaxStop() { - $('.log').ajaxStop(function () { - $(this).text('Triggered ajaxStop handler.'); - }); - $('.trigger').click(function () { - $('.result').load('ajax/test.html'); - }); - $("#loading").ajaxStop(function () { - $(this).hide(); - }); -} - -function test_ajaxSuccess() { - $('.log').ajaxSuccess(function () { - $(this).text('Triggered ajaxSuccess handler.'); - }); - $('.trigger').click(function () { - $('.result').load('ajax/test.html'); - }); - $('.log').ajaxSuccess(function (e, xhr, settings) { - if (settings.url == 'ajax/test.html') { - $(this).text('Triggered ajaxSuccess handler. The ajax response was:' + xhr.responseText); - } - }); - $("#msg").ajaxSuccess(function (evt, request, settings) { - $(this).append("
  • Successful Request!
  • "); - }); -} - -function test_allSelector() { - var elementCount = $("*").css("border", "3px solid red").length; - $("body").prepend("

    " + elementCount + " elements found

    "); - var elementCount2 = $("#test").find("*").css("border", "3px solid red").length; - $("body").prepend("

    " + elementCount2 + " elements found

    "); -} - -function test_animate() { - $('#clickme').click(function () { - $('#book').animate({ - opacity: 0.25, - left: '+=50', - height: 'toggle' - }, 5000, function () { - }); - }); - $('li').animate({ - opacity: .5, - height: '50%' - }, { - step: function (now, fx) { - var data = fx.elem.id + ' ' + fx.prop + ': ' + now; - $('body').append('
    ' + data + '
    '); - } - }); - $('#clickme').click(function () { - $('#book').animate({ - width: ['toggle', 'swing'], - height: ['toggle', 'swing'], - opacity: 'toggle' - }, 5000, 'linear', function () { - $(this).after('
    Animation complete.
    '); - }); - }); - $('#clickme').click(function () { - $('#book').animate({ - width: 'toggle', - height: 'toggle' - }, { - duration: 5000, - specialEasing: { - width: 'linear', - height: 'easeOutBounce' - }, - complete: function () { - $(this).after('
    Animation complete.
    '); + function isArray() { + function type_guard(obj: object) { + if ($.isArray(obj)) { + console.log(obj[0]); } - }); - }); - $("#go").click(function () { - $("#block").animate({ - width: "70%", - opacity: 0.4, - marginLeft: "0.6in", - fontSize: "3em", - borderWidth: "10px" - }, 1500); - }); - $("#right").click(function () { - $(".block").animate({ "left": "+=50px" }, "slow"); - }); - $("#left").click(function () { - $(".block").animate({ "left": "-=50px" }, "slow"); - }); - $("#go1").click(function () { - $("#block1").animate({ width: "90%" }, { queue: false, duration: 3000 }) - .animate({ fontSize: "24px" }, 1500) - .animate({ borderRightWidth: "15px" }, 1500); - }); - $("#go2").click(function () { - $("#block2").animate({ width: "90%" }, 1000) - .animate({ fontSize: "24px" }, 1000) - .animate({ borderLeftWidth: "15px" }, 1000); - }); - $("#go3").click(function () { - $("#go1").add("#go2").click(); - }); - $("#go4").click(function () { - $("div").css({ width: "", fontSize: "", borderWidth: "" }); - }); - $("#go").click(function () { - $(".block:first").animate({ - left: 100 - }, { - duration: 1000, - step: function (now, fx) { - $(".block:gt(0)").css("left", now); + } + } + + function isFunction() { + function type_guard(obj: object) { + if ($.isFunction(obj)) { + obj(); } - }); - }); - $("p").animate({ - height: "toggle", opacity: "toggle" - }, "slow"); - $("p").animate({ - left: 50, opacity: 1 - }, 500); - $("p").animate({ - left: "50px", opacity: 1 - }, { duration: 500, queue: false }); - $("p").animate({ - opacity: "show" - }, "slow", "easein"); - $("p").animate({ - height: "toggle", opacity: "toggle" - }, { duration: "slow" }); - $("p").animate({ - opacity: "show" - }, { duration: "slow", easing: "easein" }); - $("p").animate({ - height: 200, width: 400, opacity: 0.5 - }, 1000, "linear", function () { - alert("all done"); - }); -} - -function test_animatedSelector() { - $("#run").click(function () { - $("div:animated").toggleClass("colored"); - }); - function animateIt() { - $("#mover").slideToggle("slow", animateIt); - } - animateIt(); -} - -function test_slideToggle() { - $("button").click(function () { - $("p").slideToggle("slow"); - }); - - $("#aa").click(function () { - $("div:not(.still)").slideToggle("slow", function () { - var n = parseInt($("span").text(), 10); - $("span").text(n + 1); - }); - }); -} - -function test_toggle() { - $(".target").toggle(); - - $("#clickme").click(function () { - $("#book").toggle("slow", function () { - // Animation complete. - }); - }); - - $("#foo").toggle(true); - - $("button").click(function () { - $("p").toggle(); - }); - - $("button").click(function () { - $("p").toggle("slow"); - }); - - var flip = 0; - $("button").click(function () { - $("p").toggle(flip++ % 2 === 0); - }); -} - -function test_append() { - $('.inner').append('

    Test

    '); - $('.container').append($('h2')).append(document.createDocumentFragment()); - - var $newdiv1 = $('
    '), - newdiv2 = document.createElement('div'), - existingdiv1 = document.getElementById('foo'); - - $('body').append($newdiv1, [newdiv2, existingdiv1]); -} - -function test_appendTo() { - $('

    Test

    ').appendTo('.inner'); - $('h2').appendTo($('.container')); -} - -function test_attr() { - var title = $("em").attr("title"); - $("em").attr("title", null); // Delete an attribute. - $("div").text(title); - $('#greatphoto').attr('alt', 'Beijing Brush Seller'); - $('#greatphoto') - .attr('title', 'Photo by Kelly Clark'); - $('#greatphoto').attr({ - alt: 'Beijing Brush Seller', - title: 'photo by Kelly Clark' - }); - $('#greatphoto').attr('title', function (i, val) { - return val + ' - photo by Kelly Clark' - }); - $("div").attr("id", function (arr) { - return "div-id" + arr; - }) - .each(function () { - $("span", this).html("(ID = '" + this.id + "')"); - }); - $("img").attr("src", function () { - return "/images/" + this.title; - }); -} - -function test_attributeSelectors() { - $('a[hreflang|="en"]').css('border', '3px dotted green'); - $('input[name*="man"]').val('has man in it!'); - $('input[name~="man"]').val('mr. man is in it!'); - $('input[name$="letter"]').val('a letter'); - $('input[value="Hot Fuzz"]').next().text(" Hot Fuzz"); - $('input[name!="newsletter"]').next().append('; not newsletter'); - $('input[name^="news"]').val('news here!'); -} - -function test_before() { - $('.inner').before('

    Test

    '); - $('.container').before($('h2')).before(document.createDocumentFragment()); - $("
    ").before("

    "); - var $newdiv1 = $('
    '), - newdiv2 = document.createElement('div'), - existingdiv1 = document.getElementById('foo'); - $('p').first().before($newdiv1, [newdiv2, existingdiv1]); -} - -function test_bind() { - $('#foo').bind('click', function () { - alert('User clicked on "foo."'); - }); - $('#foo').bind('mouseenter mouseleave', function () { - $(this).toggleClass('entered'); - }); - $('#foo').bind({ - click: function () { }, - mouseenter: function () { } - }); - $('#foo').bind('click', function () { - alert($(this).text()); - }); - $(document).ready(function () { - $('#foo').bind('click', function (event) { - alert('The mouse cursor is at (' - + event.pageX + ', ' + event.pageY + ')'); - }); - }); - var message = 'Spoon!'; - $('#foo').bind('click', function () { - alert(message); - }); - message = 'Not in the face!'; - $('#bar').bind('click', function () { - alert(message); - }); - var message = 'Spoon!'; - $('#foo').bind('click', { msg: message }, function (event) { - alert(event.data.msg); - }); - message = 'Not in the face!'; - $('#bar').bind('click', { msg: message }, function (event) { - alert(event.data.msg); - }); - $("p").bind("click", function (event) { - var str = "( " + event.pageX + ", " + event.pageY + " )"; - $("span").text("Click happened! " + str); - }); - $("p").bind("dblclick", function () { - $("span").text("Double-click happened in " + this.nodeName); - }); - $("p").bind("mouseenter mouseleave", function (event) { - $(this).toggleClass("over"); - }); - $("p").bind("click", function () { - alert($(this).text()); - }); - function handler(event) { - alert(event.data.foo); - } - $("p").bind("click", { foo: "bar" }, handler) - $("form").bind("submit", function () { return false; }) - $("form").bind("submit", function (event) { - event.preventDefault(); - }); - $("form").bind("submit", function (event) { - event.stopPropagation(); - }); - $("p").bind("myCustomEvent", function (e, myName?, myValue?) { - $(this).text(myName + ", hi there!"); - $("span").stop().css("opacity", 1) - .text("myName = " + myName) - .fadeIn(30).fadeOut(1000); - }); - $("button").click(function () { - $("p").trigger("myCustomEvent", ["John"]); - }); - $("div.test").bind({ - click: function () { - $(this).addClass("active"); - }, - mouseenter: function () { - $(this).addClass("inside"); - }, - mouseleave: function () { - $(this).removeClass("inside"); } - }); -} + } -function test_unbind() { - $("#foo").unbind(); - - $("#foo").unbind("click"); - - var handler = function () { - alert("The quick brown fox jumps over the lazy dog."); - }; - $("#foo").bind("click", handler); - $("#foo").unbind("click", handler); - - $("#foo").bind("click", function () { - alert("The quick brown fox jumps over the lazy dog."); - }); - - // Will NOT work - $("#foo").unbind("click", function () { - alert("The quick brown fox jumps over the lazy dog."); - }); - - $("#foo").bind("click.myEvents", handler); - - $("#foo").unbind("click"); - - $("#foo").unbind("click.myEvents"); - - $("#foo").unbind(".myEvents"); - - var timesClicked = 0; - $("#foo").bind("click", function (event) { - alert("The quick brown fox jumps over the lazy dog."); - timesClicked++; - if (timesClicked >= 3) { - $(this).unbind(event); + function isNumeric() { + function type_guard(obj: boolean) { + if ($.isNumeric(obj)) { + obj.toFixed(); + } } - }); - - function aClick() { - $("div").show().fadeOut("slow"); } - $("#bind").click(function () { - $("#theone") - .bind("click", aClick) - .text("Can Click!"); - }); - $("#unbind").click(function () { - $("#theone") - .unbind("click", aClick) - .text("Does nothing..."); - }); - $("p").unbind(); - - $("p").unbind("click"); - - var foo = function () { - // Code to handle some kind of event - }; - - $("p").bind("click", foo); // ... Now foo will be called when paragraphs are clicked ... - - $("p").unbind("click", foo); // ... foo will no longer be called. -} - -function test_blur() { - $('#target').blur(function () { - alert('Handler for .blur() called.'); - }); - $('#other').click(function () { - $('#target').blur(); - - }); - $("p").blur(); -} - -interface JQueryStatic { Topic; } -function test_callbacks() { - function fn1(value) { - console.log(value); + function isPlainObject() { + function type_guard(obj: object) { + if ($.isPlainObject(obj)) { + obj['key'] = true; + } + } } - function fn2(value) { - fn1("fn2 says:" + value); - return false; - } - var callbacks = $.Callbacks(); - var callbacks2 = $.Callbacks("once"); - callbacks.add(fn1); - callbacks.fire("foo!"); - callbacks.add(fn2); - callbacks.fire("bar!"); - callbacks.remove(fn2); - callbacks.fire("foobar"); - var topics = {}; - jQuery.Topic = function (id) { - var callbacks, - method, - topic = id && topics[id]; - if (!topic) { - callbacks = jQuery.Callbacks(); - topic = { - publish: callbacks.fire, - subscribe: callbacks.add, - unsubscribe: callbacks.remove + function isWindow() { + function type_guard(obj: object) { + if ($.isWindow(obj)) { + obj.location.href === 'href'; + } + } + } + + function map() { + function object() { + const testObj = { + myProp: true, + name: 'Rogers', }; - if (id) { - topics[id] = topic; - } - } - return topic; - }; - $.Topic("mailArrived").subscribe(fn1); - $.Topic("mailArrived").subscribe(fn2); - $.Topic("mailSent").subscribe(fn1); - $.Topic("mailArrived").publish("hello world!"); - $.Topic("mailSent").publish("woo! mail!"); - $.Topic("mailArrived").subscribe(fn1); - var dfd = $.Deferred(); - var topic = $.Topic("mailArrived"); - dfd.done(topic.publish); - dfd.resolve("its been published!"); -} - -function test_callbacksFunctions() { - var foo = function (value) { - console.log('foo:' + value); - } - var bar = function (value) { - console.log('bar:' + value); - } - var callbacks = $.Callbacks(); - callbacks.add(foo); - callbacks.fire('hello'); - callbacks.add(bar); - callbacks.fire('world'); - callbacks.disable(); - - // Test the disabled state of the list - console.log(callbacks.disabled()); - // Outputs: true - - callbacks.empty(); - callbacks.fire('hello'); - console.log(callbacks.fired()); - callbacks.fireWith(window, ['foo', 'bar']); - var foo2 = function (value1, value2) { - console.log('Received:' + value1 + ',' + value2); - }; - console.log(callbacks.has(foo2)); - callbacks.lock(); - console.log(callbacks.locked()); - callbacks.remove(foo); -} - -function test_change() { - $('.target').change(function () { - alert('Handler for .change() called.'); - }); - $('#other').click(function () { - $('.target').change(); - }); - $("input[type='text']").change(function () { }); - $("input[type='text']").change(); -} - -function test_children() { - $('ul.level-2').children().css('background-color', 'red'); - $("#container").click(function (e) { - $("*").removeClass("hilite"); - var $kids = $(e.target).children(); - var len = $kids.addClass("hilite").length; - - $("#results span:first").text(len); - //$("#results span:last").text(e.target.tagName); - - e.preventDefault(); - return false; - }); - $("div").children(".selected").css("color", "blue"); -} - -function test_clearQueue() { - $("#start").click(function () { - var myDiv = $("div"); - myDiv.show("slow"); - myDiv.animate({ left: '+=200' }, 5000); - myDiv.queue(function () { - var _this = $(this); - _this.addClass("newcolor"); - _this.dequeue(); - }); - myDiv.animate({ left: '-=200' }, 1500); - myDiv.queue(function () { - var _this = $(this); - _this.removeClass("newcolor"); - _this.dequeue(); - }); - myDiv.slideUp(); - - }); - $("#stop").click(function () { - var myDiv = $("div"); - myDiv.clearQueue(); - myDiv.stop(); - }); -} - -function test_click() { - $("#target").click(function () { - alert("Handler for .click() called."); - }); - $("#other").click(function () { - $("#target").click(); - }); - $("p").click(function () { - $(this).slideUp(); - }); - $("p").click(); -} - -function test_submit() { - $("#target").submit(function () { - alert("Handler for .submit() called."); - }); - $("#target").submit(); -} - -function test_trigger() { - - $("#foo").on("click", function () { - alert($(this).text()); - }); - $("#foo").trigger("click"); - - $("#foo").on("custom", function (event, param1?, param2?) { - alert(param1 + "\n" + param2); - }); - $("#foo").trigger("custom", ["Custom", "Event"]); - - $("button:first").click(function () { - update($("span:first")); - }); - - $("button:last").click(function () { - $("button:first").trigger("click"); - update($("span:last")); - }); - - function update(j) { - var n = parseInt(j.text(), 10); - j.text(n + 1); - } - - $("form:first").trigger("submit"); - - var event = jQuery.Event("submit"); - $("form:first").trigger(event); - if (event.isDefaultPrevented()) { - // Perform an action... - } - - $("p") - .click(function (event, a, b) { - // When a normal click fires, a and b are undefined - // for a trigger like below a refers to "foo" and b refers to "bar" - }) - .trigger("click", ["foo", "bar"]); - - var event = jQuery.Event("logged"); - (event).user = "foo"; - (event).pass = "bar"; - $("body").trigger(event); - - // Adapted from jQuery documentation which may be wrong on this occasion - var event2 = jQuery.Event("logged"); - $("body").trigger(event2, { - type: "logged", - user: "foo", - pass: "bar" - }); -} - -function test_clone() { - $('.hello').clone().appendTo('.goodbye'); - var $elem = $('#elem').data({ "arr": [1] }), - $clone = $elem.clone(true) - .data("arr", $.extend([], $elem.data("arr"))); - $("b").clone().prependTo("p"); - $('#copy').append($('#orig .elem') - .clone() - .children('a') - .prepend('foo - ') - .parent() - .clone()); -} - -function test_prepend() { - $('.inner').prepend('

    Test

    '); - $('.container').prepend($('h2')).prepend(document.createDocumentFragment()); - - var $newdiv1 = $('
    '), - newdiv2 = document.createElement('div'), - existingdiv1 = document.getElementById('foo'); - - $('body').prepend($newdiv1, [newdiv2, existingdiv1]); -} - -function test_prependTo() { - $("

    Test

    ").prependTo(".inner"); - $("h2").prependTo($(".container")); - $("span").prependTo("#foo"); -} - -function test_closest() { - $('li.item-a').closest('ul') - .css('background-color', 'red'); - $('li.item-a').closest('li') - .css('background-color', 'red'); - var listItemII = document.getElementById('ii'); - $('li.item-a').closest('ul', listItemII) - .css('background-color', 'red'); - $('li.item-a').closest('#one', listItemII) - .css('background-color', 'green'); - $(document).bind("click", function (e) { - $(e.target).closest("li").toggleClass("hilight"); - }); - var $listElements = $("li").css("color", "blue"); - $(document).bind("click", function (e) { - //$(e.target).closest($listElements).toggleClass("hilight"); - }); -} - -function test_contains() { - jQuery.contains(document.documentElement, document.body); - jQuery.contains(document.body, document.documentElement); -} - -function test_contents() { - $('.container').contents().filter(function () { - return this.nodeType == 3; - }) - .wrap('

    ') - .end() - .filter('br') - .remove(); - $("#frameDemo").contents().find("a").css("background-color", "#BADA55"); -} - -function test_context() { - $("ul") - .append("
  • " + $("ul").context + "
  • ") - .append("
  • " + $("ul", document.body).context.nodeName + "
  • "); -} - -function test_css() { - $("div").click(function () { - var color = $(this).css("background-color"); - $("#result").html("That div is " + color + "."); - }); - $('div.example').css('width', function (index) { - return index * 50; - }); - $("p").mouseover(function () { - $(this).css("color", "red"); - }); - $("#box").one("click", function () { - $(this).css("width", "+=200"); - }); - var words = $("p:first").text().split(" "); - var text = words.join(" "); - $("p:first").html("" + text + ""); - $("span").click(function () { - $(this).css("background-color", "yellow"); - }); - $("p").hover(function () { - $(this).css({ 'background-color': 'yellow', 'font-weight': 'bolder' }); - }, function () { - var cssObj = { - 'background-color': '#ddd', - 'font-weight': '', - 'color': 'rgb(0,40,244)' - } - $(this).css(cssObj); - }); - $("div").click(function () { - $(this).css({ - width: function (index, value) { - return parseFloat(value) * 1.2; - }, - height: function (index, value) { - return parseFloat(value) * 1.2; - } - }); - }); - var dims = $("#box").css([ "width", "height", "backgroundColor" ]); -} - -function test_cssHooks() { - if (!$.cssHooks) { - throw ("jQuery 1.4.3 or above is required for this plugin to work"); - } - $.cssHooks["someCSSProp"] = { - get: function (elem, computed, extra) { }, - set: function (elem, value) { } - }; - function styleSupport(prop) { - var vendorProp, supportedProp, - capProp = prop.charAt(0).toUpperCase() + prop.slice(1), - prefixes = ["Moz", "Webkit", "O", "ms"], - div = document.createElement("div"); - - if (prop in div.style) { - supportedProp = prop; - } else { - for (var i = 0; i < prefixes.length; i++) { - vendorProp = prefixes[i] + capProp; - if (vendorProp in div.style) { - supportedProp = vendorProp; - break; + const results = $.map(testObj, (propertyOfObject, key) => { + switch (key) { + case 'myProp': + return 1; + case 'name': + return false; } - } - } - div = null; - $.support[prop] = supportedProp; - return supportedProp; - } - styleSupport("borderRadius"); - - $.cssNumber["someCSSProp"] = true; - $.fx.step["someCSSProp"] = function (fx) { - $.cssHooks["someCSSProp"].set(fx.elem, fx.now + fx.unit); - }; -} - -function test_data() { - $('body').data('foo', 52); - $('body').data('bar', { myType: 'test', count: 40 }); - $('body').data('foo'); - $('body').data(); - $("div").data("test", { first: 16, last: "pizza!" }); - $("span:first").text($("div").data("test").first); - $("span:last").text($("div").data("test").last); - alert($('body').data('foo')); - alert($('body').data()); - alert($("body").data("foo")); - $("body").data("bar", "foobar"); - alert($("body").data("bar")); - $("div").data("role") === "page"; - $("div").data("lastValue") === 43; - $("div").data("hidden") === true; - $("div").data("options").name === "John"; - var value; - switch ($("button").index(this)) { - case 0: - value = $("div").data("blah"); - break; - case 1: - $("div").data("blah", "hello"); - value = "Stored!"; - break; - case 2: - $("div").data("blah", 86); - value = "Stored!"; - break; - case 3: - $("div").removeData("blah"); - value = "Removed!"; - break; - } - $("span").text("" + value); - jQuery.data(document.body, 'foo', 52); - jQuery.data(document.body, 'bar', 'test'); - var div = $("div")[0]; - jQuery.data(div, "test", { first: 16, last: "pizza!" }); - $("span:first").text(jQuery.data(div, "test").first); - $("span:last").text(jQuery.data(div, "test").last); - $.data(document.getElementById("id"), "", 8).toFixed(2); - $.data(document.getElementById("id"), "", "8").toUpperCase(); -} - -function test_removeData() { - $("span:eq(0)").text("" + $("div").data("test1")); - $("div").data("test1", "VALUE-1"); - $("div").data("test2", "VALUE-2"); - $("span:eq(1)").text("" + $("div").data("test1")); - $("div").removeData("test1"); - $("span:eq(2)").text("" + $("div").data("test1")); - $("span:eq(3)").text("" + $("div").data("test2")); -} - -function test_jQuery_removeData() { - var div = $("div")[0]; - $("span:eq(0)").text("" + $("div").data("test1")); - jQuery.data(div, "test1", "VALUE-1"); - jQuery.data(div, "test2", "VALUE-2"); - $("span:eq(1)").text("" + jQuery.data(div, "test1")); - jQuery.removeData(div, "test1"); - $("span:eq(2)").text("" + jQuery.data(div, "test1")); - $("span:eq(3)").text("" + jQuery.data(div, "test2")); -} - -function test_removeDataAll() { - var el = $("div"); - el.data("test1", "VALUE-1"); - el.data("test2", "VALUE-2"); - el.removeData(); -} - -function test_dblclick() { - $('#target').dblclick(function () { - alert('Handler for .dblclick() called.'); - }); - $('#other').click(function () { - $('#target').dblclick(); - }); - $("p").dblclick(function () { alert("Hello World!"); }); - var divdbl = $("div:first"); - divdbl.dblclick(function () { - divdbl.toggleClass('dbl'); - }); - $('#target').dblclick(); -} - -function test_delay() { - $('#foo').slideUp(300).delay(800).fadeIn(400); - $("button").click(function () { - $("div.first").slideUp(300).delay(800).fadeIn(400); - $("div.second").slideUp(300).fadeIn(400); - }); -} - -function test_delegate() { - $("table").delegate("td", "click", function () { - $(this).toggleClass("chosen"); - }); - $("table").on("click", "td", function () { - $(this).toggleClass("chosen"); - }); - $("body").delegate("p", "click", function () { - $(this).after("

    Another paragraph!

    "); - }); - $("body").delegate("p", "click", function () { - alert($(this).text()); - }); - $("body").delegate("a", "click", function () { return false; }); - $("body").delegate("a", "click", function (event) { - event.preventDefault(); - }); - $("body").delegate("p", "myCustomEvent", function (e, myName?, myValue?) { - $(this).text("Hi there!"); - $("span").stop().css("opacity", 1) - .text("myName = " + myName) - .fadeIn(30).fadeOut(1000); - }); - $("button").click(function () { - $("p").trigger("myCustomEvent"); - }); -} - -function test_undelegate() { - function aClick() { - $("div").show().fadeOut("slow"); - } - $("#bind").click(function () { - $("body") - .delegate("#theone", "click", aClick) - .find("#theone").text("Can Click!"); - }); - $("#unbind").click(function () { - $("body") - .undelegate("#theone", "click", aClick) - .find("#theone").text("Does nothing..."); - }); - - $("p").undelegate(); - - $("p").undelegate("click"); - - var foo = function () { - // Code to handle some kind of event - }; - - // ... Now foo will be called when paragraphs are clicked ... - $("body").delegate("p", "click", foo); - - // ... foo will no longer be called. - $("body").undelegate("p", "click", foo); - - var foo = function () { - // Code to handle some kind of event - }; - - // Delegate events under the ".whatever" namespace - $("form").delegate(":button", "click.whatever", foo); - - $("form").delegate("input[type='text'] ", "keypress.whatever", foo); - - // Unbind all events delegated under the ".whatever" namespace - $("form").undelegate(".whatever"); -} - -function test_dequeue() { - $("button").click(function () { - $("div").animate({ left: '+=200px' }, 2000); - $("div").animate({ top: '0px' }, 600); - $("div").queue(function () { - $(this).toggleClass("red"); - $(this).dequeue(); - }); - $("div").animate({ left: '10px', top: '30px' }, 700); - }); -} - -function test_queue() { - - $("#show").click(function () { - var n = jQuery.queue($("div")[0], "fx"); - $("span").text("Queue length is: " + n.length); - }); - - function runIt() { - $("div") - .show("slow") - .animate({ - left: "+=200" - }, 2000) - .slideToggle(1000) - .slideToggle("fast") - .animate({ - left: "-=200" - }, 1500) - .hide("slow") - .show(1200) - .slideUp("normal", runIt); - } - - runIt(); - - $(document.body).click(function () { - var divs = $("div") - .show("slow") - .animate({ left: "+=200" }, 2000); - jQuery.queue(divs[0], "fx", function () { - $(this).addClass("newcolor"); - jQuery.dequeue(this); - }); - divs.animate({ left: "-=200" }, 500); - jQuery.queue(divs[0], "fx", function () { - $(this).removeClass("newcolor"); - jQuery.dequeue(this); - }); - divs.slideUp(); - }); - - $("#start").click(function () { - var divs = $("div") - .show("slow") - .animate({ left: "+=200" }, 5000); - jQuery.queue(divs[0], "fx", function () { - $(this).addClass("newcolor"); - jQuery.dequeue(this); - }); - divs.animate({ left: "-=200" }, 1500); - jQuery.queue(divs[0], "fx", function () { - $(this).removeClass("newcolor"); - jQuery.dequeue(this); - }); - divs.slideUp(); - }); - $("#stop").click(function () { - jQuery.queue($("div")[0], "fx", []); - $("div").stop(); - }); -} - -function test_detach() { - $("p").click(function () { - $(this).toggleClass("off"); - }); - var p; - $("button").click(function () { - if (p) { - p.appendTo("body"); - p = null; - } else { - p = $("p").detach(); - } - }); -} - -function test_each() { - var numArray: number[]; - numArray = $.each([1, 2, 3, 4], function (index: number, value: number) { - alert(index + ': ' + value); - }); - numArray = $.each([1, 2, 3, 4], function (index: number, value: number) { - alert(index + ': ' + value); - return value < 2; - }); - - var res: {one: number, 2: string}; - res = $.each({ one: 1, 2: "two" }, function(key: string, value: any) { - alert(key + ': ' + value); - }); - res = $.each({ one: 1, 2: "two" }, function(key: string, value: any) { - alert(key + ': ' + value); - return key === "2"; - }); - - var map = { - 'flammable': 'inflammable', - 'duh': 'no duh' - }; - $.each(map, function (key, value) { - alert(key + ': ' + value); - }); - var arr = ["one", "two", "three", "four", "five"]; - var obj = { one: 1, two: 2, three: 3, four: 4, five: 5 }; - jQuery.each(arr, function () { - $("#" + this).text("Mine is " + this + "."); - return (this != "three"); - }); - jQuery.each(obj, function (i, val) { - $("#" + i).append(document.createTextNode(" - " + val)); - }); - $.each(['a', 'b', 'c'], function (i, l) { - alert("Index #" + i + ": " + l); - }); - $.each({ name: "John", lang: "JS" }, function (k, v) { - alert("Key: " + k + ", Value: " + v); - }); - $.each([{a: 1}, {a: 2}, {a: 3}], function (i, o) { - alert("Index #" + i + ": " + o.a); - }); - $('li').each(function (index) { - alert(index + ': ' + $(this).text()); - }); - $(document.body).click(function () { - $("div").each(function (i) { - if (this.style.color != "blue") { - this.style.color = "blue"; - } else { - this.style.color = ""; - } - }); - }); - $("span").click(function () { - $("li").each(function () { - $(this).toggleClass("example"); - }); - }); - $("button").click(function () { - $("div").each(function (index, domEle) { - // domEle == this - $(domEle).css("backgroundColor", "yellow"); - if ($(this).is("#stop")) { - $("span").text("Stopped at div index #" + index); - return false; - } - }); - }); -} - -function test_empty() { - $('.hello').empty(); -} - -function test_end() { - $('ul.first').find('.foo').css('background-color', 'red') - .end().find('.bar').css('background-color', 'green'); - $('ul.first').find('.foo') - .css('background-color', 'red') - .end().find('.bar') - .css('background-color', 'green') - .end(); -} - -function test_eq() { - $('li').eq(2).css('background-color', 'red'); - $('li').eq(-2).css('background-color', 'red'); - $('li').eq(5).css('background-color', 'red'); - $("body").find("div").eq(2).addClass("blue"); -} - -function test_error() { - $('#book') - .error(function () { - alert('Handler for .error() called.') - }) - .attr("src", "missing.png"); - $("img") - .error(function () { - $(this).hide(); - }) - .attr("src", "missing.png"); - jQuery.error("Oups"); - jQuery.error = (message?: string) => { - console.error(message); return this; - }; -} - -function test_eventParams() { - $("p").click(function (event) { - event.currentTarget === this; - }); - $(".box").on("click", "button", function (event) { - $(event.delegateTarget).css("background-color", "red"); - }); - $("a").click(function (event) { - event.isDefaultPrevented(); - event.preventDefault(); - event.isDefaultPrevented(); - }); - function immediatePropStopped(e) { - var msg = ""; - if (e.isImmediatePropagationStopped()) { - msg = "called" - } else { - msg = "not called"; - } - $("#stop-log").append("
    " + msg + "
    "); - } - $("button").click(function (event) { - immediatePropStopped(event); - event.stopImmediatePropagation(); - immediatePropStopped(event); - }); - function propStopped(e) { - var msg = ""; - if (e.isPropagationStopped()) { - msg = "called"; - } else { - msg = "not called"; - } - $("#stop-log").append("
    " + msg + "
    "); - } - $("button").click(function (event) { - propStopped(event); - event.stopPropagation(); - propStopped(event); - }); - $("p").bind("test.something", function (event) { - alert(event.namespace); - }); - $("button").click(function (event) { - $("p").trigger("test.something"); - }); - $(document).bind('mousemove', function (e) { - $("#log").text("e.pageX: " + e.pageX + ", e.pageY: " + e.pageY); - }); - $("a").click(function (event) { - event.preventDefault(); - $('
    ') - .append('default ' + event.type + ' prevented') - .appendTo('#log'); - }); - $("a").mouseout(function (event) { - alert(event.relatedTarget.nodeName); - }); - $("button").click(function (event) { - return "hey"; - }); - $("button").click(function (event) { - $("p").html(event.result); - }); - $("p").click(function (event) { - event.stopImmediatePropagation(); - }); - $("p").click(function (event) { - $(this).css("background-color", "#f00"); - }); - $("div").click(function (event) { - $(this).css("background-color", "#f00"); - }); - $("p").click(function (event) { - event.stopPropagation(); - }); - $("body").click(function (event) { - //bugfix, duplicate identifier. see: http://stackoverflow.com/questions/14824143/duplicate-identifier-nodename-in-jquery-d-ts - //$("#log").html("clicked: " + event.target.nodeName); - }); - $('#whichkey').bind('keydown', function (e) { - $('#log').html(e.type + ': ' + e.which); - }); - $('#whichkey').bind('mousedown', function (e) { - $('#log').html(e.type + ': ' + e.which); - }); - $(window).on('mousewheel', (e) => { - var delta = (e.originalEvent).deltaY; - }); - $( "p" ).click(function( event ) { - alert( event.currentTarget === this ); // true - }); -} - -function test_extend() { - var object1 = { - apple: 0, - banana: { weight: 52, price: 100 }, - cherry: 97 - }; - var object2 = { - banana: { price: 200 }, - durian: 100 - }; - $.extend(object1, object2); - var printObj = typeof JSON != "undefined" ? JSON.stringify : function (obj) { - var arr = []; - $.each(obj, function (key, val) { - var next = key + ": "; - next += $.isPlainObject(val) ? printObj(val) : val; - arr.push(next); - }); - return "{ " + arr.join(", ") + " }"; - }; - $("#log").append(printObj(object1)); - - var defaults = { validate: false, limit: 5, name: "foo" }; - var options = { validate: true, name: "bar" }; - var settings: typeof defaults = $.extend({}, defaults, options); -} - -function test_fadeIn() { - $('#clickme').click(function () { - $('#book').fadeIn('slow', function () { }); - }); - $(document.body).click(function () { - $("div:hidden:first").fadeIn("slow"); - }); - $("a").click(function () { - $("div").fadeIn(3000, function () { - $("span").fadeIn(100); - }); - return false; - }); -} - -function test_fadeOut() { - $('#clickme').click(function () { - $('#book').fadeOut('slow', function () { }); - }); - $("p").click(function () { - $("p").fadeOut("slow"); - }); - $("span").click(function () { - $(this).fadeOut(1000, function () { - $("div").text("'" + $(this).text() + "' has faded!"); - $(this).remove(); - }); - }); - $("span").hover(function () { - $(this).addClass("hilite"); - }, function () { - $(this).removeClass("hilite"); - }); - $("#btn1").click(function () { - function complete() { - $("
    ").text(this.id).appendTo("#log"); - } - $("#box1").fadeOut(1600, "linear", complete); - $("#box2").fadeOut(1600, complete); - }); - $("#btn2").click(function () { - $("div").show(); - $("#log").empty(); - }); -} - -function test_fadeTo() { - $('#clickme').click(function () { - $('#book').fadeTo('slow', 0.5, function () { }); - }); - $("p:first").click(function () { - $(this).fadeTo("slow", 0.33); - }); - $("div").click(function () { - $(this).fadeTo("fast", Math.random()); - }); - var getPos = function (n) { - return (Math.floor(n) * 90) + "px"; - }; - $("p").each(function (n) { - var r = Math.floor(Math.random() * 3); - var tmp = $(this).text(); - $(this).text($("p:eq(" + r + ")").text()); - $("p:eq(" + r + ")").text(tmp); - $(this).css("left", getPos(n)); - }); - $("div").each(function (n) { - $(this).css("left", getPos(n)); - }) - .css("cursor", "pointer") - .click(function () { - $(this).fadeTo(250, 0.25, function () { - $(this).css("cursor", "") - .prev().css({ - "font-weight": "bolder", - "font-style": "italic" - }); - }); - }); -} - -function test_fadeToggle() { - $("button:first").click(function () { - $("p:first").fadeToggle("slow", "linear"); - }); - $("button:last").click(function () { - $("p:last").fadeToggle("fast", function () { - $("#log").append("
    finished
    "); - }); - }); -} - -function test_filter() { - $('li').filter(':even').css('background-color', 'red'); - $('li').filter(function (index) { - return index % 3 === 2; - }).css('background-color', 'red'); - $("div").css("background", "#b4b0da") - .filter(function (index) { - return index === 1 || $(this).attr("id") === "fourth"; - }) - .css("border", "3px double red"); - $("div").filter(document.getElementById("unique")); - $("div").filter($("#unique")); -} - -function test_find() { - $('li.item-ii').find('li').css('background-color', 'red'); - var item1 = $('li.item-1')[0]; - $('li.item-ii').find(item1).css('background-color', 'red'); - var $spans = $('span'); - $("p").find($spans).css('color', 'red'); - var newText = $("p").text().split(" ").join(" "); - newText = "" + newText + ""; - $("p").html(newText) - .find('span') - .hover(function () { - $(this).addClass("hilite"); - }, - function () { - $(this).removeClass("hilite"); - }) - .end() - .find(":contains('t')") - .css({ "font-style": "italic", "font-weight": "bolder" }); -} - -function test_finish() { - $(".box").finish(); -} - -function test_first() { - $('li').first().css('background-color', 'red'); -} - -function test_focus() { - $('#target').focus(function () { - alert('Handler for .focus() called.'); - }); - $('#other').click(function () { - $('#target').focus(); - }); - $("input").focus(function () { - $(this).next("span").css('display', 'inline').fadeOut(1000); - }); - $("input[type=text]").focus(function () { - $(this).blur(); - }); - $(document).ready(function () { - $("#login").focus(); - }); -} - -function test_focusin() { - $("p").focusin(function () { - $(this).find("span").css('display', 'inline').fadeOut(1000); - }); -} - -function test_focusout() { - var fo = 0, b = 0; - $("p").focusout(function () { - fo++; - $("#fo") - .text("focusout fired: " + fo + "x"); - }).blur(function () { - b++; - $("#b") - .text("blur fired: " + b + "x"); - }); -} - -function test_easing() { - const easing = jQuery.easing; - - function test_easing_function( name: string, fn: JQueryEasingFunction ) { - const step = Math.pow( 2, -3 ); // use power of 2 to prevent floating point rounding error - for( let i = 0; i <= 1; i += step ) { - console.log( `$.easing.${name}(${i}): ${fn.call(easing, i)}` ); - } - } - - test_easing_function( "linear", easing.linear ); - test_easing_function( "swing", easing.swing ); -} - -function test_fx() { - jQuery.fx.interval = 100; - $("input").click(function () { - $("div").toggle(3000); - }); - var toggleFx = function () { - $.fx.off = !$.fx.off; - }; - toggleFx(); - $("button").click(toggleFx) - $("input").click(function () { - $("div").toggle("slow"); - }); -} - -function test_get() { - $.get('ajax/test.html', function (data) { - $('.result').html(data); - alert('Load was performed.'); - }); - var jqxhr = $.get("example.php", function () { - alert("success"); - }) - .done(function () { alert("second success"); }) - .fail(function () { alert("error"); }); - - $.get("test.php"); - $.get("test.php", { name: "John", time: "2pm" }); - $.get("test.php", { 'choices[]': ["Jon", "Susan"] }); - $.get("test.php", function (data) { - alert("Data Loaded: " + data); - }); - $.get("test.cgi", { name: "John", time: "2pm" }, - function (data) { - alert("Data Loaded: " + data); - }); - $.get("test.php", - function (data) { - $('body').append("Name: " + data.name) - .append("Time: " + data.time); - }, "json"); - alert($('li').get()); - $('li').get(0); - $('li')[0]; - alert($('li').get(-1)); - function disp(divs) { - var a = []; - for (var i = 0; i < divs.length; i++) { - a.push(divs[i].innerHTML); - } - $("span").text(a.join(" ")); - } - disp($("div").get().reverse()); - $("*", document.body).click(function (e) { - e.stopPropagation(); - var domEl = $(this).get(0); - $("span:first").text("Clicked on - " + domEl.tagName); - }); -} - -function test_getJSON() { - $.getJSON('ajax/test.json', function (data) { - var items = []; - $.each(data, function (key, val) { - items.push('
  • ' + val + '
  • '); - }); - $('
      ', { - 'class': 'my-new-list', - html: items.join('') - }).appendTo('body'); - }); - var jqxhr = $.getJSON("example.json", function () { - alert("success"); - }) - .done(function () { alert("second success"); }) - .fail(function () { alert("error"); }); - $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?", - { - tags: "mount rainier", - tagmode: "any", - format: "json" - }, - function (data) { - $.each(data.items, function (i, item) { - $("").attr("src", item.media.m).appendTo("#images"); - if (i === "3") return false; - }); - }); - $.getJSON("test.js", function (json) { - alert("JSON Data: " + json.users[3].name); - }); - $.getJSON("test.js", { name: "John", time: "2pm" }, function (json) { - alert("JSON Data: " + json.users[3].name); - }); -} - -function test_getScript() { - $.getScript("ajax/test.js", function (data, textStatus, jqxhr) { - console.log(data); - console.log(textStatus); - console.log(jqxhr.status); - console.log('Load was performed.'); - }); - $.getScript("ajax/test.js") - .done(function (script, textStatus) { - console.log(textStatus); - }) - .fail(function (jqxhr, settings, exception) { - $("div.log").text("Triggered ajaxError handler."); - }); - $("div.log").ajaxError(function (e, jqxhr, settings, exception) { - if (settings.dataType == 'script') { - $(this).text("Triggered ajaxError handler."); - } - }); - $.ajaxSetup({ - cache: true - }); - $.getScript("/scripts/jquery.color.js", function () { - $("#go").click(function () { - $(".block").animate({ backgroundColor: "pink" }, 1000) - .delay(500) - .animate({ backgroundColor: "blue" }, 1000); - }); - }); -} - -function test_jQueryget() { - console.log($("li").get(0)); - console.log($("li")[0]); - console.log($("li").get(-1)); - $("*", document.body).click(function (event) { - event.stopPropagation(); - var domElement = $(this).get(0); - $("span:first").text("Clicked on - " + domElement.nodeName); - }); - - function display(divs) { - var a = []; - for (var i = 0; i < divs.length; i++) { - a.push(divs[i].innerHTML); - } - $("span").text(a.join(" ")); - } - display($("div").get().reverse()); -} - -function test_globalEval() { - jQuery.globalEval("var newVar = true;"); -} - -function test_grep() { - var arr = [1, 9, 3, 8, 6, 1, 5, 9, 4, 7, 3, 8, 6, 9, 1]; - $("div").text(arr.join(", ")); - arr = jQuery.grep(arr, function (n, i) { - return (n != 5 && i > 4); - }); - $("p").text(arr.join(", ")); - var arr2 = jQuery.grep(arr, function (a) { return a != 9; }); - $("span").text(arr.join(", ")); - $.grep([0, 1, 2], function (n, i) { - return n > 0; - }, true); - var arr3 = $.grep(["a", "b", "c"], function (n, i) { return n !== "b"; }); -} - -function test_has() { - $('li').has('ul').css('background-color', 'red'); - $("ul").append("
    • " + ($("ul").has("li").length ? "Yes" : "No") + "
    • "); - $("ul").has("li").addClass("full"); -} - -function test_hasClass() { - $('#mydiv').hasClass('foo'); - $("div#result1").append($("p:first").hasClass("selected").toString()); - $("div#result2").append($("p:last").hasClass("selected").toString()); - $("div#result3").append($("p").hasClass("selected").toString()); -} - -function test_hasData() { - var $p = jQuery("p"), p = $p[0]; - $p.append(jQuery.hasData(p) + " "); - $.data(p, "testing", 123); - $p.append(jQuery.hasData(p) + " "); - $.removeData(p, "testing"); - $p.append(jQuery.hasData(p) + " "); - $p.on('click', function () { }); - $p.append(jQuery.hasData(p) + " "); - $p.off('click'); - $p.append(jQuery.hasData(p) + " "); -} - -function test_jQuery_proxy() { - - function test1() { - var me = { - type: "zombie", - test: function (event?) { - // Without proxy, `this` would refer to the event target - // use event.target to reference that element. - var element = event.target; - $(element).css("background-color", "red"); - - // With proxy, `this` refers to the me object encapsulating - // this function. - $("#log").append("Hello " + this.type + "
      "); - $("#test").off("click", this.test); - } - }; - - var you = { - type: "person", - test: function (event?) { - $("#log").append(this.type + " "); - } - }; - - // Execute you.test() in the context of the `you` object - // no matter where it is called - // i.e. the `this` keyword will refer to `you` - var youClick = $.proxy(you.test, you); - - // attach click handlers to #test - $("#test") - // this === "zombie"; handler unbound after first click - .on("click", $.proxy(me.test, me)) - - // this === "person" - .on("click", youClick) - - // this === "zombie" - .on("click", $.proxy(you.test, me)) - - // this === "