Apply stricter lint rules (#19063)

This commit is contained in:
Andy 2017-08-17 14:53:41 -07:00 committed by GitHub
parent 3dfa2b2005
commit 5d6c651a1a
484 changed files with 3388 additions and 3281 deletions

View File

@ -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 + '<br>';
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);
};
}

View File

@ -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<WIA.Property>(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) {

View File

@ -1,6 +1,6 @@
// Type definitions for alertify 0.3.11
// Project: http://fabien-d.github.io/alertify.js/
// Definitions by: John Jeffery <http://github.com/jjeffery>
// Definitions by: John Jeffery <https://github.com/jjeffery>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var alertify: alertify.IAlertifyStatic;

View File

@ -1,13 +1,13 @@
import * as Alexa from "alexa-sdk";
const handler = (event: Alexa.RequestBody<Alexa.Request>, 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<Alexa.Request> = {
const handlers: Alexa.Handlers<Alexa.Request> = {
'LaunchRequest': function() {
this.emit('SayHello');
},

View File

@ -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);
}

View File

@ -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;
}
}
});

View File

@ -1,6 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
"no-empty-interface": false
// All are TODOs
"no-empty-interface": false,
"prefer-const": false
}
}

View File

@ -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();
});

View File

@ -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

View File

@ -1,6 +1,6 @@
// Type definitions for Angular JS (ngCookies module) 1.4
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Anthony Ciccarello <http://github.com/aciccarello>
// Definitions by: Diego Vilar <https://github.com/diegovilar>, Anthony Ciccarello <https://github.com/aciccarello>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

View File

@ -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;
};
}

View File

@ -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;
}
});
});

View File

@ -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<IControllerConstructor>;
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<any>;
show(options: IBottomSheetOptions): IPromise<any>;
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<any>): void;
onShowing?(scope: IScope, element: JQuery): void;
onComplete?(scope: IScope, element: JQuery): void;
onRemoving?(element: JQuery, removePromise: IPromise<any>): void;
skipHide?: boolean;
multiple?: boolean;
fullscreen?: boolean; // default: false
}
interface IDialogService {
show(dialog: IDialogOptions | IAlertDialog | IConfirmDialog | IPromptDialog): angular.IPromise<any>;
show(dialog: IDialogOptions | IAlertDialog | IConfirmDialog | IPromptDialog): IPromise<any>;
confirm(): IConfirmDialog;
alert(): IAlertDialog;
prompt(): IPromptDialog;
hide(response?: any): angular.IPromise<any>;
hide(response?: any): IPromise<any>;
cancel(response?: any): void;
}
type IIcon = (id: string) => angular.IPromise<Element>; // id is a unique ID or URL
type IIcon = (id: string) => IPromise<Element>; // 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<void>;
open(): angular.IPromise<void>;
close(): angular.IPromise<void>;
toggle(): IPromise<void>;
open(): IPromise<void>;
close(): IPromise<void>;
isOpen(): boolean;
isLockedOpen(): boolean;
onClose(onClose: () => void): void;
}
interface ISidenavService {
(component: string, enableWait: boolean): angular.IPromise<ISidenavObject>;
(component: string, enableWait: boolean): IPromise<ISidenavObject>;
(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<any>): angular.IPromise<any>;
showSimple(content: string): angular.IPromise<any>;
show(optionsOrPreset: IToastOptions | IToastPreset<any>): IPromise<any>;
showSimple(content: string): IPromise<any>;
simple(): ISimpleToastPreset;
build(): IToastPreset<any>;
updateContent(newContent: string): void;
@ -306,7 +306,7 @@ declare module 'angular' {
}
interface IMenuService {
hide(response?: any, options?: any): angular.IPromise<any>;
hide(response?: any, options?: any): IPromise<any>;
}
interface IColorPalette {
@ -366,19 +366,19 @@ declare module 'angular' {
isAttached: boolean;
panelContainer: JQuery;
panelEl: JQuery;
open(): angular.IPromise<any>;
close(): angular.IPromise<any>;
attach(): angular.IPromise<any>;
detach(): angular.IPromise<any>;
show(): angular.IPromise<any>;
hide(): angular.IPromise<any>;
open(): IPromise<any>;
close(): IPromise<any>;
attach(): IPromise<any>;
detach(): IPromise<any>;
show(): IPromise<any>;
hide(): IPromise<any>;
destroy(): void;
addClass(newClass: string): void;
removeClass(oldClass: string): void;
toggleClass(toggleClass: string): void;
updatePosition(position: IPanelPosition): void;
registerInterceptor(type: string, callback: () => angular.IPromise<any>): IPanelRef;
removeInterceptor(type: string, callback: () => angular.IPromise<any>): IPanelRef;
registerInterceptor(type: string, callback: () => IPromise<any>): IPanelRef;
removeInterceptor(type: string, callback: () => IPromise<any>): 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<IPanelRef>;
open(opt_config: IPanelConfig): IPromise<IPanelRef>;
newPanelPosition(): IPanelPosition;
newPanelAnimation(): IPanelAnimation;
xPosition: {

View File

@ -1,6 +1,6 @@
// Type definitions for Angular JS (ngMock, ngMockE2E module) 1.5
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Tony Curtis <http://github.com/daltin>
// Definitions by: Diego Vilar <https://github.com/diegovilar>, Tony Curtis <https://github.com/daltin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

View File

@ -27,9 +27,9 @@ declare module 'angular' {
interface OAuth {
isAuthenticated(): boolean;
getAccessToken(data: Data, options?: any): angular.IPromise<string>;
getRefreshToken(data?: Data, options?: any): angular.IPromise<string>;
revokeToken(data?: Data, options?: any): angular.IPromise<string>;
getAccessToken(data: Data, options?: any): IPromise<string>;
getRefreshToken(data?: Data, options?: any): IPromise<string>;
revokeToken(data?: Data, options?: any): IPromise<string>;
}
interface OAuthTokenConfig {

View File

@ -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;

View File

@ -32,7 +32,7 @@ interface IArticleResourceClass extends ng.resource.IResourceClass<IArticleResou
function MainController($resource: ng.resource.IResourceService): void {
// IntelliSense will provide IActionDescriptor interface and will validate
// your assignment against it
let publishDescriptor: ng.resource.IActionDescriptor = {
const publishDescriptor: ng.resource.IActionDescriptor = {
method: 'GET',
isArray: false
};
@ -40,7 +40,7 @@ function MainController($resource: ng.resource.IResourceService): void {
// A call to the $resource service returns a IResourceClass. Since
// our own IArticleResourceClass defines 2 more actions, we cast the return
// value to make the compiler aware of that
let articleResource: IArticleResourceClass = $resource<IArticleResource, IArticleResourceClass>('/articles/:id', null, {
const articleResource: IArticleResourceClass = $resource<IArticleResource, IArticleResourceClass>('/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();

View File

@ -1,6 +1,6 @@
// Type definitions for Angular JS (ngResource module) 1.5
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>, Michael Jess <http://github.com/miffels>
// Definitions by: Diego Vilar <https://github.com/diegovilar>, Michael Jess <https://github.com/miffels>
// 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<T> {
new(dataOrParams?: any): T & IResource<T>;
get: IResourceMethod<T>;
@ -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<T> {
$get(): angular.IPromise<T>;
$get(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
$get(success: Function, error?: Function): angular.IPromise<T>;
$get(): IPromise<T>;
$get(params?: Object, success?: Function, error?: Function): IPromise<T>;
$get(success: Function, error?: Function): IPromise<T>;
$query(): angular.IPromise<IResourceArray<T>>;
$query(params?: Object, success?: Function, error?: Function): angular.IPromise<IResourceArray<T>>;
$query(success: Function, error?: Function): angular.IPromise<IResourceArray<T>>;
$query(): IPromise<IResourceArray<T>>;
$query(params?: Object, success?: Function, error?: Function): IPromise<IResourceArray<T>>;
$query(success: Function, error?: Function): IPromise<IResourceArray<T>>;
$save(): angular.IPromise<T>;
$save(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
$save(success: Function, error?: Function): angular.IPromise<T>;
$save(): IPromise<T>;
$save(params?: Object, success?: Function, error?: Function): IPromise<T>;
$save(success: Function, error?: Function): IPromise<T>;
$remove(): angular.IPromise<T>;
$remove(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
$remove(success: Function, error?: Function): angular.IPromise<T>;
$remove(): IPromise<T>;
$remove(params?: Object, success?: Function, error?: Function): IPromise<T>;
$remove(success: Function, error?: Function): IPromise<T>;
$delete(): angular.IPromise<T>;
$delete(params?: Object, success?: Function, error?: Function): angular.IPromise<T>;
$delete(success: Function, error?: Function): angular.IPromise<T>;
$delete(): IPromise<T>;
$delete(params?: Object, success?: Function, error?: Function): IPromise<T>;
$delete(success: Function, error?: Function): IPromise<T>;
$cancelRequest(): void;
/** The promise of the original server interaction that created this instance. */
$promise: angular.IPromise<T>;
$promise: IPromise<T>;
$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<IResourceArray<T>>;
$promise: IPromise<IResourceArray<T>>;
$resolved: boolean;
}
/** when creating a resource factory via IModule.factory */
interface IResourceServiceFactoryFunction<T> {
($resource: angular.resource.IResourceService): IResourceClass<T>;
<U extends IResourceClass<T>>($resource: angular.resource.IResourceService): U;
($resource: resource.IResourceService): IResourceClass<T>;
<U extends IResourceClass<T>>($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<any>): IModule;
factory(name: string, resourceServiceFactoryFunction: resource.IResourceServiceFactoryFunction<any>): IModule;
}
namespace auto {
@ -210,7 +210,7 @@ declare module 'angular' {
declare global {
interface Array<T> {
/** The promise of the original server interaction that created this collection. */
$promise: angular.IPromise<T[]>;
$promise: IPromise<T[]>;
$resolved: boolean;
}
}

View File

@ -1,6 +1,6 @@
// Type definitions for Angular JS (ngSanitize module) 1.3
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions by: Diego Vilar <https://github.com/diegovilar>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

View File

@ -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 <http://github.com/davidreher>
// Definitions by: David Reher <https://github.com/davidreher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace angular {

View File

@ -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<TResult>;
result = $q.resolve<TResult>(tResult);
result = $q.resolve<TResult>(promiseTResult);
let result2: angular.IPromise<TResult | TOther> = $q.resolve<TResult | TOther>(Math.random() > 0.5 ? tResult : promiseTOther);
const result2: angular.IPromise<TResult | TOther> = $q.resolve<TResult | TOther>(Math.random() > 0.5 ? tResult : promiseTOther);
}
// $q.when
@ -388,7 +388,6 @@ namespace TestQ {
}
{
let result: angular.IPromise<TResult>;
let other: angular.IPromise<TOther>;
let resultOther: angular.IPromise<TResult | TOther>;
result = $q.when<TResult>(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);
};
}

View File

@ -1,7 +1,7 @@
// Type definitions for Angular JS 1.6
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Georgii Dolzhykov <http://github.com/thorn0>
// Definitions by: Diego Vilar <https://github.com/diegovilar>
// Georgii Dolzhykov <https://github.com/thorn0>
// Caleb St-Denis <https://github.com/calebstdenis>
// Leonard Thieu <https://github.com/leonard-thieu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

View File

@ -1,6 +1,6 @@
// Type definitions for AngularFire 0.8.2
// Project: http://angularfire.com
// Definitions by: Dénes Harmath <http://github.com/thSoft>
// Definitions by: Dénes Harmath <https://github.com/thSoft>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

View File

@ -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: {

View File

@ -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 {
/**

View File

@ -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";
}

View File

@ -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
}
}

View File

@ -1,6 +1,6 @@
// Type definitions for argparse v1.0.3
// Project: https://github.com/nodeca/argparse
// Definitions by: Andrew Schurman <http://github.com/arcticwaters>
// Definitions by: Andrew Schurman <https://github.com/arcticwaters>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

View File

@ -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;

View File

@ -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: {

View File

@ -1,5 +1,5 @@
import * as autosni from "auto-sni";
let a = autosni({
const a = autosni({
agreeTos: true,
email: '',
domains: ['']

View File

@ -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,

View File

@ -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;

View File

@ -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<Node>): 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<Node>, parentScope?: Scope);
path: NodePath<Node>;
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<Node>): void;
registerDeclaration(path: NodePath): void;
buildUndefinedNode(): Node;
registerConstantViolation(path: NodePath<Node>): void;
registerConstantViolation(path: NodePath): void;
registerBinding(kind: string, path: NodePath<Node>, bindingPath?: NodePath<Node>): 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<Node>; 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<Node>;
path: NodePath;
kind: 'var' | 'let' | 'const' | 'module';
referenced: boolean;
references: number;
referencePaths: Array<NodePath<Node>>;
referencePaths: NodePath[];
constant: boolean;
constantViolations: Array<NodePath<Node>>;
constantViolations: NodePath[];
}
export interface Visitor extends VisitNodeObject<Node> {
@ -328,7 +328,7 @@ export class NodePath<T = Node> {
state: any;
opts: object;
skipKeys: object;
parentPath: NodePath<Node>;
parentPath: NodePath;
context: TraversalContext;
container: object | object[];
listKey: string;
@ -362,15 +362,15 @@ export class NodePath<T = Node> {
* 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<Node>) => boolean): NodePath<Node>;
findParent(callback: (path: NodePath) => boolean): NodePath;
find(callback: (path: NodePath<Node>) => boolean): NodePath<Node>;
find(callback: (path: NodePath) => boolean): NodePath;
/** Get the parent function of the current path. */
getFunctionParent(): NodePath<Node>;
getFunctionParent(): NodePath;
/** Walk up the tree until we hit a parent node path in a list. */
getStatementParent(): NodePath<Node>;
getStatementParent(): NodePath;
/**
* Get the deepest common ancestor and then from it, get the earliest relationship path
@ -379,20 +379,20 @@ export class NodePath<T = Node> {
* Earliest is defined as being "before" all the other nodes in terms of list container
* position and visiting key.
*/
getEarliestCommonAncestorFrom(paths: Array<NodePath<Node>>): Array<NodePath<Node>>;
getEarliestCommonAncestorFrom(paths: NodePath[]): NodePath[];
/** Get the earliest path in the tree where the provided `paths` intersect. */
getDeepestCommonAncestorFrom(
paths: Array<NodePath<Node>>,
filter?: (deepest: Node, i: number, ancestries: Array<NodePath<Node>>) => NodePath<Node>
): NodePath<Node>;
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<NodePath<Node>>;
getAncestry(): NodePath[];
inType(...candidateTypes: string[]): boolean;
@ -404,7 +404,7 @@ export class NodePath<T = Node> {
couldBeBaseType(name: string): boolean;
baseTypeStrictlyMatches(right: NodePath<Node>): boolean;
baseTypeStrictlyMatches(right: NodePath): boolean;
isGenericType(genericName: string): boolean;
@ -428,7 +428,7 @@ export class NodePath<T = Node> {
replaceWithSourceString(replacement: any): void;
/** Replace the current node with another. */
replaceWith(replacement: Node | NodePath<Node>): 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<T = Node> {
hoist(scope: Scope): void;
// ------------------------- family -------------------------
getOpposite(): NodePath<Node>;
getOpposite(): NodePath;
getCompletionRecords(): Array<NodePath<Node>>;
getCompletionRecords(): NodePath[];
getSibling(key: string): NodePath<Node>;
getSibling(key: string): NodePath;
get(key: string, context?: boolean | TraversalContext): NodePath<Node>;
get(key: string, context?: boolean | TraversalContext): NodePath;
getBindingIdentifiers(duplicates?: boolean): Node[];
@ -960,7 +960,7 @@ export class Hub {
}
export interface TraversalContext {
parentPath: NodePath<Node>;
parentPath: NodePath;
scope: Scope;
state: any;
opts: any;

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -1,6 +1,6 @@
// Type definitions for batch-stream 0.1.2
// Project: https://github.com/segmentio/batch-stream
// Definitions by: Nicholas Penree <http://github.com/drudge>
// Definitions by: Nicholas Penree <https://github.com/drudge>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />

View File

@ -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);

View File

@ -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(

View File

@ -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;

View File

@ -1,6 +1,6 @@
// Type definitions for bookshelfjs v0.9.3
// Project: http://bookshelfjs.org/
// Definitions by: Andrew Schurman <http://github.com/arcticwaters>, Vesa Poikajärvi <https://github.com/vesse>
// Definitions by: Andrew Schurman <https://github.com/arcticwaters>, Vesa Poikajärvi <https://github.com/vesse>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

View File

@ -1,8 +1,8 @@
// Type definitions for boom 4.3
// Project: http://github.com/hapijs/boom
// Definitions by: Igor Rogatty <http://github.com/rogatty>
// AJP <http://github.com/AJamesPhillips>
// Jinesh Shah <http://github.com/jineshshah36>
// Project: https://github.com/hapijs/boom
// Definitions by: Igor Rogatty <https://github.com/rogatty>
// AJP <https://github.com/AJamesPhillips>
// Jinesh Shah <https://github.com/jineshshah36>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

View File

@ -1,6 +1,6 @@
// Type definitions for boom 3.2
// Project: http://github.com/hapijs/boom
// Definitions by: Igor Rogatty <http://github.com/rogatty>
// Project: https://github.com/hapijs/boom
// Definitions by: Igor Rogatty <https://github.com/rogatty>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />

View File

@ -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({

View File

@ -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 {

View File

@ -1,6 +1,6 @@
// Type definitions for Bounce.js v0.8.2
// Project: http://github.com/tictail/bounce.js
// Definitions by: Cherry <http://github.com/cherrry>
// Project: https://github.com/tictail/bounce.js
// Definitions by: Cherry <https://github.com/cherrry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

View File

@ -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/

View File

@ -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/

View File

@ -1,6 +1,6 @@
// Type definitions for browser-sync
// Project: http://www.browsersync.io/
// Definitions by: Asana <https://asana.com>, Joe Skeen <http://github.com/joeskeen>
// Definitions by: Asana <https://asana.com>, Joe Skeen <https://github.com/joeskeen>
// Thomas "Thasmo" Deinhamer <https://thasmo.com/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

View File

@ -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: {}
};

View File

@ -1,8 +1,8 @@
// Type definitions for bytebuffer.js 5.0.0
// Project: https://github.com/dcodeIO/bytebuffer.js
// Definitions by: Denis Cappellin <http://github.com/cappellin>
// Definitions by: Denis Cappellin <https://github.com/cappellin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Definitions by: SINTEF-9012 <http://github.com/SINTEF-9012>
// Definitions by: SINTEF-9012 <https://github.com/SINTEF-9012>
import Long = require("long");

View File

@ -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]

View File

@ -1,6 +1,6 @@
// Type definitions for nodejs-driver v0.8.2
// Project: https://github.com/datastax/nodejs-driver
// Definitions by: Marc Fisher <http://github.com/Svjard>
// Definitions by: Marc Fisher <https://github.com/Svjard>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />

View File

@ -1,6 +1,6 @@
// Type definitions for catbox 7.1
// Project: https://github.com/hapijs/catbox
// Definitions by: Jason Swearingen <http://github.com/jasonswearingen>, AJP <https://github.com/AJamesPhillips>
// Definitions by: Jason Swearingen <https://github.com/jasonswearingen>, AJP <https://github.com/AJamesPhillips>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

View File

@ -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];

View File

@ -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');

View File

@ -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: <ChartData> {
labels: ['group 1'],

View File

@ -1,6 +1,6 @@
import * as color from 'color-convert';
import * as conv from 'color-convert/conversions';
let hsv: [number, number, number] = color.rgb.hsv([1, 2, 3]);
let hsv_raw: [number, number, number] = color.rgb.hsv.raw([1, 2, 3]);
let aaa: [number, number, number] = color.rgb.hsv([1, 2, 3]);
const hsv: [number, number, number] = color.rgb.hsv([1, 2, 3]);
const hsv_raw: [number, number, number] = color.rgb.hsv.raw([1, 2, 3]);
const aaa: [number, number, number] = color.rgb.hsv([1, 2, 3]);

View File

@ -1,6 +1,6 @@
// Type definitions for commander 2.9
// Project: https://github.com/visionmedia/commander.js
// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <http://github.com/mdezem>, vvakame <http://github.com/vvakame>
// Definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />

View File

@ -26,18 +26,18 @@ function logNode(node: commonmark.Node) {
const parser = new commonmark.Parser({ smart: true, time: true });
const node = parser.parse('# a piece of _markdown_');
let w = node.walker();
let step = w.next();
const w = node.walker();
const step = w.next();
if (step.entering) {
logNode(step.node);
}
let xmlRenderer = new commonmark.XmlRenderer({ sourcepos: true, time: true });
let xml = xmlRenderer.render(node);
const xmlRenderer = new commonmark.XmlRenderer({ sourcepos: true, time: true });
const xml = xmlRenderer.render(node);
console.log(xml);
let htmlRenderer = new commonmark.HtmlRenderer({ safe: true, smart: true, sourcepos: true, time: true });
let html = htmlRenderer.render(node);
const htmlRenderer = new commonmark.HtmlRenderer({ safe: true, smart: true, sourcepos: true, time: true });
const html = htmlRenderer.render(node);
console.log(html);
function basic_usage() {

View File

@ -3,7 +3,7 @@ import concat = require("concat-stream");
import { Readable } from "stream";
class MyReadable extends Readable {
i: number = 1;
i = 1;
_read() {
if (this.i <= 100) {
this.push(this.i.toString());

View File

@ -21,7 +21,7 @@ function test(topic: string, callback: (t: Test) => any) {
test("asynchronously propagating state with local-context-domains", function (t) {
t.plan(2);
var namespace = cls.createNamespace('namespace');
const namespace = cls.createNamespace('namespace');
// t.ok(process.namespaces.namespace, "namespace has been created");
namespace.run(function () {
@ -39,7 +39,7 @@ test("minimized test case that caused #6011 patch to fail", function (t) {
// when the flaw was in the patch, commenting out this line would fix things:
process.nextTick(function () { console.log('!'); });
var n = cls.createNamespace("test");
const n = cls.createNamespace("test");
t.ok(!n.get('state'), "state should not yet be visible");
n.run(function () {
@ -59,7 +59,7 @@ test("event emitters bound to CLS context", function (t) {
t.test("handler registered in context, emit out of context", function (t) {
t.plan(1);
var n = cls.createNamespace('in')
const n = cls.createNamespace('in')
, ee = new EventEmitter()
;
@ -78,7 +78,7 @@ test("event emitters bound to CLS context", function (t) {
t.test("once handler registered in context", function (t) {
t.plan(1);
var n = cls.createNamespace('inOnce')
const n = cls.createNamespace('inOnce')
, ee = new EventEmitter()
;
@ -97,7 +97,7 @@ test("event emitters bound to CLS context", function (t) {
t.test("handler registered out of context, emit in context", function (t) {
t.plan(1);
var n = cls.createNamespace('out')
const n = cls.createNamespace('out')
, ee = new EventEmitter()
;
@ -117,7 +117,7 @@ test("event emitters bound to CLS context", function (t) {
t.test("once handler registered out of context", function (t) {
t.plan(1);
var n = cls.createNamespace('outOnce')
const n = cls.createNamespace('outOnce')
, ee = new EventEmitter()
;
@ -137,7 +137,7 @@ test("event emitters bound to CLS context", function (t) {
t.test("handler registered out of context, emit out of context", function (t) {
t.plan(1);
var n = cls.createNamespace('out')
const n = cls.createNamespace('out')
, ee = new EventEmitter()
;
@ -155,12 +155,12 @@ test("event emitters bound to CLS context", function (t) {
});
t.test("once handler registered out of context on Readable", function (t) {
var Readable = require('stream').Readable;
const Readable = require('stream').Readable;
if (Readable) {
t.plan(12);
var n = cls.createNamespace('outOnceReadable')
const n = cls.createNamespace('outOnceReadable')
, re = new Readable()
;
@ -203,7 +203,7 @@ test("event emitters bound to CLS context", function (t) {
t.test("emitter with newListener that removes handler", function (t) {
t.plan(3);
var n = cls.createNamespace('newListener')
const n = cls.createNamespace('newListener')
, ee = new EventEmitter()
;
@ -239,12 +239,12 @@ test("event emitters bound to CLS context", function (t) {
});
t.test("handler registered in context on Readable", function (t) {
var Readable = require('stream').Readable;
const Readable = require('stream').Readable;
if (Readable) {
t.plan(12);
var n = cls.createNamespace('outOnReadable')
const n = cls.createNamespace('outOnReadable')
, re = new Readable()
;
@ -288,7 +288,7 @@ test("event emitters bound to CLS context", function (t) {
t.test("handler added but used entirely out of context", function (t) {
t.plan(2);
var n = cls.createNamespace('none')
const n = cls.createNamespace('none')
, ee = new EventEmitter()
;
@ -309,12 +309,12 @@ test("event emitters bound to CLS context", function (t) {
t.test("handler added but no listeners registered", function (t) {
t.plan(3);
var http = require('http')
const http = require('http')
, n = cls.createNamespace('no_listener')
;
// only fails on Node < 0.10
var server = http.createServer(function (req: any, res: any) {
const server = http.createServer(function (req: any, res: any) {
n.bindEmitter(req);
t.doesNotThrow(function () {
@ -342,7 +342,7 @@ test("event emitters bound to CLS context", function (t) {
t.test("listener with parameters added but not bound to context", function (t) {
t.plan(2);
var ee = new EventEmitter()
const ee = new EventEmitter()
, n = cls.createNamespace('param_list')
;
@ -361,7 +361,7 @@ test("event emitters bound to CLS context", function (t) {
t.test("listener that throws doesn't leave removeListener wrapped", function (t) {
t.plan(4);
var ee = new EventEmitter()
const ee = new EventEmitter()
, n = cls.createNamespace('kaboom')
;
@ -385,7 +385,7 @@ test("event emitters bound to CLS context", function (t) {
t.test("emitter bound to multiple namespaces handles them correctly", function (t) {
t.plan(8);
var ee = new EventEmitter()
const ee = new EventEmitter()
, ns1 = cls.createNamespace('1')
, ns2 = cls.createNamespace('2')
;
@ -430,7 +430,7 @@ test("event emitters bound to CLS context", function (t) {
// multiple contexts in use
test("simple tracer built on contexts", function (t) {
var tracer = cls.createNamespace('tracer');
const tracer = cls.createNamespace('tracer');
class Trace {
harvester: any;
@ -438,7 +438,7 @@ test("simple tracer built on contexts", function (t) {
this.harvester = harvester;
}
runHandler(callback: any) {
var wrapped = tracer.bind(function () {
const wrapped = tracer.bind(function () {
callback();
this.harvester.emit('finished', tracer.get('transaction'));
}.bind(this));
@ -448,8 +448,8 @@ test("simple tracer built on contexts", function (t) {
t.plan(6);
var harvester = new EventEmitter();
var trace = new Trace(harvester);
const harvester = new EventEmitter();
const trace = new Trace(harvester);
harvester.on('finished', function (transaction: any) {
t.ok(transaction, "transaction should have been passed in");

View File

@ -35,7 +35,7 @@ convict.addFormats({
}
});
let conf = convict({
const conf = convict({
env: {
doc: 'The applicaton environment.',
format: ['production', 'development', 'test'],
@ -98,8 +98,8 @@ let conf = convict({
// load environment dependent configuration
let env = conf.get('env');
let dbip = conf.get('db.ip');
const env = conf.get('env');
const dbip = conf.get('db.ip');
conf.loadFile('./config/' + env + '.json');
conf.loadFile(['./configs/always.json', './configs/sometimes.json']);
@ -119,7 +119,7 @@ conf
.validate({ allowed: 'warn' })
.toString();
let port: number = conf.default('port');
const port: number = conf.default('port');
if (conf.has('key')) {
conf.set('the.awesome', true);

View File

@ -1,6 +1,6 @@
// Type definitions for copy-webpack-plugin v4.0.0
// Project: https://github.com/kevlened/copy-webpack-plugin
// Definitions by: flying-sheep <http://github.com/flying-sheep>
// Definitions by: flying-sheep <https://github.com/flying-sheep>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Plugin } from 'webpack'

View File

@ -4,7 +4,7 @@
// signature of window.open() added by InAppBrowser plugin
// is similar to native window.open signature, so the compiler can's
// select proper overload, but we cast result to InAppBrowser manually.
const iab = <InAppBrowser> window.open('google.com', '_self');
const iab = window.open('google.com', '_self');
iab.addEventListener('loadstart', (ev: InAppBrowserEvent) => { console.log('Start opening ' + ev.url); });
iab.addEventListener('loadstart', (ev) => { console.log('loadstart' + ev.url); });

View File

@ -31,7 +31,7 @@ import { readonly } from 'core-decorators';
class Meal {
@readonly
entree: string = 'steak';
entree = 'steak';
}
const dinner = new Meal();
@ -155,7 +155,7 @@ class Meal2 {
entree = 'steak';
@nonenumerable
cost: number = 4.44;
cost = 4.44;
}
const dinner2 = new Meal2();
@ -175,7 +175,7 @@ import { nonconfigurable } from 'core-decorators';
class Meal3 {
@nonconfigurable
entree: string = 'steak';
entree = 'steak';
}
const dinner3 = new Meal3();

View File

@ -1,6 +1,6 @@
// Type definitions for core-js 0.9
// Project: https://github.com/zloirock/core-js/
// Definitions by: Ron Buckton <http://github.com/rbuckton>, Michel Felipe <http://github.com/mfdeveloper>
// Definitions by: Ron Buckton <https://github.com/rbuckton>, Michel Felipe <https://github.com/mfdeveloper>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1

View File

@ -5,7 +5,7 @@ import fs = require('fs');
/////////////////////////////
// From CSV String
const csvStr: string = `1,2,3
const csvStr = `1,2,3
4,5,6
7,8,9`;

View File

@ -43,9 +43,9 @@ let num: number;
let date: Date;
let numOrUndefined: number | undefined;
let strOrUndefined: string |  undefined;
let numericOrUndefined: NumCoercible |  undefined;
let dateOrUndefined: Date |  undefined;
let strOrUndefined: string | undefined;
let numericOrUndefined: NumCoercible | undefined;
let dateOrUndefined: Date | undefined;
let numOrUndefinedExtent: [number, number] | [undefined, undefined];
let strOrUndefinedExtent: [string, string] | [undefined, undefined];
let numericOrUndefinedExtent: [NumCoercible, NumCoercible] | [undefined, undefined];

View File

@ -85,7 +85,6 @@ brush = brush.on('end', null);
// re-apply
brush.on('end', function(d, i, g) {
const that: SVGGElement = this;
const datum: BrushDatum = d;
const index: number = i;
const group: SVGGElement[] | ArrayLike<SVGGElement> = g;

View File

@ -11,13 +11,13 @@ import { ascending } from 'd3-array';
// Preparatory steps --------------------------------------------------------------
let keyValueObj = {
const keyValueObj = {
a: 'test',
b: 123,
c: [true, true, false]
};
let keyValueObj2 = {
const keyValueObj2 = {
a: 'test',
b: 'same',
c: 'type'
@ -29,7 +29,6 @@ let stringKVArray: Array<{ key: string, value: string }>;
let anyKVArray: Array<{ key: string, value: any }>;
let num: number;
let str: string;
let booleanFlag: boolean;
// ---------------------------------------------------------------------
@ -137,9 +136,9 @@ testObjKVArray = testObjMap.entries();
// each() --------------------------------------------------------------
testObjMap.each((value, key, map) => {
let v: TestObject = value;
let k: string = key;
let m: d3Collection.Map<TestObject> = map;
const v: TestObject = value;
const k: string = key;
const m: d3Collection.Map<TestObject> = map;
console.log(v.val);
});
@ -169,9 +168,9 @@ basicSet = d3Collection.set(['foo', 'bar', 42]); // last element is coerced
// from array without accessor
basicSet = d3Collection.set(testObjArray, (value, index, array) => {
let v: TestObject = value;
let i: number = index;
let a: TestObject[] = array;
const v: TestObject = value;
const i: number = index;
const a: TestObject[] = array;
return v.name;
});
@ -208,9 +207,9 @@ stringArray = basicSet.values();
// each() --------------------------------------------------------------
basicSet.each((value, valueRepeat, set) => {
let v: string = value;
let vr: string = valueRepeat;
let s: d3Collection.Set = set;
const v: string = value;
const vr: string = valueRepeat;
const s: d3Collection.Set = set;
console.log(v);
});
@ -233,7 +232,7 @@ interface Yield {
site: string;
}
let raw: Yield[] = [
const raw: Yield[] = [
{ yield: 27.00, variety: 'Manchuria', year: 1931, site: 'University Farm' },
{ yield: 48.87, variety: 'Manchuria', year: 1931, site: 'Waseca' },
{ yield: 27.43, variety: 'Manchuria', year: 1931, site: 'Morris' },
@ -279,8 +278,8 @@ nestL1Rollup = nestL1Rollup
nestL2 = nestL2
.sortValues((a, b) => {
let val1: Yield = a; // data type Yield
let val2: Yield = b; // data type Yield
const val1: Yield = a; // data type Yield
const val2: Yield = b; // data type Yield
return a.yield - b.yield;
});
@ -288,7 +287,7 @@ nestL2 = nestL2
nestL1Rollup = nestL1Rollup
.rollup(values => {
let vs: Yield[] = values; // correct data array type
const vs: Yield[] = values; // correct data array type
return vs.length;
});

View File

@ -110,7 +110,7 @@ interface CustomDatum {
// Get contour generator -------------------------------------------------------
let contDensDefault: d3Contour.ContourDensity<[number, number]> = d3Contour.contourDensity();
const contDensDefault: d3Contour.ContourDensity<[number, number]> = d3Contour.contourDensity();
let contDensCustom: d3Contour.ContourDensity<CustomDatum> = d3Contour.contourDensity<CustomDatum>();
// Configure contour generator =================================================

View File

@ -16,8 +16,6 @@ interface Datum {
}
let dispatch: d3Dispatch.Dispatch<HTMLElement>;
let copy: d3Dispatch.Dispatch<HTMLElement>;
let copy2: d3Dispatch.Dispatch<SVGElement>;
// Signature Tests ----------------------------------------
@ -50,5 +48,5 @@ dispatch.apply('bar', document.body, [{ a: 3, b: 'test' }, 1]);
dispatch.on('bar', null);
// Copy dispatch -----------------------------------------------
copy = dispatch.copy();
// copy2 = dispatch.copy(); // test fails type mismatch of underlying event target
const copy: d3Dispatch.Dispatch<HTMLElement> = dispatch.copy();
// const copy2: d3Dispatch.Dispatch<SVGElement> = dispatch.copy(); // test fails type mismatch of underlying event target

View File

@ -12,13 +12,13 @@ import * as d3Dsv from 'd3-dsv';
// Preperatory Steps
// ------------------------------------------------------------------------------------------
const csvTestString: string = '1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38';
const tsvTestString: string = '1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38';
const pipedTestString: string = '1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38';
const csvTestString = '1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38';
const tsvTestString = '1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38';
const pipedTestString = '1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38';
const csvTestStringWithHeader: string = 'Year,Make,Model,Length\n1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38';
const tsvTestStringWithHeader: string = 'Year\tMake\tModel\tLength\n1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38';
const pipedTestStringWithHeader: string = 'Year|Make|Model|Length\n1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38';
const csvTestStringWithHeader = 'Year,Make,Model,Length\n1997,Ford,E350,2.34\n2000,Mercury,Cougar,2.38';
const tsvTestStringWithHeader = 'Year\tMake\tModel\tLength\n1997\tFord\tE350\t2.34\n2000\tMercury\tCougar\t2.38';
const pipedTestStringWithHeader = 'Year|Make|Model|Length\n1997|Ford|E350|2.34\n2000|Mercury|Cougar|2.38';
interface ParsedTestObject {
year: Date;

View File

@ -8,7 +8,7 @@
import * as d3Ease from 'd3-ease';
const t_in: number = 0.5;
const t_in = 0.5;
let t_out: number;
t_out = d3Ease.easeLinear(t_in);

View File

@ -36,17 +36,17 @@ formatFn = d3Format.formatPrefix(',.0', 1e-6);
specifier = d3Format.formatSpecifier('.0%');
let fill: string = specifier.fill;
let align: '>' | '<' | '^' | '=' = specifier.align;
let sign: '-' | '+' | '(' | ' ' = specifier.sign;
let symbol: '$' | '#' | '' = specifier.symbol;
let zero: boolean = specifier.zero;
let width: number | undefined = specifier.width;
let comma: boolean = specifier.comma;
let precision: number = specifier.precision;
let type: 'e' | 'f' | 'g' | 'r' | 's' | '%' | 'p' | 'b' | 'o' | 'd' | 'x' | 'X' | 'c' | '' | 'n' = specifier.type;
const fill: string = specifier.fill;
const align: '>' | '<' | '^' | '=' = specifier.align;
const sign: '-' | '+' | '(' | ' ' = specifier.sign;
const symbol: '$' | '#' | '' = specifier.symbol;
const zero: boolean = specifier.zero;
const width: number | undefined = specifier.width;
const comma: boolean = specifier.comma;
const precision: number = specifier.precision;
const type: 'e' | 'f' | 'g' | 'r' | 's' | '%' | 'p' | 'b' | 'o' | 'd' | 'x' | 'X' | 'c' | '' | 'n' = specifier.type;
let formatString: string = specifier.toString();
const formatString: string = specifier.toString();
// ----------------------------------------------------------------------
// Test Precision Suggestors
@ -85,16 +85,16 @@ localeDef = {
percent : "\u202f%"
};
let decimal: string = localeDef.decimal;
let thousands: string = localeDef.thousands;
let grouping: number[] = localeDef.grouping;
let currency: [string, string] = localeDef.currency;
let numerals: string[] | undefined = localeDef.numerals;
let percent: string | undefined = localeDef.percent;
const decimal: string = localeDef.decimal;
const thousands: string = localeDef.thousands;
const grouping: number[] = localeDef.grouping;
const currency: [string, string] = localeDef.currency;
const numerals: string[] | undefined = localeDef.numerals;
const percent: string | undefined = localeDef.percent;
localeObj = d3Format.formatLocale(localeDef);
localeObj = d3Format.formatDefaultLocale(localeDef);
let formatFactory: (specifier: string) => ((n: number) => string) = localeObj.format;
let formatPrefixFactory: (specifier: string, value: number) => ((n: number) => string) = localeObj.formatPrefix;
const formatFactory: (specifier: string) => ((n: number) => string) = localeObj.format;
const formatPrefixFactory: (specifier: string, value: number) => ((n: number) => string) = localeObj.formatPrefix;

View File

@ -112,8 +112,8 @@ export interface FormatSpecifier {
comma: boolean;
/**
* Depending on the type, the precision either indicates the number of digits that follow the decimal point (types 'f' and '%'),
* or the number of significant digits (types '' (none), 'e', 'g', 'r', 's' and 'p'). If the precision is not specified,
* it defaults to 6 for all types except '' (none), which defaults to 12.
* or the number of significant digits (types '' (none), 'e', 'g', 'r', 's' and 'p'). If the precision is not specified,
* it defaults to 6 for all types except '' (none), which defaults to 12.
* Precision is ignored for integer formats (types 'b', 'o', 'd', 'x', 'X' and 'c').
*
* See precisionFixed and precisionRound for help picking an appropriate precision
@ -137,7 +137,7 @@ export interface FormatSpecifier {
* 'c' - converts the integer to the corresponding unicode character before printing.
* '' (none) - like g, but trim insignificant trailing zeros.
*
* The type 'n' is also supported as shorthand for ',g'. For the 'g', 'n' and ''(none) types,
* The type 'n' is also supported as shorthand for ',g'. For the 'g', 'n' and ''(none) types,
* decimal notation is used if the resulting string would have precision or fewer digits; otherwise, exponent notation is used.
*/
type: 'e' | 'f' | 'g' | 'r' | 's' | '%' | 'p' | 'b' | 'o' | 'd' | 'x' | 'X' | 'c' | '' | 'n';
@ -170,7 +170,7 @@ export function formatDefaultLocale(defaultLocale: FormatLocaleDefinition): Form
*
* Uses the current default locale.
*
* The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type].
* The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type].
* For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties.
*
* @param specifier A Specifier string
@ -185,7 +185,7 @@ export function format(specifier: string): (n: number) => string;
*
* Uses the current default locale.
*
* The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type].
* The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type].
* For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties.
*
* @param specifier A Specifier string
@ -197,7 +197,7 @@ export function formatPrefix(specifier: string, value: number): (n: number) => s
* Parses the specified specifier, returning an object with exposed fields that correspond to the
* format specification mini-language and a toString method that reconstructs the specifier.
*
* The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type].
* The general form of a specifier is [[fill]align][sign][symbol][0][width][,][.precision][type].
* For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties.
*
* @param specifier A specifier string.

View File

@ -44,7 +44,6 @@ let iString: Interpolator<string>;
let iDate: Interpolator<Date>;
let iArrayNum: Interpolator<number[]>;
let iArrayStr: Interpolator<string[]>;
let iArrayDate: Interpolator<Date[]>;
let iArrayMixed: Interpolator<[Date, string]>;
let iKeyVal: Interpolator<{ [key: string]: any }>;
let iRGBColorObj: Interpolator<d3Color.RGBColor>;
@ -56,7 +55,6 @@ let arrNum: number[];
let arrStr: string[];
let objKeyVal: { [key: string]: any };
let objRGBColor: d3Color.RGBColor;
let objHSVColor: d3Hsv.HSVColor;
let zoom: [number, number, number];
// test interpolate(a, b) signature ----------------------------------------------------

View File

@ -12,7 +12,7 @@ import * as d3Path from 'd3-path';
// Test create new path serializer
// -----------------------------------------------------------------------------------------
let context: d3Path.Path = d3Path.path();
const context: d3Path.Path = d3Path.path();
// -----------------------------------------------------------------------------------------
// Test path serializer methods
@ -35,4 +35,4 @@ context.rect(60, 60, 100, 200);
context.closePath();
let pathString: string = context.toString();
const pathString: string = context.toString();

View File

@ -15,8 +15,8 @@ import * as d3Polygon from 'd3-polygon';
let num: number;
let containsFlag: boolean;
let point: [number, number] = [15, 15];
let polygon: Array<[number, number]> = [[10, 10], [20, 20], [10, 30]];
let pointArray: Array<[number, number]> = [[10, 10], [20, 20], [10, 30], [15, 15]];
const polygon: Array<[number, number]> = [[10, 10], [20, 20], [10, 30]];
const pointArray: Array<[number, number]> = [[10, 10], [20, 20], [10, 30], [15, 15]];
let hull: Array<[number, number]>;
// -----------------------------------------------------------------------------

View File

@ -39,7 +39,7 @@ let testData: TestDatum[] = [
let node: d3Quadtree.QuadtreeInternalNode<TestDatum> | d3Quadtree.QuadtreeLeaf<TestDatum>;
let numberAccessor: (d: TestDatum) => number;
let simpleTestData: Array<[number, number]> = [
const simpleTestData: Array<[number, number]> = [
[10, 20],
[30, 10],
[15, 80],
@ -216,7 +216,7 @@ quadtree = quadtree.visitAfter((node, x0, y0, x1, y1) => {
// Test QuadtreeLeaf =========================================================
let leaf: d3Quadtree.QuadtreeLeaf<TestDatum>;
declare const leaf: d3Quadtree.QuadtreeLeaf<TestDatum>;
let nextLeaf: d3Quadtree.QuadtreeLeaf<TestDatum> | undefined;
testDatum = leaf.data;
@ -225,7 +225,7 @@ nextLeaf = leaf.next ? leaf.next : undefined;
// Test QuadtreeInternalNode =================================================
let internalNode: d3Quadtree.QuadtreeInternalNode<TestDatum>;
declare const internalNode: d3Quadtree.QuadtreeInternalNode<TestDatum>;
let quadNode: d3Quadtree.QuadtreeInternalNode<TestDatum> | d3Quadtree.QuadtreeLeaf<TestDatum> | undefined;
quadNode = internalNode[0];

View File

@ -16,7 +16,7 @@ import { DSVParsedArray, DSVRowString } from 'd3-dsv';
// Preparatory Steps
// -------------------------------------------------------------------------------
const url: string = 'http:// api.reddit.com';
const url = 'http:// api.reddit.com';
interface RequestDatumGET {
kind: 'Listing';
@ -49,13 +49,12 @@ let listenerResult: (this: d3Request.Request, result: ResponseDatumGET[]) => voi
// -------------------------------------------------------------------------------
// request to configure and send in follow-up
let request: d3Request.Request = d3Request.request(url);
const request: d3Request.Request = d3Request.request(url);
// GET-request with callback, immediately sent
let requestWithCallback: d3Request.Request = d3Request.request(url, (error, xhr) => {
let x: XMLHttpRequest;
const requestWithCallback: d3Request.Request = d3Request.request(url, (error, xhr) => {
if (!error) {
x = xhr;
const x: XMLHttpRequest = xhr;
console.log(xhr.responseText);
}
});
@ -65,36 +64,34 @@ let requestWithCallback: d3Request.Request = d3Request.request(url, (error, xhr)
// -------------------------------------------------------------------------------
// Abort -----------------------------------------------------------------------
let r1: d3Request.Request = request.abort();
const r1: d3Request.Request = request.abort();
// Get -------------------------------------------------------------------------
// no arguments
let r2: d3Request.Request = d3Request.request(url)
const r2: d3Request.Request = d3Request.request(url)
.get();
// with request datum
let r3: d3Request.Request = d3Request.request(url)
const r3: d3Request.Request = d3Request.request(url)
.get<RequestDatumGET>({ kind: 'Listing' });
// with callback for response handling
let r4: d3Request.Request = d3Request.request(url)
const r4: d3Request.Request = d3Request.request(url)
.response(xhr2Listing)
.get<ResponseDatumGET[]>((error, response) => {
let r: ResponseDatumGET[];
if (!error) {
r = response;
const r: ResponseDatumGET[] = response;
console.log(r);
}
});
// with request datum and callback for response handling
let r5: d3Request.Request = d3Request.request(url)
const r5: d3Request.Request = d3Request.request(url)
.response(xhr2Listing)
.get<RequestDatumGET, ResponseDatumGET[]>({ kind: 'Listing' }, (error, response) => {
let r: ResponseDatumGET[];
if (!error) {
r = response;
const r: ResponseDatumGET[] = response;
console.log(r);
}
});
@ -102,20 +99,20 @@ let r5: d3Request.Request = d3Request.request(url)
// Headers --------------------------------------------------------------------
// get
let acceptEncoding: string = request.header('Accept-Encoding');
const acceptEncoding: string = request.header('Accept-Encoding');
// set
let r6: d3Request.Request = request.header('Accept-Encoding', 'gzip');
const r6: d3Request.Request = request.header('Accept-Encoding', 'gzip');
// remove
let r7: d3Request.Request = request.header('Accept-Encoding', null);
const r7: d3Request.Request = request.header('Accept-Encoding', null);
// Mime Type -------------------------------------------------------------------
// get
let mimeType: string = request.mimeType();
// set
let r8: d3Request.Request = request.mimeType('application/json');
const r8: d3Request.Request = request.mimeType('application/json');
// remove
let r9: d3Request.Request = request.mimeType(null);
const r9: d3Request.Request = request.mimeType(null);
// Events - on ------------------------------------------------------------------
@ -124,8 +121,8 @@ let r10: d3Request.Request = d3Request.request(url);
// beforesent
r10 = r10.on('beforesend', function(xhr) {
let that: d3Request.Request = this;
let x: XMLHttpRequest = xhr;
const that: d3Request.Request = this;
const x: XMLHttpRequest = xhr;
// do something;
});
@ -134,8 +131,8 @@ listenerXhr = r10.on('beforesend');
// progress
r10 = r10.on('progress', function(progEvent) {
let that: d3Request.Request = this;
let e: ProgressEvent = progEvent;
const that: d3Request.Request = this;
const e: ProgressEvent = progEvent;
// do something;
});
@ -144,8 +141,8 @@ listenerProgress = r10.on('progress');
// error
r10 = r10.on('error', function(error) {
let that: d3Request.Request = this;
let err: any = error;
const that: d3Request.Request = this;
const err: any = error;
// do something;
});
@ -154,20 +151,20 @@ listenerError = r10.on('error');
// load
r10 = r10.on<ResponseDatumGET[]>('load', function(result) {
let that: d3Request.Request = this;
let res: ResponseDatumGET[] = result;
const that: d3Request.Request = this;
const res: ResponseDatumGET[] = result;
// do something;
});
r10 = r10.on('load', function(result: ResponseDatumGET[]) {
let that: d3Request.Request = this;
let res: ResponseDatumGET[] = result;
const that: d3Request.Request = this;
const res: ResponseDatumGET[] = result;
// do something;
});
// r10 = r10.on<ResponseDatumGET[]>('load', function(result: number) { // fails, wrong argument type for callback
// let that: d3Request.Request = this;
// let res: number = result;
// const that: d3Request.Request = this;
// const res: number = result;
// // do something;
// });
@ -176,16 +173,16 @@ listenerResult = r10.on<ResponseDatumGET[]>('load');
// general (for unknown type additional event listener e.g. 'beforesent.custom' or 'load.custom')
r10 = r10.on('progress.foo', function(progEvent: ProgressEvent) {
let that: d3Request.Request = this;
let e: any = ProgressEvent;
const that: d3Request.Request = this;
const e: any = ProgressEvent;
// do something;
});
listenerProgress = r10.on('progress.foo');
r10 = r10.on('error.foo', function(error) {
let that: d3Request.Request = this;
let err: any = error;
const that: d3Request.Request = this;
const err: any = error;
// do something;
});
@ -194,95 +191,85 @@ listenerError = r10.on('error.foo');
// Password ---------------------------------------------------------------------
// get
let password: string = request.password();
const password: string = request.password();
// set
let r11: d3Request.Request = request.password('MyPassword');
const r11: d3Request.Request = request.password('MyPassword');
// Post -------------------------------------------------------------------------
function xhr2Success(xhr: XMLHttpRequest): ResponseDatumPOST {
let result: ResponseDatumPOST;
result = JSON.parse(xhr.responseText);
return result;
return JSON.parse(xhr.responseText);
}
// no arguments
let r12: d3Request.Request = d3Request.request(url)
const r12: d3Request.Request = d3Request.request(url)
.post();
// with request datum
let r13: d3Request.Request = d3Request.request(url)
const r13: d3Request.Request = d3Request.request(url)
.post<RequestDatumPOST>({ test: 'NewValue', value: 10 });
// with callback for response handling
let r14: d3Request.Request = d3Request.request(url).response(xhr2Success)
const r14: d3Request.Request = d3Request.request(url).response(xhr2Success)
.post<ResponseDatumPOST>(function(error, response) {
let that: d3Request.Request = this;
let err: any = error;
let res: ResponseDatumPOST = response;
const that: d3Request.Request = this;
const err: any = error;
const res: ResponseDatumPOST = response;
console.log('Success? ', res.success);
});
let r15: d3Request.Request = d3Request.request(url).response(xhr2Success)
const r15: d3Request.Request = d3Request.request(url).response(xhr2Success)
.post<RequestDatumPOST, ResponseDatumPOST>({ test: 'NewValue', value: 10 }, function(error, response) {
let that: d3Request.Request = this;
let err: any = error;
let res: ResponseDatumPOST = response;
const that: d3Request.Request = this;
const err: any = error;
const res: ResponseDatumPOST = response;
console.log('Success? ', res.success);
});
// Response ---------------------------------------------------------------------
function xhr2Listing(xhr: XMLHttpRequest): ResponseDatumGET[] {
let result: ResponseDatumGET[];
result = JSON.parse(xhr.responseText);
return result;
return JSON.parse(xhr.responseText);
}
let r16: d3Request.Request = d3Request.request(url)
const r16: d3Request.Request = d3Request.request(url)
.response<ResponseDatumGET[]>(xhr2Listing);
// ResponseType -----------------------------------------------------------------
// get
let responseType: string = d3Request.request(url)
const responseType: string = d3Request.request(url)
.responseType();
// set
let r17: d3Request.Request = d3Request.request(url)
const r17: d3Request.Request = d3Request.request(url)
.responseType('application/json');
// Send ------------------------------------------------------------------------
// method only
let r18: d3Request.Request = d3Request.request(url)
const r18: d3Request.Request = d3Request.request(url)
.send('GET');
// method and request datum
let r19: d3Request.Request = d3Request.request(url)
const r19: d3Request.Request = d3Request.request(url)
.send<RequestDatumPOST>('POST', { test: 'NewValue', value: 10 });
// method and callback for response handling
let r20: d3Request.Request = d3Request.request(url)
const r20: d3Request.Request = d3Request.request(url)
.response(xhr2Listing)
.send<ResponseDatumGET[]>('GET', (error, response) => {
let r: ResponseDatumGET[];
if (!error) {
r = response;
const r: ResponseDatumGET[] = response;
console.log(r);
}
});
// method,request datum and callback for response handling
let r21: d3Request.Request = d3Request.request(url)
const r21: d3Request.Request = d3Request.request(url)
.response(xhr2Listing)
.send<RequestDatumGET, ResponseDatumGET[]>('GET', { kind: 'Listing' }, (error, response) => {
let r: ResponseDatumGET[];
if (!error) {
r = response;
const r: ResponseDatumGET[] = response;
console.log(r);
}
});
@ -290,28 +277,28 @@ let r21: d3Request.Request = d3Request.request(url)
// Timeout -----------------------------------------------------------------------
// get
let timeout: number = d3Request.request(url)
const timeout: number = d3Request.request(url)
.timeout();
// set
let r22: d3Request.Request = d3Request.request(url)
const r22: d3Request.Request = d3Request.request(url)
.timeout(500);
// User----------------------------------------------------------------------------
// get
let user: string = request.user();
const user: string = request.user();
// set
let r23: d3Request.Request = request.user('User');
const r23: d3Request.Request = request.user('User');
// -------------------------------------------------------------------------------
// HTML Request
// -------------------------------------------------------------------------------
let html: d3Request.Request = d3Request.html(url);
let htmlWithCallback: d3Request.Request = d3Request.html(url, function(error, data) {
let that: d3Request.Request = this;
let err: any = error;
let d: DocumentFragment = data;
const html: d3Request.Request = d3Request.html(url);
const htmlWithCallback: d3Request.Request = d3Request.html(url, function(error, data) {
const that: d3Request.Request = this;
const err: any = error;
const d: DocumentFragment = data;
console.log(d);
});
@ -319,11 +306,11 @@ let htmlWithCallback: d3Request.Request = d3Request.html(url, function(error, da
// JSON Request
// -------------------------------------------------------------------------------
let json: d3Request.Request = d3Request.json(url);
let jsonWithCallback: d3Request.Request = d3Request.json<ResponseDatumGET[]>(url, function(error, data) {
let that: d3Request.Request = this;
let err: any = error;
let d: ResponseDatumGET[] = data;
const json: d3Request.Request = d3Request.json(url);
const jsonWithCallback: d3Request.Request = d3Request.json<ResponseDatumGET[]>(url, function(error, data) {
const that: d3Request.Request = this;
const err: any = error;
const d: ResponseDatumGET[] = data;
console.log(d);
});
@ -331,11 +318,11 @@ let jsonWithCallback: d3Request.Request = d3Request.json<ResponseDatumGET[]>(url
// Text Request
// -------------------------------------------------------------------------------
let text: d3Request.Request = d3Request.text(url);
let textWithCallback: d3Request.Request = d3Request.text(url, function(error, data) {
let that: d3Request.Request = this;
let err: any = error;
let d: string = data;
const text: d3Request.Request = d3Request.text(url);
const textWithCallback: d3Request.Request = d3Request.text(url, function(error, data) {
const that: d3Request.Request = this;
const err: any = error;
const d: string = data;
console.log(d);
});
@ -343,11 +330,11 @@ let textWithCallback: d3Request.Request = d3Request.text(url, function(error, da
// XML Request
// -------------------------------------------------------------------------------
let xml: d3Request.Request = d3Request.xml(url);
let xmlWithCallback: d3Request.Request = d3Request.xml(url, function(error, data) {
let that: d3Request.Request = this;
let err: any = error;
let d: any = data;
const xml: d3Request.Request = d3Request.xml(url);
const xmlWithCallback: d3Request.Request = d3Request.xml(url, function(error, data) {
const that: d3Request.Request = this;
const err: any = error;
const d: any = data;
console.log(d);
});
@ -359,32 +346,29 @@ let xmlWithCallback: d3Request.Request = d3Request.xml(url, function(error, data
let csvRequest: d3Request.DsvRequest = d3Request.csv(url);
// url and callback for response handling
let csvRequestWithCallback: d3Request.DsvRequest = d3Request.csv(url, function(error, data) {
let that: d3Request.Request = this;
let err: any = error;
let d: DSVParsedArray<DSVRowString> = data;
const csvRequestWithCallback: d3Request.DsvRequest = d3Request.csv(url, function(error, data) {
const that: d3Request.Request = this;
const err: any = error;
const d: DSVParsedArray<DSVRowString> = data;
console.log(d);
});
// url, row mapping function and callback for response handling
let csvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.csv<ResponseDatumGET>(url,
const csvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.csv<ResponseDatumGET>(url,
(rawRow, index, columns) => {
let rr: DSVRowString = rawRow;
let i: number = index;
let cols: string[] = columns;
let mappedRow: ResponseDatumGET;
mappedRow = {
const rr: DSVRowString = rawRow;
const i: number = index;
const cols: string[] = columns;
const mappedRow: ResponseDatumGET = {
test: rr['test'],
value: +rr['value']
};
return mappedRow;
},
function(error, data) {
let that: d3Request.Request = this;
let err: any = error;
let d: DSVParsedArray<ResponseDatumGET> = data;
const that: d3Request.Request = this;
const err: any = error;
const d: DSVParsedArray<ResponseDatumGET> = data;
console.log(data);
});
@ -393,35 +377,32 @@ let csvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.csv<Response
// -------------------------------------------------------------------------------
// url only
let tsvRequest: d3Request.DsvRequest = d3Request.tsv(url);
const tsvRequest: d3Request.DsvRequest = d3Request.tsv(url);
// url and callback for response handling
let tsvRequestWithCallback: d3Request.DsvRequest = d3Request.tsv(url, function(error, data) {
let that: d3Request.Request = this;
let err: any = error;
let d: DSVParsedArray<DSVRowString> = data;
const tsvRequestWithCallback: d3Request.DsvRequest = d3Request.tsv(url, function(error, data) {
const that: d3Request.Request = this;
const err: any = error;
const d: DSVParsedArray<DSVRowString> = data;
console.log(d);
});
// url, row mapping function and callback for response handling
let tsvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.tsv<ResponseDatumGET>(url,
const tsvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.tsv<ResponseDatumGET>(url,
(rawRow, index, columns) => {
let rr: DSVRowString = rawRow;
let i: number = index;
let cols: string[] = columns;
let mappedRow: ResponseDatumGET;
mappedRow = {
const rr: DSVRowString = rawRow;
const i: number = index;
const cols: string[] = columns;
const mappedRow: ResponseDatumGET = {
test: rr['test'],
value: +rr['value']
};
return mappedRow;
},
function(error, data) {
let that: d3Request.Request = this;
let err: any = error;
let d: DSVParsedArray<ResponseDatumGET> = data;
const that: d3Request.Request = this;
const err: any = error;
const d: DSVParsedArray<ResponseDatumGET> = data;
console.log(data);
});
@ -433,16 +414,13 @@ let tsvRequestWithRowWithCallback: d3Request.DsvRequest = d3Request.tsv<Response
csvRequest = csvRequest
.row<ResponseDatumGET>((rawRow, index, columns) => {
let rr: DSVRowString = rawRow;
let i: number = index;
let cols: string[] = columns;
let mappedRow: ResponseDatumGET;
mappedRow = {
const rr: DSVRowString = rawRow;
const i: number = index;
const cols: string[] = columns;
const mappedRow: ResponseDatumGET = {
test: rr['test'],
value: +rr['value']
};
return mappedRow;
});

View File

@ -168,7 +168,7 @@ let sGraph: d3Sankey.SankeyGraph<SNodeExtra, SLinkExtra>;
// Obtain SankeyLayout Generator
// ---------------------------------------------------------------------------
let slgDefault: d3Sankey.SankeyLayout<d3Sankey.SankeyGraph<{}, {}>, {}, {}> = d3Sankey.sankey();
const slgDefault: d3Sankey.SankeyLayout<d3Sankey.SankeyGraph<{}, {}>, {}, {}> = d3Sankey.sankey();
let slgDAG: d3Sankey.SankeyLayout<DAG, SNodeExtra, SLinkExtra> = d3Sankey.sankey<DAG, SNodeExtra, SLinkExtra>();
let slgDAGCustomId: d3Sankey.SankeyLayout<DAGCustomId, SNodeExtraCustomId, SLinkExtra> = d3Sankey.sankey<DAGCustomId, SNodeExtraCustomId, SLinkExtra>();
@ -299,7 +299,7 @@ slgDAG = slgDAG.nodes(d => d.customNodes);
// Get -----------------------------------------------------------------------
let nodesAccessor: (d: DAG) => SNode[] = slgDAG.nodes();
const nodesAccessor: (d: DAG) => SNode[] = slgDAG.nodes();
// ---------------------------------------------------------------------------
// Links
@ -315,7 +315,7 @@ slgDAG = slgDAG.links(d => d.customLinks);
// Get -----------------------------------------------------------------------
let linksAccessor: (d: DAG) => SLink[] = slgDAG.links();
const linksAccessor: (d: DAG) => SLink[] = slgDAG.links();
// ---------------------------------------------------------------------------
// Compute Initial Layout
@ -344,7 +344,7 @@ pathGen = d3Sankey.sankeyLinkHorizontal<SNodeExtra, SLinkExtra>();
// Render to svg path
let svgPathString: string | null = pathGen(sGraph.links[0]);
const svgPathString: string | null = pathGen(sGraph.links[0]);
svgLinkPaths.attr('d', pathGen);
// Render to canvas
@ -361,7 +361,7 @@ pathGen(sGraph.links[0]);
// Sankey Node --------------------------------------------------------------
sNodes = sGraph.nodes;
let sNode = sNodes[0];
const sNode = sNodes[0];
// User-specified extra properties:
@ -386,7 +386,7 @@ linksArrMaybe = sNode.targetLinks;
// Sankey Link --------------------------------------------------------------
sLinks = sGraph.links;
let sLink = sLinks[0];
const sLink = sLinks[0];
// User-specified extra properties:

View File

@ -11,50 +11,50 @@ import * as d3ScaleChromatic from 'd3-scale-chromatic';
// -----------------------------------------------------------------------
// Categorical
// -----------------------------------------------------------------------
let accent: string = d3ScaleChromatic.schemeAccent[0]; // #7fc97f
let dark: string = d3ScaleChromatic.schemeDark2[0]; // #1b9e77
let paired: string = d3ScaleChromatic.schemePaired[0]; // #a6cee3
let pastel1: string = d3ScaleChromatic.schemePastel1[0]; // #fbb4ae
let pastel2: string = d3ScaleChromatic.schemePastel2[0]; // #b3e2cd
let set1: string = d3ScaleChromatic.schemeSet1[0]; // #e41a1c
let set2: string = d3ScaleChromatic.schemeSet2[0]; // #66c2a5
let set3: string = d3ScaleChromatic.schemeSet3[0]; // #8dd3c7
const accent: string = d3ScaleChromatic.schemeAccent[0]; // #7fc97f
const dark: string = d3ScaleChromatic.schemeDark2[0]; // #1b9e77
const paired: string = d3ScaleChromatic.schemePaired[0]; // #a6cee3
const pastel1: string = d3ScaleChromatic.schemePastel1[0]; // #fbb4ae
const pastel2: string = d3ScaleChromatic.schemePastel2[0]; // #b3e2cd
const set1: string = d3ScaleChromatic.schemeSet1[0]; // #e41a1c
const set2: string = d3ScaleChromatic.schemeSet2[0]; // #66c2a5
const set3: string = d3ScaleChromatic.schemeSet3[0]; // #8dd3c7
// -----------------------------------------------------------------------
// Diverging
// -----------------------------------------------------------------------
let BrBG: string = d3ScaleChromatic.interpolateBrBG(0); // rgb(84, 48, 5)
let PRGn: string = d3ScaleChromatic.interpolatePRGn(0); // rgb(64, 0, 75)
let PiYG: string = d3ScaleChromatic.interpolatePiYG(0); // rgb(142, 1, 82)
let PuOr: string = d3ScaleChromatic.interpolatePuOr(0); // rgb(127, 59, 8)
let RdBu: string = d3ScaleChromatic.interpolateRdBu(0); // rgb(103, 0, 31)
let RdGy: string = d3ScaleChromatic.interpolateRdGy(0); // rgb(103, 0, 31)
let RdYlBu: string = d3ScaleChromatic.interpolateRdYlBu(0); // rgb(103, 0, 31)
let RdYlGn: string = d3ScaleChromatic.interpolateRdYlGn(0); // rgb(103, 0, 31)
let Spectral: string = d3ScaleChromatic.interpolateSpectral(0); // rgb(158, 1, 66)
const BrBG: string = d3ScaleChromatic.interpolateBrBG(0); // rgb(84, 48, 5)
const PRGn: string = d3ScaleChromatic.interpolatePRGn(0); // rgb(64, 0, 75)
const PiYG: string = d3ScaleChromatic.interpolatePiYG(0); // rgb(142, 1, 82)
const PuOr: string = d3ScaleChromatic.interpolatePuOr(0); // rgb(127, 59, 8)
const RdBu: string = d3ScaleChromatic.interpolateRdBu(0); // rgb(103, 0, 31)
const RdGy: string = d3ScaleChromatic.interpolateRdGy(0); // rgb(103, 0, 31)
const RdYlBu: string = d3ScaleChromatic.interpolateRdYlBu(0); // rgb(103, 0, 31)
const RdYlGn: string = d3ScaleChromatic.interpolateRdYlGn(0); // rgb(103, 0, 31)
const Spectral: string = d3ScaleChromatic.interpolateSpectral(0); // rgb(158, 1, 66)
// -----------------------------------------------------------------------
// Sequential
// -----------------------------------------------------------------------
let Blue: string = d3ScaleChromatic.interpolateBlues(1); // rgb(8, 48, 107)
let Green: string = d3ScaleChromatic.interpolateGreens(1); // rgb(0, 68, 27)
let Grey: string = d3ScaleChromatic.interpolateGreys(1); // rgb(0, 0, 0)
let Orange: string = d3ScaleChromatic.interpolateOranges(1); // rgb(127, 39, 4)
let Purple: string = d3ScaleChromatic.interpolatePurples(1); // rgb(63, 0, 125)
let Red: string = d3ScaleChromatic.interpolateReds(1); // rgb(103, 0, 13)
const Blue: string = d3ScaleChromatic.interpolateBlues(1); // rgb(8, 48, 107)
const Green: string = d3ScaleChromatic.interpolateGreens(1); // rgb(0, 68, 27)
const Grey: string = d3ScaleChromatic.interpolateGreys(1); // rgb(0, 0, 0)
const Orange: string = d3ScaleChromatic.interpolateOranges(1); // rgb(127, 39, 4)
const Purple: string = d3ScaleChromatic.interpolatePurples(1); // rgb(63, 0, 125)
const Red: string = d3ScaleChromatic.interpolateReds(1); // rgb(103, 0, 13)
// -----------------------------------------------------------------------
// Sequential(Multi-Hue)
// -----------------------------------------------------------------------
let BuGn: string = d3ScaleChromatic.interpolateBuGn(1); // rgb(0, 68, 27)
let BuPu: string = d3ScaleChromatic.interpolateBuPu(1); // rgb(77, 0, 75)
let GnBu: string = d3ScaleChromatic.interpolateGnBu(1); // rgb(8, 64, 129)
let OrRd: string = d3ScaleChromatic.interpolateOrRd(1); // rgb(127, 0, 0)
let PuBuGn: string = d3ScaleChromatic.interpolatePuBuGn(1); // rgb(1, 70, 54)
let PuBu: string = d3ScaleChromatic.interpolatePuBu(1); // rgb(2, 56, 88)
let PuRd: string = d3ScaleChromatic.interpolatePuRd(1); // rgb(103, 0, 31)
let RdPu: string = d3ScaleChromatic.interpolateRdPu(1); // rgb(73, 0, 106)
let YlGnBu: string = d3ScaleChromatic.interpolateYlGnBu(1); // rgb(8, 29, 88)
let YlGn: string = d3ScaleChromatic.interpolateYlGn(1); // rgb(0, 69, 41)
let YlOrBr: string = d3ScaleChromatic.interpolateYlOrBr(1); // rgb(102, 37, 6)
let YlOrRd: string = d3ScaleChromatic.interpolateYlOrRd(1); // rgb(128, 0, 38)
const BuGn: string = d3ScaleChromatic.interpolateBuGn(1); // rgb(0, 68, 27)
const BuPu: string = d3ScaleChromatic.interpolateBuPu(1); // rgb(77, 0, 75)
const GnBu: string = d3ScaleChromatic.interpolateGnBu(1); // rgb(8, 64, 129)
const OrRd: string = d3ScaleChromatic.interpolateOrRd(1); // rgb(127, 0, 0)
const PuBuGn: string = d3ScaleChromatic.interpolatePuBuGn(1); // rgb(1, 70, 54)
const PuBu: string = d3ScaleChromatic.interpolatePuBu(1); // rgb(2, 56, 88)
const PuRd: string = d3ScaleChromatic.interpolatePuRd(1); // rgb(103, 0, 31)
const RdPu: string = d3ScaleChromatic.interpolateRdPu(1); // rgb(73, 0, 106)
const YlGnBu: string = d3ScaleChromatic.interpolateYlGnBu(1); // rgb(8, 29, 88)
const YlGn: string = d3ScaleChromatic.interpolateYlGn(1); // rgb(0, 69, 41)
const YlOrBr: string = d3ScaleChromatic.interpolateYlOrBr(1); // rgb(102, 37, 6)
const YlOrRd: string = d3ScaleChromatic.interpolateYlOrRd(1); // rgb(128, 0, 38)

View File

@ -447,8 +447,8 @@ let lineRadial: d3Shape.LineRadial<LineRadialDatum> = d3Shape.lineRadial<LineRad
// DEPRECATED Naming conventions test (cross-testing with new naming conventions)
let defaultRadialLine: d3Shape.RadialLine<[number, number]> = defaultLineRadial;
let radialLine: d3Shape.RadialLine<LineRadialDatum> = lineRadial;
const defaultRadialLine: d3Shape.RadialLine<[number, number]> = defaultLineRadial;
const radialLine: d3Shape.RadialLine<LineRadialDatum> = lineRadial;
defaultLineRadial = d3Shape.radialLine();
lineRadial = d3Shape.radialLine<LineRadialDatum>();
@ -685,8 +685,8 @@ let areaRadial: d3Shape.AreaRadial<AreaRadialDatum> = d3Shape.areaRadial<AreaRad
// DEPRECATED Naming conventions test (cross-testing with new naming conventions)
let defaultRadialArea: d3Shape.RadialArea<[number, number]> = defaultAreaRadial;
let radialArea: d3Shape.RadialArea<AreaRadialDatum> = areaRadial;
const defaultRadialArea: d3Shape.RadialArea<[number, number]> = defaultAreaRadial;
const radialArea: d3Shape.RadialArea<AreaRadialDatum> = areaRadial;
defaultAreaRadial = d3Shape.radialArea();
areaRadial = d3Shape.radialArea<AreaRadialDatum>();
@ -1322,7 +1322,7 @@ customSymbol = d3Shape.symbolWye;
// Test pointRadial
// -----------------------------------------------------------------------------------
let coordinatates: [number, number] = d3Shape.pointRadial(0, 12);
const coordinatates: [number, number] = d3Shape.pointRadial(0, 12);
// -----------------------------------------------------------------------------------
// Test Stacks

View File

@ -12,8 +12,6 @@ import * as d3TimeFormat from 'd3-time-format';
// Preparatory Steps
// ----------------------------------------------------------------------
let num: number;
let formatFn: (n: Date) => string;
let parseFn: (dateString: string) => (Date | null);
@ -38,21 +36,21 @@ parseFn = d3TimeFormat.utcParse('.%L');
// iso ------------------------------------------------------------------
let dateString: string = d3TimeFormat.isoFormat(new Date(2016, 6, 6));
let date: Date = d3TimeFormat.isoParse('2016-07-08T14:06:41.386Z');
const dateString: string = d3TimeFormat.isoFormat(new Date(2016, 6, 6));
const date: Date = d3TimeFormat.isoParse('2016-07-08T14:06:41.386Z');
// ----------------------------------------------------------------------
// Test Locale Definition
// ----------------------------------------------------------------------
let dateTimeSpecifier: string = localeDef.dateTime;
let dateSpecifier: string = localeDef.date;
let timeSpecifier: string = localeDef.time;
let periods: [string, string] = localeDef.periods;
let days: [string, string, string, string, string, string, string] = localeDef.days;
let shortDays: [string, string, string, string, string, string, string] = localeDef.shortDays;
let months: [string, string, string, string, string, string, string, string, string, string, string, string] = localeDef.months;
let shortMonths: [string, string, string, string, string, string, string, string, string, string, string, string] = localeDef.shortMonths;
const dateTimeSpecifier: string = localeDef.dateTime;
const dateSpecifier: string = localeDef.date;
const timeSpecifier: string = localeDef.time;
const periods: [string, string] = localeDef.periods;
const days: [string, string, string, string, string, string, string] = localeDef.days;
const shortDays: [string, string, string, string, string, string, string] = localeDef.shortDays;
const months: [string, string, string, string, string, string, string, string, string, string, string, string] = localeDef.months;
const shortMonths: [string, string, string, string, string, string, string, string, string, string, string, string] = localeDef.shortMonths;
localeDef = {
dateTime: '%a %b %e %X %Y',

View File

@ -11,9 +11,9 @@ import * as d3Time from 'd3-time';
let countableI: d3Time.CountableTimeInterval;
let simpleI: d3Time.TimeInterval;
let dateArray: Date[];
let start: Date = new Date(2014, 1, 1, 6, 0, 0, 0);
let end: Date = new Date(2016, 6, 13, 1, 25, 15, 500);
let inBetween: Date = new Date(2015, 6, 13, 1, 30, 5, 700);
const start: Date = new Date(2014, 1, 1, 6, 0, 0, 0);
const end: Date = new Date(2016, 6, 13, 1, 25, 15, 500);
const inBetween: Date = new Date(2015, 6, 13, 1, 30, 5, 700);
let resultDate: Date;
let count: number;
@ -75,7 +75,7 @@ simpleI = countableI.filter((d: Date) => d.getMonth() === 2);
count = countableI.count(start, end);
// let countableIOrNull: d3Time.CountableTimeInterval | null = countableI.every(10); // Test fails, since .every(...) return Interval and not CountableInterval
let simpleIOrNull: d3Time.TimeInterval | null = countableI.every(10);
const simpleIOrNull: d3Time.TimeInterval | null = countableI.every(10);
resultDate = simpleI.floor(inBetween);
resultDate = simpleI.round(inBetween);

View File

@ -9,7 +9,7 @@
import * as d3Timer from 'd3-timer';
// Test now definition
let now: number = d3Timer.now();
const now: number = d3Timer.now();
// Test timer and timerFlush definitions ------------

View File

@ -24,7 +24,7 @@ interface VoronoiTestDatum {
y: number;
}
let testData: VoronoiTestDatum[] = [
const testData: VoronoiTestDatum[] = [
{ x: 10, y: 10 },
{ x: 20, y: 10 },
{ x: 10, y: 20 },
@ -84,7 +84,7 @@ pointPair = [[10, 10], [50, 50]];
// VoronoiPolygon -------------------------------------------------------
let voronoiPolygon: d3Voronoi.VoronoiPolygon<VoronoiTestDatum>;
declare const voronoiPolygon: d3Voronoi.VoronoiPolygon<VoronoiTestDatum>;
voronoiPolygon[0][0] = 10; // x-coordinate of first point
voronoiPolygon[0][1] = 10; // y-coordinate of first point
@ -229,7 +229,6 @@ testDatum = link.target;
// find() ===============================================================
let nearestSite: d3Voronoi.VoronoiSite<VoronoiTestDatum> | null;
let wrongSiteDataType: d3Voronoi.VoronoiSite<[number, number]> | null;
// Without search radius
nearestSite = voronoiDiagram.find(10, 50);
@ -238,4 +237,4 @@ nearestSite = voronoiDiagram.find(10, 50);
nearestSite = voronoiDiagram.find(10, 50, 20);
// wrong data type
// wrongSiteDataType = voronoiDiagram.find(10, 50); // fails, due to data type mismatch
// const wrongSiteDataType: d3Voronoi.VoronoiSite<[number, number]> | null; = voronoiDiagram.find(10, 50); // fails, due to data type mismatch

View File

@ -1,6 +1,6 @@
// Type definitions for DateJS
// Project: http://www.datejs.com/
// Definitions by: David Khristepher Santos <http://github.com/rupertavery>
// Definitions by: David Khristepher Santos <https://github.com/rupertavery>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
//NOTE: This definition file is for the library located at http://datejs.googlecode.com/svn/ and documented at https://code.google.com/p/datejs/wiki/APIDocumentation

View File

@ -1,6 +1,6 @@
// Type definitions for DateJS - SugarPak Extensions
// Project: http://www.datejs.com/
// Definitions by: David Khristepher Santos <http://github.com/rupertavery>
// Definitions by: David Khristepher Santos <https://github.com/rupertavery>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** SugarPak.js - Domain Specific Language - Syntactical Sugar */

View File

@ -1,6 +1,6 @@
// Type definitions for db-migrate-pg
// Project: https://github.com/db-migrate/pg
// Definitions by: nickiannone <http://github.com/nickiannone>
// Definitions by: nickiannone <https://github.com/nickiannone>
// Definitions: https://github.com/nickiannone/DefinitelyTyped
// TypeScript Version: 2.3

View File

@ -7,7 +7,7 @@ function handle(res: number) {}
asyncFunction(42, handle);
// deasync
let wrapped = deasync(asyncFunction);
const wrapped = deasync(asyncFunction);
handle(wrapped(42));
// deasync.loopWhile

View File

@ -1,9 +1,9 @@
import { DM, Event, EventId } from 'debessmann';
let eventId: EventId = {seq: 0, time: new Date()};
let e: Event = {_id: eventId, headers: {header1: 'header1Val'}};
const eventId: EventId = {seq: 0, time: new Date()};
const e: Event = {_id: eventId, headers: {header1: 'header1Val'}};
let dm: DM = {
const dm: DM = {
init(endpoint: string, auth: string): void {
},
send(data: Event): void {

View File

@ -1,6 +1,6 @@
// Type definitions for decimal.js
// Project: http://mikemcl.github.io/decimal.js
// Definitions by: Joseph Rossi <http://github.com/musicist288>
// Definitions by: Joseph Rossi <https://github.com/musicist288>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var Decimal: decimal.IDecimalStatic;

View File

@ -1,6 +1,6 @@
// Type definitions for deep-equal 1.0
// Project: https://github.com/substack/node-deep-equal
// Definitions by: remojansen <https://github.com/remojansen>, Jay Anslow <http://github.com/janslow>
// Definitions by: remojansen <https://github.com/remojansen>, Jay Anslow <https://github.com/janslow>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface DeepEqualOptions {

View File

@ -1,6 +1,6 @@
import * as detect from "detect-port";
const port: number = 8000;
const port = 8000;
/**
* callback usage

View File

@ -1,6 +1,6 @@
// Type definitions for dhtmlxGantt 4.0.0
// Project: http://dhtmlx.com/docs/products/dhtmlxGantt
// Definitions by: Maksim Kozhukh <http://github.com/mkozhukh>, Christophe Camicas <http://github.com/chriscamicas>
// Definitions by: Maksim Kozhukh <https://github.com/mkozhukh>, Christophe Camicas <https://github.com/chriscamicas>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

Some files were not shown because too many files have changed in this diff Show More