diff --git a/scripts/material-ui/README.md b/scripts/material-ui/README.md new file mode 100644 index 0000000000..8fe5206a81 --- /dev/null +++ b/scripts/material-ui/README.md @@ -0,0 +1,15 @@ +# Generator for material-ui + +## Usage + +```sh +node scripts/material-ui/generate.js +``` + +### GitHub API Limitation + +The error `GitHub response: 401 Unauthorized` is due to [Rate Limiting | GitHub API v3 \| GitHub Developer Guide](https://developer.github.com/v3/#rate-limiting). In order to avoid this, it is necessary to publish [Personal access token](https://github.com/settings/tokens) and specify it as an environment variable. + +```sh +GITHUB_ACCESS_TOKEN=XXXXX node scripts/material-ui/generate.js +``` diff --git a/scripts/material-ui/generate.js b/scripts/material-ui/generate.js new file mode 100644 index 0000000000..06e6983a44 --- /dev/null +++ b/scripts/material-ui/generate.js @@ -0,0 +1,147 @@ +const {get} = require('https') +const {readdir, readFile, writeFile} = require('fs') +const {join, extname, basename, dirname, relative} = require('path') + +const token = process.env.GITHUB_ACCESS_TOKEN || '' + +const toMixedCase = (name) => { + let dist = name[0].toUpperCase() + for (let i = 1; i < name.length; i++) { + const c = name[i] + if (c !== '-') { + dist += c + continue + } + i++ + dist += name[i].toUpperCase() + } + return dist +} + +const github = (path) => new Promise((resolve, reject) => { + get({ + headers: {'user-agent': 'DefinitelyTyped/material-ui/generate'}, + host: 'api.github.com', + path, + }, (res) => { + if ((res.statusCode / 100 >> 0) != 2) { + reject(`GitHub response: ${res.statusCode} ${res.statusMessage}`) + return + } + let data = ''; + res + .on('data', (chunk) => data += chunk) + .on('end', () => resolve(JSON.parse(data))) + }).on('error', reject) +}) + +const categories = () => github(`/repos/callemall/material-ui/contents/src/svg-icons?ref=master&access_token=${token}`) + +const contents = (path) => github(`/repos/callemall/material-ui/contents/${path}?ref=master&access_token=${token}`) + +const collator = new Intl.Collator() + +const resolvePath = (filename) => join(__dirname, '../../types/material-ui', filename) + +const readText = (filename) => new Promise((resolve, reject) => { + readFile(resolvePath(filename), 'utf8', (err, data) => { + if (err != null) { + reject(err) + return + } + resolve(data) + }) +}) + +const writeText = (filename, text) => new Promise((resolve, reject) => { + writeFile(resolvePath(filename), text, 'utf8', (err) => { + if (err != null) { + reject(err) + return + } + resolve() + }) +}) + +const inject = (content) => { + content.category = this.name + return content +} + +const rMark = /(\/{2} \{{3})[\s\S]*?(\/{2} \}{3})/g + +categories() + .then((cats) => Promise.all(Array.prototype.map.call(cats, (cat) => contents(cat.path) + .then((cons) => Array.prototype.map.call(cons, (con) => { + con.category = cat.name + return con + })) + ))) + .then((contentsList) => Array.prototype.concat.apply([], contentsList) + .map((content) => { + const {path} = content + const name = basename(path, extname(path)) + content.id = join(relative('src', dirname(path)), name) + content.className = toMixedCase(content.category) + toMixedCase(name) + return content + }) + .sort((a, b) => collator.compare(a.id, b.id)) + .reduce((prev, content) => { + const {dts, test} = prev + dts.individuals.push(`declare module 'material-ui/${content.id}' { + export import ${content.className} = __MaterialUI.SvgIcon; + export default ${content.className}; +}`) + dts.summarizeds.push(` export import ${content.className} = __MaterialUI.SvgIcon; // require('material-ui/${content.id}');`) + + test.individuals.push(`import _${content.className} from 'material-ui/${content.id}';`) + test.summarizeds.push(` ${content.className},`) + return prev + }, { + dts: {individuals: [], summarizeds: []}, + test: {individuals: [], summarizeds: []}, + }) +) + .then(({dts, test}) => { + return Promise.all([ + (() => { + const {individuals, summarizeds} = dts + const file = 'index.d.ts' + let index = 0 + return readText(file) + .then((script) => writeText(file, script.replace(rMark, (_, p1, p2) => { + let text = '' + switch (index) { + case 0: + text = individuals.join('\n\n') + break + case 1: + text = summarizeds.join('\n') + break + } + index++ + return p1 + '\n' + text + '\n' + p2 + }))) + })(), + (() => { + const {individuals, summarizeds} = test + const file = join('material-ui-tests.tsx') + let index = 0 + return readText(file) + .then((script) => writeText(file, script.replace(rMark, (_, p1, p2) => { + let text = '' + switch (index) { + case 0: + text = individuals.join('\n') + break + case 1: + text = summarizeds.join('\n') + break + } + index++ + return p1 + '\n' + text + '\n' + p2 + }))) + })(), + ]) + }) + .catch((err) => console.error(err)) diff --git a/types/activex-scripting/activex-scripting-tests.ts b/types/activex-scripting/activex-scripting-tests.ts index cc14a421ff..3be8e1ccf5 100644 --- a/types/activex-scripting/activex-scripting-tests.ts +++ b/types/activex-scripting/activex-scripting-tests.ts @@ -1,7 +1,7 @@ // source -- https://msdn.microsoft.com/en-us/library/ebkhfaaz.aspx // Generates a string describing the drive type of a given Drive object. -let showDriveType = (drive: Scripting.Drive) => { +function showDriveType(drive: Scripting.Drive) { switch (drive.DriveType) { case Scripting.DriveTypeConst.Removable: return 'Removeable'; @@ -16,15 +16,15 @@ let showDriveType = (drive: Scripting.Drive) => { default: return 'Unknown'; } -}; +} // Generates a string describing the attributes of a file or folder. -let showFileAttributes = (file: Scripting.File) => { - let attr = file.Attributes; +function showFileAttributes(file: Scripting.File) { + const attr = file.Attributes; if (attr === 0) { return 'Normal'; } - let attributeStrings: string[] = []; + const attributeStrings: string[] = []; if (attr & Scripting.FileAttribute.Directory) { attributeStrings.push('Directory'); } if (attr & Scripting.FileAttribute.ReadOnly) { attributeStrings.push('Read-only'); } if (attr & Scripting.FileAttribute.Hidden) { attributeStrings.push('Hidden'); } @@ -34,22 +34,22 @@ let showFileAttributes = (file: Scripting.File) => { if (attr & Scripting.FileAttribute.Alias) { attributeStrings.push('Alias'); } if (attr & Scripting.FileAttribute.Compressed) { attributeStrings.push('Compressed'); } return attributeStrings.join(','); -}; +} // source --https://msdn.microsoft.com/en-us/library/ts2t8ybh(v=vs.84).aspx -let showFreeSpace = (drvPath: string) => { - let fso = new ActiveXObject('Scripting.FileSystemObject'); - let d = fso.GetDrive(fso.GetDriveName(drvPath)); +function showFreeSpace(drvPath: string) { + const fso = new ActiveXObject('Scripting.FileSystemObject'); + const d = fso.GetDrive(fso.GetDriveName(drvPath)); let s = 'Drive ' + drvPath + ' - '; s += d.VolumeName + '
'; s += 'Free Space: ' + d.FreeSpace / 1024 + ' Kbytes'; return (s); -}; +} // source -- https://msdn.microsoft.com/en-us/library/kaf6yaft(v=vs.84).aspx -let getALine = (filespec: string) => { - let fso = new ActiveXObject('Scripting.FileSystemObject'); - let file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false); +function getALine(filespec: string) { + const fso = new ActiveXObject('Scripting.FileSystemObject'); + const file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false); let s = ''; while (!file.AtEndOfLine) { @@ -57,4 +57,4 @@ let getALine = (filespec: string) => { } file.Close(); return (s); -}; +} diff --git a/types/activex-wia/activex-wia-tests.ts b/types/activex-wia/activex-wia-tests.ts index 8384291f5d..b765083870 100644 --- a/types/activex-wia/activex-wia-tests.ts +++ b/types/activex-wia/activex-wia-tests.ts @@ -7,7 +7,7 @@ let img = commonDialog.ShowAcquireImage(); // when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these: let jpegFormatID = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}'; if (img.FormatID !== jpegFormatID) { - let ip = new ActiveXObject('WIA.ImageProcess'); + const ip = new ActiveXObject('WIA.ImageProcess'); ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID); ip.Filters.Item(1).Properties.Item('FormatID').Value = jpegFormatID; img = ip.Apply(img); @@ -24,8 +24,8 @@ if (img.FormatID !== jpegFormatID) { let dev = commonDialog.ShowSelectDevice(); if (dev.Type === WIA.WiaDeviceType.CameraDeviceType) { // when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these: - let commandID = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}'; - let itm = dev.ExecuteCommand(commandID); + const commandID = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}'; + const itm = dev.ExecuteCommand(commandID); // with this: // let itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture); @@ -36,7 +36,7 @@ dev = commonDialog.ShowSelectDevice(); let e = new Enumerator(dev.Properties); // no foreach over ActiveX collections e.moveFirst(); while (!e.atEnd()) { - let p = e.item(); + const p = e.item(); let s = p.Name + ' (' + p.PropertyID + ') = '; if (p.IsVector) { s += '[vector of data]'; @@ -60,7 +60,7 @@ while (!e.atEnd()) { } else { s += ' [valid values include: '; } - let count = p.SubTypeValues.Count; + const count = p.SubTypeValues.Count; for (let i = 1; i <= count; i++) { s += p.SubTypeValues.Item(i); if (i < count) { diff --git a/types/alertify/index.d.ts b/types/alertify/index.d.ts index fa71118381..1eb2699f6f 100644 --- a/types/alertify/index.d.ts +++ b/types/alertify/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for alertify 0.3.11 // Project: http://fabien-d.github.io/alertify.js/ -// Definitions by: John Jeffery +// Definitions by: John Jeffery // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var alertify: alertify.IAlertifyStatic; diff --git a/types/alexa-sdk/alexa-sdk-tests.ts b/types/alexa-sdk/alexa-sdk-tests.ts index c384bf194d..c77bc93091 100644 --- a/types/alexa-sdk/alexa-sdk-tests.ts +++ b/types/alexa-sdk/alexa-sdk-tests.ts @@ -1,13 +1,13 @@ import * as Alexa from "alexa-sdk"; const handler = (event: Alexa.RequestBody, context: Alexa.Context, callback: () => void) => { - let alexa = Alexa.handler(event, context); + const alexa = Alexa.handler(event, context); alexa.resources = {}; alexa.registerHandlers(handlers); alexa.execute(); }; -let handlers: Alexa.Handlers = { +const handlers: Alexa.Handlers = { 'LaunchRequest': function() { this.emit('SayHello'); }, diff --git a/types/algebra.js/algebra.js-tests.ts b/types/algebra.js/algebra.js-tests.ts index 0dc7f260e7..7b6cebfab8 100644 --- a/types/algebra.js/algebra.js-tests.ts +++ b/types/algebra.js/algebra.js-tests.ts @@ -5,9 +5,9 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js'; expr = expr.subtract(3); expr = expr.add("x"); expr.toString(); - let eq = new Equation(expr, 4); + const eq = new Equation(expr, 4); eq.toString(); - let x = eq.solveFor("x"); + const x = eq.solveFor("x"); x.toString(); } { @@ -29,7 +29,7 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js'; x.toString(); x = x.add("y"); x.toString(); - let otherExp = new Expression("x").add(6); + const otherExp = new Expression("x").add(6); x = x.add(otherExp); x.toString(); @@ -54,10 +54,10 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js'; exp = exp.add("y"); exp = exp.add(3); exp.toString(); - let sum = exp.summation("x", 3, 6); + const sum = exp.summation("x", 3, 6); sum.toString(); exp = new Expression("x").add(2); - let exp3 = exp.pow(3); + const exp3 = exp.pow(3); "(" + exp.toString() + ")^3 = " + exp3.toString(); let expr = new Expression("x"); @@ -66,14 +66,14 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js'; expr = expr.add("y"); expr = expr.add(new Fraction(1, 3)); expr.toString(); - let answer1 = expr.eval({ x: 2 }); - let answer2 = expr.eval({ x: 2, y: new Fraction(3, 4) }); + const answer1 = expr.eval({ x: 2 }); + const answer2 = expr.eval({ x: 2, y: new Fraction(3, 4) }); answer1.toString(); answer2.toString(); expr = new Expression("x").add(2); expr.toString(); - let sub = new Expression("y").add(4); - let answer = expr.eval({ x: sub }); + const sub = new Expression("y").add(4); + const answer = expr.eval({ x: sub }); answer.toString(); exp = new Expression("x").add(2); exp.toString(); @@ -91,23 +91,23 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js'; exp.toString(); exp = exp.simplify(); exp.toString(); - let z = new Expression("z"); - let eq1 = new Equation(z.subtract(4).divide(9), z.add(6)); + const z = new Expression("z"); + const eq1 = new Equation(z.subtract(4).divide(9), z.add(6)); eq1.toString(); - let eq2 = new Equation(z.add(4).multiply(9), 6); + const eq2 = new Equation(z.add(4).multiply(9), 6); eq2.toString(); - let eq3 = new Equation(z.divide(2).multiply(7), new Fraction(1, 4)); + const eq3 = new Equation(z.divide(2).multiply(7), new Fraction(1, 4)); eq3.toString(); } { - let x1 = parse("1/5 * x + 2/15"); - let x2 = parse("1/7 * x + 4"); + const x1 = parse("1/5 * x + 2/15"); + const x2 = parse("1/7 * x + 4"); let eq = new Equation(x1 as Expression, x2 as Expression); eq.toString(); - let answer = eq.solveFor("x"); + const answer = eq.solveFor("x"); "x = " + answer.toString(); - let expr1 = parse("1/4 * x + 5/4"); - let expr2 = parse("3 * y - 12/5"); + const expr1 = parse("1/4 * x + 5/4"); + const expr2 = parse("3 * y - 12/5"); eq = new Equation(expr1 as Expression, expr2 as Expression); eq.toString(); let xAnswer = eq.solveFor("x"); @@ -116,14 +116,14 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js'; "y = " + yAnswer.toString(); let n1 = parse("x + 5") as Expression; let n2 = parse("x - 3/4") as Expression; - let quad = new Equation(n1.multiply(n2), 0); + const quad = new Equation(n1.multiply(n2), 0); quad.toString(); let answers = quad.solveFor("x"); "x = " + answers.toString(); n1 = parse("x + 2") as Expression; n2 = parse("x + 3") as Expression; - let n3 = parse("x + 4") as Expression; - let cubic = new Equation(n1.multiply(n2).multiply(n3), 0); + const n3 = parse("x + 4") as Expression; + const cubic = new Equation(n1.multiply(n2).multiply(n3), 0); cubic.toString(); answers = cubic.solveFor("x"); "x = " + answers.toString(); @@ -143,20 +143,20 @@ import { Equation, Expression, Fraction, parse, toTex } from 'algebra.js'; exp.toString(); } { - let eq = parse("x^2 + 4 * x + 4 = 0") as Equation; + const eq = parse("x^2 + 4 * x + 4 = 0") as Equation; eq.toString(); - let ans = eq.solveFor("x"); + const ans = eq.solveFor("x"); "x = " + ans.toString(); - let a = new Expression("x").pow(2); - let b = new Expression("x").multiply(new Fraction(5, 4)); - let c = new Fraction(-21, 4); - let expr = a.add(b).add(c); - let quad = new Equation(expr, 0); + const a = new Expression("x").pow(2); + const b = new Expression("x").multiply(new Fraction(5, 4)); + const c = new Fraction(-21, 4); + const expr = a.add(b).add(c); + const quad = new Equation(expr, 0); toTex(quad); - let answers = quad.solveFor("x"); + const answers = quad.solveFor("x"); toTex(answers); - let lambda = new Expression("lambda").add(3).divide(4); - let Phi = new Expression("Phi").subtract(new Fraction(1, 5)).add(lambda); + const lambda = new Expression("lambda").add(3).divide(4); + const Phi = new Expression("Phi").subtract(new Fraction(1, 5)).add(lambda); toTex(lambda); toTex(Phi); } diff --git a/types/amplify/amplify-tests.ts b/types/amplify/amplify-tests.ts index 62b00052dd..1277e5e2a3 100644 --- a/types/amplify/amplify-tests.ts +++ b/types/amplify/amplify-tests.ts @@ -168,19 +168,24 @@ amplify.request("twitter-mentions", { user: "amplifyjs" }); // Example: const appEnvelopeDecoder: amplify.Decoder = (data, status, xhr, success, error) => { - if (data.status === "success") { - success(data.data); - } else if (data.status === "fail" || data.status === "error") { - error(data.message, data.status); - } else { - error(data.message, "fatal"); + switch (data.status) { + case "success": + success(data.data); + break; + case "fail": + case "error": + error(data.message, data.status); + break; + default: + error(data.message, "fatal"); + break; } }; // a new decoder can be added to the amplifyDecoders interface declare module "amplify" { interface Decoders { - appEnvelope: amplify.Decoder; + appEnvelope: Decoder; } } @@ -213,12 +218,17 @@ amplify.request.define("decoderSingleExample", "ajax", { url: "/myAjaxUrl", type: "POST", decoder(data, status, xhr, success, error) { - if (data.status === "success") { - success(data.data); - } else if (data.status === "fail" || data.status === "error") { - error(data.message, data.status); - } else { - error(data.message, "fatal"); + switch (data.status) { + case "success": + success(data.data); + break; + case "fail": + case "error": + error(data.message, data.status); + break; + default: + error(data.message, "fatal"); + break; } } }); diff --git a/types/amqplib/tslint.json b/types/amqplib/tslint.json index 4f44991c3c..bfc9508c49 100644 --- a/types/amqplib/tslint.json +++ b/types/amqplib/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "no-empty-interface": false + // All are TODOs + "no-empty-interface": false, + "prefer-const": false } } diff --git a/types/angular-block-ui/angular-block-ui-tests.ts b/types/angular-block-ui/angular-block-ui-tests.ts index 4b3903f9cc..58547fff4d 100644 --- a/types/angular-block-ui/angular-block-ui-tests.ts +++ b/types/angular-block-ui/angular-block-ui-tests.ts @@ -37,5 +37,5 @@ app.controller('Ctrl', ($scope: ng.IScope, blockUI: angular.blockUI.BlockUIServi blockUI.reset(); blockUI.message("Hello Types"); blockUI.done(); - let b: boolean = blockUI.isBlocking(); + const b: boolean = blockUI.isBlocking(); }); diff --git a/types/angular-block-ui/index.d.ts b/types/angular-block-ui/index.d.ts index 7733bc72f7..47ba9902b9 100644 --- a/types/angular-block-ui/index.d.ts +++ b/types/angular-block-ui/index.d.ts @@ -70,7 +70,7 @@ declare module 'angular' { * @param {angular.IRequestConfig} config - the Angular request config object. * */ - requestFilter?(config: angular.IRequestConfig): (string | boolean); + requestFilter?(config: IRequestConfig): (string | boolean); /** * When the module is started it will inject the main block element diff --git a/types/angular-cookies/index.d.ts b/types/angular-cookies/index.d.ts index 502e83a2e9..dc6fd913e9 100644 --- a/types/angular-cookies/index.d.ts +++ b/types/angular-cookies/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS (ngCookies module) 1.4 // Project: http://angularjs.org -// Definitions by: Diego Vilar , Anthony Ciccarello +// Definitions by: Diego Vilar , Anthony Ciccarello // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/angular-gridster/index.d.ts b/types/angular-gridster/index.d.ts index 3d4fbbe799..22c02b4050 100644 --- a/types/angular-gridster/index.d.ts +++ b/types/angular-gridster/index.d.ts @@ -89,13 +89,13 @@ declare module "angular" { handles?: string[]; // optional callback fired when drag is started - start?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void; + start?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void; // optional callback fired when item is resized - resize?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void; + resize?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void; // optional callback fired when item is finished dragging - stop?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void; + stop?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void; }; // options to pass to draggable handler @@ -113,13 +113,13 @@ declare module "angular" { handle?: string; // optional callback fired when drag is started - start?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void; + start?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void; // optional callback fired when item is moved, - drag?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void; + drag?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void; // optional callback fired when item is finished dragging - stop?(event: angular.IAngularEvent, $element: angular.IAugmentedJQuery, options: any): void; + stop?(event: IAngularEvent, $element: IAugmentedJQuery, options: any): void; }; } diff --git a/types/angular-material/angular-material-tests.ts b/types/angular-material/angular-material-tests.ts index 5766a81975..79f72f0b5d 100644 --- a/types/angular-material/angular-material-tests.ts +++ b/types/angular-material/angular-material-tests.ts @@ -49,7 +49,7 @@ myApp.config(( return c * t * t + b; }, easeFnIndeterminate(t, b, c, d) { - return c * Math.pow(2, 10 * (t / d - 1)) + b; + return c * Math.pow(2, (t / d - 1) * 10) + b; } }); }); diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index 36a43329f6..a8808f92ff 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -18,7 +18,7 @@ declare module 'angular' { interface IBottomSheetOptions { templateUrl?: string; template?: string; - scope?: angular.IScope; // default: new child scope + scope?: IScope; // default: new child scope preserveScope?: boolean; // default: false controller?: string | Injectable; locals?: { [index: string]: any }; @@ -28,12 +28,12 @@ declare module 'angular' { escapeToClose?: boolean; resolve?: ResolveObject; controllerAs?: string; - parent?: ((scope: angular.IScope, element: JQuery) => Element | JQuery) | string | Element | JQuery; // default: root node + parent?: ((scope: IScope, element: JQuery) => Element | JQuery) | string | Element | JQuery; // default: root node disableParentScroll?: boolean; // default: true } interface IBottomSheetService { - show(options: IBottomSheetOptions): angular.IPromise; + show(options: IBottomSheetOptions): IPromise; hide(response?: any): void; cancel(response?: any): void; } @@ -47,7 +47,7 @@ declare module 'angular' { templateUrl(templateUrl?: string): T; template(template?: string): T; targetEvent(targetEvent?: MouseEvent): T; - scope(scope?: angular.IScope): T; // default: new child scope + scope(scope?: IScope): T; // default: new child scope preserveScope(preserveScope?: boolean): T; // default: false disableParentScroll(disableParentScroll?: boolean): T; // default: true hasBackdrop(hasBackdrop?: boolean): T; // default: true @@ -98,7 +98,7 @@ declare module 'angular' { targetEvent?: MouseEvent; openFrom?: any; closeTo?: any; - scope?: angular.IScope; // default: new child scope + scope?: IScope; // default: new child scope preserveScope?: boolean; // default: false disableParentScroll?: boolean; // default: true hasBackdrop?: boolean; // default: true @@ -111,24 +111,24 @@ declare module 'angular' { resolve?: ResolveObject; controllerAs?: string; parent?: string | Element | JQuery; // default: root node - onShowing?(scope: angular.IScope, element: JQuery): void; - onComplete?(scope: angular.IScope, element: JQuery): void; - onRemoving?(element: JQuery, removePromise: angular.IPromise): void; + onShowing?(scope: IScope, element: JQuery): void; + onComplete?(scope: IScope, element: JQuery): void; + onRemoving?(element: JQuery, removePromise: IPromise): void; skipHide?: boolean; multiple?: boolean; fullscreen?: boolean; // default: false } interface IDialogService { - show(dialog: IDialogOptions | IAlertDialog | IConfirmDialog | IPromptDialog): angular.IPromise; + show(dialog: IDialogOptions | IAlertDialog | IConfirmDialog | IPromptDialog): IPromise; confirm(): IConfirmDialog; alert(): IAlertDialog; prompt(): IPromptDialog; - hide(response?: any): angular.IPromise; + hide(response?: any): IPromise; cancel(response?: any): void; } - type IIcon = (id: string) => angular.IPromise; // id is a unique ID or URL + type IIcon = (id: string) => IPromise; // id is a unique ID or URL interface IIconProvider { icon(id: string, url: string, viewBoxSize?: number): IIconProvider; // viewBoxSize default: 24 @@ -141,16 +141,16 @@ declare module 'angular' { type IMedia = (media: string) => boolean; interface ISidenavObject { - toggle(): angular.IPromise; - open(): angular.IPromise; - close(): angular.IPromise; + toggle(): IPromise; + open(): IPromise; + close(): IPromise; isOpen(): boolean; isLockedOpen(): boolean; onClose(onClose: () => void): void; } interface ISidenavService { - (component: string, enableWait: boolean): angular.IPromise; + (component: string, enableWait: boolean): IPromise; (component: string): ISidenavObject; } @@ -175,7 +175,7 @@ declare module 'angular' { templateUrl?: string; template?: string; autoWrap?: boolean; - scope?: angular.IScope; // default: new child scope + scope?: IScope; // default: new child scope preserveScope?: boolean; // default: false hideDelay?: number | false; // default (ms): 3000 position?: string; // any combination of 'bottom'/'left'/'top'/'right'/'fit'; default: 'bottom left' @@ -189,8 +189,8 @@ declare module 'angular' { } interface IToastService { - show(optionsOrPreset: IToastOptions | IToastPreset): angular.IPromise; - showSimple(content: string): angular.IPromise; + show(optionsOrPreset: IToastOptions | IToastPreset): IPromise; + showSimple(content: string): IPromise; simple(): ISimpleToastPreset; build(): IToastPreset; updateContent(newContent: string): void; @@ -306,7 +306,7 @@ declare module 'angular' { } interface IMenuService { - hide(response?: any, options?: any): angular.IPromise; + hide(response?: any, options?: any): IPromise; } interface IColorPalette { @@ -366,19 +366,19 @@ declare module 'angular' { isAttached: boolean; panelContainer: JQuery; panelEl: JQuery; - open(): angular.IPromise; - close(): angular.IPromise; - attach(): angular.IPromise; - detach(): angular.IPromise; - show(): angular.IPromise; - hide(): angular.IPromise; + open(): IPromise; + close(): IPromise; + attach(): IPromise; + detach(): IPromise; + show(): IPromise; + hide(): IPromise; destroy(): void; addClass(newClass: string): void; removeClass(oldClass: string): void; toggleClass(toggleClass: string): void; updatePosition(position: IPanelPosition): void; - registerInterceptor(type: string, callback: () => angular.IPromise): IPanelRef; - removeInterceptor(type: string, callback: () => angular.IPromise): IPanelRef; + registerInterceptor(type: string, callback: () => IPromise): IPanelRef; + removeInterceptor(type: string, callback: () => IPromise): IPanelRef; removeAllInterceptors(type?: string): IPanelRef; } @@ -407,7 +407,7 @@ declare module 'angular' { interface IPanelService { create(opt_config: IPanelConfig): IPanelRef; - open(opt_config: IPanelConfig): angular.IPromise; + open(opt_config: IPanelConfig): IPromise; newPanelPosition(): IPanelPosition; newPanelAnimation(): IPanelAnimation; xPosition: { diff --git a/types/angular-mocks/index.d.ts b/types/angular-mocks/index.d.ts index 14571e2eba..ac9e6cece3 100644 --- a/types/angular-mocks/index.d.ts +++ b/types/angular-mocks/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS (ngMock, ngMockE2E module) 1.5 // Project: http://angularjs.org -// Definitions by: Diego Vilar , Tony Curtis +// Definitions by: Diego Vilar , Tony Curtis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/angular-oauth2/index.d.ts b/types/angular-oauth2/index.d.ts index 1c5e3ac6ed..ef11ee3680 100644 --- a/types/angular-oauth2/index.d.ts +++ b/types/angular-oauth2/index.d.ts @@ -27,9 +27,9 @@ declare module 'angular' { interface OAuth { isAuthenticated(): boolean; - getAccessToken(data: Data, options?: any): angular.IPromise; - getRefreshToken(data?: Data, options?: any): angular.IPromise; - revokeToken(data?: Data, options?: any): angular.IPromise; + getAccessToken(data: Data, options?: any): IPromise; + getRefreshToken(data?: Data, options?: any): IPromise; + revokeToken(data?: Data, options?: any): IPromise; } interface OAuthTokenConfig { diff --git a/types/angular-pdfjs-viewer/index.d.ts b/types/angular-pdfjs-viewer/index.d.ts index 392164bb00..e9c41ef1fe 100644 --- a/types/angular-pdfjs-viewer/index.d.ts +++ b/types/angular-pdfjs-viewer/index.d.ts @@ -8,7 +8,7 @@ import * as angular from 'angular'; declare module 'angular' { namespace pdfjsViewer { - interface ConfigProvider extends angular.IServiceProvider { + interface ConfigProvider extends IServiceProvider { setWorkerSrc(src: string): void; setCmapDir(dir: string): void; setImageDir(dir: string): void; diff --git a/types/angular-resource/angular-resource-tests.ts b/types/angular-resource/angular-resource-tests.ts index c5b71ee39f..4f3a1db1dc 100644 --- a/types/angular-resource/angular-resource-tests.ts +++ b/types/angular-resource/angular-resource-tests.ts @@ -32,7 +32,7 @@ interface IArticleResourceClass extends ng.resource.IResourceClass('/articles/:id', null, { + const articleResource: IArticleResourceClass = $resource('/articles/:id', null, { publish : publishDescriptor, unpublish : { method: 'POST' @@ -51,7 +51,7 @@ function MainController($resource: ng.resource.IResourceService): void { articleResource.unpublish({ id: 1 }); // IResourceClass.get() will be automatically available here - let article: IArticleResource = articleResource.get({id: 1}, function success(): void { + const article: IArticleResource = articleResource.get({id: 1}, function success(): void { // Again, default + custom action here... article.title = 'New Title'; article.$save(); diff --git a/types/angular-resource/index.d.ts b/types/angular-resource/index.d.ts index 4bdc8cc007..13be56637e 100644 --- a/types/angular-resource/index.d.ts +++ b/types/angular-resource/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS (ngResource module) 1.5 // Project: http://angularjs.org -// Definitions by: Diego Vilar , Michael Jess +// Definitions by: Diego Vilar , Michael Jess // Definitions: https://github.com/daptiv/DefinitelyTyped // TypeScript Version: 2.3 @@ -74,10 +74,10 @@ declare module 'angular' { params?: any; url?: string; isArray?: boolean; - transformRequest?: angular.IHttpRequestTransformer | angular.IHttpRequestTransformer[]; - transformResponse?: angular.IHttpResponseTransformer | angular.IHttpResponseTransformer[]; + transformRequest?: IHttpRequestTransformer | IHttpRequestTransformer[]; + transformResponse?: IHttpResponseTransformer | IHttpResponseTransformer[]; headers?: any; - cache?: boolean | angular.ICacheObject; + cache?: boolean | ICacheObject; /** * Note: In contrast to $http.config, promises are not supported in $resource, because the same value * would be used for multiple requests. If you are looking for a way to cancel requests, you should @@ -118,15 +118,15 @@ declare module 'angular' { // it's gonna be considered data if the action method is POST, PUT or // PATCH (in other words, methods with body). Otherwise, it's going // to be considered as parameters to the request. - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465 + // https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L461-L465 // // Only those methods with an HTTP body do have 'data' as first parameter: - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L463 + // https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L463 // More specifically, those methods are POST, PUT and PATCH: - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L432 + // https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L432 // // Also, static calls always return the IResource (or IResourceArray) retrieved - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L549 + // https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L538-L549 interface IResourceClass { new(dataOrParams?: any): T & IResource; get: IResourceMethod; @@ -141,32 +141,32 @@ declare module 'angular' { } // Instance calls always return the the promise of the request which retrieved the object - // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L538-L546 + // https://github.com/angular/js/blob/v1.2.0/src/ngResource/resource.js#L538-L546 interface IResource { - $get(): angular.IPromise; - $get(params?: Object, success?: Function, error?: Function): angular.IPromise; - $get(success: Function, error?: Function): angular.IPromise; + $get(): IPromise; + $get(params?: Object, success?: Function, error?: Function): IPromise; + $get(success: Function, error?: Function): IPromise; - $query(): angular.IPromise>; - $query(params?: Object, success?: Function, error?: Function): angular.IPromise>; - $query(success: Function, error?: Function): angular.IPromise>; + $query(): IPromise>; + $query(params?: Object, success?: Function, error?: Function): IPromise>; + $query(success: Function, error?: Function): IPromise>; - $save(): angular.IPromise; - $save(params?: Object, success?: Function, error?: Function): angular.IPromise; - $save(success: Function, error?: Function): angular.IPromise; + $save(): IPromise; + $save(params?: Object, success?: Function, error?: Function): IPromise; + $save(success: Function, error?: Function): IPromise; - $remove(): angular.IPromise; - $remove(params?: Object, success?: Function, error?: Function): angular.IPromise; - $remove(success: Function, error?: Function): angular.IPromise; + $remove(): IPromise; + $remove(params?: Object, success?: Function, error?: Function): IPromise; + $remove(success: Function, error?: Function): IPromise; - $delete(): angular.IPromise; - $delete(params?: Object, success?: Function, error?: Function): angular.IPromise; - $delete(success: Function, error?: Function): angular.IPromise; + $delete(): IPromise; + $delete(params?: Object, success?: Function, error?: Function): IPromise; + $delete(success: Function, error?: Function): IPromise; $cancelRequest(): void; /** The promise of the original server interaction that created this instance. */ - $promise: angular.IPromise; + $promise: IPromise; $resolved: boolean; toJSON(): T; } @@ -178,18 +178,18 @@ declare module 'angular' { $cancelRequest(): void; /** The promise of the original server interaction that created this collection. */ - $promise: angular.IPromise>; + $promise: IPromise>; $resolved: boolean; } /** when creating a resource factory via IModule.factory */ interface IResourceServiceFactoryFunction { - ($resource: angular.resource.IResourceService): IResourceClass; - >($resource: angular.resource.IResourceService): U; + ($resource: resource.IResourceService): IResourceClass; + >($resource: resource.IResourceService): U; } // IResourceServiceProvider used to configure global settings - interface IResourceServiceProvider extends angular.IServiceProvider { + interface IResourceServiceProvider extends IServiceProvider { defaults: IResourceOptions; } } @@ -197,7 +197,7 @@ declare module 'angular' { /** extensions to base ng based on using angular-resource */ interface IModule { /** creating a resource service factory */ - factory(name: string, resourceServiceFactoryFunction: angular.resource.IResourceServiceFactoryFunction): IModule; + factory(name: string, resourceServiceFactoryFunction: resource.IResourceServiceFactoryFunction): IModule; } namespace auto { @@ -210,7 +210,7 @@ declare module 'angular' { declare global { interface Array { /** The promise of the original server interaction that created this collection. */ - $promise: angular.IPromise; + $promise: IPromise; $resolved: boolean; } } diff --git a/types/angular-sanitize/index.d.ts b/types/angular-sanitize/index.d.ts index 89273b42fb..ad42ec362e 100644 --- a/types/angular-sanitize/index.d.ts +++ b/types/angular-sanitize/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS (ngSanitize module) 1.3 // Project: http://angularjs.org -// Definitions by: Diego Vilar +// Definitions by: Diego Vilar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/angular/angular-component-router.d.ts b/types/angular/angular-component-router.d.ts index b8c939f7c8..b8cd8d097e 100644 --- a/types/angular/angular-component-router.d.ts +++ b/types/angular/angular-component-router.d.ts @@ -1,7 +1,7 @@ /* tslint:disable:dt-header variable-name */ // Type definitions for Angular JS 1.5 component router // Project: http://angularjs.org -// Definitions by: David Reher +// Definitions by: David Reher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace angular { diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 20de01f71f..eec64baed0 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -339,12 +339,12 @@ namespace TestQ { result = $q.all<{a: number; b: string; }>({a: promiseAny, b: promiseAny}); } { - let result = $q.all({ num: $q.when(2), str: $q.when('test') }); + const result = $q.all({ num: $q.when(2), str: $q.when('test') }); // TS should infer that num is a number and str is a string result.then(r => (r.num * 2) + r.str.indexOf('s')); } { - let result = $q.all({ num: $q.when(2), str: 'test' }); + const result = $q.all({ num: $q.when(2), str: 'test' }); // TS should infer that num is a number and str is a string result.then(r => (r.num * 2) + r.str.indexOf('s')); } @@ -378,7 +378,7 @@ namespace TestQ { let result: angular.IPromise; result = $q.resolve(tResult); result = $q.resolve(promiseTResult); - let result2: angular.IPromise = $q.resolve(Math.random() > 0.5 ? tResult : promiseTOther); + const result2: angular.IPromise = $q.resolve(Math.random() > 0.5 ? tResult : promiseTOther); } // $q.when @@ -388,7 +388,6 @@ namespace TestQ { } { let result: angular.IPromise; - let other: angular.IPromise; let resultOther: angular.IPromise; result = $q.when(tResult); @@ -450,8 +449,8 @@ namespace TestDeferred { // deferred.resolve { let result: void; - result = deferred.resolve() as void; - result = deferred.resolve(tResult) as void; + result = deferred.resolve(); + result = deferred.resolve(tResult); } // deferred.reject @@ -488,7 +487,7 @@ namespace TestInjector { class Foobar { constructor($q) {} } - let result: Foobar = $injector.instantiate(Foobar); + const result: Foobar = $injector.instantiate(Foobar); } // $injector.invoke @@ -496,14 +495,14 @@ namespace TestInjector { function foobar(v: boolean): number { return 7; } - let result = $injector.invoke(foobar); + const result = $injector.invoke(foobar); if (!(typeof result === 'number')) { // This fails to compile if 'result' is not exactly a number. - let expectNever: never = result; + const expectNever: never = result; } - let anyFunction: Function = foobar; - let anyResult: string = $injector.invoke(anyFunction); + const anyFunction: Function = foobar; + const anyResult: string = $injector.invoke(anyFunction); } } @@ -1160,11 +1159,7 @@ function NgModelControllerTyping() { ngModel.$asyncValidators['uniqueUsername'] = (modelValue, viewValue) => { const value = modelValue || viewValue; return $http.get('/api/users/' + value). - then(function resolved() { - return $q.reject('exists'); - }, function rejected() { - return true; - }); + then(() => $q.reject('exists'), () => true); }; } diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index f6b74517b8..f48a1d3493 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -1,7 +1,7 @@ // Type definitions for Angular JS 1.6 // Project: http://angularjs.org -// Definitions by: Diego Vilar -// Georgii Dolzhykov +// Definitions by: Diego Vilar +// Georgii Dolzhykov // Caleb St-Denis // Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/angularfire/index.d.ts b/types/angularfire/index.d.ts index e27cbf5721..de1482b0e3 100644 --- a/types/angularfire/index.d.ts +++ b/types/angularfire/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for AngularFire 0.8.2 // Project: http://angularfire.com -// Definitions by: Dénes Harmath +// Definitions by: Dénes Harmath // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/annyang/annyang-tests.ts b/types/annyang/annyang-tests.ts new file mode 100644 index 0000000000..56dd51f417 --- /dev/null +++ b/types/annyang/annyang-tests.ts @@ -0,0 +1,71 @@ +import { Annyang, CommandOption } from 'annyang'; + +declare let annyang: Annyang; +declare let console: any; + +// Tests based on API documentation at https://github.com/TalAter/annyang/blob/master/docs/README.md + +function testStartListening() { + annyang.start({ autoRestart: false }); // $ExpectType void + annyang.start({ autoRestart: false, continuous: false }); // $ExpectType void +} + +function testAddComments() { + let helloFunction = (): string => { + return 'hello'; + }; + + let commands: CommandOption = {'hello :name': helloFunction, howdy: helloFunction}; + let commands2: CommandOption = {hi: helloFunction}; + + annyang.addCommands(commands); // $ExpectType void + annyang.addCommands(commands2); // $ExpectType void + annyang.removeCommands(); // $ExpectType void + annyang.addCommands(commands); // $ExpectType void + annyang.removeCommands('hello'); // $ExpectType void + annyang.removeCommands(['howdy', 'hi']); // $ExpectType void +} + +let notConnected = () => { console.error('network connection error'); }; + +function testAddCallback() { + annyang.addCallback('error', () => console.error('There was an error!') ); // $ExpectType void + + // $ExpectType void + annyang.addCallback('resultMatch', (userSaid, commandText, phrases) => { + console.log(userSaid); + console.log(commandText); + console.log(phrases); + }); + + annyang.addCallback('errorNetwork', notConnected, annyang); // $ExpectType void +} + +function testRemoveCallback() { + let start = () => { console.log('start'); }; + let end = () => { console.log('end'); }; + + annyang.addCallback('start', start); // $ExpectType void + annyang.addCallback('end', end); // $ExpectType void + + annyang.removeCallback(); // $ExpectType void + + annyang.removeCallback('end'); // $ExpectType void + + annyang.removeCallback('start', start); // $ExpectType void + + annyang.removeCallback(undefined, start); // $ExpectType void +} + +function testTrigger() { + annyang.trigger('Time for some thrilling heroics'); + + // $ExpectType void + annyang.trigger( + ['Time for some thrilling heroics', 'Time for some thrilling aerobics'] + ); +} + +function testIsListening() { + annyang.isListening(); // $ExpectType boolean +} diff --git a/types/annyang/index.d.ts b/types/annyang/index.d.ts new file mode 100644 index 0000000000..fee0cb9acb --- /dev/null +++ b/types/annyang/index.d.ts @@ -0,0 +1,230 @@ +// Type definitions for annyang 2.6 +// Project: https://www.talater.com/annyang/ +// Definitions by: Hisham Al-Shurafa +// Lukas Klinzing +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Options for function `start` + * + * @export + * @interface StartOptions + */ +export interface StartOptions { + /** + * Should annyang restart itself if it is closed indirectly, because of silence or window conflicts? + * + * @type {boolean} + */ + autoRestart?: boolean; + /** + * Allow forcing continuous mode on or off. Annyang is pretty smart about this, so only set this if you know what you're doing. + * + * @type {boolean} + */ + continuous?: boolean; +} + +/** + * A command option that supports custom regular expressions + * + * @export + * @interface CommandOptionRegex + */ +export interface CommandOptionRegex { + /** + * @type {RegExp} + */ + regexp: RegExp; + /** + * @type {() => any} + */ + callback(): void; +} + +/** + * Commands that annyang should listen to + * + * #### Examples: + * ````javascript + * {'hello :name': helloFunction, 'howdy': helloFunction}; + * {'hi': helloFunction}; + * ```` + * @export + * @interface CommandOption + */ +export interface CommandOption { + [command: string]: CommandOptionRegex | (() => void); +} + +/** + * Supported Events that will be triggered to listeners, you attach using `annyang.addCallback()` + * + * `start` - Fired as soon as the browser's Speech Recognition engine starts listening + * `error` - Fired when the browser's Speech Recogntion engine returns an error, this generic error callback will be followed by more accurate error callbacks (both will fire if both are defined) + * `errorNetwork` - Fired when Speech Recognition fails because of a network error + * `errorPermissionBlocked` - Fired when the browser blocks the permission request to use Speech Recognition. + * `errorPermissionDenied` - Fired when the user blocks the permission request to use Speech Recognition. + * `end` - Fired when the browser's Speech Recognition engine stops + * `result` - Fired as soon as some speech was identified. This generic callback will be followed by either the `resultMatch` or `resultNoMatch` callbacks. + * Callback functions registered to this event will include an array of possible phrases the user said as the first argument + * `resultMatch` - Fired when annyang was able to match between what the user said and a registered command + * Callback functions registered to this event will include three arguments in the following order: + * * The phrase the user said that matched a command + * * The command that was matched + * * An array of possible alternative phrases the user might've said + * `resultNoMatch` - Fired when what the user said didn't match any of the registered commands. + * Callback functions registered to this event will include an array of possible phrases the user might've said as the first argument + */ +export type Events = + 'start' | + 'soundstart' | + 'error' | + 'end' | + 'result' | + 'resultMatch' | + 'resultNoMatch' | + 'errorNetwork' | + 'errorPermissionBlocked' | + 'errorPermissionDenied'; + +export interface Annyang { + /** + * Start listening. + * It's a good idea to call this after adding some commands first, but not mandatory. + * + * @param {StartOptions} options + */ + start(options?: StartOptions): void; + + /** + * Stop listening, and turn off mic. + * + */ + abort(): void; + + /** + * Pause listening. annyang will stop responding to commands (until the resume or start methods are called), without turning off the browser's SpeechRecognition engine or the mic. + * + */ + pause(): void; + + /** + * Resumes listening and restores command callback execution when a result matches. + * If SpeechRecognition was aborted (stopped), start it. + * + */ + resume(): void; + + /** + * Turn on output of debug messages to the console. Ugly, but super-handy! + * + * @export + * @param {boolean} [newState=true] Turn on/off debug messages + */ + debug(newState?: boolean): void; + + /** + * Set the language the user will speak in. If this method is not called, defaults to 'en-US'. + * + * @param {string} lang + * @see [Languages](https://github.com/TalAter/annyang/blob/master/docs/FAQ.md#what-languages-are-supported) + */ + setLanguage(lang: string): void; + + /** + * Add commands that annyang will respond to. Similar in syntax to init(), but doesn't remove existing commands. + * + * #### Examples: + * ````javascript + * var commands = {'hello :name': helloFunction, 'howdy': helloFunction}; + * var commands2 = {'hi': helloFunction}; + * + * annyang.addCommands(commands); + * annyang.addCommands(commands2); + * // annyang will now listen to all three commands + * ```` + * + * @param {CommandOption} commands + */ + addCommands(commands: CommandOption): void; + + /** + * Removes all existing commands or a specific command + * #### Examples: + * ````javascript + * var commands : annyang.CommandOption = {'hello': helloFunction, 'howdy': helloFunction, 'hi': helloFunction}; + * + * // Don't respond to hello + * annyang.removeCommands('hello'); + * + * // Remove all existing commands + * annyang.removeCommands(); + * ```` + * @param {string} command + */ + removeCommands(command?: string): void; + + /** + * Removes a list of commands + * #### Examples: + * ````javascript + * var commands : annyang.CommandOption = {'hello': helloFunction, 'howdy': helloFunction, 'hi': helloFunction}; + * // Add some commands + * annyang.addCommands(commands); + * // Don't respond to howdy or hi + * annyang.removeCommands(['howdy', 'hi']); + * ```` + * + * @param {string[]} command + */ + removeCommands(command: string[]): void; + + /** + * @param {Events} event + * @param {(userSaid : string, commandText : string, results : string[]) => void} callback + * @param {*} [context] + */ + addCallback(event: Events, callback: (userSaid?: string, commandText?: string, results?: string[]) => void, context?: any): void; + + /** + * @param {Events} [event] + * @param {Function} [callback] + */ + removeCallback(event?: Events, callback?: (userSaid: string, commandText: string, results: string[]) => void): void; + + /** + * Returns true if speech recognition is currently on. + * Returns false if speech recognition is off or annyang is paused. + * + * @returns {boolean} + */ + isListening(): boolean; + + /** + * Returns the instance of the browser's SpeechRecognition object used by annyang. + * Useful in case you want direct access to the browser's Speech Recognition engine. + * + * @returns {*} + */ + getSpeechRecognizer(): any; + + /** + * Simulate speech being recognized. This will trigger the same events and behavior as when the Speech Recognition + * detects speech. + * + * Can accept either a string containing a single sentence, or an array containing multiple sentences to be checked + * in order until one of them matches a command (similar to the way Speech Recognition Alternatives are parsed) + * + * #### Examples: + * ````javascript + * annyang.trigger('Time for some thrilling heroics'); + * annyang.trigger( + * ['Time for some thrilling heroics', 'Time for some thrilling aerobics'] + * ); + * ```` + * + * @param {string} command + */ + trigger(command: string | string[]): void; +} diff --git a/types/annyang/tsconfig.json b/types/annyang/tsconfig.json new file mode 100644 index 0000000000..f54c7cd18c --- /dev/null +++ b/types/annyang/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", + "annyang-tests.ts" + ] +} diff --git a/types/annyang/tslint.json b/types/annyang/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/annyang/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/applepayjs/applepayjs-tests.ts b/types/applepayjs/applepayjs-tests.ts index 5adf61e45c..505dbd2daf 100644 --- a/types/applepayjs/applepayjs-tests.ts +++ b/types/applepayjs/applepayjs-tests.ts @@ -6,7 +6,7 @@ declare function it(desc: string, fn: () => void): void; describe("ApplePaySession", () => { it("the constants are defined", () => { - let status = 0; + const status = 0; switch (status) { case ApplePaySession.STATUS_FAILURE: case ApplePaySession.STATUS_INVALID_BILLING_POSTAL_ADDRESS: @@ -43,8 +43,8 @@ describe("ApplePaySession", () => { it("can call static methods", () => { const merchantIdentifier = "MyMerchantId"; - let canMakePayments: boolean = ApplePaySession.canMakePayments(); - let supported: boolean = ApplePaySession.supportsVersion(2); + const canMakePayments: boolean = ApplePaySession.canMakePayments(); + const supported: boolean = ApplePaySession.supportsVersion(2); ApplePaySession.canMakePaymentsWithActiveCard(merchantIdentifier) .then((status: boolean) => { @@ -168,7 +168,7 @@ describe("ApplePaySession", () => { }); describe("ApplePayPaymentRequest", () => { it("can create a new instance", () => { - let paymentRequest: ApplePayJS.ApplePayPaymentRequest = { + const paymentRequest: ApplePayJS.ApplePayPaymentRequest = { applicationData: "ApplicationData", countryCode: "GB", currencyCode: "GBP", @@ -181,8 +181,8 @@ describe("ApplePayPaymentRequest", () => { "amex", "discover", "jcb", - "master​Card", - "private​Label", + "masterCard", + "privateLabel", "visa" ], total: { diff --git a/types/applepayjs/index.d.ts b/types/applepayjs/index.d.ts index 34d3c41a99..f705a4fad2 100644 --- a/types/applepayjs/index.d.ts +++ b/types/applepayjs/index.d.ts @@ -10,7 +10,7 @@ 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. + * @param paymentRequest - An ApplePayPaymentRequest object that contains the information that is displayed on the Apple Pay payment sheet. */ constructor(version: number, paymentRequest: ApplePayJS.ApplePayPaymentRequest); @@ -95,8 +95,8 @@ declare class ApplePaySession extends EventTarget { /** * 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. + * @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase. + * @param newLineItems - A sequence of ApplePayLineItem dictionaries. */ completePaymentMethodSelection(newTotal: ApplePayJS.ApplePayLineItem, newLineItems: ApplePayJS.ApplePayLineItem[]): void; @@ -104,8 +104,8 @@ declare class ApplePaySession extends EventTarget { * 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. + * @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase. + * @param newLineItems - A sequence of ApplePayLineItem dictionaries. */ completeShippingContactSelection( status: number, @@ -116,8 +116,8 @@ declare class ApplePaySession extends EventTarget { /** * 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. + * @param newTotal - An ApplePayLineItem dictionary representing the total price for the purchase. + * @param newLineItems - A sequence of ApplePayLineItem dictionaries. */ completeShippingMethodSelection(status: number, newTotal: ApplePayJS.ApplePayLineItem, newLineItems: ApplePayJS.ApplePayLineItem[]): void; @@ -204,7 +204,7 @@ declare namespace ApplePayJS { } /** - * The Apple​Pay​Payment​Authorized​Event class defines the attributes contained by the ApplePaySession.onpaymentauthorized callback function. + * The ApplePayPaymentAuthorizedEvent class defines the attributes contained by the ApplePaySession.onpaymentauthorized callback function. */ abstract class ApplePayPaymentAuthorizedEvent extends Event { /** @@ -279,7 +279,7 @@ declare namespace ApplePayJS { /** * 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. + * The value is one of the supported networks specified in the supportedNetworks property of the ApplePayPaymentRequest. */ network: string; @@ -295,7 +295,7 @@ declare namespace ApplePayJS { } /** - * The Apple​Pay​Payment​Method​Selected​Event class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function. + * The ApplePayPaymentMethodSelectedEvent class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function. */ abstract class ApplePayPaymentMethodSelectedEvent extends Event { /** @@ -426,7 +426,7 @@ declare namespace ApplePayJS { } /** - * The Apple​Pay​Shipping​Contact​Selected​Event class defines the attributes contained by the ApplePaySession.onshippingcontactselected callback function. + * The ApplePayShippingContactSelectedEvent class defines the attributes contained by the ApplePaySession.onshippingcontactselected callback function. */ abstract class ApplePayShippingContactSelectedEvent extends Event { /** @@ -461,7 +461,7 @@ declare namespace ApplePayJS { } /** - * The Apple​Pay​Shipping​Method​Selected​Event class defines the attribute contained by the ApplePaySession.onshippingmethodselected callback function. + * The ApplePayShippingMethodSelectedEvent class defines the attribute contained by the ApplePaySession.onshippingmethodselected callback function. */ abstract class ApplePayShippingMethodSelectedEvent extends Event { /** @@ -471,7 +471,7 @@ declare namespace ApplePayJS { } /** - * The Apple​Pay​Validate​Merchant​Event class defines the attributes contained by the ApplePaySession.onvalidatemerchant callback function. + * The ApplePayValidateMerchantEvent class defines the attributes contained by the ApplePaySession.onvalidatemerchant callback function. */ abstract class ApplePayValidateMerchantEvent extends Event { /** diff --git a/types/applicationinsights-js/applicationinsights-js-tests.ts b/types/applicationinsights-js/applicationinsights-js-tests.ts index ecefb6d41a..49c68181f8 100644 --- a/types/applicationinsights-js/applicationinsights-js-tests.ts +++ b/types/applicationinsights-js/applicationinsights-js-tests.ts @@ -123,7 +123,7 @@ context.addTelemetryInitializer(envelope => { }); // a sample from: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md#example context.addTelemetryInitializer(envelope => { - let telemetryItem = envelope.data.baseData; + const telemetryItem = envelope.data.baseData; if (envelope.name === Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType) { telemetryItem.url = "URL CENSORED"; } diff --git a/types/applicationinsights-js/tslint.json b/types/applicationinsights-js/tslint.json index 0cc2f62b56..4b24c7ab0a 100644 --- a/types/applicationinsights-js/tslint.json +++ b/types/applicationinsights-js/tslint.json @@ -1,8 +1,11 @@ { "extends": "dtslint/dt.json", "rules": { - "interface-name": [ false ], + // All are TODOs + "interface-name": false, "no-internal-module": false, - "no-single-declare-module": false + "no-mergeable-namespace": false, + "no-single-declare-module": false, + "no-unnecessary-qualifier": false } } diff --git a/types/argparse/index.d.ts b/types/argparse/index.d.ts index 845d5d8fd3..2661b01c12 100644 --- a/types/argparse/index.d.ts +++ b/types/argparse/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for argparse v1.0.3 // Project: https://github.com/nodeca/argparse -// Definitions by: Andrew Schurman +// Definitions by: Andrew Schurman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/ascii2mathml/ascii2mathml-tests.ts b/types/ascii2mathml/ascii2mathml-tests.ts new file mode 100644 index 0000000000..9cb54443a4 --- /dev/null +++ b/types/ascii2mathml/ascii2mathml-tests.ts @@ -0,0 +1,17 @@ +import * as ascii2mathml from 'ascii2mathml'; + +let fn = ascii2mathml({}); // $ExpectType any +fn(''); // $ExpectType string +ascii2mathml('', {}); // $ExpectType string + +// $ExpectType string +ascii2mathml('', { + decimalMark: '.', + colSep: ',', + rowSep: ';', + display: 'inline', + dir: 'ltr', + bare: false, + standalone: false, + annotate: false +}); diff --git a/types/ascii2mathml/index.d.ts b/types/ascii2mathml/index.d.ts new file mode 100644 index 0000000000..2b02dfea15 --- /dev/null +++ b/types/ascii2mathml/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for ascii2mathml 0.5 +// Project: https://github.com/runarberg/ascii2mathml +// Definitions by: Muhammad Ragib Hasin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = A2MML; + +declare var A2MML: ascii2mathml; + +interface Options { + decimalMark?: string; + colSep?: string; + rowSep?: string; + display?: 'inline' | 'block'; + dir?: 'ltr' | 'rtl'; + bare?: boolean; + standalone?: boolean; + annotate?: boolean; +} + +interface ascii2mathml { + /** + * Generates a function with default options set to convert + * ASCIIMath expression to MathML markup. + * @param options Options + */ + (options: Options): ascii2mathml; + + /** + * Converts ASCIIMath expression to MathML markup. + * @param asciimath {string} ASCIIMath expression + * @param options Options + */ + (asciimath: string, options?: Options): string; +} diff --git a/types/ascii2mathml/tsconfig.json b/types/ascii2mathml/tsconfig.json new file mode 100644 index 0000000000..22e7823b58 --- /dev/null +++ b/types/ascii2mathml/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", + "ascii2mathml-tests.ts" + ] +} diff --git a/types/ascii2mathml/tslint.json b/types/ascii2mathml/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ascii2mathml/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/askmethat-rating/askmethat-rating-tests.ts b/types/askmethat-rating/askmethat-rating-tests.ts index af0ab3cb88..af985d6358 100644 --- a/types/askmethat-rating/askmethat-rating-tests.ts +++ b/types/askmethat-rating/askmethat-rating-tests.ts @@ -1,6 +1,6 @@ import { AskmethatRating, AskmethatRatingSteps } from "askmethat-rating"; -let options = { +const options = { backgroundColor: "#e5e500", hoverColor: "#ffff66", fontClass: "fa fa-star", @@ -11,8 +11,8 @@ let options = { inputName: "AskmethatRating" }; -let div = document.createElement("div"); -let amcRating = new AskmethatRating(div, 2 , options); +const div = document.createElement("div"); +const amcRating = new AskmethatRating(div, 2 , options); options.readonly = true; amcRating.defaultOptions = options; diff --git a/types/auth0-lock/auth0-lock-tests.ts b/types/auth0-lock/auth0-lock-tests.ts index 3abe93a7c2..0642453a13 100644 --- a/types/auth0-lock/auth0-lock-tests.ts +++ b/types/auth0-lock/auth0-lock-tests.ts @@ -4,7 +4,7 @@ import Auth0Lock from 'auth0-lock'; const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID"; const DOMAIN = "YOUR_DOMAIN_AT.auth0.com"; -var lock: Auth0LockStatic = new Auth0Lock(CLIENT_ID, DOMAIN); +const lock: Auth0LockStatic = new Auth0Lock(CLIENT_ID, DOMAIN); lock.show(); lock.hide(); @@ -12,7 +12,7 @@ lock.logout(() => {}); // Show supports UI arguments -var showOptions : Auth0LockShowOptions = { +const showOptions : Auth0LockShowOptions = { allowedConnections: [ "twitter", "facebook" ], allowSignUp: true, allowForgotPassword: false, @@ -63,7 +63,7 @@ lock.on("authenticated", function(authResult : any) { // test theme -var themeOptions : Auth0LockConstructorOptions = { +const themeOptions : Auth0LockConstructorOptions = { theme: { authButtons: { fooProvider: { @@ -86,7 +86,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, themeOptions); // test empty theme -var themeOptionsEmpty : Auth0LockConstructorOptions = { +const themeOptionsEmpty : Auth0LockConstructorOptions = { theme: { } }; @@ -94,7 +94,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, themeOptions); // test authentication -var authOptions : Auth0LockConstructorOptions = { +const authOptions : Auth0LockConstructorOptions = { auth: { params: { state: "foo" }, redirect: true, @@ -108,7 +108,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, authOptions); // test multi-variant example -var multiVariantOptions : Auth0LockConstructorOptions = { +const multiVariantOptions : Auth0LockConstructorOptions = { container: "myContainer", closable: false, languageDictionary: { @@ -122,7 +122,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, multiVariantOptions); // test text-field additional sign up field -var textFieldOptions : Auth0LockConstructorOptions = { +const textFieldOptions : Auth0LockConstructorOptions = { additionalSignUpFields: [{ name: "address", placeholder: "enter your address", @@ -142,7 +142,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, textFieldOptions); // test select-field additional sign up field -var selectFieldOptions : Auth0LockConstructorOptions = { +const selectFieldOptions : Auth0LockConstructorOptions = { additionalSignUpFields: [{ type: "select", name: "location", @@ -162,7 +162,7 @@ new Auth0Lock(CLIENT_ID, DOMAIN, selectFieldOptions); // test select-field additional sign up field with callbacks for -var selectFieldOptionsWithCallbacks : Auth0LockConstructorOptions = { +const selectFieldOptionsWithCallbacks : Auth0LockConstructorOptions = { additionalSignUpFields: [{ type: "select", name: "location", @@ -171,7 +171,7 @@ var selectFieldOptionsWithCallbacks : Auth0LockConstructorOptions = { // obtain options, in case of error you call cb with the error in the // first arg instead of null - let options = [ + const options = [ {value: "us", label: "United States"}, {value: "fr", label: "France"}, {value: "ar", label: "Argentina"} @@ -184,7 +184,7 @@ var selectFieldOptionsWithCallbacks : Auth0LockConstructorOptions = { // obtain prefill, in case of error you call cb with the error in the // first arg instead of null - let prefill = "us"; + const prefill = "us"; cb(null, prefill); } @@ -195,13 +195,13 @@ new Auth0Lock(CLIENT_ID, DOMAIN, selectFieldOptionsWithCallbacks); // test Avatar options -var avatarOptions : Auth0LockConstructorOptions = { +const avatarOptions : Auth0LockConstructorOptions = { avatar: { url: (email : string, cb : Auth0LockAvatarUrlCallback) => { // obtain url for email, in case of error you call cb with the error in // the first arg instead of null - let url = "url"; + const url = "url"; cb(null, url); }, @@ -209,7 +209,7 @@ var avatarOptions : Auth0LockConstructorOptions = { // obtain displayName for email, in case of error you call cb with the // error in the first arg instead of null - let displayName = "displayName"; + const displayName = "displayName"; cb(null, displayName); } @@ -218,7 +218,7 @@ var avatarOptions : Auth0LockConstructorOptions = { new Auth0Lock(CLIENT_ID, DOMAIN, avatarOptions); -var authResult : AuthResult = { +const authResult : AuthResult = { accessToken: 'fake_access_token', idToken: 'fake_id_token', idTokenPayload: { diff --git a/types/auth0/index.d.ts b/types/auth0/index.d.ts index 07a316268a..cb84c7a6bd 100644 --- a/types/auth0/index.d.ts +++ b/types/auth0/index.d.ts @@ -360,6 +360,7 @@ export class ManagementClient { // Users getUsers(params?: GetUsersData): Promise; + getUsers(cb: (err: Error, users: User[]) => void): void; getUsers(params?: GetUsersData, cb?: (err: Error, users: User[]) => void): void; getUser(params: ObjectWithId): Promise; diff --git a/types/auto-sni/auto-sni-tests.ts b/types/auto-sni/auto-sni-tests.ts index a271a1a1ad..6be54148fb 100644 --- a/types/auto-sni/auto-sni-tests.ts +++ b/types/auto-sni/auto-sni-tests.ts @@ -1,5 +1,5 @@ import * as autosni from "auto-sni"; -let a = autosni({ +const a = autosni({ agreeTos: true, email: '', domains: [''] diff --git a/types/babel-generator/babel-generator-tests.ts b/types/babel-generator/babel-generator-tests.ts index 1aeec38831..5efb98ba24 100644 --- a/types/babel-generator/babel-generator-tests.ts +++ b/types/babel-generator/babel-generator-tests.ts @@ -11,7 +11,7 @@ ast.loc.start; const output = generate(ast, { /* options */ }, code); // Example from https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-generator -let result = generate(ast, { +const result = generate(ast, { retainLines: false, compact: "auto", concise: false, diff --git a/types/babel-traverse/babel-traverse-tests.ts b/types/babel-traverse/babel-traverse-tests.ts index 571620fd09..1dd95060e4 100644 --- a/types/babel-traverse/babel-traverse-tests.ts +++ b/types/babel-traverse/babel-traverse-tests.ts @@ -29,7 +29,7 @@ const ast = babylon.parse(code); traverse(ast, { enter(path) { - let node = path.node; + const node = path.node; if (t.isIdentifier(node) && node.name === "n") { node.name = "x"; } @@ -85,10 +85,10 @@ const v1: Visitor = { // ... } - let id1 = path.scope.generateUidIdentifier("uid"); + const id1 = path.scope.generateUidIdentifier("uid"); id1.type; id1.name; - let id2 = path.scope.generateUidIdentifier("uid"); + const id2 = path.scope.generateUidIdentifier("uid"); id2.type; id2.name; diff --git a/types/babel-traverse/index.d.ts b/types/babel-traverse/index.d.ts index 01f00c75c8..526f8ffd1c 100644 --- a/types/babel-traverse/index.d.ts +++ b/types/babel-traverse/index.d.ts @@ -8,7 +8,7 @@ import * as t from 'babel-types'; export type Node = t.Node; -export default function traverse(parent: Node | Node[], opts?: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void; +export default function traverse(parent: Node | Node[], opts?: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void; export interface TraverseOptions extends Visitor { scope?: Scope; @@ -16,8 +16,8 @@ export interface TraverseOptions extends Visitor { } export class Scope { - constructor(path: NodePath, parentScope?: Scope); - path: NodePath; + constructor(path: NodePath, parentScope?: Scope); + path: NodePath; block: Node; parentBlock: Node; parent: Scope; @@ -61,13 +61,13 @@ export class Scope { toArray(node: Node, i?: number): Node; - registerDeclaration(path: NodePath): void; + registerDeclaration(path: NodePath): void; buildUndefinedNode(): Node; - registerConstantViolation(path: NodePath): void; + registerConstantViolation(path: NodePath): void; - registerBinding(kind: string, path: NodePath, bindingPath?: NodePath): void; + registerBinding(kind: string, path: NodePath, bindingPath?: NodePath): void; addGlobal(node: Node): void; @@ -121,16 +121,16 @@ export class Scope { } export class Binding { - constructor(opts: { existing: Binding; identifier: t.Identifier; scope: Scope; path: NodePath; kind: 'var' | 'let' | 'const'; }); + constructor(opts: { existing: Binding; identifier: t.Identifier; scope: Scope; path: NodePath; kind: 'var' | 'let' | 'const'; }); identifier: t.Identifier; scope: Scope; - path: NodePath; + path: NodePath; kind: 'var' | 'let' | 'const' | 'module'; referenced: boolean; references: number; - referencePaths: Array>; + referencePaths: NodePath[]; constant: boolean; - constantViolations: Array>; + constantViolations: NodePath[]; } export interface Visitor extends VisitNodeObject { @@ -328,7 +328,7 @@ export class NodePath { state: any; opts: object; skipKeys: object; - parentPath: NodePath; + parentPath: NodePath; context: TraversalContext; container: object | object[]; listKey: string; @@ -362,15 +362,15 @@ export class NodePath { * Call the provided `callback` with the `NodePath`s of all the parents. * When the `callback` returns a truthy value, we return that node path. */ - findParent(callback: (path: NodePath) => boolean): NodePath; + findParent(callback: (path: NodePath) => boolean): NodePath; - find(callback: (path: NodePath) => boolean): NodePath; + find(callback: (path: NodePath) => boolean): NodePath; /** Get the parent function of the current path. */ - getFunctionParent(): NodePath; + getFunctionParent(): NodePath; /** Walk up the tree until we hit a parent node path in a list. */ - getStatementParent(): NodePath; + getStatementParent(): NodePath; /** * Get the deepest common ancestor and then from it, get the earliest relationship path @@ -379,20 +379,20 @@ export class NodePath { * Earliest is defined as being "before" all the other nodes in terms of list container * position and visiting key. */ - getEarliestCommonAncestorFrom(paths: Array>): Array>; + getEarliestCommonAncestorFrom(paths: NodePath[]): NodePath[]; /** Get the earliest path in the tree where the provided `paths` intersect. */ getDeepestCommonAncestorFrom( - paths: Array>, - filter?: (deepest: Node, i: number, ancestries: Array>) => NodePath - ): NodePath; + paths: NodePath[], + filter?: (deepest: Node, i: number, ancestries: NodePath[]) => NodePath + ): NodePath; /** * Build an array of node paths containing the entire ancestry of the current node path. * * NOTE: The current node path is included in this. */ - getAncestry(): Array>; + getAncestry(): NodePath[]; inType(...candidateTypes: string[]): boolean; @@ -404,7 +404,7 @@ export class NodePath { couldBeBaseType(name: string): boolean; - baseTypeStrictlyMatches(right: NodePath): boolean; + baseTypeStrictlyMatches(right: NodePath): boolean; isGenericType(genericName: string): boolean; @@ -428,7 +428,7 @@ export class NodePath { replaceWithSourceString(replacement: any): void; /** Replace the current node with another. */ - replaceWith(replacement: Node | NodePath): void; + replaceWith(replacement: Node | NodePath): void; /** * This method takes an array of statements nodes and then explodes it @@ -573,13 +573,13 @@ export class NodePath { hoist(scope: Scope): void; // ------------------------- family ------------------------- - getOpposite(): NodePath; + getOpposite(): NodePath; - getCompletionRecords(): Array>; + getCompletionRecords(): NodePath[]; - getSibling(key: string): NodePath; + getSibling(key: string): NodePath; - get(key: string, context?: boolean | TraversalContext): NodePath; + get(key: string, context?: boolean | TraversalContext): NodePath; getBindingIdentifiers(duplicates?: boolean): Node[]; @@ -960,7 +960,7 @@ export class Hub { } export interface TraversalContext { - parentPath: NodePath; + parentPath: NodePath; scope: Scope; state: any; opts: any; diff --git a/types/babel-types/babel-types-tests.ts b/types/babel-types/babel-types-tests.ts index 0ef79f39f4..af8ab2d0b7 100644 --- a/types/babel-types/babel-types-tests.ts +++ b/types/babel-types/babel-types-tests.ts @@ -2,11 +2,11 @@ import traverse from "babel-traverse"; import * as t from "babel-types"; -let ast: t.Node; +declare const ast: t.Node; traverse(ast, { enter(path) { - let node = path.node; + const node = path.node; if (t.isIdentifier(node, { name: "n" })) { node.name = "x"; } @@ -31,7 +31,7 @@ const exp: t.Expression = t.nullLiteral(); // https://github.com/babel/babel/blob/4e50b2d9d9c376cee7a2cbf56553fe5b982ea53c/packages/babel-plugin-transform-react-inline-elements/src/index.js#L61 traverse(ast, { JSXElement(path, file) { - const { node } = path; + const { node } = path; const open = node.openingElement; // init diff --git a/types/babylon/babylon-tests.ts b/types/babylon/babylon-tests.ts index d844b9a8f7..2a5ddfcb57 100644 --- a/types/babylon/babylon-tests.ts +++ b/types/babylon/babylon-tests.ts @@ -6,7 +6,7 @@ const code = `function square(n) { return n * n; }`; -let node = babylon.parse(code); +const node = babylon.parse(code); assert(node.type === "File"); assert(node.start === 0); assert(node.end === 38); diff --git a/types/bagpipes/bagpipes-tests.ts b/types/bagpipes/bagpipes-tests.ts index af7dfa0a31..eaa412d56b 100755 --- a/types/bagpipes/bagpipes-tests.ts +++ b/types/bagpipes/bagpipes-tests.ts @@ -56,11 +56,11 @@ const pipesConfigFullEmpty: Bagpipes.Config = { userViewsDirs: [] }; -let pipesA = Bagpipes.create(perDefsMixed, { +const pipesA = Bagpipes.create(perDefsMixed, { connectMiddlewareDirs: ['some_dir', 'ssssss'], swaggerNodeRunner: {} }); -let pipeA = pipesA.getPipe('HelloWorld'); +const pipeA = pipesA.getPipe('HelloWorld'); // log the output to standard out pipeA.fit((context, cb) => { @@ -81,7 +81,7 @@ const pipeErrTest = pipesEnty.pipes['any'].fit((context, cb) => { pipesEnty.play(pipeErrTest, {}); const fittingsC = ["xxxx", "aaa"].map((name) => { - let fittingDef = {} as Bagpipes.PipeDefMap; + const fittingDef = {} as Bagpipes.PipeDefMap; fittingDef[name] = 'nothing'; return fittingDef; }); @@ -95,6 +95,6 @@ bagpipesD.play(bagpipesD.getPipe('objPipe'), {}); // Test full create const userFittingsDirs = ['./fixtures/fittings']; const pipeWithString = ['emit']; -let contextPlain = {}; +const contextPlain = {}; const bagpipesWithPipeAndFittings = Bagpipes.create({ myCustomPipe: pipeWithString }, { userFittingsDirs }); bagpipesWithPipeAndFittings.play(bagpipesWithPipeAndFittings.getPipe('myCustomPipe'), contextPlain); diff --git a/types/baidumap-web-sdk/baidumap-web-sdk-tests.ts b/types/baidumap-web-sdk/baidumap-web-sdk-tests.ts index cc525509c6..8ac6457975 100644 --- a/types/baidumap-web-sdk/baidumap-web-sdk-tests.ts +++ b/types/baidumap-web-sdk/baidumap-web-sdk-tests.ts @@ -4,8 +4,8 @@ namespace BMapTests { //document: http://lbsyun.baidu.com/index.php?title=jspopular public createMap(container: string | HTMLElement) { navigator.geolocation.getCurrentPosition((position: Position) => { - let point = new BMap.Point(position.coords.longitude, position.coords.latitude); - let map = new BMap.Map(container); + const point = new BMap.Point(position.coords.longitude, position.coords.latitude); + const map = new BMap.Map(container); map.centerAndZoom(point, 15); }, console.log, { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true }); } @@ -16,7 +16,7 @@ namespace BMapTests { map.addControl(new BMap.OverviewMapControl({ isOpen: true, anchor: BMAP_ANCHOR_BOTTOM_RIGHT })); } public addMarker(map: BMap.Map, point: BMap.Point) { - var marker = new BMap.Marker(point); + const marker = new BMap.Marker(point); map.addOverlay(marker); marker.setAnimation(BMAP_ANIMATION_BOUNCE); } diff --git a/types/batch-stream/index.d.ts b/types/batch-stream/index.d.ts index 26c433a04b..2ab8c6b8c5 100644 --- a/types/batch-stream/index.d.ts +++ b/types/batch-stream/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for batch-stream 0.1.2 // Project: https://github.com/segmentio/batch-stream -// Definitions by: Nicholas Penree +// Definitions by: Nicholas Penree // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/bignumber.js/bignumber.js-tests.ts b/types/bignumber.js/bignumber.js-tests.ts index 8ea0775dba..424665d8ba 100644 --- a/types/bignumber.js/bignumber.js-tests.ts +++ b/types/bignumber.js/bignumber.js-tests.ts @@ -182,7 +182,7 @@ x.floor(); y = new BigNumber(-1.3); y.floor(); -0.1 > (0.3 - 0.2); +0.1 > (0.3 - 0.2); // tslint:disable-line binary-expression-operand-order x = new BigNumber(0.1); x.greaterThan(BigNumber(0.3).minus(0.2)); BigNumber(0).gt(x); diff --git a/types/bleno/bleno-tests.ts b/types/bleno/bleno-tests.ts index 7dcb47ff35..bd4b6971ee 100644 --- a/types/bleno/bleno-tests.ts +++ b/types/bleno/bleno-tests.ts @@ -45,7 +45,7 @@ Bleno.on('stateChange', (state: string) => { } }); -let characteristic = new EchoCharacteristic(); +const characteristic = new EchoCharacteristic(); Bleno.on('advertisingStart', (error: string) => { if (!error) { Bleno.setServices( diff --git a/types/bloomfilter/bloomfilter-tests.ts b/types/bloomfilter/bloomfilter-tests.ts index 650cc97eb4..96ee0443b6 100644 --- a/types/bloomfilter/bloomfilter-tests.ts +++ b/types/bloomfilter/bloomfilter-tests.ts @@ -1,7 +1,7 @@ import { BloomFilter } from 'bloomfilter'; function test_bloomfilter() { - const m: number = 10; - const k: number = 2; + const m = 10; + const k = 2; const bloomFilter = new BloomFilter(m, k); const array: Int32Array[] = bloomFilter.buckets; diff --git a/types/bookshelf/bookshelf-tests.ts b/types/bookshelf/bookshelf-tests.ts index f42a1bf784..75d91d73df 100644 --- a/types/bookshelf/bookshelf-tests.ts +++ b/types/bookshelf/bookshelf-tests.ts @@ -182,10 +182,10 @@ exports.down = (knex: Knex) => { { class Site extends bookshelf.Model { - get tableName() { return 'sites'; } - photo(): Photo { - return this.morphOne(Photo, 'imageable'); - } + get tableName() { return 'sites'; } + photo(): Photo { + return this.morphOne(Photo, 'imageable'); + } } class Post extends bookshelf.Model { diff --git a/types/bookshelf/index.d.ts b/types/bookshelf/index.d.ts index 914107816f..0b22e60b69 100644 --- a/types/bookshelf/index.d.ts +++ b/types/bookshelf/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for bookshelfjs v0.9.3 // Project: http://bookshelfjs.org/ -// Definitions by: Andrew Schurman , Vesa Poikajärvi +// Definitions by: Andrew Schurman , Vesa Poikajärvi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -84,6 +84,10 @@ declare namespace Bookshelf { values(): any[]; } + interface ModelSubclass { + new(): Model; + } + class Model> extends ModelBase { static collection>(models?: T[], options?: CollectionOptions): Collection; static count(column?: string, options?: SyncOptions): BlueBird; @@ -106,8 +110,8 @@ declare namespace Bookshelf { load(relations: string | string[], options?: LoadOptions): BlueBird; morphMany>(target: { new (...args: any[]): R }, name?: string, columnNames?: string[], morphValue?: string): Collection; morphOne>(target: { new (...args: any[]): R }, name?: string, columnNames?: string[], morphValue?: string): R; - morphTo(name: string, columnNames?: string[], ...target: typeof Model[]): T; - morphTo(name: string, ...target: typeof Model[]): T; + morphTo(name: string, columnNames?: string[], ...target: ModelSubclass[]): T; + morphTo(name: string, ...target: ModelSubclass[]): T; orderBy(column: string, order?: SortOrder): T; // Declaration order matters otherwise TypeScript gets confused between query() and query(...query: string[]) @@ -120,7 +124,7 @@ declare namespace Bookshelf { resetQuery(): T; save(key?: string, val?: any, options?: SaveOptions): BlueBird; save(attrs?: { [key: string]: any }, options?: SaveOptions): BlueBird; - through>(interim: typeof Model, throughForeignKey?: string, otherKey?: string): R; + through>(interim: ModelSubclass, throughForeignKey?: string, otherKey?: string): R; where(properties: { [key: string]: any }): T; where(key: string, operatorOrValue: string | number | boolean, valueIfOperator?: string | number | boolean): T; @@ -255,7 +259,7 @@ declare namespace Bookshelf { query(query: { [key: string]: any }): Collection; resetQuery(): Collection; - through>(interim: typeof Model, throughForeignKey?: string, otherKey?: string): Collection; + through>(interim: ModelSubclass, throughForeignKey?: string, otherKey?: string): Collection; updatePivot(attributes: any, options?: PivotOptions): BlueBird; withPivot(columns: string[]): Collection; diff --git a/types/boom/index.d.ts b/types/boom/index.d.ts index 97a0f7ef59..8025a7ddab 100644 --- a/types/boom/index.d.ts +++ b/types/boom/index.d.ts @@ -1,8 +1,8 @@ // Type definitions for boom 4.3 -// Project: http://github.com/hapijs/boom -// Definitions by: Igor Rogatty -// AJP -// Jinesh Shah +// Project: https://github.com/hapijs/boom +// Definitions by: Igor Rogatty +// AJP +// Jinesh Shah // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/boom/v3/index.d.ts b/types/boom/v3/index.d.ts index 2c0a3ce21d..adf433c9f4 100644 --- a/types/boom/v3/index.d.ts +++ b/types/boom/v3/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for boom 3.2 -// Project: http://github.com/hapijs/boom -// Definitions by: Igor Rogatty +// Project: https://github.com/hapijs/boom +// Definitions by: Igor Rogatty // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts b/types/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts index 9f2b780f44..fe985e229f 100644 --- a/types/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts +++ b/types/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts @@ -118,7 +118,7 @@ function test_timeZone() { function test_widgetParent() { let nullW: null = null; - let str: string = "myId"; + let str = "myId"; let jquery = $("#element"); $("#picker").datetimepicker({ diff --git a/types/bootstrap.v3.datetimepicker/index.d.ts b/types/bootstrap.v3.datetimepicker/index.d.ts index 9f2f5dda78..7b1d3877ba 100644 --- a/types/bootstrap.v3.datetimepicker/index.d.ts +++ b/types/bootstrap.v3.datetimepicker/index.d.ts @@ -589,7 +589,7 @@ export interface UpdateEvent extends JQueryEventObject { viewDate: moment.Moment; } -export type EventName = "dp.show" | "dp.hide" | "dp.error"; +export type EventName = "dp.show" | "dp.hide" | "dp.error"; declare global { interface JQuery { diff --git a/types/bounce.js/index.d.ts b/types/bounce.js/index.d.ts index 0db872fb30..c90f709a97 100644 --- a/types/bounce.js/index.d.ts +++ b/types/bounce.js/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Bounce.js v0.8.2 -// Project: http://github.com/tictail/bounce.js -// Definitions by: Cherry +// Project: https://github.com/tictail/bounce.js +// Definitions by: Cherry // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/box2d/README.md b/types/box2d/README.md index 9a775a1962..e16b327ee1 100644 --- a/types/box2d/README.md +++ b/types/box2d/README.md @@ -73,7 +73,7 @@ Change Log License ======= -Box2DWeb-2.1.d.ts Copyright (c) 2012 Josh Baldwin http://github.com/jbaldwin/box2dweb.d.ts +Box2DWeb-2.1.d.ts Copyright (c) 2012 Josh Baldwin https://github.com/jbaldwin/box2dweb.d.ts There are a few competing javascript Box2D ports. This definitions file is for Box2dWeb.js -> http://code.google.com/p/box2dweb/ diff --git a/types/box2d/index.d.ts b/types/box2d/index.d.ts index 26411b2198..181c5537d2 100644 --- a/types/box2d/index.d.ts +++ b/types/box2d/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** -* Box2DWeb-2.1.d.ts Copyright (c) 2012-2013 Josh Baldwin http://github.com/jbaldwin/box2dweb.d.ts +* Box2DWeb-2.1.d.ts Copyright (c) 2012-2013 Josh Baldwin https://github.com/jbaldwin/box2dweb.d.ts * There are a few competing javascript Box2D ports. * This definitions file is for Box2dWeb.js -> * http://code.google.com/p/box2dweb/ diff --git a/types/browser-sync/index.d.ts b/types/browser-sync/index.d.ts index 449063192d..ade12d3cb6 100644 --- a/types/browser-sync/index.d.ts +++ b/types/browser-sync/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for browser-sync // Project: http://www.browsersync.io/ -// Definitions by: Asana , Joe Skeen +// Definitions by: Asana , Joe Skeen // Thomas "Thasmo" Deinhamer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/bunyan/bunyan-tests.ts b/types/bunyan/bunyan-tests.ts index 48c9a6c809..ffdfb2e911 100644 --- a/types/bunyan/bunyan-tests.ts +++ b/types/bunyan/bunyan-tests.ts @@ -1,9 +1,9 @@ import Logger = require('bunyan'); -let ringBufferOptions: Logger.RingBufferOptions = { +const ringBufferOptions: Logger.RingBufferOptions = { limit: 100 }; -let ringBuffer: Logger.RingBuffer = new Logger.RingBuffer(ringBufferOptions); +const ringBuffer: Logger.RingBuffer = new Logger.RingBuffer(ringBufferOptions); ringBuffer.write("hello"); let level: number; @@ -20,7 +20,7 @@ level = Logger.resolveLevel(Logger.WARN); level = Logger.resolveLevel(Logger.ERROR); level = Logger.resolveLevel(Logger.FATAL); -let options: Logger.LoggerOptions = { +const options: Logger.LoggerOptions = { name: 'test-logger', serializers: Logger.stdSerializers, streams: [{ @@ -51,9 +51,9 @@ let options: Logger.LoggerOptions = { }] }; -let log = Logger.createLogger(options); +const log = Logger.createLogger(options); -let customSerializer = (anything: any) => { +const customSerializer = (anything: any) => { return { obj: anything }; }; @@ -67,7 +67,7 @@ log.addSerializers( } ); -let levels: number[] = log.levels(); +const levels: number[] = log.levels(); level = log.levels(0); log.levels('foo'); @@ -75,9 +75,9 @@ log.levels(0, Logger.INFO); log.levels(0, 'info'); log.levels('foo', Logger.WARN); -let buffer = new Buffer(0); -let error = new Error(''); -let object = { +const buffer = new Buffer(0); +const error = new Error(''); +const object = { test: 123 }; @@ -112,7 +112,7 @@ log.fatal(error); log.fatal(object); log.fatal('Hello, %s', 'world!'); -let recursive: any = { +const recursive: any = { hello: 'world', whats: {} }; diff --git a/types/bytebuffer/index.d.ts b/types/bytebuffer/index.d.ts index 1cf7142592..8456f28182 100644 --- a/types/bytebuffer/index.d.ts +++ b/types/bytebuffer/index.d.ts @@ -1,8 +1,8 @@ // Type definitions for bytebuffer.js 5.0.0 // Project: https://github.com/dcodeIO/bytebuffer.js -// Definitions by: Denis Cappellin +// Definitions by: Denis Cappellin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Definitions by: SINTEF-9012 +// Definitions by: SINTEF-9012 import Long = require("long"); diff --git a/types/c3/c3-tests.ts b/types/c3/c3-tests.ts index 029946c710..509678636b 100644 --- a/types/c3/c3-tests.ts +++ b/types/c3/c3-tests.ts @@ -3,7 +3,7 @@ ////////////////// function chart_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, bindto: "#myContainer", size: { @@ -30,19 +30,19 @@ function chart_examples() { onresized: () => { /* code*/ } }); - let chart2 = c3.generate({ + const chart2 = c3.generate({ bindto: document.getElementById("myContainer"), data: {} }); - let chart3 = c3.generate({ + const chart3 = c3.generate({ bindto: d3.select("#myContainer"), data: {} }); } function data_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: { url: "/data/c3_test.csv", json: [ @@ -126,7 +126,7 @@ function data_examples() { } }); - let chart2 = c3.generate({ + const chart2 = c3.generate({ data: { labels: { format: (v, id, i, j) => { /* code */ } }, hide: ["data1"] @@ -135,7 +135,7 @@ function data_examples() { } function axis_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, axis: { rotated: true, @@ -207,7 +207,7 @@ function axis_examples() { } }); - let chart2 = c3.generate({ + const chart2 = c3.generate({ data: {}, axis: { x: { @@ -241,7 +241,7 @@ function axis_examples() { } function grid_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, grid: { x: { @@ -265,7 +265,7 @@ function grid_examples() { } function region_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, regions: [ { axis: "x", start: 1, end: 4, class: "region-1-4" }, @@ -274,7 +274,7 @@ function region_examples() { } function legend_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, legend: { show: true, @@ -294,7 +294,7 @@ function legend_examples() { } }); - let chart2 = c3.generate({ + const chart2 = c3.generate({ data: {}, legend: { hide: "data1", @@ -307,7 +307,7 @@ function legend_examples() { } }); - let chart3 = c3.generate({ + const chart3 = c3.generate({ data: {}, legend: { hide: ["data1", "data2"] @@ -316,7 +316,7 @@ function legend_examples() { } function subchart_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, subchart: { show: true, @@ -329,7 +329,7 @@ function subchart_examples() { } function zoom_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, zoom: { enabled: false, @@ -343,7 +343,7 @@ function zoom_examples() { } function point_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, point: { show: false, @@ -362,7 +362,7 @@ function point_examples() { } function line_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, line: { connectNull: true, @@ -374,7 +374,7 @@ function line_examples() { } function area_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, area: { zerobased: false @@ -383,7 +383,7 @@ function area_examples() { } function bar_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, bar: { width: 10, @@ -391,7 +391,7 @@ function bar_examples() { } }); - let chart2 = c3.generate({ + const chart2 = c3.generate({ data: {}, bar: { width: { @@ -403,7 +403,7 @@ function bar_examples() { } function pie_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, pie: { label: { @@ -419,7 +419,7 @@ function pie_examples() { } function donut_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, donut: { label: { @@ -437,7 +437,7 @@ function donut_examples() { } function gauge_examples() { - let chart = c3.generate({ + const chart = c3.generate({ data: {}, gauge: { label: { @@ -460,7 +460,7 @@ function gauge_examples() { ///////////////// function simple_multiple() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -481,7 +481,7 @@ function simple_multiple() { } function timeseries() { - let chart = c3.generate({ + const chart = c3.generate({ data: { x: "x", xFormat: "%Y%m%d", // 'xFormat' can be used as custom format of 'x' @@ -503,7 +503,7 @@ function timeseries() { } function chart_spline() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -515,7 +515,7 @@ function chart_spline() { } function simple_xy() { - let chart = c3.generate({ + const chart = c3.generate({ data: { x: "x", columns: [ @@ -528,7 +528,7 @@ function simple_xy() { } function simple_xy_multiple() { - let chart = c3.generate({ + const chart = c3.generate({ data: { xs: { data1: "x1", @@ -545,7 +545,7 @@ function simple_xy_multiple() { } function simple_regions() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -560,7 +560,7 @@ function simple_regions() { } function chart_step() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 300, 350, 300, 0, 0, 100], @@ -575,7 +575,7 @@ function chart_step() { } function area_chart() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 300, 350, 300, 0, 0, 0], @@ -590,7 +590,7 @@ function area_chart() { } function chart_area_stacked() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 300, 350, 300, 0, 0, 120], @@ -607,7 +607,7 @@ function chart_area_stacked() { } function chart_bar() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -627,7 +627,7 @@ function chart_bar() { } function chart_bar_stacked() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", -30, 200, 200, 400, -150, 250], @@ -648,7 +648,7 @@ function chart_bar_stacked() { } function chart_scatter() { - let chart = c3.generate({ + const chart = c3.generate({ data: { xs: { setosa: "setosa_x", @@ -682,7 +682,7 @@ function chart_scatter() { } function chart_pie() { - let chart = c3.generate({ + const chart = c3.generate({ data: { // iris data from R columns: [ @@ -698,7 +698,7 @@ function chart_pie() { } function chart_donut() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30], @@ -716,7 +716,7 @@ function chart_donut() { } function gauge_chart() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data", 91.4] @@ -753,7 +753,7 @@ function gauge_chart() { } function chart_combination() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 20, 50, 40, 60, 50], @@ -781,7 +781,7 @@ function chart_combination() { //////////////////// function categorized() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250, 50, 100, 250] @@ -797,7 +797,7 @@ function categorized() { } function axes_rotated() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -814,7 +814,7 @@ function axes_rotated() { } function axes_y2() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -834,7 +834,7 @@ function axes_y2() { } function axes_x_tick_format() { - let chart = c3.generate({ + const chart = c3.generate({ data: { x: "x", columns: [ @@ -855,7 +855,7 @@ function axes_x_tick_format() { } function axes_x_tick_count() { - let chart = c3.generate({ + const chart = c3.generate({ data: { x: "x", columns: [ @@ -876,7 +876,7 @@ function axes_x_tick_count() { } function axes_x_tick_values() { - let chart = c3.generate({ + const chart = c3.generate({ data: { x: "x", columns: [ @@ -897,7 +897,7 @@ function axes_x_tick_values() { } function axes_x_tick_culling() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 30, 200, 100, 400, 150, 250, 200, 100, 400, 150, 250] @@ -919,7 +919,7 @@ function axes_x_tick_culling() { } function axes_x_tick_fit() { - let chart = c3.generate({ + const chart = c3.generate({ data: { x: "x", columns: [ @@ -940,7 +940,7 @@ function axes_x_tick_fit() { } function axes_x_localtime() { - let chart = c3.generate({ + const chart = c3.generate({ data: { x: "x", xFormat: "%Y", @@ -966,7 +966,7 @@ function axes_x_localtime() { } function axes_x_tick_rotate() { - let chart = c3.generate({ + const chart = c3.generate({ data: { x: "x", columns: [ @@ -990,7 +990,7 @@ function axes_x_tick_rotate() { } function axes_y_tick_format() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 2500] @@ -1008,7 +1008,7 @@ function axes_y_tick_format() { } function axes_y_padding() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1032,7 +1032,7 @@ function axes_y_padding() { } function axes_y_range() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250] @@ -1050,7 +1050,7 @@ function axes_y_range() { } function axes_label() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250], @@ -1076,7 +1076,7 @@ function axes_label() { } function axes_label_position() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["sample1", 30, 200, 100, 400, 150, 250], @@ -1134,7 +1134,7 @@ function axes_label_position() { /////////////////// function data_columned() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 20, 50, 40, 60, 50], @@ -1146,7 +1146,7 @@ function data_columned() { } function data_rowed() { - let chart = c3.generate({ + const chart = c3.generate({ data: { rows: [ ["data1", "data2", "data3"], @@ -1210,7 +1210,7 @@ function data_json() { } function data_url() { - let chart = c3.generate({ + const chart = c3.generate({ data: { url: "/data/c3_test.csv" } @@ -1227,7 +1227,7 @@ function data_url() { } function data_stringx() { - let chart = c3.generate({ + const chart = c3.generate({ data: { x: "x", columns: [ @@ -1294,7 +1294,7 @@ function data_stringx() { } function data_load() { - let chart = c3.generate({ + const chart = c3.generate({ data: { url: "/data/c3_test.csv", type: "line" @@ -1397,7 +1397,7 @@ function data_load() { } function data_name() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1412,7 +1412,7 @@ function data_name() { } function data_color() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 20, 50, 40, 60, 50], @@ -1434,7 +1434,7 @@ function data_color() { } function data_order() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 130, 200, 320, 400, 530, 750], @@ -1478,7 +1478,7 @@ function data_order() { } function data_label() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, -200, -100, 400, 150, 250], @@ -1500,7 +1500,7 @@ function data_label() { } function data_label_format() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, -200, -100, 400, 150, 250], @@ -1532,7 +1532,7 @@ function data_label_format() { /////////////////// function options_gridline() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250, 120, 200] @@ -1550,7 +1550,7 @@ function options_gridline() { } function grid_x_lines() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250] @@ -1569,7 +1569,7 @@ function grid_x_lines() { } function grid_y_lines() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250], @@ -1601,7 +1601,7 @@ function grid_y_lines() { /////////////////// function region() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250, 400], @@ -1631,7 +1631,7 @@ function region() { } function region_timeseries() { - let chart = c3.generate({ + const chart = c3.generate({ data: { x: "date", columns: [ @@ -1657,7 +1657,7 @@ function region_timeseries() { ///////////////////// function options_subchart() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250] @@ -1670,7 +1670,7 @@ function options_subchart() { } function interaction_zoom() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250, 150, 200, 170, 240, 350, 150, 100, 400, 150, 250, 150, 200, 170, 240, 100, 150, 250, 150, 200, 170, 240, 30, 200, 100, 400, 150, 250, 150, @@ -1688,7 +1688,7 @@ function interaction_zoom() { ///////////////////// function options_legend() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250] @@ -1701,7 +1701,7 @@ function options_legend() { } function legend_position() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1737,7 +1737,7 @@ function legend_position() { } function legend_custom() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 100], @@ -1781,7 +1781,7 @@ function legend_custom() { ///////////////////// function tooltip_show() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1795,7 +1795,7 @@ function tooltip_show() { } function tooltip_grouped() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1810,7 +1810,7 @@ function tooltip_grouped() { } function tooltip_format() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30000, 20000, 10000, 40000, 15000, 250000], @@ -1837,7 +1837,7 @@ function tooltip_format() { format: { title: (d: any) => "Data " + d, value: (value: any, ratio: any, id: any) => { - let format = id === "data1" ? d3.format(",") : d3.format("$"); + const format = id === "data1" ? d3.format(",") : d3.format("$"); return format(value); } // value: d3.format(",") // apply this format to both y and y2 @@ -1851,7 +1851,7 @@ function tooltip_format() { //////////////////////// function options_size() { - let chart = c3.generate({ + const chart = c3.generate({ size: { height: 240, width: 480 @@ -1865,7 +1865,7 @@ function options_size() { } function options_padding() { - let chart = c3.generate({ + const chart = c3.generate({ padding: { top: 40, right: 100, @@ -1881,7 +1881,7 @@ function options_padding() { } function options_color() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1900,7 +1900,7 @@ function options_color() { } function transition_duration() { - let chart = c3.generate({ + const chart = c3.generate({ data: { url: "/data/c3_test.csv" }, @@ -1953,7 +1953,7 @@ function transition_duration() { ///////////////////////////// function point_show() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -1971,7 +1971,7 @@ function point_show() { //////////////////////////// function pie_label_format() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30], @@ -1994,7 +1994,7 @@ function pie_label_format() { ///////////////////// function api_flow() { - let chart = c3.generate({ + const chart = c3.generate({ data: { x: "x", columns: [ @@ -2064,7 +2064,7 @@ function api_flow() { } function api_data_name() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2087,7 +2087,7 @@ function api_data_name() { } function api_data_color() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 20, 50, 40, 60, 50], @@ -2122,7 +2122,7 @@ function api_data_color() { } function api_axis_label() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2154,7 +2154,7 @@ function api_axis_label() { } function api_axis_range() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2210,7 +2210,7 @@ function api_axis_range() { } function api_resize() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2233,7 +2233,7 @@ function api_resize() { } function api_grid_x() { - let chart = c3.generate({ + const chart = c3.generate({ bindto: "#chart", data: { columns: [ @@ -2276,7 +2276,7 @@ function api_grid_x() { ///////////////////// function transform_line() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2304,7 +2304,7 @@ function transform_line() { } function transform_spline() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2332,7 +2332,7 @@ function transform_spline() { } function transform_bar() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2360,7 +2360,7 @@ function transform_bar() { } function transform_area() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2388,7 +2388,7 @@ function transform_area() { } function transform_areaspline() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2416,7 +2416,7 @@ function transform_areaspline() { } function transform_scatter() { - let chart = c3.generate({ + const chart = c3.generate({ data: { xs: { setosa: "setosa_x", @@ -2462,7 +2462,7 @@ function transform_scatter() { } function transform_pie() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2485,7 +2485,7 @@ function transform_pie() { } function transform_donut() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 30, 200, 100, 400, 150, 250], @@ -2516,7 +2516,7 @@ function transform_donut() { ///////////////////// function style_region() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["sample", 30, 200, 100, 400, 150, 250] @@ -2530,7 +2530,7 @@ function style_region() { } function style_grid() { - let chart = c3.generate({ + const chart = c3.generate({ data: { columns: [ ["data1", 100, 200, 1000, 900, 500] diff --git a/types/cassandra-driver/index.d.ts b/types/cassandra-driver/index.d.ts index 1f7f2fe33d..bf9e73feb6 100644 --- a/types/cassandra-driver/index.d.ts +++ b/types/cassandra-driver/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for nodejs-driver v0.8.2 // Project: https://github.com/datastax/nodejs-driver -// Definitions by: Marc Fisher +// Definitions by: Marc Fisher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/catbox/index.d.ts b/types/catbox/index.d.ts index e34059d618..7bc691abdc 100644 --- a/types/catbox/index.d.ts +++ b/types/catbox/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for catbox 7.1 // Project: https://github.com/hapijs/catbox -// Definitions by: Jason Swearingen , AJP +// Definitions by: Jason Swearingen , AJP // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/chai-arrays/chai-arrays-tests.ts b/types/chai-arrays/chai-arrays-tests.ts index 7fabaacbca..f8a42fb6a7 100644 --- a/types/chai-arrays/chai-arrays-tests.ts +++ b/types/chai-arrays/chai-arrays-tests.ts @@ -8,7 +8,7 @@ chai.use(ChaiArrays); chai.should(); const arr: any[] = [1, 2, 3]; -const str: string = 'abcdef'; +const str = 'abcdef'; const otherArr: number[] = [1, 2, 3]; const anotherArr: number[] = [2, 4]; diff --git a/types/chai-http/chai-http-tests.ts b/types/chai-http/chai-http-tests.ts index c9c80c31ed..7c1c7a6b42 100644 --- a/types/chai-http/chai-http-tests.ts +++ b/types/chai-http/chai-http-tests.ts @@ -13,7 +13,7 @@ if (!global.Promise) { chai.request.addPromises(when.promise); } -let app: http.Server; +declare const app: http.Server; chai.request(app).get('/'); chai.request('http://localhost:8080').get('/'); @@ -55,7 +55,7 @@ chai.request(app) .then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200)) .catch((err: any) => { throw err; }); -let agent = chai.request.agent(app); +const agent = chai.request.agent(app); agent .post('/session') @@ -69,7 +69,7 @@ agent }); function test1() { - let req = chai.request(app).get('/'); + const req = chai.request(app).get('/'); req.then((res: ChaiHttp.Response) => { chai.expect(res).to.have.status(200); chai.expect(res).to.have.header('content-type', 'text/plain'); diff --git a/types/chart.js/chart.js-tests.ts b/types/chart.js/chart.js-tests.ts index 5c2dab60f9..4ba3c4fc4c 100644 --- a/types/chart.js/chart.js-tests.ts +++ b/types/chart.js/chart.js-tests.ts @@ -4,7 +4,7 @@ import { Chart, ChartData } from 'chart.js'; // import chartjs = require('chart.js'); // => chartjs.Chart -let chart: Chart = new Chart(new CanvasRenderingContext2D(), { +const chart: Chart = new Chart(new CanvasRenderingContext2D(), { type: 'bar', data: { labels: ['group 1'], diff --git a/types/chayns/chayns-tests.ts b/types/chayns/chayns-tests.ts new file mode 100644 index 0000000000..8e8912430a --- /dev/null +++ b/types/chayns/chayns-tests.ts @@ -0,0 +1,14 @@ +// Test file for chayns typings + +chayns.register({ + strictMode: false, + appName: 'chayns-typings-test' +}); + +chayns.ready.then(data => { + return data; +}).catch(err => { + return err; +}); + +chayns.dialog.alert('chayns-typings', 'Test chayns-typings!'); diff --git a/types/chayns/index.d.ts b/types/chayns/index.d.ts new file mode 100644 index 0000000000..a1989a1c51 --- /dev/null +++ b/types/chayns/index.d.ts @@ -0,0 +1,938 @@ +// Type definitions for chayns 3.1 +// Project: https://github.com/TobitSoftware/chayns-js +// Definitions by: Henning Kuehl +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/** + * Definition file for chayns v3.1 + */ +declare namespace chayns { + /** + * Getting Started + * chayns + * + */ + let ready: Promise; + + function register(config: RegisterConfig): void; + + /** + * Basic Functions + * chayns + */ + function login(parameters?: string[]): Promise; + + function getUser(config: GetUserConfig): Promise; + + function getUacGroups(siteId: number, updateCache?: boolean): Promise; + + function startInteractionIdentification(config: InteractionIdentificationConfig): Promise; + + function stopInteractionIdentification(): Promise; + + function allowRefreshScroll(): Promise; + + function disallowRefreshScroll(): Promise; + + function showTitleImage(): Promise; + + function hideTitleImage(): Promise; + + function setOnActivateCallback(callback: (tappEvent: number) => any): Promise; + + function setNetworkChangeCallback(callback: (result: NetworkChangeResult) => any, ongoing: boolean): Promise; + + function setNfcCallback(callback: (rfid: string) => any): Promise; + + function removeNfcCallback(): Promise; + + function startNfcDetection(callback: (result: NfcDetectionResult) => any, interval: number, vibrate: boolean): Promise; + + function stopNfcDetection(): Promise; + + function scanQRCode(cameryType?: number, timeout?: number): Promise; // TODO interface for promise result + + function createQRCode(text: string): Promise; + + function showFinetradingQRCode(): Promise; + + function selectTapp(tapp: SelectTappConfig, parameter?: string[]): Promise; + + function openUrl(config: OpenUrlConfig): void; + + function closeUrl(): void; + + function openUrlInBrowser(url: string): void; + + function getGeoLocation(): Promise; + + function getLocationBeacons(forceReload: boolean): Promise; + + function getBeaconHistory(subNumber?: number): Promise; + + function getBaseColor(color?: string, colorMode?: number): string; + + function share(config: ShareConfig): Promise; // TODO interface for promise result + + function getAvailableSharingServices(): Promise; + + function navigateBack(): Promise; + + function updateNavigation(tappId?: number, config?: UpdateNavigationConfig): Promise; + + function enableDisplayTimeout(): Promise; + + function disableDisplayTimeout(): Promise; + + function setSpeechToText(callback: (result: SpeechToTextResult) => any, title?: string): Promise; + + function createTappShortcut(name: string, imageUrl: string): Promise; + + function setSubTapp(config: SubTappConfig): void; + + function removeSubTapp(config: RemoveSubTappConfig): void; + + function vibrate(ms: number[]): Promise; + + function setHeight(config: SetHeightConfig): Promise; + + function scrollToY(position: number): Promise; + + function addToWallet(passbook: string): Promise; // TODO check passbock parameter + + function addScrollListener(callback: (data: any) => any, throttle?: number): Promise; // TODO interface for callback data + + function setScreenOrientation(orientation: number): Promise; + + function findSite(name: string, skip?: number, take?: number): Promise; + + /** + * UI Functions + * Waitcursor + * chayns + */ + function showWaitCursor(text?: string, timeout?: number): Promise; + + function hideWaitCursor(): Promise; + + /** + * UI Functions + * Floating Button + * chayns + */ + function showFloatingButton(config: FloatingConfig, callback: () => any): void; + + function hideFloatingButton(): void; + + /** + * Media Functions + * Image + * chayns + */ + function openImage(urls: string[], start?: number): Promise; + + function uploadImage(): Promise; + + /** + * Media Functions + * Miscellaneous + * chayns + */ + function openVideo(url: string): Promise; + + function saveAppointment(config: SaveAppointmentConfig): Promise; + + function playSound(url: string, playOnMute?: boolean): Promise; + + function addErrorListener(logFn: (error: any) => Promise<{}>, appName: string): void; + + function getGlobalData(): GlobalData; + + /** + * chayns.smartShop + */ + let smartShop: any; + + /** + * Basic Functions + * chayns.intercom + */ + namespace intercom { + function sendMessageToUser(userId: number, config: IntercomConfig): Promise; // TODO set interface for promise result + + function sendMessageToGroup(groupId: number, config: IntercomConfig): Promise; // TODO set interface for promise result + + function sendMessageToPage(config: IntercomConfig): Promise; // TODO set interface for promise result + } + + /** + * Basic Functions + * chayns.passKit + */ + namespace passKit { + function getInstalled(): Promise; // TODO interface for promise result + + function isInstalled(identifier: string): Promise; // TODO interface for promise result + } + + /** + * Environmental Variables + * chayns.env + */ + namespace env { + let _parameters: any; + + let parameters: any; + + let isBrowser: boolean; + + let isChaynsWeb: boolean; + + let isChaynsWebDesktop: boolean; + + let isChaynsWebMobile: boolean; + + let isDesktop: boolean; + + let isMobile: boolean; + + let isApp: boolean; + + let isIOS: boolean; + + let isAndroid: boolean; + + let isTablet: boolean; + + let isWP: boolean; + + let appVersion: number; + + let os: string; + + let apiVersion: number; + + let debugMode: boolean; + + let isChaynsParent: boolean; + + let isChaynsWebLight: boolean; + + let isInFacebookFrame: boolean; + + let isInFrame: boolean; + + let isWidget: boolean; + + let language: string; + + /** + * Environmental Variables + * chayns.env.user + */ + namespace user { + let tobitAccessToken: string; + + let facebookAccessToken: string; + + let facebookId: string; + + let id: number; + + let name: string; + + let personId: string; + + let isAuthenticated: boolean; + + let language: string; + + let groups: UserGroup[]; + } + + /** + * Environmental Variables + * chayns.env.site + */ + namespace site { + let color: string; + + let colorMode: number; + + let colorScheme: number; + + let domain: string; + + let facebookAppId: string; + + let facebookPageId: string; + + let id: string; + + let isAdEnabled: boolean; + + let isArEnabled: boolean; + + let language: string; + + let locationId: number; + + let locationPersonId: string; + + let tapps: SiteTapp[]; + + let title: string; + + let url: string; + + let version: string; + + /** + * Environmental Variables + * chayns.env.site.tapp + */ + namespace tapp { + let customUrl: string; + + let id: number; + + let internalName: string; + + let isExclusiveView: boolean; + + let isKioskMode: boolean; + + let isSubTapp: boolean; + + let showName: string; + + let sortId: number; + + let userGroupIds: number[]; + } + } + + /** + * Environmental Variables + * chayns.env.app + */ + namespace app { + let flavor: string; + + let languageId: string; + + let model: string; + + let name: string; + + let uid: string; + + let version: string; + } + + /** + * Environmental Variables + * chayns.env.device + */ + namespace device { + let fontScale: any; + + let imei: string; + + let languageId: string; + + let model: string; + + let systemName: string; + + let systemVersion: number; + + let uid: string; + } + + /** + * Environmental Variables + * chayns.env.browser + */ + namespace browser { + let name: string; + + let version: string; + } + } + + /** + * UI Functions + * chayns.dialog + */ + namespace dialog { + enum buttonType { + CANCEL = -1, + NEGATIVE = 0, + POSITIVE = 1 + } + + enum buttonText { + CANCEL = 'Abbrechen', + NO = 'Nein', + OK = 'OK', + YES = 'Ja' + } + + enum dateType { + DATE, + TIME, + DATE_TIME + } + + enum inputType { + DEFAULT = 0, + PASSWORD = 1 + } + + function alert(title: string, message?: string): Promise; + + function confirm(title: string, message?: string, buttons?: DialogButton[]): Promise; + + function date(config: DialogDateConfig): Promise; + + function select(config: DialogSelectConfig): Promise; + + function input(config: DialogInputConfig): Promise; + + function facebook(options: DialogFacebookOptions): Promise; + } + + /** + * chayns.ui + */ + namespace ui { + /** + * UI Functions + * chayns.ui.modeSwitch + */ + namespace modeSwitch { + function init(config: ModeSwitchConfig): void; + + function addItem(item: ModeSwitchItem, index?: number): void; + + function changeMode(item: number | ModeSwitchItem): void; + + function remove(): void; + + function add(): void; + } + + /** + * Media Functions + * chayns.ui.gallery + */ + namespace gallery { + function create(id: string, urls: string[]): void; + + function setUrls(id: string, urls: string[]): void; + + function getUrls(id: string): string[]; + + function addUrl(id: string, url: string): void; + + function removeUrl(id: string, url: string): void; + } + + /** + * chayns.ui.tooltip + */ + namespace tooltip { + function init(config: UiTooltipInitConfig, rootElement: any): Promise; + } + + /** + * chayns.ui.slider + */ + namespace slider { + function refreshTrack(): void; + } + } + + /** + * Utility Functions + * chayns.utils + */ + namespace utils { + /** + * Utility Functions + * Check Types + * chayns.utils + */ + function isHex(parameter: any, shorthand: boolean): boolean; + + function isArray(parameter: any): boolean; + + function isBLEAdress(parameter: any): boolean; + + function isBlank(parameter: any): boolean; + + function isDate(parameter: any): boolean; + + function isDefined(parameter: any): boolean; + + function isFormData(parameter: any): boolean; + + function isFunction(parameter: any): boolean; + + function isGUID(parameter: any): boolean; + + function isMacAdress(parameter: any): boolean; + + function isNumber(parameter: any): boolean; + + function isObject(parameter: any): boolean; + + function isPromise(parameter: any): boolean; + + function isString(parameter: any): boolean; + + function isUUID(parameter: any): boolean; + + function isUndefined(parameter: any): boolean; + + function isDeferred(parameter: any): boolean; + + function isJwt(parameter: any): boolean; + + function isUrl(parameter: any): boolean; + + /** + * Utility Functions + * Miscellaneous + * chayns.utils + */ + function getJwtPayload(token: string): JwtPaylod; + + function mod(number: number, modulo: number): number; + + function trim(test: string): string; + + function replacePlaceholder(text: string, parameters: any[]): string; // TODO set interface for parameters + + function mixColor(color1: string, color2: string, saturation: number): string; + + function isPresent(parameter: any): boolean; + + function setLevel(level: number): void; + + /** + * Utility Functions + * Local Storage + * chayns.utils.ls + */ + namespace ls { + function set(key: string, value: string): void; + + function get(key: string): string; + + function remove(key: string): void; + + function removeAll(): void; + } + + namespace lang { + function init(config: any): void; + + function renderTextStrings(): void; + + function get(textString: string): string; + + function translateDomStrings(): void; + } + } + + /** + * chayns.storage + */ + namespace storage { + enum accessMode { + PUBLIC, + PROTECTED, + PRIVATE + } + + function set(key: string, value: any, accessMode?: accessMode, tappIds?: number[]): Promise; + + function get(key: string, accessMode?: accessMode): any; + + function remove(key: string, accessMode?: accessMode): Promise; + } +} + +/** + * Getting Started + * chayns + * interfaces + */ +// chayns.register() +interface RegisterConfig { + strictMode?: boolean; + appName?: string; + cssPrefix?: string; + callbackPrefix?: string; + initialHeight?: number; + autoResize?: boolean; +} + +/** + * Basic Functions + * chayns + * interfaces + */ +// chayns.getUser() +interface GetUserConfig { + accessToken?: string; + userId?: number; + fbId?: string; + personId?: string; +} + +interface User { + FacebookID: string; + FirstName: string; + LastName: string; + PersonID: string; + UserFullName: string; + UserID: number; +} + +// chayns.getUacGroups() +interface UacGroup { + id: number; + name: string; + showName: string; +} + +// chayns.startInteractionIdentification() +interface InteractionIdentificationConfig { + duration: number; + delay?: number; + callback: any; + resetOnInteraction?: boolean; + foregroundColor: string; + backgroundColor?: string; +} + +// chayns.setNetworkChangeCallback() +interface NetworkChangeResult { + isConnected: boolean; + type: number; +} + +// chayns.startNfcDetection() +interface NfcDetectionResult { + connected: boolean; + rfid: string; +} + +// chayns.selectTapp() +interface SelectTappConfig { + id?: number; + internalName?: string; + showName?: string; + position?: number; +} + +// chayns.openUrl() +interface OpenUrlConfig { + url: string; + title?: string; + exclusiveView?: boolean; + darkenBackground?: boolean; + fullSize?: boolean; + width?: number; +} + +// chayns.getGeoLocation() +interface GeoLocationResult { + longitude: number; + latitude: number; +} + +// chayns.getLocationBeacons() +interface LocationBeacon { + id: number; + pushMessage: string; + latitude: number; + longitude: number; +} + +// chayns.getBeaconHistory() +interface BeaconHistory { + id: number; + timestamp: number; +} + +// chayns.share() +interface ShareConfig { + title?: string; + text: string; + imageUrl?: string; + sharingApp: number; + sharingAndroidApp?: string; +} + +// chayns.updateNavigation() +interface UpdateNavigationConfig { + stateOnly?: boolean; + updateTapp?: boolean; +} + +// chayns.setSpeecToText() +interface SpeechToTextResult { + languageCode: string; + text: string[]; +} + +// chayns.setSubTapp() +interface SubTappConfig { + tappID: number; + name: string; + color: string; + colorText?: string; + sortID: number; + icon: string; + callbackURL?(result: any): any; + url: string; + buttonName: string; + isExclusiveView?: boolean; + replaceParent?: boolean; + boldText?: boolean; +} + +// chayns.removeSubTapp() +interface RemoveSubTappConfig { + tappID: number; + close: boolean; + remove: boolean; +} + +// chayns.setHeight() +interface SetHeightConfig { + height: number; + growOnly?: boolean; + full?: boolean; + fullViewport?: boolean; +} + +// chayns.findSite() +interface Site { + appstoreName: string; + facebookId: string; + siteId: string; + locationId: number; +} + +/** + * Basic Functions + * chayns.intercom + * interfaces + */ +interface IntercomConfig { + text: string; +} + +/** + * UI Functions + * chayns.dialog + * interfaces + */ +// chayns.dialog.confirm() +interface DialogButton { + text: string; + buttonType: chayns.dialog.buttonType; +} + +// chayns.dialog.date() +interface DialogDateConfig { + dateType: chayns.dialog.dateType; + preSelect?: Date; + minDate?: Date; + maxDate?: Date; +} + +interface DialogDateResult { + timestamp: number; + buttonType: chayns.dialog.buttonType; +} + +// chayns.dialog.select() +interface DialogSelectConfig { + title: string; + message?: string; + quickfind?: boolean; + multiselect?: boolean; + buttons?: any[]; // TODO interface for buttons + list: DialogSelectConfigItem[]; +} + +interface DialogSelectConfigItem { + name: string; + value?: string; + image?: string; + isSelected?: boolean; +} + +interface DialogSelectResult { + buttonType: chayns.dialog.buttonType; + selection: DialogSelectResultItem[]; +} + +interface DialogSelectResultItem { + name: string; + value?: string; +} + +// chayns.dialog.input() +interface DialogInputConfig { + title: string; + message?: string; + placeholderText?: string; + text?: string; + buttons?: DialogButton[]; +} + +interface DialogInputResult { + buttonType: chayns.dialog.buttonType; + text: string; +} + +/** + * UI Functions + * chayns.ui.modeswitch + * interfaces + */ +// chayns.ui.modeswitch.init() +interface ModeSwitchConfig { + items: ModeSwitchItem[]; + callback(result: ModeSwitchItem): void; + headline?: string; + preventclose?: boolean; +} + +interface ModeSwitchItem { + name: string; + value: number; + default?: boolean; +} + +/** + * UI Functions + * Floating Button + * chayns + * interfaces + */ +// chayns.showFloatingButton() +interface FloatingConfig { + text?: string; + color?: string; + colorText?: string; + icon?: string; +} + +/** + * Media Functions + * Miscellaneous + * chayns + * interfaces + */ +// chayns.saveAppointment() +interface SaveAppointmentConfig { + name: string; + location: string; + description: string; + start: Date; + end: Date; +} + +/** + * Utility Functions + * Miscellaneous + * chayns.utils + * interfaces + */ +// chayns.utils.getJwtPayload() +interface JwtPaylod { + FacebookUserID: string; + FirstName: string; + LastName: string; + PersonID: string; + LocationID: number; + TobitUserID: number; + LoginType: number; + isAdmin: boolean; +} + +/** + * Enviroment Variables + * User + * interfaces + */ +// chayns.env.user.groups +interface UserGroup { + id: number; + isActive?: boolean; + isSystemGroup?: boolean; + name: string; + showName?: string; +} + +/** + * Enviroment Variables + * Site + * interfaces + */ +interface SiteTapp { + customUrl: string; + id: number; + internalName: string; + isExclusiveView: boolean; + isKioskMode: boolean; + isSubTapp: boolean; + showName: string; + sortId: number; + userGroupIds: number[]; +} + +interface GlobalData { + _result: any; +} + +interface DialogFacebookOptions { + title: string; + message?: string; + quickfind?: number; + multiselect?: number; + button?: DialogFacebookButton[]; + preSelected: number[]; // TODO: Verify type +} + +interface DialogFacebookButton { + text: string; + value: number; // TODO: Verify type +} + +interface DialogFacebookResult { + buttonType: number; + selection: DialogFacebookResultSelection[]; +} + +interface DialogFacebookResultSelection { + first_name: string; + last_name: string; + id: string; + gender: string; + name: string; +} + +interface UiTooltipInitConfig { + tooltipClass: string; + preventAnimation: boolean; +} diff --git a/types/chayns/tsconfig.json b/types/chayns/tsconfig.json new file mode 100644 index 0000000000..99d0599998 --- /dev/null +++ b/types/chayns/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", + "chayns-tests.ts" + ] +} diff --git a/types/chayns/tslint.json b/types/chayns/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/chayns/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/classnames/bind.d.ts b/types/classnames/bind.d.ts index b6a4242507..4af94d1835 100644 --- a/types/classnames/bind.d.ts +++ b/types/classnames/bind.d.ts @@ -1,5 +1,3 @@ -export type ClassNamesFn = ( - ...args: Array> -) => string; +import * as cn from "./index"; -export function bind(styles: Record): ClassNamesFn; +export function bind(styles: Record): typeof cn; diff --git a/types/classnames/classnames-tests.ts b/types/classnames/classnames-tests.ts index 14760dff0d..b2b8c9eba4 100644 --- a/types/classnames/classnames-tests.ts +++ b/types/classnames/classnames-tests.ts @@ -35,3 +35,6 @@ const styles = { const cx = cn.bind(styles); const className = cx('foo', ['bar'], { baz: true }); // => "abc def xyz" + +// falsey values are just ignored +cx(null, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1' diff --git a/types/client-sessions/client-sessions-tests.ts b/types/client-sessions/client-sessions-tests.ts index f53407a69c..7498aac12d 100644 --- a/types/client-sessions/client-sessions-tests.ts +++ b/types/client-sessions/client-sessions-tests.ts @@ -1,5 +1,5 @@ -import * as express from "express"; -import * as session from "client-sessions"; +import express = require("express"); +import session = require("client-sessions"); const secret = "yolo"; const app = express(); diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts index 960f293656..f6c40a99c2 100644 --- a/types/codemirror/index.d.ts +++ b/types/codemirror/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for CodeMirror // Project: https://github.com/marijnh/CodeMirror // Definitions by: mihailik +// nrbernard // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = CodeMirror; @@ -104,6 +105,19 @@ declare namespace CodeMirror { type DOMEvent = 'mousedown' | 'dblclick' | 'touchstart' | 'contextmenu' | 'keydown' | 'keypress' | 'keyup' | 'cut' | 'copy' | 'paste' | 'dragstart' | 'dragenter' | 'dragover' | 'dragleave' | 'drop'; + interface Token { + /** The character(on the given line) at which the token starts. */ + start: number; + /** The character at which the token ends. */ + end: number; + /** The token's string. */ + string: string; + /** The token type the mode assigned to the token, such as "keyword" or "comment" (may also be null). */ + type: string | null; + /** The mode's state at the end of this token. */ + state: any; + } + interface Editor { /** Tells you whether the editor currently has focus. */ @@ -289,20 +303,11 @@ declare namespace CodeMirror { you should probably follow up by calling this method to ensure CodeMirror is still looking as intended. */ refresh(): void; - /** Retrieves information about the token the current mode found before the given position (a {line, ch} object). */ - getTokenAt(pos: CodeMirror.Position): { - /** The character(on the given line) at which the token starts. */ - start: number; - /** The character at which the token ends. */ - end: number; - /** The token's string. */ - string: string; - /** The token type the mode assigned to the token, such as "keyword" or "comment" (may also be null). */ - type: string | null; - /** The mode's state at the end of this token. */ - state: any; - }; + getTokenAt(pos: CodeMirror.Position): Token; + + /** This is similar to getTokenAt, but collects all tokens for a given line into an array. */ + getLineTokens(line: number, precise?: boolean): Token[]; /** Returns the mode's parser state, if any, at the end of the given line number. If no line number is given, the state at the end of the document is returned. @@ -410,7 +415,7 @@ declare namespace CodeMirror { /** Fires when one of the DOM events fires. */ on(eventName: DOMEvent, handler: (instance: CodeMirror.Editor, event: Event) => void ): void; off(eventName: DOMEvent, handler: (instance: CodeMirror.Editor, event: Event) => void ): void; - + /** Expose the state object, so that the Editor.state.completionActive property is reachable*/ state: any; } diff --git a/types/color-convert/color-convert-tests.ts b/types/color-convert/color-convert-tests.ts index 735c169a2f..fe45e209f3 100644 --- a/types/color-convert/color-convert-tests.ts +++ b/types/color-convert/color-convert-tests.ts @@ -1,6 +1,6 @@ import * as color from 'color-convert'; import * as conv from 'color-convert/conversions'; -let hsv: [number, number, number] = color.rgb.hsv([1, 2, 3]); -let hsv_raw: [number, number, number] = color.rgb.hsv.raw([1, 2, 3]); -let aaa: [number, number, number] = color.rgb.hsv([1, 2, 3]); +const hsv: [number, number, number] = color.rgb.hsv([1, 2, 3]); +const hsv_raw: [number, number, number] = color.rgb.hsv.raw([1, 2, 3]); +const aaa: [number, number, number] = color.rgb.hsv([1, 2, 3]); diff --git a/types/commander/index.d.ts b/types/commander/index.d.ts index 017495784a..9e5feded68 100644 --- a/types/commander/index.d.ts +++ b/types/commander/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for commander 2.9 // Project: https://github.com/visionmedia/commander.js -// Definitions by: Alan Agius , Marcelo Dezem , vvakame +// Definitions by: Alan Agius , Marcelo Dezem , vvakame // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/commonmark/commonmark-tests.ts b/types/commonmark/commonmark-tests.ts index 8d3a3a5447..b85eb16ace 100644 --- a/types/commonmark/commonmark-tests.ts +++ b/types/commonmark/commonmark-tests.ts @@ -26,18 +26,18 @@ function logNode(node: commonmark.Node) { const parser = new commonmark.Parser({ smart: true, time: true }); const node = parser.parse('# a piece of _markdown_'); -let w = node.walker(); -let step = w.next(); +const w = node.walker(); +const step = w.next(); if (step.entering) { logNode(step.node); } -let xmlRenderer = new commonmark.XmlRenderer({ sourcepos: true, time: true }); -let xml = xmlRenderer.render(node); +const xmlRenderer = new commonmark.XmlRenderer({ sourcepos: true, time: true }); +const xml = xmlRenderer.render(node); console.log(xml); -let htmlRenderer = new commonmark.HtmlRenderer({ safe: true, smart: true, sourcepos: true, time: true }); -let html = htmlRenderer.render(node); +const htmlRenderer = new commonmark.HtmlRenderer({ safe: true, smart: true, sourcepos: true, time: true }); +const html = htmlRenderer.render(node); console.log(html); function basic_usage() { diff --git a/types/concat-stream/concat-stream-tests.ts b/types/concat-stream/concat-stream-tests.ts index 4f3bf839e0..b89cde817b 100644 --- a/types/concat-stream/concat-stream-tests.ts +++ b/types/concat-stream/concat-stream-tests.ts @@ -3,7 +3,7 @@ import concat = require("concat-stream"); import { Readable } from "stream"; class MyReadable extends Readable { - i: number = 1; + i = 1; _read() { if (this.i <= 100) { this.push(this.i.toString()); diff --git a/types/content-type/content-type-tests.ts b/types/content-type/content-type-tests.ts index 0705d440c1..4be9519a94 100644 --- a/types/content-type/content-type-tests.ts +++ b/types/content-type/content-type-tests.ts @@ -1,18 +1,19 @@ -import contentType = require('content-type'); -import express = require('express'); +/// -let obj = contentType.parse('image/svg+xml; charset=utf-8'); +import * as contentType from 'content-type'; +import * as http from 'http'; -console.log(obj.type); // => 'image/svg+xml' -console.log(obj.parameters.charset); // => 'utf-8' +const mediaType = contentType.parse('image/svg+xml; charset=utf-8'); +mediaType; // $ExpectType ParsedMediaType +mediaType.type; // $ExpectType string +mediaType.parameters; // $ExpectType { [key: string]: string; } -let req: express.Request; -obj = contentType.parse(req); +http.createServer((req, res) => { + contentType.parse(req); + contentType.parse(res); +}); -let res: express.Response; -obj = contentType.parse(res); - -let str: string = contentType.format({type: 'image/svg+xml'}); - -let media: contentType.MediaType; -contentType.format(media); +// $ExpectType string +contentType.format({type: 'image/svg+xml'}); +contentType.format({type: 'image/svg+xml', parameters: {charset: 'utf-8'}}); +contentType.format(mediaType); diff --git a/types/content-type/index.d.ts b/types/content-type/index.d.ts index ec60de446f..5ff4ae7ff1 100644 --- a/types/content-type/index.d.ts +++ b/types/content-type/index.d.ts @@ -1,21 +1,26 @@ // Type definitions for content-type 1.1 // Project: https://www.npmjs.com/package/content-type // Definitions by: Hiroki Horiuchi +// BendingBender // Definitions: https://github.com/borisyankov/DefinitelyTyped -import * as express from 'express'; +export function parse(input: RequestLike | ResponseLike | string): ParsedMediaType; +export function format(obj: MediaType): string; -declare var ct: ct.StaticFunctions; -export = ct; +export interface ParsedMediaType { + type: string; + parameters: {[key: string]: string}; +} -declare namespace ct { - interface StaticFunctions { - parse(input: express.Request | express.Response | string): MediaType; - format(obj: MediaType): string; - } +export interface MediaType { + type: string; + parameters?: {[key: string]: string}; +} - interface MediaType { - type: string; - parameters?: any; - } +export interface RequestLike { + headers: {[header: string]: string | string[]}; +} + +export interface ResponseLike { + getHeader(name: string): number | string | string[] | undefined; } diff --git a/types/content-type/tsconfig.json b/types/content-type/tsconfig.json index 4eaa2f42f4..3361989225 100644 --- a/types/content-type/tsconfig.json +++ b/types/content-type/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,4 +19,4 @@ "index.d.ts", "content-type-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/continuation-local-storage/continuation-local-storage-tests.ts b/types/continuation-local-storage/continuation-local-storage-tests.ts index 3d85886d73..aee44866af 100644 --- a/types/continuation-local-storage/continuation-local-storage-tests.ts +++ b/types/continuation-local-storage/continuation-local-storage-tests.ts @@ -21,7 +21,7 @@ function test(topic: string, callback: (t: Test) => any) { test("asynchronously propagating state with local-context-domains", function (t) { t.plan(2); - var namespace = cls.createNamespace('namespace'); + const namespace = cls.createNamespace('namespace'); // t.ok(process.namespaces.namespace, "namespace has been created"); namespace.run(function () { @@ -39,7 +39,7 @@ test("minimized test case that caused #6011 patch to fail", function (t) { // when the flaw was in the patch, commenting out this line would fix things: process.nextTick(function () { console.log('!'); }); - var n = cls.createNamespace("test"); + const n = cls.createNamespace("test"); t.ok(!n.get('state'), "state should not yet be visible"); n.run(function () { @@ -59,7 +59,7 @@ test("event emitters bound to CLS context", function (t) { t.test("handler registered in context, emit out of context", function (t) { t.plan(1); - var n = cls.createNamespace('in') + const n = cls.createNamespace('in') , ee = new EventEmitter() ; @@ -78,7 +78,7 @@ test("event emitters bound to CLS context", function (t) { t.test("once handler registered in context", function (t) { t.plan(1); - var n = cls.createNamespace('inOnce') + const n = cls.createNamespace('inOnce') , ee = new EventEmitter() ; @@ -97,7 +97,7 @@ test("event emitters bound to CLS context", function (t) { t.test("handler registered out of context, emit in context", function (t) { t.plan(1); - var n = cls.createNamespace('out') + const n = cls.createNamespace('out') , ee = new EventEmitter() ; @@ -117,7 +117,7 @@ test("event emitters bound to CLS context", function (t) { t.test("once handler registered out of context", function (t) { t.plan(1); - var n = cls.createNamespace('outOnce') + const n = cls.createNamespace('outOnce') , ee = new EventEmitter() ; @@ -137,7 +137,7 @@ test("event emitters bound to CLS context", function (t) { t.test("handler registered out of context, emit out of context", function (t) { t.plan(1); - var n = cls.createNamespace('out') + const n = cls.createNamespace('out') , ee = new EventEmitter() ; @@ -155,12 +155,12 @@ test("event emitters bound to CLS context", function (t) { }); t.test("once handler registered out of context on Readable", function (t) { - var Readable = require('stream').Readable; + const Readable = require('stream').Readable; if (Readable) { t.plan(12); - var n = cls.createNamespace('outOnceReadable') + const n = cls.createNamespace('outOnceReadable') , re = new Readable() ; @@ -203,7 +203,7 @@ test("event emitters bound to CLS context", function (t) { t.test("emitter with newListener that removes handler", function (t) { t.plan(3); - var n = cls.createNamespace('newListener') + const n = cls.createNamespace('newListener') , ee = new EventEmitter() ; @@ -239,12 +239,12 @@ test("event emitters bound to CLS context", function (t) { }); t.test("handler registered in context on Readable", function (t) { - var Readable = require('stream').Readable; + const Readable = require('stream').Readable; if (Readable) { t.plan(12); - var n = cls.createNamespace('outOnReadable') + const n = cls.createNamespace('outOnReadable') , re = new Readable() ; @@ -288,7 +288,7 @@ test("event emitters bound to CLS context", function (t) { t.test("handler added but used entirely out of context", function (t) { t.plan(2); - var n = cls.createNamespace('none') + const n = cls.createNamespace('none') , ee = new EventEmitter() ; @@ -309,12 +309,12 @@ test("event emitters bound to CLS context", function (t) { t.test("handler added but no listeners registered", function (t) { t.plan(3); - var http = require('http') + const http = require('http') , n = cls.createNamespace('no_listener') ; // only fails on Node < 0.10 - var server = http.createServer(function (req: any, res: any) { + const server = http.createServer(function (req: any, res: any) { n.bindEmitter(req); t.doesNotThrow(function () { @@ -342,7 +342,7 @@ test("event emitters bound to CLS context", function (t) { t.test("listener with parameters added but not bound to context", function (t) { t.plan(2); - var ee = new EventEmitter() + const ee = new EventEmitter() , n = cls.createNamespace('param_list') ; @@ -361,7 +361,7 @@ test("event emitters bound to CLS context", function (t) { t.test("listener that throws doesn't leave removeListener wrapped", function (t) { t.plan(4); - var ee = new EventEmitter() + const ee = new EventEmitter() , n = cls.createNamespace('kaboom') ; @@ -385,7 +385,7 @@ test("event emitters bound to CLS context", function (t) { t.test("emitter bound to multiple namespaces handles them correctly", function (t) { t.plan(8); - var ee = new EventEmitter() + const ee = new EventEmitter() , ns1 = cls.createNamespace('1') , ns2 = cls.createNamespace('2') ; @@ -430,7 +430,7 @@ test("event emitters bound to CLS context", function (t) { // multiple contexts in use test("simple tracer built on contexts", function (t) { - var tracer = cls.createNamespace('tracer'); + const tracer = cls.createNamespace('tracer'); class Trace { harvester: any; @@ -438,7 +438,7 @@ test("simple tracer built on contexts", function (t) { this.harvester = harvester; } runHandler(callback: any) { - var wrapped = tracer.bind(function () { + const wrapped = tracer.bind(function () { callback(); this.harvester.emit('finished', tracer.get('transaction')); }.bind(this)); @@ -448,8 +448,8 @@ test("simple tracer built on contexts", function (t) { t.plan(6); - var harvester = new EventEmitter(); - var trace = new Trace(harvester); + const harvester = new EventEmitter(); + const trace = new Trace(harvester); harvester.on('finished', function (transaction: any) { t.ok(transaction, "transaction should have been passed in"); diff --git a/types/convict/convict-tests.ts b/types/convict/convict-tests.ts index daa07c6875..08bac59825 100644 --- a/types/convict/convict-tests.ts +++ b/types/convict/convict-tests.ts @@ -35,7 +35,7 @@ convict.addFormats({ } }); -let conf = convict({ +const conf = convict({ env: { doc: 'The applicaton environment.', format: ['production', 'development', 'test'], @@ -98,8 +98,8 @@ let conf = convict({ // load environment dependent configuration -let env = conf.get('env'); -let dbip = conf.get('db.ip'); +const env = conf.get('env'); +const dbip = conf.get('db.ip'); conf.loadFile('./config/' + env + '.json'); conf.loadFile(['./configs/always.json', './configs/sometimes.json']); @@ -119,7 +119,7 @@ conf .validate({ allowed: 'warn' }) .toString(); -let port: number = conf.default('port'); +const port: number = conf.default('port'); if (conf.has('key')) { conf.set('the.awesome', true); diff --git a/types/copy-webpack-plugin/index.d.ts b/types/copy-webpack-plugin/index.d.ts index 11a3a30dd9..8bfae1e0ed 100644 --- a/types/copy-webpack-plugin/index.d.ts +++ b/types/copy-webpack-plugin/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for copy-webpack-plugin v4.0.0 // Project: https://github.com/kevlened/copy-webpack-plugin -// Definitions by: flying-sheep +// Definitions by: flying-sheep // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { Plugin } from 'webpack' diff --git a/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts b/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts index 1497eec386..2506df887d 100644 --- a/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts +++ b/types/cordova-plugin-inappbrowser/cordova-plugin-inappbrowser-tests.ts @@ -4,7 +4,7 @@ // signature of window.open() added by InAppBrowser plugin // is similar to native window.open signature, so the compiler can's // select proper overload, but we cast result to InAppBrowser manually. -const iab = window.open('google.com', '_self'); +const iab = window.open('google.com', '_self'); iab.addEventListener('loadstart', (ev: InAppBrowserEvent) => { console.log('Start opening ' + ev.url); }); iab.addEventListener('loadstart', (ev) => { console.log('loadstart' + ev.url); }); diff --git a/types/core-decorators/core-decorators-tests.ts b/types/core-decorators/core-decorators-tests.ts index ef4659e56b..c617de5fcc 100644 --- a/types/core-decorators/core-decorators-tests.ts +++ b/types/core-decorators/core-decorators-tests.ts @@ -31,7 +31,7 @@ import { readonly } from 'core-decorators'; class Meal { @readonly - entree: string = 'steak'; + entree = 'steak'; } const dinner = new Meal(); @@ -155,7 +155,7 @@ class Meal2 { entree = 'steak'; @nonenumerable - cost: number = 4.44; + cost = 4.44; } const dinner2 = new Meal2(); @@ -175,7 +175,7 @@ import { nonconfigurable } from 'core-decorators'; class Meal3 { @nonconfigurable - entree: string = 'steak'; + entree = 'steak'; } const dinner3 = new Meal3(); diff --git a/types/core-js/index.d.ts b/types/core-js/index.d.ts index 0a8f506df4..5fb9400d75 100644 --- a/types/core-js/index.d.ts +++ b/types/core-js/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for core-js 0.9 // Project: https://github.com/zloirock/core-js/ -// Definitions by: Ron Buckton , Michel Felipe +// Definitions by: Ron Buckton , Michel Felipe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 diff --git a/types/csvtojson/csvtojson-tests.ts b/types/csvtojson/csvtojson-tests.ts index 5b58451fac..2d6e36c84f 100644 --- a/types/csvtojson/csvtojson-tests.ts +++ b/types/csvtojson/csvtojson-tests.ts @@ -5,7 +5,7 @@ import fs = require('fs'); ///////////////////////////// // From CSV String -const csvStr: string = `1,2,3 +const csvStr = `1,2,3 4,5,6 7,8,9`; diff --git a/types/d3-array/d3-array-tests.ts b/types/d3-array/d3-array-tests.ts index 287f1d1a5e..7ce3d6354d 100644 --- a/types/d3-array/d3-array-tests.ts +++ b/types/d3-array/d3-array-tests.ts @@ -43,9 +43,9 @@ let num: number; let date: Date; let numOrUndefined: number | undefined; -let strOrUndefined: string |  undefined; -let numericOrUndefined: NumCoercible |  undefined; -let dateOrUndefined: Date |  undefined; +let strOrUndefined: string | undefined; +let numericOrUndefined: NumCoercible | undefined; +let dateOrUndefined: Date | undefined; let numOrUndefinedExtent: [number, number] | [undefined, undefined]; let strOrUndefinedExtent: [string, string] | [undefined, undefined]; let numericOrUndefinedExtent: [NumCoercible, NumCoercible] | [undefined, undefined]; diff --git a/types/d3-brush/d3-brush-tests.ts b/types/d3-brush/d3-brush-tests.ts index 2d9ee319aa..bce080f424 100644 --- a/types/d3-brush/d3-brush-tests.ts +++ b/types/d3-brush/d3-brush-tests.ts @@ -85,7 +85,6 @@ brush = brush.on('end', null); // re-apply brush.on('end', function(d, i, g) { - const that: SVGGElement = this; const datum: BrushDatum = d; const index: number = i; const group: SVGGElement[] | ArrayLike = g; diff --git a/types/d3-collection/d3-collection-tests.ts b/types/d3-collection/d3-collection-tests.ts index af9bf8d075..91a72479db 100644 --- a/types/d3-collection/d3-collection-tests.ts +++ b/types/d3-collection/d3-collection-tests.ts @@ -11,13 +11,13 @@ import { ascending } from 'd3-array'; // Preparatory steps -------------------------------------------------------------- -let keyValueObj = { +const keyValueObj = { a: 'test', b: 123, c: [true, true, false] }; -let keyValueObj2 = { +const keyValueObj2 = { a: 'test', b: 'same', c: 'type' @@ -29,7 +29,6 @@ let stringKVArray: Array<{ key: string, value: string }>; let anyKVArray: Array<{ key: string, value: any }>; let num: number; -let str: string; let booleanFlag: boolean; // --------------------------------------------------------------------- @@ -137,9 +136,9 @@ testObjKVArray = testObjMap.entries(); // each() -------------------------------------------------------------- testObjMap.each((value, key, map) => { - let v: TestObject = value; - let k: string = key; - let m: d3Collection.Map = map; + const v: TestObject = value; + const k: string = key; + const m: d3Collection.Map = map; console.log(v.val); }); @@ -169,9 +168,9 @@ basicSet = d3Collection.set(['foo', 'bar', 42]); // last element is coerced // from array without accessor basicSet = d3Collection.set(testObjArray, (value, index, array) => { - let v: TestObject = value; - let i: number = index; - let a: TestObject[] = array; + const v: TestObject = value; + const i: number = index; + const a: TestObject[] = array; return v.name; }); @@ -208,9 +207,9 @@ stringArray = basicSet.values(); // each() -------------------------------------------------------------- basicSet.each((value, valueRepeat, set) => { - let v: string = value; - let vr: string = valueRepeat; - let s: d3Collection.Set = set; + const v: string = value; + const vr: string = valueRepeat; + const s: d3Collection.Set = set; console.log(v); }); @@ -233,7 +232,7 @@ interface Yield { site: string; } -let raw: Yield[] = [ +const raw: Yield[] = [ { yield: 27.00, variety: 'Manchuria', year: 1931, site: 'University Farm' }, { yield: 48.87, variety: 'Manchuria', year: 1931, site: 'Waseca' }, { yield: 27.43, variety: 'Manchuria', year: 1931, site: 'Morris' }, @@ -279,8 +278,8 @@ nestL1Rollup = nestL1Rollup nestL2 = nestL2 .sortValues((a, b) => { - let val1: Yield = a; // data type Yield - let val2: Yield = b; // data type Yield + const val1: Yield = a; // data type Yield + const val2: Yield = b; // data type Yield return a.yield - b.yield; }); @@ -288,7 +287,7 @@ nestL2 = nestL2 nestL1Rollup = nestL1Rollup .rollup(values => { - let vs: Yield[] = values; // correct data array type + const vs: Yield[] = values; // correct data array type return vs.length; }); diff --git a/types/d3-contour/d3-contour-tests.ts b/types/d3-contour/d3-contour-tests.ts index 751dfe99c9..588750bf29 100644 --- a/types/d3-contour/d3-contour-tests.ts +++ b/types/d3-contour/d3-contour-tests.ts @@ -110,7 +110,7 @@ interface CustomDatum { // Get contour generator ------------------------------------------------------- -let contDensDefault: d3Contour.ContourDensity<[number, number]> = d3Contour.contourDensity(); +const contDensDefault: d3Contour.ContourDensity<[number, number]> = d3Contour.contourDensity(); let contDensCustom: d3Contour.ContourDensity = d3Contour.contourDensity(); // Configure contour generator ================================================= diff --git a/types/d3-dispatch/d3-dispatch-tests.ts b/types/d3-dispatch/d3-dispatch-tests.ts index 436bc3d6d4..a9f29ef75d 100644 --- a/types/d3-dispatch/d3-dispatch-tests.ts +++ b/types/d3-dispatch/d3-dispatch-tests.ts @@ -16,8 +16,6 @@ interface Datum { } let dispatch: d3Dispatch.Dispatch; -let copy: d3Dispatch.Dispatch; -let copy2: d3Dispatch.Dispatch; // Signature Tests ---------------------------------------- @@ -50,5 +48,5 @@ dispatch.apply('bar', document.body, [{ a: 3, b: 'test' }, 1]); dispatch.on('bar', null); // Copy dispatch ----------------------------------------------- -copy = dispatch.copy(); -// copy2 = dispatch.copy(); // test fails type mismatch of underlying event target +const copy: d3Dispatch.Dispatch = dispatch.copy(); +// const copy2: d3Dispatch.Dispatch = dispatch.copy(); // test fails type mismatch of underlying event target diff --git a/types/d3-dsv/d3-dsv-tests.ts b/types/d3-dsv/d3-dsv-tests.ts index 421add6e65..51127b7266 100644 --- a/types/d3-dsv/d3-dsv-tests.ts +++ b/types/d3-dsv/d3-dsv-tests.ts @@ -12,13 +12,13 @@ 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'; +const csvTestString = '1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38'; +const tsvTestString = '1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38'; +const pipedTestString = '1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38'; -const csvTestStringWithHeader: string = 'Year,Make,Model,Length\n1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38'; -const tsvTestStringWithHeader: string = 'Year\tMake\tModel\tLength\n1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38'; -const pipedTestStringWithHeader: string = 'Year|Make|Model|Length\n1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38'; +const csvTestStringWithHeader = 'Year,Make,Model,Length\n1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38'; +const tsvTestStringWithHeader = 'Year\tMake\tModel\tLength\n1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38'; +const pipedTestStringWithHeader = 'Year|Make|Model|Length\n1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38'; interface ParsedTestObject { year: Date; diff --git a/types/d3-ease/d3-ease-tests.ts b/types/d3-ease/d3-ease-tests.ts index 67a0f32b1b..543f2fd375 100644 --- a/types/d3-ease/d3-ease-tests.ts +++ b/types/d3-ease/d3-ease-tests.ts @@ -8,7 +8,7 @@ import * as d3Ease from 'd3-ease'; -const t_in: number = 0.5; +const t_in = 0.5; let t_out: number; t_out = d3Ease.easeLinear(t_in); diff --git a/types/d3-format/d3-format-tests.ts b/types/d3-format/d3-format-tests.ts index 9c11d07c70..def8994b70 100644 --- a/types/d3-format/d3-format-tests.ts +++ b/types/d3-format/d3-format-tests.ts @@ -36,17 +36,17 @@ formatFn = d3Format.formatPrefix(',.0', 1e-6); specifier = d3Format.formatSpecifier('.0%'); -let fill: string = specifier.fill; -let align: '>' | '<' | '^' | '=' = specifier.align; -let sign: '-' | '+' | '(' | ' ' = specifier.sign; -let symbol: '$' | '#' | '' = specifier.symbol; -let zero: boolean = specifier.zero; -let width: number | undefined = specifier.width; -let comma: boolean = specifier.comma; -let precision: number = specifier.precision; -let type: 'e' | 'f' | 'g' | 'r' | 's' | '%' | 'p' | 'b' | 'o' | 'd' | 'x' | 'X' | 'c' | '' | 'n' = specifier.type; +const fill: string = specifier.fill; +const align: '>' | '<' | '^' | '=' = specifier.align; +const sign: '-' | '+' | '(' | ' ' = specifier.sign; +const symbol: '$' | '#' | '' = specifier.symbol; +const zero: boolean = specifier.zero; +const width: number | undefined = specifier.width; +const comma: boolean = specifier.comma; +const precision: number = specifier.precision; +const type: 'e' | 'f' | 'g' | 'r' | 's' | '%' | 'p' | 'b' | 'o' | 'd' | 'x' | 'X' | 'c' | '' | 'n' = specifier.type; -let formatString: string = specifier.toString(); +const formatString: string = specifier.toString(); // ---------------------------------------------------------------------- // Test Precision Suggestors @@ -85,16 +85,16 @@ localeDef = { percent : "\u202f%" }; -let decimal: string = localeDef.decimal; -let thousands: string = localeDef.thousands; -let grouping: number[] = localeDef.grouping; -let currency: [string, string] = localeDef.currency; -let numerals: string[] | undefined = localeDef.numerals; -let percent: string | undefined = localeDef.percent; +const decimal: string = localeDef.decimal; +const thousands: string = localeDef.thousands; +const grouping: number[] = localeDef.grouping; +const currency: [string, string] = localeDef.currency; +const numerals: string[] | undefined = localeDef.numerals; +const percent: string | undefined = localeDef.percent; localeObj = d3Format.formatLocale(localeDef); localeObj = d3Format.formatDefaultLocale(localeDef); -let formatFactory: (specifier: string) => ((n: number) => string) = localeObj.format; -let formatPrefixFactory: (specifier: string, value: number) => ((n: number) => string) = localeObj.formatPrefix; +const formatFactory: (specifier: string) => ((n: number) => string) = localeObj.format; +const formatPrefixFactory: (specifier: string, value: number) => ((n: number) => string) = localeObj.formatPrefix; diff --git a/types/d3-format/index.d.ts b/types/d3-format/index.d.ts index 34cf80c047..6592756ef1 100644 --- a/types/d3-format/index.d.ts +++ b/types/d3-format/index.d.ts @@ -112,8 +112,8 @@ export interface FormatSpecifier { comma: boolean; /** * Depending on the type, the precision either indicates the number of digits that follow the decimal point (types 'f' and '%'), - * or the number of significant digits (types ''​ (none), 'e', 'g', 'r', 's' and 'p'). If the precision is not specified, - * it defaults to 6 for all types except ''​ (none), which defaults to 12. + * or the number of significant digits (types '' (none), 'e', 'g', 'r', 's' and 'p'). If the precision is not specified, + * it defaults to 6 for all types except '' (none), which defaults to 12. * Precision is ignored for integer formats (types 'b', 'o', 'd', 'x', 'X' and 'c'). * * See precisionFixed and precisionRound for help picking an appropriate precision @@ -137,7 +137,7 @@ export interface FormatSpecifier { * 'c' - converts the integer to the corresponding unicode character before printing. * '' (none) - like g, but trim insignificant trailing zeros. * - * The type 'n' is also supported as shorthand for ',g'. For the 'g', 'n' and ​''(none) types, + * The type 'n' is also supported as shorthand for ',g'. For the 'g', 'n' and ''(none) types, * decimal notation is used if the resulting string would have precision or fewer digits; otherwise, exponent notation is used. */ type: 'e' | 'f' | 'g' | 'r' | 's' | '%' | 'p' | 'b' | 'o' | 'd' | 'x' | 'X' | 'c' | '' | 'n'; @@ -170,7 +170,7 @@ export function formatDefaultLocale(defaultLocale: FormatLocaleDefinition): Form * * Uses the current default locale. * - * The general form of a specifier is [​[fill]align][sign][symbol][0][width][,][.precision][type]. + * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type]. * For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties. * * @param specifier A Specifier string @@ -185,7 +185,7 @@ export function format(specifier: string): (n: number) => string; * * Uses the current default locale. * - * The general form of a specifier is [​[fill]align][sign][symbol][0][width][,][.precision][type]. + * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type]. * For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties. * * @param specifier A Specifier string @@ -197,7 +197,7 @@ export function formatPrefix(specifier: string, value: number): (n: number) => s * Parses the specified specifier, returning an object with exposed fields that correspond to the * format specification mini-language and a toString method that reconstructs the specifier. * - * The general form of a specifier is [​[fill]align][sign][symbol][0][width][,][.precision][type]. + * The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type]. * For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties. * * @param specifier A specifier string. diff --git a/types/d3-interpolate/d3-interpolate-tests.ts b/types/d3-interpolate/d3-interpolate-tests.ts index 5cbb6fe3a0..6baaf06092 100644 --- a/types/d3-interpolate/d3-interpolate-tests.ts +++ b/types/d3-interpolate/d3-interpolate-tests.ts @@ -44,7 +44,6 @@ let iString: Interpolator; let iDate: Interpolator; let iArrayNum: Interpolator; let iArrayStr: Interpolator; -let iArrayDate: Interpolator; let iArrayMixed: Interpolator<[Date, string]>; let iKeyVal: Interpolator<{ [key: string]: any }>; let iRGBColorObj: Interpolator; @@ -56,7 +55,6 @@ let arrNum: number[]; let arrStr: string[]; let objKeyVal: { [key: string]: any }; let objRGBColor: d3Color.RGBColor; -let objHSVColor: d3Hsv.HSVColor; let zoom: [number, number, number]; // test interpolate(a, b) signature ---------------------------------------------------- diff --git a/types/d3-path/d3-path-tests.ts b/types/d3-path/d3-path-tests.ts index b11a3405e3..6a7b6a3fa0 100644 --- a/types/d3-path/d3-path-tests.ts +++ b/types/d3-path/d3-path-tests.ts @@ -12,7 +12,7 @@ import * as d3Path from 'd3-path'; // Test create new path serializer // ----------------------------------------------------------------------------------------- -let context: d3Path.Path = d3Path.path(); +const context: d3Path.Path = d3Path.path(); // ----------------------------------------------------------------------------------------- // Test path serializer methods @@ -35,4 +35,4 @@ context.rect(60, 60, 100, 200); context.closePath(); -let pathString: string = context.toString(); +const pathString: string = context.toString(); diff --git a/types/d3-polygon/d3-polygon-tests.ts b/types/d3-polygon/d3-polygon-tests.ts index 748054b727..28e1e464e1 100644 --- a/types/d3-polygon/d3-polygon-tests.ts +++ b/types/d3-polygon/d3-polygon-tests.ts @@ -15,8 +15,8 @@ import * as d3Polygon from 'd3-polygon'; let num: number; let containsFlag: boolean; let point: [number, number] = [15, 15]; -let polygon: Array<[number, number]> = [[10, 10], [20, 20], [10, 30]]; -let pointArray: Array<[number, number]> = [[10, 10], [20, 20], [10, 30], [15, 15]]; +const polygon: Array<[number, number]> = [[10, 10], [20, 20], [10, 30]]; +const pointArray: Array<[number, number]> = [[10, 10], [20, 20], [10, 30], [15, 15]]; let hull: Array<[number, number]>; // ----------------------------------------------------------------------------- diff --git a/types/d3-quadtree/d3-quadtree-tests.ts b/types/d3-quadtree/d3-quadtree-tests.ts index 5fabc66961..eda00fe130 100644 --- a/types/d3-quadtree/d3-quadtree-tests.ts +++ b/types/d3-quadtree/d3-quadtree-tests.ts @@ -39,7 +39,7 @@ let testData: TestDatum[] = [ let node: d3Quadtree.QuadtreeInternalNode | d3Quadtree.QuadtreeLeaf; let numberAccessor: (d: TestDatum) => number; -let simpleTestData: Array<[number, number]> = [ +const simpleTestData: Array<[number, number]> = [ [10, 20], [30, 10], [15, 80], @@ -216,7 +216,7 @@ quadtree = quadtree.visitAfter((node, x0, y0, x1, y1) => { // Test QuadtreeLeaf ========================================================= -let leaf: d3Quadtree.QuadtreeLeaf; +declare const leaf: d3Quadtree.QuadtreeLeaf; let nextLeaf: d3Quadtree.QuadtreeLeaf | undefined; testDatum = leaf.data; @@ -225,7 +225,7 @@ nextLeaf = leaf.next ? leaf.next : undefined; // Test QuadtreeInternalNode ================================================= -let internalNode: d3Quadtree.QuadtreeInternalNode; +declare const internalNode: d3Quadtree.QuadtreeInternalNode; let quadNode: d3Quadtree.QuadtreeInternalNode | d3Quadtree.QuadtreeLeaf | undefined; quadNode = internalNode[0]; diff --git a/types/d3-request/d3-request-tests.ts b/types/d3-request/d3-request-tests.ts index 8d8061d76a..8b2130240a 100644 --- a/types/d3-request/d3-request-tests.ts +++ b/types/d3-request/d3-request-tests.ts @@ -16,7 +16,7 @@ import { DSVParsedArray, DSVRowString } from 'd3-dsv'; // Preparatory Steps // ------------------------------------------------------------------------------- -const url: string = 'http:// api.reddit.com'; +const url = 'http:// api.reddit.com'; interface RequestDatumGET { kind: 'Listing'; @@ -49,13 +49,12 @@ let listenerResult: (this: d3Request.Request, result: ResponseDatumGET[]) => voi // ------------------------------------------------------------------------------- // request to configure and send in follow-up -let request: d3Request.Request = d3Request.request(url); +const request: d3Request.Request = d3Request.request(url); // GET-request with callback, immediately sent -let requestWithCallback: d3Request.Request = d3Request.request(url, (error, xhr) => { - let x: XMLHttpRequest; +const requestWithCallback: d3Request.Request = d3Request.request(url, (error, xhr) => { if (!error) { - x = xhr; + const x: XMLHttpRequest = xhr; console.log(xhr.responseText); } }); @@ -65,36 +64,34 @@ let requestWithCallback: d3Request.Request = d3Request.request(url, (error, xhr) // ------------------------------------------------------------------------------- // Abort ----------------------------------------------------------------------- -let r1: d3Request.Request = request.abort(); +const r1: d3Request.Request = request.abort(); // Get ------------------------------------------------------------------------- // no arguments -let r2: d3Request.Request = d3Request.request(url) +const r2: d3Request.Request = d3Request.request(url) .get(); // with request datum -let r3: d3Request.Request = d3Request.request(url) +const r3: d3Request.Request = d3Request.request(url) .get({ kind: 'Listing' }); // with callback for response handling -let r4: d3Request.Request = d3Request.request(url) +const r4: d3Request.Request = d3Request.request(url) .response(xhr2Listing) .get((error, response) => { - let r: ResponseDatumGET[]; if (!error) { - r = response; + const r: ResponseDatumGET[] = response; console.log(r); } }); // with request datum and callback for response handling -let r5: d3Request.Request = d3Request.request(url) +const r5: d3Request.Request = d3Request.request(url) .response(xhr2Listing) .get({ kind: 'Listing' }, (error, response) => { - let r: ResponseDatumGET[]; if (!error) { - r = response; + const r: ResponseDatumGET[] = response; console.log(r); } }); @@ -102,20 +99,20 @@ let r5: d3Request.Request = d3Request.request(url) // Headers -------------------------------------------------------------------- // get -let acceptEncoding: string = request.header('Accept-Encoding'); +const acceptEncoding: string = request.header('Accept-Encoding'); // set -let r6: d3Request.Request = request.header('Accept-Encoding', 'gzip'); +const r6: d3Request.Request = request.header('Accept-Encoding', 'gzip'); // remove -let r7: d3Request.Request = request.header('Accept-Encoding', null); +const r7: d3Request.Request = request.header('Accept-Encoding', null); // Mime Type ------------------------------------------------------------------- // get let mimeType: string = request.mimeType(); // set -let r8: d3Request.Request = request.mimeType('application/json'); +const r8: d3Request.Request = request.mimeType('application/json'); // remove -let r9: d3Request.Request = request.mimeType(null); +const r9: d3Request.Request = request.mimeType(null); // Events - on ------------------------------------------------------------------ @@ -124,8 +121,8 @@ let r10: d3Request.Request = d3Request.request(url); // beforesent r10 = r10.on('beforesend', function(xhr) { - let that: d3Request.Request = this; - let x: XMLHttpRequest = xhr; + const that: d3Request.Request = this; + const x: XMLHttpRequest = xhr; // do something; }); @@ -134,8 +131,8 @@ listenerXhr = r10.on('beforesend'); // progress r10 = r10.on('progress', function(progEvent) { - let that: d3Request.Request = this; - let e: ProgressEvent = progEvent; + const that: d3Request.Request = this; + const e: ProgressEvent = progEvent; // do something; }); @@ -144,8 +141,8 @@ listenerProgress = r10.on('progress'); // error r10 = r10.on('error', function(error) { - let that: d3Request.Request = this; - let err: any = error; + const that: d3Request.Request = this; + const err: any = error; // do something; }); @@ -154,20 +151,20 @@ listenerError = r10.on('error'); // load r10 = r10.on('load', function(result) { - let that: d3Request.Request = this; - let res: ResponseDatumGET[] = result; + const that: d3Request.Request = this; + const res: ResponseDatumGET[] = result; // do something; }); r10 = r10.on('load', function(result: ResponseDatumGET[]) { - let that: d3Request.Request = this; - let res: ResponseDatumGET[] = result; + const that: d3Request.Request = this; + const res: ResponseDatumGET[] = result; // do something; }); // r10 = r10.on('load', function(result: number) { // fails, wrong argument type for callback -// let that: d3Request.Request = this; -// let res: number = result; +// const that: d3Request.Request = this; +// const res: number = result; // // do something; // }); @@ -176,16 +173,16 @@ listenerResult = r10.on('load'); // general (for unknown type additional event listener e.g. 'beforesent.custom' or 'load.custom') r10 = r10.on('progress.foo', function(progEvent: ProgressEvent) { - let that: d3Request.Request = this; - let e: any = ProgressEvent; + const that: d3Request.Request = this; + const e: any = ProgressEvent; // do something; }); listenerProgress = r10.on('progress.foo'); r10 = r10.on('error.foo', function(error) { - let that: d3Request.Request = this; - let err: any = error; + const that: d3Request.Request = this; + const err: any = error; // do something; }); @@ -194,95 +191,85 @@ listenerError = r10.on('error.foo'); // Password --------------------------------------------------------------------- // get -let password: string = request.password(); +const password: string = request.password(); // set -let r11: d3Request.Request = request.password('MyPassword'); +const r11: d3Request.Request = request.password('MyPassword'); // Post ------------------------------------------------------------------------- function xhr2Success(xhr: XMLHttpRequest): ResponseDatumPOST { - let result: ResponseDatumPOST; - - result = JSON.parse(xhr.responseText); - - return result; + return JSON.parse(xhr.responseText); } // no arguments -let r12: d3Request.Request = d3Request.request(url) +const r12: d3Request.Request = d3Request.request(url) .post(); // with request datum -let r13: d3Request.Request = d3Request.request(url) +const r13: d3Request.Request = d3Request.request(url) .post({ test: 'NewValue', value: 10 }); // with callback for response handling -let r14: d3Request.Request = d3Request.request(url).response(xhr2Success) +const r14: d3Request.Request = d3Request.request(url).response(xhr2Success) .post(function(error, response) { - let that: d3Request.Request = this; - let err: any = error; - let res: ResponseDatumPOST = response; + const that: d3Request.Request = this; + const err: any = error; + const res: ResponseDatumPOST = response; console.log('Success? ', res.success); }); -let r15: d3Request.Request = d3Request.request(url).response(xhr2Success) +const r15: d3Request.Request = d3Request.request(url).response(xhr2Success) .post({ test: 'NewValue', value: 10 }, function(error, response) { - let that: d3Request.Request = this; - let err: any = error; - let res: ResponseDatumPOST = response; + const that: d3Request.Request = this; + const err: any = error; + const res: ResponseDatumPOST = response; console.log('Success? ', res.success); }); // Response --------------------------------------------------------------------- function xhr2Listing(xhr: XMLHttpRequest): ResponseDatumGET[] { - let result: ResponseDatumGET[]; - - result = JSON.parse(xhr.responseText); - - return result; + return JSON.parse(xhr.responseText); } -let r16: d3Request.Request = d3Request.request(url) +const r16: d3Request.Request = d3Request.request(url) .response(xhr2Listing); // ResponseType ----------------------------------------------------------------- // get -let responseType: string = d3Request.request(url) +const responseType: string = d3Request.request(url) .responseType(); // set -let r17: d3Request.Request = d3Request.request(url) +const r17: d3Request.Request = d3Request.request(url) .responseType('application/json'); // Send ------------------------------------------------------------------------ // method only -let r18: d3Request.Request = d3Request.request(url) +const r18: d3Request.Request = d3Request.request(url) .send('GET'); // method and request datum -let r19: d3Request.Request = d3Request.request(url) +const r19: d3Request.Request = d3Request.request(url) .send('POST', { test: 'NewValue', value: 10 }); // method and callback for response handling -let r20: d3Request.Request = d3Request.request(url) +const r20: d3Request.Request = d3Request.request(url) .response(xhr2Listing) .send('GET', (error, response) => { - let r: ResponseDatumGET[]; if (!error) { - r = response; + const r: ResponseDatumGET[] = response; console.log(r); } }); // method,request datum and callback for response handling -let r21: d3Request.Request = d3Request.request(url) +const r21: d3Request.Request = d3Request.request(url) .response(xhr2Listing) .send('GET', { kind: 'Listing' }, (error, response) => { - let r: ResponseDatumGET[]; if (!error) { - r = response; + const r: ResponseDatumGET[] = response; console.log(r); } }); @@ -290,28 +277,28 @@ let r21: d3Request.Request = d3Request.request(url) // Timeout ----------------------------------------------------------------------- // get -let timeout: number = d3Request.request(url) +const timeout: number = d3Request.request(url) .timeout(); // set -let r22: d3Request.Request = d3Request.request(url) +const r22: d3Request.Request = d3Request.request(url) .timeout(500); // User---------------------------------------------------------------------------- // get -let user: string = request.user(); +const user: string = request.user(); // set -let r23: d3Request.Request = request.user('User'); +const r23: d3Request.Request = request.user('User'); // ------------------------------------------------------------------------------- // HTML Request // ------------------------------------------------------------------------------- -let html: d3Request.Request = d3Request.html(url); -let htmlWithCallback: d3Request.Request = d3Request.html(url, function(error, data) { - let that: d3Request.Request = this; - let err: any = error; - let d: DocumentFragment = data; +const html: d3Request.Request = d3Request.html(url); +const htmlWithCallback: d3Request.Request = d3Request.html(url, function(error, data) { + const that: d3Request.Request = this; + const err: any = error; + const d: DocumentFragment = data; console.log(d); }); @@ -319,11 +306,11 @@ let htmlWithCallback: d3Request.Request = d3Request.html(url, function(error, da // JSON Request // ------------------------------------------------------------------------------- -let json: d3Request.Request = d3Request.json(url); -let jsonWithCallback: d3Request.Request = d3Request.json(url, function(error, data) { - let that: d3Request.Request = this; - let err: any = error; - let d: ResponseDatumGET[] = data; +const json: d3Request.Request = d3Request.json(url); +const jsonWithCallback: d3Request.Request = d3Request.json(url, function(error, data) { + const that: d3Request.Request = this; + const err: any = error; + const d: ResponseDatumGET[] = data; console.log(d); }); @@ -331,11 +318,11 @@ let jsonWithCallback: d3Request.Request = d3Request.json(url // Text Request // ------------------------------------------------------------------------------- -let text: d3Request.Request = d3Request.text(url); -let textWithCallback: d3Request.Request = d3Request.text(url, function(error, data) { - let that: d3Request.Request = this; - let err: any = error; - let d: string = data; +const text: d3Request.Request = d3Request.text(url); +const textWithCallback: d3Request.Request = d3Request.text(url, function(error, data) { + const that: d3Request.Request = this; + const err: any = error; + const d: string = data; console.log(d); }); @@ -343,11 +330,11 @@ let textWithCallback: d3Request.Request = d3Request.text(url, function(error, da // XML Request // ------------------------------------------------------------------------------- -let xml: d3Request.Request = d3Request.xml(url); -let xmlWithCallback: d3Request.Request = d3Request.xml(url, function(error, data) { - let that: d3Request.Request = this; - let err: any = error; - let d: any = data; +const xml: d3Request.Request = d3Request.xml(url); +const xmlWithCallback: d3Request.Request = d3Request.xml(url, function(error, data) { + const that: d3Request.Request = this; + const err: any = error; + const d: any = data; console.log(d); }); @@ -359,32 +346,29 @@ let xmlWithCallback: d3Request.Request = d3Request.xml(url, function(error, data let csvRequest: d3Request.DsvRequest = d3Request.csv(url); // url and callback for response handling -let csvRequestWithCallback: d3Request.DsvRequest = d3Request.csv(url, function(error, data) { - let that: d3Request.Request = this; - let err: any = error; - let d: DSVParsedArray = data; +const csvRequestWithCallback: d3Request.DsvRequest = d3Request.csv(url, function(error, data) { + const that: d3Request.Request = this; + const err: any = error; + const d: DSVParsedArray = data; console.log(d); }); // url, row mapping function and callback for response handling -let csvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.csv(url, +const csvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.csv(url, (rawRow, index, columns) => { - let rr: DSVRowString = rawRow; - let i: number = index; - let cols: string[] = columns; - let mappedRow: ResponseDatumGET; - - mappedRow = { + const rr: DSVRowString = rawRow; + const i: number = index; + const cols: string[] = columns; + const mappedRow: ResponseDatumGET = { test: rr['test'], value: +rr['value'] }; - return mappedRow; }, function(error, data) { - let that: d3Request.Request = this; - let err: any = error; - let d: DSVParsedArray = data; + const that: d3Request.Request = this; + const err: any = error; + const d: DSVParsedArray = data; console.log(data); }); @@ -393,35 +377,32 @@ let csvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.csv = data; +const tsvRequestWithCallback: d3Request.DsvRequest = d3Request.tsv(url, function(error, data) { + const that: d3Request.Request = this; + const err: any = error; + const d: DSVParsedArray = data; console.log(d); }); // url, row mapping function and callback for response handling -let tsvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.tsv(url, +const tsvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.tsv(url, (rawRow, index, columns) => { - let rr: DSVRowString = rawRow; - let i: number = index; - let cols: string[] = columns; - let mappedRow: ResponseDatumGET; - - mappedRow = { + const rr: DSVRowString = rawRow; + const i: number = index; + const cols: string[] = columns; + const mappedRow: ResponseDatumGET = { test: rr['test'], value: +rr['value'] }; - return mappedRow; }, function(error, data) { - let that: d3Request.Request = this; - let err: any = error; - let d: DSVParsedArray = data; + const that: d3Request.Request = this; + const err: any = error; + const d: DSVParsedArray = data; console.log(data); }); @@ -433,16 +414,13 @@ let tsvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.tsv((rawRow, index, columns) => { - let rr: DSVRowString = rawRow; - let i: number = index; - let cols: string[] = columns; - let mappedRow: ResponseDatumGET; - - mappedRow = { + const rr: DSVRowString = rawRow; + const i: number = index; + const cols: string[] = columns; + const mappedRow: ResponseDatumGET = { test: rr['test'], value: +rr['value'] }; - return mappedRow; }); diff --git a/types/d3-sankey/d3-sankey-tests.ts b/types/d3-sankey/d3-sankey-tests.ts index abf61775b8..ace13d7e3c 100644 --- a/types/d3-sankey/d3-sankey-tests.ts +++ b/types/d3-sankey/d3-sankey-tests.ts @@ -168,7 +168,7 @@ let sGraph: d3Sankey.SankeyGraph; // Obtain SankeyLayout Generator // --------------------------------------------------------------------------- -let slgDefault: d3Sankey.SankeyLayout, {}, {}> = d3Sankey.sankey(); +const slgDefault: d3Sankey.SankeyLayout, {}, {}> = d3Sankey.sankey(); let slgDAG: d3Sankey.SankeyLayout = d3Sankey.sankey(); let slgDAGCustomId: d3Sankey.SankeyLayout = d3Sankey.sankey(); @@ -299,7 +299,7 @@ slgDAG = slgDAG.nodes(d => d.customNodes); // Get ----------------------------------------------------------------------- -let nodesAccessor: (d: DAG) => SNode[] = slgDAG.nodes(); +const nodesAccessor: (d: DAG) => SNode[] = slgDAG.nodes(); // --------------------------------------------------------------------------- // Links @@ -315,7 +315,7 @@ slgDAG = slgDAG.links(d => d.customLinks); // Get ----------------------------------------------------------------------- -let linksAccessor: (d: DAG) => SLink[] = slgDAG.links(); +const linksAccessor: (d: DAG) => SLink[] = slgDAG.links(); // --------------------------------------------------------------------------- // Compute Initial Layout @@ -344,7 +344,7 @@ pathGen = d3Sankey.sankeyLinkHorizontal(); // Render to svg path -let svgPathString: string | null = pathGen(sGraph.links[0]); +const svgPathString: string | null = pathGen(sGraph.links[0]); svgLinkPaths.attr('d', pathGen); // Render to canvas @@ -361,7 +361,7 @@ pathGen(sGraph.links[0]); // Sankey Node -------------------------------------------------------------- sNodes = sGraph.nodes; -let sNode = sNodes[0]; +const sNode = sNodes[0]; // User-specified extra properties: @@ -386,7 +386,7 @@ linksArrMaybe = sNode.targetLinks; // Sankey Link -------------------------------------------------------------- sLinks = sGraph.links; -let sLink = sLinks[0]; +const sLink = sLinks[0]; // User-specified extra properties: diff --git a/types/d3-scale-chromatic/d3-scale-chromatic-tests.ts b/types/d3-scale-chromatic/d3-scale-chromatic-tests.ts index 1dac850043..f6b322b74d 100644 --- a/types/d3-scale-chromatic/d3-scale-chromatic-tests.ts +++ b/types/d3-scale-chromatic/d3-scale-chromatic-tests.ts @@ -11,50 +11,50 @@ import * as d3ScaleChromatic from 'd3-scale-chromatic'; // ----------------------------------------------------------------------- // Categorical // ----------------------------------------------------------------------- -let accent: string = d3ScaleChromatic.schemeAccent[0]; // #7fc97f -let dark: string = d3ScaleChromatic.schemeDark2[0]; // #1b9e77 -let paired: string = d3ScaleChromatic.schemePaired[0]; // #a6cee3 -let pastel1: string = d3ScaleChromatic.schemePastel1[0]; // #fbb4ae -let pastel2: string = d3ScaleChromatic.schemePastel2[0]; // #b3e2cd -let set1: string = d3ScaleChromatic.schemeSet1[0]; // #e41a1c -let set2: string = d3ScaleChromatic.schemeSet2[0]; // #66c2a5 -let set3: string = d3ScaleChromatic.schemeSet3[0]; // #8dd3c7 +const accent: string = d3ScaleChromatic.schemeAccent[0]; // #7fc97f +const dark: string = d3ScaleChromatic.schemeDark2[0]; // #1b9e77 +const paired: string = d3ScaleChromatic.schemePaired[0]; // #a6cee3 +const pastel1: string = d3ScaleChromatic.schemePastel1[0]; // #fbb4ae +const pastel2: string = d3ScaleChromatic.schemePastel2[0]; // #b3e2cd +const set1: string = d3ScaleChromatic.schemeSet1[0]; // #e41a1c +const set2: string = d3ScaleChromatic.schemeSet2[0]; // #66c2a5 +const set3: string = d3ScaleChromatic.schemeSet3[0]; // #8dd3c7 // ----------------------------------------------------------------------- // Diverging // ----------------------------------------------------------------------- -let BrBG: string = d3ScaleChromatic.interpolateBrBG(0); // rgb(84, 48, 5) -let PRGn: string = d3ScaleChromatic.interpolatePRGn(0); // rgb(64, 0, 75) -let PiYG: string = d3ScaleChromatic.interpolatePiYG(0); // rgb(142, 1, 82) -let PuOr: string = d3ScaleChromatic.interpolatePuOr(0); // rgb(127, 59, 8) -let RdBu: string = d3ScaleChromatic.interpolateRdBu(0); // rgb(103, 0, 31) -let RdGy: string = d3ScaleChromatic.interpolateRdGy(0); // rgb(103, 0, 31) -let RdYlBu: string = d3ScaleChromatic.interpolateRdYlBu(0); // rgb(103, 0, 31) -let RdYlGn: string = d3ScaleChromatic.interpolateRdYlGn(0); // rgb(103, 0, 31) -let Spectral: string = d3ScaleChromatic.interpolateSpectral(0); // rgb(158, 1, 66) +const BrBG: string = d3ScaleChromatic.interpolateBrBG(0); // rgb(84, 48, 5) +const PRGn: string = d3ScaleChromatic.interpolatePRGn(0); // rgb(64, 0, 75) +const PiYG: string = d3ScaleChromatic.interpolatePiYG(0); // rgb(142, 1, 82) +const PuOr: string = d3ScaleChromatic.interpolatePuOr(0); // rgb(127, 59, 8) +const RdBu: string = d3ScaleChromatic.interpolateRdBu(0); // rgb(103, 0, 31) +const RdGy: string = d3ScaleChromatic.interpolateRdGy(0); // rgb(103, 0, 31) +const RdYlBu: string = d3ScaleChromatic.interpolateRdYlBu(0); // rgb(103, 0, 31) +const RdYlGn: string = d3ScaleChromatic.interpolateRdYlGn(0); // rgb(103, 0, 31) +const Spectral: string = d3ScaleChromatic.interpolateSpectral(0); // rgb(158, 1, 66) // ----------------------------------------------------------------------- // Sequential // ----------------------------------------------------------------------- -let Blue: string = d3ScaleChromatic.interpolateBlues(1); // rgb(8, 48, 107) -let Green: string = d3ScaleChromatic.interpolateGreens(1); // rgb(0, 68, 27) -let Grey: string = d3ScaleChromatic.interpolateGreys(1); // rgb(0, 0, 0) -let Orange: string = d3ScaleChromatic.interpolateOranges(1); // rgb(127, 39, 4) -let Purple: string = d3ScaleChromatic.interpolatePurples(1); // rgb(63, 0, 125) -let Red: string = d3ScaleChromatic.interpolateReds(1); // rgb(103, 0, 13) +const Blue: string = d3ScaleChromatic.interpolateBlues(1); // rgb(8, 48, 107) +const Green: string = d3ScaleChromatic.interpolateGreens(1); // rgb(0, 68, 27) +const Grey: string = d3ScaleChromatic.interpolateGreys(1); // rgb(0, 0, 0) +const Orange: string = d3ScaleChromatic.interpolateOranges(1); // rgb(127, 39, 4) +const Purple: string = d3ScaleChromatic.interpolatePurples(1); // rgb(63, 0, 125) +const Red: string = d3ScaleChromatic.interpolateReds(1); // rgb(103, 0, 13) // ----------------------------------------------------------------------- // Sequential(Multi-Hue) // ----------------------------------------------------------------------- -let BuGn: string = d3ScaleChromatic.interpolateBuGn(1); // rgb(0, 68, 27) -let BuPu: string = d3ScaleChromatic.interpolateBuPu(1); // rgb(77, 0, 75) -let GnBu: string = d3ScaleChromatic.interpolateGnBu(1); // rgb(8, 64, 129) -let OrRd: string = d3ScaleChromatic.interpolateOrRd(1); // rgb(127, 0, 0) -let PuBuGn: string = d3ScaleChromatic.interpolatePuBuGn(1); // rgb(1, 70, 54) -let PuBu: string = d3ScaleChromatic.interpolatePuBu(1); // rgb(2, 56, 88) -let PuRd: string = d3ScaleChromatic.interpolatePuRd(1); // rgb(103, 0, 31) -let RdPu: string = d3ScaleChromatic.interpolateRdPu(1); // rgb(73, 0, 106) -let YlGnBu: string = d3ScaleChromatic.interpolateYlGnBu(1); // rgb(8, 29, 88) -let YlGn: string = d3ScaleChromatic.interpolateYlGn(1); // rgb(0, 69, 41) -let YlOrBr: string = d3ScaleChromatic.interpolateYlOrBr(1); // rgb(102, 37, 6) -let YlOrRd: string = d3ScaleChromatic.interpolateYlOrRd(1); // rgb(128, 0, 38) +const BuGn: string = d3ScaleChromatic.interpolateBuGn(1); // rgb(0, 68, 27) +const BuPu: string = d3ScaleChromatic.interpolateBuPu(1); // rgb(77, 0, 75) +const GnBu: string = d3ScaleChromatic.interpolateGnBu(1); // rgb(8, 64, 129) +const OrRd: string = d3ScaleChromatic.interpolateOrRd(1); // rgb(127, 0, 0) +const PuBuGn: string = d3ScaleChromatic.interpolatePuBuGn(1); // rgb(1, 70, 54) +const PuBu: string = d3ScaleChromatic.interpolatePuBu(1); // rgb(2, 56, 88) +const PuRd: string = d3ScaleChromatic.interpolatePuRd(1); // rgb(103, 0, 31) +const RdPu: string = d3ScaleChromatic.interpolateRdPu(1); // rgb(73, 0, 106) +const YlGnBu: string = d3ScaleChromatic.interpolateYlGnBu(1); // rgb(8, 29, 88) +const YlGn: string = d3ScaleChromatic.interpolateYlGn(1); // rgb(0, 69, 41) +const YlOrBr: string = d3ScaleChromatic.interpolateYlOrBr(1); // rgb(102, 37, 6) +const YlOrRd: string = d3ScaleChromatic.interpolateYlOrRd(1); // rgb(128, 0, 38) diff --git a/types/d3-shape/d3-shape-tests.ts b/types/d3-shape/d3-shape-tests.ts index ee9a8fbb98..4199d2f170 100644 --- a/types/d3-shape/d3-shape-tests.ts +++ b/types/d3-shape/d3-shape-tests.ts @@ -447,8 +447,8 @@ let lineRadial: d3Shape.LineRadial = d3Shape.lineRadial = defaultLineRadial; -let radialLine: d3Shape.RadialLine = lineRadial; +const defaultRadialLine: d3Shape.RadialLine<[number, number]> = defaultLineRadial; +const radialLine: d3Shape.RadialLine = lineRadial; defaultLineRadial = d3Shape.radialLine(); lineRadial = d3Shape.radialLine(); @@ -685,8 +685,8 @@ let areaRadial: d3Shape.AreaRadial = d3Shape.areaRadial = defaultAreaRadial; -let radialArea: d3Shape.RadialArea = areaRadial; +const defaultRadialArea: d3Shape.RadialArea<[number, number]> = defaultAreaRadial; +const radialArea: d3Shape.RadialArea = areaRadial; defaultAreaRadial = d3Shape.radialArea(); areaRadial = d3Shape.radialArea(); @@ -1322,7 +1322,7 @@ customSymbol = d3Shape.symbolWye; // Test pointRadial // ----------------------------------------------------------------------------------- -let coordinatates: [number, number] = d3Shape.pointRadial(0, 12); +const coordinatates: [number, number] = d3Shape.pointRadial(0, 12); // ----------------------------------------------------------------------------------- // Test Stacks diff --git a/types/d3-time-format/d3-time-format-tests.ts b/types/d3-time-format/d3-time-format-tests.ts index 547a77aabe..eb569dd779 100644 --- a/types/d3-time-format/d3-time-format-tests.ts +++ b/types/d3-time-format/d3-time-format-tests.ts @@ -12,8 +12,6 @@ import * as d3TimeFormat from 'd3-time-format'; // Preparatory Steps // ---------------------------------------------------------------------- -let num: number; - let formatFn: (n: Date) => string; let parseFn: (dateString: string) => (Date | null); @@ -38,21 +36,21 @@ parseFn = d3TimeFormat.utcParse('.%L'); // iso ------------------------------------------------------------------ -let dateString: string = d3TimeFormat.isoFormat(new Date(2016, 6, 6)); -let date: Date = d3TimeFormat.isoParse('2016-07-08T14:06:41.386Z'); +const dateString: string = d3TimeFormat.isoFormat(new Date(2016, 6, 6)); +const date: Date = d3TimeFormat.isoParse('2016-07-08T14:06:41.386Z'); // ---------------------------------------------------------------------- // Test Locale Definition // ---------------------------------------------------------------------- -let dateTimeSpecifier: string = localeDef.dateTime; -let dateSpecifier: string = localeDef.date; -let timeSpecifier: string = localeDef.time; -let periods: [string, string] = localeDef.periods; -let days: [string, string, string, string, string, string, string] = localeDef.days; -let shortDays: [string, string, string, string, string, string, string] = localeDef.shortDays; -let months: [string, string, string, string, string, string, string, string, string, string, string, string] = localeDef.months; -let shortMonths: [string, string, string, string, string, string, string, string, string, string, string, string] = localeDef.shortMonths; +const dateTimeSpecifier: string = localeDef.dateTime; +const dateSpecifier: string = localeDef.date; +const timeSpecifier: string = localeDef.time; +const periods: [string, string] = localeDef.periods; +const days: [string, string, string, string, string, string, string] = localeDef.days; +const shortDays: [string, string, string, string, string, string, string] = localeDef.shortDays; +const months: [string, string, string, string, string, string, string, string, string, string, string, string] = localeDef.months; +const shortMonths: [string, string, string, string, string, string, string, string, string, string, string, string] = localeDef.shortMonths; localeDef = { dateTime: '%a %b %e %X %Y', diff --git a/types/d3-time/d3-time-tests.ts b/types/d3-time/d3-time-tests.ts index a99cd818a0..57905d5286 100644 --- a/types/d3-time/d3-time-tests.ts +++ b/types/d3-time/d3-time-tests.ts @@ -11,9 +11,9 @@ import * as d3Time from 'd3-time'; let countableI: d3Time.CountableTimeInterval; let simpleI: d3Time.TimeInterval; let dateArray: Date[]; -let start: Date = new Date(2014, 1, 1, 6, 0, 0, 0); -let end: Date = new Date(2016, 6, 13, 1, 25, 15, 500); -let inBetween: Date = new Date(2015, 6, 13, 1, 30, 5, 700); +const start: Date = new Date(2014, 1, 1, 6, 0, 0, 0); +const end: Date = new Date(2016, 6, 13, 1, 25, 15, 500); +const inBetween: Date = new Date(2015, 6, 13, 1, 30, 5, 700); let resultDate: Date; let count: number; @@ -75,7 +75,7 @@ simpleI = countableI.filter((d: Date) => d.getMonth() === 2); count = countableI.count(start, end); // let countableIOrNull: d3Time.CountableTimeInterval | null = countableI.every(10); // Test fails, since .every(...) return Interval and not CountableInterval -let simpleIOrNull: d3Time.TimeInterval | null = countableI.every(10); +const simpleIOrNull: d3Time.TimeInterval | null = countableI.every(10); resultDate = simpleI.floor(inBetween); resultDate = simpleI.round(inBetween); diff --git a/types/d3-timer/d3-timer-tests.ts b/types/d3-timer/d3-timer-tests.ts index d3e755ede1..042fc11072 100644 --- a/types/d3-timer/d3-timer-tests.ts +++ b/types/d3-timer/d3-timer-tests.ts @@ -9,7 +9,7 @@ import * as d3Timer from 'd3-timer'; // Test now definition -let now: number = d3Timer.now(); +const now: number = d3Timer.now(); // Test timer and timerFlush definitions ------------ diff --git a/types/d3-voronoi/d3-voronoi-tests.ts b/types/d3-voronoi/d3-voronoi-tests.ts index 7dea86241e..76971d6217 100644 --- a/types/d3-voronoi/d3-voronoi-tests.ts +++ b/types/d3-voronoi/d3-voronoi-tests.ts @@ -24,7 +24,7 @@ interface VoronoiTestDatum { y: number; } -let testData: VoronoiTestDatum[] = [ +const testData: VoronoiTestDatum[] = [ { x: 10, y: 10 }, { x: 20, y: 10 }, { x: 10, y: 20 }, @@ -84,7 +84,7 @@ pointPair = [[10, 10], [50, 50]]; // VoronoiPolygon ------------------------------------------------------- -let voronoiPolygon: d3Voronoi.VoronoiPolygon; +declare const voronoiPolygon: d3Voronoi.VoronoiPolygon; voronoiPolygon[0][0] = 10; // x-coordinate of first point voronoiPolygon[0][1] = 10; // y-coordinate of first point @@ -229,7 +229,6 @@ testDatum = link.target; // find() =============================================================== let nearestSite: d3Voronoi.VoronoiSite | null; -let wrongSiteDataType: d3Voronoi.VoronoiSite<[number, number]> | null; // Without search radius nearestSite = voronoiDiagram.find(10, 50); @@ -238,4 +237,4 @@ nearestSite = voronoiDiagram.find(10, 50); nearestSite = voronoiDiagram.find(10, 50, 20); // wrong data type -// wrongSiteDataType = voronoiDiagram.find(10, 50); // fails, due to data type mismatch +// const wrongSiteDataType: d3Voronoi.VoronoiSite<[number, number]> | null; = voronoiDiagram.find(10, 50); // fails, due to data type mismatch diff --git a/types/datatables.net/index.d.ts b/types/datatables.net/index.d.ts index 99a2aae7b8..8017017d8c 100644 --- a/types/datatables.net/index.d.ts +++ b/types/datatables.net/index.d.ts @@ -1321,7 +1321,7 @@ declare namespace DataTables { /** * Set an initial filter in DataTables and / or filtering options. Since: 1.10 */ - search?: SearchSettings; + search?: SearchSettings | boolean; /** * Set placeholder attribute for input type="text" tag elements. Since: 1.10 diff --git a/types/datejs/index.d.ts b/types/datejs/index.d.ts index d7c1854253..1863dc2a6f 100644 --- a/types/datejs/index.d.ts +++ b/types/datejs/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for DateJS // Project: http://www.datejs.com/ -// Definitions by: David Khristepher Santos +// Definitions by: David Khristepher Santos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped //NOTE: This definition file is for the library located at http://datejs.googlecode.com/svn/ and documented at https://code.google.com/p/datejs/wiki/APIDocumentation diff --git a/types/datejs/sugarpak.d.ts b/types/datejs/sugarpak.d.ts index b4077960ad..b389f2c723 100644 --- a/types/datejs/sugarpak.d.ts +++ b/types/datejs/sugarpak.d.ts @@ -1,6 +1,6 @@ // Type definitions for DateJS - SugarPak Extensions // Project: http://www.datejs.com/ -// Definitions by: David Khristepher Santos +// Definitions by: David Khristepher Santos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** SugarPak.js - Domain Specific Language - Syntactical Sugar */ diff --git a/types/db-migrate-pg/index.d.ts b/types/db-migrate-pg/index.d.ts index 6a72fd1109..09cba26317 100644 --- a/types/db-migrate-pg/index.d.ts +++ b/types/db-migrate-pg/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for db-migrate-pg // Project: https://github.com/db-migrate/pg -// Definitions by: nickiannone +// Definitions by: nickiannone // Definitions: https://github.com/nickiannone/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/deasync/deasync-tests.ts b/types/deasync/deasync-tests.ts index e4e77561e9..982e34c338 100644 --- a/types/deasync/deasync-tests.ts +++ b/types/deasync/deasync-tests.ts @@ -7,7 +7,7 @@ function handle(res: number) {} asyncFunction(42, handle); // deasync -let wrapped = deasync(asyncFunction); +const wrapped = deasync(asyncFunction); handle(wrapped(42)); // deasync.loopWhile diff --git a/types/debessmann/debessmann-tests.ts b/types/debessmann/debessmann-tests.ts index 4a247827fd..ab135de254 100644 --- a/types/debessmann/debessmann-tests.ts +++ b/types/debessmann/debessmann-tests.ts @@ -1,9 +1,9 @@ import { DM, Event, EventId } from 'debessmann'; -let eventId: EventId = {seq: 0, time: new Date()}; -let e: Event = {_id: eventId, headers: {header1: 'header1Val'}}; +const eventId: EventId = {seq: 0, time: new Date()}; +const e: Event = {_id: eventId, headers: {header1: 'header1Val'}}; -let dm: DM = { +const dm: DM = { init(endpoint: string, auth: string): void { }, send(data: Event): void { diff --git a/types/decimal.js/index.d.ts b/types/decimal.js/index.d.ts index 69521a46cc..27f4213612 100644 --- a/types/decimal.js/index.d.ts +++ b/types/decimal.js/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for decimal.js // Project: http://mikemcl.github.io/decimal.js -// Definitions by: Joseph Rossi +// Definitions by: Joseph Rossi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var Decimal: decimal.IDecimalStatic; diff --git a/types/deep-equal/index.d.ts b/types/deep-equal/index.d.ts index d9c4b5f6cf..7451fbc255 100644 --- a/types/deep-equal/index.d.ts +++ b/types/deep-equal/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for deep-equal 1.0 // Project: https://github.com/substack/node-deep-equal -// Definitions by: remojansen , Jay Anslow +// Definitions by: remojansen , Jay Anslow // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface DeepEqualOptions { diff --git a/types/detect-port/detect-port-tests.ts b/types/detect-port/detect-port-tests.ts index 759313665b..afd532ead0 100644 --- a/types/detect-port/detect-port-tests.ts +++ b/types/detect-port/detect-port-tests.ts @@ -1,6 +1,6 @@ import * as detect from "detect-port"; -const port: number = 8000; +const port = 8000; /** * callback usage diff --git a/types/dhtmlxgantt/index.d.ts b/types/dhtmlxgantt/index.d.ts index f94ba88a33..53626662ec 100644 --- a/types/dhtmlxgantt/index.d.ts +++ b/types/dhtmlxgantt/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for dhtmlxGantt 4.0.0 // Project: http://dhtmlx.com/docs/products/dhtmlxGantt -// Definitions by: Maksim Kozhukh , Christophe Camicas +// Definitions by: Maksim Kozhukh , Christophe Camicas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/dhtmlxscheduler/index.d.ts b/types/dhtmlxscheduler/index.d.ts index 2a5ff01c87..96c9670a4d 100644 --- a/types/dhtmlxscheduler/index.d.ts +++ b/types/dhtmlxscheduler/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for dhtmlxScheduler 4.3.0 // Project: http://dhtmlx.com/docs/products/dhtmlxScheduler -// Definitions by: Maksim Kozhukh +// Definitions by: Maksim Kozhukh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface SchedulerCallback { (...args: any[]): any } diff --git a/types/diff/diff-tests.ts b/types/diff/diff-tests.ts index e1b1025495..0d49147c33 100644 --- a/types/diff/diff-tests.ts +++ b/types/diff/diff-tests.ts @@ -1,12 +1,11 @@ -// tslint:disable:no-var only-arrow-functions import jsdiff = require('diff'); -var one = 'beep boop'; -var other = 'beep boob blah'; +const one = 'beep boop'; +const other = 'beep boob blah'; -var diff = jsdiff.diffChars(one, other); +let diff = jsdiff.diffChars(one, other); -diff.forEach(function(part) { - var mark = part.added ? '+' : +diff.forEach(part => { + const mark = part.added ? '+' : part.removed ? '-' : ' '; console.log(mark + " " + part.value); }); @@ -23,8 +22,8 @@ class LineDiffWithoutWhitespace extends jsdiff.Diff { } } -var obj = new LineDiffWithoutWhitespace(true); -var diff = obj.diff(one, other); +const obj = new LineDiffWithoutWhitespace(true); +diff = obj.diff(one, other); printDiff(diff); function printDiff(diff: jsdiff.IDiffResult[]) { @@ -50,7 +49,7 @@ function printDiff(diff: jsdiff.IDiffResult[]) { } function verifyPatchMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) { - var verifyPatch = jsdiff.parsePatch( + const verifyPatch = jsdiff.parsePatch( jsdiff.createTwoFilesPatch("oldFile.ts", "newFile.ts", oldStr, newStr, "old", "new", { context: 1 })); if (JSON.stringify(verifyPatch) !== JSON.stringify(uniDiff)) { @@ -58,7 +57,7 @@ function verifyPatchMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUni } } function verifyApplyMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUniDiff) { - var verifyApply = [ + const verifyApply = [ jsdiff.applyPatch(oldStr, uniDiff), jsdiff.applyPatch(oldStr, [uniDiff]) ]; @@ -83,7 +82,7 @@ function verifyApplyMethods(oldStr: string, newStr: string, uniDiff: jsdiff.IUni }); } -verifyPatchMethods(one, other, uniDiff); -var uniDiff = jsdiff.structuredPatch("oldFile.ts", "newFile.ts", one, other, +const uniDiff = jsdiff.structuredPatch("oldFile.ts", "newFile.ts", one, other, "old", "new", { context: 1 }); +verifyPatchMethods(one, other, uniDiff); verifyApplyMethods(one, other, uniDiff); diff --git a/types/dockerode/tslint.json b/types/dockerode/tslint.json index 3db14f85ea..aac1f69ee8 100644 --- a/types/dockerode/tslint.json +++ b/types/dockerode/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "await-promise": false + } +} diff --git a/types/dom-inputevent/tslint.json b/types/dom-inputevent/tslint.json index 3db14f85ea..b63c1c3846 100644 --- a/types/dom-inputevent/tslint.json +++ b/types/dom-inputevent/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-boolean-literal-compare": false + } +} diff --git a/types/dustjs-linkedin/index.d.ts b/types/dustjs-linkedin/index.d.ts index c3381ea00c..17513f1f17 100644 --- a/types/dustjs-linkedin/index.d.ts +++ b/types/dustjs-linkedin/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for linkedin dustjs 1.2.1 // Project: https://github.com/linkedin/dustjs -// Definitions by: Marcelo Dezem +// Definitions by: Marcelo Dezem // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // diff --git a/types/dwt/dwt-tests.ts b/types/dwt/dwt-tests.ts index 4b201cf33d..b1a5cc6b09 100644 --- a/types/dwt/dwt-tests.ts +++ b/types/dwt/dwt-tests.ts @@ -1,5 +1,5 @@ function dwtOnReady() { - let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer' + const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); // Get the Dynamic Web TWAIN object that is embeded in the div with id 'dwtcontrolContainer' if (DWObject) { let count = DWObject.SourceCount; if (count === 0) { @@ -12,7 +12,7 @@ function dwtOnReady() { } function acquireImage() { - let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); if (DWObject) { DWObject.SelectSourceByIndex(0); // Use method SelectSourceByIndex to avoid the 'Select Source' dialog DWObject.OpenSource(); @@ -22,7 +22,7 @@ function acquireImage() { } function registerEvent() { - let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); if (DWObject) { // The event OnPostTransfer fires after each image is scanned and transferred DWObject.RegisterEvent("OnPostTransfer", function () {}); @@ -41,7 +41,7 @@ function registerEvent() { } function editImage() { - let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); if (DWObject) { if (DWObject.HowManyImagesInBuffer > 0) DWObject.RotateLeft(DWObject.CurrentImageIndexInBuffer); @@ -58,14 +58,14 @@ function editImage() { } function showImageEditor() { - let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); if (DWObject) { DWObject.ShowImageEditor(); } } function saveImage() { - let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); if (DWObject) { DWObject.ConvertToGrayScale(DWObject.CurrentImageIndexInBuffer); DWObject.SaveAsJPEG("DynamicWebTWAIN.jpg", DWObject.CurrentImageIndexInBuffer); @@ -75,8 +75,8 @@ function saveImage() { } function updateLargeViewer() { - let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); - let DWObjectLargeViewer = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainerLargeViewer'); + const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + const DWObjectLargeViewer = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainerLargeViewer'); if (DWObject) { DWObject.CopyToClipboard(DWObject.CurrentImageIndexInBuffer); // Copy the current image in the thumbnail to clipboard in DIB format. DWObjectLargeViewer.LoadDibFromClipboard(); // Load the image from Clipboard into the large viewer. @@ -84,7 +84,7 @@ function updateLargeViewer() { } function uploadImage() { - let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); if (DWObject) { DWObject.HTTPPort = 80; DWObject.IfSSL = false; @@ -93,7 +93,7 @@ function uploadImage() { } function downloadImage() { - let DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); + const DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer'); if (DWObject) { DWObject.HTTPPort = 80; DWObject.HTTPDownload("www.dynamsoft.com", "img.png", () => {}, (errorCode: number, errorString: string) => {}); diff --git a/types/ej.web.all/tslint.json b/types/ej.web.all/tslint.json index f85abff699..cacaecba4b 100644 --- a/types/ej.web.all/tslint.json +++ b/types/ej.web.all/tslint.json @@ -1,9 +1,13 @@ { "extends": "dtslint/dt.json", "rules": { + // All are TODOs "comment-format": false, "no-consecutive-blank-lines": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, "no-padding": false, + "no-unnecessary-qualifier": false, "strict-export-declare-modifiers": false } } diff --git a/types/elasticsearch/index.d.ts b/types/elasticsearch/index.d.ts index fa68deba57..fbe9795b9e 100644 --- a/types/elasticsearch/index.d.ts +++ b/types/elasticsearch/index.d.ts @@ -83,6 +83,7 @@ declare module Elasticsearch { update(params: UpdateDocumentParams, callback: (error: any, response: any) => void): void; updateByQuery(params: UpdateDocumentByQueryParams): Promise; updateByQuery(params: UpdateDocumentByQueryParams, callback: (error: any, response: any) => void): void; + close(): void; } export interface ConfigOptions { diff --git a/types/electron-packager/index.d.ts b/types/electron-packager/index.d.ts index 7a4504c386..df5a10eb92 100644 --- a/types/electron-packager/index.d.ts +++ b/types/electron-packager/index.d.ts @@ -185,15 +185,12 @@ declare namespace electronPackager { * If present, signs OS X target apps when the host platform is OS X and XCode is installed. */ osxSign?: boolean | ElectronOsXSignOptions; - /** - * The URL protocol scheme(s) to associate the app with - */ - protocol?: string[]; - /** - * The descriptive name(s) of the URL protocol scheme(s) specified via the protocol option. - * Maps to the CFBundleURLName metadata property. - */ - protocolName?: string[]; + + /** The URL protocol schemes the app supports. */ + protocols?: Array<{ + name: string + schemes: string[] + }>; /** * Windows targets only diff --git a/types/electron-settings/v2/tslint.json b/types/electron-settings/v2/tslint.json index 4f44991c3c..bc27c7eca5 100644 --- a/types/electron-settings/v2/tslint.json +++ b/types/electron-settings/v2/tslint.json @@ -1,6 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { + // TODOs + "no-boolean-literal-compare": false, "no-empty-interface": false } } diff --git a/types/ember/ember-tests.ts b/types/ember/ember-tests.ts index b5097848ff..0ce8667862 100644 --- a/types/ember/ember-tests.ts +++ b/types/ember/ember-tests.ts @@ -106,13 +106,13 @@ App.userController = Ember.Object.create({ }); Ember.Helper.helper(params => { - let cents = params[0]; + const cents = params[0]; return `${cents * 0.01}`; }); Ember.Helper.helper((params, hash) => { - let cents = params[0]; - let currency = hash.currency; + const cents = params[0]; + const currency = hash.currency; return `${currency}${cents * 0.01}`; }); diff --git a/types/engine.io-client/engine.io-client-tests.ts b/types/engine.io-client/engine.io-client-tests.ts index 4a73136cef..aaf3f5be35 100644 --- a/types/engine.io-client/engine.io-client-tests.ts +++ b/types/engine.io-client/engine.io-client-tests.ts @@ -3,7 +3,7 @@ import client = require('engine.io-client'); let server: engine.Server; let socket: client.Socket; -let options: client.SocketOptions = {}; +const options: client.SocketOptions = {}; options.agent = false; options.upgrade = true; diff --git a/types/enhanced-resolve/index.d.ts b/types/enhanced-resolve/index.d.ts index aa85a8336f..5a39b4f6d0 100644 --- a/types/enhanced-resolve/index.d.ts +++ b/types/enhanced-resolve/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for enhanced-resolve v3.0.0 -// Project: http://github.com/webpack/enhanced-resolve.git +// Project: https://github.com/webpack/enhanced-resolve.git // Definitions by: e-cloud , Onigoetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/es6-collections/index.d.ts b/types/es6-collections/index.d.ts index 69f3b10cd8..5d3290a675 100644 --- a/types/es6-collections/index.d.ts +++ b/types/es6-collections/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for es6-collections v0.5.1 // Project: https://github.com/WebReflection/es6-collections/ -// Definitions by: Ron Buckton +// Definitions by: Ron Buckton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 diff --git a/types/es6-shim/index.d.ts b/types/es6-shim/index.d.ts index 4c03fc8b9e..51824fc932 100644 --- a/types/es6-shim/index.d.ts +++ b/types/es6-shim/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for es6-shim v0.31.2 // Project: https://github.com/paulmillr/es6-shim -// Definitions by: Ron Buckton +// Definitions by: Ron Buckton // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 diff --git a/types/esri-leaflet/esri-leaflet-tests.ts b/types/esri-leaflet/esri-leaflet-tests.ts index 7198c06d06..f6dfdf6e30 100644 --- a/types/esri-leaflet/esri-leaflet-tests.ts +++ b/types/esri-leaflet/esri-leaflet-tests.ts @@ -6,9 +6,9 @@ import L = require('esri-leaflet'); -let latlng: L.LatLng = new L.LatLng(0, 0); -let latlngbounds: L.LatLngBounds = new L.LatLngBounds(latlng, latlng); -let map: L.Map = new L.Map('map'); +const latlng: L.LatLng = new L.LatLng(0, 0); +const latlngbounds: L.LatLngBounds = new L.LatLngBounds(latlng, latlng); +const map: L.Map = new L.Map('map'); let basemapLayer: L.esri.BasemapLayer; basemapLayer = L.esri.basemapLayer('Streets'); @@ -217,7 +217,7 @@ dynamicMapLayer = new L.esri.DynamicMapLayer({ }); dynamicMapLayer.bindPopup(function (err, featureCollection, response) { - let count = featureCollection.features.length; + const count = featureCollection.features.length; return (count) ? count + ' features' : false; }); @@ -450,7 +450,7 @@ featureLayerService.query() .where("Direction = 'WEST'") .run(function (error, featureCollection, response) { }); -let feature = { +const feature = { type: 'Feature', geometry: { type: 'Point', @@ -462,7 +462,7 @@ let feature = { }; featureLayerService.addFeature(feature, function (error, response) { }); -let feature2 = { +const feature2 = { type: 'Feature', id: 2, geometry: { diff --git a/types/esri-leaflet/index.d.ts b/types/esri-leaflet/index.d.ts index e2ccf9f6a8..31a31bb9b5 100644 --- a/types/esri-leaflet/index.d.ts +++ b/types/esri-leaflet/index.d.ts @@ -3,13 +3,6 @@ // Definitions by: strajuser // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// tslint:disable:whitespace -// tslint:disable:no-trailing-whitespace -// tslint:disable:prefer-method-signature -// tslint:disable:no-single-declare-module -// tslint:disable:max-line-length -// tslint:disable:no-empty-interface - /// declare namespace L { @@ -19,43 +12,43 @@ declare namespace L { interface LayerOptionsBase { /** * URL of the Map Service - * + * * @type {string} * @memberof LayerOptionsBase */ url: string; /** * URL of an ArcGIS API for JavaScript proxy or ArcGIS Resource Proxy to use for proxying requests. - * + * * @type {string} * @memberof LayerOptionsBase */ proxy?: string; /** * Dictates if the service should use CORS when making GET requests. - * + * * @type {boolean} * @memberof LayerOptionsBase */ useCors?: boolean; /** * Will use this token to authenticate all calls to the service. - * + * * @type {string} * @memberof LayerOptionsBase */ token?: string; } - type Basemaps = - 'Streets' + type Basemaps = + 'Streets' | 'Topographic' | 'NationalGeographic' | 'Oceans' | 'Gray' | 'DarkGray' | 'Imagery' - | 'ShadedRelief' + | 'ShadedRelief' | 'Terrain' | 'USATopo' | 'OceansLabels' @@ -63,23 +56,23 @@ declare namespace L { | 'DarkGrayLabels' | 'ImageryLabels' | 'ImageryTransportation' - | 'ShadedReliefLabels' + | 'ShadedReliefLabels' | 'TerrainLabels'; type LeafletGeometry = L.Marker | L.Polygon | L.Polyline | L.LatLng | L.LatLngBounds | L.GeoJSON; type GeoJSONGeometry = GeoJSON.Point | GeoJSON.Polygon | GeoJSON.LineString; type Geometry = LeafletGeometry | GeoJSONGeometry; - + /** * Options for L.esri.BasemapLayer - * + * * @interface BasemapLayerOptions * @extends {L.TileLayerOptions} */ interface BasemapLayerOptions extends L.TileLayerOptions { /** * Will use this token to authenticate all calls to the service. - * + * * @type {string} * @memberof BasemapLayerOptions */ @@ -88,7 +81,7 @@ declare namespace L { /** * L.esri.BasemapLayer is used to display Esri hosted basemaps and attributes data providers appropriately. The Terms of Use for Esri hosted services apply to all Leaflet applications. - * + * * @class BasemapLayer * @extends {L.TileLayer} */ @@ -98,16 +91,16 @@ declare namespace L { /** * L.esri.basemapLayer is used to display Esri hosted basemaps and attributes data providers appropriately. The Terms of Use for Esri hosted services apply to all Leaflet applications. - * - * @param {Basemaps} key - * @param {BasemapLayerOptions} [options] - * @returns {BasemapLayer} + * + * @param {Basemaps} key + * @param {BasemapLayerOptions} [options] + * @returns {BasemapLayer} */ function basemapLayer(key: Basemaps, options?: BasemapLayerOptions): BasemapLayer; - + /** * Options for L.esri.TiledMapLayer - * + * * @interface TiledMapLayerOptions * @extends {L.TileLayerOptions} */ @@ -115,7 +108,7 @@ declare namespace L { /** * If correctZoomLevels is enabled this controls the amount of tolerance for the difference at each scale level for remapping tile levels. * Default 0.1 - * + * * @type {number} * @memberof TiledMapLayerOptions */ @@ -124,7 +117,7 @@ declare namespace L { /** * Access tiles from ArcGIS Online and ArcGIS Server to visualize and identify features. Copyright text from the service is added to map attribution automatically. - * + * * @class TiledMapLayer * @extends {L.TileLayer} */ @@ -132,39 +125,39 @@ declare namespace L { constructor(options: TiledMapLayerOptions); /** * Authenticates this service with a new token and runs any pending requests that required a token. - * - * @param {string} token - * @returns {this} + * + * @param {string} token + * @returns {this} * @memberof TiledMapLayer */ authenticate(token: string): this; /** * Requests metadata about this Feature Layer. Callback will be called with error and metadata. - * - * @param {CallbackHandler} callback - * @param {*} context - * @returns {this} + * + * @param {CallbackHandler} callback + * @param {*} context + * @returns {this} * @memberof TiledMapLayer */ metadata(callback: CallbackHandler, context?: any): this; /** * Returns a new L.esri.services.IdentifyFeatures object that can be used to identify features on this layer. Your callback function will be passed a GeoJSON FeatureCollection with the results or an error. - * - * @returns {*} + * + * @returns {*} * @memberof TiledMapLayer */ identify(): IdentifyFeatures; /** * Returns a new L.esri.services.Find object that can be used to find features. Your callback function will be passed a GeoJSON FeatureCollection with the results or an error. - * - * @returns {*} + * + * @returns {*} * @memberof TiledMapLayer */ find(): Find; /** * Returns a new L.esri.Query object that can be used to query this service. - * - * @returns {*} + * + * @returns {*} * @memberof TiledMapLayer */ query(): Query; @@ -172,15 +165,15 @@ declare namespace L { /** * Access tiles from ArcGIS Online and ArcGIS Server to visualize and identify features. Copyright text from the service is added to map attribution automatically. - * - * @param {TiledMapLayerOptions} options - * @returns {TiledMapLayer} + * + * @param {TiledMapLayerOptions} options + * @returns {TiledMapLayer} */ function tiledMapLayer(options: TiledMapLayerOptions): TiledMapLayer; /** * Options for RasterLayer - * + * * @interface RasterLayerOptions * @extends {L.ImageOverlayOptions} */ @@ -188,7 +181,7 @@ declare namespace L { /** * Server response content type. * Default: 'image' - * + * * @type {string} * @memberof RasterLayerOptions */ @@ -196,21 +189,21 @@ declare namespace L { /** * Position of the layer relative to other overlays. * Default: 'front' - * + * * @type {string} * @memberof RasterLayerOptions */ position?: string; /** * Closest zoom level the layer will be displayed on the map. - * + * * @type {number} * @memberof RasterLayerOptions */ maxZoom?: number; /** * Furthest zoom level the layer will be displayed on the map. - * + * * @type {number} * @memberof RasterLayerOptions */ @@ -219,77 +212,77 @@ declare namespace L { /** * A generic class representing an image layer. This class can be extended to provide support for making export requests from ArcGIS REST services. - * + * * @class RasterLayer * @extends {L.ImageOverlay} */ abstract class RasterLayer extends L.ImageOverlay { /** * Redraws this layer below all other overlay layers. - * - * @returns {this} + * + * @returns {this} * @memberof RasterLayer */ bringToBack(): this; /** * Redraws this layer above all other overlay layers. - * - * @returns {this} + * + * @returns {this} * @memberof RasterLayer */ bringToFront(): this; /** * Returns the current opacity of the layer. - * - * @returns {number} + * + * @returns {number} * @memberof RasterLayer */ getOpacity(): number; /** * Sets the opacity of the layer. - * - * @param {number} opacity - * @returns {this} + * + * @param {number} opacity + * @returns {this} * @memberof RasterLayer */ setOpacity(opacity: number): this; /** * Returns the current time range being used for rendering. Array [from, to]; - * - * @returns {Date[]} + * + * @returns {Date[]} * @memberof RasterLayer */ getTimeRange(): Date[]; /** * Redraws the layer with he passed time range. - * - * @param {Date} from - * @param {Date} to - * @returns {this} + * + * @param {Date} from + * @param {Date} to + * @returns {this} * @memberof RasterLayer */ setTimeRange(from: Date, to: Date): this; /** * Used to make a fresh request to the service and draw the response. - * - * @returns {this} + * + * @returns {this} * @memberof RasterLayer */ redraw(): this; /** * Authenticates this service with a new token and runs any pending requests that required a token. - * - * @param {string} token - * @returns {this} + * + * @param {string} token + * @returns {this} * @memberof TiledMapLayer */ authenticate(token: string): this; /** * Requests metadata about this Feature Layer. Callback will be called with error and metadata. - * - * @param {CallbackHandler} callback - * @param {*} context - * @returns {this} + * + * @param {CallbackHandler} callback + * @param {*} context + * @returns {this} * @memberof TiledMapLayer */ metadata(callback: CallbackHandler, context?: any): this; @@ -297,7 +290,7 @@ declare namespace L { /** * Options for L.esri.DynamicMapLayer - * + * * @interface DynamicMapLayerOptions * @extends {RasterLayerOptions} */ @@ -305,43 +298,43 @@ declare namespace L { /** * Output format of the image. * Default: 'png24' - * + * * @type {string} * @memberof DynamicMapLayerOptions */ format?: string; /** * Allow the server to produce transparent images. - * + * * @type {boolean} * @memberof DynamicMapLayerOptions */ transparent?: boolean; /** * Attribution from service metadata copyright text is automatically displayed in Leaflet's default control. This property can be used for customization. - * + * * @type {string} * @memberof DynamicMapLayerOptions */ attribution?: string; /* * An array of Layer IDs like [3,4,5] to show from the service. - * + * * @type {any[]} * @memberof DynamicMapLayerOptions */ layers?: any[]; /** - * SQL filters to define what features will be included in the image rendered by the service. An object is used with keys that map each query to its respective layer. + * SQL filters to define what features will be included in the image rendered by the service. An object is used with keys that map each query to its respective layer. * { 3: "STATE_NAME='Kansas'", 9: "POP2007>25000" } - * + * * @type {*} * @memberof DynamicMapLayerOptions */ layerDefs?: any; /** * JSON object literal used to manipulate the layer symbology defined in the service itself. Requires a 10.1 (or above) map service which supports dynamicLayers requests. - * + * * @type {*} * @memberof DynamicMapLayerOptions */ @@ -351,7 +344,7 @@ declare namespace L { /** * Render and visualize Map Services from ArcGIS Online and ArcGIS Server. L.esri.DynamicMapLayer also supports custom popups and identification of features. * Map Services are used when its preferable to ask the server to draw layers at a particular location and scale and pass back the image which was generated on the fly. They also expose capabilities for querying and identifying individual features. - * + * * @class DynamicMapLayer * @extends {RasterLayer} */ @@ -359,114 +352,114 @@ declare namespace L { constructor(options: DynamicMapLayerOptions); /** * Uses the provided function to create a popup that will identify features whenever the map is clicked. Your function will be passed a GeoJSON FeatureCollection of the features at the clicked location and should return the appropriate HTML. If you do not want to open the popup when there are no results, return false. - * - * @param {any} fn - * @param {L.PopupOptions} popupOptions - * @returns {this} + * + * @param {any} fn + * @param {L.PopupOptions} popupOptions + * @returns {this} * @memberof DynamicMapLayer */ bindPopup(fn: FeatureCallbackHandler, popupOptions?: L.PopupOptions): this; bindPopup(content: ((layer: Layer) => Content) | Content | Popup, options?: PopupOptions): this; /** * Removes a popup previously bound with bindPopup. - * - * @returns {this} + * + * @returns {this} * @memberof DynamicMapLayer */ unbindPopup(): this; /** * Returns the current opacity of the layer. - * - * @returns {number} + * + * @returns {number} * @memberof DynamicMapLayer */ getOpacity(): number; /** * Sets the opacity of the layer. - * - * @param {number} opacity - * @returns {this} + * + * @param {number} opacity + * @returns {this} * @memberof DynamicMapLayer */ setOpacity(opacity: number): this; /** * Returns the array of visible layers specified in the layer constructor. - * - * @returns {Array} + * + * @returns {Array} * @memberof DynamicMapLayer */ getLayers(): any[]; /** * Redraws the layer to show the passed array of layer ids. - * - * @param {Array} layers - * @returns {this} + * + * @param {Array} layers + * @returns {this} * @memberof DynamicMapLayer */ setLayers(layers: any[]): this; /** * Returns the current layer definition(s) being used for rendering. - * - * @returns {*} + * + * @returns {*} * @memberof DynamicMapLayer */ getLayerDefs(): any; /** * Redraws the layer with the new layer definitions. Corresponds to the layerDefs option on the export API. - * - * @param {*} layerDefs - * @returns {this} + * + * @param {*} layerDefs + * @returns {this} * @memberof DynamicMapLayer */ setLayerDefs(layerDefs: any): this; /** * Returns the current time options being used for rendering. - * - * @returns {*} + * + * @returns {*} * @memberof DynamicMapLayer */ getTimeOptions(): any; /** * Sets the current time options being used to render the layer. Corresponds to the layerTimeOptions option on the export API. - * - * @param {*} timeOptions - * @returns {this} + * + * @param {*} timeOptions + * @returns {this} * @memberof DynamicMapLayer */ setTimeOptions(timeOptions: any): this; /** * Returns a JSON object representing the modified layer symbology being requested from the map service. - * - * @returns {*} + * + * @returns {*} * @memberof DynamicMapLayer */ getDynamicLayers(): any; /** * Used to insert raw dynamicLayers JSON in situations where you'd like to modify layer symbology defined in the service itself. - * - * @param {*} layers - * @returns {this} + * + * @param {*} layers + * @returns {this} * @memberof DynamicMapLayer */ setDynamicLayers(layers: any): this; /** * Returns a new L.esri.services.IdentifyFeatures object that can be used to identify features on this layer. Your callback function will be passed a GeoJSON FeatureCollection with the results or an error. - * - * @returns {*} + * + * @returns {*} * @memberof DynamicMapLayer */ identify(): IdentifyFeatures; /** * Returns a new L.esri.services.Find object that can be used to find features. Your callback function will be passed a GeoJSON FeatureCollection with the results or an error. - * - * @returns {*} + * + * @returns {*} * @memberof DynamicMapLayer */ find(): Find; /** * Returns a new L.esri.Query object that can be used to query this service. - * - * @returns {*} + * + * @returns {*} * @memberof DynamicMapLayer */ query(): Query; @@ -475,138 +468,138 @@ declare namespace L { /** * Render and visualize Map Services from ArcGIS Online and ArcGIS Server. L.esri.DynamicMapLayer also supports custom popups and identification of features. * Map Services are used when its preferable to ask the server to draw layers at a particular location and scale and pass back the image which was generated on the fly. They also expose capabilities for querying and identifying individual features. - * - * @param {DynamicMapLayerOptions} options - * @returns {DynamicMapLayer} + * + * @param {DynamicMapLayerOptions} options + * @returns {DynamicMapLayer} */ function dynamicMapLayer(options: DynamicMapLayerOptions): DynamicMapLayer; /** * Options for FeatureLayer - * + * * @interface FeatureLayerOptions * @extends {LayerOptionsBase} */ interface FeatureLayerOptions extends LayerOptionsBase { /** * Function that will be used for creating layers for GeoJSON points. If the option is not specified, simple markers will be created). For point layers, custom panes should be passed through pointToLayer (example here). - * + * * @memberof FeatureLayerOptions */ pointToLayer?: (feature: any, latLng: LatLngExpression) => void; /** * Function that will be used to get style options for vector layers created for GeoJSON features. - * + * * @memberof FeatureLayerOptions */ style?: (feature: any, layer: L.Layer) => void; /** * Provides an opportunity to introspect individual GeoJSON features in the layer. - * + * * @memberof FeatureLayerOptions */ onEachFeature?: (feature: any, layer: L.Layer) => void; /** * An optional expression to filter features server side. String values should be denoted using single quotes ie: where: "FIELDNAME = 'field value'"; More information about valid SQL syntax can be found here. - * + * * @type {string} * @memberof FeatureLayerOptions */ where?: string; /** * Closest zoom level the layer will be displayed on the map. example: maxZoom:19 - * + * * @type {number} * @memberof FeatureLayerOptions */ maxZoom?: number; /** * Furthest zoom level the layer will be displayed on the map. example: minZoom:3 - * + * * @type {number} * @memberof FeatureLayerOptions */ minZoom?: number; /** * Will remove layers from the internal cache when they are removed from the map. - * + * * @type {boolean} * @memberof FeatureLayerOptions */ cacheLayers?: boolean; /** * An array of fieldnames to pull from the service. Includes all fields by default. You should always specify the name of the unique id for the service. Usually either 'FID' or 'OBJECTID'. - * + * * @type {Array} * @memberof FeatureLayerOptions */ fields?: string[]; /** * When paired with to defines the time range of features to display. Requires the Feature Layer to be time enabled. - * + * * @type {Date} * @memberof FeatureLayerOptions */ from?: Date; /** * When paired with from defines the time range of features to display. Requires the Feature Layer to be time enabled. - * + * * @type {Date} * @memberof FeatureLayerOptions */ to?: Date; /** * The name of the field to lookup the time of the feature. Can be an object like {start:'startTime', end:'endTime'} or a string like 'created'. - * + * * @type {*} * @memberof FeatureLayerOptions */ timeField?: any; /** * Determines where features are filtered by time. By default features will be filtered by the server. If set to 'client' all features are requested and filtered by the app before display. - * + * * @type {('server' | 'client')} * @memberof FeatureLayerOptions */ timeFilterMode?: 'server' | 'client'; /** * How much to simplify polygons and polylines. A higher value gives better performance, a lower value gives a more accurate representation. - * + * * @type {number} * @memberof FeatureLayerOptions */ simplifyFactor?: number; /** * How many digits of precision to request from the server. Wikipedia has a great reference of digit precision to meters. - * + * * @type {number} * @memberof FeatureLayerOptions */ precision?: number; /** * The vector renderer to use to draw the service. Usually L.svg() is preferable but setting to L.canvas() can have performance benefits for large polygon layers. - * + * * @type {(L.SVG | L.Canvas)} * @memberof FeatureLayerOptions */ renderer?: L.SVG | L.Canvas; /** * Set this to false if your own service supports GeoJSON as an output format but you'd like to ask for Geoservices JSON instead. - * + * * @type {boolean} * @memberof FeatureLayerOptions */ isModern?: boolean; /** * When utilizing esri-leaflet-renderers '2.0.2' or above, this option makes it possible to override the symbology defined by the service itself. - * + * * @type {boolean} * @memberof FeatureLayerOptions */ ignoreRenderer?: boolean; } - type StyleCallback = (feature: any) => any; + type StyleCallback = (feature: any) => any; // TODO: VirtualGrid extends support @@ -617,7 +610,7 @@ declare namespace L { * Feature Layer URLs always end in a number (ex: /FeatureServer/{LAYER_ID} or /MapServer/{LAYER_ID}). * You can create a new empty feature service with a single layer on the ArcGIS for Developers website or you can use ArcGIS Online to create a Feature Service from a CSV or Shapefile * L.esri.FeatureLayer divides the current map extent into a grid of individual cells and uses them to fire queries to fetch nearby features. This technique is comparable to MODE_ONDEMAND in the ArcGIS API for JavaScript. - * + * * @class FeatureLayer * @extends {L.Layer} */ @@ -627,99 +620,99 @@ declare namespace L { * Sets the given path options to each layer that has a setStyle method. Can also be a Function that will receive a feature argument and should return Path Options * featureLayer.setStyle({ color: 'white' }) * featureLayer.setStyle(function(feature){ return { weight: feature.properties.pixelWidth };}) - * - * @param {(L.PathOptions | StyleCallback)} style - * @returns {this} + * + * @param {(L.PathOptions | StyleCallback)} style + * @returns {this} * @memberof FeatureLayer */ setStyle(style: L.PathOptions | StyleCallback): this; /** * Changes the style on a specfic feature. - * - * @param {(string | number)} id - * @param {(L.PathOptions | StyleCallback)} style - * @returns {this} + * + * @param {(string | number)} id + * @param {(L.PathOptions | StyleCallback)} style + * @returns {this} * @memberof FeatureLayer */ setFeatureStyle(id: string | number, style: L.PathOptions | StyleCallback): this; /** * Given the ID of a feature, reset that feature to the original style. - * - * @returns {this} + * + * @returns {this} * @memberof FeatureLayer */ resetStyle(): this; /** * Calls the passed function against every feature. The function will be passed the layer that represents the feature. * featureLayer.eachFeature(function(layer){ console.log(layer.feature.properties.NAME); }); - * - * @param {(feature: any) => void} fn - * @param {*} [context] - * @returns {this} + * + * @param {(feature: any) => void} fn + * @param {*} [context] + * @returns {this} * @memberof FeatureLayer */ - eachFeature(fn: (feature: any) => void, context?: any): this; + eachFeature(fn: (feature: any) => void, context?: any): this; /** * Calls the passed function against every feature that is currently being displayed. - * - * @param {(feature: any) => void} fn - * @param {*} [context] - * @returns {this} + * + * @param {(feature: any) => void} fn + * @param {*} [context] + * @returns {this} * @memberof FeatureLayer */ - eachActiveFeature(fn: (feature: any) => void, context?: any): this; + eachActiveFeature(fn: (feature: any) => void, context?: any): this; /** * Given the id of a Feature return the layer on the map that represents it. This will usually be a Leaflet vector layer like Polyline or Polygon, or a Leaflet Marker. - * - * @param {(string | number)} id - * @returns {L.Layer} + * + * @param {(string | number)} id + * @returns {L.Layer} * @memberof FeatureLayer */ getFeature(id: string | number): L.Layer; /** * Returns the current where setting - * - * @returns {string} + * + * @returns {string} * @memberof FeatureLayer */ getWhere(): string; /** * Sets the new where option and refreshes the layer to reflect the new where filter. Accepts an optional callback and function context. - * - * @param {string} where - * @param {FeatureCallbackHandler} [callback] - * @param {*} [context] - * @returns {this} + * + * @param {string} where + * @param {FeatureCallbackHandler} [callback] + * @param {*} [context] + * @returns {this} * @memberof FeatureLayer */ - setWhere(where: string, callback?: FeatureCallbackHandler, context?: any): this; + setWhere(where: string, callback?: FeatureCallbackHandler, context?: any): this; /** * Returns the current time range as an array like [from, to] - * - * @returns {Date[]} + * + * @returns {Date[]} * @memberof FeatureLayer */ getTimeRange(): Date[]; /** * Sets the current time filter applied to features. An optional callback is run upon completion if timeFilterMode is set to 'server'. Also accepts function context as the last argument. - * - * @param {Date} from - * @param {Date} to - * @param {FeatureCallbackHandler} [callback] - * @param {*} [context] - * @returns {this} + * + * @param {Date} from + * @param {Date} to + * @param {FeatureCallbackHandler} [callback] + * @param {*} [context] + * @returns {this} * @memberof FeatureLayer */ - setTimeRange(from: Date, to: Date, callback?: FeatureCallbackHandler, context?: any): this; + setTimeRange(from: Date, to: Date, callback?: FeatureCallbackHandler, context?: any): this; /** * Adds a new feature to the feature layer. this also adds the feature to the map if creation is successful. * Requires authentication as a user who has permission to edit the service in ArcGIS Online or the user who created the service. * Requires the Create capability be enabled on the service. You can check if creation exists by checking the metadata of your service under capabilities. - * - * @param {GeoJSONFeature} feature - * @param {ResponseCallbackHandler} [callback] - * @param {*} context - * @returns {this} + * + * @param {GeoJSONFeature} feature + * @param {ResponseCallbackHandler} [callback] + * @param {*} context + * @returns {this} * @memberof FeatureLayer */ // TODO: GeoJSONFeature @@ -728,11 +721,11 @@ declare namespace L { * Update the provided feature on the Feature Layer. This also updates the feature on the map. * Requires authentication as a user who has permission to edit the service in ArcGIS Online or the user who created the service. * Requires the Update capability be enabled on the service. You can check if this operation exists by checking the metadata of your service under capabilities. - * - * @param {GeoJSONFeature} feature - * @param {ResponseCallbackHandler} [callback] - * @param {*} context - * @returns {this} + * + * @param {GeoJSONFeature} feature + * @param {ResponseCallbackHandler} [callback] + * @param {*} context + * @returns {this} * @memberof FeatureLayer */ // TODO: GeoJSONFeature @@ -741,11 +734,11 @@ declare namespace L { * Remove the feature with the provided id from the feature layer. This will also remove the feature from the map if it exists. * Requires authentication as a user who has permission to edit the service in ArcGIS Online or the user who created the service. * Requires the Delete capability be enabled on the service. You can check if this operation exists by checking the metadata of your service under capabilities. - * - * @param {(string | number)} id - * @param {ResponseCallbackHandler} [callback] - * @param {*} context - * @returns {this} + * + * @param {(string | number)} id + * @param {ResponseCallbackHandler} [callback] + * @param {*} context + * @returns {this} * @memberof FeatureLayer */ deleteFeature(id: string | number, callback?: ResponseCallbackHandler, context?: any): this; @@ -753,64 +746,64 @@ declare namespace L { * Removes an array of features with the provided ids from the feature layer. This will also remove the features from the map if they exist. * Requires authentication as a user who has permission to edit the service in ArcGIS Online or the user who created the service. * Requires the Delete capability be enabled on the service. You can check if this operation exists by checking the metadata of your service under capabilities. - * - * @param {(Array)} ids - * @param {ResponseCallbackHandler} [callback] - * @param {*} context - * @returns {this} + * + * @param {(Array)} ids + * @param {ResponseCallbackHandler} [callback] + * @param {*} context + * @returns {this} * @memberof FeatureLayer */ deleteFeatures(ids: string[] | number[], callback?: ResponseCallbackHandler, context?: any): this; /** * Redraws a feature with the provided id from the feature layer. - * - * @param {(string | number)} id - * @returns {this} + * + * @param {(string | number)} id + * @returns {this} * @memberof FeatureLayer */ redraw(id: string | number): this; /** * Redraws all features from the feature layer that exist on the map. - * - * @returns {this} + * + * @returns {this} * @memberof FeatureLayer */ refresh(): this; /** * Authenticates this service with a new token and runs any pending requests that required a token. - * - * @param {string} token - * @returns {this} + * + * @param {string} token + * @returns {this} * @memberof TiledMapLayer */ authenticate(token: string): this; /** * Requests metadata about this Feature Layer. Callback will be called with error and metadata. - * - * @param {CallbackHandler} callback - * @param {*} context - * @returns {this} + * + * @param {CallbackHandler} callback + * @param {*} context + * @returns {this} * @memberof TiledMapLayer */ metadata(callback: CallbackHandler, context?: any): this; /** * Returns a new L.esri.services.IdentifyFeatures object that can be used to identify features on this layer. Your callback function will be passed a GeoJSON FeatureCollection with the results or an error. - * - * @returns {*} + * + * @returns {*} * @memberof TiledMapLayer */ identify(): IdentifyFeatures; /** * Returns a new L.esri.services.Find object that can be used to find features. Your callback function will be passed a GeoJSON FeatureCollection with the results or an error. - * - * @returns {*} + * + * @returns {*} * @memberof TiledMapLayer */ find(): Find; /** * Returns a new L.esri.Query object that can be used to query this service. - * - * @returns {*} + * + * @returns {*} * @memberof TiledMapLayer */ query(): Query; @@ -823,9 +816,9 @@ declare namespace L { * Feature Layer URLs always end in a number (ex: /FeatureServer/{LAYER_ID} or /MapServer/{LAYER_ID}). * You can create a new empty feature service with a single layer on the ArcGIS for Developers website or you can use ArcGIS Online to create a Feature Service from a CSV or Shapefile * L.esri.FeatureLayer divides the current map extent into a grid of individual cells and uses them to fire queries to fetch nearby features. This technique is comparable to MODE_ONDEMAND in the ArcGIS API for JavaScript. - * - * @param {FeatureLayerOptions} options - * @returns {FeatureLayer} + * + * @param {FeatureLayerOptions} options + * @returns {FeatureLayer} */ function featureLayer(options: FeatureLayerOptions): FeatureLayer; } @@ -838,34 +831,34 @@ declare namespace L { /** * Options for L.esri.Service - * + * * @interface ServiceOptions */ interface ServiceOptions { /** * URL of the ArcGIS service you would like to consume. - * + * * @type {string} * @memberof ServiceOptions */ url?: string; /** * URL of an ArcGIS API for JavaScript proxy or ArcGIS Resource Proxy to use for proxying POST requests. - * + * * @type {string} * @memberof ServiceOptions */ proxy?: string; /** * If this service should use CORS when making GET requests. - * + * * @type {boolean} * @memberof ServiceOptions */ useCors?: boolean; /** * Operation timeout - * + * * @type {number} * @memberof ServiceOptions */ @@ -874,47 +867,47 @@ declare namespace L { /** * A generic class representing a hosted resource on ArcGIS Online or ArcGIS Server. This class can be extended to provide support for making requests and serves as a standard for authentication and proxying. - * + * * @class Service * @extends {L.Evented} */ abstract class Service extends L.Evented { /** * Makes a GET request to the service. The service's URL will be combined with the path option and parameters will be serialized to a query string. Accepts an optional function context for the callback. - * - * @param {string} url - * @param {*} [params] - * @param {CallbackHandler} [callback] - * @param {*} [context] - * @returns {this} + * + * @param {string} url + * @param {*} [params] + * @param {CallbackHandler} [callback] + * @param {*} [context] + * @returns {this} * @memberof Service */ get(url: string, params?: any, callback?: CallbackHandler, context?: any): this; /** * Makes a POST request to the service. The service's URL will be combined with the path option and parameters will be serialized. Accepts an optional function context for the callback. - * - * @param {string} url - * @param {*} [params] - * @param {CallbackHandler} [callback] - * @param {*} [context] - * @returns {this} + * + * @param {string} url + * @param {*} [params] + * @param {CallbackHandler} [callback] + * @param {*} [context] + * @returns {this} * @memberof Service */ post(url: string, params?: any, callback?: CallbackHandler, context?: any): this; /** * Authenticates this service with a new token and runs any pending requests that required a token. - * - * @param {string} token - * @returns {this} + * + * @param {string} token + * @returns {this} * @memberof TiledMapLayer */ authenticate(token: string): this; /** * Requests metadata about this Feature Layer. Callback will be called with error and metadata. - * - * @param {CallbackHandler} callback - * @param {*} context - * @returns {this} + * + * @param {CallbackHandler} callback + * @param {*} context + * @returns {this} * @memberof TiledMapLayer */ metadata(callback: CallbackHandler, context?: any): this; @@ -922,7 +915,7 @@ declare namespace L { /** * Options for MapService - * + * * @interface MapServiceOptions * @extends {ServiceOptions} */ @@ -930,7 +923,7 @@ declare namespace L { /** * L.esri.MapService is an abstraction for interacting with Map Services running on ArcGIS Online and ArcGIS Server that allows you to make requests to the API, as well as query and identify published features. - * + * * @class MapService * @extends {Service} */ @@ -938,22 +931,22 @@ declare namespace L { constructor(options: MapServiceOptions); /** * Returns a new L.esri.services.IdentifyFeatures object that can be used to identify features on this layer. Your callback function will be passed a GeoJSON FeatureCollection with the results or an error. - * - * @returns {*} + * + * @returns {*} * @memberof MapService */ identify(): IdentifyFeatures; /** * Returns a new L.esri.services.Find object that can be used to find features. Your callback function will be passed a GeoJSON FeatureCollection with the results or an error. - * - * @returns {*} + * + * @returns {*} * @memberof MapService */ find(): Find; /** * Returns a new L.esri.Query object that can be used to query this service. - * - * @returns {*} + * + * @returns {*} * @memberof MapService */ query(): Query; @@ -961,15 +954,15 @@ declare namespace L { /** * L.esri.MapService is an abstraction for interacting with Map Services running on ArcGIS Online and ArcGIS Server that allows you to make requests to the API, as well as query and identify published features. - * - * @param {MapServiceOptions} options - * @returns {MapService} + * + * @param {MapServiceOptions} options + * @returns {MapService} */ function mapService(options: MapServiceOptions): MapService; /** * Options for Task - * + * * @interface TaskOptions * @extends {ServiceOptions} */ @@ -977,7 +970,7 @@ declare namespace L { /** * L.esri.Task is a generic class that provides the foundation for calling operations on ArcGIS Online and ArcGIS Server Services like query, find and identify. - * + * * @class Task * @extends {L.Class} */ @@ -985,20 +978,20 @@ declare namespace L { constructor(options: TaskOptions | Service); /** * Makes a request to the associated service. The service's URL will be combined with the path option and parameters will be serialized. Accepts an optional function context for the callback. - * - * @param {string} url - * @param {*} params - * @param {*} callback - * @param {*} context - * @returns {this} + * + * @param {string} url + * @param {*} params + * @param {*} callback + * @param {*} context + * @returns {this} * @memberof Task */ request(url: string, params?: any, callback?: any, context?: any): this; /** * Adds a token to this request if the service requires authentication. Will be added automatically if used with a service. - * - * @param {string} token - * @returns {this} + * + * @param {string} token + * @returns {this} * @memberof Task */ token(token: string): this; @@ -1006,15 +999,15 @@ declare namespace L { /** * L.esri.Task is a generic class that provides the foundation for calling operations on ArcGIS Online and ArcGIS Server Services like query, find and identify. - * - * @param {(TaskOptions | Service)} options - * @returns {Task} + * + * @param {(TaskOptions | Service)} options + * @returns {Task} */ function task(options: TaskOptions | Service): Task; /** * Options for ImageService - * + * * @interface ImageServiceOptions * @extends {ServiceOptions} */ @@ -1022,7 +1015,7 @@ declare namespace L { /** * L.esri.ImageService is an abstraction for interacting with Image Services running on ArcGIS Online and ArcGIS Server that allows you to make requests to the API, as well as query and identify features on the service. - * + * * @class ImageService * @extends {Service} */ @@ -1030,8 +1023,8 @@ declare namespace L { constructor(options: ImageServiceOptions); /** * Returns a new L.esri.Query object that can be used to query this service. - * - * @returns {this} + * + * @returns {this} * @memberof ImageService */ query(): Query; @@ -1039,15 +1032,15 @@ declare namespace L { /** * L.esri.ImageService is an abstraction for interacting with Image Services running on ArcGIS Online and ArcGIS Server that allows you to make requests to the API, as well as query and identify features on the service. - * - * @param {ImageServiceOptions} options - * @returns {ImageService} + * + * @param {ImageServiceOptions} options + * @returns {ImageService} */ function imageService(options: ImageServiceOptions): ImageService; /** * Options for FeatureLayerService - * + * * @interface FeatureLayerServiceOptions * @extends {ServiceOptions} */ @@ -1055,7 +1048,7 @@ declare namespace L { /** * L.esri.FeatureLayerService is an abstraction for interacting with Feature Layers running on ArcGIS Online and ArcGIS Server that allows you to make requests to the API, as well as query, add, update and remove features from the service. - * + * * @class FeatureLayerService * @extends {Service} */ @@ -1063,8 +1056,8 @@ declare namespace L { constructor(options: FeatureLayerServiceOptions); /** * Returns a new L.esri.Query object that can be used to query this layer. - * - * @returns {this} + * + * @returns {this} * @memberof FeatureLayerService */ query(): Query; @@ -1072,11 +1065,11 @@ declare namespace L { * Adds a new feature to the feature layer. this also adds the feature to the map if creation is successful. * Requires authentication as a user who has permission to edit the service in ArcGIS Online or the user who created the service. * Requires the Create capability be enabled on the service. You can check if creation exists by checking the metadata of your service under capabilities. - * - * @param {GeoJSONFeature} feature - * @param {ResponseCallbackHandler} [callback] - * @param {*} context - * @returns {this} + * + * @param {GeoJSONFeature} feature + * @param {ResponseCallbackHandler} [callback] + * @param {*} context + * @returns {this} * @memberof FeatureLayerService */ // TODO: GeoJSONFeature @@ -1085,11 +1078,11 @@ declare namespace L { * Update the provided feature on the Feature Layer. This also updates the feature on the map. * Requires authentication as a user who has permission to edit the service in ArcGIS Online or the user who created the service. * Requires the Update capability be enabled on the service. You can check if this operation exists by checking the metadata of your service under capabilities. - * - * @param {GeoJSONFeature} feature - * @param {ResponseCallbackHandler} [callback] - * @param {*} context - * @returns {this} + * + * @param {GeoJSONFeature} feature + * @param {ResponseCallbackHandler} [callback] + * @param {*} context + * @returns {this} * @memberof FeatureLayerService */ // TODO: GeoJSONFeature @@ -1098,11 +1091,11 @@ declare namespace L { * Remove the feature with the provided id from the feature layer. This will also remove the feature from the map if it exists. * Requires authentication as a user who has permission to edit the service in ArcGIS Online or the user who created the service. * Requires the Delete capability be enabled on the service. You can check if this operation exists by checking the metadata of your service under capabilities. - * - * @param {(string | number)} id - * @param {ResponseCallbackHandler} [callback] - * @param {*} context - * @returns {this} + * + * @param {(string | number)} id + * @param {ResponseCallbackHandler} [callback] + * @param {*} context + * @returns {this} * @memberof FeatureLayerService */ deleteFeature(id: string | number, callback?: ResponseCallbackHandler, context?: any): this; @@ -1110,11 +1103,11 @@ declare namespace L { * Removes an array of features with the provided ids from the feature layer. This will also remove the features from the map if they exist. * Requires authentication as a user who has permission to edit the service in ArcGIS Online or the user who created the service. * Requires the Delete capability be enabled on the service. You can check if this operation exists by checking the metadata of your service under capabilities. - * - * @param {(Array)} ids - * @param {ResponseCallbackHandler} [callback] - * @param {*} context - * @returns {this} + * + * @param {(Array)} ids + * @param {ResponseCallbackHandler} [callback] + * @param {*} context + * @returns {this} * @memberof FeatureLayerService */ deleteFeatures(ids: string[] | number[], callback?: ResponseCallbackHandler, context?: any): this; @@ -1122,15 +1115,15 @@ declare namespace L { /** * L.esri.FeatureLayerService is an abstraction for interacting with Feature Layers running on ArcGIS Online and ArcGIS Server that allows you to make requests to the API, as well as query, add, update and remove features from the service. - * - * @param {FeatureLayerServiceOptions} options - * @returns {FeatureLayerService} + * + * @param {FeatureLayerServiceOptions} options + * @returns {FeatureLayerService} */ function featureLayerService(options: FeatureLayerServiceOptions): FeatureLayerService; /** * Options for Query - * + * * @interface QueryOptions * @extends {TaskOptions} */ @@ -1139,7 +1132,7 @@ declare namespace L { /** * L.esri.Query is an abstraction for the query API included in Feature Layers and Image Services. It provides a chainable API for building request parameters and executing queries. * Note Depending on the type of service you are querying (Feature Layer, Map Service, Image Service) and the version of ArcGIS Server that hosts the service some of these options may not be available. - * + * * @class Query * @extends {Task} */ @@ -1147,190 +1140,190 @@ declare namespace L { constructor(options: QueryOptions); /** * Queries features from the service within (fully contained by) the passed geometry object. geometry can be an instance of L.Marker, L.Polygon, L.Polyline, L.LatLng, L.LatLngBounds and L.GeoJSON. It can also accept valid GeoJSON Point, Polyline, Polygon objects and GeoJSON Feature objects containing Point, Polyline, Polygon. - * - * @param {Geometry} geometry - * @returns {this} + * + * @param {Geometry} geometry + * @returns {this} * @memberof Query */ within(geometry: Geometry): this; /** * Queries features from the service that fully contain the passed geometry object. geometry can be an instance of L.Marker, L.Polygon, L.Polyline, L.LatLng, L.LatLngBounds and L.GeoJSON. It can also accept valid GeoJSON Point, Polyline, Polygon objects and GeoJSON Feature objects containing Point, Polyline, Polygon. - * - * @param {Geometry} geometry - * @returns {this} + * + * @param {Geometry} geometry + * @returns {this} * @memberof Query */ contains(geometry: Geometry): this; /** * Queries features from the service that intersect (touch anywhere) the passed geometry object. geometry can be an instance of L.Marker, L.Polygon, L.Polyline, L.LatLng, L.LatLngBounds and L.GeoJSON. It can also accept valid GeoJSON Point, Polyline, Polygon objects and GeoJSON Feature objects containing Point, Polyline, Polygon. - * - * @param {Geometry} geometry - * @returns {this} + * + * @param {Geometry} geometry + * @returns {this} * @memberof Query */ intersects(geometry: Geometry): this; /** * Queries features from the service that have a bounding box that intersects the bounding box of the passed geometry object. geometry can be an instance of L.Marker, L.Polygon, L.Polyline, L.LatLng, L.LatLngBounds and L.GeoJSON. It can also accept valid GeoJSON Point, Polyline, Polygon objects and GeoJSON Feature objects containing Point, Polyline, Polygon. - * - * @param {Geometry} geometry - * @returns {this} + * + * @param {Geometry} geometry + * @returns {this} * @memberof Query */ bboxIntersects(geometry: Geometry): this; /** * Queries features from the service that overlap (touch but are not fully contained by) the passed geometry object. geometry can be an instance of L.Marker, L.Polygon, L.Polyline, L.LatLng, L.LatLngBounds and L.GeoJSON. It can also accept valid GeoJSON Point, Polyline, Polygon objects and GeoJSON Feature objects containing Point, Polyline, Polygon. - * - * @param {Geometry} geometry - * @returns {this} + * + * @param {Geometry} geometry + * @returns {this} * @memberof Query */ overlap(geometry: Geometry): this; /** - * Queries features a given distance in meters around a LatLng. + * Queries features a given distance in meters around a LatLng. * Only available for Feature Layers hosted on ArcGIS Online or ArcGIS Server 10.3 that include the capability supportQueryWithDistance. - * - * @param {L.LatLng} latlng - * @param {number} distance - * @returns {this} + * + * @param {L.LatLng} latlng + * @param {number} distance + * @returns {this} * @memberof Query */ nearby(latlng: L.LatLng, distance: number): this; /** * Adds a where clause to the query. String values should be denoted using single quotes ie: query.where("FIELDNAME = 'field value'"); More info about valid SQL can be found here. - * - * @param {string} where - * @returns {this} + * + * @param {string} where + * @returns {this} * @memberof Query */ where(where: string): this; /** - * Define the offset of the results, when combined with limit can be used for paging. + * Define the offset of the results, when combined with limit can be used for paging. * Only available for Feature Layers hosted on ArcGIS Online or ArcGIS Server 10.3. - * - * @param {number} offset - * @returns {this} + * + * @param {number} offset + * @returns {this} * @memberof Query */ offset(offset: number): this; /** - * Limit the number of results returned by this query, when combined with offset can be used for paging. + * Limit the number of results returned by this query, when combined with offset can be used for paging. * Only available for Feature Layers hosted on ArcGIS Online or ArcGIS Server 10.3. - * - * @param {number} limit - * @returns {this} + * + * @param {number} limit + * @returns {this} * @memberof Query */ limit(limit: number): this; /** * Queries features within a given time range. Only available for Layers/Services with timeInfo in their metadata. - * - * @param {Date} from - * @param {Date} to - * @returns {this} + * + * @param {Date} from + * @param {Date} to + * @returns {this} * @memberof Query */ between(from: Date, to: Date): this; /** * An array of associated fields to request for each feature. - * - * @param {(string | Array)} fields - * @returns {this} + * + * @param {(string | Array)} fields + * @returns {this} * @memberof Query */ fields(fields: string | string[]): this; /** * Return geometry with results. Default is true. - * - * @param {boolean} returnGeometry - * @returns {this} + * + * @param {boolean} returnGeometry + * @returns {this} * @memberof Query */ returnGeometry(returnGeometry: boolean): this; /** * Simplify the geometries of the output features for the current map view. the factor parameter controls the amount of simplification between 0 (no simplification) and 1 (the most basic shape possible). - * - * @param {L.Map} map - * @param {number} factor - * @returns {this} + * + * @param {L.Map} map + * @param {number} factor + * @returns {this} * @memberof Query */ simplify(map: L.Map, factor: number): this; /** * Sort output features using values from an individual field. "ASC" (ascending) is the default sort order, but "DESC" can be passed as an alternative. This method can be called more than once to apply advanced sorting. - * - * @param {string} fieldName - * @param {string} order - * @returns {this} + * + * @param {string} fieldName + * @param {string} order + * @returns {this} * @memberof Query */ orderBy(fieldName: string, order: string): this; /** * Return only specific feature IDs if they match other query parameters. - * - * @param {Array} ids - * @returns {this} + * + * @param {Array} ids + * @returns {this} * @memberof Query */ featureIds(ids: any[]): this; /** * Return only this many decimal points of precision in the output geometries. - * - * @param {number} precision - * @returns {this} + * + * @param {number} precision + * @returns {this} * @memberof Query */ precision(precision: number): this; /** - * Used to select which layer inside a Map Service to perform the query on. + * Used to select which layer inside a Map Service to perform the query on. * Only available for Map Services. - * - * @param {(number | string)} layer - * @returns {this} + * + * @param {(number | string)} layer + * @returns {this} * @memberof Query */ layer(layer: number | string): this; /** - * Override the default pixelSize when querying an Image Service. + * Override the default pixelSize when querying an Image Service. * Only available for Image Services. - * - * @param {L.Point} point - * @returns {this} + * + * @param {L.Point} point + * @returns {this} * @memberof Query */ pixelSize(point: L.Point): this; /** * Exectues the query request with the current parameters, features will be passed to callback as a GeoJSON FeatureCollection. Accepts an optional function context. - * - * @param {FeatureCallbackHandler} callback - * @param {*} [context] - * @returns {this} + * + * @param {FeatureCallbackHandler} callback + * @param {*} [context] + * @returns {this} * @memberof Query */ run(callback: FeatureCallbackHandler, context?: any): this; /** * Exectues the query request with the current parameters, passing only the number of features matching the query to callback as an Integer. Accepts an optional function context. - * - * @param {FeatureCallbackHandler} callback - * @param {*} [context] - * @returns {this} + * + * @param {FeatureCallbackHandler} callback + * @param {*} [context] + * @returns {this} * @memberof Query */ count(callback: FeatureCallbackHandler, context?: any): this; /** * Exectues the query request with the current parameters, passing only an array of the feature ids matching the query to callbackcallback. Accepts an optional function context. - * - * @param {FeatureCallbackHandler} callback - * @param {*} [context] - * @returns {this} + * + * @param {FeatureCallbackHandler} callback + * @param {*} [context] + * @returns {this} * @memberof Query */ ids(callback: FeatureCallbackHandler, context?: any): this; /** * Executes the query request with the current parameters, passing only the LatLngBounds of all features matching the query in the callback. Accepts an optional function context. Only available for Feature Layers hosted on ArcGIS Online or ArcGIS Server 10.3.1. - * - * @param {FeatureCallbackHandler} callback - * @param {*} [context] - * @returns {this} + * + * @param {FeatureCallbackHandler} callback + * @param {*} [context] + * @returns {this} * @memberof Query */ bounds(callback: FeatureCallbackHandler, context?: any): this; @@ -1339,15 +1332,15 @@ declare namespace L { /** * L.esri.Query is an abstraction for the query API included in Feature Layers and Image Services. It provides a chainable API for building request parameters and executing queries. * Note Depending on the type of service you are querying (Feature Layer, Map Service, Image Service) and the version of ArcGIS Server that hosts the service some of these options may not be available. - * - * @param {QueryOptions} options - * @returns {Query} + * + * @param {QueryOptions} options + * @returns {Query} */ function query(options: QueryOptions): Query; /** * Options for IdentifyFeatures - * + * * @interface IdentifyFeaturesOptions * @extends {ServiceOptions} */ @@ -1355,7 +1348,7 @@ declare namespace L { /** * L.esri.IdentifyFeatures is an abstraction for the Identify API found in Map Services. It provides a chainable API for building request parameters and executing the request. - * + * * @class IdentifyFeatures * @extends {Task} */ @@ -1363,86 +1356,86 @@ declare namespace L { constructor(options: IdentifyFeaturesOptions | ImageService); /** * The map to identify features on. - * - * @param {L.Map} map - * @returns {this} + * + * @param {L.Map} map + * @returns {this} * @memberof IdentifyFeatures */ on(map: L.Map): this; /** - * Identifies feautres at a given - * - * @param {LatLngExpression} latlng - * @returns {this} + * Identifies feautres at a given + * + * @param {LatLngExpression} latlng + * @returns {this} * @memberof IdentifyFeatures */ at(latlng: LatLngExpression): this; /** * Add a layer definition to the query. - * - * @param {number} id - * @param {string} where - * @returns {this} + * + * @param {number} id + * @param {string} where + * @returns {this} * @memberof IdentifyFeatures */ layerDef(id: number, where: string): this; /** * Identifies features within a given time range. - * - * @param {Date} from - * @param {Date} to - * @returns {this} + * + * @param {Date} from + * @param {Date} to + * @returns {this} * @memberof IdentifyFeatures */ between(from: Date, to: Date): this; /** * By default, only the topmost feature will be identified, but it is possible to specify both an alternative strategy and array of individual layers. See the REST API documentation for more information about valid combinations. * ex: .layers('all:0'). - * - * @param {string} layers - * @returns {this} + * + * @param {string} layers + * @returns {this} * @memberof IdentifyFeatures */ layers(layers: string | string[]): this; /** * Return only this many decimal points of precision in the output geometries. - * - * @param {number} precision - * @returns {this} + * + * @param {number} precision + * @returns {this} * @memberof IdentifyFeatures */ precision(precision: number): this; /** * Buffer the identify area by a given number of screen pixels. - * - * @param {number} precision - * @returns {this} + * + * @param {number} precision + * @returns {this} * @memberof IdentifyFeatures */ tolerance(precision: number): this; /** * Return geometry with results. Default is true. - * - * @param {boolean} returnGeometry - * @returns {this} + * + * @param {boolean} returnGeometry + * @returns {this} * @memberof IdentifyFeatures */ returnGeometry(returnGeometry: boolean): this; /** * Simplify the geometries of the output features for the current map view. the factor parameter controls the amount of simplification between 0 (no simplification) and 1 (the most basic shape possible). - * - * @param {L.Map} map - * @param {number} factor - * @returns {this} + * + * @param {L.Map} map + * @param {number} factor + * @returns {this} * @memberof IdentifyFeatures */ simplify(map: L.Map, factor: number): this; /** * Executes the identify request with the current parameters, identified features will be passed to callback as a GeoJSON FeatureCollection. Accepts an optional function context - * - * @param {FeatureCallbackHandler} callback - * @param {*} context - * @returns {this} + * + * @param {FeatureCallbackHandler} callback + * @param {*} context + * @returns {this} * @memberof IdentifyFeatures */ run(callback: FeatureCallbackHandler, context?: any): this; @@ -1450,15 +1443,15 @@ declare namespace L { /** * L.esri.IdentifyFeatures is an abstraction for the Identify API found in Map Services. It provides a chainable API for building request parameters and executing the request. - * - * @param {(IdentifyFeaturesOptions | ImageService)} options - * @returns {IdentifyFeatures} + * + * @param {(IdentifyFeaturesOptions | ImageService)} options + * @returns {IdentifyFeatures} */ function identifyFeatures(options: IdentifyFeaturesOptions | ImageService): IdentifyFeatures; /** * Options for Find Task - * + * * @interface FindOptions * @extends {ServiceOptions} */ @@ -1466,7 +1459,7 @@ declare namespace L { /** * L.esri.Find is an abstraction for the find API included in Map Services. It provides a chainable API for building request parameters and executing find tasks. - * + * * @class Find * @extends {Task} */ @@ -1474,126 +1467,126 @@ declare namespace L { constructor(options: FindOptions | MapService); /** * Text that is searched across the layers and fields the user specifies. - * - * @param {string} text - * @returns {this} + * + * @param {string} text + * @returns {this} * @memberof Find */ text(text: string): this; /** * When true find task will search for a value that contains the searchText. When false it will do an exact match on the searchText string. Default is true. - * - * @param {boolean} contains - * @returns {this} + * + * @param {boolean} contains + * @returns {this} * @memberof Find */ contains(contains: boolean): this; /** * An array or comma-separated list of field names to search. If not specified, all fields are searched. - * - * @param {(string | Array)} fields - * @returns {this} + * + * @param {(string | Array)} fields + * @returns {this} * @memberof Find */ fields(fields: string | string[]): this; /** * The well known ID (ex. 4326) for the results. - * - * @param {number} sr - * @returns {this} + * + * @param {number} sr + * @returns {this} * @memberof Find */ spatialReference(sr: number): this; /** * Add a layer definition to the find task. - * - * @param {number} id - * @param {string} where - * @returns {this} + * + * @param {number} id + * @param {string} where + * @returns {this} * @memberof Find */ - layerDef(id: number, where: string): this; + layerDef(id: number, where: string): this; /** * Layers to perform find task on. Accepts an array of layer IDs or comma-separated list. - * - * @param {(string | Array)} layers - * @returns {this} + * + * @param {(string | Array)} layers + * @returns {this} * @memberof Find */ layers(layers: string | string[]): this; /** * Return geometry with results. Default is true. - * - * @param {boolean} returnGeometry - * @returns {this} + * + * @param {boolean} returnGeometry + * @returns {this} * @memberof Find */ returnGeometry(returnGeometry: boolean): this; /** * Specifies the maximum allowable offset to be used for generalizing geometries returned by the find task. - * - * @param {number} maxAllowableOffset - * @returns {this} + * + * @param {number} maxAllowableOffset + * @returns {this} * @memberof Find */ maxAllowableOffset(maxAllowableOffset: number): this; /** * Specifies the number of decimal places in returned geometries. - * - * @param {number} precision - * @returns {this} + * + * @param {number} precision + * @returns {this} * @memberof Find */ precision(precision: number): this; /** * Include Z values in the results. Default value is true. This parameter only applies if returnGeometry=true. - * - * @param {boolean} returnZ - * @returns {this} + * + * @param {boolean} returnZ + * @returns {this} * @memberof Find */ returnZ(returnZ: boolean): this; /** * Includes M values if the features have them. Default value is false. This parameter only applies if returnGeometry=true. - * - * @param {boolean} returnM - * @returns {this} + * + * @param {boolean} returnM + * @returns {this} * @memberof Find */ returnM(returnM: boolean): this; /** * Property used for adding new layers or modifying the data source of existing ones in the current map service. - * - * @param {*} dynamicLayers - * @returns {this} + * + * @param {*} dynamicLayers + * @returns {this} * @memberof Find */ dynamicLayers(dynamicLayers: any): this; /** * Simplify the geometries of the output features for the current map view. the factor parameter controls the amount of simplification between 0 (no simplification) and 1 (simplify to the most basic shape possible). - * - * @param {L.Map} map - * @param {number} factor - * @returns {this} + * + * @param {L.Map} map + * @param {number} factor + * @returns {this} * @memberof Find */ - simplify(map: L.Map, factor: number): this; + simplify(map: L.Map, factor: number): this; /** * Exectues the find request with the current parameters, features will be passed to callback as a GeoJSON FeatureCollection. Accepts an optional function context. - * - * @param {FeatureCallbackHandler} callback - * @param {*} [context] - * @returns {this} + * + * @param {FeatureCallbackHandler} callback + * @param {*} [context] + * @returns {this} * @memberof Find */ - run(callback: FeatureCallbackHandler, context?: any): this; + run(callback: FeatureCallbackHandler, context?: any): this; } /** * L.esri.Find is an abstraction for the find API included in Map Services. It provides a chainable API for building request parameters and executing find tasks. - * - * @param {(FindOptions | MapService)} options - * @returns {Find} + * + * @param {(FindOptions | MapService)} options + * @returns {Find} */ function find(options: FindOptions | MapService): Find; } diff --git a/types/esri-leaflet/tslint.json b/types/esri-leaflet/tslint.json index 3db14f85ea..06265672fc 100644 --- a/types/esri-leaflet/tslint.json +++ b/types/esri-leaflet/tslint.json @@ -1 +1,12 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // All are TODOs + "prefer-method-signature": false, + "max-line-length": false, + "no-empty-interface": false, + "no-mergeable-namespace": false, + "no-single-declare-module": false, + "no-unnecessary-qualifier": false + } +} diff --git a/types/ethjs-signer/ethjs-signer-tests.ts b/types/ethjs-signer/ethjs-signer-tests.ts index 7f6939fc3b..8f7499f571 100644 --- a/types/ethjs-signer/ethjs-signer-tests.ts +++ b/types/ethjs-signer/ethjs-signer-tests.ts @@ -10,7 +10,7 @@ const transaction = { nonce }; -const signedTransactionString = sign(transaction, privateKey) as string; -const signedTransaction = sign(transaction, privateKey, true) as any[]; +const signedTransactionString: string = sign(transaction, privateKey); +const signedTransaction: any[] = sign(transaction, privateKey, true); const publicKey = recover(signedTransactionString, -1, signedTransaction[7], signedTransaction[8]); diff --git a/types/eureka-js-client/eureka-js-client-tests.ts b/types/eureka-js-client/eureka-js-client-tests.ts index 1eb2a510d5..109dab0278 100644 --- a/types/eureka-js-client/eureka-js-client-tests.ts +++ b/types/eureka-js-client/eureka-js-client-tests.ts @@ -1,7 +1,7 @@ import { Eureka } from 'eureka-js-client'; // example configuration -let client = new Eureka({ +const client = new Eureka({ // application instance information instance: { app: 'jqservice', diff --git a/types/execa/tslint.json b/types/execa/tslint.json index 3db14f85ea..5281feceb3 100644 --- a/types/execa/tslint.json +++ b/types/execa/tslint.json @@ -1 +1,8 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // All are TODOs + "await-promise": false, + "no-boolean-literal-compare": false + } +} diff --git a/types/express-enforces-ssl/express-enforces-ssl-tests.ts b/types/express-enforces-ssl/express-enforces-ssl-tests.ts index 50dab42cdf..ccaac78ef6 100644 --- a/types/express-enforces-ssl/express-enforces-ssl-tests.ts +++ b/types/express-enforces-ssl/express-enforces-ssl-tests.ts @@ -1,6 +1,6 @@ import express = require('express'); import expressEnforcesSsl = require('express-enforces-ssl'); -let app: express.Express = express(); +const app: express.Express = express(); app.use(expressEnforcesSsl()); diff --git a/types/express-sanitized/express-sanitized-tests.ts b/types/express-sanitized/express-sanitized-tests.ts index 19c7039fee..1610ef6c91 100644 --- a/types/express-sanitized/express-sanitized-tests.ts +++ b/types/express-sanitized/express-sanitized-tests.ts @@ -1,6 +1,6 @@ import * as express from "express"; import * as expressSanitized from "express-sanitized"; -let RoutingServer: express.Express = express(); +const RoutingServer: express.Express = express(); RoutingServer.use(expressSanitized()); diff --git a/types/express-session/express-session-tests.ts b/types/express-session/express-session-tests.ts index 4ee9a76a6e..e348086a72 100644 --- a/types/express-session/express-session-tests.ts +++ b/types/express-session/express-session-tests.ts @@ -1,7 +1,7 @@ import express = require('express'); import session = require('express-session'); -let app = express(); +const app = express(); app.use(session({ secret: 'keyboard cat', @@ -25,7 +25,7 @@ interface MySession extends Express.Session { } app.use((req, res, next) => { - let sess = req.session as MySession; + const sess = req.session as MySession; if (sess.views) { sess.views++; res.setHeader('Content-Type', 'text/html'); diff --git a/types/express-session/index.d.ts b/types/express-session/index.d.ts index 60dedea20a..ac7ea271f9 100644 --- a/types/express-session/index.d.ts +++ b/types/express-session/index.d.ts @@ -2,7 +2,7 @@ // Project: https://www.npmjs.org/package/express-session // Definitions by: Hiroki Horiuchi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Definitions by: Jacob Bogers diff --git a/types/file-type/index.d.ts b/types/file-type/index.d.ts index 95217430eb..a3de4e99e8 100644 --- a/types/file-type/index.d.ts +++ b/types/file-type/index.d.ts @@ -1,7 +1,7 @@ // Type definitions for file-type 5.2 // Project: https://github.com/sindresorhus/file-type -// Definitions by: KIM Jaesuck a.k.a. gim tcaesvk -// BendingBender +// Definitions by: KIM Jaesuck a.k.a. gim tcaesvk +// BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/fingerprintjs2/fingerprintjs2-tests.ts b/types/fingerprintjs2/fingerprintjs2-tests.ts index 88cc9f337a..172dc1b801 100644 --- a/types/fingerprintjs2/fingerprintjs2-tests.ts +++ b/types/fingerprintjs2/fingerprintjs2-tests.ts @@ -3,121 +3,121 @@ function defaultCallback(result: string, components: [{ key: string, value: stri } function test_default_settings() { - let fingerprint = new Fingerprint2().get( defaultCallback); + const fingerprint = new Fingerprint2().get( defaultCallback); } function test_get_exclude_swfContainerId() { - let fingerprint = new Fingerprint2({ swfContainerId: 'swfContainerId' }).get(defaultCallback); + const fingerprint = new Fingerprint2({ swfContainerId: 'swfContainerId' }).get(defaultCallback); } function test_get_exclude_swfPath() { - let fingerprint = new Fingerprint2({swfPath: 'pathToSwf'}).get(defaultCallback); + const fingerprint = new Fingerprint2({swfPath: 'pathToSwf'}).get(defaultCallback); } function test_get_exclude_userDefinedFonts() { - let fingerprint = new Fingerprint2({ userDefinedFonts: ['font1', 'font2']}).get(defaultCallback); + const fingerprint = new Fingerprint2({ userDefinedFonts: ['font1', 'font2']}).get(defaultCallback); } function test_get_excludeUserAgent() { - let fingerprint = new Fingerprint2({ excludeUserAgent: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeUserAgent: true }).get(defaultCallback); } function test_get_excludeLanguage() { - let fingerprint = new Fingerprint2({ excludeLanguage: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeLanguage: true }).get(defaultCallback); } function test_get_excludeColorDepth() { - let fingerprint = new Fingerprint2({ excludeColorDepth: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeColorDepth: true }).get(defaultCallback); } function test_get_excludeScreenResolution() { - let fingerprint = new Fingerprint2({ excludeScreenResolution: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeScreenResolution: true }).get(defaultCallback); } function test_get_excludeTimezoneOffset() { - let fingerprint = new Fingerprint2({ excludeTimezoneOffset: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeTimezoneOffset: true }).get(defaultCallback); } function test_get_excludeSessionStorage() { - let fingerprint = new Fingerprint2({ excludeSessionStorage: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeSessionStorage: true }).get(defaultCallback); } function test_get_excludeIndexedDB() { - let fingerprint = new Fingerprint2({ excludeIndexedDB: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeIndexedDB: true }).get(defaultCallback); } function test_get_excludeAddBehavior() { - let fingerprint = new Fingerprint2({ excludeAddBehavior: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeAddBehavior: true }).get(defaultCallback); } function test_get_excludeOpenDatabase() { - let fingerprint = new Fingerprint2({ excludeOpenDatabase: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeOpenDatabase: true }).get(defaultCallback); } function test_get_excludeCpuClass() { - let fingerprint = new Fingerprint2({ excludeCpuClass: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeCpuClass: true }).get(defaultCallback); } function test_get_excludePlatform() { - let fingerprint = new Fingerprint2({ excludePlatform: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludePlatform: true }).get(defaultCallback); } function test_get_excludeDoNotTrack() { - let fingerprint = new Fingerprint2({ excludeDoNotTrack: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeDoNotTrack: true }).get(defaultCallback); } function test_get_excludeCanvas() { - let fingerprint = new Fingerprint2({ excludeCanvas: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeCanvas: true }).get(defaultCallback); } function test_get_excludeWebGL() { - let fingerprint = new Fingerprint2({ excludeWebGL: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeWebGL: true }).get(defaultCallback); } function test_get_excludeAdBlock() { - let fingerprint = new Fingerprint2({ excludeAdBlock: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeAdBlock: true }).get(defaultCallback); } function test_get_excludeHasLiedLanguages() { - let fingerprint = new Fingerprint2({ excludeHasLiedLanguages: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeHasLiedLanguages: true }).get(defaultCallback); } function test_get_excludeHasLiedResolution() { - let fingerprint = new Fingerprint2({ excludeHasLiedResolution: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeHasLiedResolution: true }).get(defaultCallback); } function test_get_excludeHasLiedOs() { - let fingerprint = new Fingerprint2({ excludeHasLiedOs: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeHasLiedOs: true }).get(defaultCallback); } function test_get_excludeHasLiedBrowser() { - let fingerprint = new Fingerprint2({ excludeHasLiedBrowser: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeHasLiedBrowser: true }).get(defaultCallback); } function test_get_excludeJsFonts() { - let fingerprint = new Fingerprint2({ excludeJsFonts: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeJsFonts: true }).get(defaultCallback); } function test_get_excludeFlashFonts() { - let fingerprint = new Fingerprint2({ excludeFlashFonts: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeFlashFonts: true }).get(defaultCallback); } function test_get_excludePlugins() { - let fingerprint = new Fingerprint2({ excludePlugins: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludePlugins: true }).get(defaultCallback); } function test_get_excludeIEPlugins() { - let fingerprint = new Fingerprint2({ excludeIEPlugins: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeIEPlugins: true }).get(defaultCallback); } function test_get_excludeTouchSupport() { - let fingerprint = new Fingerprint2({ excludeTouchSupport: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeTouchSupport: true }).get(defaultCallback); } function test_get_excludePixelRatio() { - let fingerprint = new Fingerprint2({ excludePixelRatio: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludePixelRatio: true }).get(defaultCallback); } function test_get_excludeHardwareConcurrency() { - let fingerprint = new Fingerprint2({ excludeHardwareConcurrency: true }).get(defaultCallback); + const fingerprint = new Fingerprint2({ excludeHardwareConcurrency: true }).get(defaultCallback); } diff --git a/types/firebase/firebase-simplelogin.d.ts b/types/firebase/firebase-simplelogin.d.ts index b64638bd34..c03702502d 100644 --- a/types/firebase/firebase-simplelogin.d.ts +++ b/types/firebase/firebase-simplelogin.d.ts @@ -1,6 +1,6 @@ // Type definitions for Firebase Simple Login // Project: https://www.firebase.com/docs/security/simple-login-overview.html -// Definitions by: Wilker Lucio +// Definitions by: Wilker Lucio // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/firebird/firebird-tests.ts b/types/firebird/firebird-tests.ts index 4a6bd59c05..96600a7f2d 100644 --- a/types/firebird/firebird-tests.ts +++ b/types/firebird/firebird-tests.ts @@ -32,13 +32,13 @@ if (con.inTransaction === true) { console.log('in transaction'); } -let blob: fb.FBBlob = con.newBlobSync(); +const blob: fb.FBBlob = con.newBlobSync(); -let tx: fb.Transaction = con.startNewTransactionSync(); +const tx: fb.Transaction = con.startNewTransactionSync(); con.startNewTransaction((err: Error | null, tx: fb.Transaction) => {}); /* DataType */ -let column: fb.DataType = {}; +const column: fb.DataType = {}; if (typeof (column) === "number") { column * 10; } else if (typeof (column) === "string") { @@ -46,7 +46,7 @@ if (typeof (column) === "number") { } else if (column instanceof Date) { column.toISOString(); } else { - let _: fb.FBBlob = column; + const _: fb.FBBlob = column; } /* FBResult */ @@ -87,7 +87,7 @@ if (tx.inTransaction === true) { } /* FBStatement */ -let asFBResult: fb.FBResult = stmt; +const asFBResult: fb.FBResult = stmt; stmt.execSync("John"); stmt.execSync(1, "Mary"); stmt.execInTransSync(tx, "John"); @@ -102,8 +102,8 @@ blob._openSync(); blob._closeSync(); -let buffer: Buffer = {}; -let readBytes: number = blob._readSync(buffer); +const buffer: Buffer = {}; +const readBytes: number = blob._readSync(buffer); blob._read(buffer, (err: Error | null, buffer: Buffer, len: number) => {}); blob._readAll(); @@ -119,4 +119,4 @@ blob._write(buffer, 10); blob._write(buffer, 10, (err: Error | null) => {}); /* Stream */ -let strm: NodeJS.ReadWriteStream = new fb.Stream(blob); +const strm: NodeJS.ReadWriteStream = new fb.Stream(blob); diff --git a/types/firebird/index.d.ts b/types/firebird/index.d.ts index 6506762408..ad1093ef55 100644 --- a/types/firebird/index.d.ts +++ b/types/firebird/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for firebird 0.1 // Project: https://github.com/xdenser/node-firebird-libfbclient -// Definitions by: Yasushi Kato +// Definitions by: Yasushi Kato // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 diff --git a/types/firebird/tslint.json b/types/firebird/tslint.json index 3db14f85ea..b63c1c3846 100644 --- a/types/firebird/tslint.json +++ b/types/firebird/tslint.json @@ -1 +1,7 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + // TODO + "no-boolean-literal-compare": false + } +} diff --git a/types/flatbuffers/flatbuffers-tests.ts b/types/flatbuffers/flatbuffers-tests.ts index cdcabac25b..493773fdcf 100644 --- a/types/flatbuffers/flatbuffers-tests.ts +++ b/types/flatbuffers/flatbuffers-tests.ts @@ -16,7 +16,7 @@ enum Any { class Monster2 { bb: flatbuffers.ByteBuffer= null; - bb_pos: number = 0; + bb_pos = 0; __init(i: number, bb: flatbuffers.ByteBuffer): Monster2 { this.bb_pos = i; @@ -41,7 +41,7 @@ class Monster2 { class Test { bb: flatbuffers.ByteBuffer = null; - bb_pos: number = 0; + bb_pos = 0; __init(i: number, bb: flatbuffers.ByteBuffer): Test { this.bb_pos = i; @@ -91,7 +91,7 @@ class Test { class TestSimpleTableWithEnum { bb: flatbuffers.ByteBuffer= null; - bb_pos: number = 0; + bb_pos = 0; __init(i: number, bb: flatbuffers.ByteBuffer): TestSimpleTableWithEnum { this.bb_pos = i; @@ -136,7 +136,7 @@ class TestSimpleTableWithEnum { class Vec3 { bb: flatbuffers.ByteBuffer= null; - bb_pos: number = 0; + bb_pos = 0; __init(i: number, bb: flatbuffers.ByteBuffer): Vec3 { this.bb_pos = i; @@ -244,7 +244,7 @@ class Vec3 { class Stat { bb: flatbuffers.ByteBuffer= null; - bb_pos: number = 0; + bb_pos = 0; __init(i: number, bb: flatbuffers.ByteBuffer): Stat { this.bb_pos = i; @@ -307,7 +307,7 @@ class Stat { class Monster { bb: flatbuffers.ByteBuffer= null; - bb_pos: number = 0; + bb_pos = 0; __init(i: number, bb: flatbuffers.ByteBuffer): Monster { this.bb_pos = i; diff --git a/types/fluent-ffmpeg/index.d.ts b/types/fluent-ffmpeg/index.d.ts index 86004caec1..7a660d1767 100644 --- a/types/fluent-ffmpeg/index.d.ts +++ b/types/fluent-ffmpeg/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for node-fluent-ffmpeg 2.1 // Project: https://github.com/fluent-ffmpeg/node-fluent-ffmpeg -// Definitions by: KIM Jaesuck a.k.a. gim tcaesvk , DingWeizhe +// Definitions by: KIM Jaesuck a.k.a. gim tcaesvk , DingWeizhe // Definitions: https://github.com/DefinitelyType/DefinitelyTyped /// diff --git a/types/flux/test/Flux.ts b/types/flux/test/Flux.ts index 6666b830aa..0619a1c63e 100644 --- a/types/flux/test/Flux.ts +++ b/types/flux/test/Flux.ts @@ -17,9 +17,9 @@ interface Action { } function dispatcherCallback(payload: Action) { - let source: ActionSource = payload.source; - let type: ActionType = payload.type; - let data: {} = payload.data; + const source: ActionSource = payload.source; + const type: ActionType = payload.type; + const data: {} = payload.data; } let dispatcherIsDispatching: boolean; diff --git a/types/flux/test/FluxUtils.tsx b/types/flux/test/FluxUtils.tsx index 38e06e71e4..0619be57b6 100644 --- a/types/flux/test/FluxUtils.tsx +++ b/types/flux/test/FluxUtils.tsx @@ -42,8 +42,6 @@ class CounterContainer extends React.Component { return [Store]; } - static a: string = "asd"; - static calculateState(prevState: State, props: Props): State { return { counter: Store.getState() - (props.b ? 0 : 1) diff --git a/types/forwarded/forwarded-tests.ts b/types/forwarded/forwarded-tests.ts new file mode 100644 index 0000000000..a0ae446993 --- /dev/null +++ b/types/forwarded/forwarded-tests.ts @@ -0,0 +1,7 @@ +import forwarded = require('forwarded'); +import * as http from 'http'; + +http.createServer((req) => { + // $ExpectType string[] + forwarded(req); +}); diff --git a/types/forwarded/index.d.ts b/types/forwarded/index.d.ts new file mode 100644 index 0000000000..0214731de9 --- /dev/null +++ b/types/forwarded/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for forwarded 0.1 +// Project: https://github.com/jshttp/forwarded +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +import { IncomingMessage } from 'http'; + +export = forwarded; + +declare function forwarded(req: IncomingMessage): string[]; diff --git a/types/forwarded/tsconfig.json b/types/forwarded/tsconfig.json new file mode 100644 index 0000000000..9df0387d33 --- /dev/null +++ b/types/forwarded/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", + "forwarded-tests.ts" + ] +} diff --git a/types/forwarded/tslint.json b/types/forwarded/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/forwarded/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/fpsmeter/index.d.ts b/types/fpsmeter/index.d.ts index 314a50861d..25bc6296d2 100644 --- a/types/fpsmeter/index.d.ts +++ b/types/fpsmeter/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for FPSmeter v0.3.0 // Project: http://darsa.in/fpsmeter/ -// Definitions by: Aaron Lampros +// Definitions by: Aaron Lampros // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface FPSMeterOptions { diff --git a/types/framebus/framebus-tests.ts b/types/framebus/framebus-tests.ts index acd8f1ff2f..e37186d168 100644 --- a/types/framebus/framebus-tests.ts +++ b/types/framebus/framebus-tests.ts @@ -1,14 +1,14 @@ import * as framebus from "framebus"; -let popup = window.open('https://example.com'); +const popup = window.open('https://example.com'); framebus.include(popup); framebus.emit('hello popup and friends!'); framebus.target('https://example.com').on('my cool event', () => {}); -let callback = (data: any) => { +function callback(data: any) { console.log('Got back %s as a reply!', data); -}; +} framebus.publish('Marco!', callback, 'http://listener.example.com'); diff --git a/types/fs-extra-promise-es6/fs-extra-promise-es6-tests.ts b/types/fs-extra-promise-es6/fs-extra-promise-es6-tests.ts index b17cb07e32..337dd1ca0f 100644 --- a/types/fs-extra-promise-es6/fs-extra-promise-es6-tests.ts +++ b/types/fs-extra-promise-es6/fs-extra-promise-es6-tests.ts @@ -6,41 +6,41 @@ let str: string; let strArr: string[]; let bool: boolean; let num: number; -let src: string; -let dest: string; -let file: string; -let filename: string; -let dir: string; -let path: string; -let data: any; -let object: any; +declare const src: string; +declare const dest: string; +declare const file: string; +declare const filename: string; +declare const dir: string; +declare const path: string; +declare const data: any; +declare const object: any; let buffer: NodeBuffer; -let modeNum: number; -let modeStr: string; -let encoding: string; -let type: string; -let flags: string; -let srcpath: string; -let dstpath: string; -let oldPath: string; -let newPath: string; -let cache: string; -let offset: number; -let length: number; -let position: number; -let cacheBool: boolean; -let cacheStr: string; -let fd: number; -let len: number; -let uid: number; -let gid: number; -let atime: number; -let mtime: number; -let statsCallback: (err: Error, stats: fs.Stats) => void; -let errorCallback: (err: Error) => void; -let openOpts: fs.OpenOptions; +declare const modeNum: number; +declare const modeStr: string; +declare const encoding: string; +declare const type: string; +declare const flags: string; +declare const srcpath: string; +declare const dstpath: string; +declare const oldPath: string; +declare const newPath: string; +declare const cache: string; +declare const offset: number; +declare const length: number; +declare const position: number; +declare const cacheBool: boolean; +declare const cacheStr: string; +declare const fd: number; +declare const len: number; +declare const uid: number; +declare const gid: number; +declare const atime: number; +declare const mtime: number; +declare const statsCallback: (err: Error, stats: fs.Stats) => void; +declare const errorCallback: (err: Error) => void; +declare const openOpts: fs.OpenOptions; let watcher: fs.FSWatcher; -let readStreeam: stream.Readable; +let readStream: stream.Readable; let writeStream: stream.Writable; let isDirectory: boolean; @@ -198,8 +198,8 @@ fs.exists(path, (exists: boolean) => { }); bool = fs.existsSync(path); -readStreeam = fs.createReadStream(path); -readStreeam = fs.createReadStream(path, { +readStream = fs.createReadStream(path); +readStream = fs.createReadStream(path, { flags: str, encoding: str, fd: num, @@ -211,8 +211,7 @@ writeStream = fs.createWriteStream(path, { encoding: str }); -let isDirectoryCallback = (err: Error, isDirectory: boolean) => { -}; +function isDirectoryCallback(err: Error, isDirectory: boolean) {} fs.isDirectory(path, isDirectoryCallback); fs.isDirectory(path); isDirectory = fs.isDirectorySync(path); diff --git a/types/fs-extra-promise/fs-extra-promise-tests.ts b/types/fs-extra-promise/fs-extra-promise-tests.ts index 30794946f3..719bb65e6f 100644 --- a/types/fs-extra-promise/fs-extra-promise-tests.ts +++ b/types/fs-extra-promise/fs-extra-promise-tests.ts @@ -6,41 +6,41 @@ let str: string; let strArr: string[]; let bool: boolean; let num: number; -let src: string; -let dest: string; -let file: string; -let filename: string; -let dir: string; -let path: string; -let data: any; -let object: object; -let buf: Buffer; +declare const src: string; +declare const dest: string; +declare const file: string; +declare const filename: string; +declare const dir: string; +declare const path: string; +declare const data: any; +declare const object: object; +declare const buf: Buffer; let strOrBuf: string | Buffer; let buffer: NodeBuffer; -let modeNum: number; -let modeStr: string; -let encoding: string; -let type: string; -let flags: string; -let srcpath: string; -let dstpath: string; -let oldPath: string; -let newPath: string; -let cache: { [path: string]: string; }; -let offset: number; -let length: number; -let position: number; -let fd: number; -let len: number; -let uid: number; -let gid: number; -let atime: number; -let mtime: number; -let watchListener: (curr: fs.Stats, prev: fs.Stats) => void; -let statsCallback: (err: Error, stats: fs.Stats) => void; -let errorCallback: (err: Error) => void; -let openOpts: fs.ReadOptions; -let writeOpts: fs.WriteOptions; +declare const modeNum: number; +declare const modeStr: string; +declare const encoding: string; +declare const type: string; +declare const flags: string; +declare const srcpath: string; +declare const dstpath: string; +declare const oldPath: string; +declare const newPath: string; +declare const cache: { [path: string]: string; }; +declare const offset: number; +declare const length: number; +declare const position: number; +declare const fd: number; +declare const len: number; +declare const uid: number; +declare const gid: number; +declare const atime: number; +declare const mtime: number; +declare const watchListener: (curr: fs.Stats, prev: fs.Stats) => void; +declare const statsCallback: (err: Error, stats: fs.Stats) => void; +declare const errorCallback: (err: Error) => void; +declare const openOpts: fs.ReadOptions; +declare const writeOpts: fs.WriteOptions; let watcher: fs.FSWatcher; let readStream: stream.Readable; let writeStream: stream.Writable; @@ -209,8 +209,7 @@ writeStream = fs.createWriteStream(path, { defaultEncoding: str }); -let isDirectoryCallback = (err: Error, isDirectory: boolean) => { -}; +function isDirectoryCallback(err: Error, isDirectory: boolean) {} fs.isDirectory(path, isDirectoryCallback); fs.isDirectory(path); isDirectory = fs.isDirectorySync(path); diff --git a/types/fs-promise/fs-promise-tests.ts b/types/fs-promise/fs-promise-tests.ts index 51da06bb05..a210496a15 100644 --- a/types/fs-promise/fs-promise-tests.ts +++ b/types/fs-promise/fs-promise-tests.ts @@ -1,11 +1,11 @@ import * as fs from "fs-promise"; let src: string; -let dst: string; -let dir: string; -let path: string; -let data: any; -let writeOptions: fs.WriteOptions; +declare const dst: string; +declare const dir: string; +declare const path: string; +declare const data: any; +declare const writeOptions: fs.WriteOptions; const writeJsonOptions: fs.WriteJsonOptions = { spaces: 2, replacer(key, value) { @@ -13,7 +13,7 @@ const writeJsonOptions: fs.WriteJsonOptions = { return value; } }; -let readJsonOptions: fs.ReadJsonOptions; +declare const readJsonOptions: fs.ReadJsonOptions; async function test() { await fs.copy(src, dst); diff --git a/types/fullcalendar/index.d.ts b/types/fullcalendar/index.d.ts index bed6396214..04e68a4d99 100644 --- a/types/fullcalendar/index.d.ts +++ b/types/fullcalendar/index.d.ts @@ -51,7 +51,7 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr weekNumbers?: boolean; weekNumberCalculation?: any; // String/Function businessHours?: boolean | BusinessHours | BusinessHours[]; - height?: number | 'auto' | 'parent'; + height?: number | 'auto' | 'parent'; contentHeight?: number; aspectRatio?: number; handleWindowResize?: boolean; diff --git a/types/git-remote-origin-url/index.d.ts b/types/git-remote-origin-url/index.d.ts index 6d648dc322..2c8f227953 100644 --- a/types/git-remote-origin-url/index.d.ts +++ b/types/git-remote-origin-url/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for git-remote-origin-url 2.0 // Project: https://github.com/sindresorhus/git-remote-origin-url#readme -// Definitions by: Jay Anslow +// Definitions by: Jay Anslow // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare function gitRemoteOriginUrl(cwd?: string): Promise; diff --git a/types/glob-stream/index.d.ts b/types/glob-stream/index.d.ts index 05281f1647..36a5d9fb92 100644 --- a/types/glob-stream/index.d.ts +++ b/types/glob-stream/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for glob-stream v3.1.12 -// Project: http://github.com/wearefractal/glob-stream +// Project: https://github.com/wearefractal/glob-stream // Definitions by: Bart van der Schoor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/globby/globby-tests.ts b/types/globby/globby-tests.ts index 0722b5fb37..68acb7cde8 100644 --- a/types/globby/globby-tests.ts +++ b/types/globby/globby-tests.ts @@ -19,6 +19,6 @@ const tasks: Array<{ options: IOptions }> = globby.generateGlobTasks(['*.tmp', '!b.tmp'], {ignore: ['c.tmp']}); -console.log(globby.hasMagic('**') === true); -console.log(globby.hasMagic(['**', 'path1', 'path2']) === true); -console.log(globby.hasMagic(['path1', 'path2']) === false); +console.log(globby.hasMagic('**')); +console.log(globby.hasMagic(['**', 'path1', 'path2'])); +console.log(!globby.hasMagic(['path1', 'path2'])); diff --git a/types/google-cloud__storage/google-cloud__storage-tests.ts b/types/google-cloud__storage/google-cloud__storage-tests.ts index 590953fa6a..00f85ff3d0 100644 --- a/types/google-cloud__storage/google-cloud__storage-tests.ts +++ b/types/google-cloud__storage/google-cloud__storage-tests.ts @@ -19,6 +19,7 @@ import { FileMetadata, FilePrivateOptions, ReadStreamOptions, + ResumableUploadOptions, SignedPolicy, SignedPolicyOptions, SignedUrlConfig, @@ -247,6 +248,16 @@ export class TestFile { return this.file.copy(destination); } + /** + * Create a unique resumable upload session URI. This is the first step when performing a resumable upload. + * @method createResumableUpload + * @param {ResumableUploadOptions} options + * @return {Promise<[string]} + */ + createResumableUpload(options?: ResumableUploadOptions): Promise<[string]> { + return this.file.createResumableUpload(options); + } + /** * Create a readable stream to read the contents of the remote file. * It can be piped to a writable stream or listened to for 'data' events to read a file's contents. diff --git a/types/google-cloud__storage/index.d.ts b/types/google-cloud__storage/index.d.ts index bee7c5de87..1d6bde527a 100644 --- a/types/google-cloud__storage/index.d.ts +++ b/types/google-cloud__storage/index.d.ts @@ -121,6 +121,7 @@ declare namespace Storage { acl: Acl; copy(destination: string | Bucket | File): Promise<[File, ApiResponse]>; createReadStream(options?: ReadStreamOptions): ReadStream; + createResumableUpload(options?: ResumableUploadOptions): Promise<[string]>; createWriteStream(options?: WriteStreamOptions): WriteStream; delete(): Promise<[ApiResponse]>; download(options?: DownloadOptions): Promise<[Buffer]>; @@ -139,11 +140,19 @@ declare namespace Storage { metadata?: FileMetadata; } + /** + * User-defined metadata. + */ + interface CustomFileMetadata { + [key: string]: boolean | number | string | null; + } + /** * File metadata. */ interface FileMetadata { contentType?: string; + metadata?: CustomFileMetadata; } /** @@ -192,6 +201,17 @@ declare namespace Storage { responseType?: string; } + /** + * Options when obtaining a resumable upload URI. + */ + interface ResumableUploadOptions { + metadata?: FileMetadata; + origin?: string; + predefinedAcl?: string; + private?: boolean; + public?: boolean; + } + /** * Access control list for storage buckets and files. */ diff --git a/types/google-map-react/google-map-react-tests.tsx b/types/google-map-react/google-map-react-tests.tsx index c01d1e3cab..464f840658 100644 --- a/types/google-map-react/google-map-react-tests.tsx +++ b/types/google-map-react/google-map-react-tests.tsx @@ -1,5 +1,5 @@ import GoogleMapReact, { BootstrapURLKeys } from 'google-map-react'; -import * as React from 'react'; +import * as React from 'react'; const center = { lat: 0, lng: 0 }; diff --git a/types/google-protobuf/google-protobuf-tests.ts b/types/google-protobuf/google-protobuf-tests.ts index 63dd08e8b5..19421754ac 100644 --- a/types/google-protobuf/google-protobuf-tests.ts +++ b/types/google-protobuf/google-protobuf-tests.ts @@ -80,8 +80,8 @@ class MySimple extends jspb.Message { }; static deserializeBinary(bytes: Uint8Array): MySimple { - var reader = new jspb.BinaryReader(bytes); - var msg = new MySimple; + const reader = new jspb.BinaryReader(bytes); + const msg = new MySimple; return MySimple.deserializeBinaryFromReader(msg, reader); } @@ -90,77 +90,77 @@ class MySimple extends jspb.Message { if (reader.isEndGroup()) { break; } - var field = reader.getFieldNumber(); + const field = reader.getFieldNumber(); switch (field) { case 1: - var value1 = /** @type {string} */ (reader.readString()); + const value1 = /** @type {string} */ (reader.readString()); msg.setMyString(value1); break; case 2: - var value2 = /** @type {boolean} */ (reader.readBool()); + const value2 = /** @type {boolean} */ (reader.readBool()); msg.setMyBool(value2); break; case 3: - var value3 = /** @type {string} */ (reader.readString()); + const value3 = /** @type {string} */ (reader.readString()); msg.addSomeLabels(value3); break; case 4: - var value4 = new google_protobuf_compiler_plugin_pb.CodeGeneratorRequest; + const value4 = new google_protobuf_compiler_plugin_pb.CodeGeneratorRequest; reader.readMessage(value4, google_protobuf_compiler_plugin_pb.CodeGeneratorRequest.deserializeBinaryFromReader); msg.setSomeCodeGeneratorRequest(value4); break; case 5: - var value5 = new google_protobuf_any_pb.Any; + const value5 = new google_protobuf_any_pb.Any; reader.readMessage(value5, google_protobuf_any_pb.Any.deserializeBinaryFromReader); msg.setSomeAny(value5); break; case 6: - var value6 = new google_protobuf_api_pb.Method; + const value6 = new google_protobuf_api_pb.Method; reader.readMessage(value6, google_protobuf_api_pb.Method.deserializeBinaryFromReader); msg.setSomeMethod(value6); break; case 7: - var value7 = new google_protobuf_descriptor_pb.GeneratedCodeInfo; + const value7 = new google_protobuf_descriptor_pb.GeneratedCodeInfo; reader.readMessage(value7, google_protobuf_descriptor_pb.GeneratedCodeInfo.deserializeBinaryFromReader); msg.setSomeGeneratedCodeInfo(value7); break; case 8: - var value8 = new google_protobuf_duration_pb.Duration; + const value8 = new google_protobuf_duration_pb.Duration; reader.readMessage(value8, google_protobuf_duration_pb.Duration.deserializeBinaryFromReader); msg.setSomeDuration(value8); break; case 9: - var value9 = new google_protobuf_empty_pb.Empty; + const value9 = new google_protobuf_empty_pb.Empty; reader.readMessage(value9, google_protobuf_empty_pb.Empty.deserializeBinaryFromReader); msg.setSomeEmpty(value9); break; case 10: - var value10 = new google_protobuf_field_mask_pb.FieldMask; + const value10 = new google_protobuf_field_mask_pb.FieldMask; reader.readMessage(value10, google_protobuf_field_mask_pb.FieldMask.deserializeBinaryFromReader); msg.setSomeFieldMask(value10); break; case 11: - var value11 = new google_protobuf_source_context_pb.SourceContext; + const value11 = new google_protobuf_source_context_pb.SourceContext; reader.readMessage(value11, google_protobuf_source_context_pb.SourceContext.deserializeBinaryFromReader); msg.setSomeSourceContext(value11); break; case 12: - var value12 = new google_protobuf_struct_pb.Struct; + const value12 = new google_protobuf_struct_pb.Struct; reader.readMessage(value12, google_protobuf_struct_pb.Struct.deserializeBinaryFromReader); msg.setSomeStruct(value12); break; case 13: - var value13 = new google_protobuf_timestamp_pb.Timestamp; + const value13 = new google_protobuf_timestamp_pb.Timestamp; reader.readMessage(value13, google_protobuf_timestamp_pb.Timestamp.deserializeBinaryFromReader); msg.setSomeTimestamp(value13); break; case 14: - var value14 = new google_protobuf_type_pb.Type; + const value14 = new google_protobuf_type_pb.Type; reader.readMessage(value14, google_protobuf_type_pb.Type.deserializeBinaryFromReader); msg.setSomeType(value14); break; case 15: - var value15 = new google_protobuf_wrappers_pb.DoubleValue; + const value15 = new google_protobuf_wrappers_pb.DoubleValue; reader.readMessage(value15, google_protobuf_wrappers_pb.DoubleValue.deserializeBinaryFromReader); msg.setSomeDoubleValue(value15); break; @@ -173,7 +173,7 @@ class MySimple extends jspb.Message { } serializeBinary(): Uint8Array { - var writer = new jspb.BinaryWriter(); + const writer = new jspb.BinaryWriter(); MySimple.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); } diff --git a/types/google.analytics/google.analytics-tests.ts b/types/google.analytics/google.analytics-tests.ts index ac2a99fd2e..945f967dc9 100644 --- a/types/google.analytics/google.analytics-tests.ts +++ b/types/google.analytics/google.analytics-tests.ts @@ -3,7 +3,7 @@ declare function it(desc: string, fn: () => void): void; describe("tester Google Analytics Tracker _gat object", () => { it("can set ga script element", () => { - gaClassic = document.createElement("script"); + gaClassic = document.createElement("script"); }); it("can set aync to true", () => { gaClassic.async = true; diff --git a/types/google.visualization/google.visualization-tests.ts b/types/google.visualization/google.visualization-tests.ts index 34999ccc3f..71cc0f80db 100644 --- a/types/google.visualization/google.visualization-tests.ts +++ b/types/google.visualization/google.visualization-tests.ts @@ -68,7 +68,7 @@ function test_scatterChart() { [ 6.5, 7] ]); - var options = { + var options: google.visualization.ScatterChartOptions = { title: 'Age vs. Weight comparison', hAxis: {title: 'Age', minValue: 0, maxValue: 15}, vAxis: {title: 'Weight', minValue: 0, maxValue: 15}, @@ -344,7 +344,7 @@ function test_candlestickChart() { // Treat first row as data as well. ], true); - var options = { + var options: google.visualization.CandlestickChartOptions = { legend:'none' }; diff --git a/types/google.visualization/index.d.ts b/types/google.visualization/index.d.ts index d5967384f1..a757e1d340 100644 --- a/types/google.visualization/index.d.ts +++ b/types/google.visualization/index.d.ts @@ -538,8 +538,7 @@ declare namespace google { // https://google-developers.appspot.com/chart/interactive/docs/gallery/scatterchart export class ScatterChart extends CoreChartBase { - draw(data: DataTable, options?: ScatterChartOptions): void; - draw(data: DataView, options?: ScatterChartOptions): void; + draw(data: DataTable | DataView, options?: ScatterChartOptions): void; } export interface ScatterChartOptions { @@ -560,7 +559,7 @@ declare namespace google { forceIFrame?: boolean; hAxis?: ChartAxis; height?: number; - legend?: ChartLegend; + legend?: ChartLegend | "none"; lineWidth?: number; pointSize?: number; selectionMode?: string; @@ -1085,8 +1084,7 @@ declare namespace google { // https://google-developers.appspot.com/chart/interactive/docs/gallery/candlestickchart export class CandlestickChart extends CoreChartBase { - draw(data: DataTable, options: CandlestickChartOptions): void; - draw(data: DataView, options: CandlestickChartOptions): void; + draw(data: DataTable | DataView, options: CandlestickChartOptions): void; } // https://google-developers.appspot.com/chart/interactive/docs/gallery/candlestickchart#Configuration_Options @@ -1105,7 +1103,7 @@ declare namespace google { fontName?: string; hAxis?: ChartAxis; height?: number; - legend?: ChartLegend; + legend?: ChartLegend | "none"; orientation?: string; reverseCategories?: boolean; selectionMode?: string // single / multiple diff --git a/types/googlemaps/index.d.ts b/types/googlemaps/index.d.ts index 8fc613a426..b86057d5b6 100644 --- a/types/googlemaps/index.d.ts +++ b/types/googlemaps/index.d.ts @@ -1317,8 +1317,8 @@ declare namespace google.maps { export interface TransitOptions { arrivalTime?: Date; departureTime?: Date; - modes: TransitMode[]; - routingPreference: TransitRoutePreference; + modes?: TransitMode[]; + routingPreference?: TransitRoutePreference; } export enum TransitMode { @@ -1339,7 +1339,7 @@ declare namespace google.maps { export interface DrivingOptions { departureTime: Date; - trafficModel: TrafficModel + trafficModel?: TrafficModel } export enum TrafficModel @@ -2518,7 +2518,7 @@ declare namespace google.maps { } export interface ComponentRestrictions { - country: string; + country: string|string[]; } export interface PlaceAspectRating { diff --git a/types/griddle-react/test/CustomFilterComponent.tsx b/types/griddle-react/test/CustomFilterComponent.tsx index b045281868..5c8b8d629c 100644 --- a/types/griddle-react/test/CustomFilterComponent.tsx +++ b/types/griddle-react/test/CustomFilterComponent.tsx @@ -23,7 +23,7 @@ const CustomFilterFunction = (items: ResultType[], query: string): ResultType[] }; class CustomFilterComponent extends React.Component { - query: string = ''; + query = ''; searchChange(event: React.FormEvent) { this.query = event.currentTarget.value; diff --git a/types/grunt/index.d.ts b/types/grunt/index.d.ts index 4c8198dee9..73436b67fd 100644 --- a/types/grunt/index.d.ts +++ b/types/grunt/index.d.ts @@ -6,7 +6,7 @@ /// /** - * {@link http://github.com/marak/colors.js/} + * {@link https://github.com/marak/colors.js/} */ interface String { yellow: string; @@ -34,7 +34,7 @@ declare namespace node { } /** - * {@link http://github.com/isaacs/minimatch} + * {@link https://github.com/isaacs/minimatch} */ declare namespace minimatch { @@ -203,7 +203,7 @@ declare namespace grunt { namespace event { /** - * {@link http://github.com/hij1nx/EventEmitter2} + * {@link https://github.com/hij1nx/EventEmitter2} */ interface EventModule { @@ -1053,7 +1053,7 @@ declare namespace grunt { /** * Format a date using the dateformat library. - * {@link http://github.com/felixge/node-dateformat} + * {@link https://github.com/felixge/node-dateformat} * * @note if you don't include the mask argument, dateFormat.masks.default is used */ @@ -1063,7 +1063,7 @@ declare namespace grunt { /** * Format today's date using the dateformat library using the current date and time. - * {@link http://github.com/felixge/node-dateformat} + * {@link https://github.com/felixge/node-dateformat} * * @note if you don't include the mask argument, dateFormat.masks.default is used */ @@ -1219,7 +1219,7 @@ declare namespace grunt { } /** - * {@link http://github.com/snbartell/node-spawn} + * {@link https://github.com/snbartell/node-spawn} */ interface ISpawnedChild { /** diff --git a/types/gulp-concat/index.d.ts b/types/gulp-concat/index.d.ts index 74155f6b4c..639365c512 100644 --- a/types/gulp-concat/index.d.ts +++ b/types/gulp-concat/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for gulp-concat -// Project: http://github.com/wearefractal/gulp-concat +// Project: https://github.com/wearefractal/gulp-concat // Definitions by: Keita Kagurazaka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/gulp-connect/gulp-connect-tests.ts b/types/gulp-connect/gulp-connect-tests.ts index 03722a4c15..feafa1007b 100644 --- a/types/gulp-connect/gulp-connect-tests.ts +++ b/types/gulp-connect/gulp-connect-tests.ts @@ -92,7 +92,7 @@ gulp.task('connect', () => { import * as express from "express"; gulp.task('connect', () => { - let middleware = [ + const middleware = [ express() ]; @@ -106,7 +106,7 @@ gulp.task('connect', () => { // Validate using paths to restrict handler functions works gulp.task('connect', () => { - let middleware: connect.ConnectRouteHandler[] = [ + const middleware: connect.ConnectRouteHandler[] = [ ["/path", express()], ["/path2", express()], ]; diff --git a/types/gulp-if/index.d.ts b/types/gulp-if/index.d.ts index 589482c49b..b276fbaae1 100644 --- a/types/gulp-if/index.d.ts +++ b/types/gulp-if/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for gulp-if // Project: https://github.com/robrich/gulp-if -// Definitions by: Asana , Joe Skeen +// Definitions by: Asana , Joe Skeen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/gulp-load-plugins/index.d.ts b/types/gulp-load-plugins/index.d.ts index 4d58eae286..d39a64c2f3 100644 --- a/types/gulp-load-plugins/index.d.ts +++ b/types/gulp-load-plugins/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for gulp-load-plugins // Project: https://github.com/jackfranklin/gulp-load-plugins -// Definitions by: Joe Skeen +// Definitions by: Joe Skeen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/gulp-plumber/index.d.ts b/types/gulp-plumber/index.d.ts index 7486668421..d94566aff1 100644 --- a/types/gulp-plumber/index.d.ts +++ b/types/gulp-plumber/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for gulp-plumber // Project: https://github.com/floatdrop/gulp-plumber -// Definitions by: Joe Skeen +// Definitions by: Joe Skeen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/gulp-sort/index.d.ts b/types/gulp-sort/index.d.ts index 96d5362550..6db9c07dd5 100644 --- a/types/gulp-sort/index.d.ts +++ b/types/gulp-sort/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for gulp-sort // Project: https://github.com/pgilad/gulp-sort -// Definitions by: Joe Skeen +// Definitions by: Joe Skeen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/gulp-task-listing/index.d.ts b/types/gulp-task-listing/index.d.ts index 113c6acaf2..9fc6e4ab18 100644 --- a/types/gulp-task-listing/index.d.ts +++ b/types/gulp-task-listing/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for gulp-task-listing // Project: https://github.com/OverZealous/gulp-task-listing -// Definitions by: Joe Skeen +// Definitions by: Joe Skeen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** diff --git a/types/gulp-watch/gulp-watch-tests.ts b/types/gulp-watch/gulp-watch-tests.ts index de531257a5..b273662824 100644 --- a/types/gulp-watch/gulp-watch-tests.ts +++ b/types/gulp-watch/gulp-watch-tests.ts @@ -26,14 +26,10 @@ gulp.task('build', () => { .pipe(watch(files, { base: '..' })); }); -gulp.task('build', () => { - var files = [ - 'app/**/*.ts', - 'lib/**/*.ts', - 'components/**/*.ts', - ]; - - gulp.src(files, { cwd: '..' }) - .pipe(watch(files, { base: '..' })); +gulp.task('use_file', () => { + watch("foo", file => { + const s: string = file.relative; + const e: "add" | "change" | "unlink" = file.event; + }); }); diff --git a/types/gulp-watch/index.d.ts b/types/gulp-watch/index.d.ts index 8b96e78c97..d9cd61d869 100644 --- a/types/gulp-watch/index.d.ts +++ b/types/gulp-watch/index.d.ts @@ -5,6 +5,7 @@ /// +import * as File from "vinyl"; import { SrcOptions } from "vinyl-fs"; interface IOptions extends SrcOptions { @@ -22,6 +23,9 @@ interface IWatchStream extends NodeJS.ReadWriteStream { close(): NodeJS.ReadWriteStream; } -declare function watch(glob: string | Array, options?: IOptions, callback?: Function): IWatchStream; +type Cb = (file: File & { event: "add" | "change" | "unlink" }) => void; + +declare function watch(glob: string | Array, callback?: Cb): IWatchStream; +declare function watch(glob: string | Array, options?: IOptions, callback?: Cb): IWatchStream; declare namespace watch { } export = watch; diff --git a/types/gulp/test/index.ts b/types/gulp/test/index.ts index 40807f890a..e59d721669 100644 --- a/types/gulp/test/index.ts +++ b/types/gulp/test/index.ts @@ -50,7 +50,7 @@ const someNextTask = () => { gulp.task(someTask); -let foo: gulp.TaskFunction = () => { }; +const foo: gulp.TaskFunction = () => { }; foo.name === 'foo'; // true const bar: gulp.TaskFunction = () => { }; @@ -59,7 +59,7 @@ bar.name === ''; // true bar.name = 'bar'; bar.name === ''; // true -let test: gulp.TaskFunction = (done) => { +const test: gulp.TaskFunction = (done) => { done(); }; diff --git a/types/h2o2/index.d.ts b/types/h2o2/index.d.ts index 7ca3ccb85f..881b75c0a8 100644 --- a/types/h2o2/index.d.ts +++ b/types/h2o2/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for h2o2 5.4 // Project: https://github.com/hapijs/catbox -// Definitions by: Jason Swearingen , AJP +// Definitions by: Jason Swearingen , AJP // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/hapi-auth-jwt2/index.d.ts b/types/hapi-auth-jwt2/index.d.ts index 0109bfb33d..4d5f6b2cd4 100644 --- a/types/hapi-auth-jwt2/index.d.ts +++ b/types/hapi-auth-jwt2/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for hapi-auth-jwt2 7.0 -// Project: http://github.com/dwyl/hapi-auth-jwt2 -// Definitions by: Warren Seymour +// Project: https://github.com/dwyl/hapi-auth-jwt2 +// Definitions by: Warren Seymour // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { Request, Response, PluginFunction } from 'hapi'; diff --git a/types/hapi-decorators/index.d.ts b/types/hapi-decorators/index.d.ts index e4d7c40991..4cd98beda8 100644 --- a/types/hapi-decorators/index.d.ts +++ b/types/hapi-decorators/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for hapi-decorators v0.4.3 // Project: https://github.com/knownasilya/hapi-decorators -// Definitions by: Ken Howard +// Definitions by: Ken Howard // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index 87d7b94e35..e5a6bfa038 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for hapi 16.1 // Project: https://github.com/hapijs/hapi -// Definitions by: Jason Swearingen , AJP +// Definitions by: Jason Swearingen , AJP // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/hapi/v12/index.d.ts b/types/hapi/v12/index.d.ts index 13c9e7a28d..8cbfaff2cf 100644 --- a/types/hapi/v12/index.d.ts +++ b/types/hapi/v12/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for hapi 12.0.1 -// Project: http://github.com/spumko/hapi -// Definitions by: Jason Swearingen +// Project: https://github.com/spumko/hapi +// Definitions by: Jason Swearingen // Definitions: https://github.com/borisyankov/DefinitelyTyped // Note/Disclaimer: diff --git a/types/hapi/v15/index.d.ts b/types/hapi/v15/index.d.ts index 86b993bfb5..b7a4510483 100644 --- a/types/hapi/v15/index.d.ts +++ b/types/hapi/v15/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for hapi 15.0 -// Project: http://github.com/spumko/hapi -// Definitions by: Jason Swearingen +// Project: https://github.com/spumko/hapi +// Definitions by: Jason Swearingen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Note/Disclaimer: This .d.ts was created against hapi v8.x but has been incrementally upgraded to 13.x. Some newer features/changes may be missing. YMMV. diff --git a/types/hapi/v8/index.d.ts b/types/hapi/v8/index.d.ts index 0a46c60757..762b9eb198 100644 --- a/types/hapi/v8/index.d.ts +++ b/types/hapi/v8/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for hapi 8.2.0 -// Project: http://github.com/spumko/hapi -// Definitions by: Jason Swearingen +// Project: https://github.com/spumko/hapi +// Definitions by: Jason Swearingen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped //This is a total rewrite of Hakubo's original hapi.d.ts, as it was out of date/incomplete. diff --git a/types/haversine/haversine-tests.ts b/types/haversine/haversine-tests.ts new file mode 100644 index 0000000000..043d7d5898 --- /dev/null +++ b/types/haversine/haversine-tests.ts @@ -0,0 +1,18 @@ +import haversine = require('haversine'); + +const start: haversine.Coordinate = { + longitude: 48.1548256, + latitude: 11.4017529 +}; + +const end: haversine.Coordinate = { + longitude: 52.5065133, + latitude: 13.1445551 +}; + +const options: haversine.Options = { + unit: 'km', + threshold: 1 +}; + +haversine(start, end, options); diff --git a/types/haversine/index.d.ts b/types/haversine/index.d.ts new file mode 100644 index 0000000000..aa3c0cb1aa --- /dev/null +++ b/types/haversine/index.d.ts @@ -0,0 +1,36 @@ +// Type definitions for haversine 1.0 +// Project: https://github.com/njj/haversine +// Definitions by: Christian Rackerseder +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace haversine { + interface Coordinate { + longitude: number; + latitude: number; + } + + interface Options { + /** + * Unit of measurement applied to result. Default: "km". + */ + unit?: 'km' | 'mile' | 'meter' | 'nmi'; + /** + * If passed, will result in library returning boolean value of whether or not the start and end points are within that supplied threshold. Default: null. + */ + threshold?: number; + } +} + +/** + * Determines the great-circle distance between two points on a sphere given their longitudes and latitudes + * @param start + * @param end + * @param options + */ +declare function haversine( + start: haversine.Coordinate, + end: haversine.Coordinate, + options?: haversine.Options +): number; + +export = haversine; diff --git a/types/haversine/tsconfig.json b/types/haversine/tsconfig.json new file mode 100644 index 0000000000..aaf7c243c2 --- /dev/null +++ b/types/haversine/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "haversine-tests.ts" + ] +} diff --git a/types/haversine/tslint.json b/types/haversine/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/haversine/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/heredatalens/heredatalens-tests.ts b/types/heredatalens/heredatalens-tests.ts index 40e68902c5..6b66cc9de5 100644 --- a/types/heredatalens/heredatalens-tests.ts +++ b/types/heredatalens/heredatalens-tests.ts @@ -142,7 +142,7 @@ let layer = new H.datalens.ObjectLayer( rowToStyle: (cluster) => { const size = 32; - let icon = H.datalens.ObjectLayer.createIcon([ + const icon = H.datalens.ObjectLayer.createIcon([ 'svg', { viewBox: [-size, -size, 2 * size, 2 * size] diff --git a/types/heredatalens/index.d.ts b/types/heredatalens/index.d.ts index b01014ba1e..e9861713e3 100644 --- a/types/heredatalens/index.d.ts +++ b/types/heredatalens/index.d.ts @@ -15,14 +15,14 @@ declare namespace H { /** * HERE Maps API and Data Lens JavaScript API can be used to visualize data from different network sources. * For each network source type, a service class is required. The service also stores API connection credentials. - * The service instance must be configured with a H.service.Platform instance. + * The service instance must be configured with a service.Platform instance. */ - class Service implements H.service.IConfigurable { + class Service implements service.IConfigurable { /** * Constructor - * @param options {H.datalens.Service.Options=} - Overrides the configuration from the H.service.Platform instance + * @param options {datalens.Service.Options=} - Overrides the configuration from the service.Platform instance */ - constructor(options?: H.datalens.Service.Options); + constructor(options?: datalens.Service.Options); /** * This method makes an HTTP request to the Data Lens REST API. @@ -75,15 +75,15 @@ declare namespace H { /** * This method fetches vector tile data from the layer. * @param layerName {string} - * @param x {H.datalens.QueryTileProvider.X} - Tile columns - * @param y {H.datalens.QueryTileProvider.Y} - Tile row - * @param z {H.datalens.QueryTileProvider.Zoom} - zoom level + * @param x {datalens.QueryTileProvider.X} - Tile columns + * @param y {datalens.QueryTileProvider.Y} - Tile row + * @param z {datalens.QueryTileProvider.Zoom} - zoom level * @param params {any=} - URL parameters (eg bounding box) * @param onResult {function(any)=} - Callback called on a successful request with response data * @param onError {function(Error)=} - Callback called on an unsuccessful request with the Error object * @returns {Promise} - Typed array with tile data */ - fetchLayerTile(layerName: string, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom, + fetchLayerTile(layerName: string, x: datalens.QueryTileProvider.X, y: datalens.QueryTileProvider.Y, z: datalens.QueryTileProvider.Zoom, params?: any, onResult?: (result: any) => void, onError?: (error: any) => void): Promise; /** @@ -96,21 +96,21 @@ declare namespace H { setTokens(accessToken: string, refreshToken: string): void; /** - * This method implements H.service.IConfigurable interface. It is called by the H.service.Platform instance. + * This method implements service.IConfigurable interface. It is called by the service.Platform instance. * @param appId {string} - The appId * @param appCode {string} - The appCode * @param useHTTPS {boolean} - A flag to use HTTPS or not * @param useCIT {boolean} - A flag to use the staging server (CIT) or not - * @param baseUrl {H.service.Url=} - The base URL for all requests to the Data Lens REST API - * @returns {H.datalens.Service} + * @param baseUrl {service.Url=} - The base URL for all requests to the Data Lens REST API + * @returns {datalens.Service} */ - configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, baseUrl?: H.service.Url): H.datalens.Service; + configure(appId: string, appCode: string, useHTTPS: boolean, useCIT: boolean, baseUrl?: service.Url): datalens.Service; } namespace Service { /** - * Overrides the H.datalens.Service configuration - * Normally the H.datalens.Service instance is configured with the H.service.Platform instance. + * Overrides the datalens.Service configuration + * Normally the datalens.Service instance is configured with the service.Platform instance. * This configuration can be overridden by specifying these options. * It can be useful when the Data Lens environment is different from the HERE Platform environment. * @property subDomain {string=} - Subdomain of the Data Lens REST API URL @@ -148,25 +148,25 @@ declare namespace H { * The input data can be stored locally or loaded from the network. Data can be loaded by tiles or in one chunk. * This provider allows you to supply data stored locally or fetched using external tools. */ - class Provider extends H.map.provider.Provider { + class Provider extends map.provider.Provider { /** * Constructor - * @param data {H.datalens.Service.Data=} - JSON object - * @param options {H.map.provider.Provider.Options=} - Configures data accessibility parameters + * @param data {datalens.Service.Data=} - JSON object + * @param options {map.provider.Provider.Options=} - Configures data accessibility parameters */ - constructor(data?: H.datalens.Service.Data, options?: H.map.provider.Provider.Options); + constructor(data?: datalens.Service.Data, options?: map.provider.Provider.Options); /** * Updates the provider data. When data is updated, the update event is triggered so that the consuming layers are redrawn. - * @param data {H.datalens.Service.Data} - JSON object + * @param data {datalens.Service.Data} - JSON object */ - setData(data: H.datalens.Service.Data): void; + setData(data: datalens.Service.Data): void; /** * Retrieves the provider data. - * @returns {H.datalens.Service.Data} - JSON object + * @returns {datalens.Service.Data} - JSON object */ - getData(): H.datalens.Service.Data; + getData(): datalens.Service.Data; } /** @@ -175,13 +175,13 @@ declare namespace H { * Data can be loaded by tiles or in one chunk. This provider loads query data with the Data Lens REST API. * Note that this provider must be used only for non-tiled queries. */ - class QueryProvider extends H.datalens.Provider { + class QueryProvider extends datalens.Provider { /** * Constructor - * @param service {H.datalens.Service} - Data Lens REST API service - * @param options {H.datalens.QueryProvider.Options=} - Configures source query and data accessibility parameters + * @param service {datalens.Service} - Data Lens REST API service + * @param options {datalens.QueryProvider.Options=} - Configures source query and data accessibility parameters */ - constructor(data: H.datalens.Service.Data, options?: H.datalens.QueryProvider.Options); + constructor(data: datalens.Service.Data, options?: datalens.QueryProvider.Options); /** * Updates the query ID to be used in the next call of the Data Lens REST API. @@ -207,21 +207,21 @@ declare namespace H { /** * Updates the provider data. * When data is updated, the update event is triggered so that the consuming layers are redrawn. - * @param data {H.datalens.Service.Data} - JSON object + * @param data {datalens.Service.Data} - JSON object */ - setData(data: H.datalens.Service.Data): void; + setData(data: datalens.Service.Data): void; /** * Retrieves the provider data. - * @returns {H.datalens.Service.Data} - JSON object + * @returns {datalens.Service.Data} - JSON object */ - getData(): H.datalens.Service.Data; + getData(): datalens.Service.Data; } namespace QueryProvider { /** - * Configures source query and data accessibility parameters for H.datalens.QueryProvider - * Specifies the query credentials and dynamic parameters required for fetching query data with the Data Lens REST API. Other options from H.datalens.Provider.Options are available. + * Configures source query and data accessibility parameters for datalens.QueryProvider + * Specifies the query credentials and dynamic parameters required for fetching query data with the Data Lens REST API. Other options from datalens.Provider.Options are available. * @property queryId {string} - The ID of the Data Lens REST API query * @property queryParams {any=} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. */ @@ -237,13 +237,13 @@ declare namespace H { * This provider loads tiled query data with the Data Lens REST API. Tiled queries are used to load data only for the current viewport. * This optimizes memory and network usage and enables progressive rendering. */ - class QueryTileProvider extends H.map.provider.RemoteTileProvider { + class QueryTileProvider extends map.provider.RemoteTileProvider { /** * Constructor - * @param service {H.datalens.Service} - Data Lens REST API service - * @param options {H.datalens.QueryTileProvider.Options} - Configures source query and data accessibility parameters + * @param service {datalens.Service} - Data Lens REST API service + * @param options {datalens.QueryTileProvider.Options} - Configures source query and data accessibility parameters */ - constructor(service: H.datalens.Service, options: H.datalens.QueryTileProvider.Options); + constructor(service: datalens.Service, options: datalens.QueryTileProvider.Options); /** * Updates the query ID to be used in the next call of the Data Lens REST API. @@ -262,9 +262,9 @@ declare namespace H { /** * Updates the names of the dynamic parameters that defines tiles. This method is only needed when the query ID is updated. * Note that new data will be fetched only after the reload method is called. - * @param tileParamNames {H.datalens.QueryTileProvider.TileParamNames} - Names of the URI parameters that control the x/y/z of a tiled query + * @param tileParamNames {datalens.QueryTileProvider.TileParamNames} - Names of the URI parameters that control the x/y/z of a tiled query */ - setTileParamNames(tileParamNames: H.datalens.QueryTileProvider.TileParamNames): void; + setTileParamNames(tileParamNames: datalens.QueryTileProvider.TileParamNames): void; } namespace QueryTileProvider { @@ -283,15 +283,15 @@ declare namespace H { } /** - * Configures source query and data accessibility parameters for H.datalens.QueryTileProvider + * Configures source query and data accessibility parameters for datalens.QueryTileProvider * Specifies the query credentials and dynamic parameters required for fetching tiled query data with the Data Lens REST API. - * Other options from H.datalens.Provider.Options are available. - * @property tileParamNames {H.datalens.QueryTileProvider.TileParamNames=} - Names of the URI parameters that control the x/y/z of a tiled query + * Other options from datalens.Provider.Options are available. + * @property tileParamNames {datalens.QueryTileProvider.TileParamNames=} - Names of the URI parameters that control the x/y/z of a tiled query * @property queryId {string} - The ID for the Data Lens REST API query * @property queryParams {any=} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. */ interface Options { - tileParamNames: H.datalens.QueryTileProvider.TileParamNames; + tileParamNames: datalens.QueryTileProvider.TileParamNames; queryId: string; queryParams?: string; } @@ -321,7 +321,7 @@ declare namespace H { * The rendering is implemented by drawing directly on a canvas. The layer is often used together with a Data Lens query which groups rows by pixels. * This reduces the amount of data delivered to the client. */ - class RasterLayer extends H.map.layer.TileLayer { + class RasterLayer extends map.layer.TileLayer { /** * Constructor */ @@ -341,37 +341,37 @@ declare namespace H { /** * This is a default implementation of renderTile callback. This method represents each point as a black 1x1 pixel square. - * @param points {Array} - Input data points within a tile + * @param points {Array} - Input data points within a tile * @param canvas {HTMLCanvasElement} - The target canvas */ - static defaultRenderTile(points: H.datalens.RasterLayer.TilePoint[], canvas: HTMLCanvasElement): void; + static defaultRenderTile(points: datalens.RasterLayer.TilePoint[], canvas: HTMLCanvasElement): void; } namespace RasterLayer { /** * Defines data processing and rendering options for RasterLayer. * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. - * By default this step is processed with H.datalens.RasterLayer.defaultDataToRows. + * By default this step is processed with datalens.RasterLayer.defaultDataToRows. * This behavior can be changed by defining the dataToRows callback. - * To collect the rows for a tile including buffer, the rows must be translated to H.datalens.RasterLayer.TilePoint. + * To collect the rows for a tile including buffer, the rows must be translated to datalens.RasterLayer.TilePoint. * This translation must be specified with the rowToTilePoint callback. The final rendering on the tile canvas must be defined in renderTile. - * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * @property dataToRows {function(datalens.Service.Data, datalens.QueryTileProvider.X, datalens.QueryTileProvider.Y, datalens.QueryTileProvider.Zoom)=} - * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. - * @property rowToTilePoint {function(H.datalens.RasterLayer.Row, H.datalens.RasterLayer.X, H.datalens.RasterLayer.Y)=} - - * Defines how the row is translated to the H.datalens.RasterLayer.TilePoint. This callback is called for each row that is returned from dataToRows. - * @property buffer {function(H.datalens.QueryTileProvider.Zoom)=} - Defines the buffer as a function of the zoom level. + * @property rowToTilePoint {function(datalens.RasterLayer.Row, datalens.RasterLayer.X, datalens.RasterLayer.Y)=} - + * Defines how the row is translated to the datalens.RasterLayer.TilePoint. This callback is called for each row that is returned from dataToRows. + * @property buffer {function(datalens.QueryTileProvider.Zoom)=} - Defines the buffer as a function of the zoom level. * The buffer is a value (in pixels) that defines an extra area around each tile to capture data points from. * This is done to avoid drawing edges between tiles. For example, if data points represented with circles with a maximum radius of 10 pixels, then the buffer must be 10 pixels. - * @property renderTile {function(Array, HTMLCanvasElement, H.datalens.QueryTileProvider.Zoom)=} - + * @property renderTile {function(Array, HTMLCanvasElement, datalens.QueryTileProvider.Zoom)=} - * Defines how tile data is represented on a canvas. Input points for each tile are collected with respect to the buffer. * For progressive rendering this callback may be called more than once for the tile. */ interface Options { - dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom): - H.datalens.RasterLayer.Row[]; - rowToTilePoint?(row: H.datalens.RasterLayer.Row, x: H.datalens.RasterLayer.X, y: H.datalens.RasterLayer.Y): H.datalens.RasterLayer.TilePoint; - buffer?(zoom: H.datalens.QueryTileProvider.Zoom): number; - renderTile?(points: H.datalens.RasterLayer.TilePoint[], canvas: HTMLCanvasElement, zoom: H.datalens.QueryTileProvider.Zoom): void; + dataToRows?(data: datalens.Service.Data, x: datalens.QueryTileProvider.X, y: datalens.QueryTileProvider.Y, zoom: datalens.QueryTileProvider.Zoom): + datalens.RasterLayer.Row[]; + rowToTilePoint?(row: datalens.RasterLayer.Row, x: datalens.RasterLayer.X, y: datalens.RasterLayer.Y): datalens.RasterLayer.TilePoint; + buffer?(zoom: datalens.QueryTileProvider.Zoom): number; + renderTile?(points: datalens.RasterLayer.TilePoint[], canvas: HTMLCanvasElement, zoom: datalens.QueryTileProvider.Zoom): void; } /** @@ -379,12 +379,12 @@ declare namespace H { * To collect data rows for each tile with respect to the buffer, each row must be represented as a point within the map tile. * @property x {number} - Row relative to tile * @property y {number} - Column relative to tile - * @property data {H.datalens.RasterLayer.Row=} - Reference to source data row + * @property data {datalens.RasterLayer.Row=} - Reference to source data row */ interface TilePoint { x: number; y: number; - data?: H.datalens.RasterLayer.Row; + data?: datalens.RasterLayer.Row; } /** @@ -413,42 +413,42 @@ declare namespace H { * In most cases, the layer consumes data grouped by 1x1 pixels buckets. For proper averaging it requires aggregated value and count (number of rows in bucket) for each bucket. * Blending of buckets is implemented via kernel density estimation (KDE) with a Gaussian kernel. */ - class HeatmapLayer extends H.datalens.RasterLayer { + class HeatmapLayer extends datalens.RasterLayer { /** * Constructor - * @param provider {H.datalens.QueryTileProvider} - Source of tiled data - * @param options {H.datalens.HeatmapLayer.Options} - Configuration for data processing and rendering + * @param provider {datalens.QueryTileProvider} - Source of tiled data + * @param options {datalens.HeatmapLayer.Options} - Configuration for data processing and rendering */ - constructor(provider: H.datalens.QueryTileProvider, options: H.datalens.HeatmapLayer.Options); + constructor(provider: datalens.QueryTileProvider, options: datalens.HeatmapLayer.Options); /** * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. - * @param data {H.datalens.Service.Data} - * @param x {H.datalens.QueryTileProvider.X} - * @param y {H.datalens.QueryTileProvider.Y} - * @param zoom {H.datalens.QueryTileProvider.Zoom} - * @returns {Array} + * @param data {datalens.Service.Data} + * @param x {datalens.QueryTileProvider.X} + * @param y {datalens.QueryTileProvider.Y} + * @param zoom {datalens.QueryTileProvider.Zoom} + * @returns {Array} */ - static defaultDataToRows: (data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom) => - H.datalens.HeatmapLayer.Row[]; + static defaultDataToRows: (data: datalens.Service.Data, x: datalens.QueryTileProvider.X, y: datalens.QueryTileProvider.Y, zoom: datalens.QueryTileProvider.Zoom) => + datalens.HeatmapLayer.Row[]; /** * Set of possible values for the inputScale option - * @type {H.datalens.HeatmapLayer.InputScale} + * @type {datalens.HeatmapLayer.InputScale} */ - static inputScale: H.datalens.HeatmapLayer.InputScale; + static inputScale: datalens.HeatmapLayer.InputScale; /** * Set of possible values for the aggregation option - * @type {H.datalens.HeatmapLayer.Aggregation} + * @type {datalens.HeatmapLayer.Aggregation} */ - static aggregation: H.datalens.HeatmapLayer.Aggregation; + static aggregation: datalens.HeatmapLayer.Aggregation; /** * @param zoom {number} - zoom level - * @return {H.datalens.HeatmapLayer.Options} + * @return {datalens.HeatmapLayer.Options} */ - getOptionsPerZoom(zoom: number): H.datalens.HeatmapLayer.Options; + getOptionsPerZoom(zoom: number): datalens.HeatmapLayer.Options; /** * Removes listeners, and references to memory consuming objects, from this layer. Call this method when you no longer need the layer. @@ -465,43 +465,43 @@ declare namespace H { /** * Defines data processing and rendering options for HeatmapLayer. * The data processing flow of HeatmapLayer is similar to RasterLayer. The initial step of rendering is to split the tile data by rows, where each row represents a bucket. - * By default this step is processed with H.datalens.HeatmapLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. - * To collect the rows for a tile including buffer, the rows must be translated to H.datalens.HeatmapLayer.TilePoint. This translation must be specified with the rowToTilePoint callback. + * By default this step is processed with datalens.HeatmapLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * To collect the rows for a tile including buffer, the rows must be translated to datalens.HeatmapLayer.TilePoint. This translation must be specified with the rowToTilePoint callback. * Other options define the blending options for the heat map. - * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * @property dataToRows {function(datalens.Service.Data, datalens.QueryTileProvider.X, datalens.QueryTileProvider.Y, datalens.QueryTileProvider.Zoom)=} - * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. - * @property rowToTilePoint {function(H.datalens.HeatmapLayer.Row, H.datalens.HeatmapLayer.X, H.datalens.HeatmapLayer.Y)=} - - * Defines how the row is translated to the H.datalens.HeatmapLayer.TilePoint. This callback is called for each row that is returned from dataToRows. - * @property bandwidth {H.datalens.HeatmapLayer~Bandwidth | H.datalens.HeatmapLayer~BandwidthStop | Array. | - * H.datalens.HeatmapLayer~BandwidthCallback=} - Describes the bandwidth behavior in relation to current zoom level A numeric value sets it static across all levels + * @property rowToTilePoint {function(datalens.HeatmapLayer.Row, datalens.HeatmapLayer.X, datalens.HeatmapLayer.Y)=} - + * Defines how the row is translated to the datalens.HeatmapLayer.TilePoint. This callback is called for each row that is returned from dataToRows. + * @property bandwidth {datalens.HeatmapLayer~Bandwidth | datalens.HeatmapLayer~BandwidthStop | Array. | + * datalens.HeatmapLayer~BandwidthCallback=} - Describes the bandwidth behavior in relation to current zoom level A numeric value sets it static across all levels * An Object with zoom, value and optional zoomIncrementFactor (1 equals doubling on every zoom increment) defines a behavior across all zoom levels * An Array of one or more zoom, value objects describes the behavior between the two defined levels and extrapolates the implied change outside of the defined range * Alternatively defines the level of smoothing as a function of the zoom level. The callback must return a value in pixels. * The cut-off of the Gaussian kernel is defined as 3 * bandwidth , a multiple (default 3) of bandwidth. - * @property valueRange {function(H.datalens.QueryTileProvider.Zoom)} - Defines the range for the color scale as a function of the zoom level. + * @property valueRange {function(datalens.QueryTileProvider.Zoom)} - Defines the range for the color scale as a function of the zoom level. * The returned value must be an array of 2 numbers. - * @property countRange {function(H.datalens.QueryTileProvider.Zoom)} - Defines the range for the density alpha mask as a function of the zoom level. + * @property countRange {function(datalens.QueryTileProvider.Zoom)} - Defines the range for the density alpha mask as a function of the zoom level. * When defined, the density alpha mask is applied. The returned value must be an array of 2 numbers. * @property colorScale {function(number)} - Defines a color palette as a function of the normalized value. You can use D3.js library scale functions with the domain [0, 1]. * @property alphaScale {function(number)} - Defines the alpha mask value as a function of the normalized count. * You can use D3.js library scale functions with the domain [0, 1] and the range [0, 1]. - * @property aggregation {H.datalens.HeatmapLayer.Aggregation} - Specifies which type of aggregation was applied (eg. type of aggregation function for bucket in the Data Lens query). + * @property aggregation {datalens.HeatmapLayer.Aggregation} - Specifies which type of aggregation was applied (eg. type of aggregation function for bucket in the Data Lens query). * Possible values are SUM or AVERAGE. If the aggregation type is AVERAGE , then an averaged heat map is rendered. - * @property inputScale {H.datalens.HeatmapLayer.InputScale} - Defines the scale (eg logarithmic scale) of the TilePoint value. + * @property inputScale {datalens.HeatmapLayer.InputScale} - Defines the scale (eg logarithmic scale) of the TilePoint value. * Note: if the value is not in a linear scale, then the aggregation in the source query must be defined with respect to the scale type. * For example, before applying the average aggregation function in a query, the value must be transformed to the linear scale. This guarantees correct linear averaging of values. */ interface Options { - dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, zoom: H.datalens.QueryTileProvider.Zoom): - H.datalens.HeatmapLayer.Row[]; - rowToTilePoint(row: H.datalens.HeatmapLayer.Row, x: H.datalens.HeatmapLayer.X, y: H.datalens.HeatmapLayer.Y): H.datalens.HeatmapLayer.TilePoint; - bandwidth?: H.datalens.HeatmapLayer.Bandwidth | H.datalens.HeatmapLayer.BandwidthStop | H.datalens.HeatmapLayer.BandwidthStop[] | H.datalens.HeatmapLayer.BandwidthCallback; - valueRange?(zoom: H.datalens.QueryTileProvider.Zoom): number[]; - countRange?(zoom: H.datalens.QueryTileProvider.Zoom): number[]; + dataToRows?(data: datalens.Service.Data, x: datalens.QueryTileProvider.X, y: datalens.QueryTileProvider.Y, zoom: datalens.QueryTileProvider.Zoom): + datalens.HeatmapLayer.Row[]; + rowToTilePoint(row: datalens.HeatmapLayer.Row, x: datalens.HeatmapLayer.X, y: datalens.HeatmapLayer.Y): datalens.HeatmapLayer.TilePoint; + bandwidth?: datalens.HeatmapLayer.Bandwidth | datalens.HeatmapLayer.BandwidthStop | datalens.HeatmapLayer.BandwidthStop[] | datalens.HeatmapLayer.BandwidthCallback; + valueRange?(zoom: datalens.QueryTileProvider.Zoom): number[]; + countRange?(zoom: datalens.QueryTileProvider.Zoom): number[]; colorScale?(scale: number): string; alphaScale?(scale: number): number; - aggregation?: H.datalens.HeatmapLayer.Aggregation; - inputScale?: H.datalens.HeatmapLayer.InputScale; + aggregation?: datalens.HeatmapLayer.Aggregation; + inputScale?: datalens.HeatmapLayer.InputScale; } /** @@ -558,14 +558,14 @@ declare namespace H { * @property y {number} - Column relative to tile * @property value {number} - Value at the point (eg aggregated bucket value) * @property count {number} - Number of contributors to the value at the point (eg number of rows in a bucket) - * @property data {H.datalens.HeatmapLayer.Row} - Reference to source data row + * @property data {datalens.HeatmapLayer.Row} - Reference to source data row */ interface TilePoint { x: number; y: number; value: number; count: number; - data?: H.datalens.HeatmapLayer.Row; + data?: datalens.HeatmapLayer.Row; } /** @@ -596,39 +596,39 @@ declare namespace H { /** * Presents data as points or spatial map objects with data-driven styles and client-side clustering. - * Applicable for drawing interactive map objects like markers, polygons, circles and other instances of H.map.Object. Source of data can be either tiled or not tiled. + * Applicable for drawing interactive map objects like markers, polygons, circles and other instances of map.Object. Source of data can be either tiled or not tiled. * Styles for objects can be parametrized with data rows and zoom level. Allows to create data-driven icons for markers like donuts or bars. * Also enables clustering and data domains for visualizing up to 100k points or more. */ - class ObjectLayer extends H.map.layer.ObjectLayer { + class ObjectLayer extends map.layer.ObjectLayer { /** * Constructor - * @param provider {H.map.provider.RemoteTileProvider | H.datalens.Provider | H.datalens.QueryProvider | H.datalens.QueryTileProvider} - Data source (tiled or not) - * @param options {H.datalens.ObjectLayer.Options} - Defines data processing, clustering and data-driven styling + * @param provider {map.provider.RemoteTileProvider | datalens.Provider | datalens.QueryProvider | datalens.QueryTileProvider} - Data source (tiled or not) + * @param options {datalens.ObjectLayer.Options} - Defines data processing, clustering and data-driven styling */ - constructor(provider: H.map.provider.RemoteTileProvider | H.datalens.Provider | H.datalens.QueryProvider | H.datalens.QueryTileProvider, options: H.datalens.ObjectLayer.Options); + constructor(provider: map.provider.RemoteTileProvider | datalens.Provider | datalens.QueryProvider | datalens.QueryTileProvider, options: datalens.ObjectLayer.Options); /** * Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names. - * @property data {H.datalens.Service.Data} - * @returns {Array} + * @property data {datalens.Service.Data} + * @returns {Array} */ - static defaultDataToRows(data: H.datalens.Service.Data): H.datalens.ObjectLayer.Row[]; + static defaultDataToRows(data: datalens.Service.Data): datalens.ObjectLayer.Row[]; /** * A factory method for data-driven icons. The method allows you to build an icon from SVG markup or JsonML object. Provides caching of icons with the same markup. * @param svg {string | Array} - SVG presented as markup or JsonML Array - * @param options {H.map.Icon.Options=} - Icon options (eg size and anchor). Note that the default anchor is in the middle. + * @param options {map.Icon.Options=} - Icon options (eg size and anchor). Note that the default anchor is in the middle. * @param options.size {H.math.ISize | number} - When the icon is a square, you can define the size as a number in pixels - * @returns {H.map.Icon} - Icon which can be used for marker or cluster + * @returns {map.Icon} - Icon which can be used for marker or cluster */ - static createIcon(svg: string | any[], options?: H.map.Icon.Options): H.map.Icon; + static createIcon(svg: string | any[], options?: map.Icon.Options): map.Icon; /** * Returns cache of icons created with the createIcon method. Can be used to clean the icon cache. - * @return {H.util.Cache} - Icon cache + * @return {util.Cache} - Icon cache */ - static getIconCache(): H.util.Cache; + static getIconCache(): util.Cache; /** * Force re-rendering of the layer. In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering. @@ -637,31 +637,31 @@ declare namespace H { /** * Recalculates the style and applies it to the map object based on the new StyleState - * @param object {H.map.Object} - Map object - * @param state {H.datalens.ObjectLayer.StyleState} - New state + * @param object {map.Object} - Map object + * @param state {datalens.ObjectLayer.StyleState} - New state */ - updateObjectStyle(any: H.map.Object, state: H.datalens.ObjectLayer.StyleState): void; + updateObjectStyle(any: map.Object, state: datalens.ObjectLayer.StyleState): void; } namespace ObjectLayer { /** * Defines data processing and data-driven styling for ObjectLayer * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. - * By default this step is processed with H.datalens.ObjectLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * By default this step is processed with datalens.ObjectLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. * In the next step each row must be presented as a map object with the rowToMapObject callback. Data-driven styling can be provided with the rowToStyle callback. - * @property dataToRows {function(H.datalens.Service.Data)=} - Defines how the input data is split by rows. You can specify this callback to define client-side aggregation and filtering. - * @property rowToMapObject {function(H.datalens.ObjectLayer.Row, H.datalens.QueryTileProvider.Zoom)} - Defines how each row is presented on the map (eg marker, polygon) - * @property rowToStyle {function(H.datalens.ObjectLayer.Row, H.datalens.QueryTileProvider.Zoom, H.datalens.ObjectLayer.StyleState)=} - + * @property dataToRows {function(datalens.Service.Data)=} - Defines how the input data is split by rows. You can specify this callback to define client-side aggregation and filtering. + * @property rowToMapObject {function(datalens.ObjectLayer.Row, datalens.QueryTileProvider.Zoom)} - Defines how each row is presented on the map (eg marker, polygon) + * @property rowToStyle {function(datalens.ObjectLayer.Row, datalens.QueryTileProvider.Zoom, datalens.ObjectLayer.StyleState)=} - * Defines map object style and icon according to data row and zoom level. Also it can define different styles depending on the StyleState (eg hovered, selected). - * @property dataDomains {H.datalens.ObjectLayer.DataDomains=} - Defines quantization of data for improving data-driven styling performance - * @property clustering {H.datalens.ObjectLayer.Clustering=} - When present, client-side clustering is applied + * @property dataDomains {datalens.ObjectLayer.DataDomains=} - Defines quantization of data for improving data-driven styling performance + * @property clustering {datalens.ObjectLayer.Clustering=} - When present, client-side clustering is applied */ interface Options { - dataToRows?(data: H.datalens.Service.Data): H.datalens.ObjectLayer.Row[]; - rowToMapObject(row: H.datalens.ObjectLayer.Row, z: H.datalens.QueryTileProvider.Zoom): H.map.Object; - rowToStyle?(row: H.datalens.ObjectLayer.Row, z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.ObjectLayer.StyleState): H.datalens.ObjectLayer.ObjectStyleOptions; - dataDomains?: H.datalens.ObjectLayer.DataDomains; - clustering?: H.datalens.ObjectLayer.Clustering; + dataToRows?(data: datalens.Service.Data): datalens.ObjectLayer.Row[]; + rowToMapObject(row: datalens.ObjectLayer.Row, z: datalens.QueryTileProvider.Zoom): map.Object; + rowToStyle?(row: datalens.ObjectLayer.Row, z: datalens.QueryTileProvider.Zoom, styleState: datalens.ObjectLayer.StyleState): datalens.ObjectLayer.ObjectStyleOptions; + dataDomains?: datalens.ObjectLayer.DataDomains; + clustering?: datalens.ObjectLayer.Clustering; } /** @@ -669,12 +669,12 @@ declare namespace H { * When the clustering option is provided, rows returned from dataToRows go to the clustering.rowToDataPoint callback to be transformed to data points. * Then, the data points are clustered according to clustering.options. Clustering produces clusters and noise points (data points that are not clustered). * Clusters and noise points must be presented as map objects with the rowToMapObject callback and can be styled with the rowToStyle callback. - * @property rowToDataPoint {H.datalens.ObjectLayer.Row} - Defines data points from rows - * @property options {function(H.datalens.QueryTileProvider.Zoom)} - Defines clustering options as a function of the zoom level + * @property rowToDataPoint {datalens.ObjectLayer.Row} - Defines data points from rows + * @property options {function(datalens.QueryTileProvider.Zoom)} - Defines clustering options as a function of the zoom level */ interface Clustering { - rowToDataPoint(row: H.datalens.ObjectLayer.Row): H.clustering.DataPoint; - options(zoom: H.datalens.QueryTileProvider.Zoom): H.clustering.Provider.ClusteringOptions; + rowToDataPoint(row: datalens.ObjectLayer.Row): clustering.DataPoint; + options(zoom: datalens.QueryTileProvider.Zoom): clustering.Provider.ClusteringOptions; } /** @@ -683,7 +683,7 @@ declare namespace H { * This representation can be changed with the dataToRows callback. */ interface Row { - getPosition(): H.geo.Point; + getPosition(): geo.Point; isCluster(): boolean; lat: number; lng: number; @@ -698,21 +698,21 @@ declare namespace H { /** * Output from the rowToStyle callback. * Defines the styles or the icon that is applied to the map object. - * @property icon {H.map.Icon} - Marker icon - * @property style {H.map.SpatialStyle.Options} - Spatial style - * @property arrows {H.map.ArrowStyle.Options} - Style of arrows to render along a polyline + * @property icon {map.Icon} - Marker icon + * @property style {map.SpatialStyle.Options} - Spatial style + * @property arrows {map.ArrowStyle.Options} - Style of arrows to render along a polyline * @property zIndex {number} - The z-index value of the map object, default is 0 */ interface ObjectStyleOptions { - icon: H.map.Icon; - style?: H.map.SpatialStyle.Options; - arrows?: H.map.ArrowStyle.Options; + icon: map.Icon; + style?: map.SpatialStyle.Options; + arrows?: map.ArrowStyle.Options; zIndex?: number; } /** * Input data quantization domain, used to optimize styling performance. - * The option must have properties corresponding to the properties of H.datalens.ObjectLayer.Row. Values must be represented as an Array of Numbers that defines the quantization domain. + * The option must have properties corresponding to the properties of datalens.ObjectLayer.Row. Values must be represented as an Array of Numbers that defines the quantization domain. * When provided, the input data will be quantized, and rowToStyle will be called only for quantized values. */ type DataDomains = any; @@ -722,12 +722,12 @@ declare namespace H { * Defines how to load data from a raw data file * This provider defines the interface for loading data, such as geometries or coordinates, from a local or remote data file in GeoJSON or CSV format */ - class RawDataProvider extends H.map.provider.RemoteTileProvider { + class RawDataProvider extends map.provider.RemoteTileProvider { /** * Constructor - * @param options {H.datalens.RawDataProvider.Options} - Configures options + * @param options {datalens.RawDataProvider.Options} - Configures options */ - constructor(options: H.datalens.RawDataProvider.Options); + constructor(options: datalens.RawDataProvider.Options); /** * Updates the data url. Note that new data will be fetched only after the reload method is called. @@ -742,15 +742,15 @@ declare namespace H { * Options for RawDataProvider * @property dataUrl - The data url to fetch * @property dataToFeatures {function(any)=} - Defines how the input data is mapped to an array of GeoJSON features - * @property featuresToRows {function(Array, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom, - * H.datalens.RawDataProvider.TileSize, H.datalens.RawDataProvider.Helpers)=} - + * @property featuresToRows {function(Array, datalens.QueryTileProvider.X, datalens.QueryTileProvider.Y, datalens.QueryTileProvider.Zoom, + * datalens.RawDataProvider.TileSize, datalens.RawDataProvider.Helpers)=} - * Defines how GeoJSON features on a tile should be mapped to data rows, which are inputs to layers such as ObjectLayer and HeatmapLayer */ interface Options { dataUrl?: string; - dataToFeatures?(obj: any): H.datalens.RawDataProvider.Feature[]; - featuresToRows?(features: H.datalens.RawDataProvider.Feature[], x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom, - tileSize: H.datalens.RawDataProvider.TileSize, helpers: H.datalens.RawDataProvider.Helpers): H.datalens.ObjectLayer.Row[]; + dataToFeatures?(obj: any): datalens.RawDataProvider.Feature[]; + featuresToRows?(features: datalens.RawDataProvider.Feature[], x: datalens.QueryTileProvider.X, y: datalens.QueryTileProvider.Y, z: datalens.QueryTileProvider.Zoom, + tileSize: datalens.RawDataProvider.TileSize, helpers: datalens.RawDataProvider.Helpers): datalens.ObjectLayer.Row[]; } /** @@ -768,17 +768,17 @@ declare namespace H { /** * A helper class used in the worker thread * This helper class provides convenience functions you can use in the worker thread - * @property latLngToPixel {function(H.datalens.RawDataProvider.Latitude, H.datalens.RawDataProvider.Longitude, H.datalens.QueryTileProvider.Zoom, H.datalens.RawDataProvider.TileSize)=} - + * @property latLngToPixel {function(datalens.RawDataProvider.Latitude, datalens.RawDataProvider.Longitude, datalens.QueryTileProvider.Zoom, datalens.RawDataProvider.TileSize)=} - * Translates geographical coordinates (latitude, longitude) to world pixel coordinates. - * @property pixelToLatLng {function(H.datalens.RawDataProvider.PX, H.datalens.RawDataProvider.PY, H.datalens.QueryTileProvider.Zoom, H.datalens.RawDataProvider.TileSize)=} - + * @property pixelToLatLng {function(datalens.RawDataProvider.PX, datalens.RawDataProvider.PY, datalens.QueryTileProvider.Zoom, datalens.RawDataProvider.TileSize)=} - * Translates world pixel coordinates to geographical coordinates (latitude, longitude). * @property parseCSV {function(any)=} - Takes CSV data as input, parses it, and return the parsed result. */ interface Helpers { - latLngToPixel?(latitude: H.datalens.RawDataProvider.Latitude, longitude: H.datalens.RawDataProvider.Longitude, z: H.datalens.QueryTileProvider.Zoom, - tileSize: H.datalens.RawDataProvider.TileSize): H.datalens.RawDataProvider.PixelCoordinates; - pixelToLatLng?(x: H.datalens.RawDataProvider.PX, y: H.datalens.RawDataProvider.PY, z: H.datalens.QueryTileProvider.Zoom, tileSize: H.datalens.RawDataProvider.TileSize): - H.datalens.RawDataProvider.GeoCoordinates; + latLngToPixel?(latitude: datalens.RawDataProvider.Latitude, longitude: datalens.RawDataProvider.Longitude, z: datalens.QueryTileProvider.Zoom, + tileSize: datalens.RawDataProvider.TileSize): datalens.RawDataProvider.PixelCoordinates; + pixelToLatLng?(x: datalens.RawDataProvider.PX, y: datalens.RawDataProvider.PY, z: datalens.QueryTileProvider.Zoom, tileSize: datalens.RawDataProvider.TileSize): + datalens.RawDataProvider.GeoCoordinates; parseCSV?(obj: any): any[]; } @@ -823,14 +823,14 @@ declare namespace H { * Renders vector tiles using data-driven styles * This layer binds the spatial data and user data, all provided by the Data Lens REST API. The layer renders geometry features using data-driven styles. */ - class SpatialLayer extends H.map.layer.TileLayer { + class SpatialLayer extends map.layer.TileLayer { /** * Constructor - * @param dataProvider {H.datalens.Provider} - Source of tiled data (pass in null if data come from feature properties) - * @param spatialProvider {H.datalens.SpatialTileProvider} - Source of geometry data - * @param options {H.datalens.SpatialLayer.Options} - Configuration for data processing and rendering + * @param dataProvider {datalens.Provider} - Source of tiled data (pass in null if data come from feature properties) + * @param spatialProvider {datalens.SpatialTileProvider} - Source of geometry data + * @param options {datalens.SpatialLayer.Options} - Configuration for data processing and rendering */ - constructor(dataProvider: H.datalens.Provider, spatialProvider: H.datalens.SpatialTileProvider, options: H.datalens.SpatialLayer.Options); + constructor(dataProvider: datalens.Provider, spatialProvider: datalens.SpatialTileProvider, options: datalens.SpatialLayer.Options); static DEFAULT_STATE: any; static Spatial: any; @@ -847,36 +847,36 @@ declare namespace H { /** * This method changes the state of a map object; for example, style on mouse event. - * @param {H.map.Object} spatial - * @param {H.datalens.SpatialLayer.StyleState} state + * @param {map.Object} spatial + * @param {datalens.SpatialLayer.StyleState} state */ - updateSpatialStyle(spatial: H.map.Object, state: H.datalens.SpatialLayer.StyleState): void; + updateSpatialStyle(spatial: map.Object, state: datalens.SpatialLayer.StyleState): void; } namespace SpatialLayer { /** * Defines data processing and rendering options for SpatialLayer * The initial step of rendering is to split the tile data by rows, where each row represents a bucket. - * By default this step is processed with H.datalens.SpatialLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. - * @property dataToRows {function(H.datalens.Service.Data, H.datalens.QueryTileProvider.X, H.datalens.QueryTileProvider.Y, H.datalens.QueryTileProvider.Zoom)=} - + * By default this step is processed with datalens.SpatialLayer.defaultDataToRows. This behavior can be changed by defining the dataToRows callback. + * @property dataToRows {function(datalens.Service.Data, datalens.QueryTileProvider.X, datalens.QueryTileProvider.Y, datalens.QueryTileProvider.Zoom)=} - * Defines how the input tile data is split by rows. You can specify this callback to define client-side aggregation and filtering. This callback is called for each tile. - * @property rowToSpatialId {function(H.datalens.SpatialLayer.Row)} - + * @property rowToSpatialId {function(datalens.SpatialLayer.Row)} - * Defines how to get the spatial ID from a data row. This callback is called for each row that is returned from dataToRows. - * @property featureToSpatialId {function(H.datalens.SpatialLayer.Feature)} - + * @property featureToSpatialId {function(datalens.SpatialLayer.Feature)} - * Defines how to get the spatial ID from a geometry feature. This callback is called for each geometry feature in the vector tile. - * @property rowToStyle {function(H.datalens.SpatialLayer.Row, H.datalens.QueryTileProvider.Zoom, H.datalens.SpatialLayer.StyleState)} - + * @property rowToStyle {function(datalens.SpatialLayer.Row, datalens.QueryTileProvider.Zoom, datalens.SpatialLayer.StyleState)} - * Defines how the row is translated to map object style. This callback is called for each row that is returned from dataToRows. - * @property defaultStyle {function(H.datalens.QueryTileProvider.Zoom, H.datalens.SpatialLayer.StyleState)} - Defines the default map object style. - * @property transformFeature {H.datalens.SpatialLayer.transformFeature} - Defines how to transform the features. + * @property defaultStyle {function(datalens.QueryTileProvider.Zoom, datalens.SpatialLayer.StyleState)} - Defines the default map object style. + * @property transformFeature {datalens.SpatialLayer.transformFeature} - Defines how to transform the features. */ interface Options { - dataToRows?(data: H.datalens.Service.Data, x: H.datalens.QueryTileProvider.X, y: H.datalens.QueryTileProvider.Y, z: H.datalens.QueryTileProvider.Zoom): - H.datalens.SpatialLayer.Row[]; - rowToSpatialId(row: H.datalens.SpatialLayer.Row): string; - featureToSpatialId(feature: H.datalens.SpatialLayer.Feature): string; - rowToStyle(row: H.datalens.SpatialLayer.Row, z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.SpatialLayer.StyleState): any; - defaultStyle(z: H.datalens.QueryTileProvider.Zoom, styleState: H.datalens.SpatialLayer.StyleState): any; - transformFeature: H.datalens.SpatialLayer.transformFeature; + dataToRows?(data: datalens.Service.Data, x: datalens.QueryTileProvider.X, y: datalens.QueryTileProvider.Y, z: datalens.QueryTileProvider.Zoom): + datalens.SpatialLayer.Row[]; + rowToSpatialId(row: datalens.SpatialLayer.Row): string; + featureToSpatialId(feature: datalens.SpatialLayer.Feature): string; + rowToStyle(row: datalens.SpatialLayer.Row, z: datalens.QueryTileProvider.Zoom, styleState: datalens.SpatialLayer.StyleState): any; + defaultStyle(z: datalens.QueryTileProvider.Zoom, styleState: datalens.SpatialLayer.StyleState): any; + transformFeature: datalens.SpatialLayer.transformFeature; } /** @@ -908,13 +908,13 @@ declare namespace H { * This provider defines the interface for accessing shape layers via the Data Lens REST API. The input data is provided as vector tiles in the MapBox format (Protobuf). * Data is loaded by tiles. */ - class SpatialTileProvider extends H.map.provider.RemoteTileProvider { + class SpatialTileProvider extends map.provider.RemoteTileProvider { /** * Constructor - * @param service {H.datalens.Service} - Data Lens REST API service - * @param options {H.datalens.SpatialTileProvider.Options} - Configures layer name + * @param service {datalens.Service} - Data Lens REST API service + * @param options {datalens.SpatialTileProvider.Options} - Configures layer name */ - constructor(service: H.datalens.Service, options: H.datalens.SpatialTileProvider.Options); + constructor(service: datalens.Service, options: datalens.SpatialTileProvider.Options); static VectorTile: any; @@ -934,8 +934,8 @@ declare namespace H { namespace SpatialTileProvider { /** - * Defines layer name and data accessibility parameters for H.datalens.SpatialTileProvider - * This defines the layer name and dynamic parameters required for fetching tiled geometry data with the Data Lens REST API. Other options from H.datalens.Provider.Options are available. + * Defines layer name and data accessibility parameters for datalens.SpatialTileProvider + * This defines the layer name and dynamic parameters required for fetching tiled geometry data with the Data Lens REST API. Other options from datalens.Provider.Options are available. * @property layerName {string} - The name of the layer to fetch with the Data Lens REST API query * @property queryParams {any} - The query's dynamic parameters. The dynamic parameters can be used to filter data provided by the query. */ diff --git a/types/heremaps/heremaps-tests.ts b/types/heremaps/heremaps-tests.ts index 97a2a82477..9d289ffe6c 100644 --- a/types/heremaps/heremaps-tests.ts +++ b/types/heremaps/heremaps-tests.ts @@ -112,7 +112,7 @@ places.request( }, (response) => { console.log(response); - let items = response.results.items; + const items = response.results.items; places.follow( items[0].href, (resp) => { diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index 89e0992b82..b9382485c4 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -5694,7 +5694,7 @@ declare namespace H { * @param opt_locale {(H.ui.i18n.Localization | string)=} - the language to use (or a full localization object). * @returns {H.ui.UI} - the UI instance configured with the default controls */ - static createDefault(map: H.Map, mapTypes: H.service.Platform.MapTypes | H.service.DefaultLayers, opt_locale?: H.ui.i18n.Localization | string): H.ui.UI; + static createDefault(map: H.Map, mapTypes: H.service.Platform.MapTypes | H.service.DefaultLayers, opt_locale?: H.ui.i18n.Localization | string): H.ui.UI; /** * This method is used to capture the element view diff --git a/types/highcharts/highcharts-more.d.ts b/types/highcharts/highcharts-more.d.ts index 6bd8693409..630dbb5622 100644 --- a/types/highcharts/highcharts-more.d.ts +++ b/types/highcharts/highcharts-more.d.ts @@ -1,6 +1,6 @@ // Type definitions for Highcharts 4.2.6 // Project: http://www.highcharts.com/ -// Definitions by: Maciej Suchecki +// Definitions by: Maciej Suchecki // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as Highcharts from "highcharts"; diff --git a/types/highcharts/highstock.d.ts b/types/highcharts/highstock.d.ts index 4c246478ee..79103b3464 100644 --- a/types/highcharts/highstock.d.ts +++ b/types/highcharts/highstock.d.ts @@ -1,5 +1,6 @@ // Type definitions for Highstock 2.1.5 // Project: http://www.highcharts.com/ + // Definitions by: David Deutsch // Definitions by: Dave Baumann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index f8ae716c13..13ac88f875 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -1,7 +1,7 @@ // Type definitions for Highcharts 5.0.10 // Project: http://www.highcharts.com/ -// Definitions by: Damiano Gambarotto -// Dan Lewi Harkestad +// Definitions by: Damiano Gambarotto +// Dan Lewi Harkestad // Albert Ozimek // Juliën Hanssens // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/highcharts/modules/boost.d.ts b/types/highcharts/modules/boost.d.ts index 1a297c7087..e0a3480f95 100644 --- a/types/highcharts/modules/boost.d.ts +++ b/types/highcharts/modules/boost.d.ts @@ -1,6 +1,6 @@ // Type definitions for Highcharts 4.2.6 (boost module) // Project: http://www.highcharts.com/ -// Definitions by: Daniel Martin +// Definitions by: Daniel Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { Static } from "highcharts"; diff --git a/types/highcharts/modules/exporting.d.ts b/types/highcharts/modules/exporting.d.ts index 8d808c1929..b4b0124a66 100644 --- a/types/highcharts/modules/exporting.d.ts +++ b/types/highcharts/modules/exporting.d.ts @@ -1,6 +1,6 @@ // Type definitions for Highcharts 4.2.6 (exporting module) // Project: http://www.highcharts.com/ -// Definitions by: Maciej Suchecki +// Definitions by: Maciej Suchecki // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { Static } from "highcharts"; diff --git a/types/highcharts/modules/map/index.d.ts b/types/highcharts/modules/map/index.d.ts index fa8c0ed28d..ecf553945b 100644 --- a/types/highcharts/modules/map/index.d.ts +++ b/types/highcharts/modules/map/index.d.ts @@ -8,22 +8,22 @@ import * as geojson from 'geojson'; declare module 'highcharts' { interface Static { - mapChart(renderTo: string | HTMLElement, options: MapOptions, callback?: (chart: highcharts.ChartObject) => void): highcharts.ChartObject; + mapChart(renderTo: string | HTMLElement, options: MapOptions, callback?: (chart: ChartObject) => void): ChartObject; } interface MapOptions { - chart?: highcharts.ChartOptions; - legend?: highcharts.LegendOptions; + chart?: ChartOptions; + legend?: LegendOptions; mapNavigation?: Navigation; - plotOptions?: highcharts.PlotOptions; + plotOptions?: PlotOptions; series?: MapSeriesOptions[]; colorAxis?: ColorAxis; - title?: highcharts.TitleOptions; - tooltip?: highcharts.TooltipOptions; + title?: TitleOptions; + tooltip?: TooltipOptions; } interface MapSeriesOptions { - data?: number[] | Array<[number, number]> | Array<[string, number]> | highcharts.DataPoint[]; + data?: number[] | Array<[number, number]> | Array<[string, number]> | DataPoint[]; dataLabels?: MapSeriesOptionsDataLabels; diff --git a/types/highcharts/modules/no-data-to-display.d.ts b/types/highcharts/modules/no-data-to-display.d.ts index f807860838..a842eee5f0 100644 --- a/types/highcharts/modules/no-data-to-display.d.ts +++ b/types/highcharts/modules/no-data-to-display.d.ts @@ -1,6 +1,6 @@ // Type definitions for Highcharts No Data to Display 4.2.7 // Project: http://www.highcharts.com/ -// Definitions by: Andrey Zolotin , Rowell Heria +// Definitions by: Andrey Zolotin , Rowell Heria // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { Static } from "highcharts"; diff --git a/types/highcharts/modules/offline-exporting.d.ts b/types/highcharts/modules/offline-exporting.d.ts index 5b58f65c46..ee38e1c91b 100644 --- a/types/highcharts/modules/offline-exporting.d.ts +++ b/types/highcharts/modules/offline-exporting.d.ts @@ -1,6 +1,6 @@ // Type definitions for Highcharts 4.2.6 (offline exporting module) // Project: http://www.highcharts.com/ -// Definitions by: Daniel Martin +// Definitions by: Daniel Martin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import { Static } from "highcharts"; diff --git a/types/highcharts/test/index.ts b/types/highcharts/test/index.ts index a17ee094c2..c1dfdc6e31 100644 --- a/types/highcharts/test/index.ts +++ b/types/highcharts/test/index.ts @@ -1447,7 +1447,7 @@ function test_Column() { function test_ColumnCrispFalse() { // conform example: http://jsfiddle.net/gh/get/jquery/3.1.1/highslide-software/highcharts.com/tree/master/samples/highcharts/plotoptions/column-crisp-false/ const numbers = () => { - let arr = []; + const arr = []; for (let i = 0; i < 100; i++) { arr.push(i); } @@ -2152,7 +2152,7 @@ function test_AccessibilityOptions() { function test_AddAndUpdateCredits() { // example based on: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/credits/credits-update/ - let chart = new Highcharts.Chart({ + const chart = new Highcharts.Chart({ title: { text: 'Credits update' }, @@ -2495,7 +2495,7 @@ function test_ElementObject() { function test_NumericSymbolMagnitude() { // conform example: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/lang/numericsymbolmagnitude/ - let chart = new Highcharts.Chart({ + const chart = new Highcharts.Chart({ title: { text: 'Numeric symbols magnitude' }, @@ -2580,7 +2580,7 @@ function test_RendererObject() { function test_ResponsiveOptions() { const responsiveOptions: Highcharts.ResponsiveOptions = { - rules: [ + rules: [ { chartOptions: { description: 'just a test' @@ -2682,7 +2682,7 @@ function test_SeriesDataLabel() { function test_SoftMinSoftMax() { // conform example: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/yaxis/softmin-softmax/ - let chart: Highcharts.ChartObject = new Highcharts.Chart({ + const chart: Highcharts.ChartObject = new Highcharts.Chart({ title: { text: 'Y axis softMax is 100' }, @@ -2750,7 +2750,7 @@ function test_TitleUpdate() { // conform example: http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/members/title-update/ let i = 1; - let chart = new Highcharts.Chart({ + const chart = new Highcharts.Chart({ subtitle: { text: 'Subtitle' }, diff --git a/types/highland/index.d.ts b/types/highland/index.d.ts index 6a3532baca..0d9aedb609 100644 --- a/types/highland/index.d.ts +++ b/types/highland/index.d.ts @@ -18,7 +18,7 @@ * Highland: the high-level streams library * * Highland may be freely distributed under the Apache 2.0 license. - * http://github.com/caolan/highland + * https://github.com/caolan/highland * Copyright (c) Caolan McMahon * */ diff --git a/types/hiredis/index.d.ts b/types/hiredis/index.d.ts index 727e4f4a03..97a3f8d98c 100644 --- a/types/hiredis/index.d.ts +++ b/types/hiredis/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for hiredis 0.5 -// Project: http://github.com/redis/hiredis-node +// Project: https://github.com/redis/hiredis-node // Definitions by: Titan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts b/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts new file mode 100644 index 0000000000..c8adb26d1a --- /dev/null +++ b/types/htmlbars-inline-precompile/htmlbars-inline-precompile-tests.ts @@ -0,0 +1,5 @@ +import hbs from 'htmlbars-inline-precompile'; + +const likeThisDotRender = (s: string | string[]) => {}; + +likeThisDotRender(hbs`this is allowed`); diff --git a/types/htmlbars-inline-precompile/index.d.ts b/types/htmlbars-inline-precompile/index.d.ts new file mode 100644 index 0000000000..ab4bf9a1b7 --- /dev/null +++ b/types/htmlbars-inline-precompile/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for htmlbars-inline-precompile 1.0 +// Project: https://github.com/ember-cli/ember-cli-htmlbars-inline-precompile +// Definitions by: Chris Krycho +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// This is a bit of a funky one: it's from a [Babel plugin], but is exported for +// Ember applications as the module `"htmlbars-inline-precompile"`. It acts +// like a tagged string from the perspective of consumers, but is actually an +// AST transformation which generates a function as its output. That function in +// turn [generates a string or array of strings][output] to use with the Ember +// testing helper `this.render()`. +// +// [Babel plugin]: https://github.com/ember-cli/babel-plugin-htmlbars-inline-precompile#babel-plugin-htmlbars-inline-precompile- +// [output]: https://github.com/emberjs/ember-test-helpers/blob/77f9a53da9d8c19a85b3122788caadbcc59274c2/lib/ember-test-helpers/-legacy-overrides.js#L17-L42 + +export default function hbs(tagged: TemplateStringsArray): string | string[]; diff --git a/types/htmlbars-inline-precompile/tsconfig.json b/types/htmlbars-inline-precompile/tsconfig.json new file mode 100644 index 0000000000..32ad3d22fb --- /dev/null +++ b/types/htmlbars-inline-precompile/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", + "htmlbars-inline-precompile-tests.ts" + ] +} diff --git a/types/htmlbars-inline-precompile/tslint.json b/types/htmlbars-inline-precompile/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/htmlbars-inline-precompile/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/http-errors/http-errors-tests.ts b/types/http-errors/http-errors-tests.ts index 51017828a1..cfe399de9e 100644 --- a/types/http-errors/http-errors-tests.ts +++ b/types/http-errors/http-errors-tests.ts @@ -1,86 +1,115 @@ - -import * as createError from 'http-errors'; +import * as create from 'http-errors'; import * as express from 'express'; +import * as util from 'util'; -var app = express(); +const app = express(); -declare global { - namespace Express { - export interface Request { - user?: any - } - } -} - -app.use(function (req, res, next) { - if (!req.user) return next(createError(401, 'Please login to view this page.')); +app.use((req, res, next) => { + if (!req) return next(create('Please login to view this page.', 401)); next(); }); -/* Examples taken from https://github.com/jshttp/http-errors/blob/1.3.1/test/test.js */ +/* Examples taken from https://github.com/jshttp/http-errors/blob/1.6.2/test/test.js */ -// createError(status) -var err = createError(404); -console.log(err.name); -console.log(err.message); -console.log(err.status); -console.log(err.statusCode); -console.log(err.expose); -console.log(err.headers); +// create(status) +let err = create(404); +err; // $ExpectType HttpError +err.name; // $ExpectType string +err.message; // $ExpectType string +err.status; // $ExpectType number +err.statusCode; // $ExpectType number +err.expose; // $ExpectType boolean +err.headers; // $ExpectType { [key: string]: string; } | undefined -// createError(status, msg) -var err = createError(404, 'LOL'); +// create(status, msg) +err = create(404, 'LOL'); -// createError(status, props) -var err = createError(404, {id: 1}); +// create(status, props) +err = create(404, {id: 1}); -// createError(props) -var err = createError({id: 1}); -console.log(( err).id); +// create(status, props) with status prop +err = create(404, { + id: 1, + status: 500 +}); -// createError(msg, status) -var err = createError('LOL', 404); +// create(status, props) with statusCode prop +err = create(404, { + id: 1, + statusCode: 500 +}); -// createError(msg) -var err = createError('LOL'); +// create(props) +err = create({id: 1}); +// $ExpectType any +err.id; -// createError(msg, props) -var err = createError('LOL', {id: 1}); +// create(msg, status) +err = create('LOL', 404); -// createError(err) -var err = createError(new Error('LOL')); +// create(msg) +err = create('LOL'); -// createError(err, props) -var err = createError(new Error('LOL'), {id: 1}); +// create(msg, props) +err = create('LOL', {id: 1}); -// createError(status, err, props) -var err = createError(404, new Error('LOL'), {id: 1}); +// create(err) +err = create(new Error('LOL')); -// createError(status, msg, props) -var err = createError(404, 'LOL', {id: 1}); +// create(err, props) +err = create(new Error('LOL'), {id: 1}); -// createError(status, msg, { expose: false }) -var err = createError(404, 'LOL', {expose: false}) +// create(status, err, props) +err = create(404, new Error('LOL'), {id: 1}); -// new createError.NotFound() -var err = new createError.NotFound(); +// create(status, msg, props) +err = create(404, 'LOL', {id: 1}); -// new createError.InternalServerError() -var err = new createError.InternalServerError(); +// create(status, msg, { expose: false }) +err = create(404, 'LOL', {expose: false}); -// new createError['404']() -var err = new createError['404'](); +// new create.HttpError() should throw: cannot construct abstract class +// $ExpectType never +new create.HttpError(); -//createError['404'](); // TypeScript should fail with "Did you mean to include 'new'?" -//new createError(); // TypeScript should fail with "Only a void function can be called with the 'new' keyword" +err = new create.NotFound(); +err = new create.InternalServerError(); +err = new create[404](); +err = new create['404'](); + +create['404'](); // $ExpectError +new create(); // $ExpectError // Error messages can have custom messages -var err = new createError.NotFound('This might be a problem'); -var err = new createError['404']('This might be a problem'); +err = new create.NotFound('This might be a problem'); +err = new create[404]('This might be a problem'); // 1.5.0 supports 421 - Misdirected Request -var err = new createError.MisdirectedRequest(); -var err = new createError.MisdirectedRequest('Where should this go?'); +err = new create.MisdirectedRequest(); +err = new create.MisdirectedRequest('Where should this go?'); -let error: createError.HttpError; -console.log(error instanceof createError.HttpError); +// $ExpectType boolean +new Error() instanceof create.HttpError; + +// should support err instanceof Error +create(404) instanceof Error; +(new create['404']()) instanceof Error; +(new create['500']()) instanceof Error; + +// should support err instanceof exposed constructor +create(404) instanceof create.NotFound; +create(500) instanceof create.InternalServerError; +(new create['404']()) instanceof create.NotFound; +(new create['500']()) instanceof create.InternalServerError; +(new create.NotFound()) instanceof create.NotFound; +(new create.InternalServerError()) instanceof create.InternalServerError; + +// should support err instanceof HttpError +create(404) instanceof create.HttpError; +(new create['404']()) instanceof create.HttpError; +(new create['500']()) instanceof create.HttpError; + +// should support util.isError() +util.isError(create(404)); +util.isError(new create['404']()); +util.isError(new create['500']()); diff --git a/types/http-errors/index.d.ts b/types/http-errors/index.d.ts index aff5b312dd..5db6e497e7 100644 --- a/types/http-errors/index.d.ts +++ b/types/http-errors/index.d.ts @@ -1,97 +1,112 @@ -// Type definitions for http-errors v1.5.0 +// Type definitions for http-errors 1.6 // Project: https://github.com/jshttp/http-errors // Definitions by: Tanguy Krotoff +// BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -declare module 'http-errors' { - namespace createHttpError { +export = createHttpError; - // See https://github.com/jshttp/http-errors/blob/1.3.1/index.js#L42 - interface HttpError extends Error { - status: number; - statusCode: number; - expose: boolean; - headers?: { - [key: string]: string - }; - } +declare const createHttpError: createHttpError.CreateHttpError & createHttpError.NamedConstructors; - type HttpErrorConstructor = new(msg?: string) => HttpError; - - interface CreateHttpError { - // See https://github.com/Microsoft/TypeScript/issues/227#issuecomment-50092674 - [code: string]: new (msg?: string) => HttpError; - - (...args: Array): HttpError; - - HttpError: HttpErrorConstructor; - - Continue: HttpErrorConstructor; - SwitchingProtocols: HttpErrorConstructor; - Processing: HttpErrorConstructor; - OK: HttpErrorConstructor; - Created: HttpErrorConstructor; - Accepted: HttpErrorConstructor; - NonAuthoritativeInformation: HttpErrorConstructor; - NoContent: HttpErrorConstructor; - ResetContent: HttpErrorConstructor; - PartialContent: HttpErrorConstructor; - MultiStatus: HttpErrorConstructor; - AlreadyReported: HttpErrorConstructor; - IMUsed: HttpErrorConstructor; - MultipleChoices: HttpErrorConstructor; - MovedPermanently: HttpErrorConstructor; - Found: HttpErrorConstructor; - SeeOther: HttpErrorConstructor; - NotModified: HttpErrorConstructor; - UseProxy: HttpErrorConstructor; - Unused: HttpErrorConstructor; - TemporaryRedirect: HttpErrorConstructor; - PermanentRedirect: HttpErrorConstructor; - BadRequest: HttpErrorConstructor; - Unauthorized: HttpErrorConstructor; - PaymentRequired: HttpErrorConstructor; - Forbidden: HttpErrorConstructor; - NotFound: HttpErrorConstructor; - MethodNotAllowed: HttpErrorConstructor; - NotAcceptable: HttpErrorConstructor; - ProxyAuthenticationRequired: HttpErrorConstructor; - RequestTimeout: HttpErrorConstructor; - Conflict: HttpErrorConstructor; - Gone: HttpErrorConstructor; - LengthRequired: HttpErrorConstructor; - PreconditionFailed: HttpErrorConstructor; - PayloadTooLarge: HttpErrorConstructor; - URITooLong: HttpErrorConstructor; - UnsupportedMediaType: HttpErrorConstructor; - RangeNotSatisfiable: HttpErrorConstructor; - ExpectationFailed: HttpErrorConstructor; - ImATeapot: HttpErrorConstructor; - MisdirectedRequest: HttpErrorConstructor; - UnprocessableEntity: HttpErrorConstructor; - Locked: HttpErrorConstructor; - FailedDependency: HttpErrorConstructor; - UnorderedCollection: HttpErrorConstructor; - UpgradeRequired: HttpErrorConstructor; - PreconditionRequired: HttpErrorConstructor; - TooManyRequests: HttpErrorConstructor; - RequestHeaderFieldsTooLarge: HttpErrorConstructor; - UnavailableForLegalReasons: HttpErrorConstructor; - InternalServerError: HttpErrorConstructor; - NotImplemented: HttpErrorConstructor; - BadGateway: HttpErrorConstructor; - ServiceUnavailable: HttpErrorConstructor; - GatewayTimeout: HttpErrorConstructor; - HTTPVersionNotSupported: HttpErrorConstructor; - VariantAlsoNegotiates: HttpErrorConstructor; - InsufficientStorage: HttpErrorConstructor; - LoopDetected: HttpErrorConstructor; - BandwidthLimitExceeded: HttpErrorConstructor; - NotExtended: HttpErrorConstructor; - NetworkAuthenticationRequired: HttpErrorConstructor; - } +declare namespace createHttpError { + interface HttpError extends Error { + status: number; + statusCode: number; + expose: boolean; + headers?: { + [key: string]: string; + }; + [key: string]: any; } - var createHttpError: createHttpError.CreateHttpError; - export = createHttpError; + type HttpErrorConstructor = new (msg?: string) => HttpError; + + type CreateHttpError = (...args: Array) => HttpError; + + type NamedConstructors = { + [code: string]: HttpErrorConstructor; + HttpError: new (msg?: string) => never; + } & Record<'BadRequest' | + 'Unauthorized' | + 'PaymentRequired' | + 'Forbidden' | + 'NotFound' | + 'MethodNotAllowed' | + 'NotAcceptable' | + 'ProxyAuthenticationRequired' | + 'RequestTimeout' | + 'Conflict' | + 'Gone' | + 'LengthRequired' | + 'PreconditionFailed' | + 'PayloadTooLarge' | + 'URITooLong' | + 'UnsupportedMediaType' | + 'RangeNotSatisfiable' | + 'ExpectationFailed' | + 'ImATeapot' | + 'MisdirectedRequest' | + 'UnprocessableEntity' | + 'Locked' | + 'FailedDependency' | + 'UnorderedCollection' | + 'UpgradeRequired' | + 'PreconditionRequired' | + 'TooManyRequests' | + 'RequestHeaderFieldsTooLarge' | + 'UnavailableForLegalReasons' | + 'InternalServerError' | + 'NotImplemented' | + 'BadGateway' | + 'ServiceUnavailable' | + 'GatewayTimeout' | + 'HTTPVersionNotSupported' | + 'VariantAlsoNegotiates' | + 'InsufficientStorage' | + 'LoopDetected' | + 'BandwidthLimitExceeded' | + 'NotExtended' | + 'NetworkAuthenticationRequire' | + '400' | + '401' | + '402' | + '403' | + '404' | + '405' | + '406' | + '407' | + '408' | + '409' | + '410' | + '411' | + '412' | + '413' | + '414' | + '415' | + '416' | + '417' | + '418' | + '421' | + '422' | + '423' | + '424' | + '425' | + '426' | + '428' | + '429' | + '431' | + '451' | + '500' | + '501' | + '502' | + '503' | + '504' | + '505' | + '506' | + '507' | + '508' | + '509' | + '510' | + '511', HttpErrorConstructor>; } diff --git a/types/http-errors/tsconfig.json b/types/http-errors/tsconfig.json index 7b2948b792..6067e7af56 100644 --- a/types/http-errors/tsconfig.json +++ b/types/http-errors/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,4 +19,4 @@ "index.d.ts", "http-errors-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/http-errors/tslint.json b/types/http-errors/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/http-errors/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/i18n/i18n-tests.ts b/types/i18n/i18n-tests.ts index ac3813c934..8f6deb423c 100644 --- a/types/i18n/i18n-tests.ts +++ b/types/i18n/i18n-tests.ts @@ -9,7 +9,7 @@ import express = require("express"); import i18n = require("i18n"); const app = express(); -let req: express.Request; +declare const req: express.Request; /** * Configuration @@ -98,7 +98,7 @@ i18n.configure({ * Usage in global scope * https://github.com/mashpie/i18n-node#example-usage-in-global-scope */ -let greeting = i18n.__('Hello'); +const greeting = i18n.__('Hello'); /** * Usage in Express @@ -111,7 +111,7 @@ app.configure(() => { }); app.get('/de', (_req: Express.Request, res: Express.Response) => { - let greeting = res.__('Hello'); + const greeting = res.__('Hello'); }); /** diff --git a/types/i18next/i18next-tests.ts b/types/i18next/i18next-tests.ts index ecf5642649..1b5cbaa9cf 100644 --- a/types/i18next/i18next-tests.ts +++ b/types/i18next/i18next-tests.ts @@ -156,7 +156,7 @@ i18next const updateContent2 = () => { const value: string = i18next.t('title', { what: 'i18next' }); const value2: string = i18next.t('common:button.save', { count: Math.floor(Math.random() * 2 + 1) }); - const value3: string = `detected user language: "${i18next.language}" --> loaded languages: "${i18next.languages.join(', ')}"`; + const value3 = `detected user language: "${i18next.language}" --> loaded languages: "${i18next.languages.join(', ')}"`; }; i18next.init({ @@ -424,7 +424,7 @@ i18next.t(["friend", "tree"], { myVar: "someValue" }); const t1: i18next.TranslationFunction = (key: string, options: i18next.TranslationOptions) => ""; const t2: i18next.TranslationFunction<{ value: string }> = (key: string, options: i18next.TranslationOptions) => ({ value: "asd" }); const t3: i18next.TranslationFunction = (key: string | string[], options: i18next.TranslationOptions) => ""; -const t4: i18next.TranslationFunction = (key: KeyList | KeyList[], options: i18next.TranslationOptions) => ""; +const t4: i18next.TranslationFunction = (key: KeyList | KeyList[], options: i18next.TranslationOptions) => ""; i18next.exists("friend"); i18next.exists(["friend", "tree"]); diff --git a/types/iframe-resizer/iframe-resizer-tests.ts b/types/iframe-resizer/iframe-resizer-tests.ts index 186dc2ba47..218a7f71cd 100644 --- a/types/iframe-resizer/iframe-resizer-tests.ts +++ b/types/iframe-resizer/iframe-resizer-tests.ts @@ -1,9 +1,9 @@ import { IFrameComponent, IFrameOptions, iframeResizer } from "iframe-resizer"; function testOne(): void { - let iframe: HTMLIFrameElement = document.createElement('iframe'); - let options: IFrameOptions = {log: true}; - let components: IFrameComponent[] = iframeResizer(options, iframe); + const iframe: HTMLIFrameElement = document.createElement('iframe'); + const options: IFrameOptions = {log: true}; + const components: IFrameComponent[] = iframeResizer(options, iframe); if (components) { components.forEach(component => console.log(component.iFrameResizer)); } else { @@ -12,8 +12,8 @@ function testOne(): void { } function testTwo(): void { - let iframe: HTMLIFrameElement = document.createElement('iframe'); - let components: IFrameComponent[] = iframeResizer({ + const iframe: HTMLIFrameElement = document.createElement('iframe'); + const components: IFrameComponent[] = iframeResizer({ initCallback: () => { console.log('Init'); }, diff --git a/types/ignite-ui/tslint.json b/types/ignite-ui/tslint.json index 344603a3a9..b8160f687d 100644 --- a/types/ignite-ui/tslint.json +++ b/types/ignite-ui/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { + // All are TODOs "array-type": false, "dt-header": false, "ban-types": false, @@ -8,6 +9,7 @@ "no-empty-interface": false, "unified-signatures": false, "max-line-length": false, + "no-mergeable-namespace": false, "whitespace": false } } diff --git a/types/imagemagick/index.d.ts b/types/imagemagick/index.d.ts index e5abea57ef..89d0eeb600 100644 --- a/types/imagemagick/index.d.ts +++ b/types/imagemagick/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for imagemagick -// Project: http://github.com/rsms/node-imagemagick +// Project: https://github.com/rsms/node-imagemagick // Definitions by: Carlos Ballesteros Velasco // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/images/images-tests.ts b/types/images/images-tests.ts index fc5cab619b..f7ba58d68d 100644 --- a/types/images/images-tests.ts +++ b/types/images/images-tests.ts @@ -1,9 +1,9 @@ import * as images from "images"; // from https://github.com/zhangyuanwei/node-images/blob/master/demo/uploadServer.js -let tmp_path = "tmp_path"; -let out_path = "out_path"; -let photo = images(tmp_path); +const tmp_path = "tmp_path"; +const out_path = "out_path"; +const photo = images(tmp_path); photo.size(800) .draw(images('./logo.png'), 800 - 421, photo.height() - 117) diff --git a/types/imgur-rest-api/index.d.ts b/types/imgur-rest-api/index.d.ts index 5d4c483edf..091c3b1db5 100644 --- a/types/imgur-rest-api/index.d.ts +++ b/types/imgur-rest-api/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Imgur REST API 3.0 // Project: https://api.imgur.com/ -// Definitions by: Luke William Westby +// Definitions by: Luke William Westby // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace ImgurRestApi { diff --git a/types/inert/index.d.ts b/types/inert/index.d.ts index 28e4efbe58..1af500c7cf 100644 --- a/types/inert/index.d.ts +++ b/types/inert/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for inert 4.2 // Project: https://github.com/hapijs/inert/ -// Definitions by: Steve Ognibene , AJP +// Definitions by: Steve Ognibene , AJP // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/insight/index.d.ts b/types/insight/index.d.ts index 2dfc147da6..255807a37e 100644 --- a/types/insight/index.d.ts +++ b/types/insight/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for insight 0.4.3 // Project: https://github.com/yeoman/insight -// Definitions by: vvakame +// Definitions by: vvakame // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace insight { diff --git a/types/integer/integer-tests.ts b/types/integer/integer-tests.ts index 2450423ff7..67c9a90975 100644 --- a/types/integer/integer-tests.ts +++ b/types/integer/integer-tests.ts @@ -11,18 +11,18 @@ num0 = num0.add(num0); console.assert(!num0.compare(60)); let num1: Integer.IntClass = Integer.fromBits(0xFF); -let num2: Integer.IntClass = Integer.fromBits(0xFF, 0xFF); +const num2: Integer.IntClass = Integer.fromBits(0xFF, 0xFF); num1 = num1.shl(32); console.assert(!num1.compare(num2)); -let num3: Integer.IntClass = Integer.fromNumber(10); +const num3: Integer.IntClass = Integer.fromNumber(10); let num4: Integer.IntClass = Integer.fromNumber(10, 10); console.assert(!num3.compare(num4)); num4 = Integer.fromNumber(10, num3); console.assert(!num3.compare(num4)); -let num5: Integer.IntClass = Integer.fromString('255'); -let num6: Integer.IntClass = Integer.fromString('ff', 16); +const num5: Integer.IntClass = Integer.fromString('255'); +const num6: Integer.IntClass = Integer.fromString('ff', 16); console.assert(!num5.compare(num6)); let num7: Integer.IntClass = Integer.fromString('ff', 16, '255'); console.assert(!num5.compare(num7)); diff --git a/types/intercomjs/index.d.ts b/types/intercomjs/index.d.ts index 5068059f27..f39e6868a0 100644 --- a/types/intercomjs/index.d.ts +++ b/types/intercomjs/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for intercom.js // Project: https://github.com/diy/intercom.js -// Definitions by: spencerwi +// Definitions by: spencerwi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace intercom { diff --git a/types/intl/index.d.ts b/types/intl/index.d.ts new file mode 100644 index 0000000000..5a20583f99 --- /dev/null +++ b/types/intl/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for intl 1.2 +// Project: https://github.com/andyearnshaw/Intl.js +// Definitions by: Muhammad Ragib Hasin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = Intl; diff --git a/types/intl/intl-tests.ts b/types/intl/intl-tests.ts new file mode 100644 index 0000000000..0f005979f9 --- /dev/null +++ b/types/intl/intl-tests.ts @@ -0,0 +1 @@ +import * as intl from 'intl'; diff --git a/types/intl/tsconfig.json b/types/intl/tsconfig.json new file mode 100644 index 0000000000..520dc3c689 --- /dev/null +++ b/types/intl/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", + "intl-tests.ts" + ] +} diff --git a/types/intl/tslint.json b/types/intl/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/intl/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/is-number/index.d.ts b/types/is-number/index.d.ts new file mode 100644 index 0000000000..27d7328456 --- /dev/null +++ b/types/is-number/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for is-number 3.0 +// Project: https://github.com/jonschlinkert/is-number +// Definitions by: Harry Shipton +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = is_number; + +/** + * Will test to see if the argument is a valid number, excluding Infinity and NaN. + * @param {*} num - Any value that should be tested for being a number + * @returns {boolean} - true if the parameter is a valid number, otherwise false + */ +declare function is_number(num: any): boolean; diff --git a/types/is-number/is-number-tests.ts b/types/is-number/is-number-tests.ts new file mode 100644 index 0000000000..52ecb3d7cd --- /dev/null +++ b/types/is-number/is-number-tests.ts @@ -0,0 +1,13 @@ +/// + +import isNumber from 'is-number'; + +const numberTest: boolean = isNumber(-1.1); +const stringTest: boolean = isNumber('-1.1'); +const arrayTest: boolean = isNumber([]); +const functionTest: boolean = isNumber(() => {}); +const arrayConstructorTest: boolean = isNumber(new Array('abc')); +const bufferTest: boolean = isNumber(Buffer.from('abc')); +const nullTest: boolean = isNumber(null); +const undefinedTest: boolean = isNumber(undefined); +const objectTest: boolean = isNumber({abc: 'abc'}); diff --git a/types/is-number/tsconfig.json b/types/is-number/tsconfig.json new file mode 100644 index 0000000000..25b9ea6910 --- /dev/null +++ b/types/is-number/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "allowSyntheticDefaultImports": true + }, + "files": [ + "index.d.ts", + "is-number-tests.ts" + ] +} diff --git a/types/is-number/tslint.json b/types/is-number/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/is-number/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/jasmine_dom_matchers/index.d.ts b/types/jasmine_dom_matchers/index.d.ts index f463a5ebce..51f2fa035e 100644 --- a/types/jasmine_dom_matchers/index.d.ts +++ b/types/jasmine_dom_matchers/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for jasmine_dom_matchers 1.4 -// Project: http://github.com/charleshansen/jasmine_dom_matchers +// Project: https://github.com/charleshansen/jasmine_dom_matchers // Definitions by: Yaroslav Admin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index 2f303c5e8d..7e5ed2567f 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -5,24 +5,24 @@ declare var require: { requireMock(s: string): any; }; // TODO: use real jquery types? -declare let $: any; +declare const $: any; // Tests based on the Jest website jest.unmock('../sum'); describe('sum', () => { it('adds 1 + 2 to equal 3', () => { - let sum: (a: number, b: number) => number = require('../sum'); + const sum: (a: number, b: number) => number = require('../sum'); expect(sum(1, 2)).toBe(3); }); }); describe('fetchCurrentUser', () => { it('calls the callback when $.ajax requests are finished', () => { - let fetchCurrentUser = require('../fetchCurrentUser'); + const fetchCurrentUser = require('../fetchCurrentUser'); // Create a mock function for our callback - let callback = jest.fn(); + const callback = jest.fn(); fetchCurrentUser(callback); // Now we emulate the process by which `$.ajax` would execute its own @@ -53,9 +53,9 @@ describe('displayUser', () => { '