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",
- "masterCard",
- "privateLabel",
+ "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 ApplePayPaymentRequest 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 ApplePayLineItem dictionary representing the total price for the purchase.
- * @param newLineItems - A sequence of ApplePayLineItem 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 ApplePayLineItem dictionary representing the total price for the purchase.
- * @param newLineItems - A sequence of ApplePayLineItem 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 ApplePayLineItem dictionary representing the total price for the purchase.
- * @param newLineItems - A sequence of ApplePayLineItem 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 ApplePayPaymentAuthorizedEvent 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 supportedNetworks property of the ApplePayPaymentRequest.
+ * 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 ApplePayPaymentMethodSelectedEvent 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 ApplePayShippingContactSelectedEvent 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 ApplePayShippingMethodSelectedEvent 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 ApplePayValidateMerchantEvent 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