From d3453c5e83a480d2f9dfb29259a754c72ce4bf02 Mon Sep 17 00:00:00 2001 From: Mark Crawshaw Date: Sat, 25 Mar 2017 12:33:36 +1100 Subject: [PATCH 01/56] Updated to match lib version 3.0.0 & new 'types' folder --- types/redux-logger/index.d.ts | 6 +++--- types/redux-logger/redux-logger-tests.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/redux-logger/index.d.ts b/types/redux-logger/index.d.ts index becaf79c29..042dd49c92 100644 --- a/types/redux-logger/index.d.ts +++ b/types/redux-logger/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for redux-logger v2.10.1 +// Type definitions for redux-logger v3.0.0 // Project: https://github.com/fcomb/redux-logger // Definitions by: Alexander Rusakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -46,6 +46,6 @@ export interface ReduxLoggerOptions { diffPredicate?: LoggerPredicate; } -declare function createLogger(options?: ReduxLoggerOptions): Redux.Middleware; +export function createLogger(options?: ReduxLoggerOptions): Redux.Middleware; -export default createLogger; +export default logger; diff --git a/types/redux-logger/redux-logger-tests.ts b/types/redux-logger/redux-logger-tests.ts index b2ccaa4432..db0131b95e 100644 --- a/types/redux-logger/redux-logger-tests.ts +++ b/types/redux-logger/redux-logger-tests.ts @@ -1,7 +1,7 @@ -import createLogger from 'redux-logger'; -import {logger} from 'redux-logger'; -import { applyMiddleware, createStore } from 'redux' +import {createLogger} from 'redux-logger'; +import logger from 'redux-logger'; +import { applyMiddleware, createStore } from 'redux'; let loggerSimple = createLogger(); From 3b6ee1231b3cad4b6660bc5de3fe1a30ebc0289d Mon Sep 17 00:00:00 2001 From: Chris Gervang Date: Fri, 24 Mar 2017 20:49:44 -0700 Subject: [PATCH 02/56] Additions Plotly.js Type Definition --- types/plotly.js/index.d.ts | 294 +++++++++++++++++++++++++++++++++---- 1 file changed, 264 insertions(+), 30 deletions(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 863c708abb..0907914965 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -1,39 +1,273 @@ // Type definitions for plotly.js +// Version: 1.22 // Project: https://plot.ly/javascript/ -// Definitions by: Martin Duparc +// Definitions by: Chris Gervang , Martin Duparc // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface PlotlyConfig { - staticPlot?: boolean, - editable?: boolean, - autosizable?: boolean, - fillFrame?: boolean, - frameMargins?: number, - scrollZoom?: boolean, - doubleClick?: string, - showTips?: boolean, - showLink?: boolean, - sendData?: boolean, - linkText?: string, - showSources?: boolean, - displayModeBar?: string|boolean, - modeBarButtonsToRemove?: any[], - modeBarButtonsToAdd?: any[], - modeBarButtons?: boolean, - displaylogo?: boolean, - plotGlPixelRatio?: number, - setBackground?: any, - topojsonURL?: string, - mapboxAccessToken?: string, - logging?: boolean +declare module 'plotly' { + var Plotly: Plotly.PlotlyStatic; + export = Plotly; + } -interface PlotlyStatic { - newPlot(divid:string | HTMLElement, data:any[], layout?:any, config?:PlotlyConfig):void; +declare var Plotly: Plotly.PlotlyStatic; + +declare namespace Plots { + interface StaticPlots { + resize: (root: Plotly.Root) => void + } } -declare module "plotly.js" { - export = plotly; -} +declare namespace Plotly { + interface PlotlyStatic { + Plots: Plots.StaticPlots + newPlot: (root: Root, data: Partial[], layout: Partial, config: Partial) => void + relayout: (root: Root, layout: Partial) => void + redraw: (root: Root) => void + purge: (root: Root) => void + d3: any + } -declare var plotly:PlotlyStatic; + type Root = string | HTMLElement + + type Data = ScatterData + + interface RangeSlider { + visible: boolean + thickness: number + range: [Datum, Datum] + borderwidth: number + bordercolor: string + bgcolor: string + } + + interface RangeSelectorButton { + step: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year' | 'all' + stepmode: 'backward' | 'todate' + count: number + label: string + } + + interface Font { + family: string + size: number + color: string + } + + interface RangeSelector { + buttons: Partial[] + visible: boolean + x: number + xanchor: 'auto' | 'left' | 'center' | 'right' + y: number + yanchor: 'auto' | 'top' | 'middle' | 'bottom' + bgcolor: string + activecolor: string + bordercolor: string + borderwidth: number + font: Partial + } + + type AxisType = "date" | "log" | "linear" + + interface Axis { + showgrid: boolean + fixedrange: boolean + rangemode: "tozero" | 'normal' | 'nonnegative' + type: AxisType + tickformat: string + hoverformat: string + rangeslider: Partial + rangeselector: Partial, + range: [Datum, Datum] + showticklabels: boolean + autotick: boolean + zeroline: boolean + autorange: boolean | 'reversed' + } + + interface Layout { + autosize: boolean + showlegend: boolean + xaxis: Partial + yaxis: Partial + margin: Partial + height: number + width: number + hovermode: "closest" | "x" | "y" | false + 'xaxis.range': [Datum, Datum] + 'yaxis.range': [Datum, Datum] + 'yaxis.type': AxisType + 'xaxis.type': AxisType + 'xaxis.autorange': boolean + 'yaxis.autorange': boolean + shapes: Partial[] + } + + interface ShapeLine { + color: string + width: number + dash: Dash + } + + interface Shape { + visible: boolean + layer: 'below' | 'above' + type: 'rect' | 'circle' | 'line' | 'path' + path: string + // x-reference is assigned to the x-values + xref: 'x' | 'paper' + // y-reference is assigned to the plot paper [0,1] + yref: 'paper' | 'y' + x0: Datum + y0: Datum + x1: Datum + y1: Datum + fillcolor: string + opacity: number + line: Partial + } + + interface Margin { + t: number + b: number + l: number + r: number + } + + type ModeBarButtons = 'lasso2d' | 'select2d' | 'sendDataToCloud' | 'autoScale2d' | + 'zoom2d' | 'pan2d' | 'zoomIn2d' | 'zoomOut2d' | 'autoScale2d' | 'resetScale2d' | + 'hoverClosestCartesian' | 'hoverCompareCartesian' | 'zoom3d' | 'pan3d' | 'orbitRotation' | + 'tableRotation' | 'resetCameraDefault3d' | 'resetCameraLastSave3d' | 'hoverClosest3d' | + 'zoomInGeo' | 'zoomOutGeo' | 'resetGeo' | 'hoverClosestGeo' | 'hoverClosestGl2d' | + 'hoverClosestPie' | 'toggleHover' | 'resetViews' + + type Datum = string | number | Date + + interface ScatterData { + type: 'scatter' | 'scattergl' + x: Datum[] + y: Datum[] + text: string | string[] + line: Partial + marker: Partial + mode: "lines" | "markers" | "text" | "lines+markers" | "text+markers" | "text+lines" | "text+lines+markers" | "none" + hoveron: "points" | "fills" + hoverinfo: "text" + fill: 'none' | 'tozeroy' | 'tozerox' | 'tonexty' | 'tonextx' | 'toself' | 'tonext' + fillcolor: string + legendgroup: string + name: string + connectgaps: boolean + } + + interface ScatterMarker { + symbol: "" //Drawing.symbolList + opacity: number + size: number + maxdisplayed: number + sizeref: number + sizemin: number + sizemode: "diameter" | "area" + showscale: boolean + line: {} //TODO + colorbar: {} //TODO + } + + type Dash = 'solid' | 'dot' | 'dash' | 'longdash' | 'dashdot' | 'longdashdot' + + interface ScatterLine { + color: string + width: number + dash: Dash + shape: 'linear' | 'spline' | 'hv' | 'vh' | 'hvh' | 'vhv' + smoothing: number + simplify: boolean + } + + interface Config { + // no interactivity, for export or image generation + staticPlot: boolean + + // we can edit titles, move annotations, etc + editable: boolean + + // DO autosize once regardless of layout.autosize + // (use default width or height values otherwise) + autosizable: boolean + + // set the length of the undo/redo queue + queueLength: number + + // if we DO autosize, do we fill the container or the screen? + fillFrame: boolean + + // if we DO autosize, set the frame margins in percents of plot size + frameMargins: number + + // mousewheel or two-finger scroll zooms the plot + scrollZoom: boolean + + // double click interaction (false, 'reset', 'autosize' or 'reset+autosize') + doubleClick: 'reset+autosize' | 'reset' | 'autosize' | false + + // new users see some hints about interactivity + showTips: boolean + + // link to open this plot in plotly + showLink: boolean + + // if we show a link, does it contain data or just link to a plotly file? + sendData: boolean + + // text appearing in the sendData link + linkText: string + + // false or function adding source(s) to linkText + showSources: boolean + + // display the mode bar (true, false, or 'hover') + displayModeBar: 'hover' | boolean + + // remove mode bar button by name + // (see ./components/modebar/buttons.js for the list of names) + modeBarButtonsToRemove: ModeBarButtons[], + + // add mode bar button using config objects + // (see ./components/modebar/buttons.js for list of arguments) + modeBarButtonsToAdd: ModeBarButtons[], + + // fully custom mode bar buttons as nested array, + // where the outer arrays represents button groups, and + // the inner arrays have buttons config objects or names of default buttons + // (see ./components/modebar/buttons.js for more info) + modeBarButtons: boolean + + // add the plotly logo on the end of the mode bar + displaylogo: boolean + + // increase the pixel ratio for Gl plot images + plotGlPixelRatio: number + + // function to add the background color to a different container + // or 'opaque' to ensure there's white behind it + setBackground: string | 'opaque' + + // URL to topojson files used in geo charts + topojsonURL: string + + // Mapbox access token (required to plot mapbox trace types) + // If using an Mapbox Atlas server, set this option to '', + // so that plotly.js won't attempt to authenticate to the public Mapbox server. + mapboxAccessToken: string + + // Turn all console logging on or off (errors will be thrown) + // This should ONLY be set via Plotly.setPlotConfig + logging: boolean + + // Set global transform to be applied to all traces with no + // specification needed + globalTransforms: any[] + + } +} From bfa2fe98076167020492579dbeb86db98eba59e0 Mon Sep 17 00:00:00 2001 From: Chris Gervang Date: Fri, 24 Mar 2017 21:40:56 -0700 Subject: [PATCH 03/56] Added a basic bar data type, and updated the test code. --- types/plotly.js/index.d.ts | 146 ++++++++++++++++------------- types/plotly.js/plotly.js-tests.ts | 4 +- 2 files changed, 82 insertions(+), 68 deletions(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 0907914965..51a184e70d 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -4,14 +4,6 @@ // Definitions by: Chris Gervang , Martin Duparc // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module 'plotly' { - var Plotly: Plotly.PlotlyStatic; - export = Plotly; - -} - -declare var Plotly: Plotly.PlotlyStatic; - declare namespace Plots { interface StaticPlots { resize: (root: Plotly.Root) => void @@ -19,53 +11,35 @@ declare namespace Plots { } declare namespace Plotly { + type Root = string | HTMLElement + interface PlotlyStatic { Plots: Plots.StaticPlots - newPlot: (root: Root, data: Partial[], layout: Partial, config: Partial) => void + newPlot: (root: Root, data: Partial[], layout?: Partial, config?: Partial) => void relayout: (root: Root, layout: Partial) => void redraw: (root: Root) => void purge: (root: Root) => void d3: any } - type Root = string | HTMLElement + // Layout - type Data = ScatterData - - interface RangeSlider { - visible: boolean - thickness: number - range: [Datum, Datum] - borderwidth: number - bordercolor: string - bgcolor: string - } - - interface RangeSelectorButton { - step: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year' | 'all' - stepmode: 'backward' | 'todate' - count: number - label: string - } - - interface Font { - family: string - size: number - color: string - } - - interface RangeSelector { - buttons: Partial[] - visible: boolean - x: number - xanchor: 'auto' | 'left' | 'center' | 'right' - y: number - yanchor: 'auto' | 'top' | 'middle' | 'bottom' - bgcolor: string - activecolor: string - bordercolor: string - borderwidth: number - font: Partial + interface Layout { + autosize: boolean + showlegend: boolean + xaxis: Partial + yaxis: Partial + margin: Partial + height: number + width: number + hovermode: "closest" | "x" | "y" | false + 'xaxis.range': [Datum, Datum] + 'yaxis.range': [Datum, Datum] + 'yaxis.type': AxisType + 'xaxis.type': AxisType + 'xaxis.autorange': boolean + 'yaxis.autorange': boolean + shapes: Partial[] } type AxisType = "date" | "log" | "linear" @@ -86,24 +60,6 @@ declare namespace Plotly { autorange: boolean | 'reversed' } - interface Layout { - autosize: boolean - showlegend: boolean - xaxis: Partial - yaxis: Partial - margin: Partial - height: number - width: number - hovermode: "closest" | "x" | "y" | false - 'xaxis.range': [Datum, Datum] - 'yaxis.range': [Datum, Datum] - 'yaxis.type': AxisType - 'xaxis.type': AxisType - 'xaxis.autorange': boolean - 'yaxis.autorange': boolean - shapes: Partial[] - } - interface ShapeLine { color: string width: number @@ -142,8 +98,22 @@ declare namespace Plotly { 'zoomInGeo' | 'zoomOutGeo' | 'resetGeo' | 'hoverClosestGeo' | 'hoverClosestGl2d' | 'hoverClosestPie' | 'toggleHover' | 'resetViews' + // Data + type Datum = string | number | Date + type Dash = 'solid' | 'dot' | 'dash' | 'longdash' | 'dashdot' | 'longdashdot' + + type Data = ScatterData | BarData + + // Bar + interface BarData { + type: 'bar' + x: Datum[] + y: Datum[] + } + + // Scatter interface ScatterData { type: 'scatter' | 'scattergl' x: Datum[] @@ -174,8 +144,6 @@ declare namespace Plotly { colorbar: {} //TODO } - type Dash = 'solid' | 'dot' | 'dash' | 'longdash' | 'dashdot' | 'longdashdot' - interface ScatterLine { color: string width: number @@ -185,6 +153,12 @@ declare namespace Plotly { simplify: boolean } + interface Font { + family: string + size: number + color: string + } + interface Config { // no interactivity, for export or image generation staticPlot: boolean @@ -270,4 +244,44 @@ declare namespace Plotly { globalTransforms: any[] } + + // Components + + interface RangeSlider { + visible: boolean + thickness: number + range: [Datum, Datum] + borderwidth: number + bordercolor: string + bgcolor: string + } + + interface RangeSelectorButton { + step: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year' | 'all' + stepmode: 'backward' | 'todate' + count: number + label: string + } + + interface RangeSelector { + buttons: Partial[] + visible: boolean + x: number + xanchor: 'auto' | 'left' | 'center' | 'right' + y: number + yanchor: 'auto' | 'top' | 'middle' | 'bottom' + bgcolor: string + activecolor: string + bordercolor: string + borderwidth: number + font: Partial + } } + +declare module 'plotly' { + var Plotly: Plotly.PlotlyStatic; + export = Plotly; + +} + +declare var Plotly: Plotly.PlotlyStatic; diff --git a/types/plotly.js/plotly.js-tests.ts b/types/plotly.js/plotly.js-tests.ts index 57fc92d8a9..ede3248eb7 100644 --- a/types/plotly.js/plotly.js-tests.ts +++ b/types/plotly.js/plotly.js-tests.ts @@ -1,6 +1,6 @@ -import * as Plotly from 'plotly.js'; +import * as Plotly from 'plotly'; -var data = [ +var data: Plotly.BarData[] = [ { x: ['giraffes', 'orangutans', 'monkeys'], y: [20, 14, 23], From 53955a935ad26a5f7c141be398fe6bdca14b27c6 Mon Sep 17 00:00:00 2001 From: Chris Gervang Date: Fri, 24 Mar 2017 21:45:29 -0700 Subject: [PATCH 04/56] Adding tslint --- types/plotly.js/tslint.json | 1 + 1 file changed, 1 insertion(+) create mode 100644 types/plotly.js/tslint.json diff --git a/types/plotly.js/tslint.json b/types/plotly.js/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/types/plotly.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file From 0070f246f5b068dbb8ecec7749da8668e68f834b Mon Sep 17 00:00:00 2001 From: Chris Gervang Date: Fri, 24 Mar 2017 22:01:44 -0700 Subject: [PATCH 05/56] Version formatting --- types/plotly.js/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 51a184e70d..3ee0440844 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -1,5 +1,4 @@ -// Type definitions for plotly.js -// Version: 1.22 +// Type definitions for plotly.js 1.22 // Project: https://plot.ly/javascript/ // Definitions by: Chris Gervang , Martin Duparc // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From aab2ca4331f7162c905b3faaa97aada6978c3823 Mon Sep 17 00:00:00 2001 From: Chris Gervang Date: Fri, 24 Mar 2017 22:04:42 -0700 Subject: [PATCH 06/56] Typescript version 2.2 --- types/plotly.js/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 3ee0440844..6cd34bc4ef 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -2,6 +2,7 @@ // Project: https://plot.ly/javascript/ // Definitions by: Chris Gervang , Martin Duparc // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 declare namespace Plots { interface StaticPlots { From b9ce3fc309b428cd903d904277b48cb688765fc3 Mon Sep 17 00:00:00 2001 From: Chris Gervang Date: Fri, 24 Mar 2017 22:11:40 -0700 Subject: [PATCH 07/56] strictNullChecks --- types/plotly.js/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/plotly.js/tsconfig.json b/types/plotly.js/tsconfig.json index 94a19223ed..776f3e5a66 100644 --- a/types/plotly.js/tsconfig.json +++ b/types/plotly.js/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From 144f0dd6727c922e3209966fd75050c4c8eeb331 Mon Sep 17 00:00:00 2001 From: Chris Gervang Date: Sat, 25 Mar 2017 01:17:11 -0700 Subject: [PATCH 08/56] =?UTF-8?q?The=20package=20is=20actually=20called=20?= =?UTF-8?q?plotly.js=20rather=20than=20just=20plotly=20=F0=9F=98=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/plotly.js/index.d.ts | 9 ++------- types/plotly.js/plotly.js-tests.ts | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 6cd34bc4ef..1fbdf3942c 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -278,10 +278,5 @@ declare namespace Plotly { } } -declare module 'plotly' { - var Plotly: Plotly.PlotlyStatic; - export = Plotly; - -} - -declare var Plotly: Plotly.PlotlyStatic; +declare var Plotly: Plotly.PlotlyStatic +export = Plotly \ No newline at end of file diff --git a/types/plotly.js/plotly.js-tests.ts b/types/plotly.js/plotly.js-tests.ts index ede3248eb7..293c5ade6a 100644 --- a/types/plotly.js/plotly.js-tests.ts +++ b/types/plotly.js/plotly.js-tests.ts @@ -1,4 +1,4 @@ -import * as Plotly from 'plotly'; +import * as Plotly from 'plotly.js'; var data: Plotly.BarData[] = [ { From c4b09456225c881de696b76683f5cef93c856cc8 Mon Sep 17 00:00:00 2001 From: rzymek Date: Sat, 25 Mar 2017 09:52:01 +0100 Subject: [PATCH 09/56] lodash - lodash.nth package --- types/lodash.nth/index.d.ts | 8 ++++++++ types/lodash.nth/tsconfig.json | 21 +++++++++++++++++++++ types/lodash.nth/tslint.json | 1 + 3 files changed, 30 insertions(+) create mode 100644 types/lodash.nth/index.d.ts create mode 100644 types/lodash.nth/tsconfig.json create mode 100644 types/lodash.nth/tslint.json diff --git a/types/lodash.nth/index.d.ts b/types/lodash.nth/index.d.ts new file mode 100644 index 0000000000..9576fa5a4e --- /dev/null +++ b/types/lodash.nth/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for lodash.nth 4.0 +// Project: http://lodash.com/ +// Definitions by: Brian Zengel , Ilya Mochalov , Stepan Mikhaylyuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import { nth } from "lodash"; +export = nth; diff --git a/types/lodash.nth/tsconfig.json b/types/lodash.nth/tsconfig.json new file mode 100644 index 0000000000..92ebbc6458 --- /dev/null +++ b/types/lodash.nth/tsconfig.json @@ -0,0 +1,21 @@ +{ + "files": [ + "index.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} \ No newline at end of file diff --git a/types/lodash.nth/tslint.json b/types/lodash.nth/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/types/lodash.nth/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 8af0a7e8453088ac1892ce9f2bc2356ffd6cabaf Mon Sep 17 00:00:00 2001 From: yohei1126 Date: Mon, 23 Jan 2017 14:50:52 +0900 Subject: [PATCH 10/56] msgpack: add module declaration --- types/msgpack/index.d.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/types/msgpack/index.d.ts b/types/msgpack/index.d.ts index 7d15442ce3..ff695b7087 100644 --- a/types/msgpack/index.d.ts +++ b/types/msgpack/index.d.ts @@ -81,3 +81,7 @@ interface MsgPackCallbackResult { } declare var msgpack: MsgPackStatic; + +declare module "msgpack" { + export = msgpack; +} \ No newline at end of file From 0a32d9d78266e436d0305073475baee846c564e9 Mon Sep 17 00:00:00 2001 From: yohei1126 Date: Sat, 4 Feb 2017 13:13:48 +0900 Subject: [PATCH 11/56] fix declaration --- types/msgpack/index.d.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/types/msgpack/index.d.ts b/types/msgpack/index.d.ts index ff695b7087..6b38b985cb 100644 --- a/types/msgpack/index.d.ts +++ b/types/msgpack/index.d.ts @@ -82,6 +82,4 @@ interface MsgPackCallbackResult { declare var msgpack: MsgPackStatic; -declare module "msgpack" { - export = msgpack; -} \ No newline at end of file +export = msgpack; From be2a3869bb744258c9a6b0ad53b038c30b1a7a88 Mon Sep 17 00:00:00 2001 From: yohei1126 Date: Sat, 18 Feb 2017 20:33:40 +0900 Subject: [PATCH 12/56] fix module declaration --- types/msgpack/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/msgpack/index.d.ts b/types/msgpack/index.d.ts index 6b38b985cb..9f869b8eac 100644 --- a/types/msgpack/index.d.ts +++ b/types/msgpack/index.d.ts @@ -83,3 +83,4 @@ interface MsgPackCallbackResult { declare var msgpack: MsgPackStatic; export = msgpack; +export as namespacei msgpack; From e423731ecc4644881354a8ca0e16061d2905d39a Mon Sep 17 00:00:00 2001 From: yohei1126 Date: Sat, 18 Feb 2017 20:37:19 +0900 Subject: [PATCH 13/56] fix module declaration --- types/msgpack/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/msgpack/index.d.ts b/types/msgpack/index.d.ts index 9f869b8eac..d57d49df17 100644 --- a/types/msgpack/index.d.ts +++ b/types/msgpack/index.d.ts @@ -83,4 +83,4 @@ interface MsgPackCallbackResult { declare var msgpack: MsgPackStatic; export = msgpack; -export as namespacei msgpack; +export as namespace msgpack; From fb6f6071946f21d8b8b87afb53ad5b639fea89c2 Mon Sep 17 00:00:00 2001 From: ogis-onishi Date: Thu, 23 Mar 2017 10:30:38 +0900 Subject: [PATCH 14/56] add msgpack namespace on MsgPackStatic --- types/msgpack/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/msgpack/index.d.ts b/types/msgpack/index.d.ts index d57d49df17..15d18d0d70 100644 --- a/types/msgpack/index.d.ts +++ b/types/msgpack/index.d.ts @@ -80,7 +80,7 @@ interface MsgPackCallbackResult { ok: boolean; } -declare var msgpack: MsgPackStatic; +declare var msgpack: msgpack.MsgPackStatic; export = msgpack; export as namespace msgpack; From 91c1a8327d157700bc8a854f6225a7fd1a9ae094 Mon Sep 17 00:00:00 2001 From: yohei1126 Date: Thu, 23 Mar 2017 10:51:10 +0900 Subject: [PATCH 15/56] fix namespace --- types/msgpack/index.d.ts | 118 +++++++++++++++++---------------- types/msgpack/msgpack-tests.ts | 14 ++-- 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/types/msgpack/index.d.ts b/types/msgpack/index.d.ts index 15d18d0d70..9d318641ae 100644 --- a/types/msgpack/index.d.ts +++ b/types/msgpack/index.d.ts @@ -3,81 +3,83 @@ // Definitions by: Shinya Mochizuki // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -interface MsgPackStatic { - /** - * @param data string or ByteArray. - * @param toString return string value if true. - * - * @return string or ByteArray or false. pack failed if false. - */ - pack(data: any, toString?: boolean): any; +declare namespace msgpack { + interface MsgPackStatic { + /** + * @param data string or ByteArray. + * @param toString return string value if true. + * + * @return string or ByteArray or false. pack failed if false. + */ + pack(data: any, toString?: boolean): any; - /** - * @param data string or ByteArray. - * - * @return string or ByteArray or undefined. unpack failed if undefined. - */ - unpack(data: any): any; + /** + * @param data string or ByteArray. + * + * @return string or ByteArray or undefined. unpack failed if undefined. + */ + unpack(data: any): any; - worker: string; + worker: string; - upload(url: string, option: MsgPackUploadOption, callback: MsgPackUploadCallback): void; + upload(url: string, option: MsgPackUploadOption, callback: MsgPackUploadCallback): void; - download(url: string, option: MsgPackDownloadOption, callback: MsgPackDownloadCallback): void; -} + download(url: string, option: MsgPackDownloadOption, callback: MsgPackDownloadCallback): void; + } -interface MsgPackUploadOption { - /** - * string or ByteArray - */ - data: any; + interface MsgPackUploadOption { + /** + * string or ByteArray + */ + data: any; - /** - * use WebWorker if true. - */ - worker?: boolean; + /** + * use WebWorker if true. + */ + worker?: boolean; - /** - * timeout sec. - */ - timeout?: number; + /** + * timeout sec. + */ + timeout?: number; - before?: (xhr: XMLHttpRequest, option: MsgPackUploadOption) => void; + before?: (xhr: XMLHttpRequest, option: MsgPackUploadOption) => void; - after?: (xhr: XMLHttpRequest, option: MsgPackUploadOption, result: MsgPackCallbackResult) => void; -} + after?: (xhr: XMLHttpRequest, option: MsgPackUploadOption, result: MsgPackCallbackResult) => void; + } -interface MsgPackUploadCallback { - (data: string, option: MsgPackUploadOption, result: MsgPackCallbackResult): void; -} + interface MsgPackUploadCallback { + (data: string, option: MsgPackUploadOption, result: MsgPackCallbackResult): void; + } -interface MsgPackDownloadOption { - /** - * use WebWorker if true. - */ - worker?: boolean; + interface MsgPackDownloadOption { + /** + * use WebWorker if true. + */ + worker?: boolean; - /** - * timeout sec. - */ - timeout?: number; + /** + * timeout sec. + */ + timeout?: number; - before?: (xhr: XMLHttpRequest, option: MsgPackDownloadOption) => void; + before?: (xhr: XMLHttpRequest, option: MsgPackDownloadOption) => void; - after?: (xhr: XMLHttpRequest, option: MsgPackDownloadOption, result: MsgPackCallbackResult) => void; -} + after?: (xhr: XMLHttpRequest, option: MsgPackDownloadOption, result: MsgPackCallbackResult) => void; + } -interface MsgPackDownloadCallback { - /** - * @param data string or ByteArray - */ - (data: any, option: MsgPackDownloadCallback, result: MsgPackCallbackResult): void; -} + interface MsgPackDownloadCallback { + /** + * @param data string or ByteArray + */ + (data: any, option: MsgPackDownloadCallback, result: MsgPackCallbackResult): void; + } -interface MsgPackCallbackResult { - status: number; + interface MsgPackCallbackResult { + status: number; - ok: boolean; + ok: boolean; + } } declare var msgpack: msgpack.MsgPackStatic; diff --git a/types/msgpack/msgpack-tests.ts b/types/msgpack/msgpack-tests.ts index da0d12b926..b0b9a716a0 100644 --- a/types/msgpack/msgpack-tests.ts +++ b/types/msgpack/msgpack-tests.ts @@ -1,5 +1,3 @@ - - var packed = msgpack.pack(""); msgpack.unpack(packed); @@ -12,17 +10,17 @@ var uploadOption = { data: "", worker: false, timeout: 10, - before: (xhr: XMLHttpRequest, option: MsgPackUploadOption) => { }, - after: (xhr: XMLHttpRequest, option: MsgPackUploadOption, result: MsgPackCallbackResult) => { } + before: (xhr: XMLHttpRequest, option: msgpack.MsgPackUploadOption) => { }, + after: (xhr: XMLHttpRequest, option: msgpack.MsgPackUploadOption, result: msgpack.MsgPackCallbackResult) => { } }; -var uploadCallback = (data: string, option: MsgPackUploadOption, result: MsgPackCallbackResult) => { }; +var uploadCallback = (data: string, option: msgpack.MsgPackUploadOption, result: msgpack.MsgPackCallbackResult) => { }; msgpack.upload(url, uploadOption, uploadCallback); var downloadOption = { worker: false, timeout: 10, - before: (xhr: XMLHttpRequest, option: MsgPackDownloadOption) => { }, - after: (xhr: XMLHttpRequest, option: MsgPackDownloadOption, result: MsgPackCallbackResult) => { } + before: (xhr: XMLHttpRequest, option: msgpack.MsgPackDownloadOption) => { }, + after: (xhr: XMLHttpRequest, option: msgpack.MsgPackDownloadOption, result: msgpack.MsgPackCallbackResult) => { } }; -var downloadCallback = (data: any, option: MsgPackDownloadOption, result: MsgPackCallbackResult) => { }; +var downloadCallback = (data: any, option: msgpack.MsgPackDownloadOption, result: msgpack.MsgPackCallbackResult) => { }; msgpack.download(url, downloadOption, downloadCallback); From 681c14ffa9c540c279b06ca88a7cbf9383e4c7c6 Mon Sep 17 00:00:00 2001 From: ktmblueskyarb Date: Sat, 25 Mar 2017 12:16:38 +0100 Subject: [PATCH 16/56] Added type definitions for web-animations-js --- web-animations-js/tsconfig.json | 24 +++++ web-animations-js/web-animations-js-tests.ts | 60 ++++++++++++ web-animations-js/web-animations-js.d.ts | 96 ++++++++++++++++++++ 3 files changed, 180 insertions(+) create mode 100644 web-animations-js/tsconfig.json create mode 100644 web-animations-js/web-animations-js-tests.ts create mode 100644 web-animations-js/web-animations-js.d.ts diff --git a/web-animations-js/tsconfig.json b/web-animations-js/tsconfig.json new file mode 100644 index 0000000000..dbf76f478e --- /dev/null +++ b/web-animations-js/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es5", + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "web-animations-js.d.ts", + "web-animations-js-tests.ts" + ] +} \ No newline at end of file diff --git a/web-animations-js/web-animations-js-tests.ts b/web-animations-js/web-animations-js-tests.ts new file mode 100644 index 0000000000..977bc403ac --- /dev/null +++ b/web-animations-js/web-animations-js-tests.ts @@ -0,0 +1,60 @@ +// From the documentation +function test_doc() { + var elem = document.createElement('div'); + var animation = elem.animate({ + opacity: [0.5, 1], + transform: ['scale(0.5)', 'scale(1)'] + }, { + direction: 'alternate', + duration: 500, + iterations: Infinity + }); +} +// From https://io2015codelabs.appspot.com/codelabs/web-animations-transitions-playbackcontrol +// To test KeyframeEffect, SequenceEffect and GroupEffect +function test_AnimationsApiNext() { + function buildFadeIn(target : HTMLElement) { + var steps = [ + { opacity: 0, transform: 'translate(0, 20em)' }, + { opacity: 1, transform: 'translate(0)' } + ]; + return new KeyframeEffect(target, steps, { + duration: 500, + delay: -1000, + fill: 'backwards', + easing: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)' + }); + } + function buildFadeOut(target: HTMLElement) { + var angle = Math.pow((Math.random() * 16) - 6, 3); + var offset = (Math.random() * 20) - 10; + var transform = 'translate(' + offset + 'em, 20em) ' + + 'rotate(' + angle + 'deg) ' + + 'scale(0)'; + var steps = [ + { visibility: 'visible', opacity: 1, transform: 'none' }, + { visibility: 'visible', opacity: 0, transform: transform } + ]; + return new KeyframeEffect(target, steps, { + duration: 1500, + easing: 'ease-in' + }); + } + var effectNode = document.createElement('div'); + effectNode.className = 'circleEffect'; + var bounds = document.documentElement.getBoundingClientRect(); + effectNode.style.left = bounds.left + bounds.width / 2 + 'px'; + effectNode.style.top = bounds.top + bounds.height / 2 + 'px'; + var header = document.querySelector('header'); + header.appendChild(effectNode); + var newColor = 'hsl(' + Math.round(Math.random() * 255) + ', 46%, 42%)'; + effectNode.style.background = newColor; + var scaleSteps = [{ transform: 'scale(0)' }, { transform: 'scale(1)' }]; + var timing = { duration: 2500, easing: 'ease-in-out' }; + var scaleEffect = new KeyframeEffect(effectNode, scaleSteps, timing); + var fadeEffect = new SequenceEffect([buildFadeOut(effectNode), buildFadeIn(effectNode)]); + var allEffects = [scaleEffect, fadeEffect]; + // Play all animations within this group. + var groupEffect = new GroupEffect(allEffects); + var anim = document.timeline.play(groupEffect); +} diff --git a/web-animations-js/web-animations-js.d.ts b/web-animations-js/web-animations-js.d.ts new file mode 100644 index 0000000000..80c98a555a --- /dev/null +++ b/web-animations-js/web-animations-js.d.ts @@ -0,0 +1,96 @@ +// Type definitions for web-animations-js v2.2.2 +// Project: https://github.com/web-animations/web-animations-js +// Definitions by: Kristian Moerch +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare type FillMode = "none" | "forwards" | "backwards" | "both" | "auto"; +declare type PlaybackDirection = "normal" | "reverse" | "alternate" | "alternate-reverse"; +declare type AnimationPlayState = "idle" | "pending" | "running" | "paused" | "finished"; + +interface AnimationPlaybackEvent extends Event { + currentTime: number; + timelineTime: number; +} + +interface AnimationKeyFrame { + easing?: string; + offset?: number; + [key: string]: string | number | number[] | string[]; +} + +interface AnimationTimeline { + currentTime: number; + getAnimations(): any; + play(a: any): any; +} +interface AnimationEffectTiming { + delay?: number; + direction?: PlaybackDirection; + duration?: number; + easing?: string; + endDelay?: number; + fill?: FillMode |  string; + iterationStart?: number; + iterations?: number; + playbackRate?: number; +} +declare class KeyframeEffect { + constructor(target: HTMLElement, effect: AnimationKeyFrame | AnimationKeyFrame[], timing: number | AnimationEffectTiming); + activeDuration: number; + onsample: any; + parent: any; + target: any; + timing: AnimationEffectTiming; + getFrames(): AnimationKeyFrame[]; +} + +interface Animation extends Element { + currentTime: number; + id: string; + oncancel: EventListener; + onfinish: EventListener; + readonly playState: AnimationPlayState; + playbackRate: number; + startTime: number; + cancel(): void; + finish(): void; + pause(): void; + play(): void; + reverse(): void; + effect: KeyframeEffect; + readonly finished: Promise; + readonly ready: Promise; + timeline: AnimationTimeline; +} +declare class Animation extends Element { + currentTime: number; + id: string; + oncancel: EventListener; + onfinish: EventListener; + readonly playState: AnimationPlayState; + playbackRate: number; + startTime: number; + cancel(): void; + finish(): void; + pause(): void; + play(): void; + reverse(): void; + effect: KeyframeEffect; + readonly finished: Promise; + readonly ready: Promise; + timeline: AnimationTimeline; +} + +declare class SequenceEffect extends KeyframeEffect { + constructor(effects: KeyframeEffect[]); +} +declare class GroupEffect extends KeyframeEffect { + constructor(effects: KeyframeEffect[]); +} +interface Element { + animate(effect: AnimationKeyFrame | AnimationKeyFrame[], timing: number | AnimationEffectTiming): Animation; + getAnimations(): Animation[]; +} +interface Document { + timeline: AnimationTimeline; +} \ No newline at end of file From 0d2658c362a70a603aba49a0baa1934e06415af7 Mon Sep 17 00:00:00 2001 From: Alexey Pelykh Date: Sat, 25 Mar 2017 13:50:00 +0200 Subject: [PATCH 17/56] Use hashmap signature instead of Object --- types/cheerio/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/cheerio/index.d.ts b/types/cheerio/index.d.ts index f3615674f5..4096a0f9c2 100644 --- a/types/cheerio/index.d.ts +++ b/types/cheerio/index.d.ts @@ -250,7 +250,7 @@ interface CheerioElement { tagName: string; type: string; name: string; - attribs: Object; + attribs: {[attr: string]: string}; children: CheerioElement[]; childNodes: CheerioElement[]; lastChild: CheerioElement; @@ -272,4 +272,4 @@ declare var cheerio:CheerioAPI; declare module "cheerio" { export = cheerio; -} \ No newline at end of file +} From 5f12128b3ab4153cc4d5292c7c0e9f7afb5f9aa7 Mon Sep 17 00:00:00 2001 From: vilicvane Date: Sat, 25 Mar 2017 22:40:58 +0800 Subject: [PATCH 18/56] Update index.d.ts --- types/body-parser/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/body-parser/index.d.ts b/types/body-parser/index.d.ts index 8d068cb66a..2b17b20ed4 100644 --- a/types/body-parser/index.d.ts +++ b/types/body-parser/index.d.ts @@ -16,7 +16,7 @@ declare namespace bodyParser { interface Options { inflate?: boolean; limit?: number | string; - type?: string | ((req: Request) => any); + type?: string | string[] | ((req: Request) => any); verify?: (req: Request, res: Response, buf: Buffer, encoding: string) => void; } From 30cbfd282cc7e568dc6613831bdc4b0d35bb0233 Mon Sep 17 00:00:00 2001 From: Marcus Longmuir Date: Sat, 25 Mar 2017 01:47:12 +0000 Subject: [PATCH 19/56] google-protobuf - Map fixes, undefined messages and formatting --- .../google/protobuf/api_pb.d.ts | 6 +- .../google/protobuf/compiler/plugin_pb.d.ts | 20 +-- .../google/protobuf/descriptor_pb.d.ts | 160 +++++++++--------- .../google/protobuf/struct_pb.d.ts | 12 +- .../google/protobuf/type_pb.d.ts | 19 ++- types/google-protobuf/index.d.ts | 13 +- 6 files changed, 117 insertions(+), 113 deletions(-) diff --git a/types/google-protobuf/google/protobuf/api_pb.d.ts b/types/google-protobuf/google/protobuf/api_pb.d.ts index a7ba91088c..abb0c56df0 100644 --- a/types/google-protobuf/google/protobuf/api_pb.d.ts +++ b/types/google-protobuf/google/protobuf/api_pb.d.ts @@ -21,8 +21,8 @@ export class Api extends jspb.Message { hasSourceContext(): boolean; clearSourceContext(): void; - getSourceContext(): google_protobuf_source_context_pb.SourceContext; - setSourceContext(value: google_protobuf_source_context_pb.SourceContext): void; + getSourceContext(): google_protobuf_source_context_pb.SourceContext | undefined; + setSourceContext(value?: google_protobuf_source_context_pb.SourceContext): void; clearMixinsList(): void; getMixinsList(): Array; @@ -48,7 +48,7 @@ export namespace Api { methodsList: Array, optionsList: Array, version: string, - sourceContext: google_protobuf_source_context_pb.SourceContext.AsObject, + sourceContext?: google_protobuf_source_context_pb.SourceContext.AsObject, mixinsList: Array, syntax: google_protobuf_type_pb.Syntax, } diff --git a/types/google-protobuf/google/protobuf/compiler/plugin_pb.d.ts b/types/google-protobuf/google/protobuf/compiler/plugin_pb.d.ts index 0e3491e702..bc4a15554f 100644 --- a/types/google-protobuf/google/protobuf/compiler/plugin_pb.d.ts +++ b/types/google-protobuf/google/protobuf/compiler/plugin_pb.d.ts @@ -34,10 +34,10 @@ export class Version extends jspb.Message { export namespace Version { export type AsObject = { - major: number, - minor: number, - patch: number, - suffix: string, + major?: number, + minor?: number, + patch?: number, + suffix?: string, } } @@ -60,7 +60,7 @@ export class CodeGeneratorRequest extends jspb.Message { hasCompilerVersion(): boolean; clearCompilerVersion(): void; getCompilerVersion(): Version; - setCompilerVersion(value: Version): void; + setCompilerVersion(value?: Version): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): CodeGeneratorRequest.AsObject; @@ -75,7 +75,7 @@ export class CodeGeneratorRequest extends jspb.Message { export namespace CodeGeneratorRequest { export type AsObject = { fileToGenerateList: Array, - parameter: string, + parameter?: string, protoFileList: Array, compilerVersion: Version.AsObject, } @@ -104,7 +104,7 @@ export class CodeGeneratorResponse extends jspb.Message { export namespace CodeGeneratorResponse { export type AsObject = { - error: string, + error?: string, fileList: Array, } @@ -136,9 +136,9 @@ export namespace CodeGeneratorResponse { export namespace File { export type AsObject = { - name: string, - insertionPoint: string, - content: string, + name?: string, + insertionPoint?: string, + content?: string, } } } diff --git a/types/google-protobuf/google/protobuf/descriptor_pb.d.ts b/types/google-protobuf/google/protobuf/descriptor_pb.d.ts index 294cbab1dc..920850a8d8 100644 --- a/types/google-protobuf/google/protobuf/descriptor_pb.d.ts +++ b/types/google-protobuf/google/protobuf/descriptor_pb.d.ts @@ -71,12 +71,12 @@ export class FileDescriptorProto extends jspb.Message { hasOptions(): boolean; clearOptions(): void; getOptions(): FileOptions; - setOptions(value: FileOptions): void; + setOptions(value?: FileOptions): void; hasSourceCodeInfo(): boolean; clearSourceCodeInfo(): void; getSourceCodeInfo(): SourceCodeInfo; - setSourceCodeInfo(value: SourceCodeInfo): void; + setSourceCodeInfo(value?: SourceCodeInfo): void; hasSyntax(): boolean; clearSyntax(): void; @@ -95,8 +95,8 @@ export class FileDescriptorProto extends jspb.Message { export namespace FileDescriptorProto { export type AsObject = { - name: string, - package: string, + name?: string, + package?: string, dependencyList: Array, publicDependencyList: Array, weakDependencyList: Array, @@ -106,7 +106,7 @@ export namespace FileDescriptorProto { extensionList: Array, options: FileOptions.AsObject, sourceCodeInfo: SourceCodeInfo.AsObject, - syntax: string, + syntax?: string, } } @@ -149,7 +149,7 @@ export class DescriptorProto extends jspb.Message { hasOptions(): boolean; clearOptions(): void; getOptions(): MessageOptions; - setOptions(value: MessageOptions): void; + setOptions(value?: MessageOptions): void; clearReservedRangeList(): void; getReservedRangeList(): Array; @@ -173,7 +173,7 @@ export class DescriptorProto extends jspb.Message { export namespace DescriptorProto { export type AsObject = { - name: string, + name?: string, fieldList: Array, extensionList: Array, nestedTypeList: Array, @@ -208,8 +208,8 @@ export namespace DescriptorProto { export namespace ExtensionRange { export type AsObject = { - start: number, - end: number, + start?: number, + end?: number, } } @@ -236,8 +236,8 @@ export namespace DescriptorProto { export namespace ReservedRange { export type AsObject = { - start: number, - end: number, + start?: number, + end?: number, } } } @@ -291,7 +291,7 @@ export class FieldDescriptorProto extends jspb.Message { hasOptions(): boolean; clearOptions(): void; getOptions(): FieldOptions; - setOptions(value: FieldOptions): void; + setOptions(value?: FieldOptions): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): FieldDescriptorProto.AsObject; @@ -305,15 +305,15 @@ export class FieldDescriptorProto extends jspb.Message { export namespace FieldDescriptorProto { export type AsObject = { - name: string, - number: number, - label: FieldDescriptorProto.Label, - type: FieldDescriptorProto.Type, - typeName: string, - extendee: string, - defaultValue: string, - oneofIndex: number, - jsonName: string, + name?: string, + number?: number, + label?: FieldDescriptorProto.Label, + type?: FieldDescriptorProto.Type, + typeName?: string, + extendee?: string, + defaultValue?: string, + oneofIndex?: number, + jsonName?: string, options: FieldOptions.AsObject, } @@ -337,6 +337,7 @@ export namespace FieldDescriptorProto { TYPE_SINT32 = 17, TYPE_SINT64 = 18, } + export enum Label { LABEL_OPTIONAL = 1, LABEL_REQUIRED = 2, @@ -353,7 +354,7 @@ export class OneofDescriptorProto extends jspb.Message { hasOptions(): boolean; clearOptions(): void; getOptions(): OneofOptions; - setOptions(value: OneofOptions): void; + setOptions(value?: OneofOptions): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): OneofDescriptorProto.AsObject; @@ -367,7 +368,7 @@ export class OneofDescriptorProto extends jspb.Message { export namespace OneofDescriptorProto { export type AsObject = { - name: string, + name?: string, options: OneofOptions.AsObject, } } @@ -386,7 +387,7 @@ export class EnumDescriptorProto extends jspb.Message { hasOptions(): boolean; clearOptions(): void; getOptions(): EnumOptions; - setOptions(value: EnumOptions): void; + setOptions(value?: EnumOptions): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): EnumDescriptorProto.AsObject; @@ -400,7 +401,7 @@ export class EnumDescriptorProto extends jspb.Message { export namespace EnumDescriptorProto { export type AsObject = { - name: string, + name?: string, valueList: Array, options: EnumOptions.AsObject, } @@ -420,7 +421,7 @@ export class EnumValueDescriptorProto extends jspb.Message { hasOptions(): boolean; clearOptions(): void; getOptions(): EnumValueOptions; - setOptions(value: EnumValueOptions): void; + setOptions(value?: EnumValueOptions): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): EnumValueDescriptorProto.AsObject; @@ -434,8 +435,8 @@ export class EnumValueDescriptorProto extends jspb.Message { export namespace EnumValueDescriptorProto { export type AsObject = { - name: string, - number: number, + name?: string, + number?: number, options: EnumValueOptions.AsObject, } } @@ -454,7 +455,7 @@ export class ServiceDescriptorProto extends jspb.Message { hasOptions(): boolean; clearOptions(): void; getOptions(): ServiceOptions; - setOptions(value: ServiceOptions): void; + setOptions(value?: ServiceOptions): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): ServiceDescriptorProto.AsObject; @@ -468,7 +469,7 @@ export class ServiceDescriptorProto extends jspb.Message { export namespace ServiceDescriptorProto { export type AsObject = { - name: string, + name?: string, methodList: Array, options: ServiceOptions.AsObject, } @@ -493,7 +494,7 @@ export class MethodDescriptorProto extends jspb.Message { hasOptions(): boolean; clearOptions(): void; getOptions(): MethodOptions; - setOptions(value: MethodOptions): void; + setOptions(value?: MethodOptions): void; hasClientStreaming(): boolean; clearClientStreaming(): void; @@ -517,12 +518,12 @@ export class MethodDescriptorProto extends jspb.Message { export namespace MethodDescriptorProto { export type AsObject = { - name: string, - inputType: string, - outputType: string, + name?: string, + inputType?: string, + outputType?: string, options: MethodOptions.AsObject, - clientStreaming: boolean, - serverStreaming: boolean, + clientStreaming?: boolean, + serverStreaming?: boolean, } } @@ -619,21 +620,21 @@ export class FileOptions extends jspb.Message { export namespace FileOptions { export type AsObject = { - javaPackage: string, - javaOuterClassname: string, - javaMultipleFiles: boolean, - javaGenerateEqualsAndHash: boolean, - javaStringCheckUtf8: boolean, - optimizeFor: FileOptions.OptimizeMode, - goPackage: string, - ccGenericServices: boolean, - javaGenericServices: boolean, - pyGenericServices: boolean, - deprecated: boolean, - ccEnableArenas: boolean, - objcClassPrefix: string, - csharpNamespace: string, - swiftPrefix: string, + javaPackage?: string, + javaOuterClassname?: string, + javaMultipleFiles?: boolean, + javaGenerateEqualsAndHash?: boolean, + javaStringCheckUtf8?: boolean, + optimizeFor?: FileOptions.OptimizeMode, + goPackage?: string, + ccGenericServices?: boolean, + javaGenericServices?: boolean, + pyGenericServices?: boolean, + deprecated?: boolean, + ccEnableArenas?: boolean, + objcClassPrefix?: string, + csharpNamespace?: string, + swiftPrefix?: string, uninterpretedOptionList: Array, } @@ -682,10 +683,10 @@ export class MessageOptions extends jspb.Message { export namespace MessageOptions { export type AsObject = { - messageSetWireFormat: boolean, - noStandardDescriptorAccessor: boolean, - deprecated: boolean, - mapEntry: boolean, + messageSetWireFormat?: boolean, + noStandardDescriptorAccessor?: boolean, + deprecated?: boolean, + mapEntry?: boolean, uninterpretedOptionList: Array, } } @@ -738,12 +739,12 @@ export class FieldOptions extends jspb.Message { export namespace FieldOptions { export type AsObject = { - ctype: FieldOptions.CType, - packed: boolean, - jstype: FieldOptions.JSType, - lazy: boolean, - deprecated: boolean, - weak: boolean, + ctype?: FieldOptions.CType, + packed?: boolean, + jstype?: FieldOptions.JSType, + lazy?: boolean, + deprecated?: boolean, + weak?: boolean, uninterpretedOptionList: Array, } @@ -752,6 +753,7 @@ export namespace FieldOptions { CORD = 1, STRING_PIECE = 2, } + export enum JSType { JS_NORMAL = 0, JS_STRING = 1, @@ -809,8 +811,8 @@ export class EnumOptions extends jspb.Message { export namespace EnumOptions { export type AsObject = { - allowAlias: boolean, - deprecated: boolean, + allowAlias?: boolean, + deprecated?: boolean, uninterpretedOptionList: Array, } } @@ -838,7 +840,7 @@ export class EnumValueOptions extends jspb.Message { export namespace EnumValueOptions { export type AsObject = { - deprecated: boolean, + deprecated?: boolean, uninterpretedOptionList: Array, } } @@ -866,7 +868,7 @@ export class ServiceOptions extends jspb.Message { export namespace ServiceOptions { export type AsObject = { - deprecated: boolean, + deprecated?: boolean, uninterpretedOptionList: Array, } } @@ -899,8 +901,8 @@ export class MethodOptions extends jspb.Message { export namespace MethodOptions { export type AsObject = { - deprecated: boolean, - idempotencyLevel: MethodOptions.IdempotencyLevel, + deprecated?: boolean, + idempotencyLevel?: MethodOptions.IdempotencyLevel, uninterpretedOptionList: Array, } @@ -962,12 +964,12 @@ export class UninterpretedOption extends jspb.Message { export namespace UninterpretedOption { export type AsObject = { nameList: Array, - identifierValue: string, - positiveIntValue: number, - negativeIntValue: number, - doubleValue: number, + identifierValue?: string, + positiveIntValue?: number, + negativeIntValue?: number, + doubleValue?: number, stringValue: Uint8Array | string, - aggregateValue: string, + aggregateValue?: string, } export class NamePart extends jspb.Message { @@ -993,8 +995,8 @@ export namespace UninterpretedOption { export namespace NamePart { export type AsObject = { - namePart: string, - isExtension: boolean, + namePart?: string, + isExtension?: boolean, } } } @@ -1060,8 +1062,8 @@ export namespace SourceCodeInfo { export type AsObject = { pathList: Array, spanList: Array, - leadingComments: string, - trailingComments: string, + leadingComments?: string, + trailingComments?: string, leadingDetachedCommentsList: Array, } } @@ -1122,9 +1124,9 @@ export namespace GeneratedCodeInfo { export namespace Annotation { export type AsObject = { pathList: Array, - sourceFile: string, - begin: number, - end: number, + sourceFile?: string, + begin?: number, + end?: number, } } } diff --git a/types/google-protobuf/google/protobuf/struct_pb.d.ts b/types/google-protobuf/google/protobuf/struct_pb.d.ts index 46c28ad1df..ed033e91ce 100644 --- a/types/google-protobuf/google/protobuf/struct_pb.d.ts +++ b/types/google-protobuf/google/protobuf/struct_pb.d.ts @@ -46,13 +46,13 @@ export class Value extends jspb.Message { hasStructValue(): boolean; clearStructValue(): void; - getStructValue(): Struct; - setStructValue(value: Struct): void; + getStructValue(): Struct | undefined; + setStructValue(value?: Struct): void; hasListValue(): boolean; clearListValue(): void; - getListValue(): ListValue; - setListValue(value: ListValue): void; + getListValue(): ListValue | undefined; + setListValue(value?: ListValue): void; getKindCase(): Value.KindCase; @@ -75,8 +75,8 @@ export namespace Value { numberValue: number, stringValue: string, boolValue: boolean, - structValue: Struct.AsObject, - listValue: ListValue.AsObject, + structValue?: Struct.AsObject, + listValue?: ListValue.AsObject, } export enum KindCase { diff --git a/types/google-protobuf/google/protobuf/type_pb.d.ts b/types/google-protobuf/google/protobuf/type_pb.d.ts index 186bad8d36..cb330a9318 100644 --- a/types/google-protobuf/google/protobuf/type_pb.d.ts +++ b/types/google-protobuf/google/protobuf/type_pb.d.ts @@ -23,8 +23,8 @@ export class Type extends jspb.Message { hasSourceContext(): boolean; clearSourceContext(): void; - getSourceContext(): google_protobuf_source_context_pb.SourceContext; - setSourceContext(value: google_protobuf_source_context_pb.SourceContext): void; + getSourceContext(): google_protobuf_source_context_pb.SourceContext | undefined; + setSourceContext(value?: google_protobuf_source_context_pb.SourceContext): void; getSyntax(): Syntax; setSyntax(value: Syntax): void; @@ -45,7 +45,7 @@ export namespace Type { fieldsList: Array, oneofsList: Array, optionsList: Array, - sourceContext: google_protobuf_source_context_pb.SourceContext.AsObject, + sourceContext?: google_protobuf_source_context_pb.SourceContext.AsObject, syntax: Syntax, } } @@ -128,6 +128,7 @@ export namespace Field { TYPE_SINT32 = 17, TYPE_SINT64 = 18, } + export enum Cardinality { CARDINALITY_UNKNOWN = 0, CARDINALITY_OPTIONAL = 1, @@ -152,8 +153,8 @@ export class Enum extends jspb.Message { hasSourceContext(): boolean; clearSourceContext(): void; - getSourceContext(): google_protobuf_source_context_pb.SourceContext; - setSourceContext(value: google_protobuf_source_context_pb.SourceContext): void; + getSourceContext(): google_protobuf_source_context_pb.SourceContext | undefined; + setSourceContext(value?: google_protobuf_source_context_pb.SourceContext): void; getSyntax(): Syntax; setSyntax(value: Syntax): void; @@ -173,7 +174,7 @@ export namespace Enum { name: string, enumvalueList: Array, optionsList: Array, - sourceContext: google_protobuf_source_context_pb.SourceContext.AsObject, + sourceContext?: google_protobuf_source_context_pb.SourceContext.AsObject, syntax: Syntax, } } @@ -214,8 +215,8 @@ export class Option extends jspb.Message { hasValue(): boolean; clearValue(): void; - getValue(): google_protobuf_any_pb.Any; - setValue(value: google_protobuf_any_pb.Any): void; + getValue(): google_protobuf_any_pb.Any | undefined; + setValue(value?: google_protobuf_any_pb.Any): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Option.AsObject; @@ -230,7 +231,7 @@ export class Option extends jspb.Message { export namespace Option { export type AsObject = { name: string, - value: google_protobuf_any_pb.Any.AsObject, + value?: google_protobuf_any_pb.Any.AsObject, } } diff --git a/types/google-protobuf/index.d.ts b/types/google-protobuf/index.d.ts index 9dcb7ea609..8ed770deca 100644 --- a/types/google-protobuf/index.d.ts +++ b/types/google-protobuf/index.d.ts @@ -170,13 +170,14 @@ export class Map { arr: Array<[K, V]>, valueCtor?: {new(init: any): V}); toArray(): Array<[K, V]>; - toObject( + toObject(includeInstance?: boolean): Array<[K, V]>; + toObject( includeInstance: boolean, - valueToObject: (includeInstance: boolean) => any): Array<[K, V]>; - static fromObject( - entries: Array<[K, V]>, + valueToObject: (includeInstance: boolean, valueWrapper: V) => VO): Array<[K, VO]>; + static fromObject( + entries: Array<[TK, TV]>, valueCtor: any, - valueFromObject: any): Map; + valueFromObject: any): Map; getLength(): number; clear(): void; del(key: K): boolean; @@ -186,7 +187,7 @@ export class Map { forEach( callback: (entry: V, key: K) => void, thisArg?: {}): void; - set(key: K, value: V): void; + set(key: K, value: V): this; get(key: K): (V | undefined); has(key: K): boolean; } From 330ccde014082ace33f02004a5f7c5edda4b844b Mon Sep 17 00:00:00 2001 From: kadler15 Date: Fri, 10 Feb 2017 11:08:13 -0800 Subject: [PATCH 20/56] Reverse signals and errno in node os.constants --- types/node/index.d.ts | 4 +- types/node/node-tests.ts | 131 ++++++++++++++++++++++++++++++++++++ types/node/v6/index.d.ts | 4 +- types/node/v6/node-tests.ts | 123 +++++++++++++++++++++++++++++++++ 4 files changed, 258 insertions(+), 4 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index e7dbe3c1a7..f132b2e64f 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1209,7 +1209,7 @@ declare module "os" { export function userInfo(options?: { encoding: string }): { username: string, uid: number, gid: number, shell: any, homedir: string } export var constants: { UV_UDP_REUSEADDR: number, - errno: { + signals: { SIGHUP: number; SIGINT: number; SIGQUIT: number; @@ -1245,7 +1245,7 @@ declare module "os" { SIGSYS: number; SIGUNUSED: number; }, - signals: { + errno: { E2BIG: number; EACCES: number; EADDRINUSE: number; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 63067a9305..49de6b8b45 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -1591,6 +1591,137 @@ namespace os_tests { result = os.networkInterfaces(); } + + { + let result: number; + + result = os.constants.signals.SIGHUP; + result = os.constants.signals.SIGINT; + result = os.constants.signals.SIGKILL; + } + + { + let result: number; + + result = os.constants.errno.E2BIG; + result = os.constants.errno.EACCES; + result = os.constants.errno.EADDRINUSE; + result = os.constants.errno.EADDRNOTAVAIL; + result = os.constants.errno.EAFNOSUPPORT; + result = os.constants.errno.EAGAIN; + result = os.constants.errno.EALREADY; + result = os.constants.errno.EBADF; + result = os.constants.errno.EBADMSG; + result = os.constants.errno.EBUSY; + result = os.constants.errno.ECANCELED; + result = os.constants.errno.ECHILD; + result = os.constants.errno.ECONNABORTED; + result = os.constants.errno.ECONNREFUSED; + result = os.constants.errno.ECONNRESET; + result = os.constants.errno.EDEADLK; + result = os.constants.errno.EDESTADDRREQ; + result = os.constants.errno.EDOM; + result = os.constants.errno.EDQUOT; + result = os.constants.errno.EEXIST; + result = os.constants.errno.EFAULT; + result = os.constants.errno.EFBIG; + result = os.constants.errno.EHOSTUNREACH; + result = os.constants.errno.EIDRM; + result = os.constants.errno.EILSEQ; + result = os.constants.errno.EINPROGRESS; + result = os.constants.errno.EINTR; + result = os.constants.errno.EINVAL; + result = os.constants.errno.EIO; + result = os.constants.errno.EISCONN; + result = os.constants.errno.EISDIR; + result = os.constants.errno.ELOOP; + result = os.constants.errno.EMFILE; + result = os.constants.errno.EMLINK; + result = os.constants.errno.EMSGSIZE; + result = os.constants.errno.EMULTIHOP; + result = os.constants.errno.ENAMETOOLONG; + result = os.constants.errno.ENETDOWN; + result = os.constants.errno.ENETRESET; + result = os.constants.errno.ENETUNREACH; + result = os.constants.errno.ENFILE; + result = os.constants.errno.ENOBUFS; + result = os.constants.errno.ENODATA; + result = os.constants.errno.ENODEV; + result = os.constants.errno.ENOENT; + result = os.constants.errno.ENOEXEC; + result = os.constants.errno.ENOLCK; + result = os.constants.errno.ENOLINK; + result = os.constants.errno.ENOMEM; + result = os.constants.errno.ENOMSG; + result = os.constants.errno.ENOPROTOOPT; + result = os.constants.errno.ENOSPC; + result = os.constants.errno.ENOSR; + result = os.constants.errno.ENOSTR; + result = os.constants.errno.ENOSYS; + result = os.constants.errno.ENOTCONN; + result = os.constants.errno.ENOTDIR; + result = os.constants.errno.ENOTEMPTY; + result = os.constants.errno.ENOTSOCK; + result = os.constants.errno.ENOTSUP; + result = os.constants.errno.ENOTTY; + result = os.constants.errno.ENXIO; + result = os.constants.errno.EOPNOTSUPP; + result = os.constants.errno.EOVERFLOW; + result = os.constants.errno.EPERM; + result = os.constants.errno.EPIPE; + result = os.constants.errno.EPROTO; + result = os.constants.errno.EPROTONOSUPPORT; + result = os.constants.errno.EPROTOTYPE; + result = os.constants.errno.ERANGE; + result = os.constants.errno.EROFS; + result = os.constants.errno.ESPIPE; + result = os.constants.errno.ESRCH; + result = os.constants.errno.ESTALE; + result = os.constants.errno.ETIME; + result = os.constants.errno.ETIMEDOUT; + result = os.constants.errno.ETXTBSY; + result = os.constants.errno.EWOULDBLOCK; + result = os.constants.errno.EXDEV; + } + + { + let result: number; + + result = os.constants.signals.SIGHUP; + result = os.constants.signals.SIGINT; + result = os.constants.signals.SIGQUIT; + result = os.constants.signals.SIGILL; + result = os.constants.signals.SIGTRAP; + result = os.constants.signals.SIGABRT; + result = os.constants.signals.SIGIOT; + result = os.constants.signals.SIGBUS; + result = os.constants.signals.SIGFPE; + result = os.constants.signals.SIGKILL; + result = os.constants.signals.SIGUSR1; + result = os.constants.signals.SIGSEGV; + result = os.constants.signals.SIGUSR2; + result = os.constants.signals.SIGPIPE; + result = os.constants.signals.SIGALRM; + result = os.constants.signals.SIGTERM; + result = os.constants.signals.SIGCHLD; + result = os.constants.signals.SIGSTKFLT; + result = os.constants.signals.SIGCONT; + result = os.constants.signals.SIGSTOP; + result = os.constants.signals.SIGTSTP; + result = os.constants.signals.SIGTTIN; + result = os.constants.signals.SIGTTOU; + result = os.constants.signals.SIGURG; + result = os.constants.signals.SIGXCPU; + result = os.constants.signals.SIGXFSZ; + result = os.constants.signals.SIGVTALRM; + result = os.constants.signals.SIGPROF; + result = os.constants.signals.SIGWINCH; + result = os.constants.signals.SIGIO; + result = os.constants.signals.SIGPOLL; + result = os.constants.signals.SIGPWR; + result = os.constants.signals.SIGSYS; + result = os.constants.signals.SIGUNUSED; + } } //////////////////////////////////////////////////// diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index da214056fc..f18f006e0c 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -1152,7 +1152,7 @@ declare module "os" { export function userInfo(options?: { encoding: string }): { username: string, uid: number, gid: number, shell: any, homedir: string } export var constants: { UV_UDP_REUSEADDR: number, - errno: { + signals: { SIGHUP: number; SIGINT: number; SIGQUIT: number; @@ -1188,7 +1188,7 @@ declare module "os" { SIGSYS: number; SIGUNUSED: number; }, - signals: { + errno: { E2BIG: number; EACCES: number; EADDRINUSE: number; diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index 8711d60974..2348bd2dd6 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -1508,6 +1508,129 @@ namespace os_tests { result = os.networkInterfaces(); } + + { + let result: number; + + result = os.constants.signals.SIGHUP; + result = os.constants.signals.SIGINT; + result = os.constants.signals.SIGQUIT; + result = os.constants.signals.SIGILL; + result = os.constants.signals.SIGTRAP; + result = os.constants.signals.SIGABRT; + result = os.constants.signals.SIGIOT; + result = os.constants.signals.SIGBUS; + result = os.constants.signals.SIGFPE; + result = os.constants.signals.SIGKILL; + result = os.constants.signals.SIGUSR1; + result = os.constants.signals.SIGSEGV; + result = os.constants.signals.SIGUSR2; + result = os.constants.signals.SIGPIPE; + result = os.constants.signals.SIGALRM; + result = os.constants.signals.SIGTERM; + result = os.constants.signals.SIGCHLD; + result = os.constants.signals.SIGSTKFLT; + result = os.constants.signals.SIGCONT; + result = os.constants.signals.SIGSTOP; + result = os.constants.signals.SIGTSTP; + result = os.constants.signals.SIGTTIN; + result = os.constants.signals.SIGTTOU; + result = os.constants.signals.SIGURG; + result = os.constants.signals.SIGXCPU; + result = os.constants.signals.SIGXFSZ; + result = os.constants.signals.SIGVTALRM; + result = os.constants.signals.SIGPROF; + result = os.constants.signals.SIGWINCH; + result = os.constants.signals.SIGIO; + result = os.constants.signals.SIGPOLL; + result = os.constants.signals.SIGPWR; + result = os.constants.signals.SIGSYS; + result = os.constants.signals.SIGUNUSED; + } + + { + let result: number; + + result = os.constants.errno.E2BIG; + result = os.constants.errno.EACCES; + result = os.constants.errno.EADDRINUSE; + result = os.constants.errno.EADDRNOTAVAIL; + result = os.constants.errno.EAFNOSUPPORT; + result = os.constants.errno.EAGAIN; + result = os.constants.errno.EALREADY; + result = os.constants.errno.EBADF; + result = os.constants.errno.EBADMSG; + result = os.constants.errno.EBUSY; + result = os.constants.errno.ECANCELED; + result = os.constants.errno.ECHILD; + result = os.constants.errno.ECONNABORTED; + result = os.constants.errno.ECONNREFUSED; + result = os.constants.errno.ECONNRESET; + result = os.constants.errno.EDEADLK; + result = os.constants.errno.EDESTADDRREQ; + result = os.constants.errno.EDOM; + result = os.constants.errno.EDQUOT; + result = os.constants.errno.EEXIST; + result = os.constants.errno.EFAULT; + result = os.constants.errno.EFBIG; + result = os.constants.errno.EHOSTUNREACH; + result = os.constants.errno.EIDRM; + result = os.constants.errno.EILSEQ; + result = os.constants.errno.EINPROGRESS; + result = os.constants.errno.EINTR; + result = os.constants.errno.EINVAL; + result = os.constants.errno.EIO; + result = os.constants.errno.EISCONN; + result = os.constants.errno.EISDIR; + result = os.constants.errno.ELOOP; + result = os.constants.errno.EMFILE; + result = os.constants.errno.EMLINK; + result = os.constants.errno.EMSGSIZE; + result = os.constants.errno.EMULTIHOP; + result = os.constants.errno.ENAMETOOLONG; + result = os.constants.errno.ENETDOWN; + result = os.constants.errno.ENETRESET; + result = os.constants.errno.ENETUNREACH; + result = os.constants.errno.ENFILE; + result = os.constants.errno.ENOBUFS; + result = os.constants.errno.ENODATA; + result = os.constants.errno.ENODEV; + result = os.constants.errno.ENOENT; + result = os.constants.errno.ENOEXEC; + result = os.constants.errno.ENOLCK; + result = os.constants.errno.ENOLINK; + result = os.constants.errno.ENOMEM; + result = os.constants.errno.ENOMSG; + result = os.constants.errno.ENOPROTOOPT; + result = os.constants.errno.ENOSPC; + result = os.constants.errno.ENOSR; + result = os.constants.errno.ENOSTR; + result = os.constants.errno.ENOSYS; + result = os.constants.errno.ENOTCONN; + result = os.constants.errno.ENOTDIR; + result = os.constants.errno.ENOTEMPTY; + result = os.constants.errno.ENOTSOCK; + result = os.constants.errno.ENOTSUP; + result = os.constants.errno.ENOTTY; + result = os.constants.errno.ENXIO; + result = os.constants.errno.EOPNOTSUPP; + result = os.constants.errno.EOVERFLOW; + result = os.constants.errno.EPERM; + result = os.constants.errno.EPIPE; + result = os.constants.errno.EPROTO; + result = os.constants.errno.EPROTONOSUPPORT; + result = os.constants.errno.EPROTOTYPE; + result = os.constants.errno.ERANGE; + result = os.constants.errno.EROFS; + result = os.constants.errno.ESPIPE; + result = os.constants.errno.ESRCH; + result = os.constants.errno.ESTALE; + result = os.constants.errno.ETIME; + result = os.constants.errno.ETIMEDOUT; + result = os.constants.errno.ETXTBSY; + result = os.constants.errno.EWOULDBLOCK; + result = os.constants.errno.EXDEV; + } } //////////////////////////////////////////////////// From fd3da9791a63ae0e52113c5388a1163b5ca67d38 Mon Sep 17 00:00:00 2001 From: kadler15 Date: Fri, 10 Feb 2017 11:14:18 -0800 Subject: [PATCH 21/56] Align test order --- types/node/node-tests.ts | 70 ++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 39 deletions(-) diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 49de6b8b45..568d15d096 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -1597,7 +1597,38 @@ namespace os_tests { result = os.constants.signals.SIGHUP; result = os.constants.signals.SIGINT; + result = os.constants.signals.SIGQUIT; + result = os.constants.signals.SIGILL; + result = os.constants.signals.SIGTRAP; + result = os.constants.signals.SIGABRT; + result = os.constants.signals.SIGIOT; + result = os.constants.signals.SIGBUS; + result = os.constants.signals.SIGFPE; result = os.constants.signals.SIGKILL; + result = os.constants.signals.SIGUSR1; + result = os.constants.signals.SIGSEGV; + result = os.constants.signals.SIGUSR2; + result = os.constants.signals.SIGPIPE; + result = os.constants.signals.SIGALRM; + result = os.constants.signals.SIGTERM; + result = os.constants.signals.SIGCHLD; + result = os.constants.signals.SIGSTKFLT; + result = os.constants.signals.SIGCONT; + result = os.constants.signals.SIGSTOP; + result = os.constants.signals.SIGTSTP; + result = os.constants.signals.SIGTTIN; + result = os.constants.signals.SIGTTOU; + result = os.constants.signals.SIGURG; + result = os.constants.signals.SIGXCPU; + result = os.constants.signals.SIGXFSZ; + result = os.constants.signals.SIGVTALRM; + result = os.constants.signals.SIGPROF; + result = os.constants.signals.SIGWINCH; + result = os.constants.signals.SIGIO; + result = os.constants.signals.SIGPOLL; + result = os.constants.signals.SIGPWR; + result = os.constants.signals.SIGSYS; + result = os.constants.signals.SIGUNUSED; } { @@ -1683,45 +1714,6 @@ namespace os_tests { result = os.constants.errno.EWOULDBLOCK; result = os.constants.errno.EXDEV; } - - { - let result: number; - - result = os.constants.signals.SIGHUP; - result = os.constants.signals.SIGINT; - result = os.constants.signals.SIGQUIT; - result = os.constants.signals.SIGILL; - result = os.constants.signals.SIGTRAP; - result = os.constants.signals.SIGABRT; - result = os.constants.signals.SIGIOT; - result = os.constants.signals.SIGBUS; - result = os.constants.signals.SIGFPE; - result = os.constants.signals.SIGKILL; - result = os.constants.signals.SIGUSR1; - result = os.constants.signals.SIGSEGV; - result = os.constants.signals.SIGUSR2; - result = os.constants.signals.SIGPIPE; - result = os.constants.signals.SIGALRM; - result = os.constants.signals.SIGTERM; - result = os.constants.signals.SIGCHLD; - result = os.constants.signals.SIGSTKFLT; - result = os.constants.signals.SIGCONT; - result = os.constants.signals.SIGSTOP; - result = os.constants.signals.SIGTSTP; - result = os.constants.signals.SIGTTIN; - result = os.constants.signals.SIGTTOU; - result = os.constants.signals.SIGURG; - result = os.constants.signals.SIGXCPU; - result = os.constants.signals.SIGXFSZ; - result = os.constants.signals.SIGVTALRM; - result = os.constants.signals.SIGPROF; - result = os.constants.signals.SIGWINCH; - result = os.constants.signals.SIGIO; - result = os.constants.signals.SIGPOLL; - result = os.constants.signals.SIGPWR; - result = os.constants.signals.SIGSYS; - result = os.constants.signals.SIGUNUSED; - } } //////////////////////////////////////////////////// From 4abf6ddb2bc43f0fc6ae7b501bee8bccb5e21ec2 Mon Sep 17 00:00:00 2001 From: Mohsen Azimi Date: Sat, 25 Mar 2017 11:57:57 -0700 Subject: [PATCH 22/56] Add inline style options to react-split-pane --- types/react-split-pane/index.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/types/react-split-pane/index.d.ts b/types/react-split-pane/index.d.ts index cdbb05d4c1..27006b7088 100644 --- a/types/react-split-pane/index.d.ts +++ b/types/react-split-pane/index.d.ts @@ -31,6 +31,14 @@ declare namespace ReactSplitPane { */ size?: number | string; split?: string; + /* Styling to be applied to both panes */ + paneStyle?: React.CSSProperties; + /* Styling to be applied to the first pane, with precedence over paneStyle */ + pane1Style?: React.CSSProperties; + /* Styling to be applied to the second pane, with precedence over paneStyle */ + pane2Style?: React.CSSProperties; + /* Styling to be applied to the resizer bar */ + resizerStyle?: React.CSSProperties; } interface ReactSplitPaneClass extends React.ComponentClass { } From 05a4862075c0b7e25d5cfd873a41a757d510475b Mon Sep 17 00:00:00 2001 From: martincostello Date: Sat, 25 Mar 2017 23:17:18 +0000 Subject: [PATCH 23/56] Add types for Apple Pay JS Add types for Apple Pay JS. https://developer.apple.com/reference/applepayjs --- types/applepayjs/applepayjs-tests.ts | 273 +++++++++++++ types/applepayjs/index.d.ts | 576 +++++++++++++++++++++++++++ types/applepayjs/tsconfig.json | 23 ++ types/applepayjs/tslint.json | 3 + 4 files changed, 875 insertions(+) create mode 100644 types/applepayjs/applepayjs-tests.ts create mode 100644 types/applepayjs/index.d.ts create mode 100644 types/applepayjs/tsconfig.json create mode 100644 types/applepayjs/tslint.json diff --git a/types/applepayjs/applepayjs-tests.ts b/types/applepayjs/applepayjs-tests.ts new file mode 100644 index 0000000000..26c61396ae --- /dev/null +++ b/types/applepayjs/applepayjs-tests.ts @@ -0,0 +1,273 @@ +// Copyright (c) Martin Costello, 2017. All rights reserved. +// Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. + +declare function describe(desc: string, fn: () => void): void; +declare function it(desc: string, fn: () => void): void; + +describe("ApplePaySession", () => { + it("the constants are defined", () => { + let status = 0; + switch (status) { + case ApplePaySession.STATUS_FAILURE: + case ApplePaySession.STATUS_INVALID_BILLING_POSTAL_ADDRESS: + case ApplePaySession.STATUS_INVALID_SHIPPING_CONTACT: + case ApplePaySession.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS: + case ApplePaySession.STATUS_PIN_INCORRECT: + case ApplePaySession.STATUS_PIN_LOCKOUT: + case ApplePaySession.STATUS_PIN_REQUIRED: + case ApplePaySession.STATUS_SUCCESS: + default: + break; + } + }); + it("can create a new instance", () => { + + const version = 1; + const paymentRequest = { + countryCode: "US", + currencyCode: "USD", + supportedNetworks: [ + "masterCard", + "visa" + ], + merchantCapabilities: [ + "supports3DS" + ], + total: { + label: "My Store", + amount: "9.99" + } + }; + + const session = new ApplePaySession(version, paymentRequest); + }); + it("can call static methods", () => { + + const merchantIdentifier = "MyMerchantId"; + + let canMakePayments: boolean = ApplePaySession.canMakePayments(); + let supported: boolean = ApplePaySession.supportsVersion(2); + + ApplePaySession.canMakePaymentsWithActiveCard(merchantIdentifier) + .then((status: boolean) => { + console.log(`Can make payments with active card: ${status}.`); + }); + + ApplePaySession.openPaymentSetup(merchantIdentifier) + .then((success) => { + console.log(`Apple Pay setup: ${success}.`); + }); + }); + it("can call instance methods", () => { + + const version = 1; + const paymentRequest = { + countryCode: "US", + currencyCode: "USD", + supportedNetworks: [ + "masterCard", + "visa" + ], + merchantCapabilities: [ + "supports3DS" + ], + total: { + label: "My Store", + amount: "9.99" + } + }; + + const session = new ApplePaySession(version, paymentRequest); + + session.abort(); + session.completeMerchantValidation({ + foo: "bar" + }); + session.completePayment(ApplePaySession.STATUS_SUCCESS); + + const total = { + label: "Subtotal", + type: "final", + amount: "35.00" + }; + + const lineItems = [ + { + label: "Subtotal", + type: "final", + amount: "35.00" + }, + { + label: "Free Shipping", + amount: "0.00", + type: "pending" + }, + { + label: "Estimated Tax", + amount: "3.06" + } + ]; + + const shippingMethods = [ + { + label: "Free Shipping", + detail: "Arrives in 5 to 7 days", + amount: "0.00", + identifier: "FreeShipping" + }, + { + label: "2-hour Shipping", + amount: "5.00" + } + ]; + + session.completePaymentMethodSelection(total, lineItems); + + session.completeShippingContactSelection( + ApplePaySession.STATUS_INVALID_SHIPPING_POSTAL_ADDRESS, + shippingMethods, + total, + lineItems); + + session.completeShippingMethodSelection( + ApplePaySession.STATUS_SUCCESS, + total, + lineItems); + + session.oncancel = (event: ApplePayJS.Event): void => { + event.cancelBubble = true; + }; + + session.onpaymentauthorized = (event: ApplePayJS.ApplePayPaymentAuthorizedEvent) => { + if (event.payment) { + console.log("Payment data:", JSON.stringify(event.payment)); + } + }; + + session.onpaymentmethodselected = (event: ApplePayJS.ApplePayPaymentMethodSelectedEvent) => { + if (event.paymentMethod) { + console.log("Payment method:", JSON.stringify(event.paymentMethod)); + } + }; + + session.onshippingcontactselected = (event: ApplePayJS.ApplePayShippingContactSelectedEvent) => { + if (event.shippingContact) { + console.log("Shipping contact:", JSON.stringify(event.shippingContact)); + } + }; + + session.onshippingmethodselected = (event: ApplePayJS.ApplePayShippingMethodSelectedEvent) => { + if (event.shippingMethod) { + console.log("Shipping method:", JSON.stringify(event.shippingMethod)); + } + }; + + session.onvalidatemerchant = (event: ApplePayJS.ApplePayValidateMerchantEvent) => { + if (event.validationURL) { + console.log(`The validation URL is '${event.validationURL}'.`); + } + }; + }); +}); +describe("ApplePayPaymentRequest", () => { + it("can create a new instance", () => { + + let paymentRequest: ApplePayJS.ApplePayPaymentRequest = { + applicationData: "ApplicationData", + countryCode: "GB", + currencyCode: "GBP", + merchantCapabilities: [ + "supports3DS", + "supportsCredit", + "supportsDebit" + ], + supportedNetworks: [ + "amex", + "discover", + "jcb", + "master​Card", + "private​Label", + "visa" + ], + total: { + label: "Apple", + type: "final", + amount: "9.99" + } + }; + + paymentRequest.billingContact = { + emailAddress: "ravipatel@example.com", + familyName: "Patel", + givenName: "Ravi", + phoneNumber: "(408) 555-5555", + addressLines: [ + "1 Infinite Loop" + ], + locality: "Cupertino", + administrativeArea: "CA", + postalCode: "95014", + country: "United States", + countryCode: "US" + }; + + paymentRequest.lineItems = [ + { + label: "Subtotal", + type: "final", + amount: "35.00" + }, + { + label: "Free Shipping", + amount: "0.00", + type: "pending" + }, + { + label: "Estimated Tax", + amount: "3.06" + } + ]; + + paymentRequest.requiredBillingContactFields = [ + "postalAddress", + "name" + ]; + + paymentRequest.requiredShippingContactFields = [ + "postalAddress", + "name", + "phone", + "email" + ]; + + paymentRequest.shippingContact = { + emailAddress: "ravipatel@example.com", + familyName: "Patel", + givenName: "Ravi", + phoneNumber: "(408) 555-5555", + addressLines: [ + "1 Infinite Loop" + ], + locality: "Cupertino", + administrativeArea: "CA", + postalCode: "95014", + country: "United States", + countryCode: "US" + }; + + paymentRequest.shippingMethods = [ + { + label: "Free Shipping", + detail: "Arrives in 5 to 7 days", + amount: "0.00", + identifier: "FreeShipping" + }, + { + label: "2-hour Shipping", + amount: "5.00" + } + ]; + + paymentRequest.shippingType = "storePickup"; + }); +}); diff --git a/types/applepayjs/index.d.ts b/types/applepayjs/index.d.ts new file mode 100644 index 0000000000..52af393ebd --- /dev/null +++ b/types/applepayjs/index.d.ts @@ -0,0 +1,576 @@ +// Type definitions for Apple Pay JS 1.0 +// Project: https://developer.apple.com/reference/applepayjs +// Definitions by: Martin Costello +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * A session object for managing the payment process on the web. + */ +declare class ApplePaySession extends EventTarget { + + /** + * Creates a new instance of the ApplePaySession class. + * @param version - The version of the ApplePay JS API you are using. + * @param paymentRequest - An Apple​Pay​Payment​Request object that contains the information that is displayed on the Apple Pay payment sheet. + */ + constructor(version: number, paymentRequest: ApplePayJS.ApplePayPaymentRequest); + + /** + * A callback function that is automatically called when the payment UI is dismissed with an error. + */ + oncancel: (event: ApplePayJS.Event) => void; + + /** + * A callback function that is automatically called when the user has authorized the Apple Pay payment, typically via TouchID. + */ + onpaymentauthorized: (event: ApplePayJS.ApplePayPaymentAuthorizedEvent) => void; + + /** + * A callback function that is automatically called when a new payment method is selected. + */ + onpaymentmethodselected: (event: ApplePayJS.ApplePayPaymentMethodSelectedEvent) => void; + + /** + * A callback function that is called when a shipping contact is selected in the payment sheet. + */ + onshippingcontactselected: (event: ApplePayJS.ApplePayShippingContactSelectedEvent) => void; + + /** + * A callback function that is automatically called when a shipping method is selected. + */ + onshippingmethodselected: (event: ApplePayJS.ApplePayShippingMethodSelectedEvent) => void; + + /** + * A callback function that is automatically called when the payment sheet is displayed. + */ + onvalidatemerchant: (event: ApplePayJS.ApplePayValidateMerchantEvent) => void; + + /** + * Indicates whether or not the device supports Apple Pay. + * @returns true if the device supports making payments with Apple Pay; otherwise, false. + */ + static canMakePayments(): boolean; + + /** + * Indicates whether or not the device supports Apple Pay and if the user has an active card in Wallet. + * @param merchantIdentifier - The merchant ID received when the merchant enrolled in Apple Pay. + * @returns true if the device supports Apple Pay and there is at least one active card in Wallet; otherwise, false. + */ + static canMakePaymentsWithActiveCard(merchantIdentifier: string): Promise; + + /** + * Displays the Set up Apple Pay button. + * @param merchantIdentifier - The merchant ID received when the merchant enrolled in Apple Pay. + * @returns A boolean value indicating whether setup was successful. + */ + static openPaymentSetup(merchantIdentifier: string): Promise; + + /** + * Verifies if a web browser supports a given Apple Pay JS API version. + * @param version - A number representing the Apple Pay JS API version being checked. The initial version is 1. + * @returns A boolean value indicating whether the web browser supports the given API version. Returns false if the web browser does not support the specified version. + */ + static supportsVersion(version: number): boolean; + + /** + * Aborts the current Apple Pay session. + */ + abort(): void; + + /** + * Begins the merchant validation process. + */ + begin(): void; + + /** + * Call after the merchant has been validated. + * @param merchantSession - An opaque message session object. + */ + completeMerchantValidation(merchantSession: any): void; + + /** + * Call when a payment has been authorized. + * @param status - The status of the payment. + */ + completePayment(status: number): void; + + /** + * Call after a payment method has been selected. + * @param newTotal - An Apple​Pay​Line​Item dictionary representing the total price for the purchase. + * @param newLineItems - A sequence of Apple​Pay​Line​Item dictionaries. + */ + completePaymentMethodSelection(newTotal: ApplePayJS.ApplePayLineItem, newLineItems: ApplePayJS.ApplePayLineItem[]): void; + + /** + * Call after a shipping contact has been selected. + * @param status - The status of the shipping contact update. + * @param newShippingMethods - A sequence of ApplePayShippingMethod dictionaries. + * @param newTotal - An Apple​Pay​Line​Item dictionary representing the total price for the purchase. + * @param newLineItems - A sequence of Apple​Pay​Line​Item dictionaries. + */ + completeShippingContactSelection( + status: number, + newShippingMethods: ApplePayJS.ApplePayShippingMethod[], + newTotal: ApplePayJS.ApplePayLineItem, + newLineItems: ApplePayJS.ApplePayLineItem[]): void; + + /** + * Call after the shipping method has been selected. + * @param status - The status of the shipping method update. + * @param newTotal - An Apple​Pay​Line​Item dictionary representing the total price for the purchase. + * @param newLineItems - A sequence of Apple​Pay​Line​Item dictionaries. + */ + completeShippingMethodSelection(status: number, newTotal: ApplePayJS.ApplePayLineItem, newLineItems: ApplePayJS.ApplePayLineItem[]): void; + + /** + * The requested action succeeded. + */ + static readonly STATUS_SUCCESS: number; + + /** + * The requested action failed. + */ + static readonly STATUS_FAILURE: number; + + /** + * The billing address is not valid. + */ + static readonly STATUS_INVALID_BILLING_POSTAL_ADDRESS: number; + + /** + * The shipping address is not valid. + */ + static readonly STATUS_INVALID_SHIPPING_POSTAL_ADDRESS: number; + + /** + * The shipping contact information is not valid. + */ + static readonly STATUS_INVALID_SHIPPING_CONTACT: number; + + /** + * The PIN information is not valid. Cards on the China Union Pay network may require a PIN. + */ + static readonly STATUS_PIN_INCORRECT: number; + + /** + * The maximum number of tries for a PIN has been reached and the user has been locked out. Cards on the China Union Pay network may require a PIN. + */ + static readonly STATUS_PIN_LOCKOUT: number; + + /** + * The required PIN information was not provided. Cards on the China Union Pay payment network may require a PIN to authenticate the transaction. + */ + static readonly STATUS_PIN_REQUIRED: number; +} + +declare namespace ApplePayJS { + + /** + * Defines a line item in a payment request - for example, total, tax, discount, or grand total. + */ + interface ApplePayLineItem { + + /** + * A short, localized description of the line item. + */ + label: string; + + /** + * The line item's amount. + */ + amount: string; + + /** + * A value that indicates if the line item is final or pending. + */ + type?: string; + } + + /** + * Represents the result of authorizing a payment request and contains encrypted payment information. + */ + interface ApplePayPayment { + + /** + * The encrypted token for an authorized payment. + */ + token: ApplePayPaymentToken; + + /** + * The billing contact selected by the user for this transaction. + */ + billingContact?: ApplePayPaymentContact; + + /** + * The shipping contact selected by the user for this transaction. + */ + shippingContact?: ApplePayPaymentContact; + } + + /** + * The Apple​Pay​Payment​Authorized​Event class defines the attributes contained by the ApplePaySession.onpaymentauthorized callback function. + */ + abstract class ApplePayPaymentAuthorizedEvent extends Event { + + /** + * The payment token used to authorize a payment. + */ + readonly payment: ApplePayPayment; + } + + /** + * Encapsulates contact information needed for billing and shipping. + */ + interface ApplePayPaymentContact { + + /** + * An email address for the contact. + */ + emailAddress: string; + + /** + * The contact's family name. + */ + familyName: string; + + /** + * The contact's given name. + */ + givenName: string; + + /** + * A phone number for the contact. + */ + phoneNumber: string; + + /** + * The address for the contact. + */ + addressLines: string[]; + + /** + * The city for the contact. + */ + locality: string; + + /** + * The state for the contact. + */ + administrativeArea: string; + + /** + * The zip code, where applicable, for the contact. + */ + postalCode: string; + + /** + * The colloquial country name for the contact. + */ + country: string; + + /** + * The contact's ISO country code. + */ + countryCode: string; + } + + /** + * Contains information about an Apple Pay payment card. + */ + interface ApplePayPaymentMethod { + + /** + * A string, suitable for display, that describes the card. + */ + displayName: string; + + /** + * A string, suitable for display, that is the name of the payment network backing the card. + * The value is one of the supported networks specified in the supported​Networks property of the Apple​Pay​Payment​Request. + */ + network: string; + + /** + * A value representing the card's type of payment. + */ + type: string; + + /** + * The payment pass object associated with the payment. + */ + paymentPass: ApplePayPaymentPass; + } + + /** + * The Apple​Pay​Payment​Method​Selected​Event class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function. + */ + abstract class ApplePayPaymentMethodSelectedEvent extends Event { + + /** + * The card used to complete a payment. + */ + readonly paymentMethod: ApplePayPaymentMethod; + } + + /** + * Represents a provisioned payment card for Apple Pay payments. + */ + interface ApplePayPaymentPass { + + /** + * The unique identifier for the primary account number for the payment card. + */ + primaryAccountIdentifier: string; + + /** + * A version of the primary account number suitable for display in your UI. + */ + primaryAccountNumberSuffix: string; + + /** + * The unique identifier for the device-specific account number. + */ + deviceAccountIdentifier?: string; + + /** + * A version of the device account number suitable for display in your UI. + */ + deviceAccountNumberSuffix?: string; + + /** + * The activation state of the pass. + */ + activationState: string; + } + + /** + * Encapsulates a request for payment, including information about payment processing capabilities, the payment amount, and shipping information. + */ + interface ApplePayPaymentRequest { + + /** + * The merchant's two-letter ISO 3166 country code. + */ + countryCode: string; + + /** + * The three-letter ISO 4217 currency code for the payment. + */ + currencyCode: string; + + /** + * A set of line items that explain recurring payments and/or additional charges. + */ + lineItems?: ApplePayLineItem[]; + + /** + * The payment capabilities supported by the merchant. + * The value must at least contain ApplePayMerchantCapability.supports3DS. + */ + merchantCapabilities: string[]; + + /** + * The payment networks supported by the merchant. + */ + supportedNetworks: string[]; + + /** + * A line item representing the total for the payment. + */ + total: ApplePayLineItem; + + /** + * Billing contact information for the user. + */ + billingContact?: ApplePayPaymentContact; + + /** + * The billing information that you require from the user in order to process the transaction. + */ + requiredBillingContactFields?: string[]; + + /** + * The shipping information that you require from the user in order to fulfill the order. + */ + requiredShippingContactFields?: string[]; + + /** + * Shipping contact information for the user. + */ + shippingContact?: ApplePayPaymentContact; + + /** + * A set of shipping method objects that describe the available shipping methods. + */ + shippingMethods?: ApplePayShippingMethod[] | string[]; + + /** + * How the items are to be shipped. + */ + shippingType?: string; + + /** + * Optional user-defined data. + */ + applicationData?: string; + } + + /** + * Contains the user's payment credentials. + */ + interface ApplePayPaymentToken { + + /** + * An object containing the encrypted payment data. + */ + paymentData: any; + + /** + * Information about the card used in the transaction. + */ + paymentMethod: ApplePayPaymentMethod; + + /** + * A unique identifier for this payment. + */ + transactionIdentifier: string; + } + + /** + * The Apple​Pay​Shipping​Contact​Selected​Event class defines the attributes contained by the ApplePaySession.onshippingcontactselected callback function. + */ + abstract class ApplePayShippingContactSelectedEvent extends Event { + + /** + * The shipping address selected by the user. + */ + readonly shippingContact: ApplePayPaymentContact; + } + + /** + * Defines a shipping method for delivering physical goods. + */ + interface ApplePayShippingMethod { + + /** + * A short description of the shipping method. + */ + label: string; + + /** + * A further description of the shipping method. + */ + detail?: string; + + /** + * The amount associated with this shipping method. + */ + amount: string; + + /** + * A client-defined identifier. + */ + identifier?: string; + } + + /** + * The Apple​Pay​Shipping​Method​Selected​Event class defines the attribute contained by the ApplePaySession.onshippingmethodselected callback function. + */ + abstract class ApplePayShippingMethodSelectedEvent extends Event { + + /** + * The shipping method selected by the user. + */ + readonly shippingMethod: ApplePayShippingMethod; + } + + /** + * The Apple​Pay​Validate​Merchant​Event class defines the attributes contained by the ApplePaySession.onvalidatemerchant callback function. + */ + abstract class ApplePayValidateMerchantEvent extends Event { + + /** + * The URL used to validate the merchant server. + */ + readonly validationURL: string; + } + + abstract class Event { + + readonly bubbles: boolean; + + cancelBubble: boolean; + + readonly cancelable: boolean; + + readonly composed: boolean; + + readonly currentTarget: EventTarget; + + readonly defaultPrevented: boolean; + + readonly eventPhase: number; + + readonly isTrusted: boolean; + + returnValue: boolean; + + readonly srcElement: EventTarget; + + readonly target: EventTarget; + + readonly timeStamp: string; + + readonly type: string; + + composedPath(): Node[]; + + initEvent(type?: string, bubbles?: boolean, cancelable?: boolean): void; + + preventDefault(): void; + + stopImmediatePropagation(): void; + + stopPropagation(): void; + + static readonly AT_TARGET: number; + + static readonly BLUR: number; + + static readonly BUBBLING_PHASE: number; + + static readonly CAPTURING_PHASE: number; + + static readonly CHANGE: number; + + static readonly CLICK: number; + + static readonly DBLCLICK: number; + + static readonly DRAGDROP: number; + + static readonly FOCUS: number; + + static readonly KEYDOWN: number; + + static readonly KEYPRESS: number; + + static readonly KEYUP: number; + + static readonly MOUSEDOWN: number; + + static readonly MOUSEDRAG: number; + + static readonly MOUSEMOVE: number; + + static readonly MOUSEOUT: number; + + static readonly MOUSEOVER: number; + + static readonly MOUSEUP: number; + + static readonly NONE: number; + + static readonly SELECT: number; + } +} diff --git a/types/applepayjs/tsconfig.json b/types/applepayjs/tsconfig.json new file mode 100644 index 0000000000..0bb26b97ac --- /dev/null +++ b/types/applepayjs/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "baseUrl": "../", + "forceConsistentCasingInFileNames": true, + "lib": [ + "dom", + "es6" + ], + "module": "commonjs", + "noImplicitAny": true, + "noImplicitThis": true, + "noEmit": true, + "strictNullChecks": true, + "typeRoots": [ + "../" + ], + "types": [] + }, + "files": [ + "index.d.ts", + "applepayjs-tests.ts" + ] +} diff --git a/types/applepayjs/tslint.json b/types/applepayjs/tslint.json new file mode 100644 index 0000000000..0344a1a3fa --- /dev/null +++ b/types/applepayjs/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} From 5c64371d89433af473f939b0ff08efe57fbb542b Mon Sep 17 00:00:00 2001 From: Chris Gervang Date: Sat, 25 Mar 2017 17:13:32 -0700 Subject: [PATCH 24/56] Updating ReactCSS types to version 1.2 --- types/reactcss/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/reactcss/index.d.ts b/types/reactcss/index.d.ts index 2d571674f7..3c0e03ee6e 100644 --- a/types/reactcss/index.d.ts +++ b/types/reactcss/index.d.ts @@ -1,12 +1,11 @@ -// Type definitions for ReactCSS v1.0.0 +// Type definitions for ReactCSS v1.2.0 // Project: http://reactcss.com/ -// Definitions by: Karol Janyst +// Definitions by: Chris Gervang , Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.2 import * as React from "react" - interface LoopableProps { "first-child"?: boolean "last-child"?: boolean @@ -19,11 +18,12 @@ interface HoverProps { hover?: boolean } -interface Classes { - default: any - [scope: string]: any +interface Classes { + default: Partial + [scope: string]: Partial } +export type CSS = React.CSSProperties export function hover(component: React.ComponentClass | React.StatelessComponent): React.ComponentClass export function loop(i: number, length: number): LoopableProps -export default function reactCSS(classes: Classes, ...activations: Array): any +export default function reactCSS(classes: Classes, ...activations: Array): T From d4b98e705fe434c31efd1ab72a0dd196aa71ed0d Mon Sep 17 00:00:00 2001 From: ktmblueskyarb Date: Sun, 26 Mar 2017 01:24:55 +0100 Subject: [PATCH 25/56] Added Animation constructor and test for that --- web-animations-js/web-animations-js-tests.ts | 71 ++++++++++++++------ web-animations-js/web-animations-js.d.ts | 33 +++------ 2 files changed, 60 insertions(+), 44 deletions(-) diff --git a/web-animations-js/web-animations-js-tests.ts b/web-animations-js/web-animations-js-tests.ts index 977bc403ac..3072c936a0 100644 --- a/web-animations-js/web-animations-js-tests.ts +++ b/web-animations-js/web-animations-js-tests.ts @@ -1,7 +1,7 @@ // From the documentation function test_doc() { - var elem = document.createElement('div'); - var animation = elem.animate({ + const elem = document.createElement('div'); + const animation = elem.animate({ opacity: [0.5, 1], transform: ['scale(0.5)', 'scale(1)'] }, { @@ -13,8 +13,8 @@ function test_doc() { // From https://io2015codelabs.appspot.com/codelabs/web-animations-transitions-playbackcontrol // To test KeyframeEffect, SequenceEffect and GroupEffect function test_AnimationsApiNext() { - function buildFadeIn(target : HTMLElement) { - var steps = [ + function buildFadeIn(target: HTMLElement) { + const steps = [ { opacity: 0, transform: 'translate(0, 20em)' }, { opacity: 1, transform: 'translate(0)' } ]; @@ -26,12 +26,12 @@ function test_AnimationsApiNext() { }); } function buildFadeOut(target: HTMLElement) { - var angle = Math.pow((Math.random() * 16) - 6, 3); - var offset = (Math.random() * 20) - 10; - var transform = 'translate(' + offset + 'em, 20em) ' + + const angle = Math.pow((Math.random() * 16) - 6, 3); + const offset = (Math.random() * 20) - 10; + const transform = 'translate(' + offset + 'em, 20em) ' + 'rotate(' + angle + 'deg) ' + 'scale(0)'; - var steps = [ + const steps = [ { visibility: 'visible', opacity: 1, transform: 'none' }, { visibility: 'visible', opacity: 0, transform: transform } ]; @@ -40,21 +40,54 @@ function test_AnimationsApiNext() { easing: 'ease-in' }); } - var effectNode = document.createElement('div'); + const effectNode = document.createElement('div'); effectNode.className = 'circleEffect'; - var bounds = document.documentElement.getBoundingClientRect(); + const bounds = document.documentElement.getBoundingClientRect(); effectNode.style.left = bounds.left + bounds.width / 2 + 'px'; effectNode.style.top = bounds.top + bounds.height / 2 + 'px'; - var header = document.querySelector('header'); + const header = document.querySelector('header'); header.appendChild(effectNode); - var newColor = 'hsl(' + Math.round(Math.random() * 255) + ', 46%, 42%)'; + const newColor = 'hsl(' + Math.round(Math.random() * 255) + ', 46%, 42%)'; effectNode.style.background = newColor; - var scaleSteps = [{ transform: 'scale(0)' }, { transform: 'scale(1)' }]; - var timing = { duration: 2500, easing: 'ease-in-out' }; - var scaleEffect = new KeyframeEffect(effectNode, scaleSteps, timing); - var fadeEffect = new SequenceEffect([buildFadeOut(effectNode), buildFadeIn(effectNode)]); - var allEffects = [scaleEffect, fadeEffect]; + const scaleSteps = [{ transform: 'scale(0)' }, { transform: 'scale(1)' }]; + const timing: AnimationEffectTiming = { duration: 2500, easing: 'ease-in-out', fill: "backwards" }; + const scaleEffect = new KeyframeEffect(effectNode, scaleSteps, timing); + const fadeEffect = new SequenceEffect([buildFadeOut(effectNode), buildFadeIn(effectNode)]); + const allEffects = [scaleEffect, fadeEffect]; // Play all animations within this group. - var groupEffect = new GroupEffect(allEffects); - var anim = document.timeline.play(groupEffect); + const groupEffect = new GroupEffect(allEffects); + const anim = document.timeline.play(groupEffect); +} + +// https://developer.mozilla.org/en-US/docs/Web/API/Animation/Animation +// http://codepen.io/rachelnabors/pen/eJyWzm/?editors=0010 +function test_whiteRabbit() { + var whiteRabbit = document.getElementById("rabbit"); + + var rabbitDownKeyframes = new KeyframeEffect( + whiteRabbit, + [ + { transform: 'translateY(0%)' }, + { transform: 'translateY(100%)' } + ], + { duration: 3000, fill: 'forwards' } + ); + + var rabbitDownAnimation = new Animation(rabbitDownKeyframes, document.timeline); + + // On tap or click, + whiteRabbit.addEventListener("mousedown", downHeGoes, false); + whiteRabbit.addEventListener("touchstart", downHeGoes, false); + + // Trigger a single-fire animation + function downHeGoes(event: Event) { + + // Remove those event listeners + whiteRabbit.removeEventListener("mousedown", downHeGoes, false); + whiteRabbit.removeEventListener("touchstart", downHeGoes, false); + + // Play rabbit animation + rabbitDownAnimation.play(); + + } } diff --git a/web-animations-js/web-animations-js.d.ts b/web-animations-js/web-animations-js.d.ts index 80c98a555a..f570e423ba 100644 --- a/web-animations-js/web-animations-js.d.ts +++ b/web-animations-js/web-animations-js.d.ts @@ -3,8 +3,8 @@ // Definitions by: Kristian Moerch // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare type FillMode = "none" | "forwards" | "backwards" | "both" | "auto"; -declare type PlaybackDirection = "normal" | "reverse" | "alternate" | "alternate-reverse"; +declare type AnimationEffectTimingFillMode = "none" | "forwards" | "backwards" | "both" | "auto"; +declare type AnimationEffectTimingPlaybackDirection = "normal" | "reverse" | "alternate" | "alternate-reverse"; declare type AnimationPlayState = "idle" | "pending" | "running" | "paused" | "finished"; interface AnimationPlaybackEvent extends Event { @@ -15,21 +15,21 @@ interface AnimationPlaybackEvent extends Event { interface AnimationKeyFrame { easing?: string; offset?: number; - [key: string]: string | number | number[] | string[]; + [key: string]: string | string[] | number | number[]; } interface AnimationTimeline { currentTime: number; - getAnimations(): any; - play(a: any): any; + getAnimations(): Animation[]; + play(effect: KeyframeEffect): Animation; } interface AnimationEffectTiming { delay?: number; - direction?: PlaybackDirection; + direction?: AnimationEffectTimingPlaybackDirection; duration?: number; easing?: string; endDelay?: number; - fill?: FillMode |  string; + fill?: AnimationEffectTimingFillMode; iterationStart?: number; iterations?: number; playbackRate?: number; @@ -44,25 +44,8 @@ declare class KeyframeEffect { getFrames(): AnimationKeyFrame[]; } -interface Animation extends Element { - currentTime: number; - id: string; - oncancel: EventListener; - onfinish: EventListener; - readonly playState: AnimationPlayState; - playbackRate: number; - startTime: number; - cancel(): void; - finish(): void; - pause(): void; - play(): void; - reverse(): void; - effect: KeyframeEffect; - readonly finished: Promise; - readonly ready: Promise; - timeline: AnimationTimeline; -} declare class Animation extends Element { + constructor(effect: KeyframeEffect, timeline?: AnimationTimeline); currentTime: number; id: string; oncancel: EventListener; From 48032bc9c4a645a82f81656c436a4370a6119809 Mon Sep 17 00:00:00 2001 From: Chris Gervang Date: Sat, 25 Mar 2017 17:44:29 -0700 Subject: [PATCH 26/56] expanded the test file to use all of the library correctly. corrected LoopableProps definition. --- types/reactcss/index.d.ts | 10 ++--- types/reactcss/reactcss-tests.tsx | 68 ++++++++++++++++++++++++++----- 2 files changed, 63 insertions(+), 15 deletions(-) diff --git a/types/reactcss/index.d.ts b/types/reactcss/index.d.ts index 3c0e03ee6e..fe64ed4ce9 100644 --- a/types/reactcss/index.d.ts +++ b/types/reactcss/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ReactCSS v1.2.0 +// Type definitions for ReactCSS 1.2.0 // Project: http://reactcss.com/ // Definitions by: Chris Gervang , Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -6,15 +6,15 @@ import * as React from "react" -interface LoopableProps { +interface LoopableProps extends React.Props { + "nth-child": number "first-child"?: boolean "last-child"?: boolean even?: boolean odd?: boolean - [nthChild: string]: boolean } -interface HoverProps { +interface HoverProps extends React.Props { hover?: boolean } @@ -25,5 +25,5 @@ interface Classes { export type CSS = React.CSSProperties export function hover(component: React.ComponentClass | React.StatelessComponent): React.ComponentClass -export function loop(i: number, length: number): LoopableProps +export function loop(index: number, length: number): LoopableProps export default function reactCSS(classes: Classes, ...activations: Array): T diff --git a/types/reactcss/reactcss-tests.tsx b/types/reactcss/reactcss-tests.tsx index 058958c7bf..2905a07f79 100644 --- a/types/reactcss/reactcss-tests.tsx +++ b/types/reactcss/reactcss-tests.tsx @@ -1,19 +1,67 @@ import * as React from "react" -import { StatelessComponent } from "react" +import { SFC } from "react" import { render } from "react-dom" -import { default as reactCSS, hover, loop, LoopableProps, HoverProps } from "reactcss" +import { default as reactCSS, hover, loop, LoopableProps, HoverProps, CSS } from "reactcss" -interface TestProps extends HoverProps { } +interface TestHoverProps extends HoverProps { } -var styles: any = reactCSS({ - default: {}, - hover: {} -}, { hover: true }) +const TestHover: SFC = ({hover}) => { + const styles = reactCSS<{title: CSS}>({ + default: { + title: { + color: "black" + } + }, + hover: { + title: { + color: "blue" + } + } + }, { hover }) -var loopProps: LoopableProps = loop(1, 10) + const list = ["First!", "Second!", "Third!"] -var TestComponent: StatelessComponent -var Test = hover(TestComponent) + return ( +
+
+ Cool Title! +
+ + {list.map((item, index) => ( + {item} + ))} +
+ ) +} + +interface TestLoopProps extends LoopableProps { } + +const TestLoop: SFC = (props) => { + const styles = reactCSS<{element: CSS}>({ + default: { + element: { + width: "200px", + border: "1px solid black" + } + }, + first: { + element: { + borderTopLeftRadius: "2px", + borderTopRightRadius: "2px" + } + }, + last: { + element: { + borderBottomLeftRadius: "2px", + borderBottomRightRadius: "2px" + } + } + }, { first: props["first-child"], last: props["last-child"] }) + + return
{props.children}
+} + +const Test = hover(TestHover) render( , From cf7ea6492c0f6076007381a2e36f69f53fc63c39 Mon Sep 17 00:00:00 2001 From: Chris Gervang Date: Sat, 25 Mar 2017 17:51:11 -0700 Subject: [PATCH 27/56] recommended pattern --- types/reactcss/reactcss-tests.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/reactcss/reactcss-tests.tsx b/types/reactcss/reactcss-tests.tsx index 2905a07f79..0ba1f69fc2 100644 --- a/types/reactcss/reactcss-tests.tsx +++ b/types/reactcss/reactcss-tests.tsx @@ -44,19 +44,19 @@ const TestLoop: SFC = (props) => { border: "1px solid black" } }, - first: { + "first-child": { element: { borderTopLeftRadius: "2px", borderTopRightRadius: "2px" } }, - last: { + "last-child": { element: { borderBottomLeftRadius: "2px", borderBottomRightRadius: "2px" } } - }, { first: props["first-child"], last: props["last-child"] }) + }, props) return
{props.children}
} From 40d95a701df311c9e3cae6b5611beb581c5ffbbd Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Sun, 26 Mar 2017 08:42:18 +0200 Subject: [PATCH 28/56] feat(stylelint): create `Type` for formatter and syntax --- types/stylelint/index.d.ts | 8 ++++++-- types/stylelint/stylelint-tests.ts | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/types/stylelint/index.d.ts b/types/stylelint/index.d.ts index 2ec479d2e1..90778baef9 100644 --- a/types/stylelint/index.d.ts +++ b/types/stylelint/index.d.ts @@ -3,6 +3,10 @@ // Definitions by: Alan Agius // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +export type FormatterType = "json" | "string" | "verbose"; + +export type SyntaxType = "scss" | "less" | "sugarss"; + export interface LinterOptions { code?: string; codeFilename?: string; @@ -11,11 +15,11 @@ export interface LinterOptions { configFile?: string; configOverrides?: JSON; files?: string | string[]; - formatter?: "json" | "string" | "verbose"; + formatter?: FormatterType; ignoreDisables?: boolean; reportNeedlessDisables?: boolean; ignorePath?: boolean; - syntax?: "scss" | "less" | "sugarss"; + syntax?: SyntaxType; customSyntax?: string; } diff --git a/types/stylelint/stylelint-tests.ts b/types/stylelint/stylelint-tests.ts index 0eeb0bdec8..a621c73a1d 100644 --- a/types/stylelint/stylelint-tests.ts +++ b/types/stylelint/stylelint-tests.ts @@ -1,4 +1,4 @@ -import { LinterOptions, lint, LintResult, LinterResult } from "stylelint"; +import { LinterOptions, FormatterType, SyntaxType, lint, LintResult, LinterResult } from "stylelint"; const options: LinterOptions = { code: "div { color: red }", @@ -16,3 +16,7 @@ lint(options).then((x: LinterResult) => { const postcssResults: any[] = x.postcssResults; const results: LintResult[] = x.results; }); + +const formatter: FormatterType = "json"; + +const syntax: SyntaxType = "scss"; From 9b5ff60d9238329385f6eeb685fcc9c545df7d78 Mon Sep 17 00:00:00 2001 From: Sarun Rattanasiri Date: Mon, 27 Mar 2017 01:03:48 +0700 Subject: [PATCH 29/56] add missing ObjectId methods to bson type definition --- types/bson/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/bson/index.d.ts b/types/bson/index.d.ts index 517ed8ede9..e34462b2b7 100644 --- a/types/bson/index.d.ts +++ b/types/bson/index.d.ts @@ -68,6 +68,8 @@ export class ObjectId { static isValid(id: number | string | ObjectId): boolean; constructor(id?: number | string | ObjectId); + toHexString(): string; + getTimestamp(): Date; } export type ObjectID = ObjectId; export class BSONRegExp { From 312f51088e182f2a2fd1cb58b69693cc66414c87 Mon Sep 17 00:00:00 2001 From: Keith Henry Date: Mon, 27 Mar 2017 08:38:58 +0100 Subject: [PATCH 30/56] Added chrome.i18n.detectLanguage `chrome.i18n.detectLanguage` is missing from the type definitions, this change adds the definition. Original documentation at https://developer.chrome.com/extensions/i18n#method-detectLanguage --- types/chrome/index.d.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index 1b07c1c2e8..8c0c3bf5f2 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -3306,6 +3306,26 @@ declare namespace chrome.history { * @since Chrome 5. */ declare namespace chrome.i18n { + /** Holds detected ISO language code and its percentage in the input string */ + interface DetectedLanguage { + /** An ISO language code such as 'en' or 'fr'. + * For a complete list of languages supported by this method, see [kLanguageInfoTable]{@link https://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc}. + * For an unknown language, 'und' will be returned, which means that [percentage] of the text is unknown to CLD */ + language: string; + + /** The percentage of the detected language */ + percentage: number; + } + + /** Holds detected language reliability and array of DetectedLanguage */ + interface LanguageDetectionResult { + /** CLD detected language reliability */ + isReliable: boolean; + + /** Array of detectedLanguage */ + languages: DetectedLanguage[]; + } + /** * Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use i18n.getUILanguage. * @param callback The callback parameter should be a function that looks like this: @@ -3324,6 +3344,12 @@ declare namespace chrome.i18n { * @since Chrome 35. */ export function getUILanguage(): string; + + /** Detects the language of the provided text using CLD. + * @param text User input string to be translated. + * @param callback The callback parameter should be a function that looks like this: function(object result) {...}; + */ + export function detectLanguage(text: string, callback: (result: LanguageDetectionResult) => void): void; } //////////////////// From d8e322fe0026cb85df02c8e644bf408697485d0f Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Tue, 7 Mar 2017 13:23:49 +0100 Subject: [PATCH 31/56] Leaflet: various fixes. A lot of or errors related to strict nulls. Also some arguments that were too general, where the functions don't behave as expected with some of the possible inputs. And other various errors. --- types/leaflet/index.d.ts | 161 +++++++++++++++++++-------------------- 1 file changed, 79 insertions(+), 82 deletions(-) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 21b8664e97..0e340d921a 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -38,60 +38,60 @@ declare namespace L { } namespace LineUtil { - function simplify(points: PointExpression[], tolerance: number): Point[]; + function simplify(points: Point[], tolerance: number): Point[]; - function pointToSegmentDistance(p: PointExpression, p1: PointExpression, p2: PointExpression): number; + function pointToSegmentDistance(p: Point, p1: Point, p2: Point): number; - function closestPointOnSegment(p: PointExpression, p1: PointExpression, p2: PointExpression): Point; + function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point; } namespace PolyUtil { - function clipPolygon(points: PointExpression[], bounds: BoundsExpression, round?: boolean): Point[]; + function clipPolygon(points: Point[], bounds: BoundsExpression, round?: boolean): Point[]; } - class DomUtil { + module DomUtil { /** * Get Element by its ID or with the given HTML-Element */ - static get(element: string | HTMLElement): HTMLElement; - static getStyle(el: HTMLElement, styleAttrib: string): string; - static create(tagName: string, className?: string, container?: HTMLElement): HTMLElement; - static remove(el: HTMLElement): void; - static empty(el: HTMLElement): void; - static toFront(el: HTMLElement): void; - static toBack(el: HTMLElement): void; - static hasClass(el: HTMLElement, name: string): boolean; - static addClass(el: HTMLElement, name: string): void; - static removeClass(el: HTMLElement, name: string): void; - static setClass(el: HTMLElement, name: string): void; - static getClass(el: HTMLElement): string; - static setOpacity(el: HTMLElement, opacity: number): void; - static testProp(props: string[]): string | boolean/*=false*/; - static setTransform(el: HTMLElement, offset: Point, scale?: number): void; - static setPosition(el: HTMLElement, position: Point): void; - static getPosition(el: HTMLElement): Point; - static disableTextSelection(): void; - static enableTextSelection(): void; - static disableImageDrag(): void; - static enableImageDrag(): void; - static preventOutline(el: HTMLElement): void; - static restoreOutline(): void; + function get(element: string | HTMLElement): HTMLElement | null; + function getStyle(el: HTMLElement, styleAttrib: string): string | null; + function create(tagName: string, className?: string, container?: HTMLElement): HTMLElement; + function remove(el: HTMLElement): void; + function empty(el: HTMLElement): void; + function toFront(el: HTMLElement): void; + function toBack(el: HTMLElement): void; + function hasClass(el: HTMLElement, name: string): boolean; + function addClass(el: HTMLElement, name: string): void; + function removeClass(el: HTMLElement, name: string): void; + function setClass(el: HTMLElement, name: string): void; + function getClass(el: HTMLElement): string; + function setOpacity(el: HTMLElement, opacity: number): void; + function testProp(props: string[]): string | false; + function setTransform(el: HTMLElement, offset: Point, scale?: number): void; + function setPosition(el: HTMLElement, position: Point): void; + function getPosition(el: HTMLElement): Point; + function disableTextSelection(): void; + function enableTextSelection(): void; + function disableImageDrag(): void; + function enableImageDrag(): void; + function preventOutline(el: HTMLElement): void; + function restoreOutline(): void; } - abstract class CRS { + interface CRS { latLngToPoint(latlng: LatLngExpression, zoom: number): Point; pointToLatLng(point: PointExpression, zoom: number): LatLng; - project(latlng: LatLngExpression): Point; + project(latlng: LatLng | LatLngLiteral): Point; unproject(point: PointExpression): LatLng; scale(zoom: number): number; zoom(scale: number): number; getProjectedBounds(zoom: number): Bounds; distance(latlng1: LatLngExpression, latlng2: LatLngExpression): number; - wrapLatLng(latlng: LatLngExpression): LatLng; + wrapLatLng(latlng: LatLng | LatLngLiteral): LatLng; - code: string; - wrapLng: [number, number]; - wrapLat: [number, number]; + code?: string; + wrapLng?: [number, number]; + wrapLat?: [number, number]; infinite: boolean; } @@ -104,10 +104,10 @@ declare namespace L { } interface Projection { - project(latlng: LatLngExpression): Point; + project(latlng: LatLng | LatLngLiteral): Point; unproject(point: PointExpression): LatLng; - bounds: LatLngBounds; + bounds: Bounds; } namespace Projection { @@ -118,7 +118,6 @@ declare namespace L { class LatLng { constructor(latitude: number, longitude: number, altitude?: number); - constructor(coords: LatLngTuple | [number, number, number] | LatLngLiteral | {lat: number, lng: number, alt?: number}); equals(otherLatLng: LatLngExpression, maxMargin?: number): boolean; toString(): string; distanceTo(otherLatLng: LatLngExpression): number; @@ -127,7 +126,7 @@ declare namespace L { lat: number; lng: number; - alt: number; + alt?: number; } interface LatLngLiteral { @@ -177,9 +176,8 @@ declare namespace L { class Point { constructor(x: number, y: number, round?: boolean); - constructor(coords: PointTuple | {x: number, y: number}); clone(): Point; - add(otherPoint: PointExpression): Point; // investigate if this mutates or returns a new instance + add(otherPoint: PointExpression): Point; // non-destructive, returns a new point subtract(otherPoint: PointExpression): Point; divideBy(num: number): Point; multiplyBy(num: number): Point; @@ -216,8 +214,8 @@ declare namespace L { intersects(otherBounds: BoundsExpression): boolean; overlaps(otherBounds: BoundsExpression): boolean; - min: Point; - max: Point; + min?: Point; + max?: Point; } type BoundsExpression = Bounds | BoundsLiteral; @@ -403,7 +401,7 @@ declare namespace L { addTo(map: Map): this; remove(): this; removeFrom(map: Map): this; - getPane(name?: string): HTMLElement; + getPane(name?: string): HTMLElement | undefined; // Popup methods bindPopup(content: ((layer: Layer) => Content) | Content | Popup, options?: PopupOptions): this; @@ -413,7 +411,7 @@ declare namespace L { togglePopup(): this; isPopupOpen(): boolean; setPopupContent(content: Content | Popup): this; - getPopup(): Popup; + getPopup(): Popup | undefined; // Tooltip methods bindTooltip(content: ((layer: Layer) => Content) | Tooltip | Content, options?: TooltipOptions): this; @@ -423,14 +421,14 @@ declare namespace L { toggleTooltip(): this; isTooltipOpen(): boolean; setTooltipContent(content: Content | Tooltip): this; - getTooltip(): Tooltip; + getTooltip(): Tooltip | undefined; // Extension methods - onAdd(map: Map): this; - onRemove(map: Map): this; - getEvents(): {[name: string]: (event: Event) => void}; - getAttribution(): string; - beforeAdd(map: Map): this; + onAdd?: (map: Map) => this; + onRemove?: (map: Map) => this; + getEvents?: () => {[name: string]: (event: Event) => void}; + getAttribution?: () => string | null; + beforeAdd?: (map: Map) => this; } interface GridLayerOptions { @@ -454,8 +452,7 @@ declare namespace L { constructor(options?: GridLayerOptions); bringToFront(): this; bringToBack(): this; - getAttribution(): string; - getContainer(): HTMLElement; + getContainer(): HTMLElement | null; setOpacity(opacity: number): this; setZIndex(zIndex: number): this; isLoading(): boolean; @@ -500,7 +497,7 @@ declare namespace L { } interface WMSOptions extends TileLayerOptions { - layers: string; + layers?: string; styles?: string; format?: string; transparent?: boolean; @@ -547,7 +544,7 @@ declare namespace L { getBounds(): LatLngBounds; /** Get the img element that represents the ImageOverlay on the map */ - getElement(): HTMLImageElement; + getElement(): HTMLImageElement | undefined; options: ImageOverlayOptions; } @@ -582,7 +579,7 @@ declare namespace L { setStyle(style: PathOptions): this; bringToFront(): this; bringToBack(): this; - getElement(): HTMLElement; + getElement(): Element | undefined; options: PathOptions; } @@ -607,7 +604,7 @@ declare namespace L { constructor(latlngs: LatLngExpression[], options?: PolylineOptions); toGeoJSON(): GeoJSONFeature; - feature: GeoJSONFeature; + feature?: GeoJSONFeature; } function polyline(latlngs: LatLngExpression[], options?: PolylineOptions): Polyline; @@ -616,7 +613,7 @@ declare namespace L { constructor(latlngs: LatLngExpression[], options?: PolylineOptions); toGeoJSON(): GeoJSONFeature; - feature: GeoJSONFeature; + feature?: GeoJSONFeature; } function polygon(latlngs: LatLngExpression[], options?: PolylineOptions): Polygon; @@ -641,7 +638,7 @@ declare namespace L { getRadius(): number; options: CircleMarkerOptions; - feature: GeoJSONFeature; + feature?: GeoJSONFeature; } function circleMarker(latlng: LatLngExpression, options?: CircleMarkerOptions): CircleMarker; @@ -726,7 +723,7 @@ declare namespace L { /** * Returns the layer with the given internal ID. */ - getLayer(id: number): Layer; + getLayer(id: number): Layer | undefined; /** * Returns an array of all the layers added to the group. @@ -743,7 +740,7 @@ declare namespace L { */ getLayerId(layer: Layer): number; - feature: GeoJSONFeatureCollection | GeoJSONFeature | GeoJSONGeometryCollection; + feature?: GeoJSONFeatureCollection | GeoJSONFeature | GeoJSONGeometryCollection; } /** @@ -783,7 +780,7 @@ declare namespace L { */ function featureGroup(layers?: Layer[]): FeatureGroup; - type StyleFunction = (feature: GeoJSONFeature) => PathOptions; + type StyleFunction = (feature?: GeoJSONFeature) => PathOptions; interface GeoJSONOptions extends LayerOptions { /** @@ -878,7 +875,7 @@ declare namespace L { /** * Reverse of coordsToLatLng */ - static latLngToCoords(latlng: LatLng): [number, number, number]; // A three tuple can be assigned to a two or three tuple + static latLngToCoords(latlng: LatLng): [number, number] | [number, number, number]; /** * Reverse of coordsToLatLngs closed determines whether the first point should be @@ -990,13 +987,13 @@ declare namespace L { constructor(options?: ControlOptions); getPosition(): ControlPosition; setPosition(position: ControlPosition): this; - getContainer(): HTMLElement; + getContainer(): HTMLElement | undefined; addTo(map: Map): this; remove(): this; // Extension methods - onAdd(map: Map): HTMLElement; - onRemove(map: Map): void; + onAdd?: (map: Map) => HTMLElement; + onRemove?: (map: Map)=> void; options: ControlOptions; } @@ -1094,11 +1091,11 @@ declare namespace L { class Popup extends Layer { constructor(options?: PopupOptions, source?: Layer); - getLatLng(): LatLng; + getLatLng(): LatLng | undefined; setLatLng(latlng: LatLngExpression): this; - getContent(): Content; + getContent(): Content | ((source: Layer) => Content) | undefined; setContent(htmlContent: ((source: Layer) => Content) | Content): this; - getElement(): HTMLElement; + getElement(): HTMLElement | undefined; update(): void; isOpen(): boolean; bringToFront(): this; @@ -1125,11 +1122,11 @@ declare namespace L { class Tooltip extends Layer { constructor(options?: TooltipOptions, source?: Layer); setOpacity(val: number): void; - getLatLng(): LatLng; + getLatLng(): LatLng | undefined; setLatLng(latlng: LatLngExpression): this; - getContent(): Content; + getContent(): Content | undefined; setContent(htmlContent: ((source: Layer) => Content) | Content): this; - getElement(): HTMLElement; + getElement(): HTMLElement | undefined; update(): void; isOpen(): boolean; bringToFront(): this; @@ -1178,8 +1175,8 @@ declare namespace L { enabled(): boolean; // Extension methods - addHooks(): void; - removeHooks(): void; + addHooks?:() => void; + removeHooks?:()=> void; } interface Event { @@ -1280,7 +1277,7 @@ declare namespace L { function stop(ev: Event): typeof DomEvent; - function getMousePosition(ev: Event, container?: HTMLElement): Point; + function getMousePosition(ev: MouseEvent, container?: HTMLElement): Point; function getWheelDelta(ev: Event): number; @@ -1350,7 +1347,7 @@ declare namespace L { /** * Name of the pane or the pane as HTML-Element */ - getPane(pane: string | HTMLElement): HTMLElement; + getPane(pane: string | HTMLElement): HTMLElement | undefined; getPanes(): {[name: string]: HTMLElement} & DefaultMapPanes; getContainer(): HTMLElement; whenReady(fn: () => void, context?: any): this; @@ -1393,7 +1390,7 @@ declare namespace L { dragging: Handler; keyboard: Handler; scrollWheelZoom: Handler; - tap: Handler; + tap?: Handler; touchZoom: Handler; options: MapOptions; @@ -1449,7 +1446,7 @@ declare namespace L { function icon(options: IconOptions): Icon; interface DivIconOptions extends BaseIconOptions { - html?: string; + html?: string | false; bgPos?: PointExpression; iconSize?: PointExpression; iconAnchor?: PointExpression; @@ -1484,11 +1481,11 @@ declare namespace L { setZIndexOffset(offset: number): this; setIcon(icon: Icon | DivIcon): this; setOpacity(opacity: number): this; - getElement(): HTMLElement; + getElement(): HTMLElement | undefined; // Properties options: MarkerOptions; - dragging: Handler; + dragging?: Handler; } function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker; @@ -1511,7 +1508,7 @@ declare namespace L { const any3d: boolean; const mobile: boolean; const mobileWebkit: boolean; - const mobiWebkit3d: boolean; + const mobileWebkit3d: boolean; const mobileOpera: boolean; const mobileGecko: boolean; const touch: boolean; @@ -1530,7 +1527,7 @@ declare namespace L { function stamp(obj: any): number; function throttle(fn: () => void, time: number, context: any): () => void; function wrapNum(num: number, range: number[], includeMax?: boolean): number; - function falseFn(): () => false; + function falseFn(): false; function formatNum(num: number, digits?: number): number; function trim(str: string): string; function splitWords(str: string): string[]; @@ -1541,7 +1538,7 @@ declare namespace L { function indexOf(array: any[], el: any): number; function requestAnimFrame(fn: () => void, context?: any, immediate?: boolean): number; function cancelAnimFrame(id: number): void; - let lastId: string; + let lastId: number; let emptyImageUrl: string; } } From 092c14b88044ea48a372633a2109e47bfafdaf83 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Tue, 7 Mar 2017 13:30:46 +0100 Subject: [PATCH 32/56] Leaflet: Fixed the test-case for leaflet (and using the correct MouseEvent in getMousePosition) --- types/leaflet/index.d.ts | 2 +- types/leaflet/leaflet-tests.ts | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 0e340d921a..16b5dbba04 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -1277,7 +1277,7 @@ declare namespace L { function stop(ev: Event): typeof DomEvent; - function getMousePosition(ev: MouseEvent, container?: HTMLElement): Point; + function getMousePosition(ev: {clientX: number, clientY: number} /*MouseEvent from lib.d.ts*/, container?: HTMLElement): Point; function getWheelDelta(ev: Event): number; diff --git a/types/leaflet/leaflet-tests.ts b/types/leaflet/leaflet-tests.ts index b7107c55fa..5936742a13 100644 --- a/types/leaflet/leaflet-tests.ts +++ b/types/leaflet/leaflet-tests.ts @@ -13,10 +13,6 @@ latLng = L.latLng([12, 13, 0]); latLng = new L.LatLng(12, 13); latLng = new L.LatLng(12, 13, 0); -latLng = new L.LatLng(latLngLiteral); -latLng = new L.LatLng({lat: 12, lng: 13, alt: 0}); -latLng = new L.LatLng(latLngTuple); -latLng = new L.LatLng([12, 13, 0]); const latLngBoundsLiteral: L.LatLngBoundsLiteral = [[12, 13], latLngTuple]; @@ -39,8 +35,6 @@ point = L.point({x: 12, y: 13}); point = new L.Point(12, 13); point = new L.Point(12, 13, true); -point = new L.Point(pointTuple); -point = new L.Point({x: 12, y: 13}); let distance: number; point.distanceTo(point); @@ -67,18 +61,13 @@ bounds = new L.Bounds(boundsLiteral); let points: L.Point[]; points = L.LineUtil.simplify([point, point], 1); -points = L.LineUtil.simplify([pointTuple, pointTuple], 2); distance = L.LineUtil.pointToSegmentDistance(point, point, point); -distance = L.LineUtil.pointToSegmentDistance(pointTuple, pointTuple, pointTuple); point = L.LineUtil.closestPointOnSegment(point, point, point); -point = L.LineUtil.closestPointOnSegment(pointTuple, pointTuple, pointTuple); points = L.PolyUtil.clipPolygon(points, bounds); points = L.PolyUtil.clipPolygon(points, bounds, true); -points = L.PolyUtil.clipPolygon([pointTuple, pointTuple], boundsLiteral); -points = L.PolyUtil.clipPolygon([pointTuple, pointTuple], boundsLiteral, true); let mapOptions: L.MapOptions = {}; mapOptions = { @@ -275,8 +264,8 @@ L.DomEvent .disableClickPropagation(htmlElement) .preventDefault(domEvent) .stop(domEvent); -point = L.DomEvent.getMousePosition(domEvent); -point = L.DomEvent.getMousePosition(domEvent, htmlElement); +point = L.DomEvent.getMousePosition(domEvent as MouseEvent); +point = L.DomEvent.getMousePosition(domEvent as MouseEvent, htmlElement); const wheelDelta: number = L.DomEvent.getWheelDelta(domEvent); map = map @@ -391,7 +380,7 @@ let twoCoords: [number, number] = [1, 2]; latLng = L.GeoJSON.coordsToLatLng(twoCoords); twoCoords = L.GeoJSON.latLngToCoords(latLng); -let threeCoords: [number, number, number] = [1, 2, 3]; +let threeCoords: [number, number] = [1, 2]; latLng = L.GeoJSON.coordsToLatLng(threeCoords); threeCoords = L.GeoJSON.latLngToCoords(latLng); From f743678eab4e3b921a853946f3c2e630313197b5 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Tue, 7 Mar 2017 13:33:48 +0100 Subject: [PATCH 33/56] Leaflet: Fixed whitespace reported by linter. --- types/leaflet/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/leaflet/index.d.ts b/types/leaflet/index.d.ts index 16b5dbba04..0efffe8f9e 100644 --- a/types/leaflet/index.d.ts +++ b/types/leaflet/index.d.ts @@ -993,7 +993,7 @@ declare namespace L { // Extension methods onAdd?: (map: Map) => HTMLElement; - onRemove?: (map: Map)=> void; + onRemove?: (map: Map) => void; options: ControlOptions; } @@ -1175,8 +1175,8 @@ declare namespace L { enabled(): boolean; // Extension methods - addHooks?:() => void; - removeHooks?:()=> void; + addHooks?: () => void; + removeHooks?: () => void; } interface Event { From 0ccb171334bb98d64e6f0f0533bc233286081ca7 Mon Sep 17 00:00:00 2001 From: ktmblueskyarb Date: Mon, 27 Mar 2017 10:02:42 +0200 Subject: [PATCH 34/56] AnimationPlaybackEvent, Corrected Animation class --- web-animations-js/web-animations-js.d.ts | 25 ++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/web-animations-js/web-animations-js.d.ts b/web-animations-js/web-animations-js.d.ts index f570e423ba..a151ef73b3 100644 --- a/web-animations-js/web-animations-js.d.ts +++ b/web-animations-js/web-animations-js.d.ts @@ -7,9 +7,18 @@ declare type AnimationEffectTimingFillMode = "none" | "forwards" | "backwards" | declare type AnimationEffectTimingPlaybackDirection = "normal" | "reverse" | "alternate" | "alternate-reverse"; declare type AnimationPlayState = "idle" | "pending" | "running" | "paused" | "finished"; -interface AnimationPlaybackEvent extends Event { +declare class AnimationPlaybackEvent { + constructor(target: Animation, currentTime: number, timelineTime: number); + target: Animation; currentTime: number; timelineTime: number; + type: string; + bubbles: boolean; + cancelable: boolean; + currentTarget: Animation; + defaultPrevented: boolean; + eventPhase: number; + timeStamp: number; } interface AnimationKeyFrame { @@ -35,7 +44,7 @@ interface AnimationEffectTiming { playbackRate?: number; } declare class KeyframeEffect { - constructor(target: HTMLElement, effect: AnimationKeyFrame | AnimationKeyFrame[], timing: number | AnimationEffectTiming); + constructor(target: HTMLElement, effect: AnimationKeyFrame | AnimationKeyFrame[], timing: number | AnimationEffectTiming, id?: string); activeDuration: number; onsample: any; parent: any; @@ -43,13 +52,15 @@ declare class KeyframeEffect { timing: AnimationEffectTiming; getFrames(): AnimationKeyFrame[]; } - -declare class Animation extends Element { +interface AnimationEventListener { + (evt: AnimationPlaybackEvent): void; +} +declare class Animation { constructor(effect: KeyframeEffect, timeline?: AnimationTimeline); currentTime: number; id: string; - oncancel: EventListener; - onfinish: EventListener; + oncancel: AnimationEventListener; + onfinish: AnimationEventListener; readonly playState: AnimationPlayState; playbackRate: number; startTime: number; @@ -58,6 +69,8 @@ declare class Animation extends Element { pause(): void; play(): void; reverse(): void; + addEventListener(type: number, handler: AnimationEventListener): void; + removeEventListener(type: number, handler: AnimationEventListener): void; effect: KeyframeEffect; readonly finished: Promise; readonly ready: Promise; From 1528028bbd89f5b894a39d4a8ae8d0169f66b2b9 Mon Sep 17 00:00:00 2001 From: Mykhailo Stadnyk Date: Mon, 27 Mar 2017 11:59:07 +0300 Subject: [PATCH 35/56] Canvas Gauges v2.1.3 type definitions updated --- types/canvas-gauges/index.d.ts | 62 +++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/types/canvas-gauges/index.d.ts b/types/canvas-gauges/index.d.ts index 6ba360a7ea..e5b4f69047 100644 --- a/types/canvas-gauges/index.d.ts +++ b/types/canvas-gauges/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for canvas-gauges v2.0.8 +// Type definitions for canvas-gauges v2.1.3 // Project: https://github.com/Mikhus/canvas-gauges // Definitions by: Mikhus // Definitions: https://github.com/Mikhus/DefinitelyTyped @@ -20,6 +20,10 @@ declare namespace CanvasGauges { color: string } + export interface EventListeners { + [key: string]: Function|[Function] + } + export type MajorTicks = string[]|number[]; export interface GenericOptions { @@ -30,6 +34,7 @@ declare namespace CanvasGauges { maxValue?: number, value?: number, units?: string|boolean, + exactTicks?: boolean, majorTicks?: MajorTicks, minorTicks?: number, strokeTicks?: boolean, @@ -37,6 +42,8 @@ declare namespace CanvasGauges { animateOnInit?: boolean, title?: string|boolean, borders?: boolean, + numbersMargin?: number, + listeners?: EventListeners, valueInt?: number, valueDec?: number, majorTicksInt?: number, @@ -45,6 +52,7 @@ declare namespace CanvasGauges { animationDuration?: number, animationRule?: string|AnimationRule, colorPlate?: string, + colorPlateEnd?: string, colorMajorTicks?: string, colorMinorTicks?: string, colorTitle?: string, @@ -67,6 +75,26 @@ declare namespace CanvasGauges { colorValueBoxShadow?: string, colorNeedleShadowUp?: string, colorNeedleShadowDown?: string, + colorBarStroke?: string, + colorBar?: string, + colorBarProgress?: string, + colorBarShadow?: string, + fontNumbers?: string, + fontTitle?: string, + fontUnits?: string, + fontValue?: string, + fontTitleSize?: number, + fontValueSize?: number, + fontUnitsSize?: number, + fontNumbersSize?: number, + fontTitleStyle?: FontStyle, + fontValueStyle?: FontStyle, + fontUnitsStyle?: FontStyle, + fontNumbersStyle?: FontStyle, + fontTitleWeight?: FontWeight, + fontValueWeight?: FontWeight, + fontUnitsWeight?: FontWeight, + fontNumbersWeight?: FontWeight, needle?: boolean, needleShadow?: boolean, needleType?: string, @@ -85,22 +113,10 @@ declare namespace CanvasGauges { valueBoxBorderRadius?: number, highlights?: Highlight[], highlightsWidth?: number, - fontNumbers?: string, - fontTitle?: string, - fontUnits?: string, - fontValue?: string, - fontTitleSize?: number, - fontValueSize?: number, - fontUnitsSize?: number, - fontNumbersSize?: number, - fontTitleStyle?: FontStyle, - fontValueStyle?: FontStyle, - fontUnitsStyle?: FontStyle, - fontNumbersStyle?: FontStyle, - fontTitleWeight?: FontWeight, - fontValueWeight?: FontWeight, - fontUnitsWeight?: FontWeight, - fontNumbersWeight?: FontWeight + barWidth?: number, + barStrokeWidth?: number, + barProgress?: boolean, + barShadow?: number } export interface RadialGaugeOptions extends GenericOptions { @@ -113,19 +129,14 @@ declare namespace CanvasGauges { needleCircleSize?: number, needleCircleInner?: boolean, needleCircleOuter?: boolean, - animationTarget?: string + animationTarget?: string, + useMinPath?: boolean } export interface LinearGaugeOptions extends GenericOptions { borderRadius?: number, barBeginCircle?: number, - barWidth?: number, - barStrokeWidth?: number, - barProgress?: boolean, - colorBar?: string, colorBarEnd?: string, - colorBarStroke?: string, - colorBarProgress?: string, colorBarProgressEnd?: string, tickSide?: string, needleSide?: string, @@ -230,6 +241,7 @@ declare namespace CanvasGauges { public canvas: SmartCanvas; public animation: Animation; public value: number; + public static readonly version: number; constructor(options: GenericOptions); @@ -238,6 +250,8 @@ declare namespace CanvasGauges { public abstract draw(): BaseGauge; public static initialize(type: string, options: GenericOptions): any; + public static fromElement(element: HTMLElement): any; + public static ensureValue(value: number): number; } export class RadialGauge extends BaseGauge { From 619d2fcc39dad12a5512eb55523f8fac7b4a44d5 Mon Sep 17 00:00:00 2001 From: Firede Date: Mon, 27 Mar 2017 17:14:47 +0800 Subject: [PATCH 36/56] `keyMap` is optional. --- types/graphql/language/visitor.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/graphql/language/visitor.d.ts b/types/graphql/language/visitor.d.ts index 1d0f399d6e..d4c528501e 100644 --- a/types/graphql/language/visitor.d.ts +++ b/types/graphql/language/visitor.d.ts @@ -42,7 +42,7 @@ export const QueryDocumentKeys: { export const BREAK: any; -export function visit(root: any, visitor: any, keyMap: any): any; +export function visit(root: any, visitor: any, keyMap?: any): any; export function visitInParallel(visitors: any): any; From 352a5756b1db52cc6cb3407dddf487843c297de0 Mon Sep 17 00:00:00 2001 From: Firede Date: Mon, 27 Mar 2017 17:15:50 +0800 Subject: [PATCH 37/56] `operationName` is optional. --- types/graphql/utilities/getOperationAST.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/graphql/utilities/getOperationAST.d.ts b/types/graphql/utilities/getOperationAST.d.ts index 65c7735a5d..ce99d39b2b 100644 --- a/types/graphql/utilities/getOperationAST.d.ts +++ b/types/graphql/utilities/getOperationAST.d.ts @@ -7,5 +7,5 @@ import { DocumentNode, OperationDefinitionNode } from '../language/ast'; */ export function getOperationAST( documentAST: DocumentNode, - operationName: string + operationName?: string ): OperationDefinitionNode; From 67dba4b5a78f585c2f74c8531ba7b6cfd72050be Mon Sep 17 00:00:00 2001 From: Firede Date: Mon, 27 Mar 2017 17:16:24 +0800 Subject: [PATCH 38/56] add `findDeprecatedUsages`. --- types/graphql/utilities/findDeprecatedUsages.d.ts | 13 +++++++++++++ types/graphql/utilities/index.d.ts | 3 +++ 2 files changed, 16 insertions(+) create mode 100644 types/graphql/utilities/findDeprecatedUsages.d.ts diff --git a/types/graphql/utilities/findDeprecatedUsages.d.ts b/types/graphql/utilities/findDeprecatedUsages.d.ts new file mode 100644 index 0000000000..58e9ae1685 --- /dev/null +++ b/types/graphql/utilities/findDeprecatedUsages.d.ts @@ -0,0 +1,13 @@ +import { GraphQLSchema } from '../type/schema'; +import { DocumentNode } from '../language/ast'; +import { GraphQLError } from '../error/GraphQLError'; + +/** + * A validation rule which reports deprecated usages. + * + * Returns a list of GraphQLError instances describing each deprecated use. + */ +export function findDeprecatedUsages( + schema: GraphQLSchema, + ast: DocumentNode +): Array diff --git a/types/graphql/utilities/index.d.ts b/types/graphql/utilities/index.d.ts index 47cfd70ff9..8815046735 100644 --- a/types/graphql/utilities/index.d.ts +++ b/types/graphql/utilities/index.d.ts @@ -73,3 +73,6 @@ export { assertValidName } from './assertValidName'; // Compares two GraphQLSchemas and detects breaking changes. export { findBreakingChanges } from './findBreakingChanges'; export { BreakingChange } from './findBreakingChanges'; + +// Report all deprecated usage within a GraphQL document. +export { findDeprecatedUsages } from './findDeprecatedUsages'; From 6d640754eb8dfb3c94d739a6aa8b2ac51af8a1bd Mon Sep 17 00:00:00 2001 From: gldfdp Date: Mon, 27 Mar 2017 11:16:56 +0200 Subject: [PATCH 39/56] Adding react-onsenui --- types/react-onsenui/index.d.ts | 314 ++++++++++++++++++++ types/react-onsenui/react-onsenui-tests.tsx | 49 +++ types/react-onsenui/tsconfig.json | 25 ++ types/react-onsenui/tslint.json | 1 + 4 files changed, 389 insertions(+) create mode 100644 types/react-onsenui/index.d.ts create mode 100644 types/react-onsenui/react-onsenui-tests.tsx create mode 100644 types/react-onsenui/tsconfig.json create mode 100644 types/react-onsenui/tslint.json diff --git a/types/react-onsenui/index.d.ts b/types/react-onsenui/index.d.ts new file mode 100644 index 0000000000..d8404e8f6c --- /dev/null +++ b/types/react-onsenui/index.d.ts @@ -0,0 +1,314 @@ +// Type definitions for React OnSenui (react-onsenui) 2.1 +// Project: https://onsen.io/v2/docs/guide/react/ +// Definitions by: Ozytis +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 +import { Component } from 'react'; + +declare interface Modifiers_string { + default?: string, + material?: string +} + +declare interface Modifiers_number { + default?: number, + material?: number +} + +declare interface AnimationOptions { + duration?: number, + delay?: number, + timing?: string +} + +/*** splitter ***/ +declare class SplitterSide extends Component<{ + side?: "left" | "right", + collapse?: "portrait" | "landscape" | boolean, + isOpen?: boolean, + onOpen?: (e?: Event) => void, + onPreOpen?: (e?: Event) => void, + onPreClose?: (e?: Event) => void, + onModeChange?: (e?: Event) => void, + onClose?: (e?: Event) => void, + isSwipeable?: boolean, + swipeTargetWidth?: number, + width?: number, + animation?: "overlay" | "default" + animationOptions?: AnimationOptions, + openThreshold?: number, + mode?: "collapse" | "split" +}, any>{ } + + +declare class SplitterContent extends Component<{}, any> { } + +declare class Splitter extends Component<{}, any> { } + +/*** toolbar ***/ + +declare class Toolbar extends Component<{}, any>{} + + +declare class BottomToolbar extends Component<{ + modifier?: string +}, any>{} + + +declare class ToolbarButton extends Component<{ + modifier?: string, + disabled?: boolean, + onClick?: (e?: Event) => void +}, any>{} + +/*** icon ***/ +declare class Icon extends Component<{ + modifier?: string, + icon?: string | Modifiers_string, + size?: number | Modifiers_number, + rotate?: 90 | 180 | 270, + fixedWidth?: boolean, + spin?: boolean +}, any>{} + +/*** page ***/ + +declare class Page extends Component<{ + contentStyle?: any, + modifier?: string, + renderModal?: () => void, + renderToolbar?: () => void, + renderBottomToolbar?: () => void, + renderFixed?: () => void, + onInit?: () => void, + onShow?: () => void, + onHide?: () => void +}, any>{} + +/*** Grid ***/ +declare class Col extends Component<{ + verticalAlign?: "top" | "bottom" | "center", + width?: string +}, any>{} + +declare class Row extends Component<{ + verticalAlign?: "top" | "bottom" | "center", +}, any>{} + +/*** Navigation ***/ +declare class BackButton extends Component<{ + modifier?: string, + onClick?: (navigator: Navigator) => void +}, any>{} + +declare class Navigator extends Component<{ + renderPage: () => any, + initialRouteStack?: string[], + initialRoute?: any, + onPrePush?: () => void, + onPostPush?: () => void, + onPrePop?: () => void, + onPostPop?: () => void, + animation?: "slide" | "lift" | "fade" | "none" | string, + animationOptions?: AnimationOptions +}, any>{ + resetPage(route: any, options: any): void; + resetPageStack(route: any, options: any): void; + pushPage(route: any, options: any): void; + popPage(route: any, options: any): void; +} + +/*** Carousel ***/ +declare class Carousel extends Component<{ + direction?: "horizontal" | "vertical", + fullscreen?: boolean, + overscrollable?: boolean, + centered?: boolean, + itemWidth?: number, + itemHeight?: number, + autoScroll?: boolean, + autoScrollRatio?: number, + swipeable?: boolean, + disabled?: boolean, + index?: number, + autoRefresh?: boolean, + onPostChange?: () => void, + onRefresh?: () => void, + onOverscroll?: () => void + animationOptions?: AnimationOptions +}, any>{} + +declare class CarouselItem extends Component<{ + modifier: string +}, any>{} + +/*** AlertDialog ***/ +declare class AlertDialog extends Component<{ + onCancel?: () => void, + isOpen?: boolean, + isCancelable?: boolean, + isDisabled?: boolean, + animation?: "none" | "default", + modifier?: string, + maskColor?: string, + animationOptions?: AnimationOptions, + onPreShow?: () => void, + onPostShow?: () => void, + onPreHide?: () => void, + onPostHide?: () => void, +}, any>{} + +declare class Dialog extends Component<{ + onCancel?: () => void, + isOpen?: boolean, + isCancelable?: boolean, + isDisabled?: boolean, + animation?: "none" | "default", + modifier?: string, + maskColor?: string, + animationOptions?: AnimationOptions, + onPreShow?: () => void, + onPostShow?: () => void, + onPreHide?: () => void, + onPostHide?: () => void, +}, any>{} + +declare class Modal extends Component<{ + animation?: "fade" | "none", + animationOptions?: AnimationOptions + onShow?: () => void, + onHide?: () => void, + isOpen?: boolean +}, any>{} + +declare class Popover extends Component<{ + getTarget?: () => Component | HTMLElement, + onCancel?: () => void, + isOpen?: boolean, + isCancelable?: boolean, + isDisabled?: boolean, + animation?: "none" | "default", + modifier?: string, + maskColor?: string, + animationOptions?: AnimationOptions, + onPreShow?: () => void, + onPostShow?: () => void, + onPreHide?: () => void, + onPostHide?: () => void, +}, any>{} + +declare class ProgressBar extends Component<{ + modifier?: string, + value?: number, + secondaryValue?: boolean, + intermediate?: boolean, +}, any> {} + +declare class ProgressCircular extends Component<{ + modifier?: string, + value?: number, + secondaryValue?: boolean, + intermediate?: boolean, +}, any>{} + +declare class Ripple extends Component<{ + color?: string, + background?: string, + disabled?: boolean, +}, any>{} + +/*** Forms ***/ +declare class Fab extends Component<{ + modifier?: string, + ripple?: boolean, + position?: string, + disabled?: boolean, + onClick?: () => void, +}, any>{} + +declare class Button extends Component<{ + modifier?: string, + disabled?: boolean, + ripple?: boolean, + onClick?: (e?: Event) => void +}, any>{} + +declare class Input extends Component<{ + modifier?: string, + disabled?: boolean, + onChange?: (e: Event) => void, + value?: string, + checked?: boolean, + placehoder?: string, + type?: string, + inputId?: string, + float?: boolean, +}, any> {} + +declare class Range extends Component<{ + modifier?: string, + onChange?: (e: Event) => void, + value?: number, + disabled?: boolean, +}, any>{} + +declare class Switch extends Component<{ + onChange?: (e: Event) => void, + checked?: boolean, + disabled?: boolean, + inputId?: string +}, any>{} + +/** +* Tabs +*/ + +declare class Tab extends Component<{}, any>{ } + +declare class TabActive extends Component<{}, any>{ } + +declare class TabInactive extends Component<{}, any>{ } + +declare class Tabbar extends Component<{ + index?: number, + renderTabs?: () => any, + position?: "bottom" | "top" | "auto", + animation: "none" | "slide" | "fade", + animationOptions?: AnimationOptions, + onPreChange?: () => void, + onPostChange?: () => void, + onReactive?: () => void, +}, any> { } + + +/** +* Lists +*/ + +declare class LazyList extends Component<{ + modifier?: string, + length?: number, + renderRow: (rowIndex: number) => any, + calculateItemHeight: (rowIndex: number) => any, +}, any>{ } + +declare class List extends Component<{ + modifier?: string, + dataSource?: string[], + renderRow?: () => void, + renderHeader?: () => void, + renderFooter?: () => void, +}, any>{} + +declare class ListHeader extends Component<{ + modifier?: string, +}, any>{} + +declare class ListItem extends Component<{ + modifier?: string, + tappable?: boolean, + tapBackgroundColor?: string, + lockOnDrag?: boolean, +}, any>{} + + diff --git a/types/react-onsenui/react-onsenui-tests.tsx b/types/react-onsenui/react-onsenui-tests.tsx new file mode 100644 index 0000000000..b72e8c3a37 --- /dev/null +++ b/types/react-onsenui/react-onsenui-tests.tsx @@ -0,0 +1,49 @@ +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import { SplitterSide, Splitter, SplitterContent, Page } from "react-onsenui"; + +class AppState { + isOpen: boolean = false; +} + +interface AppProps { +} + +export class App extends React.Component{ + + constructor(props?: AppProps) { + super(props); + this.state = new AppState(); + } + + hide() { + this.setState({ isOpen: false }); + } + + render() { + + return ( + + this.hide()} + isSwipeable={true}> + + Menu content + + + + + Test page + + + + ); + } + +} + + +ReactDOM.render(, document.getElementById('react-body')); \ No newline at end of file diff --git a/types/react-onsenui/tsconfig.json b/types/react-onsenui/tsconfig.json new file mode 100644 index 0000000000..2b4e079fd1 --- /dev/null +++ b/types/react-onsenui/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "sourceMap": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "module": "commonjs", + "target": "es5", + "jsx": "react", + "experimentalDecorators": true, + "baseUrl": "../", + "typeRoots": [ "../" ], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "lib": [ + "es6", + "dom" + ], + "types": [] + }, + "files": [ + "index.d.ts", + "react-onsenui-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-onsenui/tslint.json b/types/react-onsenui/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/types/react-onsenui/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file From 7fdcaa77107727c610432d76f1faefbac761816b Mon Sep 17 00:00:00 2001 From: Firede Date: Mon, 27 Mar 2017 17:19:40 +0800 Subject: [PATCH 40/56] remove duplicate functions. --- types/graphql/index.d.ts | 2 +- types/graphql/utilities/buildASTSchema.d.ts | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/types/graphql/index.d.ts b/types/graphql/index.d.ts index 43d810de02..b6d02d7026 100644 --- a/types/graphql/index.d.ts +++ b/types/graphql/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for graphql v0.8.2 // Project: https://www.npmjs.com/package/graphql -// Definitions by: TonyYang , Caleb Meredith , Dominic Watson +// Definitions by: TonyYang , Caleb Meredith , Dominic Watson , Firede // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/graphql/utilities/buildASTSchema.d.ts b/types/graphql/utilities/buildASTSchema.d.ts index cf782a30ec..94f4e2a47a 100644 --- a/types/graphql/utilities/buildASTSchema.d.ts +++ b/types/graphql/utilities/buildASTSchema.d.ts @@ -26,15 +26,3 @@ export function getDescription(node: { loc?: Location }): string; * document. */ export function buildSchema(source: string | Source): GraphQLSchema; - -/** - * Given an ast node, returns its string description based on a contiguous - * block full-line of comments preceding it. - */ -export function getDescription(node: { loc?: Location }): string; - -/** - * A helper function to build a GraphQLSchema directly from a source - * document. - */ -export function buildSchema(source: string | Source): GraphQLSchema; From e51040fef45babfefaeebafe577032d088a18554 Mon Sep 17 00:00:00 2001 From: Johan Nordberg Date: Mon, 27 Mar 2017 11:21:05 +0200 Subject: [PATCH 41/56] Typofix `mobileAudioEnable` should be `mobileAutoEnable` --- types/howler/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/howler/index.d.ts b/types/howler/index.d.ts index df3f6a363b..0966f4a472 100644 --- a/types/howler/index.d.ts +++ b/types/howler/index.d.ts @@ -11,7 +11,7 @@ interface HowlerGlobal { unload(): void; usingWebAudio: boolean; noAudio: boolean; - mobileAudioEnable: boolean; + mobileAutoEnable: boolean; autoSuspend: boolean; ctx: AudioContext; masterGain: GainNode; From 8f44cafe32e09106b72f8953bf48a21f6d553cea Mon Sep 17 00:00:00 2001 From: webbiesdk Date: Mon, 27 Mar 2017 12:17:53 +0200 Subject: [PATCH 42/56] Updated links in readme The links in the readme didn't change after putting all declarations into the `types` folder. --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 34ddfd9ef2..9dbb809b57 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (nee DefinitelyTyped members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down. -For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/base64-js). +For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/base64-js). #### Common mistakes @@ -191,7 +191,7 @@ If you're adding a new major version of a library, you can copy `index.d.ts` to #### I notice some packages having a `package.json` here. Usually you won't need this. When publishing a package we will normally automatically create a `package.json` for it. -A `package.json` may be included for the sake of specifying dependencies. Here's an [example](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/pikaday/package.json). +A `package.json` may be included for the sake of specifying dependencies. Here's an [example](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/pikaday/package.json). We do not allow other fields, such as `"description"`, to be defined manually. Also, if you need to reference an older version of typings, you must do that by adding `"dependencies": { "@types/foo": "x.y.z" }` to the package.json. @@ -231,7 +231,7 @@ Before making your change, please create a new subfolder with the current versio 1. Update the relative paths in `tsconfig.json` as well as `tslint.json`. 2. Add path mapping rules to ensure that tests are running against the intended version. -For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/history/v2/tsconfig.json) looks like: +For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/history/v2/tsconfig.json) looks like: ```json { @@ -250,8 +250,8 @@ For example [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/Defi ``` Please note that unless upgrading something backwards-compatible like `node`, all packages depending of the updated package need a path mapping to it, as well as packages depending on *those*. -For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/react-router/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`; -transitively `react-router-bootstrap` (which depends on `react-router`) also adds a path mapping in its [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/react-router-bootstrap/tsconfig.json). +For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`; +transitively `react-router-bootstrap` (which depends on `react-router`) also adds a path mapping in its [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router-bootstrap/tsconfig.json). Also, `/// ` will not work with path mapping, so dependencies must use `import`. From 20a6f0b7e95cc57d94bdce42249c0f6d48c61972 Mon Sep 17 00:00:00 2001 From: David Martin Date: Mon, 27 Mar 2017 11:32:57 +0100 Subject: [PATCH 43/56] allow fieldTransform to be an array of functions --- types/angular-formly/angular-formly-tests.ts | 1 + types/angular-formly/index.d.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/types/angular-formly/angular-formly-tests.ts b/types/angular-formly/angular-formly-tests.ts index 83f13af2d4..b78c8a1257 100644 --- a/types/angular-formly/angular-formly-tests.ts +++ b/types/angular-formly/angular-formly-tests.ts @@ -30,6 +30,7 @@ class FormConfig { formlyConfig.extras.errorExistsAndShouldBeVisibleExpression = angular.noop; formlyConfig.extras.explicitAsync = true; formlyConfig.extras.fieldTransform = angular.noop; + formlyConfig.extras.fieldTransform = [angular.noop]; formlyConfig.extras.getFieldId = angular.noop; formlyConfig.extras.ngModelAttrsManipulatorPreferUnbound = true; } diff --git a/types/angular-formly/index.d.ts b/types/angular-formly/index.d.ts index aed12f5360..d37228fb79 100644 --- a/types/angular-formly/index.d.ts +++ b/types/angular-formly/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for angular-formly 7.2.3 +// Type definitions for angular-formly 7.2.4 // Project: https://github.com/formly-js/angular-formly // Definitions by: Scott Hatcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -44,7 +44,7 @@ declare namespace AngularFormly { data?: { [key: string]: any; }; - fieldTransform?: Function; + fieldTransform?: Function | Array; formState?: Object; removeChromeAutoComplete?: boolean; resetModel?: Function; @@ -580,7 +580,7 @@ declare namespace AngularFormly { defaultHideDirective: string; errorExistsAndShouldBeVisibleExpression: any; getFieldId: Function; - fieldTransform: Function; + fieldTransform: Function | Array; explicitAsync: boolean; } From ad9c5dd1d2e0556d80e1848c284a773fd8bdc8e8 Mon Sep 17 00:00:00 2001 From: Firede Date: Mon, 27 Mar 2017 18:58:40 +0800 Subject: [PATCH 44/56] add `findBreakingChanges` & `findDeprecatedUsages` --- types/graphql/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/graphql/index.d.ts b/types/graphql/index.d.ts index b6d02d7026..9eef11de76 100644 --- a/types/graphql/index.d.ts +++ b/types/graphql/index.d.ts @@ -105,6 +105,12 @@ export { // Asserts a string is a valid GraphQL name. assertValidName, + // Compares two GraphQLSchemas and detects breaking changes. + findBreakingChanges, + + // Report all deprecated usage within a GraphQL document. + findDeprecatedUsages, + BreakingChange, IntrospectionDirective, From 68436998439a29d30bd2d68f4e6b1d141e51a59e Mon Sep 17 00:00:00 2001 From: Firede Date: Mon, 27 Mar 2017 19:00:26 +0800 Subject: [PATCH 45/56] add `isNamedType` & `assertNamedType`. promisify isTypeOf and resolveType. --- types/graphql/index.d.ts | 2 +- types/graphql/type/definition.d.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/types/graphql/index.d.ts b/types/graphql/index.d.ts index 9eef11de76..95c7bc5b37 100644 --- a/types/graphql/index.d.ts +++ b/types/graphql/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for graphql v0.8.2 +// Type definitions for graphql v0.9.1 // Project: https://www.npmjs.com/package/graphql // Definitions by: TonyYang , Caleb Meredith , Dominic Watson , Firede // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/graphql/type/definition.d.ts b/types/graphql/type/definition.d.ts index 6fef914d8e..3d6beae33d 100644 --- a/types/graphql/type/definition.d.ts +++ b/types/graphql/type/definition.d.ts @@ -126,6 +126,10 @@ export type GraphQLNamedType = GraphQLEnumType | GraphQLInputObjectType; +export function isNamedType(type: GraphQLType): boolean; + +export function assertNamedType(type: GraphQLType): GraphQLNamedType; + export function getNamedType(type: GraphQLType): GraphQLNamedType; /** @@ -237,13 +241,13 @@ export type GraphQLTypeResolver = ( value: TSource, context: TContext, info: GraphQLResolveInfo -) => GraphQLObjectType; +) => GraphQLObjectType | string | Promise; export type GraphQLIsTypeOfFn = ( source: TSource, context: TContext, info: GraphQLResolveInfo -) => boolean; +) => boolean | Promise; export type GraphQLFieldResolver = ( source: TSource, From a1b59d6a0f602b47ab05e0c6e52200c881c67d06 Mon Sep 17 00:00:00 2001 From: Firede Date: Mon, 27 Mar 2017 19:08:48 +0800 Subject: [PATCH 46/56] add TypeInfo.getEnumValue and EnumType.getValue --- types/graphql/type/definition.d.ts | 1 + types/graphql/utilities/TypeInfo.d.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/graphql/type/definition.d.ts b/types/graphql/type/definition.d.ts index 3d6beae33d..656ac7253c 100644 --- a/types/graphql/type/definition.d.ts +++ b/types/graphql/type/definition.d.ts @@ -430,6 +430,7 @@ export class GraphQLEnumType { constructor(config: GraphQLEnumTypeConfig); getValues(): Array; + getValue(name: string): GraphQLEnumValue; serialize(value: any): string; parseValue(value: any): any; parseLiteral(valueNode: ValueNode): any; diff --git a/types/graphql/utilities/TypeInfo.d.ts b/types/graphql/utilities/TypeInfo.d.ts index 2957114ae5..b4fa855569 100644 --- a/types/graphql/utilities/TypeInfo.d.ts +++ b/types/graphql/utilities/TypeInfo.d.ts @@ -5,6 +5,7 @@ import { GraphQLInputType, GraphQLField, GraphQLArgument, + GraphQLEnumValue, GraphQLType, } from '../type/definition'; import { GraphQLDirective } from '../type/directives'; @@ -30,6 +31,7 @@ export class TypeInfo { getFieldDef(): GraphQLField; getDirective(): GraphQLDirective; getArgument(): GraphQLArgument; + getEnumValue(): GraphQLEnumValue; enter(node: ASTNode): any; leave(node: ASTNode): any; } @@ -40,4 +42,4 @@ export interface getFieldDef { parentType: GraphQLType, fieldNode: FieldNode ): GraphQLField -} \ No newline at end of file +} From 57caf932118e8e086b6172bb66c393f619263064 Mon Sep 17 00:00:00 2001 From: Firede Date: Mon, 27 Mar 2017 19:37:17 +0800 Subject: [PATCH 47/56] fixed lint errors. --- types/graphql/error/GraphQLError.d.ts | 10 +++++----- types/graphql/index.d.ts | 2 +- types/graphql/language/ast.d.ts | 2 +- types/graphql/type/definition.d.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/types/graphql/error/GraphQLError.d.ts b/types/graphql/error/GraphQLError.d.ts index 12f65a506c..857f25b593 100644 --- a/types/graphql/error/GraphQLError.d.ts +++ b/types/graphql/error/GraphQLError.d.ts @@ -27,7 +27,7 @@ export class GraphQLError extends Error { * * Enumerable, and appears in the result of JSON.stringify(). */ - locations?: Array<{ line: number, column: number }> | void; + locations?: Array<{ line: number, column: number }> | undefined; /** * An array describing the JSON-path into the execution response which @@ -35,23 +35,23 @@ export class GraphQLError extends Error { * * Enumerable, and appears in the result of JSON.stringify(). */ - path?: Array | void; + path?: Array | undefined; /** * An array of GraphQL AST Nodes corresponding to this error. */ - nodes?: Array | void; + nodes?: Array | undefined; /** * The source GraphQL document corresponding to this error. */ - source?: Source | void; + source?: Source | undefined; /** * An array of character offsets within the source GraphQL document * which correspond to this error. */ - positions?: Array | void; + positions?: Array | undefined; /** * The original error thrown from a field resolver during execution. diff --git a/types/graphql/index.d.ts b/types/graphql/index.d.ts index 95c7bc5b37..de2a1405e6 100644 --- a/types/graphql/index.d.ts +++ b/types/graphql/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for graphql v0.9.1 +// Type definitions for graphql 0.9 // Project: https://www.npmjs.com/package/graphql // Definitions by: TonyYang , Caleb Meredith , Dominic Watson , Firede // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/graphql/language/ast.d.ts b/types/graphql/language/ast.d.ts index 238cbe7210..d0f25b65d0 100644 --- a/types/graphql/language/ast.d.ts +++ b/types/graphql/language/ast.d.ts @@ -85,7 +85,7 @@ export type Token = { /** * For non-punctuation tokens, represents the interpreted value of the token. */ - value: string | void; + value: string | undefined; /** * Tokens exist as nodes in a double-linked-list amongst all tokens diff --git a/types/graphql/type/definition.d.ts b/types/graphql/type/definition.d.ts index 656ac7253c..cf077ad5ba 100644 --- a/types/graphql/type/definition.d.ts +++ b/types/graphql/type/definition.d.ts @@ -269,7 +269,7 @@ export interface GraphQLResolveInfo { variableValues: { [variableName: string]: any }; } -export type ResponsePath = { prev: ResponsePath, key: string | number } | void; +export type ResponsePath = { prev: ResponsePath, key: string | number } | undefined; export interface GraphQLFieldConfig { type: GraphQLOutputType; From 6d01ad0c9a62499af41a518b3ee518cd5e8b6d99 Mon Sep 17 00:00:00 2001 From: gldfdp Date: Mon, 27 Mar 2017 14:33:32 +0200 Subject: [PATCH 48/56] missing "l" in placeholder prop of Input --- types/react-onsenui/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-onsenui/index.d.ts b/types/react-onsenui/index.d.ts index d8404e8f6c..3ce4a26686 100644 --- a/types/react-onsenui/index.d.ts +++ b/types/react-onsenui/index.d.ts @@ -239,7 +239,7 @@ declare class Input extends Component<{ onChange?: (e: Event) => void, value?: string, checked?: boolean, - placehoder?: string, + placeholder?: string, type?: string, inputId?: string, float?: boolean, From 75d72c4174ae7fb59875fceadc458a8e188ff7b9 Mon Sep 17 00:00:00 2001 From: huhuanming Date: Tue, 28 Mar 2017 00:49:29 +0800 Subject: [PATCH 49/56] Add react-native-google-analytics-bridge types --- .../index.d.ts | 235 ++++++++++++++++++ ...ct-native-google-analytics-bridge-tests.ts | 28 +++ .../tsconfig.json | 22 ++ .../tslint.json | 3 + types/react-native-orientation/index.d.ts | 2 +- 5 files changed, 289 insertions(+), 1 deletion(-) create mode 100644 types/react-native-google-analytics-bridge/index.d.ts create mode 100644 types/react-native-google-analytics-bridge/react-native-google-analytics-bridge-tests.ts create mode 100644 types/react-native-google-analytics-bridge/tsconfig.json create mode 100644 types/react-native-google-analytics-bridge/tslint.json diff --git a/types/react-native-google-analytics-bridge/index.d.ts b/types/react-native-google-analytics-bridge/index.d.ts new file mode 100644 index 0000000000..38afee3512 --- /dev/null +++ b/types/react-native-google-analytics-bridge/index.d.ts @@ -0,0 +1,235 @@ +// Type definitions for react-native-google-analytics-bridge 5.0 +// Project: https://github.com/idehub/react-native-google-analytics-bridge +// Definitions by: Huhuanming +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + + + export class GoogleAnalyticsTracker { + /** + * Save all tracker related data that is needed to call native methods with proper data. + * @param trackerId {String} + * @param customDimensionsFieldsIndexMap {{fieldName: fieldIndex}} Custom dimensions field/index pairs + */ + constructor(trackerId: string, customDimensionsFieldsIndexMap?: {}) + + /** + * If Tracker has customDimensionsFieldsIndexMap, it will transform + * customDimensions map pairs {field: value} to {fieldIndex: value}. + * Otherwise customDimensions are passed trough untouched. + * Underlay native methods will transform provided customDimensions map to expected format. + * Google analytics expect dimensions to be tracker with 'dimension{index}' keys, + * not dimension field names. + * @param customDimensions {Object} + * @returns {Object} + */ + transformCustomDimensionsFieldsToIndexes(customDimensions: {}): void + + /** + * Track the current screen/view + * @param {String} screenName The name of the current screen + */ + trackScreenView(screenName: string): void + + /** + * Track an event that has occured + * @param {String} category The event category + * @param {String} action The event action + * @param {Object} optionalValues An object containing optional label and value + */ + trackEvent(category: string, action: string, optionalValues?: {}): void + + /** + * Track the current screen/view with custom dimension values + * @param {String} screenName The name of the current screen + * @param {Object} customDimensionValues An object containing custom dimension key/value pairs + */ + trackScreenViewWithCustomDimensionValues(screenName: string, customDimensionValues: {}): void + + /** + * Track an event that has occured with custom dimension values + * @param {String} category The event category + * @param {String} action The event action + * @param {Object} optionalValues An object containing optional label and value + * @param {Object} customDimensionValues An object containing custom dimension key/value pairs + */ + trackEventWithCustomDimensionValues( + category: string, + action: string, + optionalValues: {}, + customDimensionValues: {}, + ): void + + /** + * Track an event that has occured + * @param {String} category The event category + * @param {Number} value The timing measurement in milliseconds + * @param {Object} optionalValues An object containing optional name and label + */ + trackTiming(category: string, value: number, optionalValues: {}): void + + /** + * Track a purchase event. This uses the Enhanced Ecommerce GA feature. + * @param {Object} product An object with product values + * @param {Object} transaction An object with transaction values + * @param {String} eventCategory The event category, defaults to Ecommerce + * @param {String} eventAction The event action, defaults to Purchase + */ + trackPurchaseEvent( + product: {}, + transaction: {}, + eventCategory?: string, + eventAction?: string, + ): void + + /** + * Track a purchase event. This uses the Enhanced Ecommerce GA feature. + * @param {Array} products An array with products + * @param {Object} transaction An object with transaction values + * @param {String} eventCategory The event category, defaults to Ecommerce + * @param {String} eventAction The event action, defaults to Purchase + */ + trackMultiProductsPurchaseEvent( + products: {}[], + ransaction: {}, + eventCategory?: string, + eventAction?: string + ): void + + /** + * Track a purchase event with custom dimensions. This uses the Enhanced Ecommerce GA feature. + * @param {Array} products An array with products + * @param {Object} transaction An object with transaction values + * @param {String} eventCategory The event category, defaults to Ecommerce + * @param {String} eventAction The event action, defaults to Purchase + * @param {Object} customDimensionValues An object containing custom dimension key/value pairs + */ + trackMultiProductsPurchaseEventWithCustomDimensionValues( + products: {}[], + transaction: {}, + eventCategory?: string, + eventAction?: string, + customDimensions?: {}, + ): void + + /** + * Track an exception + * @param {String} error The description of the error + * @param {Boolean} fatal A value indiciating if the error was fatal, defaults to false + */ + trackException(error: string, fatal?: boolean): void + + /** + * Sets the current userId for tracking. + * @param {String} userId The current userId + */ + setUser(userId: string): void + + /** + * Sets if IDFA (identifier for advertisers) collection should be enabled + * @param {Boolean} enabled Defaults to true + */ + allowIDFA(enabled?: boolean): void + + /** + * Track a social interaction, Facebook, Twitter, etc. + * @param {String} network + * @param {String} action + * @param {String} targetUrl + */ + trackSocialInteraction(network: string, action: string, targetUrl: string): void + + /** + * Sets if uncaught exceptions should be tracked + * @param {Boolean} enabled + */ + setTrackUncaughtExceptions(enabled: boolean): void + + /** + * Sets the trackers appName + * The Bundle name is used by default + * @param {String} appName + */ + setAppName(appName: string): void + + /** + * Sets the trackers appVersion + * @param {String} appVersion + */ + setAppVersion(appVersion: string): void + + /** + * Sets if AnonymizeIp is enabled + * If enabled the last octet of the IP address will be removed + * @param {Boolean} enabled + */ + setAnonymizeIp(enabled: string): void + + /** + * Sets tracker sampling rate. + * @param {Float} sampleRatio Percentage 0 - 100 + */ + setSamplingRate(sampleRatio: number): void + } + + interface GAEvent { + event: string + payload: T + } + + export class GoogleTagManager { + /** + * Call once to open the container for all subsequent static calls. + * @param {String} containerId + */ + static openContainerWithId(containerId: string): void + + /** + * Retrieves a boolean value with the given key from the opened container. + * @param {String} key + */ + static boolForKey(key: string): boolean + + /** + * Retrieves a string with the given key from the opened container. + * @param {String} key + */ + static stringForKey(key: string): string + + /** + * Retrieves a number with the given key from the opened container. + * @param {String} key + */ + static doubleForKey(key: string): number + + /** + * push a datalayer event for Google Analytics through Google Tag Manager. + * @param {Object} dictionary An Map containing key and value pairs. + * it must have at least one key "event" with event name + * example: {event: "eventName", pageId: "/home"} + */ + static pushDataLayerEvent(dictionary: GAEvent): void + } + + export class GoogleAnalyticsSettings { + /** + * Sets if OptOut is active and disables Google Analytics + * This has to be set each time the App starts + * @param {Boolean} enabled + */ + static setOptOut(enabled: boolean): void + + /** + * Sets the trackers dispatch interval + * This will influence how often batches of events, screen views, etc + * are sent to your tracker. + * @param {Number} intervalInSeconds + */ + static setDispatchInterval(intervalInSeconds: number): void + + /** + * Sets if the tracker should have dry run enabled. + * If dry run is enabled, no analytics data will be sent to your tracker. + * @param {Boolean} enabled + */ + static setDryRun(enabled: boolean): void + } diff --git a/types/react-native-google-analytics-bridge/react-native-google-analytics-bridge-tests.ts b/types/react-native-google-analytics-bridge/react-native-google-analytics-bridge-tests.ts new file mode 100644 index 0000000000..3f9835fb83 --- /dev/null +++ b/types/react-native-google-analytics-bridge/react-native-google-analytics-bridge-tests.ts @@ -0,0 +1,28 @@ +import { + GoogleAnalyticsTracker, + GoogleTagManager, + GoogleAnalyticsSettings, +} from './index' + +const tracker = new GoogleAnalyticsTracker('GA_UA') + +tracker.allowIDFA() +tracker.allowIDFA(true) + +tracker.setAnonymizeIp('1.1.1.1') + +tracker.setAppName('name') + +GoogleTagManager.openContainerWithId('123') +GoogleTagManager.boolForKey('key') +GoogleTagManager.stringForKey('key') +GoogleTagManager.doubleForKey('key') +GoogleTagManager.pushDataLayerEvent({ + event: 'event', + payload: 'payload', +}) + +GoogleAnalyticsSettings.setOptOut(true) +GoogleAnalyticsSettings.setDispatchInterval(1000) +GoogleAnalyticsSettings.setDryRun(true) + diff --git a/types/react-native-google-analytics-bridge/tsconfig.json b/types/react-native-google-analytics-bridge/tsconfig.json new file mode 100644 index 0000000000..38ddc86d87 --- /dev/null +++ b/types/react-native-google-analytics-bridge/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", + "react-native-google-analytics-bridge-tests.ts" + ] +} diff --git a/types/react-native-google-analytics-bridge/tslint.json b/types/react-native-google-analytics-bridge/tslint.json new file mode 100644 index 0000000000..ec365f164b --- /dev/null +++ b/types/react-native-google-analytics-bridge/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +} diff --git a/types/react-native-orientation/index.d.ts b/types/react-native-orientation/index.d.ts index 03139b20dd..bc36430afe 100644 --- a/types/react-native-orientation/index.d.ts +++ b/types/react-native-orientation/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-native-orientation +// Type definitions for react-native-orientation 5.0 // Project: https://github.com/yamill/react-native-orientation // Definitions by: Moshe Atlow // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From f96c1c5d92b4fd59a6c222362c137ddec1235bcb Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 27 Mar 2017 10:02:11 -0700 Subject: [PATCH 50/56] Apply new lint rules to more files --- types/bloomfilter/bloomfilter-tests.ts | 10 +- types/bloomfilter/index.d.ts | 4 +- .../bunyan-blackhole-tests.ts | 8 +- types/chai-subset/chai-subset-tests.ts | 13 +- types/clipboard/clipboard-tests.ts | 11 +- types/clipboard/index.d.ts | 2 +- .../cordova-sqlite-storage-tests.ts | 55 ++--- types/cordova-sqlite-storage/index.d.ts | 1 - types/csv-parse/csv-parse-tests.ts | 26 +- types/csv-parse/index.d.ts | 28 +-- types/csv-parse/tslint.json | 7 +- types/d3-dsv/d3-dsv-tests.ts | 8 - types/d3-dsv/tslint.json | 1 + types/d3-dsv/v0/d3-dsv-tests.ts | 7 +- types/d3-selection/d3-selection-tests.ts | 35 --- types/d3-selection/index.d.ts | 21 +- types/dagre-d3/dagre-d3-tests.ts | 1 - types/deep-equal/deep-equal-tests.ts | 1 - types/dot/dot-tests.ts | 20 +- types/falcor/index.d.ts | 7 - types/falcor/test/browser.ts | 5 +- types/falcor/test/index.ts | 1 - types/fetch-jsonp/fetch-jsonp-tests.ts | 32 +-- types/firmata/firmata-tests.ts | 35 +-- types/firmata/index.d.ts | 224 +++++++++++------- types/flatpickr/flatpickr-tests.ts | 1 - types/freeport/freeport-tests.ts | 1 - types/fusioncharts/fusioncharts-tests.ts | 6 +- types/fusioncharts/fusioncharts.charts.d.ts | 2 - types/fusioncharts/fusioncharts.gantt.d.ts | 2 - types/fusioncharts/fusioncharts.maps.d.ts | 2 - .../fusioncharts.powercharts.d.ts | 2 - types/fusioncharts/fusioncharts.ssgrid.d.ts | 2 - types/fusioncharts/fusioncharts.treemap.d.ts | 2 - types/fusioncharts/fusioncharts.widgets.d.ts | 2 - .../fusioncharts.zoomscatter.d.ts | 2 - types/fusioncharts/index.d.ts | 7 - types/fusioncharts/maps/fusioncharts.usa.d.ts | 2 - .../fusioncharts/maps/fusioncharts.world.d.ts | 2 - .../themes/fusioncharts.theme.carbon.d.ts | 2 - .../themes/fusioncharts.theme.fint.d.ts | 2 - .../themes/fusioncharts.theme.ocean.d.ts | 2 - .../themes/fusioncharts.theme.zune.d.ts | 2 - types/globule/globule-tests.ts | 1 - types/globule/index.d.ts | 1 - types/klaw-sync/index.d.ts | 1 - types/koa-compose/index.d.ts | 1 - types/koa-compose/koa-compose-tests.ts | 8 +- types/leven/leven-tests.ts | 3 +- .../localforage-cordovasqlitedriver-tests.ts | 1 - types/loopback/index.d.ts | 200 ---------------- types/loopback/loopback-tests.ts | 2 +- types/lz-string/lz-string-tests.ts | 12 +- types/modernizr/modernizr-tests.ts | 31 ++- types/modesl/index.d.ts | 1 - types/modesl/modesl-tests.ts | 2 - types/moment-business/index.d.ts | 18 +- .../moment-business/moment-business-tests.ts | 14 +- .../moment-timezone/moment-timezone-tests.ts | 21 +- types/node-waves/index.d.ts | 1 - types/node-waves/node-waves-tests.ts | 1 - types/openfin/index.d.ts | 59 +++-- types/openfin/openfin-tests.ts | 6 +- types/parse-unit/parse-unit-tests.ts | 8 +- types/parsimmon/index.d.ts | 118 ++++----- types/parsimmon/parsimmon-tests.ts | 54 ++--- types/qlik-visualizationextensions/index.d.ts | 41 ++-- .../qlik-visualizationextensions-tests.ts | 2 +- types/rc-slider/index.d.ts | 10 +- types/rc-slider/rc-slider-tests.tsx | 4 +- .../lib/components/common/EditableInput.d.ts | 1 - types/react-color/react-color-tests.tsx | 54 ++--- types/react-copy-to-clipboard/index.d.ts | 9 +- .../react-copy-to-clipboard-tests.tsx | 1 - types/react-day-picker/index.d.ts | 30 ++- .../react-day-picker-tests.tsx | 10 +- types/react-facebook-login/index.d.ts | 13 +- .../react-facebook-login-tests.tsx | 5 - types/react-joyride/react-joyride-tests.tsx | 1 - types/react-leaflet/index.d.ts | 54 ++--- types/react-leaflet/react-leaflet-tests.tsx | 2 +- types/tslint.json | 2 +- 82 files changed, 519 insertions(+), 890 deletions(-) create mode 100644 types/d3-dsv/tslint.json diff --git a/types/bloomfilter/bloomfilter-tests.ts b/types/bloomfilter/bloomfilter-tests.ts index f1f3306d62..650cc97eb4 100644 --- a/types/bloomfilter/bloomfilter-tests.ts +++ b/types/bloomfilter/bloomfilter-tests.ts @@ -1,11 +1,11 @@ -import { BloomFilter } from './index'; +import { BloomFilter } from 'bloomfilter'; function test_bloomfilter() { const m: number = 10; const k: number = 2; - let bloomFilter = new BloomFilter(m, k); - let array: Array = bloomFilter.buckets; - let length: number = bloomFilter.buckets.length; + const bloomFilter = new BloomFilter(m, k); + const array: Int32Array[] = bloomFilter.buckets; + const length: number = bloomFilter.buckets.length; bloomFilter.add('someString'); - let test: boolean = bloomFilter.test('someString'); + const test: boolean = bloomFilter.test('someString'); } diff --git a/types/bloomfilter/index.d.ts b/types/bloomfilter/index.d.ts index 071c32dfc6..00ed408c6d 100644 --- a/types/bloomfilter/index.d.ts +++ b/types/bloomfilter/index.d.ts @@ -3,8 +3,8 @@ // Definitions by: slawiko // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export declare class BloomFilter { - buckets: Array; +export class BloomFilter { + buckets: Int32Array[]; constructor(m: number, k: number); diff --git a/types/bunyan-blackhole/bunyan-blackhole-tests.ts b/types/bunyan-blackhole/bunyan-blackhole-tests.ts index ef2096a4c8..553d6f52ea 100644 --- a/types/bunyan-blackhole/bunyan-blackhole-tests.ts +++ b/types/bunyan-blackhole/bunyan-blackhole-tests.ts @@ -1,8 +1,6 @@ import blackhole = require("bunyan-blackhole"); - - -var logsLaboursLost = blackhole("lost"); +const logsLaboursLost = blackhole("lost"); const rotten = new Error("Something is rotten in the state of Denmark"); @@ -20,7 +18,5 @@ logsLaboursLost.info({play: "Much Ado About Nothing"}, "Let me be that I am and logsLaboursLost.warn({play: "All's Well That Ends Well"}, "Love all, trust a few, do wrong to none"); logsLaboursLost.error({play: "All's Well That Ends Well"}, "Love all, trust a few, do wrong to none"); -var hamlet = logsLaboursLost.child({play: "Hamlet"}); +const hamlet = logsLaboursLost.child({play: "Hamlet"}); hamlet.info({character: "Polonius"}, "Though this be madness, yet there is method in't"); - - diff --git a/types/chai-subset/chai-subset-tests.ts b/types/chai-subset/chai-subset-tests.ts index 33cf036cf8..717f86cb33 100644 --- a/types/chai-subset/chai-subset-tests.ts +++ b/types/chai-subset/chai-subset-tests.ts @@ -1,14 +1,11 @@ - - import chai = require('chai'); import chaiSubset = require('chai-subset'); chai.use(chaiSubset); -var expect = chai.expect; -var assert = chai.assert; +const { assert, expect } = chai; function test_containSubset() { - var obj = { + const obj = { a: 'b', c: 'd', e: { @@ -34,7 +31,7 @@ function test_containSubset() { } function test_notContainSubset() { - var obj = { + const obj = { a: 'b', c: 'd', e: { @@ -50,7 +47,7 @@ function test_notContainSubset() { } function test_arrayContainSubset() { - var list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ]; + const list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ]; expect(list).to.containSubset([{a: 'a', b: 'b'}]); list.should.containSubset([{a: 'a', b: 'b'}]); @@ -58,7 +55,7 @@ function test_arrayContainSubset() { } function test_arrayNotContainSubset() { - var list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ]; + const list = [{a: 'a', b: 'b'}, {v: 'f', d: {z: 'g'}} ]; expect(list).not.to.containSubset([{a: 'a', b: 'bd'}]); list.should.not.containSubset([{a: 'a', b: 'bd'}]); diff --git a/types/clipboard/clipboard-tests.ts b/types/clipboard/clipboard-tests.ts index 5af2671671..23de4c89e6 100644 --- a/types/clipboard/clipboard-tests.ts +++ b/types/clipboard/clipboard-tests.ts @@ -1,16 +1,16 @@ import * as Clipboard from 'clipboard'; -var cb1 = new Clipboard('.btn'); -var cb2 = new Clipboard(document.getElementById('id'), { +const cb1 = new Clipboard('.btn'); +const cb2 = new Clipboard(document.getElementById('id'), { action: elem => 'copy' }); -var cb3 = new Clipboard(document.querySelectorAll('query'), { +const cb3 = new Clipboard(document.querySelectorAll('query'), { text: elem => null }); -var cb4 = new Clipboard('.btn', { +const cb4 = new Clipboard('.btn', { target: elem => null }); -var cb5 = new Clipboard('.btn', { +const cb5 = new Clipboard('.btn', { action: elem => 'copy', target: elem => null }); @@ -25,4 +25,3 @@ cb2.on('success', e => { e.clearSelection(); }); cb2.on('error', e => { }); - diff --git a/types/clipboard/index.d.ts b/types/clipboard/index.d.ts index ec03d9bee5..5f12a41d5f 100644 --- a/types/clipboard/index.d.ts +++ b/types/clipboard/index.d.ts @@ -54,4 +54,4 @@ declare namespace Clipboard { export = Clipboard; -export as namespace Clipboard; \ No newline at end of file +export as namespace Clipboard; diff --git a/types/cordova-sqlite-storage/cordova-sqlite-storage-tests.ts b/types/cordova-sqlite-storage/cordova-sqlite-storage-tests.ts index bb5a768bf8..6d2e3c3454 100644 --- a/types/cordova-sqlite-storage/cordova-sqlite-storage-tests.ts +++ b/types/cordova-sqlite-storage/cordova-sqlite-storage-tests.ts @@ -1,33 +1,21 @@ // examples taken from https://github.com/litehelpers/Cordova-sqlite-storage function echoTestFunction() { - function successCallback(value: string) { - - } - function errorCallback() { - - } + function successCallback(value: string) {} + function errorCallback() {} window.sqlitePlugin.echoTest(successCallback, errorCallback); } function selfTestFunction() { - function successCallback() { - - } - function errorCallback() { - - } + function successCallback() {} + function errorCallback() {} window.sqlitePlugin.selfTest(successCallback, errorCallback); } function openingDatabase() { - function successcb(db: SQLitePlugin.Database) { + function successcb(db: SQLitePlugin.Database) {} + function errorcb(err: Error) {} - } - function errorcb(err: Error) { - - } - - var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}, successcb, errorcb); - var db = window.sqlitePlugin.openDatabase({name: 'my.db', iosDatabaseLocation: 'Library'}, successcb, errorcb); + let db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}, successcb, errorcb); + db = window.sqlitePlugin.openDatabase({name: 'my.db', iosDatabaseLocation: 'Library'}, successcb, errorcb); } function openingDatabase2() { @@ -104,7 +92,7 @@ function sampleWithPRAGMA() { // Cordova is ready function onDeviceReady() { - var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}); + const db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}); db.transaction(tx => { tx.executeSql('DROP TABLE IF EXISTS test_table'); @@ -134,14 +122,13 @@ function sampleWithPRAGMA() { } } - function sampleWithTransactionLevelNesting() { // Wait for Cordova to load document.addEventListener('deviceready', onDeviceReady, false); // Cordova is ready function onDeviceReady() { - var db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}); + const db = window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}); db.transaction(tx => { tx.executeSql('DROP TABLE IF EXISTS test_table'); @@ -155,7 +142,6 @@ function sampleWithTransactionLevelNesting() { console.log("res.rows.length: " + res.rows.length + " -- should be 1"); console.log("res.rows.item(0).cnt: " + res.rows.item(0).cnt + " -- should be 1"); }); - }, (tx, e) => { console.log("ERROR: " + e.message); }); @@ -163,18 +149,12 @@ function sampleWithTransactionLevelNesting() { } } - function dbClose(db: SQLitePlugin.Database) { - function successcb() { - - } - function errorcb(err: Error) { - - } + function successcb() {} + function errorcb(err: Error) {} db.close(successcb, errorcb); - db.transaction(tx => { tx.executeSql("SELECT LENGTH('tenletters') AS stringlength", [], (tx, res) => { console.log('got stringlength: ' + res.rows.item(0).stringlength); @@ -193,21 +173,16 @@ function dbClose(db: SQLitePlugin.Database) { } function deleteDatabase() { - function successcb() { - - } - function errorcb(err: Error) { - - } + function successcb() {} + function errorcb(err: Error) {} window.sqlitePlugin.deleteDatabase({name: 'my.db', location: 'default'}, successcb, errorcb); } - function quickInstallationTest() { window.sqlitePlugin.openDatabase({ name: 'hello-world.db', location: 'default' }, db => { db.executeSql("select length('tenletters') as stringlength", [], res => { - var stringlength = res.rows.item(0).stringlength; + const stringlength = res.rows.item(0).stringlength; console.log('got stringlength: ' + stringlength); // document.getElementById('deviceready').querySelector('.received').innerHTML = 'stringlength: ' + stringlength; }); diff --git a/types/cordova-sqlite-storage/index.d.ts b/types/cordova-sqlite-storage/index.d.ts index 76e3aac5a3..2f78c908ff 100644 --- a/types/cordova-sqlite-storage/index.d.ts +++ b/types/cordova-sqlite-storage/index.d.ts @@ -65,4 +65,3 @@ declare namespace SQLitePlugin { echoTest(ok?: (value: string) => void, error?: (msg: string) => void): void; } } - diff --git a/types/csv-parse/csv-parse-tests.ts b/types/csv-parse/csv-parse-tests.ts index b0f13121fe..26b2458360 100644 --- a/types/csv-parse/csv-parse-tests.ts +++ b/types/csv-parse/csv-parse-tests.ts @@ -1,20 +1,21 @@ import parse = require('csv-parse'); function callbackAPITest() { - var input = '#Welcome\n"1","2","3","4"\n"a","b","c","d"'; + const input = '#Welcome\n"1","2","3","4"\n"a","b","c","d"'; parse(input, {comment: '#'}, (err, output) => { output.should.eql([ [ '1', '2', '3', '4' ], [ 'a', 'b', 'c', 'd' ] ]); }); } function streamAPITest() { - let output: string[][] = []; + const output: string[][] = []; // Create the parser - var parser = parse({delimiter: ':'}); - let record: string[]; + const parser = parse({delimiter: ':'}); // Use the writable stream api parser.on('readable', () => { - while (record = parser.read()) { + while (true) { + const record = parser.read(); + if (!record) break; output.push(record); } }); @@ -35,12 +36,12 @@ function streamAPITest() { import fs = require('fs'); function pipeFunctionTest() { - var transform = require('stream-transform'); + const transform = require('stream-transform'); - var output: any = []; - var parser = parse({delimiter: ':'}) - var input = fs.createReadStream('/etc/passwd'); - var transformer = transform((record: any[], callback: any) => { + const output: any = []; + const parser = parse({delimiter: ':'}); + const input = fs.createReadStream('/etc/passwd'); + const transformer = transform((record: any[], callback: any) => { setTimeout(() => { callback(null, record.join(' ') + '\n'); }, 500); @@ -51,8 +52,7 @@ function pipeFunctionTest() { import parseSync = require('csv-parse/lib/sync'); function syncApiTest() { - var input = '"key_1","key_2"\n"value 1","value 2"'; - var records = parseSync(input, {columns: true}); + const input = '"key_1","key_2"\n"value 1","value 2"'; + const records = parseSync(input, {columns: true}); records.should.eql([{ key_1: 'value 1', key_2: 'value 2' }]); } - diff --git a/types/csv-parse/index.d.ts b/types/csv-parse/index.d.ts index e780bac27d..cbf79729e5 100644 --- a/types/csv-parse/index.d.ts +++ b/types/csv-parse/index.d.ts @@ -33,16 +33,16 @@ declare namespace parse { * special constants are 'auto', 'unix', 'mac', 'windows', 'unicode'; * defaults to 'auto' (discovered in source or 'unix' if no source is specified). */ - rowDelimiter?: string; + rowDelimiter?: string; /** * Optional character surrounding a field, one character only, defaults to double quotes. */ - quote?: string + quote?: string; /** * Set the escape character, one character only, defaults to double quotes. */ - escape?: string + escape?: string; /** * List of fields as an array, @@ -55,62 +55,62 @@ declare namespace parse { /** * Treat all the characters after this one as a comment, default to '' (disabled). */ - comment?: string + comment?: string; /** * Name of header-record title to name objects by. */ - objname?: string + objname?: string; /** * Preserve quotes inside unquoted field. */ - relax?: boolean + relax?: boolean; /** * Discard inconsistent columns count, default to false. */ - relax_column_count?: boolean + relax_column_count?: boolean; /** * Dont generate empty values for empty lines. */ - skip_empty_lines?: boolean + skip_empty_lines?: boolean; /** * Maximum numer of characters to be contained in the field and line buffers before an exception is raised, * used to guard against a wrong delimiter or rowDelimiter, * default to 128000 characters. */ - max_limit_on_data_read?: number + max_limit_on_data_read?: number; /** * If true, ignore whitespace immediately around the delimiter, defaults to false. * Does not remove whitespace in a quoted field. */ - trim?: boolean + trim?: boolean; /** * If true, ignore whitespace immediately following the delimiter (i.e. left-trim all fields), defaults to false. * Does not remove whitespace in a quoted field. */ - ltrim?: boolean + ltrim?: boolean; /** * If true, ignore whitespace immediately preceding the delimiter (i.e. right-trim all fields), defaults to false. * Does not remove whitespace in a quoted field. */ - rtrim?: boolean + rtrim?: boolean; /** * If true, the parser will attempt to convert read data types to native types. */ - auto_parse?: boolean + auto_parse?: boolean; /** * If true, the parser will attempt to convert read data types to dates. It requires the "auto_parse" option. */ - auto_parse_date?: boolean + auto_parse_date?: boolean; } // TODO: what is this for? diff --git a/types/csv-parse/tslint.json b/types/csv-parse/tslint.json index 2221e40e4a..105f5736e6 100644 --- a/types/csv-parse/tslint.json +++ b/types/csv-parse/tslint.json @@ -1 +1,6 @@ -{ "extends": "../tslint.json" } \ No newline at end of file +{ + "extends": "../tslint.json", + "rules": { + "no-empty-interface": false + } +} diff --git a/types/d3-dsv/d3-dsv-tests.ts b/types/d3-dsv/d3-dsv-tests.ts index a4d958f01b..421add6e65 100644 --- a/types/d3-dsv/d3-dsv-tests.ts +++ b/types/d3-dsv/d3-dsv-tests.ts @@ -12,7 +12,6 @@ import * as d3Dsv from 'd3-dsv'; // Preperatory Steps // ------------------------------------------------------------------------------------------ - const csvTestString: string = '1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38'; const tsvTestString: string = '1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38'; const pipedTestString: string = '1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38'; @@ -34,7 +33,6 @@ let parseMappedArray: d3Dsv.DSVParsedArray; let parseRowsArray: string[][]; let parseRowsMappedArray: ParsedTestObject[]; - let columns: string[]; let num: number; let date: Date; @@ -77,14 +75,12 @@ str = parseMappedArray[0].make; str = parseMappedArray[0].model; num = parseMappedArray[0].length; - // csvParseRows(...) ============================================================================ // without row mapper ----------------------------------------------------------------------- parseRowsArray = d3Dsv.csvParseRows(csvTestString); - str = parseRowsArray[0][0]; // 'Year' of first row // date = parseRowsArray[0][0]; // fails, return value is string @@ -158,14 +154,12 @@ str = parseMappedArray[0].make; str = parseMappedArray[0].model; num = parseMappedArray[0].length; - // tsvParseRows(...) ============================================================================ // without row mapper ----------------------------------------------------------------------- parseRowsArray = d3Dsv.tsvParseRows(tsvTestString); - str = parseRowsArray[0][0]; // 'Year' of first row // date = parseRowsArray[0][0]; // fails, return value is string @@ -244,14 +238,12 @@ str = parseMappedArray[0].make; str = parseMappedArray[0].model; num = parseMappedArray[0].length; - // parseRows(...) ============================================================================ // without row mapper ----------------------------------------------------------------------- parseRowsArray = dsv.parseRows(pipedTestString); - str = parseRowsArray[0][0]; // 'Year' of first row // date = parseRowsArray[0][0]; // fails, return value is string diff --git a/types/d3-dsv/tslint.json b/types/d3-dsv/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/types/d3-dsv/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file diff --git a/types/d3-dsv/v0/d3-dsv-tests.ts b/types/d3-dsv/v0/d3-dsv-tests.ts index 587d4d5a55..ac3e76a689 100644 --- a/types/d3-dsv/v0/d3-dsv-tests.ts +++ b/types/d3-dsv/v0/d3-dsv-tests.ts @@ -1,8 +1,5 @@ - - import d3dsv = require("d3-dsv"); -var csv = d3dsv(","); - -var rows = csv.parse("a,b,c\n1,2,3\n4,5,6"); +const csv = d3dsv(","); +const rows = csv.parse("a,b,c\n1,2,3\n4,5,6"); diff --git a/types/d3-selection/d3-selection-tests.ts b/types/d3-selection/d3-selection-tests.ts index 43d8708938..0b2dec77c2 100644 --- a/types/d3-selection/d3-selection-tests.ts +++ b/types/d3-selection/d3-selection-tests.ts @@ -1,4 +1,3 @@ - /** * Typescript definition tests for d3/d3-selection module * @@ -9,7 +8,6 @@ import * as d3Selection from 'd3-selection'; - // --------------------------------------------------------------------------------------- // Some preparatory work for definition testing below // --------------------------------------------------------------------------------------- @@ -56,7 +54,6 @@ interface CircleDatumAlternative { // Tests of Top-Level Selection Functions // --------------------------------------------------------------------------------------- - // test top-level .selection() ----------------------------------------------------------- const topSelection: d3Selection.Selection = d3Selection.selection(); @@ -101,16 +98,13 @@ maybeSVG2 = d3Selection.select(maybeSVG1.node()); // fails, as node type mismatches selection type // let body7: d3Selection.Selection = d3Selection.select(maybeSVG1.node()); - // test "special case DOM objects" d3Selection.select(xDoc); d3Selection.select(xWindow); - // test top-level selectAll() ------------------------------------------------------------- - // Using selectAll(), selectAll(null) or selectAll(undefined) creates an empty selection let emptyRootSelection: d3Selection.Selection = d3Selection.selectAll(); @@ -137,7 +131,6 @@ const baseTypeElements2: d3Selection.Selection = d3Selection.selectAll(divElements.nodes()); - // Using selectAll(...) with node array argument and type parameters creates selection // with Group element of type HTMLDivElement and datum of DivDatum type. The parent element is of type 'null' with datum of type 'undefined' @@ -145,10 +138,8 @@ const divElements4: d3Selection.Selection(baseTypeElements.nodes()); // fails as baseTypeEl.node() is not of type HTMLBodyElement - // selectAll(...) accepts NodeListOf<...> argument - const xSVGCircleElementList: NodeListOf = document.querySelectorAll('circle'); const circleSelection: d3Selection.Selection = d3Selection.selectAll(xSVGCircleElementList); @@ -156,14 +147,10 @@ const circleSelection: d3Selection.Selection = d3Selection.selectAll(document.links); - - // --------------------------------------------------------------------------------------- // Tests of Sub-Selection Functions // --------------------------------------------------------------------------------------- - - // select(...) sub-selection -------------------------------------------------------------- // Expected: datum propagates down from selected element to sub-selected descendant element @@ -211,12 +198,10 @@ firstG = svgEl.select(function(d, i, g) { return this.querySelector('g')!; // this of type SVGSVGElement by type inference }); - // firstG = svgEl.select(function() { // return this.querySelector('a'); // fails, return type HTMLAnchorElement is not compatible with SVGGElement expected by firstG // }); - // selectAll(...) sub-selection -------------------------------------------------------------- // Expected: datum from selected element(s) does not propagate down to sub-selected descendant elements. @@ -234,14 +219,12 @@ let elementsUnknownData: d3Selection.Selection = svgEl.selectAll('g'); // gElementsOldData = svgEl.selectAll('g'); // fails default type parameters of selectAll for group element type and datum type do not match - // Using selectAll(...) sub-selection with a selector function argument. function svgGroupSelectorAll(this: SVGSVGElement, d: SVGDatum, i: number, groups: SVGSVGElement[]): NodeListOf { return this.querySelectorAll('g'); // this-type compatible with group element-type to which the selector function will be appplied } - gElementsOldData = svgEl.selectAll(svgGroupSelectorAll); function wrongSvgGroupSelectorAll(this: HTMLElement, d: SVGDatum, i: number, groups: HTMLElement[]): NodeListOf { @@ -305,7 +288,6 @@ maybeG.selectAll(function(d, i, g) { // selector(...) and selectorAll(...) ---------------------------------------------------- - // d3Selection.select(d3Selection.selector('g')); // fails, selector as argument to top-level select not supported // supported on sub-selection @@ -352,12 +334,10 @@ filterdGElements2 = d3Selection.selectAll('.any-svg-type').filt // return that.tagName === 'g'|| that.tagName === 'G'; // }); // fails without using narrowing generic on filter method - // matcher() ----------------------------------------------------------------------------- filterdGElements = gElementsOldData.filter(d3Selection.matcher('.top-level')); - // --------------------------------------------------------------------------------------- // Tests of Modification // --------------------------------------------------------------------------------------- @@ -377,7 +357,6 @@ str = body.html(); // Setters tests ------------------------------------------------------------------------- - let circles: d3Selection.Selection; let divs: d3Selection.Selection; @@ -425,7 +404,6 @@ divs = divs return d.padding === '0px'; // boolean return value }); - // style(...) Tests divs = divs @@ -451,7 +429,6 @@ divs = divs // .style('color', function() { return 'green'; }, 'test') // fails, test: invalid priority value .style('color', () => 'green', 'important'); // boolean return + test: priority = 'important'; - // property(...) Tests circles = circles @@ -514,7 +491,6 @@ body = body // Tests of Datum and Data Join // --------------------------------------------------------------------------------------- - const data: CircleDatum[] = [ { nodeId: 'c1', cx: 10, cy: 10, r: 5, name: 'foo', label: 'Foo' }, { nodeId: 'c2', cx: 20, cy: 20, r: 5, name: 'bar', label: 'Bar' }, @@ -527,7 +503,6 @@ const data2: CircleDatumAlternative[] = [ { nodeId: 'c4', cx: 10, cy: 15, r: 10, name: 'newbie', label: 'Newbie', color: 'red' } ]; - // Tests of Datum ----------------------------------------------------------------------- // TEST GETTER @@ -564,7 +539,6 @@ newBodyDatum = body.datum(function(d, i, g) { // return { newFoo: 'new foo' }; // }).datum(); // inferred type - // SCENARIO 1: Fully type-parameterized // object-based @@ -616,10 +590,8 @@ d3Selection.select('#svg-1') // irrelevant typing to get contextual typing in la return d.length > 0 && d[0].color === 'green'; }); - // Tests of Data Join -------------------------------------------------------------------- - const dimensions: SVGDatum = { width: 500, height: 300 @@ -741,7 +713,6 @@ circles2 = enterCircles.merge(circles2); // merge enter and update selections // FURTHER DATA-JOIN TESTs (function argument, changes in data type between old and new data) - const matrix = [ [11975, 5871, 8916, 2868], [1951, 10048, 2060, 6171], @@ -876,7 +847,6 @@ newParagraph2 = body.insert(typeValueFunction, 'p.second-paragraph'); newParagraph2 = body.insert(typeValueFunction, beforeValueFunction); newParagraph2 = body.insert(typeValueFunction); - // sort(...) ----------------------------------------------------------------------------- // NB: Return new selection of same type @@ -932,12 +902,10 @@ circles = circles.each(function(d, i, g) { // check chaining return type by re- // call() ------------------------------------------------------------------------------- function enforceMinRadius(selection: d3Selection.Selection, minRadius: number): void { - selection.attr('r', function(d) { const r: number = +d3Selection.select(this).attr('r'); return Math.max(r, minRadius); }); - } // returns 'this' selection @@ -959,7 +927,6 @@ circles = circles.call(enforceMinRadius, 40); // check chaining return type by r let listener: undefined | ((this: HTMLBodyElement, datum: BodyDatum, index: number, group: HTMLBodyElement[] | ArrayLike) => void); - body = body.on('click', function(d, i, g) { const that: HTMLBodyElement = this; // const that2: SVGElement = this; // fails, type mismatch @@ -981,7 +948,6 @@ if (listener) { // remove listener body = body.on('click', null); // check chaining return type by re-assigning - // dispatch(...) ------------------------------------------------------------------------- const fooEventParam: d3Selection.CustomEventParameters = { @@ -1009,7 +975,6 @@ body = body.dispatch('fooEvent', function(d, i, g) { // re-assign for chaining t return eParam; }); - // event and customEvent() ---------------------------------------------------------------- // TODO: Tests of event are related to issue #3 (https://github.com/tomwanzek/d3-v4-definitelytyped/issues/3) diff --git a/types/d3-selection/index.d.ts b/types/d3-selection/index.d.ts index 49cd141dfa..b007573b1f 100644 --- a/types/d3-selection/index.d.ts +++ b/types/d3-selection/index.d.ts @@ -44,7 +44,6 @@ export interface EnterElement { */ export type ContainerElement = HTMLElement | SVGSVGElement | SVGGElement; - /** * Interface for optional parameters map, when dispatching custom events * on a selection @@ -69,7 +68,6 @@ export interface CustomEventParameters { */ export type ValueFn = (this: T, datum: Datum, index: number, groups: T[] | ArrayLike) => Result; - /** * TransitionLike is a helper interface to represent a quasi-Transition, without specifying the full Transition interface in this file. * For example, whereever d3-zoom allows a Transition to be passed in as an argument, it internally immediately invokes its `selection()` @@ -88,8 +86,6 @@ export interface TransitionLike { tween(name: string, tweenFn: ValueFn void)>): TransitionLike; } - - // -------------------------------------------------------------------------- // All Selection related interfaces and function // -------------------------------------------------------------------------- @@ -155,7 +151,6 @@ export function selectAll(nodes: GElement[] */ export function selectAll(nodes: ArrayLike): Selection; - /** * A D3 Selection of elements. * @@ -165,7 +160,6 @@ export function selectAll(nodes: ArrayLike< * The fourth generic "PDatum" refers to the type of the datum of the parent element(s). */ interface Selection { - // Sub-selection ------------------------- /** @@ -625,7 +619,6 @@ interface Selection Selection; * Selects the root element, document.documentElement. This function can also be used to test for selections * (instanceof d3.selection) or to extend the selection prototype. */ -export var selection: SelectionFn; - +export const selection: SelectionFn; // --------------------------------------------------------------------------- // on.js event and customEvent related @@ -899,7 +889,7 @@ interface BaseEvent { * rather than from the generated UMD bundle; not all bundlers observe jsnext:main. * Also beware of conflicts with the window.event global. */ -export var event: any; // Could be of all sorts of types, too general: BaseEvent | Event | MouseEvent | TouchEvent | ... | OwnCustomEventType; +export const event: any; // Could be of all sorts of types, too general: BaseEvent | Event | MouseEvent | TouchEvent | ... | OwnCustomEventType; /** * Invokes the specified listener, using the specified "that" as "this" context and passing the specified arguments, if any. @@ -984,7 +974,6 @@ export function touches(container: ContainerElement, touches?: TouchList): Array // local.js related // --------------------------------------------------------------------------- - export interface Local { /** * Retrieves a local variable stored on the node (or one of its parents). @@ -1050,7 +1039,6 @@ export interface NamespaceLocalObject { */ export function namespace(prefixedLocal: string): NamespaceLocalObject | string; - // --------------------------------------------------------------------------- // namespaces.js related // --------------------------------------------------------------------------- @@ -1063,8 +1051,7 @@ export interface NamespaceMap { [prefix: string]: string; } /** * Map of namespace prefixes to corresponding fully qualified namespace strings */ -export var namespaces: NamespaceMap; - +export const namespaces: NamespaceMap; // --------------------------------------------------------------------------- // window.js related @@ -1078,13 +1065,11 @@ export var namespaces: NamespaceMap; */ export function window(DOMNode: Window | Document | Element): Window; - // --------------------------------------------------------------------------- // creator.js and matcher.js Complex helper closure generating functions // for explicit bound-context dependent use // --------------------------------------------------------------------------- - /** * Given the specified element name, returns a function which creates an element of the given name, * assuming that "this" is the parent element. diff --git a/types/dagre-d3/dagre-d3-tests.ts b/types/dagre-d3/dagre-d3-tests.ts index 2b1a958ef7..16bfb29b0c 100644 --- a/types/dagre-d3/dagre-d3-tests.ts +++ b/types/dagre-d3/dagre-d3-tests.ts @@ -1,4 +1,3 @@ - namespace DagreD3Tests { const gDagre = new dagreD3.graphlib.Graph(); const graph = gDagre.graph(); diff --git a/types/deep-equal/deep-equal-tests.ts b/types/deep-equal/deep-equal-tests.ts index ed23a35838..d889f5929d 100644 --- a/types/deep-equal/deep-equal-tests.ts +++ b/types/deep-equal/deep-equal-tests.ts @@ -1,4 +1,3 @@ - import deepEqual = require("deep-equal"); const isDeepEqual1: boolean = deepEqual({}, {}); diff --git a/types/dot/dot-tests.ts b/types/dot/dot-tests.ts index 0987f9eb46..507f63e81d 100644 --- a/types/dot/dot-tests.ts +++ b/types/dot/dot-tests.ts @@ -1,32 +1,30 @@ +const headertmpl = "

{{=it.title}}

"; - -var headertmpl = "

{{=it.title}}

"; - -var pagetmpl = "

Here is the page using a header template< / h2 >\n" +const pagetmpl = "

Here is the page using a header template< / h2 >\n" + "{{#def.header}}\n" + "{{=it.name}}"; -var customizableheadertmpl = "{{#def.header}}" +const customizableheadertmpl = "{{#def.header}}" + "\n{{#def.mycustominjectionintoheader || ''} }"; -var pagetmplwithcustomizableheader = "

Here is the page with customized header template

\n" +const pagetmplwithcustomizableheader = "

Here is the page with customized header template

\n" + "{{##def.mycustominjectionintoheader:\n" + "
{{=it.title}} is not {{=it.name}}
\n" + "#}}\n" + "{{#def.customheader}}\n" + "{{=it.name}}"; -var def = { +const def = { header: headertmpl, customheader: customizableheadertmpl }; -var data = { +const data = { title: "My title", name: "My name" }; -var pagefn = doT.template(pagetmpl, undefined, def); -var content = pagefn(data); +let pagefn = doT.template(pagetmpl, undefined, def); +const content = pagefn(data); pagefn = doT.template(pagetmplwithcustomizableheader, undefined, def); -var contentcustom = pagefn(data); +const contentcustom = pagefn(data); diff --git a/types/falcor/index.d.ts b/types/falcor/index.d.ts index 1bf3c9ba23..44d9118ca2 100644 --- a/types/falcor/index.d.ts +++ b/types/falcor/index.d.ts @@ -41,26 +41,22 @@ export { * DataSources may retrieve JSON Graph information from anywhere, including device memory, a remote machine, or even a lazily-run computation. **/ export abstract class DataSource { - /** * The get method retrieves values from the DataSource's associated JSONGraph object. **/ get(pathSets: PathSet[]): Observable; - /** * The set method accepts values to set in the DataSource's associated JSONGraph object. **/ set(jsonGraphEnvelope: JSONGraphEnvelope): Observable; - /** * Invokes a function in the DataSource's JSONGraph object. **/ call(functionPath: Path, args?: any[], refSuffixes?: PathSet[], thisPaths?: PathSet[]): Observable; } - ///////////////////////////////////////////////////// // Model ///////////////////////////////////////////////////// @@ -215,7 +211,6 @@ export class Model { getPath(): Path; } - ///////////////////////////////////////////////////// // ModelResponse ///////////////////////////////////////////////////// @@ -232,13 +227,11 @@ interface Thenable { then(onFulfilled?: (value: T) => U | Thenable, onRejected?: (error: any) => U | Thenable | void): Thenable; } - ///////////////////////////////////////////////////// // Observable ///////////////////////////////////////////////////// export class Observable{ - /** * The forEach method is a synonym for {@link Observable.prototype.subscribe} and triggers the execution of the Observable, causing the values within to be pushed to a callback. * An Observable is like a pipe of water that is closed. diff --git a/types/falcor/test/browser.ts b/types/falcor/test/browser.ts index 073d777679..d2390f107d 100644 --- a/types/falcor/test/browser.ts +++ b/types/falcor/test/browser.ts @@ -1,6 +1,4 @@ - - -var model = new falcor.Model({source: new falcor.HttpDataSource('/model.json')}); +const model = new falcor.Model({source: new falcor.HttpDataSource('/model.json')}); model.get('greeting').then(response => { document.write(response.json.greeting); @@ -15,4 +13,3 @@ model.set({ }); model.set(falcor.pathValue('greeting', 'Hello, world')); - diff --git a/types/falcor/test/index.ts b/types/falcor/test/index.ts index 2798b72645..8eea62b2f2 100644 --- a/types/falcor/test/index.ts +++ b/types/falcor/test/index.ts @@ -127,4 +127,3 @@ subscription.dispose(); modelResponse.then(res => res.json.items.length); modelResponse.then(res => res, error => console.error.bind(error)); modelResponse.then(res => res.json.items.length).then((l: number) => l + 1); - diff --git a/types/fetch-jsonp/fetch-jsonp-tests.ts b/types/fetch-jsonp/fetch-jsonp-tests.ts index 058f47e70c..6a0d58f513 100644 --- a/types/fetch-jsonp/fetch-jsonp-tests.ts +++ b/types/fetch-jsonp/fetch-jsonp-tests.ts @@ -4,45 +4,45 @@ import * as fetchJsonp from 'fetch-jsonp'; fetchJsonp('/users.jsonp') .then(function(response) { - return response.json() + return response.json(); }).then(function(json) { - console.log('parsed json', json) + console.log('parsed json', json); }).catch(function(ex) { - console.log('parsing failed', ex) - }) + console.log('parsing failed', ex); + }); fetchJsonp('/users.jsonp', { jsonpCallback: 'custom_callback' }) .then(function(response) { - return response.json() + return response.json(); }).then(function(json) { - console.log('parsed json', json) + console.log('parsed json', json); }).catch(function(ex) { - console.log('parsing failed', ex) - }) + console.log('parsing failed', ex); + }); fetchJsonp('/users.jsonp', { timeout: 3000, jsonpCallback: 'custom_callback' }) .then(function(response) { - return response.json() + return response.json(); }).then(function(json) { - console.log('parsed json', json) + console.log('parsed json', json); }).catch(function(ex) { - console.log('parsing failed', ex) - }) + console.log('parsing failed', ex); + }); // Taken from https://github.com/camsong/fetch-jsonp/blob/v1.0.2/examples/index.html -var result = fetchJsonp('http://www.flickr.com/services/feeds/photos_public.gne?format=json', { +const result = fetchJsonp('http://www.flickr.com/services/feeds/photos_public.gne?format=json', { jsonpCallback: 'jsoncallback', timeout: 3000 -}) +}); result.then(function(response) { - return response.json() + return response.json(); }).then(function(json) { document.body.innerHTML = JSON.stringify(json); })['catch'](function(ex) { document.body.innerHTML = 'failed:' + ex; -}) +}); diff --git a/types/firmata/firmata-tests.ts b/types/firmata/firmata-tests.ts index 5e1eab09cb..d50160e2dd 100644 --- a/types/firmata/firmata-tests.ts +++ b/types/firmata/firmata-tests.ts @@ -1,42 +1,33 @@ -import * as Board from 'firmata' +import * as Board from 'firmata'; -function test_basic_board() -{ - let board = new Board(''); +function test_basic_board() { + const board = new Board(''); } -function test_board_with_callback() -{ - let board = new Board('', (error: any) => - { +function test_board_with_callback() { + const board = new Board('', (error: any) => { board.pinMode(13, board.MODES.OUTPUT); board.pinMode(12, Board.PIN_MODE.OUTPUT); }); } -function test_board_with_listener() -{ - let board = new Board(''); +function test_board_with_listener() { + const board = new Board(''); - board.on('ready', () => - { + board.on('ready', () => { board.pinMode(13, board.MODES.OUTPUT); board.pinMode(12, Board.PIN_MODE.OUTPUT); }); } -function test_class_extension() -{ - class MyBoard extends Board - { - Disconnect() - { +function test_class_extension() { + class MyBoard extends Board { + Disconnect() { this.transport.close((error: any) => {}); } } - let myBoard: MyBoard = new MyBoard('', () => - { + const myBoard: MyBoard = new MyBoard('', () => { myBoard.Disconnect(); }); -} \ No newline at end of file +} diff --git a/types/firmata/index.d.ts b/types/firmata/index.d.ts index 4bda44d3f9..a24fae435b 100644 --- a/types/firmata/index.d.ts +++ b/types/firmata/index.d.ts @@ -5,7 +5,7 @@ /// -import * as SerialPort from 'serialport' +import * as SerialPort from 'serialport'; export = Board; @@ -15,8 +15,7 @@ export = Board; * This is a starting point that appeared to work fine for months within a project of my company, but I give no * guarantee that it cannot be improved. */ -declare class Board extends NodeJS.EventEmitter -{ +declare class Board extends NodeJS.EventEmitter { constructor(serialPort: string, callback?: (error: any) => void) MODES: Board.PinModes; STEPPER: Board.StepperConstants; @@ -84,7 +83,11 @@ declare class Board extends NodeJS.EventEmitter // TODO untested --- TWW sendOneWireDelay(pin: number, delay: number): void // TODO untested --- TWW - sendOneWireWriteAndRead(pin: number, device: number, data: number|number[], numBytesToRead: number, + sendOneWireWriteAndRead( + pin: number, + device: number, + data: number|number[], + numBytesToRead: number, callback: (error?: Error, data?: number) => void): void setSamplingInterval(interval: number): void getSamplingInterval(): number @@ -92,124 +95,165 @@ declare class Board extends NodeJS.EventEmitter reportDigitalPin(pin: number, value: Board.REPORTING): void // TODO untested/incomplete --- TWW pingRead(opts: any, callback: () => void): void - stepperConfig(deviceNum: number, type: number, stepsPerRev: number, dirOrMotor1Pin: number, - stepOrMotor2Pin: number, motor3Pin?: number, motor4Pin?: number): void - stepperStep(deviceNum: number, direction: Board.STEPPER_DIRECTION, steps: number, speed: number, - accel: number|((bool?: boolean) => void), decel?: number, callback?: (bool?: boolean) => void): void + stepperConfig( + deviceNum: number, + type: number, + stepsPerRev: number, + dirOrMotor1Pin: number, + stepOrMotor2Pin: number, + motor3Pin?: number, + motor4Pin?: number): void + stepperStep( + deviceNum: number, + direction: Board.STEPPER_DIRECTION, + steps: number, + speed: number, + accel: number|((bool?: boolean) => void), + decel?: number, + callback?: (bool?: boolean) => void): void; // TODO untested --- TWW - serialConfig(options: { portId: Board.SERIAL_PORT_ID, baud: number, rxPin?: number, txPin?: number }): void + serialConfig(options: { portId: Board.SERIAL_PORT_ID, baud: number, rxPin?: number, txPin?: number }): void; // TODO untested --- TWW - serialWrite(portId: Board.SERIAL_PORT_ID, inBytes: number[]): void + serialWrite(portId: Board.SERIAL_PORT_ID, inBytes: number[]): void; // TODO untested --- TWW - serialRead(portId: Board.SERIAL_PORT_ID, maxBytesToRead: number, callback: () => void): void + serialRead(portId: Board.SERIAL_PORT_ID, maxBytesToRead: number, callback: () => void): void; // TODO untested --- TWW - serialStop(portId: Board.SERIAL_PORT_ID): void + serialStop(portId: Board.SERIAL_PORT_ID): void; // TODO untested --- TWW - serialClose(portId: Board.SERIAL_PORT_ID): void + serialClose(portId: Board.SERIAL_PORT_ID): void; // TODO untested --- TWW - serialFlush(portId: Board.SERIAL_PORT_ID): void + serialFlush(portId: Board.SERIAL_PORT_ID): void; // TODO untested --- TWW - serialListen(portId: Board.SERIAL_PORT_ID): void + serialListen(portId: Board.SERIAL_PORT_ID): void; // TODO untested --- TWW - sysexResponse(commandByte: number, handler: (data: number[]) => void): void + sysexResponse(commandByte: number, handler: (data: number[]) => void): void; // TODO untested --- TWW - sysexCommand(message: number[]): void - reset(): void - static isAcceptablePort(port: Board.Port): boolean - static requestPort(callback: (error: any, port: Board.Port) => any): void + sysexCommand(message: number[]): void; + reset(): void; + static isAcceptablePort(port: Board.Port): boolean; + static requestPort(callback: (error: any, port: Board.Port) => any): void; // TODO untested --- TWW - static encode(data: number[]): number[] + static encode(data: number[]): number[]; // TODO untested --- TWW - static decode(data: number[]): number[] + static decode(data: number[]): number[]; // TODO untested/incomplete --- TWW - protected _sendOneWireSearch(type: any, event: any, pin: number, callback: () => void): void + protected _sendOneWireSearch(type: any, event: any, pin: number, callback: () => void): void; // TODO untested/incomplete --- TWW - protected _sendOneWireRequest(pin: number, subcommand: any, device: any, numBytesToRead: any, correlationId: any, - delay: number, dataToWrite: any, event: any, callback: () => void): void + protected _sendOneWireRequest( + pin: number, + subcommand: any, + device: any, + numBytesToRead: any, + correlationId: any, + delay: number, + dataToWrite: any, + event: any, callback: () => void): void; } -declare namespace Board -{ - export interface PinModes - { - INPUT: PIN_MODE, OUTPUT: PIN_MODE, ANALOG: PIN_MODE, PWM: PIN_MODE, SERVO: PIN_MODE, SHIFT: PIN_MODE, - I2C: PIN_MODE, ONEWIRE: PIN_MODE, STEPPER: PIN_MODE, SERIAL: PIN_MODE, PULLUP: PIN_MODE, IGNORE: PIN_MODE, - PING_READ: PIN_MODE, UNKOWN: PIN_MODE +declare namespace Board { + interface PinModes { + INPUT: PIN_MODE; + OUTPUT: PIN_MODE; + ANALOG: PIN_MODE; + PWM: PIN_MODE; + SERVO: PIN_MODE; + SHIFT: PIN_MODE; + I2C: PIN_MODE; + ONEWIRE: PIN_MODE; + STEPPER: PIN_MODE; + SERIAL: PIN_MODE; + PULLUP: PIN_MODE; + IGNORE: PIN_MODE; + PING_READ: PIN_MODE; + UNKOWN: PIN_MODE; } - export interface StepperConstants - { - TYPE: { DRIVER: STEPPER_TYPE, TWO_WIRE: STEPPER_TYPE, FOUR_WIRE: STEPPER_TYPE }, + interface StepperConstants { + TYPE: { + DRIVER: STEPPER_TYPE, + TWO_WIRE: STEPPER_TYPE, + FOUR_WIRE: STEPPER_TYPE, + }; RUNSTATE: { - STOP: STEPPER_RUN_STATE, ACCEL: STEPPER_RUN_STATE, DECEL: STEPPER_RUN_STATE, RUN: STEPPER_RUN_STATE - }, - DIRECTION: { CCW: STEPPER_DIRECTION, CW: STEPPER_DIRECTION } + STOP: STEPPER_RUN_STATE, + ACCEL: STEPPER_RUN_STATE, + DECEL: STEPPER_RUN_STATE, + RUN: STEPPER_RUN_STATE, + }; + DIRECTION: { CCW: STEPPER_DIRECTION, CW: STEPPER_DIRECTION }; } // tslint:disable-next-line interface-name - export interface I2cModes - { - WRITE: I2C_MODE, READ: I2C_MODE, CONTINUOUS_READ: I2C_MODE, STOP_READING: I2C_MODE + interface I2cModes { + WRITE: I2C_MODE; + READ: I2C_MODE; + CONTINUOUS_READ: I2C_MODE; + STOP_READING: I2C_MODE; } - export interface SerialModes - { - CONTINUOUS_READ: SERIAL_MODE, STOP_READING: SERIAL_MODE + interface SerialModes { + CONTINUOUS_READ: SERIAL_MODE; + STOP_READING: SERIAL_MODE; } - export interface SerialPortIds - { - HW_SERIAL0: SERIAL_PORT_ID, HW_SERIAL1: SERIAL_PORT_ID, HW_SERIAL2: SERIAL_PORT_ID, - HW_SERIAL3: SERIAL_PORT_ID, SW_SERIAL0: SERIAL_PORT_ID, SW_SERIAL1: SERIAL_PORT_ID, - SW_SERIAL2: SERIAL_PORT_ID, SW_SERIAL3: SERIAL_PORT_ID, DEFAULT: SERIAL_PORT_ID, + interface SerialPortIds { + HW_SERIAL0: SERIAL_PORT_ID; + HW_SERIAL1: SERIAL_PORT_ID; + HW_SERIAL2: SERIAL_PORT_ID; + HW_SERIAL3: SERIAL_PORT_ID; + SW_SERIAL0: SERIAL_PORT_ID; + SW_SERIAL1: SERIAL_PORT_ID; + SW_SERIAL2: SERIAL_PORT_ID; + SW_SERIAL3: SERIAL_PORT_ID; + DEFAULT: SERIAL_PORT_ID; } - export interface SerialPinTypes - { - RES_RX0: SERIAL_PIN_TYPE, RES_TX0: SERIAL_PIN_TYPE, RES_RX1: SERIAL_PIN_TYPE, RES_TX1: SERIAL_PIN_TYPE, - RES_RX2: SERIAL_PIN_TYPE, RES_TX2: SERIAL_PIN_TYPE, RES_RX3: SERIAL_PIN_TYPE, RES_TX3: SERIAL_PIN_TYPE, + interface SerialPinTypes { + RES_RX0: SERIAL_PIN_TYPE; + RES_TX0: SERIAL_PIN_TYPE; + RES_RX1: SERIAL_PIN_TYPE; + RES_TX1: SERIAL_PIN_TYPE; + RES_RX2: SERIAL_PIN_TYPE; + RES_TX2: SERIAL_PIN_TYPE; + RES_RX3: SERIAL_PIN_TYPE; + RES_TX3: SERIAL_PIN_TYPE; } - export interface Pins - { - mode: PIN_MODE, - value: PIN_STATE|number, - supportedModes: PIN_MODE[], - analogChannel: number, - report: REPORTING, - state: PIN_STATE|PULLUP_STATE, // TODO not sure if this exists anymore... --- TWW + interface Pins { + mode: PIN_MODE; + value: PIN_STATE | number; + supportedModes: PIN_MODE[]; + analogChannel: number; + report: REPORTING; + state: PIN_STATE | PULLUP_STATE; // TODO not sure if this exists anymore... --- TWW } - export interface Firmware - { - name: string, - version: Version, + interface Firmware { + name: string; + version: Version; } - export interface Settings - { - reportVersionTimeout: number, - samplingInterval: number, + interface Settings { + reportVersionTimeout: number; + samplingInterval: number; serialport: { baudRate: number, - bufferSize: number - } + bufferSize: number, + }; } - export interface Port - { - comName: string, + interface Port { + comName: string; } - export interface Version - { - major: number, - minor: number + interface Version { + major: number; + minor: number; } // TODO these enums could actually be non-const in the future (provides some benefits) --- TWW // https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L449-L464 - export const enum PIN_MODE { + const enum PIN_MODE { INPUT = 0x00, OUTPUT = 0x01, ANALOG = 0x02, @@ -226,30 +270,30 @@ declare namespace Board UNKNOWN = 0x10, } - export const enum PIN_STATE { + const enum PIN_STATE { LOW = 0, HIGH = 1 } - export const enum REPORTING { + const enum REPORTING { ON = 1, OFF = 0, } - export const enum PULLUP_STATE { + const enum PULLUP_STATE { ENABLED = 1, DISABLED = 0, } // https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L474-L478 - export const enum STEPPER_TYPE { + const enum STEPPER_TYPE { DRIVER = 1, TWO_WIRE = 2, FOUR_WIRE = 4, } // https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L479-L484 - export const enum STEPPER_RUN_STATE { + const enum STEPPER_RUN_STATE { STOP = 0, ACCEL = 1, DECEL = 2, @@ -257,13 +301,13 @@ declare namespace Board } // https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L485-L488 - export const enum STEPPER_DIRECTION { + const enum STEPPER_DIRECTION { CCW = 0, CW = 1, } // https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L466-L471 - export const enum I2C_MODE { + const enum I2C_MODE { WRITE = 0, READ = 1, CONTINUOUS_READ = 2, @@ -271,13 +315,13 @@ declare namespace Board } // https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L491-L494 - export const enum SERIAL_MODE { + const enum SERIAL_MODE { CONTINUOUS_READ = 0x00, STOP_READING = 0x01, } // https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L497-L512 - export const enum SERIAL_PORT_ID { + const enum SERIAL_PORT_ID { HW_SERIAL0 = 0x00, HW_SERIAL1 = 0x01, HW_SERIAL2 = 0x02, @@ -290,7 +334,7 @@ declare namespace Board } // https://github.com/firmata/firmata.js/blob/v0.15.0/lib/firmata.js#L515-L524 - export const enum SERIAL_PIN_TYPE { + const enum SERIAL_PIN_TYPE { RES_RX0 = 0x00, RES_TX0 = 0x01, RES_RX1 = 0x02, @@ -300,4 +344,4 @@ declare namespace Board RES_RX3 = 0x06, RES_TX3 = 0x07, } -} \ No newline at end of file +} diff --git a/types/flatpickr/flatpickr-tests.ts b/types/flatpickr/flatpickr-tests.ts index 9f0211c79d..f6800e38b7 100644 --- a/types/flatpickr/flatpickr-tests.ts +++ b/types/flatpickr/flatpickr-tests.ts @@ -12,4 +12,3 @@ if (input != null) { } picker1.destroy(); - diff --git a/types/freeport/freeport-tests.ts b/types/freeport/freeport-tests.ts index d64a72f496..2746aeb4ed 100644 --- a/types/freeport/freeport-tests.ts +++ b/types/freeport/freeport-tests.ts @@ -1,4 +1,3 @@ - import freeport = require('freeport'); let num: number, diff --git a/types/fusioncharts/fusioncharts-tests.ts b/types/fusioncharts/fusioncharts-tests.ts index af71a2378a..ad6afac65b 100644 --- a/types/fusioncharts/fusioncharts-tests.ts +++ b/types/fusioncharts/fusioncharts-tests.ts @@ -4,9 +4,7 @@ FusionCharts.addEventListener('ready', (eventObject) => { eventObject.stopPropagation(); }); -FusionCharts.ready((fusioncharts) => { - -}); +FusionCharts.ready((fusioncharts) => {}); FusionCharts.version; @@ -48,4 +46,4 @@ chart.clone(); chart.zoomTo(0, 3); chart.zoomOut(); chart.setJSONData(chartData); -chart.ref; \ No newline at end of file +chart.ref; diff --git a/types/fusioncharts/fusioncharts.charts.d.ts b/types/fusioncharts/fusioncharts.charts.d.ts index f06060a054..82a41f7333 100644 --- a/types/fusioncharts/fusioncharts.charts.d.ts +++ b/types/fusioncharts/fusioncharts.charts.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var charts: (H: FusionChartStatic) => FusionChartStatic; export = charts; export as namespace charts; - diff --git a/types/fusioncharts/fusioncharts.gantt.d.ts b/types/fusioncharts/fusioncharts.gantt.d.ts index d29fa26f78..e9dd4cfccf 100644 --- a/types/fusioncharts/fusioncharts.gantt.d.ts +++ b/types/fusioncharts/fusioncharts.gantt.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var gantt: (H: FusionChartStatic) => FusionChartStatic; export = gantt; export as namespace gantt; - diff --git a/types/fusioncharts/fusioncharts.maps.d.ts b/types/fusioncharts/fusioncharts.maps.d.ts index 1894383758..48c5869608 100644 --- a/types/fusioncharts/fusioncharts.maps.d.ts +++ b/types/fusioncharts/fusioncharts.maps.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var maps: (H: FusionChartStatic) => FusionChartStatic; export = maps; export as namespace maps; - diff --git a/types/fusioncharts/fusioncharts.powercharts.d.ts b/types/fusioncharts/fusioncharts.powercharts.d.ts index 46178c8b8f..e2004e8423 100644 --- a/types/fusioncharts/fusioncharts.powercharts.d.ts +++ b/types/fusioncharts/fusioncharts.powercharts.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var powercharts: (H: FusionChartStatic) => FusionChartStatic; export = powercharts; export as namespace powercharts; - diff --git a/types/fusioncharts/fusioncharts.ssgrid.d.ts b/types/fusioncharts/fusioncharts.ssgrid.d.ts index b44f5336c1..fb7c2d51a2 100644 --- a/types/fusioncharts/fusioncharts.ssgrid.d.ts +++ b/types/fusioncharts/fusioncharts.ssgrid.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var ssgrid: (H: FusionChartStatic) => FusionChartStatic; export = ssgrid; export as namespace ssgrid; - diff --git a/types/fusioncharts/fusioncharts.treemap.d.ts b/types/fusioncharts/fusioncharts.treemap.d.ts index c555a627bc..146c8b8b54 100644 --- a/types/fusioncharts/fusioncharts.treemap.d.ts +++ b/types/fusioncharts/fusioncharts.treemap.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var treemap: (H: FusionChartStatic) => FusionChartStatic; export = treemap; export as namespace treemap; - diff --git a/types/fusioncharts/fusioncharts.widgets.d.ts b/types/fusioncharts/fusioncharts.widgets.d.ts index a4547b99b7..ea16eb60c9 100644 --- a/types/fusioncharts/fusioncharts.widgets.d.ts +++ b/types/fusioncharts/fusioncharts.widgets.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var widgets: (H: FusionChartStatic) => FusionChartStatic; export = widgets; export as namespace widgets; - diff --git a/types/fusioncharts/fusioncharts.zoomscatter.d.ts b/types/fusioncharts/fusioncharts.zoomscatter.d.ts index 106908b6df..277050a77a 100644 --- a/types/fusioncharts/fusioncharts.zoomscatter.d.ts +++ b/types/fusioncharts/fusioncharts.zoomscatter.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var zoomscatter: (H: FusionChartStatic) => FusionChartStatic; export = zoomscatter; export as namespace zoomscatter; - diff --git a/types/fusioncharts/index.d.ts b/types/fusioncharts/index.d.ts index 9c46955075..e218e32cd5 100644 --- a/types/fusioncharts/index.d.ts +++ b/types/fusioncharts/index.d.ts @@ -3,9 +3,7 @@ // Definitions by: Rohit Kumar , Shivaraj KV // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare namespace FusionCharts { - type ChartDataFormats = 'json' | 'jsonurl' | 'csv' | 'xml' | 'xmlurl'; type ImageHAlign = 'left' | 'right' | 'middle'; @@ -33,7 +31,6 @@ declare namespace FusionCharts { } interface ChartObject { - type?: string; id?: string; @@ -251,7 +248,6 @@ declare namespace FusionCharts { configure(options: {}): void; ref: {}; - } interface FusionChartStatic { @@ -286,10 +282,7 @@ declare namespace FusionCharts { options: {}; debugger: Debugger; - - } - } declare var FusionCharts: FusionCharts.FusionChartStatic; diff --git a/types/fusioncharts/maps/fusioncharts.usa.d.ts b/types/fusioncharts/maps/fusioncharts.usa.d.ts index 16ed0d6c91..5b02b82aa8 100644 --- a/types/fusioncharts/maps/fusioncharts.usa.d.ts +++ b/types/fusioncharts/maps/fusioncharts.usa.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var usa: (H: FusionChartStatic) => FusionChartStatic; export = usa; export as namespace usa; - diff --git a/types/fusioncharts/maps/fusioncharts.world.d.ts b/types/fusioncharts/maps/fusioncharts.world.d.ts index 3e545e2556..e950cc08e3 100644 --- a/types/fusioncharts/maps/fusioncharts.world.d.ts +++ b/types/fusioncharts/maps/fusioncharts.world.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var world: (H: FusionChartStatic) => FusionChartStatic; export = world; export as namespace world; - diff --git a/types/fusioncharts/themes/fusioncharts.theme.carbon.d.ts b/types/fusioncharts/themes/fusioncharts.theme.carbon.d.ts index 79ba171231..80b8096801 100644 --- a/types/fusioncharts/themes/fusioncharts.theme.carbon.d.ts +++ b/types/fusioncharts/themes/fusioncharts.theme.carbon.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var carbon: (H: FusionChartStatic) => FusionChartStatic; export = carbon; export as namespace carbon; - diff --git a/types/fusioncharts/themes/fusioncharts.theme.fint.d.ts b/types/fusioncharts/themes/fusioncharts.theme.fint.d.ts index cee08aa6b2..a72265a049 100644 --- a/types/fusioncharts/themes/fusioncharts.theme.fint.d.ts +++ b/types/fusioncharts/themes/fusioncharts.theme.fint.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var fint: (H: FusionChartStatic) => FusionChartStatic; export = fint; export as namespace fint; - diff --git a/types/fusioncharts/themes/fusioncharts.theme.ocean.d.ts b/types/fusioncharts/themes/fusioncharts.theme.ocean.d.ts index 8b7e3828c0..2f77db1f9b 100644 --- a/types/fusioncharts/themes/fusioncharts.theme.ocean.d.ts +++ b/types/fusioncharts/themes/fusioncharts.theme.ocean.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var ocean: (H: FusionChartStatic) => FusionChartStatic; export = ocean; export as namespace ocean; - diff --git a/types/fusioncharts/themes/fusioncharts.theme.zune.d.ts b/types/fusioncharts/themes/fusioncharts.theme.zune.d.ts index 06ab4c1787..2f76b88de5 100644 --- a/types/fusioncharts/themes/fusioncharts.theme.zune.d.ts +++ b/types/fusioncharts/themes/fusioncharts.theme.zune.d.ts @@ -1,7 +1,5 @@ - import { FusionChartStatic } from "fusioncharts"; declare var zune: (H: FusionChartStatic) => FusionChartStatic; export = zune; export as namespace zune; - diff --git a/types/globule/globule-tests.ts b/types/globule/globule-tests.ts index 78697ba199..cf3d69c4b8 100644 --- a/types/globule/globule-tests.ts +++ b/types/globule/globule-tests.ts @@ -25,4 +25,3 @@ const dest = mappings[0].dest; mappings = globule.mapping(['*.js'], { srcBase: '/home/code' }); mappings = globule.mapping(['*.js', '*.less']); mappings = globule.mapping(['*.js'], ['*.less']); - diff --git a/types/globule/index.d.ts b/types/globule/index.d.ts index 4add1d4461..08f00ec082 100644 --- a/types/globule/index.d.ts +++ b/types/globule/index.d.ts @@ -84,4 +84,3 @@ interface GlobuleStatic { declare var globule: GlobuleStatic; export = globule; - diff --git a/types/klaw-sync/index.d.ts b/types/klaw-sync/index.d.ts index d344879e1a..e68af63739 100644 --- a/types/klaw-sync/index.d.ts +++ b/types/klaw-sync/index.d.ts @@ -34,4 +34,3 @@ interface Options { } export function klawSync(root: string, options?: Options): ReadonlyArray - diff --git a/types/koa-compose/index.d.ts b/types/koa-compose/index.d.ts index a1037f187c..88047abcc9 100644 --- a/types/koa-compose/index.d.ts +++ b/types/koa-compose/index.d.ts @@ -3,7 +3,6 @@ // Definitions by: jKey Lu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare function compose(middleware: Array>): compose.ComposedMiddleware; declare namespace compose { diff --git a/types/koa-compose/koa-compose-tests.ts b/types/koa-compose/koa-compose-tests.ts index cb7b78b397..4c12ca6571 100644 --- a/types/koa-compose/koa-compose-tests.ts +++ b/types/koa-compose/koa-compose-tests.ts @@ -1,15 +1,13 @@ - import compose = require('koa-compose'); -var fn1: compose.Middleware = (context: any, next: () => Promise): Promise => +const fn1: compose.Middleware = (context: any, next: () => Promise): Promise => Promise .resolve(console.log('in fn1')) .then(() => next()); -var fn2: compose.Middleware = (context: any, next: () => Promise): Promise => +const fn2: compose.Middleware = (context: any, next: () => Promise): Promise => Promise .resolve(console.log('in fn2')) .then(() => next()); - -var fn = compose([fn1, fn2]); \ No newline at end of file +const fn = compose([fn1, fn2]); diff --git a/types/leven/leven-tests.ts b/types/leven/leven-tests.ts index 4e87d3d90e..4ca0406529 100644 --- a/types/leven/leven-tests.ts +++ b/types/leven/leven-tests.ts @@ -1,8 +1,7 @@ - import leven = require('leven'); leven('baz', 'bar'); // => "1" leven('foo', 'bar'); -// => "3" \ No newline at end of file +// => "3" diff --git a/types/localforage-cordovasqlitedriver/localforage-cordovasqlitedriver-tests.ts b/types/localforage-cordovasqlitedriver/localforage-cordovasqlitedriver-tests.ts index 5b678beeb7..22b550da0b 100644 --- a/types/localforage-cordovasqlitedriver/localforage-cordovasqlitedriver-tests.ts +++ b/types/localforage-cordovasqlitedriver/localforage-cordovasqlitedriver-tests.ts @@ -1,4 +1,3 @@ - declare const cordovaSQLiteDriver: LocalForageDriver; () => { diff --git a/types/loopback/index.d.ts b/types/loopback/index.d.ts index 2d4af5caa9..5eadbb871f 100644 --- a/types/loopback/index.d.ts +++ b/types/loopback/index.d.ts @@ -14,7 +14,6 @@ import * as core from "express-serve-static-core"; declare function l(): l.LoopBackApplication; declare namespace l { - /** * The `App` object represents a Loopback application * The App object extends [Express](expressjs.com/api.html#express) and @@ -35,7 +34,6 @@ declare namespace l { // interface ILoopbackAplication extends express.Application { }; interface LoopBackApplication extends core.Application { - start(): void; /** @@ -49,7 +47,6 @@ declare namespace l { * @param {any} connector Connector object as returne * by `require('loopback-connector-{name}')` */ - connector(name: string, connector: any): void; /** @@ -57,13 +54,11 @@ declare namespace l { * @param {string} name The data source name * @param {any} config The data source confi */ - dataSource(name: string, config: any): void; /** * Enable app wide authentication */ - enableAuth(): void; /** @@ -90,7 +85,6 @@ declare namespace l { * listen(cb?: () => void):http.Serve * */ - // listen(port?: number, cb?: () => void): any; /** @@ -114,7 +108,6 @@ declare namespace l { * @en * @returns {any} the model clas */ - model(Model: any|string, config: {dataSource: string|any, public?: boolean, relations?: any}): any; /** @@ -152,14 +145,12 @@ declare namespace l { * `` * @returns {Array} Array of model classes */ - models(): any[]; /** * Get all remote objects. * @returns {any} [Remote objects](apidocs.strongloop.com/strong-remoting/#remoteObjectsoptions). */ - remoteObjects(): any; /** @@ -168,7 +159,6 @@ declare namespace l { * *NOTE:** Calling `app.remotes()` more than once returns only a single set of remote objects. * @returns {any} remoteObjects */ - remotes(): any; /** @@ -198,7 +188,6 @@ declare namespace l { * @returns {any} this (fluent API * @header app.middlewareFromConfig(factory, config */ - middlewareFromConfig(factory: () => void, config: {phase: string, enabled?: boolean, params?: any[]|any, paths?: any[]|string|RegExp}): any; /** @@ -228,7 +217,6 @@ declare namespace l { * @returns {any} this (fluent API * @header app.defineMiddlewarePhases(nameOrArray */ - defineMiddlewarePhases(nameOrArray: string|string[]): any; /** @@ -244,7 +232,6 @@ declare namespace l { * @returns {any} this (fluent API * @header app.middleware(name, handler */ - middleware(name: string, paths?: any[]|string|RegExp, handler?: core.Handler): any; } @@ -265,7 +252,6 @@ declare namespace l { // interface Router extends core.Router { } // interface Send extends core.Send { } - /** * LoopBack core module. It provides static properties and * methods to create models and data sources. The module itself is a function @@ -286,9 +272,7 @@ declare namespace l { * @class loopback * @header loopback */ - class loopback { - /** Version of LoopBack framework. Static read-only property. */ version: string; @@ -385,7 +369,6 @@ declare namespace l { * @param {any} options (optional * @header loopback.createMode */ - static createModel(name: string, properties: any, options: any): void; /** @@ -395,7 +378,6 @@ declare namespace l { * @returns {Model} The model clas * @header loopback.findModel(modelName */ - static findModel(modelName: string): Model; /** @@ -405,7 +387,6 @@ declare namespace l { * @returns {Model} The model clas * @header loopback.getModel(modelName */ - static getModel(modelName: string): Model; /** @@ -416,7 +397,6 @@ declare namespace l { * @returns {Model} The subclass if found or the base clas * @header loopback.getModelByType(modelType */ - static getModelByType(modelType: Model): Model; /** @@ -424,16 +404,13 @@ declare namespace l { * @param {string} [name] The name of the data source. * If not provided, the `'default'` is used */ - static memory(name?: string): void; - /** * Add a remote method to a model. * @param {() => void} fn * @param {any} options (optional */ - static remoteMethod(fn: () => void, options: any): void; /** @@ -443,7 +420,6 @@ declare namespace l { * @param {string} path Path to the template file. * @returns {() => void */ - static template(path: string): void; // NOTE*** DEPRECATE in 3.0 @@ -455,7 +431,6 @@ declare namespace l { // * // * @header loopback.setDefaultDataSourceForType(type, dataSource) // */ - // setDefaultDataSourceForType(type: string, dataSource: any|DataSource): DataSource; // /** @@ -463,16 +438,13 @@ declare namespace l { // * @param {string} type The datasource type. // * @returns {DataSource} The data source instance // */ - // getDefaultDataSourceForType(type: string): DataSource; // /** // * Attach any model that does not have a dataSource to // * the default dataSource for the type the Model requests // */ - // autoAttach(): void; - } /** @@ -481,7 +453,6 @@ declare namespace l { */ class Registry { - static addACL(acls: any[], acl: any): void; /** @@ -492,7 +463,6 @@ declare namespace l { * @property {any} [relations] Model relations to add/update * @header loopback.configureModel(ModelCtor, config */ - configureModel(ModelCtor: Model, config: {dataSource: any, relations?: any}): void; /** @@ -503,7 +473,6 @@ declare namespace l { * @property {*} [*] Other connector properties. * See the relevant connector documentation */ - createDataSource(name: string, options: {connector: any, properties?: any}): void; /** @@ -559,7 +528,6 @@ declare namespace l { * @param {any} options (optional * @header loopback.createMode */ - createModel(name: string, properties: any, options: any): void; /** @@ -569,7 +537,6 @@ declare namespace l { * @returns {Model} The model clas * @header loopback.findModel(modelName */ - findModel(modelOrName: string ): Model; /** @@ -579,7 +546,6 @@ declare namespace l { * @returns {Model} The model clas * @header loopback.getModel(modelName */ - getModel(modelOrName: string): Model; /** @@ -590,7 +556,6 @@ declare namespace l { * @returns {Model} The subclass if found or the base clas * @header loopback.getModelByType(modelType */ - getModelByType(modelType: Model): Model; /** @@ -598,7 +563,6 @@ declare namespace l { * @param {string} [name] The name of the data source. * If not provided, the `'default'` is used */ - memory(name?: string): void; // **NOTE** DEPRECATE ON 3.x @@ -610,7 +574,6 @@ declare namespace l { // * // * @header loopback.setDefaultDataSourceForType(type, dataSource) // */ - // setDefaultDataSourceForType(type: string, dataSource: any|DataSource): DataSource; // /** @@ -618,14 +581,12 @@ declare namespace l { // * @param {string} type The datasource type. // * @returns {DataSource} The data source instance // */ - // getDefaultDataSourceForType(type: string): DataSource; // /** // * Attach any model that does not have a dataSource to // * the default dataSource for the type the Model requests // */ - // autoAttach(): void; } @@ -636,7 +597,6 @@ declare namespace l { * @options {Context} context The context object * @constructor */ - class AccessContext { /** context The context object */ constructor(context: Context); @@ -648,28 +608,24 @@ declare namespace l { * @param {string} [principalName] The principal name * @returns {boolean} */ - addPrincipal(principalType: string, principalId: any, principalName?: string): boolean; /** * Get the user id * @returns {*} */ - getUserId(): any; /** * Get the application id * @returns {*} */ - getAppId(): any; /** * Check if the access context has authenticated principals * @returns {boolean} */ - isAuthenticated(): boolean; } @@ -723,7 +679,6 @@ declare namespace l { * @class * @constructor */ - class AccessRequest { constructor(model: string, property: string, accessType: string, permission: string); @@ -731,21 +686,18 @@ declare namespace l { * Does the given `ACL` apply to this `AccessRequest` * @param {ACL} acl */ - exactlyMatches(acl: ACL): void; /** * Is the request for access allowed * @returns {boolean} */ - isAllowed(): boolean; /** * Does the request contain any wildcards * @returns {boolean} */ - isWildcard(): boolean; } @@ -758,7 +710,6 @@ declare namespace l { * @returns {Principal} * @class */ - class Principal { constructor(type: string, id: any, name: string); @@ -767,7 +718,6 @@ declare namespace l { * Returns true if argument principal is equal to this principal. * @param {any} p The other principa */ - equals(p: any): void; } @@ -841,9 +791,7 @@ declare namespace l { * @class * @constructor */ - class Model { - /** The name of the model. */ static modelName: string; @@ -868,7 +816,6 @@ declare namespace l { * @param {string|Error} err The error object. * @param {boolean} allowed True if the request is allowed; false otherwise */ - static checkAccess(token: AccessToken, modelId: any, sharedMethod: any, ctx: any, callback: (err: string|Error, allowed: boolean) => void): void; /** @@ -878,7 +825,6 @@ declare namespace l { * `false` if the method defined on the prototype (eg. * `MyModel.prototype.myMethod`) */ - static disableRemoteMethod(name: string, isStatic: boolean): void; /** @@ -886,7 +832,6 @@ declare namespace l { * @param {string} name The name of the method. * The name of the method (include "prototype." if the method is defined on the prototype). */ - static disableRemoteMethodByName(name: string): void; /** @@ -896,7 +841,6 @@ declare namespace l { * @param {Application} app Attached application object. * @end */ - static getApp(callback: (err: Error, app: Application) => void): void; /** @@ -934,7 +878,6 @@ declare namespace l { * @param {any} options The remoting options. * See [Remote methods - Options](docs.strongloop.com/display/LB/Remote+methods#Remotemethods-Options) */ - remoteMethod(name: string, options: any): void; /** @@ -942,7 +885,6 @@ declare namespace l { * Add any setup or configuration code you want executed when the model is created. * See [Setting up a custom model](docs.strongloop.com/display/LB/Extending+built-in+models#Extendingbuilt-inmodels-Settingupacustommodel) */ - static setup(): void; } @@ -957,7 +899,6 @@ declare namespace l { * @property {() => void } ctor The constructor * @property {any} http The HTTP settings */ - class SharedClass { /** The SharedClass name */ ctor: () => void; @@ -975,7 +916,6 @@ declare namespace l { * @param {string} name The method name * @param {any} options Set of options used to create a SharedMethod. See the full set of options https://apidocs.strongloop.com/strong-remoting/#sharedmethod */ - defineMethod(name: string, options: any): void; /** @@ -983,14 +923,12 @@ declare namespace l { * @param {string} fn The function or method name * @param {boolean} isStatic Disable a static or prototype method */ - disableMethod(fn: string, isStatic: boolean): void; /** * Disable a sharedMethod with the given static or prototype method name. * @param {string} methodName The method name */ - disableMethodByName(methodName: string): void; /** @@ -999,7 +937,6 @@ declare namespace l { * @param {boolean} isStatic Required if fn is a String. Only find a static method with the given name. * @return {any} SharedMethod https://apidocs.strongloop.com/strong-remoting/#sharedmethod */ - find(fn: () => void|string, isStatic: boolean ): any; /** @@ -1007,7 +944,6 @@ declare namespace l { * @param {string} methodName the method name Find a static or prototype method with the given name. * @return {any} SharedMethod */ - findMethodByName(methodName: string): any; /** @@ -1015,7 +951,6 @@ declare namespace l { * @param {string} fn The function or method name * @param {boolean} isStatic Disable a static or prototype method */ - getKeyFromMethodNameAndTarget(fn: string, isStatic: boolean): void; /** @@ -1023,7 +958,6 @@ declare namespace l { * @param {any} options * @return {any[]} An array of shared methods SharedMethod[] */ - methods(options: {includeDisabled: boolean}): any[]; /** @@ -1044,7 +978,6 @@ declare namespace l { * * @param {() => void} resolver The resolver function. */ - resolve(resolver: () => void): void; } @@ -1066,9 +999,7 @@ declare namespace l { * ``` * @class PersistedModel */ - class PersistedModel extends Model { - /** * Apply an update list * **Note: this is not atomic* @@ -1076,7 +1007,6 @@ declare namespace l { * @param {any} options An optional options object to pass to underlying data-access calls. * @param {() => void} callback Callback function */ - static bulkUpdate(updates: any[], options: any, callback: () => void): void; /** @@ -1088,14 +1018,12 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {Array} changes An Array of [Change](#change) objects */ - static changes(since: number, filter: any, callback: (err: Error, changes: any[]) => void): void; /** * Create a checkpoint * @param {() => void} callback */ - static checkpoint(callback: () => void): void; /** @@ -1110,7 +1038,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {number} count number of instances updated */ - static count(where?: any, callback?: (err: Error, count: number) => void): void; /** @@ -1120,7 +1047,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} models Model instances or null */ - static create(data?: any|any[], callback?: (err: Error, models: any) => void): void; /** @@ -1128,7 +1054,6 @@ declare namespace l { * @param {any} options Only changes to models matching this where filter will be included in the ChangeStream. * @param {() => void} callback */ - static createChangeStream(options: {where: any}, callback: (err: Error, changes: any) => void): void; /** @@ -1137,7 +1062,6 @@ declare namespace l { * @param {Array} deltas * @param {() => void} callback */ - static createUpdates(deltas: any[], callback: () => void): void; /** @@ -1146,7 +1070,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {number} currentCheckpointId Current checkpoint ID */ - static currentCheckpoint(callback: (err: Error, currentCheckpointId: number) => void): void; /** @@ -1163,7 +1086,6 @@ declare namespace l { * @param {any} info Additional information about the command outcome. * @param {number} info.count number of instances (rows, documents) destroyed */ - static destroyAll(where?: any, callback?: (err: Error, info: any, infoCount: number) => void): void; /** @@ -1172,7 +1094,6 @@ declare namespace l { * @callback {() => void} callback Callback function called with `(err)` arguments. Required. * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object) */ - static destroyById(id: any, callback: (err: Error) => void): void; /** @@ -1184,13 +1105,11 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} result any with `deltas` and `conflicts` properties; see [Change.diff()](#change-diff) for details */ - static diff(since: number, remoteChanges: any[], callback: (err: Error, result: any) => void): void; /** * Enable the tracking of changes made to the model. Usually for replication. */ - static enableChangeTracking(): void; /** @@ -1200,7 +1119,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {boolean} exists True if the instance with the specified ID exists; false otherwise */ - static exists(id: any, callback: (err: Error, exists: boolean) => void): void; /** @@ -1243,7 +1161,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Model instance matching the specified ID or null if no instance matches */ - static findById(id: any, filter?: {fields?: string|any|any[]; include?: string|any|any[]; }, callback?: (err: Error, instance: any) => void): void; /** @@ -1269,7 +1186,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {Array} model First model instance that matches the filter or null if none found */ - static findOne(filter?: {fields?: string|any|any[]; include?: string|any|any[]; order?: string; skip?: number; where?: any; }, callback?: (err: Error, model: any) => void): void; /** @@ -1302,7 +1218,6 @@ declare namespace l { * @param {any} instance Model instance matching the `where` filter, if found. * @param {boolean} created True if the instance matching the `where` filter was created */ - static findOrCreate( data: any, filter?: { @@ -1319,14 +1234,12 @@ declare namespace l { * Get the `Change` model. * Throws an error if the change model is not correctly setup. */ - static getChangeModel(): void; /** * Get the `id` property name of the constructor * @returns {string} The `id` property nam */ - static getIdName(): string; /** @@ -1335,7 +1248,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {string} sourceId Source identifier for the model or dataSource */ - static getSourceId(callback: (err: Error, sourceId: string) => void): void; /** @@ -1343,7 +1255,6 @@ declare namespace l { * change error handling * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object) */ - static handleChangeError(err: Error): void; /** @@ -1352,7 +1263,6 @@ declare namespace l { * @callback {() => void} callback * @param {Error} er */ - static rectifyChange(id: any, callback: (err: Error) => void): void; /** @@ -1367,7 +1277,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Replaced instance */ - static replaceById(id: any, data: any, options?: {validate: boolean; }, callback?: (err: Error, instance: any) => void): void; /** @@ -1381,7 +1290,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} model Replaced model instance. */ - static replaceOrCreate(data: any, options?: {validate: boolean; }, callback?: (err: Error, model: any) => void): void; /** @@ -1396,7 +1304,6 @@ declare namespace l { * @param {any] checkpoints The new checkpoints to use as the "since" * argument for the next replication */ - static replicate(since?: number, targetModel?: Model, options?: any, optionsFilter?: any, callback?: (err: Error, conflicts: Conflict[], param: any) => void): void; /** @@ -1424,7 +1331,6 @@ declare namespace l { * @param {number} info.count number of instances (rows, documents) updated. * */ - static updateAll(where?: any, data?: any, callback?: (err: Error, info: any, infoCount: number) => void): void; /** @@ -1434,7 +1340,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} model Updated model instance */ - static upsert(data: any, callback: (err: Error, model: any) => void): void; /** @@ -1453,7 +1358,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} model Updated model instance */ - static upsertWithWhere(data: any, callback: (err: Error, model: any) => void): void; /** @@ -1461,28 +1365,24 @@ declare namespace l { * Triggers `destroy` hook (async) before and after destroying object. * @param {() => void} callback Callback function */ - destroy(callback: () => void): void; /** * Get the `id` value for the `PersistedModel` * @returns {*} The `id` valu */ - getId(): any; /** * Get the `id` property name of the constructor * @returns {string} The `id` property nam */ - getIdName(): string; /** * Determine if the data model is new. * @returns {boolean} Returns true if the data model is new; false otherwise */ - isNewRecord(): boolean; /** @@ -1491,7 +1391,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Model instance */ - reload(callback: (err: Error, instance: any) => void): void; /** @@ -1504,7 +1403,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Replaced instance */ - replaceAttributes(data: any, options?: {validate: boolean}, callback?: (err: Error, instance: any) => void): void; /** @@ -1518,7 +1416,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Model instance saved or created */ - save(options?: {validate: boolean; throws: boolean}, callback?: (err: Error, instance: any) => void): void; /** @@ -1527,7 +1424,6 @@ declare namespace l { * Override this method to handle complex IDs * @param {*} val The `id` value. Will be converted to the type that the `id` property specifies */ - setId(val: any): void; /** @@ -1539,7 +1435,6 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Updated instance */ - updateAttribute(name: string, value: any, callback: (err: Error, instance: any) => void): void; /** @@ -1550,14 +1445,12 @@ declare namespace l { * @param {Error} err Error object; see [Error object](docs.strongloop.com/display/LB/Error+object). * @param {any} instance Updated instance */ - updateAttributes(data: any, callback: (err: Error, instance: any) => void): void; // **NOTE** Deprecate for v3.x // /** // * Alias for `destroyAll` // */ - // **NOTE** Deprecate for v3.x // deleteAll(): void; @@ -1565,21 +1458,18 @@ declare namespace l { // /** // * Alias for updateAll. // */ - // update(): void; // **NOTE** Deprecate for v3.x // /** // * Alias for destroyById. // */ - // removeById(): void; // **NOTE** Deprecate for v3.x // /** // * Alias for destroyById. // */ - // deleteById(): void; // **NOTE** Deprecate for v3.x @@ -1587,7 +1477,6 @@ declare namespace l { // * Alias for destroy. // * @header PersistedModel.remove // */ - // remove(): void; // **NOTE** Deprecate for v3.x @@ -1595,7 +1484,6 @@ declare namespace l { // * Alias for destroy. // * @header PersistedModel.delete // */ - // delete(): void; // **NOTE** Deprecate for v3.x @@ -1608,16 +1496,13 @@ declare namespace l { // * @param {Error} err // * @param {any} changes // */ - // createany(options: any, optionsWhere: any, callback: (err: Error, changes: any) => void): void; - } /** * Serve the LoopBack favicon. * @header loopback.favicon( */ - function favicon(): void; /** @@ -1629,7 +1514,6 @@ declare namespace l { * For more information, see [Exposing models over a REST API](docs.strongloop.com/display/DOC/Exposing+models+over+a+REST+API). * @header loopback.rest( */ - function rest(): void; /** @@ -1641,7 +1525,6 @@ declare namespace l { * for the full list of available options. * @header loopback.static(root, [options]) */ - function static(root: string, options: any): void; /** @@ -1654,13 +1537,11 @@ declare namespace l { * } * ``` */ - function status(): void; /** * Rewrite the url to replace current user literal with the logged in user id */ - function rewriteUserLiteral(): void; /** @@ -1711,7 +1592,6 @@ declare namespace l { * to be handled by error-handling middleware. * @header loopback.urlNotFound( */ - function urlNotFound(): void; /** @@ -1728,9 +1608,7 @@ declare namespace l { * @class AccessToken * @inherits {PersistedModel} */ - class AccessToken extends PersistedModel { - /** Generated token ID */ id: string; @@ -1749,7 +1627,6 @@ declare namespace l { * @param {Error} err * @param {string} toke */ - static createAccessTokenId(callback: (err: Error, token: string) => void): void; /** @@ -1760,7 +1637,6 @@ declare namespace l { * @param {Error} err * @param {AccessToken} toke */ - static findForRequest(req: any, options?: any, callback?: (err: Error, token: AccessToken) => void): void; /** @@ -1770,7 +1646,6 @@ declare namespace l { * @param {Error} err * @param {boolean} isValid */ - validate(callback: (err: Error, isValid: boolean) => void): void; // **NOTE** Deprecate for 3.x @@ -1781,9 +1656,7 @@ declare namespace l { // * assert(AccessToken.ANONYMOUS.id === '$anonymous'); // * ``` // */ - // ANONYMOUS(): void; - } /** @@ -1812,7 +1685,6 @@ declare namespace l { * @class ACL * @inherits PersistedMode */ - class ACL extends PersistedModel { /** model Name of the model. */ model: string; @@ -1851,7 +1723,6 @@ declare namespace l { * READ, REPLICATE, WRITE, or EXECUTE. * @param {() => void} callback Callback functio */ - static checkAccessForContext(context: {principals: any[]; model: string|Model; id: any; property: string; accessType: string; }, callback: () => void): void; /** @@ -1864,7 +1735,6 @@ declare namespace l { * @param {string|Error} err The error object * @param {boolean} allowed is the request allow */ - static checkAccessForToken(token: AccessToken, model: string, modelId: any, method: string, callback: (err: string|Error, allowed: boolean) => void): void; /** @@ -1878,7 +1748,6 @@ declare namespace l { * @param {string|Error} err The error object * @param {AccessRequest} result The access permissio */ - static checkPermission(principalType: string, principalId: string, model: string, property: string, accessType: string, callback: (err: string|Error, result: AccessRequest) => void): void; /** @@ -1887,7 +1756,6 @@ declare namespace l { * @param {AccessRequest} req The request * @returns {number} */ - static getMatchingScore(rule: ACL, req: AccessRequest): number; /** @@ -1897,7 +1765,6 @@ declare namespace l { * @param {string|*} role Role id/name * @param {() => void} cb Callback functio */ - static isMappedToRole(principalType: string, principalId: string|any, role: string|any, cb: () => void): void; /** @@ -1906,7 +1773,6 @@ declare namespace l { * @param {string|number} id Principal id or name * @param {() => void} cb Callback function */ - static resolvePrincipal(type: string, id: string|number, cb: () => void): void; /** @@ -1914,7 +1780,6 @@ declare namespace l { * @param {AccessRequest} req The request * @returns {number} scor */ - score(req: AccessRequest): number; } @@ -1959,7 +1824,6 @@ declare namespace l { * @class Application * @inherits {PersistedModel} */ - class Application extends PersistedModel { /** Generated ID. */ id: string; @@ -2099,7 +1963,6 @@ declare namespace l { * @class Change * @inherits {PersistedModel} */ - class Change extends PersistedModel { /** Hash of the modelName and ID. */ id: string; @@ -2107,7 +1970,6 @@ declare namespace l { /** The current model revision. */ rev: string; - prev: string; checkpoint: number; @@ -2164,7 +2026,6 @@ declare namespace l { * @param {Error} err * @param {any} result See above. */ - // static diff(modelName: string, since: number, remoteChanges: Change[], callback: (err: Error, result: any) => void): void; /** @@ -2176,13 +2037,11 @@ declare namespace l { * @param {Change} change * @end */ - static findOrCreateChange(modelName: string, modelId: string, callback: (err: Error, change: Change) => void): void; /** * Get the checkpoint model. */ - static getCheckpointModel(): void; /** @@ -2190,7 +2049,6 @@ declare namespace l { * **Default: `sha1`* * @param {string} str The string to be hashed */ - static hash(str: string): void; /** @@ -2198,14 +2056,12 @@ declare namespace l { * @param {string} modelName * @param {string} modelId */ - static idForModel(modelName: string, modelId: string): void; /** * Correct all change list entries. * @param {() => void} c */ - static rectifyAll(cb: () => void): void; /** @@ -2216,14 +2072,12 @@ declare namespace l { * @param {Error} err * @param {Array} changes Changes that were tracke */ - static rectifyModelChanges(modelName: string, modelIds: any[], callback: (err: Error, changes: any[]) => void): void; /** * Get the revision string for the given object * @param {any} inst The data to get the revision string for */ - static revisionForInst(inst: any): void; /** @@ -2231,7 +2085,6 @@ declare namespace l { * @param {Change} change * @return {boolean */ - conflictsWith(change: Change): void; /** @@ -2240,20 +2093,17 @@ declare namespace l { * @param {Error} err * @param {string} rev The current revisio */ - currentRevision(callback: (err: Error, rev: string) => void): void; /** * Compare two changes. * @param {Change} change */ - equals(change: Change): void; /** * Get the `Model` class for `change.modelName`. */ - getModelCtor(): void; /** @@ -2261,7 +2111,6 @@ declare namespace l { * @param {Change} change * @return {boolean */ - isBasedOn(change: Change): void; /** @@ -2270,7 +2119,6 @@ declare namespace l { * @param {Error} err * @param {Change} chang */ - rectify(callback: (err: Error, change: Change) => void): void; /** @@ -2280,7 +2128,6 @@ declare namespace l { * - `Change.DELETE` * - `Change.UNKNOWN */ - type(): void; } @@ -2295,7 +2142,6 @@ declare namespace l { * @property {ModelClass} target The target model instance * @class Change.Conflic */ - class Conflict { source: any; target: any; @@ -2308,7 +2154,6 @@ declare namespace l { * @param {Change} sourceChange * @param {Change} targetChang */ - changes(callback: (err: Error, sourceChange: Change, targetChange: Change) => void): void; /** @@ -2318,7 +2163,6 @@ declare namespace l { * @param {PersistedModel} source * @param {PersistedModel} targe */ - models(callback: (err: Error, source: PersistedModel, target: PersistedModel) => void): void; /** @@ -2331,7 +2175,6 @@ declare namespace l { * @callback {() => void} callback * @param {Error} err */ - resolve(callback: (err: Error) => void): void; /** @@ -2341,7 +2184,6 @@ declare namespace l { * @callback {() => void} callback * @param {Error} err */ - resolveManually(data: any, callback: (err: Error) => void): void; /** @@ -2349,7 +2191,6 @@ declare namespace l { * @callback {() => void} callback * @param {Error} err */ - resolveUsingSource(callback: (err: Error) => void): void; /** @@ -2357,7 +2198,6 @@ declare namespace l { * @callback {() => void} callback * @param {Error} err */ - resolveUsingTarget(callback: (err: Error) => void): void; /** @@ -2370,7 +2210,6 @@ declare namespace l { * ``` * @returns {Conflict} A new Conflict instance */ - swapParties(): Conflict; /** @@ -2385,7 +2224,6 @@ declare namespace l { * @param {Error} err * @param {string} type The conflict type */ - type(callback: (err: Error, type: string) => void): void; } @@ -2399,7 +2237,6 @@ declare namespace l { * @class Email * @inherits {Model} */ - class Email extends Model { /** Email addressee. Required. */ to: string; @@ -2438,15 +2275,12 @@ declare namespace l { * @prop {string} html Body HTML (optional) * @param {() => void} callback Called after the e-mail is sent or the sending faile */ - static send(callback: () => void, options: { from: string; to: string; subject: string; text: string; html: string; }): void; /** * A shortcut for Email.send(this). */ - send(): void; - } /** @@ -2454,7 +2288,6 @@ declare namespace l { * @class */ class KeyValueModel { - /** * Set the TTL (time to live) in ms (milliseconds) for a given key. * TTL is the remaining time before a key-value pair is discarded from the database. @@ -2470,7 +2303,6 @@ declare namespace l { * @param {any} options * @param {() => void} callback */ - static expire(key: string, ttl: number, options: any, callback: () => void): PromiseLike; /** @@ -2487,7 +2319,6 @@ declare namespace l { * @param {any} options * @param {() => void} callback */ - static get(key: string, option?: any, callback?: (err: Error, result: any) => void): PromiseLike; /** @@ -2529,7 +2360,6 @@ declare namespace l { * @param {any} filter.options * @return {any} result AsyncIterator An Object implementing next(cb) -> Promise function that can be used to iterate all keys. */ - static iterateKeys(filter: {match: string; options: any}): any; /** @@ -2550,7 +2380,6 @@ declare namespace l { * @param {() => void} callback * @return {PromiseLike} */ - static keys(filter: {match: string; options: any}, callback: () => void): PromiseLike; /** @@ -2568,7 +2397,6 @@ declare namespace l { * @param {number|any} Optional settings for the key-value pair. If a Number is provided, it is set as the TTL (time to live) in ms (milliseconds) for the key-value pair. * @param {() => void} callback */ - static set(key: string, value: any, options?: number|any, callback?: (err: Error) => void): PromiseLike; /** @@ -2583,7 +2411,6 @@ declare namespace l { * @param {any} options * @param {() => void} callback */ - static ttl(key: string, options?: any, cb?: (error: Error) => void): PromiseLike; } @@ -2592,7 +2419,6 @@ declare namespace l { * @class Role * @header Role objec */ - class Role { /** * List roles for a given principal. @@ -2601,7 +2427,6 @@ declare namespace l { * @param {Error} err Error object. * @param {string[]} roles An Array of role IDs */ - static getRoles(context: any, callback: (err: Error, roles: string[]) => void): void; /** @@ -2610,7 +2435,6 @@ declare namespace l { * @param {Error} err Error object. * @param {boolean} isAuthenticated True if the user is authenticated. */ - static isAuthenticated(context: any, callback: (err: Error, isAuthenticated: boolean) => void): void; /** @@ -2621,7 +2445,6 @@ declare namespace l { * @param {Error} err Error object. * @param {boolean} isInRole True if the principal is in the specified role. */ - static isInRole(role: string, context: any, callback: (err: Error, isInRole: boolean) => void): void; /** @@ -2631,7 +2454,6 @@ declare namespace l { * @param {*} userId The user ID * @param {() => void} callback Callback function */ - static isOwner(modelClass: () => void, modelId: any, userId: any, callback: () => void): void; /** @@ -2641,7 +2463,6 @@ declare namespace l { * if a principal is in the specified role. * Should provide a callback or return a promise. */ - static registerResolver(role: string, resolver: () => void): void; } @@ -2653,9 +2474,7 @@ declare namespace l { * @class RoleMapping * @inherits {PersistedModel} */ - class RoleMapping extends PersistedModel { - /** Generated ID. */ id: string; @@ -2671,7 +2490,6 @@ declare namespace l { * @param {Error} err * @param {Application} application */ - application(callback: (err: Error, application: Application) => void): void; /** @@ -2680,7 +2498,6 @@ declare namespace l { * @param {Error} err * @param {User} childUser */ - childRole(callback: (err: Error, childUser: User) => void): void; /** @@ -2689,7 +2506,6 @@ declare namespace l { * @param {Error} err * @param {User} user */ - user(callback: (err: Error, user: User) => void): void; } @@ -2700,9 +2516,7 @@ declare namespace l { * Scope has many resource access entrie * @class scope */ - class Scope { - /** * Check if the given scope is allowed to access the model/property * @param {string} scope The scope name @@ -2713,9 +2527,7 @@ declare namespace l { * @param {string|Error} err The error object * @param {AccessRequest} result The access permission */ - static checkPermission(scope: string, model: string, property: string, accessType: string, callback: (err: string|Error, result: AccessRequest) => void): void; - } /** @@ -2755,9 +2567,7 @@ declare namespace l { * @class User * @inherits {PersistedModel} */ - class User extends PersistedModel { - /** Must be unique. */ username: string; @@ -2819,7 +2629,6 @@ declare namespace l { * @callback {() => void} callback * @param {Error} er */ - static confirm(userId: any, token: string, redirect: string, callback: (err: Error) => void): void; /** @@ -2831,7 +2640,6 @@ declare namespace l { * @param {any} user The User this token is being generated for. * @param {() => void} cb The generator must pass back the new token with this function cal */ - static generateVerificationToken(user: any, cb: () => void): void; /** @@ -2850,7 +2658,6 @@ declare namespace l { * @param {Error} err Error object * @param {AccessToken} token Access token if login is successfu */ - static login(credentials: any, include?: string[]|string, callback?: (err: Error, token: AccessToken) => void): void; /** @@ -2866,7 +2673,6 @@ declare namespace l { * @callback {() => void} callback * @param {Error} er */ - static logout(accessTokenID: string, callback: (err: Error) => void): void; /** @@ -2876,7 +2682,6 @@ declare namespace l { * @param {string} realmDelimiter The realm delimiter, if not set, no realm is needed * @returns {any} The normalized credential objec */ - static normalizeCredentials(credentials: any, realmRequired: boolean, realmDelimiter: string): any; /** @@ -2887,7 +2692,6 @@ declare namespace l { * @callback {() => void} callback * @param {Error} er */ - static resetPassword(options: {}, callback: (err: Error) => void): void; /** @@ -2899,7 +2703,6 @@ declare namespace l { * @param {string|Error} err The error string or object * @param {AccessToken} token The generated access token object */ - createAccessToken(ttl: number, options?: any, cb?: (err: string|Error, token: AccessToken) => void): void; /** @@ -2909,7 +2712,6 @@ declare namespace l { * @param {Error} err Error object * @param {boolean} isMatch Returns true if the given `password` matches recor */ - hasPassword(password: string, callback: (err: Error, isMatch: boolean) => void): void; /** @@ -2943,10 +2745,8 @@ declare namespace l { * object, instead simply execute the callback with the token! User saving * and email sending will be handled in the `verify()` method */ - verify(options: {type: string, to: string, from: string, subject: string, text: string, template: string, redirect: string, generateVerificationToken: () => void}): void; } } export = l; - diff --git a/types/loopback/loopback-tests.ts b/types/loopback/loopback-tests.ts index b21bf8c759..938891912a 100644 --- a/types/loopback/loopback-tests.ts +++ b/types/loopback/loopback-tests.ts @@ -16,4 +16,4 @@ class Server { // start the web server }; } -} \ No newline at end of file +} diff --git a/types/lz-string/lz-string-tests.ts b/types/lz-string/lz-string-tests.ts index e9bffed120..0ad913265d 100644 --- a/types/lz-string/lz-string-tests.ts +++ b/types/lz-string/lz-string-tests.ts @@ -1,9 +1,7 @@ - - -var input = "Someting to compress"; -var encoded: string; -var decoded: string; -var encodedU8: Uint8Array; +const input = "Someting to compress"; +let encoded: string; +let decoded: string; +let encodedU8: Uint8Array; encoded = LZString.compress(input); decoded = LZString.decompress(encoded); @@ -14,4 +12,4 @@ decoded = LZString.decompressFromBase64(encoded); encoded = LZString.compressToEncodedURIComponent(input); decoded = LZString.compressToEncodedURIComponent(encoded); encodedU8 = LZString.compressToUint8Array(input); -decoded = LZString.decompressFromUint8Array(encodedU8); \ No newline at end of file +decoded = LZString.decompressFromUint8Array(encodedU8); diff --git a/types/modernizr/modernizr-tests.ts b/types/modernizr/modernizr-tests.ts index 3e62ae478e..ece0cecb5d 100644 --- a/types/modernizr/modernizr-tests.ts +++ b/types/modernizr/modernizr-tests.ts @@ -1,13 +1,11 @@ - - -declare var $: any; +declare const $: any; window.alert = (thing?: string) => { $('#content').append('
' + thing + '
'); }; $(() => { - var audio = new Audio(); + const audio = new Audio(); audio.src = Modernizr.audio.ogg ? 'background.ogg' : Modernizr.audio.mp3 ? 'background.mp3' : 'background.m4a'; @@ -15,13 +13,13 @@ $(() => { if (Modernizr.webgl) { // loadAllWebGLScripts(); } else { - var msg = 'With a different browser you’ll get to see the WebGL experience here: get.webgl.org.'; + const msg = 'With a different browser you’ll get to see the WebGL experience here: get.webgl.org.'; document.getElementById('#notice').innerHTML = msg; } Modernizr.prefixed('boxSizing'); Modernizr.prefixed('requestAnimationFrame', window); - var ms = Modernizr.prefixed("matchesSelector", HTMLElement.prototype, true); + const ms = Modernizr.prefixed("matchesSelector", HTMLElement.prototype, true); Modernizr.prefixed('requestAnimationFrame', window, false); Modernizr.mq('only all and (max-width: 400px)'); @@ -29,7 +27,7 @@ $(() => { Modernizr.mq('only screen and (max-width: 768px)'); Modernizr.addTest('track', () => { - var video = document.createElement('video'); + const video = document.createElement('video'); return typeof video.addTextTrack === 'function'; }); @@ -45,7 +43,7 @@ $(() => { Modernizr.testAllProps('boxSizing'); - var elem: Element; + const elem: Element = null as any; Modernizr.hasEvent('gesturestart', elem); if (!Modernizr.input.autofocus) { @@ -53,7 +51,6 @@ $(() => { } }); - Modernizr.on('flash', result => { if (result) { // the browser has flash @@ -63,22 +60,22 @@ Modernizr.on('flash', result => { }); Modernizr.addTest('itsTuesday', () => { - var d = new Date(); + const d = new Date(); return d.getDay() === 2; }); Modernizr.addTest('hasJquery', 'jQuery' in window); -var detects = { +const detects = { hasjquery: 'jQuery' in window, itstuesday: () => { - var d = new Date(); + const d = new Date(); return d.getDay() === 2; } }; Modernizr.addTest(detects); -var keyframes = Modernizr.atRule('@keyframes'); +const keyframes = Modernizr.atRule('@keyframes'); if (keyframes) { // keyframes are supported // could be `@-webkit-keyframes` or `@keyframes` @@ -92,25 +89,25 @@ Modernizr.hasEvent('blur'); // true; Modernizr.hasEvent('devicelight', window); // true; -var query = Modernizr.mq('(min-width: 900px)'); +const query = Modernizr.mq('(min-width: 900px)'); if (query) { // the browser window is larger than 900px } Modernizr.prefixed('boxSizing'); -var raf = Modernizr.prefixed('requestAnimationFrame', window); +const raf = Modernizr.prefixed('requestAnimationFrame', window); raf(() => { }); -var rAFProp = Modernizr.prefixed('requestAnimationFrame', window, false); +const rAFProp = Modernizr.prefixed('requestAnimationFrame', window, false); rAFProp === 'WebkitRequestAnimationFrame'; // in older webkit Modernizr.prefixedCSS('transition'); // '-moz-transition' in old Firefox Modernizr.prefixedCSSValue('background', 'linear-gradient(left, red, red)'); -var rule = Modernizr._prefixes.join('transform: rotate(20deg); '); +let rule = Modernizr._prefixes.join('transform: rotate(20deg); '); rule === 'transform: rotate(20deg); webkit-transform: rotate(20deg); moz-transform: rotate(20deg); o-transform: rotate(20deg); ms-transform: rotate(20deg);'; rule = 'display:' + Modernizr._prefixes.join('flex; display:') + 'flex'; diff --git a/types/modesl/index.d.ts b/types/modesl/index.d.ts index 6b1c532bd3..95d34599f6 100644 --- a/types/modesl/index.d.ts +++ b/types/modesl/index.d.ts @@ -104,4 +104,3 @@ export class Server extends EventEmitter { export function eslSetLogLevel(level: any): void; export function setLogLevel(level: any): void; - diff --git a/types/modesl/modesl-tests.ts b/types/modesl/modesl-tests.ts index c3788833d0..6b40281f95 100644 --- a/types/modesl/modesl-tests.ts +++ b/types/modesl/modesl-tests.ts @@ -4,7 +4,6 @@ const freeswitchListener = new modesl.Server(() => { // console.log('Server listening on localhost at port 8022'); }); - const freeswitchConnection = new modesl.Connection("freeswitch-host", 8021, 'password', () => { // console.log('connection initialized'); @@ -31,4 +30,3 @@ const freeswitchConnection = new modesl.Connection("freeswitch-host", 8021, 'pas }); }); }); - diff --git a/types/moment-business/index.d.ts b/types/moment-business/index.d.ts index 90ff725c63..9d400c62dd 100644 --- a/types/moment-business/index.d.ts +++ b/types/moment-business/index.d.ts @@ -2,14 +2,12 @@ // Project: https://github.com/jmeas/moment-business // Definitions by: Greg Sieranski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - + import * as moment from "moment"; - -declare module "moment-business" { - export function weekDays(startMoment: moment.Moment, endMoment: moment.Moment): number - export function weekendDays(startMoment: moment.Moment, endMoment: moment.Moment): number - export function addWeekDays(moment: moment.Moment, amount: number): moment.Moment - export function subtractWeekDays(moment: moment.Moment, amount: number): moment.Moment - export function isWeekDay(moment: moment.Moment): boolean - export function isWeekendDay(moment: moment.Moment): boolean -} + +export function weekDays(startMoment: moment.Moment, endMoment: moment.Moment): number; +export function weekendDays(startMoment: moment.Moment, endMoment: moment.Moment): number; +export function addWeekDays(moment: moment.Moment, amount: number): moment.Moment; +export function subtractWeekDays(moment: moment.Moment, amount: number): moment.Moment; +export function isWeekDay(moment: moment.Moment): boolean; +export function isWeekendDay(moment: moment.Moment): boolean; diff --git a/types/moment-business/moment-business-tests.ts b/types/moment-business/moment-business-tests.ts index 75f5c23b84..4f8ae296df 100644 --- a/types/moment-business/moment-business-tests.ts +++ b/types/moment-business/moment-business-tests.ts @@ -1,9 +1,9 @@ import * as moment from "moment"; import * as mb from "moment-business"; - -let a = mb.isWeekDay(moment()) -let b = mb.isWeekendDay(moment()); -let c = mb.addWeekDays(moment(), 1); -let d = mb.subtractWeekDays(moment(), 1); -let e = mb.weekDays(moment(), moment()); -let f = mb.weekendDays(moment(), moment()); + +mb.isWeekDay(moment()); +mb.isWeekendDay(moment()); +mb.addWeekDays(moment(), 1); +mb.subtractWeekDays(moment(), 1); +mb.weekDays(moment(), moment()); +mb.weekendDays(moment(), moment()); diff --git a/types/moment-timezone/moment-timezone-tests.ts b/types/moment-timezone/moment-timezone-tests.ts index 2d728fc70e..7355142466 100644 --- a/types/moment-timezone/moment-timezone-tests.ts +++ b/types/moment-timezone/moment-timezone-tests.ts @@ -1,18 +1,16 @@ - - import moment = require('moment-timezone'); -var june = moment("2014-06-01T12:00:00Z"); +const june = moment("2014-06-01T12:00:00Z"); june.tz('America/Los_Angeles').format('ha z'); -var a = moment.tz("2013-11-18 11:55", "America/Toronto"); -var b = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", "America/Toronto"); -var c = moment.tz(1403454068850, "America/Toronto"); -var d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto"); +const a = moment.tz("2013-11-18 11:55", "America/Toronto"); +const b = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", "America/Toronto"); +const c = moment.tz(1403454068850, "America/Toronto"); +const d = moment.tz("May 12th 2014 8PM", "MMM Do YYYY hA", true, "America/Toronto"); a.tz(); -var num = 1367337600000, +const num = 1367337600000, arr = [2013, 5, 1], str = "2013-12-01", date = new Date(2013, 4, 1), @@ -53,7 +51,7 @@ moment.tz(obj, "America/Los_Angeles"); moment.tz.zone('America/Los_Angeles').abbr(1403465838805); moment.tz.zone('America/Los_Angeles').offset(1403465838805); -var zone = moment.tz.zone('America/New_York'); +const zone = moment.tz.zone('America/New_York'); zone.parse(Date.UTC(2012, 2, 19, 8, 30)); // 240 moment.tz.add('America/Los_Angeles|PST PDT|80 70|0101|1Lzm0 1zb0 Op0'); @@ -80,7 +78,6 @@ moment.tz.setDefault('America/Los_Angeles'); moment.tz.guess(); -var zoneAbbr: string = moment.tz('America/Los_Angeles').zoneAbbr(); - -var zoneName: string = moment.tz('America/Los_Angeles').zoneName(); +const zoneAbbr: string = moment.tz('America/Los_Angeles').zoneAbbr(); +const zoneName: string = moment.tz('America/Los_Angeles').zoneName(); diff --git a/types/node-waves/index.d.ts b/types/node-waves/index.d.ts index ce5c63da2e..60114e79e8 100644 --- a/types/node-waves/index.d.ts +++ b/types/node-waves/index.d.ts @@ -21,7 +21,6 @@ export interface WavesConfig { } export interface RippleOptions { - /** * Specify how long to wait between starting and stopping the ripple. * diff --git a/types/node-waves/node-waves-tests.ts b/types/node-waves/node-waves-tests.ts index adfb59703a..b9eac6682e 100644 --- a/types/node-waves/node-waves-tests.ts +++ b/types/node-waves/node-waves-tests.ts @@ -1,4 +1,3 @@ - import { init, ripple, attach, calm } from "node-waves"; init({ delay: 300 }); diff --git a/types/openfin/index.d.ts b/types/openfin/index.d.ts index 994a64939f..e6c11d0180 100644 --- a/types/openfin/index.d.ts +++ b/types/openfin/index.d.ts @@ -8,16 +8,16 @@ /** * JavaScript API - * The JavaScript API allows you to create an HTML/JavaScript application that has access to the native windowing environment, + * The JavaScript API allows you to create an HTML/JavaScript application that has access to the native windowing environment, * can communicate with other applications and has access to sandboxed system-level features. * * API Ready - * When using the OpenFin API, it is important to ensure that it has been fully loaded before making any API calls. To verify - * that the API is in fact ready, be sure to make any API calls either from within the fin.desktop.main() method or explicitly + * When using the OpenFin API, it is important to ensure that it has been fully loaded before making any API calls. To verify + * that the API is in fact ready, be sure to make any API calls either from within the fin.desktop.main() method or explicitly * after it has returned. This avoids the situation of trying to access methods that are not yet fully injected. * * Overview - * When running within the OpenFin Runtime your web applications have access to the "fin" namespace and all the modules within the API + * When running within the OpenFin Runtime your web applications have access to the "fin" namespace and all the modules within the API * without the need to include additional source files. You can treat the "fin" namespace as you would the "window", "navigator" or "document" objects. **/ declare namespace fin { @@ -136,8 +136,8 @@ declare namespace fin { */ scheduleRestart(callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Sets new shortcut configuration for current application. - * Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest to + * Sets new shortcut configuration for current application. + * Application has to be launched with a manifest and has to have shortcut configuration (icon url, name, etc.) in its manifest to * be able to change shortcut states. */ setShortcuts(config: ShortCutConfig, callback?: () => void, errorCallback?: (reason: string) => void): void; @@ -150,7 +150,7 @@ declare namespace fin { */ terminate(callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Waits for a hanging application. This method can be called in response to an application "not-responding" to allow the application + * Waits for a hanging application. This method can be called in response to an application "not-responding" to allow the application * to continue and to generate another "not-responding" message after a certain period of time. */ wait(callback?: () => void, errorCallback?: (reason: string) => void): void; @@ -244,8 +244,8 @@ declare namespace fin { */ customData?: any; /** - * Specifies that the window will be positioned in the center of the primary monitor when loaded for the first time on a machine. - * When the window corresponding to that id is loaded again, the position from before the window was closed is used. + * Specifies that the window will be positioned in the center of the primary monitor when loaded for the first time on a machine. + * When the window corresponding to that id is loaded again, the position from before the window was closed is used. * This option overrides defaultLeft and defaultTop. Default: false. */ defaultCentered?: boolean; @@ -260,12 +260,12 @@ declare namespace fin { */ defaultWidth?: number; /** - * The default top position of the window. Specifies the position of the top of the window when loaded for the first time on a machine. + * The default top position of the window. Specifies the position of the top of the window when loaded for the first time on a machine. * When the window corresponding to that id is loaded again, the value of top is taken to be the last value before the window was closed. Default: 100. */ defaultTop?: number; /** - * The default width of the window. Specifies the width of the window when loaded for the first time on a machine. + * The default width of the window. Specifies the width of the window when loaded for the first time on a machine. * When the window corresponding to that id is loaded again, the width is taken to be the last width of the window before it was closed. Default: 800. */ defaultLeft?: number; @@ -364,7 +364,7 @@ declare namespace fin { */ url?: string; /** - * When set to false, the window will render before the "load" event is fired on the content's window. + * When set to false, the window will render before the "load" event is fired on the content's window. * Caution, when false you will see an initial empty white window. Default: true. */ waitForPageLoad?: boolean; @@ -463,7 +463,7 @@ declare namespace fin { send(destinationUuid: string, name: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; send(destinationUuid: string, topic: string, message: any, callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Subscribes to messages from the specified application on the specified topic. If the subscription is for a uuid, [name], + * Subscribes to messages from the specified application on the specified topic. If the subscription is for a uuid, [name], * topic combination that has already been published to upon subscription you will receive the last 20 missed messages in the order they were published. */ subscribe(senderUuid: string, name: string, topic: string, listener: (message: any, uuid: string, name: string) => void, @@ -492,8 +492,8 @@ declare namespace fin { /** * Notification - * Notification represents a window on OpenFin Runtime which is shown briefly to the user on the bottom-right corner of the primary monitor. - * A notification is typically used to alert the user of some important event which requires his or her attention. + * Notification represents a window on OpenFin Runtime which is shown briefly to the user on the bottom-right corner of the primary monitor. + * A notification is typically used to alert the user of some important event which requires his or her attention. * Notifications are a child or your application that are controlled by the runtime. */ interface OpenFinNotification { @@ -533,8 +533,8 @@ declare namespace fin { */ onClick?(callback: () => void): void; /** - * Invoked when the notification is closed via .close() method on the created notification instance - * or the by the notification itself via fin.desktop.Notification.getCurrent().close(). + * Invoked when the notification is closed via .close() method on the created notification instance + * or the by the notification itself via fin.desktop.Notification.getCurrent().close(). * NOTE: this is not invoked when the notification is dismissed via a swipe. For the swipe dismissal callback see onDismiss */ onClose?(callback: () => void): void; @@ -559,7 +559,7 @@ declare namespace fin { /** * System - * An object representing the core of OpenFin Runtime. + * An object representing the core of OpenFin Runtime. * Allows the developer to perform system-level actions, such as accessing logs, viewing processes, clearing the cache and exiting the runtime. */ interface OpenFinSystem { @@ -574,7 +574,7 @@ declare namespace fin { listener: (event: SystemBaseEvent | DesktopIconClickedEvent | IdleStateChangedEvent | MonitorInfoChangedEvent | SessionChangedEvent) => void, callback?: () => void, errorCallback?: (reason: string) => void): void; /** - * Clears cached data containing window state/positions, + * Clears cached data containing window state/positions, * application resource files (images, HTML, JavaScript files), cookies, and items stored in the Local Storage. */ clearCache(options: CacheOptions, callback?: () => void, errorCallback?: (reason: string) => void): void; @@ -636,7 +636,7 @@ declare namespace fin { */ getMousePosition(callback?: (mousePosition: VirtualScreenCoordinates) => void, errorCallback?: (reason: string) => void): void; /** - * Retrieves an array of all of the runtime processes that are currently running. + * Retrieves an array of all of the runtime processes that are currently running. * Each element in the array is an object containing the uuid and the name of the application to which the process belongs. */ getProcessList(callback?: (processInfoList: ProcessInfo[]) => void, errorCallback?: (reason: string) => void): void; @@ -706,7 +706,6 @@ declare namespace fin { * Update the OpenFin Runtime Proxy settings. */ updateProxySettings(type: string, address: string, port: number, callback?: () => void, errorCallback?: (reason: string) => void): void; - } interface CacheOptions { @@ -999,8 +998,8 @@ declare namespace fin { * * Creates a new OpenFin Window * - * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, - * maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. + * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, + * maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. * The new window appears in the same process as the parent window. * @param {any} options - The options of the window * @param {Function} [callback] - Called if the window creation was successful @@ -1021,8 +1020,8 @@ declare namespace fin { /** * Window - * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, - * maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. + * A basic window that wraps a native HTML window. Provides more fine-grained control over the window state such as the ability to minimize, + * maximize, restore, etc. By default a window does not show upon instantiation; instead the window's show() method must be invoked manually. * The new window appears in the same process as the parent window. */ interface OpenFinWindow { @@ -1031,9 +1030,9 @@ declare namespace fin { */ name: string; /** - * Returns the native JavaScript "window" object for the window. This method can only be used by the parent application or the window itself, - * otherwise it will return undefined. The same Single-Origin-Policy (SOP) rules apply for child windows created by window.open(url) in that the - * contents of the window object are only accessible if the URL has the same origin as the invoking window. See example below. + * Returns the native JavaScript "window" object for the window. This method can only be used by the parent application or the window itself, + * otherwise it will return undefined. The same Single-Origin-Policy (SOP) rules apply for child windows created by window.open(url) in that the + * contents of the window object are only accessible if the URL has the same origin as the invoking window. See example below. * Also, will not work with fin.desktop.Window objects created with fin.desktop.Window.wrap(). * @returns {Window} Native window */ @@ -1109,7 +1108,7 @@ declare namespace fin { */ getBounds(callback?: (bounds: WindowBounds) => void, errorCallback?: (reason: string) => void): void; /** - * Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this window. If a window is not in a group an empty array is returned. + * Retrieves an array containing wrapped fin.desktop.Windows that are grouped with this window. If a window is not in a group an empty array is returned. * Please note that calling window is included in the result array. */ getGroup(callback?: (group: OpenFinWindow[]) => void, errorCallback?: (reason: string) => void): void; @@ -1686,4 +1685,4 @@ declare namespace fin { | "top-right" | "bottom-left" | "bottom-right"; -} \ No newline at end of file +} diff --git a/types/openfin/openfin-tests.ts b/types/openfin/openfin-tests.ts index 6693408eec..95ed176fb1 100644 --- a/types/openfin/openfin-tests.ts +++ b/types/openfin/openfin-tests.ts @@ -46,7 +46,7 @@ function test_application() { application.getGroups(allGroups => { console.log("There are a total of " + allGroups.length + " groups."); - var groupCounter = 1; + let groupCounter = 1; allGroups.forEach(windowGroup => { console.log("Group " + groupCounter + " contains " + windowGroup.length + " windows."); @@ -548,7 +548,7 @@ function test_window() { resizable: false, state: "normal" }, () => { - var _win = finWindow.getNativeWindow(); + const _win = finWindow.getNativeWindow(); _win.addEventListener("DOMContentLoaded", () => { finWindow.show(); }); }, error => { console.log("Error creating window:", error); @@ -725,4 +725,4 @@ function test_window() { frame: false, maxWidth: 500 }); -} \ No newline at end of file +} diff --git a/types/parse-unit/parse-unit-tests.ts b/types/parse-unit/parse-unit-tests.ts index 772641c302..dd5dcb7e9f 100644 --- a/types/parse-unit/parse-unit-tests.ts +++ b/types/parse-unit/parse-unit-tests.ts @@ -1,4 +1,4 @@ -import parse = require('parse-unit') -let [number, length] = parse('10px') -number === 50 -length === 'px' +import parse = require('parse-unit'); +const [number, length] = parse('10px'); +number === 50; +length === 'px'; diff --git a/types/parsimmon/index.d.ts b/types/parsimmon/index.d.ts index ee196dd1ff..718fc1246d 100644 --- a/types/parsimmon/index.d.ts +++ b/types/parsimmon/index.d.ts @@ -42,9 +42,9 @@ declare function Parsimmon(fn: (input: string, i: number) => Parsimmon.Result): Parsimmon.Parser; declare namespace Parsimmon { - export type StreamType = string; + type StreamType = string; - export interface Index { + interface Index { /** zero-based character offset */ offset: number; /** one-based line offset */ @@ -53,26 +53,26 @@ declare namespace Parsimmon { column: number; } - export interface Mark { + interface Mark { start: Index; end: Index; value: T; } - export type Result = Success | Failure; + type Result = Success | Failure; - export interface Success { + interface Success { status: true; value: T; } - export interface Failure { + interface Failure { status: false; expected: string[]; index: Index; } - export interface Parser { + interface Parser { /** * parse the string */ @@ -155,41 +155,41 @@ declare namespace Parsimmon { /** * Alias of `Parsimmon(fn)` for backwards compatibility. */ - export function Parser(fn: (input: string, i: number) => Parsimmon.Result): Parser; + function Parser(fn: (input: string, i: number) => Parsimmon.Result): Parser; /** * To be used inside of Parsimmon(fn). Generates an object describing how * far the successful parse went (index), and what value it created doing * so. See documentation for Parsimmon(fn). */ - export function makeSuccess(index: number, value: T): Success; + function makeSuccess(index: number, value: T): Success; /** * To be used inside of Parsimmon(fn). Generates an object describing how * far the unsuccessful parse went (index), and what kind of syntax it * expected to see (expectation). See documentation for Parsimmon(fn). */ - export function makeFailure(furthest: number, expectation: string): Failure; + function makeFailure(furthest: number, expectation: string): Failure; /** * Returns true if obj is a Parsimmon parser, otherwise false. */ - export function isParser(obj: any): boolean; + function isParser(obj: any): boolean; /** * is a parser that expects to find "my-string", and will yield the same. */ - export function string(string: string): Parser; + function string(string: string): Parser; /** * Returns a parser that looks for exactly one character from string, and yields that character. */ - export function oneOf(string: string): Parser; + function oneOf(string: string): Parser; /** * Returns a parser that looks for exactly one character NOT from string, and yields that character. */ - export function noneOf(string: string): Parser; + function noneOf(string: string): Parser; /** * Returns a parser that looks for a match to the regexp and yields the given match group @@ -197,145 +197,145 @@ declare namespace Parsimmon { * parse location. The regexp may only use the following flags: imu. Any other flag will * result in an error being thrown. */ - export function regexp(myregex: RegExp, group?: number): Parser; + function regexp(myregex: RegExp, group?: number): Parser; /** * This was the original name for Parsimmon.regexp, but now it is just an alias. */ - export function regex(myregex: RegExp, group?: number): Parser; + function regex(myregex: RegExp, group?: number): Parser; /** * Returns a parser that doesn't consume any of the string, and yields result. */ - export function succeed(result: U): Parser; + function succeed(result: U): Parser; /** * This is an alias for Parsimmon.succeed(result). */ - export function of(result: U): Parser; + function of(result: U): Parser; /** * accepts a variable number of parsers that it expects to find in order, yielding an array of the results. */ - export function seq(p1: Parser): Parser<[T]>; - export function seq(p1: Parser, p2: Parser): Parser<[T, U]>; - export function seq(p1: Parser, p2: Parser, p3: Parser): Parser<[T, U, V]>; - export function seq(p1: Parser, p2: Parser, p3: Parser, p4: Parser): Parser<[T, U, V, W]>; - export function seq(p1: Parser, p2: Parser, p3: Parser, p4: Parser, p5: Parser): Parser<[T, U, V, W, X]>; - export function seq(p1: Parser, p2: Parser, p3: Parser, p4: Parser, p5: Parser, p6: Parser): Parser<[T, U, V, W, X, Y]>; - export function seq(p1: Parser, p2: Parser, p3: Parser, p4: Parser, p5: Parser, p6: Parser, p7: Parser): Parser<[T, U, V, W, X, Y, Z]>; - export function seq(...parsers: Array>): Parser; - export function seq(...parsers: Array>): Parser; + function seq(p1: Parser): Parser<[T]>; + function seq(p1: Parser, p2: Parser): Parser<[T, U]>; + function seq(p1: Parser, p2: Parser, p3: Parser): Parser<[T, U, V]>; + function seq(p1: Parser, p2: Parser, p3: Parser, p4: Parser): Parser<[T, U, V, W]>; + function seq(p1: Parser, p2: Parser, p3: Parser, p4: Parser, p5: Parser): Parser<[T, U, V, W, X]>; + function seq(p1: Parser, p2: Parser, p3: Parser, p4: Parser, p5: Parser, p6: Parser): Parser<[T, U, V, W, X, Y]>; + function seq(p1: Parser, p2: Parser, p3: Parser, p4: Parser, p5: Parser, p6: Parser, p7: Parser): Parser<[T, U, V, W, X, Y, Z]>; + function seq(...parsers: Array>): Parser; + function seq(...parsers: Array>): Parser; /** * Takes the string passed to parser.parse(string) and the error returned from * parser.parse(string) and turns it into a human readable error message string. * Note that there are certainly better ways to format errors, so feel free to write your own. */ - export function formatError(string: string, error: Result): string; + function formatError(string: string, error: Result): string; /** * Matches all parsers sequentially, and passes their results as the arguments to a function. * Similar to calling Parsimmon.seq and then .map, but the values are not put in an array. */ - export function seqMap(p1: Parser, cb: (a1: T) => U): Parser; - export function seqMap(p1: Parser, p2: Parser, cb: (a1: T, a2: U) => V): Parser; - export function seqMap(p1: Parser, p2: Parser, p3: Parser, cb: (a1: T, a2: U, a3: V) => W): Parser; - export function seqMap(p1: Parser, p2: Parser, p3: Parser, p4: Parser, cb: (a1: T, a2: U, a3: V, a4: W) => X): Parser; - export function seqMap(p1: Parser, p2: Parser, p3: Parser, p4: Parser, p5: Parser, cb: (a1: T, a2: U, a3: V, a4: W, a5: X) => Y): Parser; - export function seqMap(p1: Parser, p2: Parser, p3: Parser, p4: Parser, p5: Parser, p6: Parser, cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y) => Z): Parser; - export function seqMap( + function seqMap(p1: Parser, cb: (a1: T) => U): Parser; + function seqMap(p1: Parser, p2: Parser, cb: (a1: T, a2: U) => V): Parser; + function seqMap(p1: Parser, p2: Parser, p3: Parser, cb: (a1: T, a2: U, a3: V) => W): Parser; + function seqMap(p1: Parser, p2: Parser, p3: Parser, p4: Parser, cb: (a1: T, a2: U, a3: V, a4: W) => X): Parser; + function seqMap(p1: Parser, p2: Parser, p3: Parser, p4: Parser, p5: Parser, cb: (a1: T, a2: U, a3: V, a4: W, a5: X) => Y): Parser; + function seqMap(p1: Parser, p2: Parser, p3: Parser, p4: Parser, p5: Parser, p6: Parser, cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y) => Z): Parser; + function seqMap( p1: Parser, p2: Parser, p3: Parser, p4: Parser, p5: Parser, p6: Parser, p7: Parser, cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y, a7: Z) => A): Parser
; - export function seqMap( + function seqMap( p1: Parser, p2: Parser, p3: Parser, p4: Parser, p5: Parser, p6: Parser, p7: Parser, p8: Parser, cb: (a1: T, a2: U, a3: V, a4: W, a5: X, a6: Y, a7: Z, a8: A) => B): Parser; - export type SuccessFunctionType = (index: number, result: U) => Result; - export type FailureFunctionType = (index: number, msg: string) => Result; - export type ParseFunctionType = (stream: StreamType, index: number) => Result; + type SuccessFunctionType = (index: number, result: U) => Result; + type FailureFunctionType = (index: number, msg: string) => Result; + type ParseFunctionType = (stream: StreamType, index: number) => Result; /** * allows to add custom primitive parsers. */ - export function custom(parsingFunction: (success: SuccessFunctionType, failure: FailureFunctionType) => ParseFunctionType): Parser; + function custom(parsingFunction: (success: SuccessFunctionType, failure: FailureFunctionType) => ParseFunctionType): Parser; /** * accepts a variable number of parsers, and yields the value of the first one that succeeds, * backtracking in between. */ - export function alt(...parsers: Array>): Parser; - export function alt(...parsers: Array>): Parser; + function alt(...parsers: Array>): Parser; + function alt(...parsers: Array>): Parser; /** * Accepts two parsers, and expects zero or more matches for content, separated by separator, yielding an array. */ - export function sepBy(content: Parser, separator: Parser): Parser; + function sepBy(content: Parser, separator: Parser): Parser; /** * This is the same as Parsimmon.sepBy, but matches the content parser at least once. */ - export function sepBy1(content: Parser, separator: Parser): Parser; + function sepBy1(content: Parser, separator: Parser): Parser; /** * accepts a function that returns a parser, which is evaluated the first time the parser is used. * This is useful for referencing parsers that haven't yet been defined. */ - export function lazy(f: () => Parser): Parser; - export function lazy(description: string, f: () => Parser): Parser; + function lazy(f: () => Parser): Parser; + function lazy(description: string, f: () => Parser): Parser; /** * fail paring with a message */ - export function fail(message: string): Parser; + function fail(message: string): Parser; /** * is equivalent to Parsimmon.regex(/[a-z]/i) */ - export var letter: Parser; + const letter: Parser; /** * is equivalent to Parsimmon.regex(/[a-z]*`/i) */ - export var letters: Parser; + const letters: Parser; /** * is equivalent to Parsimmon.regex(/[0-9]/) */ - export var digit: Parser; + const digit: Parser; /** * is equivalent to Parsimmon.regex(/[0-9]*`/) */ - export var digits: Parser; + const digits: Parser; /** * is equivalent to Parsimmon.regex(/\s+/) */ - export var whitespace: Parser; + const whitespace: Parser; /** * is equivalent to Parsimmon.regex(/\s*`/) */ - export var optWhitespace: Parser; + const optWhitespace: Parser; /** * consumes and yields the next character of the stream. */ - export var any: Parser; + const any: Parser; /** * consumes and yields the entire remainder of the stream. */ - export var all: Parser; + const all: Parser; /** * expects the end of the stream. */ - export var eof: Parser; + const eof: Parser; /** * is a parser that yields the current index of the parse. */ - export var index: Parser; + const index: Parser; /** * Returns a parser that yield a single character if it passes the predicate */ - export function test(predicate: (char: string) => boolean): Parser; + function test(predicate: (char: string) => boolean): Parser; /** * Returns a parser yield a string containing all the next characters that pass the predicate */ - export function takeWhile(predicate: (char: string) => boolean): Parser; + function takeWhile(predicate: (char: string) => boolean): Parser; } export = Parsimmon; diff --git a/types/parsimmon/parsimmon-tests.ts b/types/parsimmon/parsimmon-tests.ts index 6be7eb307a..e0ce697909 100644 --- a/types/parsimmon/parsimmon-tests.ts +++ b/types/parsimmon/parsimmon-tests.ts @@ -1,4 +1,3 @@ - import P = require('parsimmon'); import { Parser, Mark, Result, Index } from "parsimmon"; @@ -14,43 +13,35 @@ class Bar { // -- -- -- -- -- -- -- -- -- -- -- -- -- -var str: string; -var strArr: string[]; -var bool: boolean; -var num: number; -var index: Index; -var regex: RegExp; +let str: string; +let strArr: string[]; +let bool: boolean; +let num: number; +let index: Index; -var foo: Foo; -var bar: Bar; - -var strArr: string[]; -var fooArr: Foo[]; -var barArr: Bar[]; +let foo: Foo; +declare const bar: Bar; // -- -- -- -- -- -- -- -- -- -- -- -- -- -var strPar: Parser; -var numPar: Parser; -var voidPar: Parser; -var anyPar: Parser; -var indexPar: Parser; +let strPar: Parser; +let numPar: Parser; +let voidPar: Parser; +let anyPar: Parser; +let indexPar: Parser; -var fooPar: Parser; -var barPar: Parser; -var fooOrBarPar: Parser; +let fooPar: Parser; +let barPar: Parser; +let fooOrBarPar: Parser; // -- -- -- -- -- -- -- -- -- -- -- -- -- -var anyArrPar: Parser; - -var strArrPar: Parser; -var fooArrPar: Parser; -var barArrPar: Parser; +let strArrPar: Parser; +let fooArrPar: Parser; // -- -- -- -- -- -- -- -- -- -- -- -- -- -var fooMarkPar: Parser>; +let fooMarkPar: Parser>; const result = fooMarkPar.parse(str); if (result.status) { @@ -61,7 +52,7 @@ if (result.status) { // -- -- -- -- -- -- -- -- -- -- -- -- -- -var fooResult: Result; +let fooResult: Result; // https://github.com/Microsoft/TypeScript/issues/12882 if (fooResult.status === true) { @@ -126,13 +117,13 @@ fooPar = fooPar.desc(str); // -- -- -- -- -- -- -- -- -- -- -- -- -- strPar = P.string(str); -strPar = P.regex(regex); +strPar = P.regex(/rgx/); fooPar = P.succeed(foo); fooArrPar = P.seq(fooPar, fooPar); -var par: Parser<[Bar, Foo, number]> = P.seq(barPar, fooPar, numPar); -var par2: Parser = P.seq(barPar, fooPar, numPar).map(([a, b, c]: [Bar, Foo, number]) => 42); +const par: Parser<[Bar, Foo, number]> = P.seq(barPar, fooPar, numPar); +const par2: Parser = P.seq(barPar, fooPar, numPar).map(([a, b, c]: [Bar, Foo, number]) => 42); fooPar = P.custom((success, failure) => (stream, i) => { str = stream; num = i; return success(num, foo); }); fooPar = P.custom((success, failure) => (stream, i) => failure(num, str)); @@ -140,7 +131,6 @@ fooPar = P.custom((success, failure) => (stream, i) => failure(num, str)); fooPar = P.alt(fooPar, fooPar); anyPar = P.alt(barPar, fooPar, numPar); - fooPar = P.lazy(() => { return fooPar; }); diff --git a/types/qlik-visualizationextensions/index.d.ts b/types/qlik-visualizationextensions/index.d.ts index e5d5850423..97ffca8733 100644 --- a/types/qlik-visualizationextensions/index.d.ts +++ b/types/qlik-visualizationextensions/index.d.ts @@ -226,7 +226,7 @@ declare namespace BackendAPI { * Validation error. * REF(NxValidationError) */ - //?Type = REF(NxValidationError)? + // ?Type = REF(NxValidationError)? qError: INxValidationError; } @@ -2235,11 +2235,7 @@ declare namespace VisualizationAPI { } declare namespace ExtensionAPI { - - - interface IExtensionModel { - - } + interface IExtensionModel {} interface IExtensionComponent { model: IExtensionModel; @@ -2249,13 +2245,12 @@ declare namespace ExtensionAPI { component: IExtensionComponent; } - - //ExtensionAPI + // ExtensionAPI type SelectionModeType = "CONFIRM" | "QUICK"; interface IInitialProperties { - qHyperCubeDef?: any; //IHyperCubeDef; - qListObjectDef?: any; //IListObjectDef; + qHyperCubeDef?: any; // IHyperCubeDef; + qListObjectDef?: any; // IListObjectDef; fixed?: boolean; width?: number; percent?: boolean; @@ -2287,7 +2282,7 @@ declare namespace ExtensionAPI { // qHyperCubeDef: IVisualizationHyperCubeDef; // qListObjectDef: IVis - //[""]: + // [""]: } //#region IDefinition @@ -2451,7 +2446,7 @@ declare namespace ExtensionAPI { items: any; } - //?Das selbe wie Appearance? + // ?Das selbe wie Appearance? interface ISettings { uses: "settings"; min?: number; @@ -2468,16 +2463,17 @@ declare namespace ExtensionAPI { } declare module "qlik" { - var e: RootAPI.IRoot; export = e; + const e: RootAPI.IRoot; + export = e; } interface IQVAngular { /** - * Register a new directive with the compiler. - * - * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) - * @param directiveFactory An injectable directive factory function. - */ + * Register a new directive with the compiler. + * + * @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind) + * @param directiveFactory An injectable directive factory function. + */ directive(name: string, directiveFactory: ng.Injectable): void; directive(object: { [directiveName: string]: ng.Injectable }): void; @@ -2496,10 +2492,11 @@ interface IQVAngular { service(name: string, serviceConstructor: ng.Injectable): T; service(object: { [name: string]: ng.Injectable }): T; - //provider(name: string, serviceProviderFactory: ng.IServiceProviderFactory): void; - //provider(name: string, serviceProviderConstructor: ng.IServiceProviderClass): void; + // provider(name: string, serviceProviderFactory: ng.IServiceProviderFactory): void; + // provider(name: string, serviceProviderConstructor: ng.IServiceProviderClass): void; } declare module "qvangular" { - var e: IQVAngular; export = e; -} \ No newline at end of file + const e: IQVAngular; + export = e; +} diff --git a/types/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts b/types/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts index 76a71d22dc..0afce187e4 100644 --- a/types/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts +++ b/types/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts @@ -1,3 +1,3 @@ import qlik = require("qlik"); -const t = qlik.currApp(); \ No newline at end of file +const t = qlik.currApp(); diff --git a/types/rc-slider/index.d.ts b/types/rc-slider/index.d.ts index 704412eda6..37ce19ac59 100644 --- a/types/rc-slider/index.d.ts +++ b/types/rc-slider/index.d.ts @@ -7,11 +7,11 @@ import * as React from 'react'; declare namespace RcSliderClass { - export interface Marks { + interface Marks { [number: number]: JSX.Element | string | { style: any, label: string | JSX.Element }; } - export interface CommonApiProps { + interface CommonApiProps { /** * Additional CSS class for the root DOM node * @default '' @@ -100,8 +100,7 @@ declare namespace RcSliderClass { value?: number; } - - export interface RangeProps extends CommonApiProps { + interface RangeProps extends CommonApiProps { /** * Set initial positions of handles. * @default [0,0] @@ -128,7 +127,7 @@ declare namespace RcSliderClass { pushable?: boolean; } - export interface HandleProps extends CommonApiProps { + interface HandleProps extends CommonApiProps { /** * Class name */ @@ -152,5 +151,4 @@ declare namespace RcSliderClass { class Handle extends React.Component { } } - export = RcSliderClass; diff --git a/types/rc-slider/rc-slider-tests.tsx b/types/rc-slider/rc-slider-tests.tsx index f6e2442558..55c0674741 100644 --- a/types/rc-slider/rc-slider-tests.tsx +++ b/types/rc-slider/rc-slider-tests.tsx @@ -24,7 +24,7 @@ ReactDOM.render( marks={{ 1: "1" }} step={0.01} vertical={true} - handle={() => { return }} + handle={() => } included={true} disabled={false} dots={true} @@ -45,4 +45,4 @@ ReactDOM.render( allowCross={false} pushable={true} />, document.querySelector('.app') -); \ No newline at end of file +); diff --git a/types/react-color/lib/components/common/EditableInput.d.ts b/types/react-color/lib/components/common/EditableInput.d.ts index 78df9473f2..f786399c9e 100644 --- a/types/react-color/lib/components/common/EditableInput.d.ts +++ b/types/react-color/lib/components/common/EditableInput.d.ts @@ -16,4 +16,3 @@ export interface EditableInputProps extends ClassAttributes { } export default class EditableInput extends Component {} - diff --git a/types/react-color/react-color-tests.tsx b/types/react-color/react-color-tests.tsx index e4e6f2348b..71ed800375 100644 --- a/types/react-color/react-color-tests.tsx +++ b/types/react-color/react-color-tests.tsx @@ -1,22 +1,22 @@ -import * as React from "react" -import { StatelessComponent } from "react" -import { render } from "react-dom" +import * as React from "react"; +import { StatelessComponent } from "react"; +import { render } from "react-dom"; import { AlphaPicker, BlockPicker, ChromePicker, CirclePicker, CompactPicker, GithubPicker, HuePicker, MaterialPicker, PhotoshopPicker, SketchPicker, SliderPicker, SwatchesPicker, TwitterPicker, CustomPicker, InjectedColorProps, ColorResult, Color -} from "react-color" -import { Alpha, Checkboard, EditableInput, Hue, Saturation } from "react-color/lib/components/common" +} from "react-color"; +import { Alpha, Checkboard, EditableInput, Hue, Saturation } from "react-color/lib/components/common"; interface CustomProps extends InjectedColorProps { - color?: Color + color?: Color; } -var CustomComponent: StatelessComponent = (props: CustomProps) => { - function onChange (color: ColorResult) { - console.log(color) +const CustomComponent: StatelessComponent = (props: CustomProps) => { + function onChange(color: ColorResult) { + console.log(color); } return ( @@ -27,23 +27,23 @@ var CustomComponent: StatelessComponent = (props: CustomProps) => { - ) -} -var Custom = CustomPicker(CustomComponent) + ); +}; +const Custom = CustomPicker(CustomComponent); -var colors: Array = ["#000", "#333"] +const colors = ["#000", "#333"]; -render(, document.getElementById("main")) -render(, document.getElementById("main")) -render(, document.getElementById("main")) -render(, document.getElementById("main")) -render(, document.getElementById("main")) -render(, document.getElementById("main")) -render(, document.getElementById("main")) -render(, document.getElementById("main")) -render(, document.getElementById("main")) -render(, document.getElementById("main")) -render(, document.getElementById("main")) -render(, document.getElementById("main")) -render(, document.getElementById("main")) -render(, document.getElementById("main")) +render(, document.getElementById("main")); +render(, document.getElementById("main")); +render(, document.getElementById("main")); +render(, document.getElementById("main")); +render(, document.getElementById("main")); +render(, document.getElementById("main")); +render(, document.getElementById("main")); +render(, document.getElementById("main")); +render(, document.getElementById("main")); +render(, document.getElementById("main")); +render(, document.getElementById("main")); +render(, document.getElementById("main")); +render(, document.getElementById("main")); +render(, document.getElementById("main")); diff --git a/types/react-copy-to-clipboard/index.d.ts b/types/react-copy-to-clipboard/index.d.ts index 1b0c9e942e..e4a0948962 100644 --- a/types/react-copy-to-clipboard/index.d.ts +++ b/types/react-copy-to-clipboard/index.d.ts @@ -11,20 +11,17 @@ export as namespace CopyToClipboard; export = CopyToClipboard; declare namespace CopyToClipboard { - - export interface Options { + interface Options { debug: boolean; message: string; } - export interface Props { + interface Props { text: string; - onCopy?: (a: string) => void, + onCopy?: (a: string) => void; options?: Options; } - } declare class CopyToClipboard extends React.Component { } - diff --git a/types/react-copy-to-clipboard/react-copy-to-clipboard-tests.tsx b/types/react-copy-to-clipboard/react-copy-to-clipboard-tests.tsx index 195e7a8ceb..4d412f0257 100644 --- a/types/react-copy-to-clipboard/react-copy-to-clipboard-tests.tsx +++ b/types/react-copy-to-clipboard/react-copy-to-clipboard-tests.tsx @@ -1,4 +1,3 @@ - import * as React from "react"; import * as CopyToClipboard from "react-copy-to-clipboard"; diff --git a/types/react-day-picker/index.d.ts b/types/react-day-picker/index.d.ts index be90f72d07..8dc5fcd12e 100644 --- a/types/react-day-picker/index.d.ts +++ b/types/react-day-picker/index.d.ts @@ -7,7 +7,7 @@ import * as React from 'react'; declare namespace DayPicker { - export interface LocaleUtils { + interface LocaleUtils { formatDay(day: Date, locale: string): string; formatMonthTitle(month: Date, locale: string): string; formatWeekdayLong(weekday: number, locale: string): string; @@ -16,7 +16,7 @@ declare namespace DayPicker { getMonths(locale: string): [string, string, string, string, string, string, string, string, string, string, string, string]; } - export interface DateUtils { + interface DateUtils { addMonths(d: Date, n: number): Date; clone(d: Date): Date; isSameDay(d1: Date, d2: Date): Date; @@ -27,16 +27,16 @@ declare namespace DayPicker { isDayInRange(day: Date, range: RangeModifier): boolean; } - export interface CaptionElementProps { + interface CaptionElementProps { date: Date; - classNames: ClassNames, + classNames: ClassNames; localeUtils: LocaleUtils; locale: string; months: undefined; onClick?: React.MouseEventHandler; } - export interface NavbarElementProps { + interface NavbarElementProps { className: string; classNames: ClassNames; previousMonth: Date; @@ -51,14 +51,14 @@ declare namespace DayPicker { locale: string; } - export interface WeekdayElementProps { + interface WeekdayElementProps { weekday: number; className: string; localeUtils: LocaleUtils; locale: string; } - export interface ClassNames { + interface ClassNames { container: string; interactionDisabled: string; navBar: string; @@ -80,28 +80,26 @@ declare namespace DayPicker { outside: string; } - export interface RangeModifier { + interface RangeModifier { from: Date; to: Date; } - export interface BeforeModifier { + interface BeforeModifier { before: Date; } - export interface AfterModifier { + interface AfterModifier { after: Date; } - export interface FunctionModifier { - (date: Date): boolean; - } - export type Modifier = Date | RangeModifier | BeforeModifier | AfterModifier | FunctionModifier; + type FunctionModifier = (date: Date) => boolean; + type Modifier = Date | RangeModifier | BeforeModifier | AfterModifier | FunctionModifier; - export interface Modifiers { + interface Modifiers { today: Modifier | Modifier[]; outside: Modifier | Modifier[]; [other: string]: Modifier | Modifier[] | undefined; } - export interface Props { + interface Props { canChangeMonth?: boolean; captionElement?: React.ReactElement> | React.ComponentClass | diff --git a/types/react-day-picker/react-day-picker-tests.tsx b/types/react-day-picker/react-day-picker-tests.tsx index 8c2755f9b5..52da9e9735 100644 --- a/types/react-day-picker/react-day-picker-tests.tsx +++ b/types/react-day-picker/react-day-picker-tests.tsx @@ -16,6 +16,7 @@ DayPicker.DateUtils.clone(new Date()); DayPicker.DateUtils.isDayInRange(new Date(), { from: new Date(), to: new Date(2050) }); interface MyCaptionProps extends DayPicker.CaptionElementProps { + myProp: number; } class Caption extends React.Component { render() { @@ -32,8 +33,7 @@ class Caption extends React.Component { ); } } - - +; type CaptionElementProps = Partial; class CaptionElement extends React.Component { @@ -46,7 +46,7 @@ class CaptionElement extends React.Component {
{ localeUtils.formatMonthTitle(date, locale) }
- ) - } + ); + }; } - }/> + }/>; diff --git a/types/react-facebook-login/index.d.ts b/types/react-facebook-login/index.d.ts index 8716b03217..577846e4a5 100644 --- a/types/react-facebook-login/index.d.ts +++ b/types/react-facebook-login/index.d.ts @@ -7,8 +7,7 @@ import * as React from "react"; declare namespace ReactFacebookLogin { - - export interface ReactFacebookLoginProps { + interface ReactFacebookLoginProps { appId: string; callback: (userInfo: ReactFacebookLoginInfo) => void; @@ -33,19 +32,17 @@ declare namespace ReactFacebookLogin { xfbml?: boolean; } - export interface ReactFacebookLoginInfo { + interface ReactFacebookLoginInfo { id: string; name: string; } - export interface ReactFacebookLoginState { + interface ReactFacebookLoginState { isSdkLoaded?: boolean; isProcessing?: boolean; } - } -declare class ReactFacebookLogin extends React.Component { -} +declare class ReactFacebookLogin extends React.Component {} -export = ReactFacebookLogin; \ No newline at end of file +export = ReactFacebookLogin; diff --git a/types/react-facebook-login/react-facebook-login-tests.tsx b/types/react-facebook-login/react-facebook-login-tests.tsx index 7f0d89ea8f..0efd5aa548 100644 --- a/types/react-facebook-login/react-facebook-login-tests.tsx +++ b/types/react-facebook-login/react-facebook-login-tests.tsx @@ -22,7 +22,6 @@ ReactDOM.render( document.getElementById('demo') ); - ReactDOM.render( { - private responseFacebook(response: ReactFacebookLoginInfo) { console.log(response); } @@ -78,9 +76,7 @@ class MyComponent extends React.Component { } } - class MyComponent2 extends React.Component { - private responseFacebook(response: ReactFacebookLoginInfo) { console.log(response); } @@ -96,4 +92,3 @@ class MyComponent2 extends React.Component { ); } } - diff --git a/types/react-joyride/react-joyride-tests.tsx b/types/react-joyride/react-joyride-tests.tsx index 9674560f5e..68e11ba94c 100644 --- a/types/react-joyride/react-joyride-tests.tsx +++ b/types/react-joyride/react-joyride-tests.tsx @@ -52,4 +52,3 @@ class NewComponent extends React.Component { }); } } - diff --git a/types/react-leaflet/index.d.ts b/types/react-leaflet/index.d.ts index eff286623a..ac67612757 100644 --- a/types/react-leaflet/index.d.ts +++ b/types/react-leaflet/index.d.ts @@ -66,7 +66,6 @@ interface LeafletDraggingEvents { onmoveend?: (event: Leaflet.Event) => void; } - interface MapProps extends React.HTMLProps, LeafletLayerEvents, LeafletMapStateChangeEvents, LeafletPopupEvents, LeafletTooltipEvents, LeafletLocationEvents, LeafletInteractionEvents, LeafletOtherEvents, Leaflet.MapOptions { animate?: boolean; @@ -78,20 +77,18 @@ interface MapProps extends React.HTMLProps, id?: string; } -declare type Map = React.ComponentClass; -declare const Map: Map; +type Map = React.ComponentClass; +export const Map: Map; interface MapInstance extends React.Component { leafletElement: Leaflet.Map; } - interface PaneProps { name?: string; style?: React.CSSProperties; className?: string; } -declare const Pane: React.ComponentClass; - +export const Pane: React.ComponentClass; // There is no Layer class, these are the base props for all layers on the map interface LayerProps extends LeafletInteractionEvents { @@ -107,7 +104,6 @@ interface LayerProps extends LeafletInteractionEvents { ontooltipclose?: (event: Leaflet.TooltipEvent) => void; } - interface MarkerProps extends LayerProps, LeafletDraggingEvents { position: Leaflet.LatLngExpression; draggable?: boolean; @@ -115,7 +111,7 @@ interface MarkerProps extends LayerProps, LeafletDraggingEvents { zIndexOffset?: number; opacity?: number; } -declare const Marker: React.ComponentClass; +export const Marker: React.ComponentClass; interface MarkerInstance extends React.Component { leafletElement: Leaflet.Marker; } @@ -123,11 +119,11 @@ interface MarkerInstance extends React.Component { interface PopupProps extends LayerProps, Leaflet.PopupOptions { position?: Leaflet.LatLngExpression; } -declare const Popup: React.ComponentClass; +export const Popup: React.ComponentClass; // tslint:disable-next-line:no-empty-interface interface TooltipProps extends LayerProps, Leaflet.TooltipOptions { } -declare const Tooltip: React.ComponentClass; +export const Tooltip: React.ComponentClass; interface GridLayerProps extends LayerProps { opacity?: number; @@ -140,84 +136,80 @@ interface GridLayerProps extends LayerProps { ontileload?: (event: Leaflet.TileEvent) => void; onload?: (event: Leaflet.Event) => void; } -declare const GridLayer: React.ComponentClass; +export const GridLayer: React.ComponentClass; interface TileLayerProps extends GridLayerProps, Leaflet.TileLayerOptions { url: string; } -declare const TileLayer: React.ComponentClass; +export const TileLayer: React.ComponentClass; interface ImageOverlayProps extends LayerProps, LeafletInteractionEvents { url: string; opacity?: string; } -declare const ImageOverlay: React.ComponentClass; +export const ImageOverlay: React.ComponentClass; interface WMSTileLayerProps extends TileLayerProps { url: string; } -declare const WMSTileLayer: React.ComponentClass; +export const WMSTileLayer: React.ComponentClass; // Path is an abstract class // tslint:disable-next-line:no-empty-interface interface PathProps extends LeafletLayerEvents, LeafletInteractionEvents, Leaflet.PathOptions { } - interface CircleProps extends PathProps { center: Leaflet.LatLngExpression; radius?: number; } -declare const Circle: React.ComponentClass; +export const Circle: React.ComponentClass; interface CircleMarkerProps extends PathProps { center: Leaflet.LatLngExpression; radius?: number; } -declare const CircleMarker: React.ComponentClass; +export const CircleMarker: React.ComponentClass; interface PolylineProps extends PathProps { positions: Leaflet.LatLngExpression[] | Leaflet.LatLngExpression[][]; } -declare const Polyline: React.ComponentClass; +export const Polyline: React.ComponentClass; interface PolygonProps extends PathProps { positions: Leaflet.LatLngExpression[] | Leaflet.LatLngExpression[][] | Leaflet.LatLngExpression[][][]; } -declare const Polygon: React.ComponentClass; +export const Polygon: React.ComponentClass; interface RectangleProps extends PathProps { bounds: Leaflet.LatLngBoundsExpression; } -declare const Rectangle: React.ComponentClass; - +export const Rectangle: React.ComponentClass; // tslint:disable-next-line:no-empty-interface interface LayerGroupProps extends LayerProps { } -declare const LayerGroup: React.ComponentClass; +export const LayerGroup: React.ComponentClass; // tslint:disable-next-line:no-empty-interface interface FeatureGroupProps extends LayerGroupProps, Leaflet.PathOptions { } -declare const FeatureGroup: React.ComponentClass; +export const FeatureGroup: React.ComponentClass; interface GeoJSONProps extends FeatureGroupProps { data: GeoJSON.GeoJsonObject; } -declare const GeoJSON: React.ComponentClass; - - +export const GeoJSON: React.ComponentClass; interface AttributionControlProps { position?: Leaflet.ControlPosition; } -declare const AttributionControl: React.ComponentClass; +export const AttributionControl: React.ComponentClass; interface LayersControlProps { position?: Leaflet.ControlPosition; } -declare const LayersControl: React.ComponentClass & { BaseLayer: LayersControl.BaseLayer, Overlay: LayersControl.Overlay }; +export const LayersControl: React.ComponentClass & { BaseLayer: LayersControl.BaseLayer, Overlay: LayersControl.Overlay }; -declare namespace LayersControl { +export namespace LayersControl { interface LayersControlLayerProps { name: string; checked?: boolean; @@ -229,9 +221,9 @@ declare namespace LayersControl { interface ScaleControlProps { position: Leaflet.ControlPosition; } -declare const ScaleControl: React.ComponentClass; +export const ScaleControl: React.ComponentClass; interface ZoomControlProps { position: Leaflet.ControlPosition; } -declare const ZoomControl: React.ComponentClass; +export const ZoomControl: React.ComponentClass; diff --git a/types/react-leaflet/react-leaflet-tests.tsx b/types/react-leaflet/react-leaflet-tests.tsx index 763e719de1..cabb2632dd 100644 --- a/types/react-leaflet/react-leaflet-tests.tsx +++ b/types/react-leaflet/react-leaflet-tests.tsx @@ -187,7 +187,7 @@ export class MarkerWithDivIconExample extends Component { new Leaflet.DivIcon({}) }/> - ) + ); } } diff --git a/types/tslint.json b/types/tslint.json index 490445671d..56b31d320a 100644 --- a/types/tslint.json +++ b/types/tslint.json @@ -1 +1 @@ -{ "extends": "../node_modules/types-publisher/tslint-definitions.json" } +{ "extends": "../node_modules/types-publisher/tslint-definitions.json" } \ No newline at end of file From 1eac02334afba3957000f9daa0a13aad5980f6cf Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 27 Mar 2017 11:42:48 -0700 Subject: [PATCH 51/56] Move web-animations-js inside types folder --- {web-animations-js => types/web-animations-js}/tsconfig.json | 0 .../web-animations-js}/web-animations-js-tests.ts | 0 .../web-animations-js}/web-animations-js.d.ts | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {web-animations-js => types/web-animations-js}/tsconfig.json (100%) rename {web-animations-js => types/web-animations-js}/web-animations-js-tests.ts (100%) rename {web-animations-js => types/web-animations-js}/web-animations-js.d.ts (100%) diff --git a/web-animations-js/tsconfig.json b/types/web-animations-js/tsconfig.json similarity index 100% rename from web-animations-js/tsconfig.json rename to types/web-animations-js/tsconfig.json diff --git a/web-animations-js/web-animations-js-tests.ts b/types/web-animations-js/web-animations-js-tests.ts similarity index 100% rename from web-animations-js/web-animations-js-tests.ts rename to types/web-animations-js/web-animations-js-tests.ts diff --git a/web-animations-js/web-animations-js.d.ts b/types/web-animations-js/web-animations-js.d.ts similarity index 100% rename from web-animations-js/web-animations-js.d.ts rename to types/web-animations-js/web-animations-js.d.ts From 2808017b657b7e06e1f5f19a0b1536229e46b1c6 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 27 Mar 2017 12:56:53 -0700 Subject: [PATCH 52/56] Make web-animations-js strictNullChecks safe --- types/web-animations-js/tsconfig.json | 4 +- .../web-animations-js-tests.ts | 49 ++++++++++--------- .../web-animations-js/web-animations-js.d.ts | 4 +- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/types/web-animations-js/tsconfig.json b/types/web-animations-js/tsconfig.json index dbf76f478e..74f7691f83 100644 --- a/types/web-animations-js/tsconfig.json +++ b/types/web-animations-js/tsconfig.json @@ -8,7 +8,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -21,4 +21,4 @@ "web-animations-js.d.ts", "web-animations-js-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/web-animations-js/web-animations-js-tests.ts b/types/web-animations-js/web-animations-js-tests.ts index 3072c936a0..ece6c3cc01 100644 --- a/types/web-animations-js/web-animations-js-tests.ts +++ b/types/web-animations-js/web-animations-js-tests.ts @@ -46,7 +46,9 @@ function test_AnimationsApiNext() { effectNode.style.left = bounds.left + bounds.width / 2 + 'px'; effectNode.style.top = bounds.top + bounds.height / 2 + 'px'; const header = document.querySelector('header'); - header.appendChild(effectNode); + if (header) { + header.appendChild(effectNode); + } const newColor = 'hsl(' + Math.round(Math.random() * 255) + ', 46%, 42%)'; effectNode.style.background = newColor; const scaleSteps = [{ transform: 'scale(0)' }, { transform: 'scale(1)' }]; @@ -63,31 +65,32 @@ function test_AnimationsApiNext() { // http://codepen.io/rachelnabors/pen/eJyWzm/?editors=0010 function test_whiteRabbit() { var whiteRabbit = document.getElementById("rabbit"); + if (whiteRabbit) { + var rabbitDownKeyframes = new KeyframeEffect( + whiteRabbit, + [ + { transform: 'translateY(0%)' }, + { transform: 'translateY(100%)' } + ], + { duration: 3000, fill: 'forwards' } + ); + var rabbitDownAnimation = new Animation(rabbitDownKeyframes, document.timeline); + // On tap or click, + whiteRabbit.addEventListener("mousedown", downHeGoes, false); + whiteRabbit.addEventListener("touchstart", downHeGoes, false); - var rabbitDownKeyframes = new KeyframeEffect( - whiteRabbit, - [ - { transform: 'translateY(0%)' }, - { transform: 'translateY(100%)' } - ], - { duration: 3000, fill: 'forwards' } - ); + // Trigger a single-fire animation + function downHeGoes(event: Event) { - var rabbitDownAnimation = new Animation(rabbitDownKeyframes, document.timeline); + // Remove those event listeners + whiteRabbit!.removeEventListener("mousedown", downHeGoes, false); + whiteRabbit!.removeEventListener("touchstart", downHeGoes, false); - // On tap or click, - whiteRabbit.addEventListener("mousedown", downHeGoes, false); - whiteRabbit.addEventListener("touchstart", downHeGoes, false); - - // Trigger a single-fire animation - function downHeGoes(event: Event) { - - // Remove those event listeners - whiteRabbit.removeEventListener("mousedown", downHeGoes, false); - whiteRabbit.removeEventListener("touchstart", downHeGoes, false); - - // Play rabbit animation - rabbitDownAnimation.play(); + // Play rabbit animation + rabbitDownAnimation.play(); + } } + + } diff --git a/types/web-animations-js/web-animations-js.d.ts b/types/web-animations-js/web-animations-js.d.ts index a151ef73b3..ddc972ba0e 100644 --- a/types/web-animations-js/web-animations-js.d.ts +++ b/types/web-animations-js/web-animations-js.d.ts @@ -24,7 +24,7 @@ declare class AnimationPlaybackEvent { interface AnimationKeyFrame { easing?: string; offset?: number; - [key: string]: string | string[] | number | number[]; + [key: string]: string | string[] | number | number[] | undefined; } interface AnimationTimeline { @@ -89,4 +89,4 @@ interface Element { } interface Document { timeline: AnimationTimeline; -} \ No newline at end of file +} From 9c038752779a60df242c6f3f761deb4eda94214d Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Mon, 27 Mar 2017 13:32:20 -0700 Subject: [PATCH 53/56] Move to index.d.ts and fix other lints Also turn on linting. --- types/web-animations-js/{web-animations-js.d.ts => index.d.ts} | 2 +- types/web-animations-js/tsconfig.json | 2 +- types/web-animations-js/tslint.json | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) rename types/web-animations-js/{web-animations-js.d.ts => index.d.ts} (98%) create mode 100644 types/web-animations-js/tslint.json diff --git a/types/web-animations-js/web-animations-js.d.ts b/types/web-animations-js/index.d.ts similarity index 98% rename from types/web-animations-js/web-animations-js.d.ts rename to types/web-animations-js/index.d.ts index ddc972ba0e..24c6282eab 100644 --- a/types/web-animations-js/web-animations-js.d.ts +++ b/types/web-animations-js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for web-animations-js v2.2.2 +// Type definitions for web-animations-js 2.2 // Project: https://github.com/web-animations/web-animations-js // Definitions by: Kristian Moerch // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/web-animations-js/tsconfig.json b/types/web-animations-js/tsconfig.json index 74f7691f83..6f7d4d67cb 100644 --- a/types/web-animations-js/tsconfig.json +++ b/types/web-animations-js/tsconfig.json @@ -18,7 +18,7 @@ "forceConsistentCasingInFileNames": true }, "files": [ - "web-animations-js.d.ts", + "index.d.ts", "web-animations-js-tests.ts" ] } diff --git a/types/web-animations-js/tslint.json b/types/web-animations-js/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/types/web-animations-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } From 5640a06e0ff2203e98091828481ecd650dc193d7 Mon Sep 17 00:00:00 2001 From: Dave Leaver Date: Tue, 28 Mar 2017 17:11:50 +1300 Subject: [PATCH 54/56] Add MapControl and additional GeoJSON bits to react-leaflet. (#15401) * Add MapControl and additional GeoJSON bits to react-leaflet. * Make MapControl actually usable. * Fix tslint errors --- types/react-leaflet/index.d.ts | 9 ++- types/react-leaflet/react-leaflet-tests.tsx | 67 +++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/types/react-leaflet/index.d.ts b/types/react-leaflet/index.d.ts index ac67612757..8caed9e4e1 100644 --- a/types/react-leaflet/index.d.ts +++ b/types/react-leaflet/index.d.ts @@ -194,7 +194,7 @@ export const LayerGroup: React.ComponentClass; interface FeatureGroupProps extends LayerGroupProps, Leaflet.PathOptions { } export const FeatureGroup: React.ComponentClass; -interface GeoJSONProps extends FeatureGroupProps { +interface GeoJSONProps extends FeatureGroupProps, Leaflet.GeoJSONOptions { data: GeoJSON.GeoJsonObject; } export const GeoJSON: React.ComponentClass; @@ -218,6 +218,13 @@ export namespace LayersControl { type Overlay = React.ComponentClass; } +interface MapControlProps { + position?: Leaflet.ControlPosition; +} +declare class MapControl extends React.Component { + leafletElement?: L.Control +} + interface ScaleControlProps { position: Leaflet.ControlPosition; } diff --git a/types/react-leaflet/react-leaflet-tests.tsx b/types/react-leaflet/react-leaflet-tests.tsx index cabb2632dd..3c928dc322 100644 --- a/types/react-leaflet/react-leaflet-tests.tsx +++ b/types/react-leaflet/react-leaflet-tests.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import * as ReactDOM from 'react-dom'; import * as Leaflet from 'leaflet'; import { Component, PropTypes } from 'react'; import { @@ -8,6 +9,8 @@ import { LayerGroup, LayersControl, Map, + MapControl, + MapControlProps, MapInstance, Marker, MarkerInstance, @@ -599,3 +602,67 @@ const ZoomControlExample = () => ( ); + + +//MapControl https://github.com/PaulLeCam/react-leaflet/issues/130 +const mapControlCenter: [number, number] = [51.505, -0.09]; +class CenterControl extends MapControl { // note we're extending MapControl from react-leaflet, not Component from react + componentWillMount() { + const centerControl = new L.Control({position: this.props.position}); // see http://leafletjs.com/reference.html#control-positions for other positions + const jsx = ( + // PUT YOUR JSX FOR THE COMPONENT HERE: +
+ // add your JSX +
+ ); + + centerControl.onAdd = (map) => { + let div = L.DomUtil.create('div', ''); + ReactDOM.render(jsx, div); + return div; + }; + + this.leafletElement = centerControl; + } +} +const CenterControlExample = () => ( + + + +); + +class LegendControl extends MapControl { + componentWillMount() { + const legend = new L.Control({position: this.props.position}); + const jsx = ( +
+ {this.props.children} +
+ ); + + legend.onAdd = (map) => { + let div = L.DomUtil.create('div', ''); + ReactDOM.render(jsx, div); + return div; + }; + + this.leafletElement = legend; + } +} + +const LegendControlExample = () => ( + + + +
    +
  • Strong Support
  • +
  • Weak Support
  • +
  • Weak Oppose
  • +
  • Strong Oppose
  • +
+
+
+); \ No newline at end of file From 51195f94395e6625afad09f280c9f69ebc03e99c Mon Sep 17 00:00:00 2001 From: Philip Jackson Date: Tue, 28 Mar 2017 17:25:56 +1300 Subject: [PATCH 55/56] electron - Update BrowserWindow.setMenu signature (#15428) * BrowserWindow.setMenu accepts `null` Passing null to setMenu removes the menu bar. The explicit "or null" type annotation is needed for users using the "strictNullChecks" option. * Add tests for BrowserWindow.setMenu --- types/electron/index.d.ts | 2 +- types/electron/test/main.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/electron/index.d.ts b/types/electron/index.d.ts index 11103b3a18..6e257c4261 100644 --- a/types/electron/index.d.ts +++ b/types/electron/index.d.ts @@ -1264,7 +1264,7 @@ declare namespace Electron { * Sets the menu as the window top menu. * Note: This API is not available on macOS. */ - setMenu(menu: Menu): void; + setMenu(menu: Menu | null): void; /** * Sets the progress value in the progress bar. * On Linux platform, only supports Unity desktop environment, you need to diff --git a/types/electron/test/main.ts b/types/electron/test/main.ts index 35a85a81dc..67a1a9954d 100644 --- a/types/electron/test/main.ts +++ b/types/electron/test/main.ts @@ -145,6 +145,9 @@ app.on('ready', () => { mainWindow.webContents.capturePage({x: 0, y: 0, width: 100, height: 200}, image => { console.log(image.toPNG()); }); + + mainWindow.setMenu(null); + mainWindow.setMenu(Menu.buildFromTemplate([])); }); app.commandLine.appendSwitch('enable-web-bluetooth'); From e5cec53dd26fed47e06c2f93acbf97aa7ae91bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20M=C3=B8rch?= Date: Tue, 28 Mar 2017 06:26:32 +0200 Subject: [PATCH 56/56] Type "finish" is the only supported event type. (#15427) Number was a typo. --- types/web-animations-js/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/web-animations-js/index.d.ts b/types/web-animations-js/index.d.ts index 24c6282eab..3bb3d56067 100644 --- a/types/web-animations-js/index.d.ts +++ b/types/web-animations-js/index.d.ts @@ -69,8 +69,8 @@ declare class Animation { pause(): void; play(): void; reverse(): void; - addEventListener(type: number, handler: AnimationEventListener): void; - removeEventListener(type: number, handler: AnimationEventListener): void; + addEventListener(type: "finish", handler: AnimationEventListener): void; + removeEventListener(type: "finish", handler: AnimationEventListener): void; effect: KeyframeEffect; readonly finished: Promise; readonly ready: Promise;