diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts index 575f72b7cb..70c8f8a586 100644 --- a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts +++ b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts @@ -116,7 +116,6 @@ function test_timeZone() { strFormats = dp.timeZone() as string; } - function test_widgetParent() { let nullW: null = null; let str: string = "myId"; diff --git a/bootstrap.v3.datetimepicker/index.d.ts b/bootstrap.v3.datetimepicker/index.d.ts index d8ec008dca..653135057d 100644 --- a/bootstrap.v3.datetimepicker/index.d.ts +++ b/bootstrap.v3.datetimepicker/index.d.ts @@ -49,9 +49,9 @@ export interface Datetimepicker { hide(): void; /**Returns the components current options object. * Note that the changing the values of the returned object does not change the components actual configuration. */ - options(): DatetimepickerOptions + options(): DatetimepickerOptions; /**Takes an object variable with option key:value properties and configures the component. Use this to update multiple options on the component. */ - options(options: DatetimepickerOptions): void + options(options: DatetimepickerOptions): void; /**Shows the widget * Emits: * - dp.show - if the widget was hidden before that call @@ -85,14 +85,14 @@ export interface Datetimepicker { /**Returns the options.daysOfWeekDisabled configuration * IMPORTANT! Throws exception if not set explicitly https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1459 */ - daysOfWeekDisabled(): Array; + daysOfWeekDisabled(): number[]; /**Takes an [ Number:0 to 6 ] and disallow the user to select weekdays that exist in this array. * This has lower priority over the options.minDate, options.maxDate, options.disabledDates and options.enabledDates configuration settings. * Emits: * - dp.change - if the currently selected moment falls in the values passed on the daysOfWeek parameter. * - dp.error - if the currently selected moment falls in the values passed on the daysOfWeek parameter. */ - daysOfWeekDisabled(days: Array): void; + daysOfWeekDisabled(days: number[]): void; /**Returns the options.dayViewHeaderFormat option. */ dayViewHeaderFormat(): string; /**Used to customize the header of the day view. */ @@ -117,22 +117,22 @@ export interface Datetimepicker { */ disabledDates(dates: boolean | Array): void; /**Returns the options.disabledHours option. - * NOTES: probably should be: disabledHours(): boolean | Array; see: DatetimepickerOptions + * NOTES: probably should be: disabledHours(): boolean | number[]; see: DatetimepickerOptions */ disabledHours(): boolean | any; /**Must be in 24 hour format. Will disallow hour selections (much like disabledTimeIntervals) but will affect all days. * Like en/disabledDates, the en/disabledHours options are mutually exclusive and will reset one of the options back to false. */ - disabledHours(value: boolean | Array): void; + disabledHours(value: boolean | number[]): void; /**Returns the options.disabledTimeIntervals option, or... not exactly * IMPORTANT! Creates an object from the options.disabledTimeIntervals with the keys being numbers, the values being the moment arrays. * eg { "0": [, ], "1": [...] } * https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1498 */ - disabledTimeIntervals(): boolean | Array>; + disabledTimeIntervals(): boolean | moment.Moment[][]; /**Disables time selection between the given moments * eg: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]] */ - disabledTimeIntervals(value: boolean | Array>): void; + disabledTimeIntervals(value: boolean | moment.Moment[][]): void; /**Returns the options.enabledDates option * NOTES: probably should be: enabledDates(): boolean | Array; see: DatetimepickerOptions */ @@ -144,12 +144,12 @@ export interface Datetimepicker { */ enabledDates(dates: boolean | Array): void; /**Returns the options.enabledHours option. - * NOTES: probably should be: enabledHours(): boolean | Array; see: DatetimepickerOptions + * NOTES: probably should be: enabledHours(): boolean | number[]; see: DatetimepickerOptions */ enabledHours(): boolean | any; /**Must be in 24 hour format. Will allow hour selections (much like enabledTimeIntervals) but will affect all days. * Like en/disabledDates, the en/disabledHours options are mutually exclusive and will reset one of the options back to false. */ - enabledHours(value: boolean | Array): void; + enabledHours(value: boolean | number[]): void; /**Returns a boolean or array with the options.extraFormats option configuration */ extraFormats(): boolean | Array; /**Takes an array of valid input moment format options, or boolean:false */ @@ -303,7 +303,7 @@ export interface Datetimepicker { */ viewMode(value: string): void; /**Returns a $(element) variable with the currently set options.widgetParent option. */ - widgetParent(): string | JQuery | null + widgetParent(): string | JQuery | null; /**Takes a string or $(element) value. */ widgetParent(widgetParent: string | JQuery | null): void; /**Returns the options.widgetPositioning object */ @@ -332,7 +332,7 @@ export interface DatetimepickerOptions { * Accepts: array of numbers from 0-6 * @default: false */ - daysOfWeekDisabled?: Array | boolean; + daysOfWeekDisabled?: number[] | boolean; /**Changes the heading of the datepicker when in "days" view. * @default: "MMMM YYYY" */ @@ -358,12 +358,12 @@ export interface DatetimepickerOptions { * eg disabledHours = [0, 1]; -> disabledHours will be { "0": true, "1": true } * https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499 */ - disabledHours?: boolean | Array | any; + disabledHours?: boolean | number[] | any; /**Disables time selection between the given moments * eg: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]] * @default: false */ - disabledTimeIntervals?: boolean | Array>; + disabledTimeIntervals?: boolean | moment.Moment[][]; /**Disables selection of dates NOT in the array, e.g. holidays * @default: false * IMPORTANT! The getter returns an Object NOT an Array, with keys being the dates, values being true. @@ -377,7 +377,7 @@ export interface DatetimepickerOptions { * eg enabledHours = [0, 1]; -> enabledHours will be { "0": true, "1": true } * https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499 */ - enabledHours?: boolean | Array; + enabledHours?: boolean | number[]; /**Allows for several input formats to be valid. See: https://github.com/Eonasdan/bootstrap-datetimepicker/pull/666 * @default: false */ @@ -566,7 +566,6 @@ type EventName = "dp.show" | "dp.hide" | "dp.error"; declare global { interface JQuery { - datetimepicker(options?: DatetimepickerOptions): JQuery; data(key: "DateTimePicker"): Datetimepicker; @@ -575,21 +574,21 @@ declare global { on(events: "dp.change", selector: string, handler: (eventobject: ChangeEvent) => any): JQuery; on(events: "dp.change", selector: string, data: any, handler?: (eventobject: ChangeEvent) => any): JQuery; - off(events: "dp.change", handler: (eventobject: ChangeEvent) => any): JQuery; - off(events: "dp.change", selector?: string, handler?: (eventobject: ChangeEvent) => any): JQuery; + on(events: "dp.update", handler: (eventObject: UpdateEvent) => any): JQuery; + on(events: "dp.update", selector: string, handler: (eventobject: UpdateEvent) => any): JQuery; + on(events: "dp.update", selector: string, data: any, handler?: (eventobject: UpdateEvent) => any): JQuery; on(events: EventName , handler: (eventObject: Event) => any): JQuery; on(events: EventName, selector: string, handler: (eventobject: Event) => any): JQuery; on(events: EventName, selector: string, data: any, handler?: (eventobject: Event) => any): JQuery; - off(events: EventName, handler: (eventobject: Event) => any): JQuery; - off(events: EventName, selector?: string, handler?: (eventobject: Event) => any): JQuery; - - on(events: "dp.update", handler: (eventObject: UpdateEvent) => any): JQuery; - on(events: "dp.update", selector: string, handler: (eventobject: UpdateEvent) => any): JQuery; - on(events: "dp.update", selector: string, data: any, handler?: (eventobject: UpdateEvent) => any): JQuery; + off(events: "dp.change", handler: (eventobject: ChangeEvent) => any): JQuery; + off(events: "dp.change", selector?: string, handler?: (eventobject: ChangeEvent) => any): JQuery; off(events: "dp.update", handler: (eventobject: UpdateEvent) => any): JQuery; off(events: "dp.update", selector?: string, handler?: (eventobject: UpdateEvent) => any): JQuery; + + off(events: EventName, handler: (eventobject: Event) => any): JQuery; + off(events: EventName, selector?: string, handler?: (eventobject: Event) => any): JQuery; } } diff --git a/browser-bunyan/browser-bunyan-tests.ts b/browser-bunyan/browser-bunyan-tests.ts index ffb2ebf7a7..47f439a07e 100644 --- a/browser-bunyan/browser-bunyan-tests.ts +++ b/browser-bunyan/browser-bunyan-tests.ts @@ -1,6 +1,6 @@ import * as bunyan from "browser-bunyan"; -var log = bunyan.createLogger({ +const log = bunyan.createLogger({ name: 'play', serializers: bunyan.stdSerializers }); diff --git a/browser-bunyan/index.d.ts b/browser-bunyan/index.d.ts index f2981bfacd..bb243e4324 100644 --- a/browser-bunyan/index.d.ts +++ b/browser-bunyan/index.d.ts @@ -6,7 +6,7 @@ import bunyan = require("bunyan"); declare module "bunyan" { - export function ConsoleFormattedStream(): void; + function ConsoleFormattedStream(): void; } export = bunyan; diff --git a/bufferstream/bufferstream-tests.ts b/bufferstream/bufferstream-tests.ts index 06cbd43e28..609e8828c7 100644 --- a/bufferstream/bufferstream-tests.ts +++ b/bufferstream/bufferstream-tests.ts @@ -1,8 +1,6 @@ - - import BufferStream = require('bufferstream'); -var stream = new BufferStream({encoding: 'utf8', size: 'flexible'}); +const stream = new BufferStream({encoding: 'utf8', size: 'flexible'}); stream.enable(); stream.disable(); stream.split('//', ':'); @@ -11,4 +9,3 @@ stream.on('split', (chunk: any, token: any) => { }); stream.write("buffer:stream//23"); console.log(stream.toString()); - diff --git a/bufferstream/index.d.ts b/bufferstream/index.d.ts index 1d1ffcdb10..0642fd8740 100644 --- a/bufferstream/index.d.ts +++ b/bufferstream/index.d.ts @@ -59,9 +59,9 @@ declare class BufferStream extends stream.Duplex { */ length: number; } // https://github.com/dodo/node-bufferstream/blob/master/src/buffer-stream.coffee#L28 -declare namespace BufferStream { - export interface Opts { +declare namespace BufferStream { + interface Opts { /* default encoding for writing strings */ @@ -85,5 +85,5 @@ declare namespace BufferStream { // String or Buffer split?: any; } - export var fn: {warn: boolean}; + const fn: {warn: boolean}; } diff --git a/chai-json-schema/chai-json-schema-tests.ts b/chai-json-schema/chai-json-schema-tests.ts index 5d4715a76e..7273ac60cc 100644 --- a/chai-json-schema/chai-json-schema-tests.ts +++ b/chai-json-schema/chai-json-schema-tests.ts @@ -65,4 +65,3 @@ const data2 = [true, 123]; expect(chai.tv4.validate(data1, schema)).to.be.true; expect(chai.tv4.validate(data2, schema)).to.be.false; - diff --git a/chai-json-schema/index.d.ts b/chai-json-schema/index.d.ts index 1498510f9f..69aec8bec7 100644 --- a/chai-json-schema/index.d.ts +++ b/chai-json-schema/index.d.ts @@ -9,16 +9,16 @@ import tv4 = require('tv4'); declare global { namespace Chai { - export interface Assert { + interface Assert { jsonSchema(value: any, schema: any, msg?: string): void; notJsonSchema(value: any, schema: any, msg?: string): void; } - export interface LanguageChains { + interface LanguageChains { jsonSchema(schema: any, msg?: string): void; } - export interface ChaiStatic { + interface ChaiStatic { tv4: tv4.TV4; } } diff --git a/clamp-js/index.d.ts b/clamp-js/index.d.ts index 2e86e544f7..2fa557bac6 100755 --- a/clamp-js/index.d.ts +++ b/clamp-js/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace clamp { - export interface ClampOptions { + interface ClampOptions { clamp?: number|string; useNativeClamp?: boolean; splitOnChars?: string[]; @@ -13,9 +13,9 @@ declare namespace clamp { truncationHTML?: string | null; } - export interface ClampResponse { - 'original': string; - 'clamped': string; + interface ClampResponse { + original: string; + clamped: string; } } diff --git a/co-views/index.d.ts b/co-views/index.d.ts index 5df2238c12..3eda7191b1 100644 --- a/co-views/index.d.ts +++ b/co-views/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace CoViews { - export interface Options { + interface Options { /** * default extname */ diff --git a/combined-stream/index.d.ts b/combined-stream/index.d.ts index cada758701..271814a4af 100644 --- a/combined-stream/index.d.ts +++ b/combined-stream/index.d.ts @@ -43,14 +43,14 @@ declare class CombinedStream extends Stream implements CombinedStream.Options { } declare namespace CombinedStream { - export interface Options { + interface Options { maxDataSize?: number; pauseStreams?: boolean; } - export function create(options?: Options): CombinedStream; + function create(options?: Options): CombinedStream; - export function isStreamLike(stream: any): stream is Stream; + function isStreamLike(stream: any): stream is Stream; } export = CombinedStream; diff --git a/compression-webpack-plugin/index.d.ts b/compression-webpack-plugin/index.d.ts index 536a77b8e9..4f2453e3b1 100644 --- a/compression-webpack-plugin/index.d.ts +++ b/compression-webpack-plugin/index.d.ts @@ -12,7 +12,7 @@ declare class CompressionPlugin extends Plugin { } declare namespace CompressionPlugin { - export interface Options { + interface Options { asset?: string; algorithm?: string; test?: RegExp | RegExp[]; diff --git a/configstore/configstore-tests.ts b/configstore/configstore-tests.ts index 724dbe9a38..ffd04e31a7 100644 --- a/configstore/configstore-tests.ts +++ b/configstore/configstore-tests.ts @@ -1,12 +1,10 @@ - import Configstore = require('configstore'); -var cs = new Configstore('foo'); +const cs = new Configstore('foo'); -var value: any; -var key: string; -var num: number; -var bool: any; -var object: any; +let value: any; +let key: string; +let num: number; +let object: any; cs.set(key, value); value = cs.get(key); diff --git a/configstore/index.d.ts b/configstore/index.d.ts index 628a4a1d6c..2617f2bce0 100644 --- a/configstore/index.d.ts +++ b/configstore/index.d.ts @@ -65,7 +65,7 @@ declare class Configstore { } declare namespace Configstore { - export interface ConfigstoreOptions { + interface ConfigstoreOptions { globalConfigPath?: boolean; } } diff --git a/connect-ensure-login/connect-ensure-login-tests.ts b/connect-ensure-login/connect-ensure-login-tests.ts index 68ce1a76a2..708f76a9ba 100644 --- a/connect-ensure-login/connect-ensure-login-tests.ts +++ b/connect-ensure-login/connect-ensure-login-tests.ts @@ -10,4 +10,4 @@ login.ensureLoggedOut(); login.ensureLoggedOut("/"); login.ensureLoggedOut({ redirectTo: "/", -}); \ No newline at end of file +}); diff --git a/connect-ensure-login/index.d.ts b/connect-ensure-login/index.d.ts index d542f63a90..fb1716abf9 100644 --- a/connect-ensure-login/index.d.ts +++ b/connect-ensure-login/index.d.ts @@ -47,7 +47,7 @@ interface LoggedOutOptions { * ensureLoggedIn({ redirectTo: '/session/new', setReturnTo: false }), * function(req, res) { ... }); */ -export declare function ensureLoggedIn(options?: LoggedInOptions | string): RequestHandler; +export function ensureLoggedIn(options?: LoggedInOptions | string): RequestHandler; /** * Ensure that no user is logged in before proceeding to next route middleware. @@ -70,4 +70,4 @@ export declare function ensureLoggedIn(options?: LoggedInOptions | string): Requ * ensureLoggedOut({ redirectTo: '/home' }), * function(req, res) { ... }); */ -export declare function ensureLoggedOut(options?: LoggedOutOptions | string): RequestHandler; \ No newline at end of file +export function ensureLoggedOut(options?: LoggedOutOptions | string): RequestHandler; diff --git a/content-disposition/index.d.ts b/content-disposition/index.d.ts index 4d0bbd8d94..31e60c1041 100644 --- a/content-disposition/index.d.ts +++ b/content-disposition/index.d.ts @@ -4,17 +4,17 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace contentDisposition { - export interface ContentDisposition { + interface ContentDisposition { type: string; parameters: any; } - export interface Options { + interface Options { type?: string; fallback?: string | boolean; } - export function parse(contentDispositionHeader: string): ContentDisposition; + function parse(contentDispositionHeader: string): ContentDisposition; } declare function contentDisposition(filename?: string, options?: contentDisposition.Options): string; diff --git a/cookies/cookies-tests.ts b/cookies/cookies-tests.ts index 5a2ad1e4a7..112246907c 100644 --- a/cookies/cookies-tests.ts +++ b/cookies/cookies-tests.ts @@ -36,4 +36,4 @@ const server = http.createServer((req, res) => { "tampered expected: undefined\n\n" + "tampered: " + tampered + "\n\n" ); -}); \ No newline at end of file +}); diff --git a/cookies/index.d.ts b/cookies/index.d.ts index 390890bb4a..55feb7ec7d 100644 --- a/cookies/index.d.ts +++ b/cookies/index.d.ts @@ -7,7 +7,7 @@ import { IncomingMessage, ServerResponse } from 'http'; import * as Keygrip from 'keygrip'; -declare interface Cookies { +interface Cookies { secure: boolean; request: IncomingMessage; response: ServerResponse; @@ -27,27 +27,26 @@ declare interface Cookies { set(name: string, value?: string, opts?: Cookies.SetOption): this; } - declare namespace Cookies { /** * for backward-compatibility */ - export type ICookies = Cookies; + type ICookies = Cookies; /** * for backward-compatibility */ - export type IOptions = SetOption; + type IOptions = SetOption; - export interface Option { + interface Option { keys: string[] | Keygrip; secure?: boolean; } - export interface GetOption { + interface GetOption { signed: boolean; } - export interface SetOption { + interface SetOption { /** * a number representing the milliseconds from Date.now() for expiry */ @@ -97,9 +96,9 @@ declare namespace Cookies { overwrite?: boolean; } - export type CookieAttr = SetOption; + type CookieAttr = SetOption; - export interface Cookie { + interface Cookie { name: string; value: string; /** @@ -119,7 +118,7 @@ declare namespace Cookies { } } -declare interface CookiesFunction { +interface CookiesFunction { (request: IncomingMessage, response: ServerResponse, options?: Cookies.Option): Cookies; /** * "options" array of key strings is deprecated, provide using options {"keys": keygrip} diff --git a/core-decorators/core-decorators-tests.ts b/core-decorators/core-decorators-tests.ts index 04a22c19cf..ef4659e56b 100644 --- a/core-decorators/core-decorators-tests.ts +++ b/core-decorators/core-decorators-tests.ts @@ -1,4 +1,3 @@ - // // @autobind // @@ -35,7 +34,7 @@ class Meal { entree: string = 'steak'; } -var dinner = new Meal(); +const dinner = new Meal(); dinner.entree = 'salmon'; // @@ -99,11 +98,9 @@ person2.facepalmHarder(); // @debounce // - import { debounce } from 'core-decorators'; class Editor { - content = ''; @debounce(500) @@ -119,7 +116,6 @@ class Editor { import { throttle } from 'core-decorators'; class Editor2 { - content = ''; @throttle(500, {leading: false}) @@ -162,8 +158,8 @@ class Meal2 { cost: number = 4.44; } -var dinner2 = new Meal2(); -for (var key in dinner2) { +const dinner2 = new Meal2(); +for (const key in dinner2) { key; // "entree" only, not "cost" } @@ -182,7 +178,7 @@ class Meal3 { entree: string = 'steak'; } -var dinner3 = new Meal3(); +const dinner3 = new Meal3(); Object.defineProperty(dinner3, 'entree', { enumerable: false @@ -196,7 +192,7 @@ Object.defineProperty(dinner3, 'entree', { declare function memoize(func: T): T; import { decorate } from 'core-decorators'; -var count = 0; +let count = 0; class Task { @decorate(memoize) @@ -207,8 +203,8 @@ class Task { } } -var task = new Task(); -var data = [1, 2, 3]; +const task = new Task(); +const data = [1, 2, 3]; task.doSomethingExpensive(data); task.doSomethingExpensive(data); @@ -232,7 +228,7 @@ class Editor3 { hugeBuffer = createHugeBuffer(); } -var editor = new Editor3(); +const editor = new Editor3(); // createHugeBuffer() has not been called yet editor.hugeBuffer; @@ -270,7 +266,7 @@ class Bird { } } -var bird = new Bird(); +const bird = new Bird(); bird.singMatingCall(); // alerts "tweet tweet" @@ -288,17 +284,12 @@ const myConsole = { class Bird2 { @time('sing') - sing() { - } + sing() {} @time('sing2', myConsole) - sing2() { - - } + sing2() {} } -var bird2 = new Bird2(); +const bird2 = new Bird2(); bird2.sing(); // console.time label will be 'sing-0' bird2.sing(); // console.time label will be 'sing-1' - - diff --git a/core-js/core-js-tests.ts b/core-js/core-js-tests.ts index 0614b117b9..3f585db33e 100644 --- a/core-js/core-js-tests.ts +++ b/core-js/core-js-tests.ts @@ -1,5 +1,3 @@ - - interface Point { x: number; y: number; } interface Point3D extends Point { z: number; } diff --git a/core-js/index.d.ts b/core-js/index.d.ts index 4191cd11aa..39eb9b9f39 100644 --- a/core-js/index.d.ts +++ b/core-js/index.d.ts @@ -324,7 +324,7 @@ interface Log extends Console { /** * Non-standard. */ -declare var log: Log; +declare const log: Log; // ############################################################################################# // Dict - https://github.com/zloirock/core-js/#dict @@ -371,7 +371,7 @@ interface DictConstructor { /** * Non-standard. */ -declare var Dict: DictConstructor; +declare const Dict: DictConstructor; // ############################################################################################# // Partial application - https://github.com/zloirock/core-js/#partial-application @@ -456,7 +456,7 @@ interface String { declare function delay(msec: number): Promise; declare namespace core { - var version: string; + const version: string; namespace Reflect { function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; @@ -475,7 +475,7 @@ declare namespace core { function setPrototypeOf(target: any, proto: any): boolean; } - var Object: { + const Object: { getPrototypeOf(o: any): any; getOwnPropertyNames(o: any): string[]; create(o: any, properties?: PropertyDescriptorMap): any; @@ -502,12 +502,12 @@ declare namespace core { make(proto: T, mixin?: any): T; }; - var Function: { + const Function: { bind(target: Function, thisArg: any, ...argArray: any[]): any; part(target: Function, ...args: any[]): any; }; - var Array: { + const Array: { from(arrayLike: ArrayLike | Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): U[]; from(arrayLike: ArrayLike | Iterable): T[]; of(...items: T[]): T[]; @@ -544,7 +544,7 @@ declare namespace core { turn(array: ArrayLike, callbackfn: (memo: U, value: T, index: number, array: T[]) => void, memo?: U): U; }; - var String: { + const String: { codePointAt(text: string, pos: number): number; includes(text: string, searchString: string, position?: number): boolean; endsWith(text: string, searchString: string, endPosition?: number): boolean; @@ -559,14 +559,14 @@ declare namespace core { unescapeHTML(text: string): string; }; - var Date: { + const Date: { now(): number; toISOString(date: Date): string; format(date: Date, template: string, locale?: string): string; formatUTC(date: Date, template: string, locale?: string): string; }; - var Number: { + const Number: { EPSILON: number; isFinite(number: number): boolean; isInteger(number: number): boolean; @@ -596,7 +596,7 @@ declare namespace core { random(lim?: number): number; }; - var Math: { + const Math: { clz32(x: number): number; imul(x: number, y: number): number; sign(x: number): number; @@ -616,20 +616,20 @@ declare namespace core { cbrt(x: number): number; }; - var RegExp: { + const RegExp: { escape(str: string): string; }; - var Map: MapConstructor; - var Set: SetConstructor; - var WeakMap: WeakMapConstructor; - var WeakSet: WeakSetConstructor; - var Promise: PromiseConstructor; - var Symbol: SymbolConstructor; - var Dict: DictConstructor; - var global: any; - var log: Log; - var _: boolean; + const Map: MapConstructor; + const Set: SetConstructor; + const WeakMap: WeakMapConstructor; + const WeakSet: WeakSetConstructor; + const Promise: PromiseConstructor; + const Symbol: SymbolConstructor; + const Dict: DictConstructor; + const global: any; + const log: Log; + const _: boolean; function setTimeout(handler: any, timeout?: any, ...args: any[]): number; @@ -671,47 +671,47 @@ declare module "core-js/core/$for" { export = $for; } declare module "core-js/core/_" { - var _: typeof core._; + const _: typeof core._; export = _; } declare module "core-js/core/array" { - var Array: typeof core.Array; + const Array: typeof core.Array; export = Array; } declare module "core-js/core/date" { - var Date: typeof core.Date; + const Date: typeof core.Date; export = Date; } declare module "core-js/core/delay" { - var delay: typeof core.delay; + const delay: typeof core.delay; export = delay; } declare module "core-js/core/dict" { - var Dict: typeof core.Dict; + const Dict: typeof core.Dict; export = Dict; } declare module "core-js/core/function" { - var Function: typeof core.Function; + const Function: typeof core.Function; export = Function; } declare module "core-js/core/global" { - var global: typeof core.global; + const global: typeof core.global; export = global; } declare module "core-js/core/log" { - var log: typeof core.log; + const log: typeof core.log; export = log; } declare module "core-js/core/number" { - var Number: typeof core.Number; + const Number: typeof core.Number; export = Number; } declare module "core-js/core/object" { - var Object: typeof core.Object; + const Object: typeof core.Object; export = Object; } declare module "core-js/core/string" { - var String: typeof core.String; + const String: typeof core.String; export = String; } declare module "core-js/fn/$for" { @@ -719,613 +719,613 @@ declare module "core-js/fn/$for" { export = $for; } declare module "core-js/fn/_" { - var _: typeof core._; + const _: typeof core._; export = _; } declare module "core-js/fn/clear-immediate" { - var clearImmediate: typeof core.clearImmediate; + const clearImmediate: typeof core.clearImmediate; export = clearImmediate; } declare module "core-js/fn/delay" { - var delay: typeof core.delay; + const delay: typeof core.delay; export = delay; } declare module "core-js/fn/dict" { - var Dict: typeof core.Dict; + const Dict: typeof core.Dict; export = Dict; } declare module "core-js/fn/get-iterator" { - var getIterator: typeof core.getIterator; + const getIterator: typeof core.getIterator; export = getIterator; } declare module "core-js/fn/global" { - var global: typeof core.global; + const global: typeof core.global; export = global; } declare module "core-js/fn/is-iterable" { - var isIterable: typeof core.isIterable; + const isIterable: typeof core.isIterable; export = isIterable; } declare module "core-js/fn/log" { - var log: typeof core.log; + const log: typeof core.log; export = log; } declare module "core-js/fn/map" { - var Map: typeof core.Map; + const Map: typeof core.Map; export = Map; } declare module "core-js/fn/promise" { - var Promise: typeof core.Promise; + const Promise: typeof core.Promise; export = Promise; } declare module "core-js/fn/set" { - var Set: typeof core.Set; + const Set: typeof core.Set; export = Set; } declare module "core-js/fn/set-immediate" { - var setImmediate: typeof core.setImmediate; + const setImmediate: typeof core.setImmediate; export = setImmediate; } declare module "core-js/fn/set-interval" { - var setInterval: typeof core.setInterval; + const setInterval: typeof core.setInterval; export = setInterval; } declare module "core-js/fn/set-timeout" { - var setTimeout: typeof core.setTimeout; + const setTimeout: typeof core.setTimeout; export = setTimeout; } declare module "core-js/fn/weak-map" { - var WeakMap: typeof core.WeakMap; + const WeakMap: typeof core.WeakMap; export = WeakMap; } declare module "core-js/fn/weak-set" { - var WeakSet: typeof core.WeakSet; + const WeakSet: typeof core.WeakSet; export = WeakSet; } declare module "core-js/fn/array" { - var Array: typeof core.Array; + const Array: typeof core.Array; export = Array; } declare module "core-js/fn/array/concat" { - var concat: typeof core.Array.concat; + const concat: typeof core.Array.concat; export = concat; } declare module "core-js/fn/array/copy-within" { - var copyWithin: typeof core.Array.copyWithin; + const copyWithin: typeof core.Array.copyWithin; export = copyWithin; } declare module "core-js/fn/array/entries" { - var entries: typeof core.Array.entries; + const entries: typeof core.Array.entries; export = entries; } declare module "core-js/fn/array/every" { - var every: typeof core.Array.every; + const every: typeof core.Array.every; export = every; } declare module "core-js/fn/array/fill" { - var fill: typeof core.Array.fill; + const fill: typeof core.Array.fill; export = fill; } declare module "core-js/fn/array/filter" { - var filter: typeof core.Array.filter; + const filter: typeof core.Array.filter; export = filter; } declare module "core-js/fn/array/find" { - var find: typeof core.Array.find; + const find: typeof core.Array.find; export = find; } declare module "core-js/fn/array/find-index" { - var findIndex: typeof core.Array.findIndex; + const findIndex: typeof core.Array.findIndex; export = findIndex; } declare module "core-js/fn/array/for-each" { - var forEach: typeof core.Array.forEach; + const forEach: typeof core.Array.forEach; export = forEach; } declare module "core-js/fn/array/from" { - var from: typeof core.Array.from; + const from: typeof core.Array.from; export = from; } declare module "core-js/fn/array/includes" { - var includes: typeof core.Array.includes; + const includes: typeof core.Array.includes; export = includes; } declare module "core-js/fn/array/index-of" { - var indexOf: typeof core.Array.indexOf; + const indexOf: typeof core.Array.indexOf; export = indexOf; } declare module "core-js/fn/array/join" { - var join: typeof core.Array.join; + const join: typeof core.Array.join; export = join; } declare module "core-js/fn/array/keys" { - var keys: typeof core.Array.keys; + const keys: typeof core.Array.keys; export = keys; } declare module "core-js/fn/array/last-index-of" { - var lastIndexOf: typeof core.Array.lastIndexOf; + const lastIndexOf: typeof core.Array.lastIndexOf; export = lastIndexOf; } declare module "core-js/fn/array/map" { - var map: typeof core.Array.map; + const map: typeof core.Array.map; export = map; } declare module "core-js/fn/array/of" { - var of: typeof core.Array.of; + const of: typeof core.Array.of; export = of; } declare module "core-js/fn/array/pop" { - var pop: typeof core.Array.pop; + const pop: typeof core.Array.pop; export = pop; } declare module "core-js/fn/array/push" { - var push: typeof core.Array.push; + const push: typeof core.Array.push; export = push; } declare module "core-js/fn/array/reduce" { - var reduce: typeof core.Array.reduce; + const reduce: typeof core.Array.reduce; export = reduce; } declare module "core-js/fn/array/reduce-right" { - var reduceRight: typeof core.Array.reduceRight; + const reduceRight: typeof core.Array.reduceRight; export = reduceRight; } declare module "core-js/fn/array/reverse" { - var reverse: typeof core.Array.reverse; + const reverse: typeof core.Array.reverse; export = reverse; } declare module "core-js/fn/array/shift" { - var shift: typeof core.Array.shift; + const shift: typeof core.Array.shift; export = shift; } declare module "core-js/fn/array/slice" { - var slice: typeof core.Array.slice; + const slice: typeof core.Array.slice; export = slice; } declare module "core-js/fn/array/some" { - var some: typeof core.Array.some; + const some: typeof core.Array.some; export = some; } declare module "core-js/fn/array/sort" { - var sort: typeof core.Array.sort; + const sort: typeof core.Array.sort; export = sort; } declare module "core-js/fn/array/splice" { - var splice: typeof core.Array.splice; + const splice: typeof core.Array.splice; export = splice; } declare module "core-js/fn/array/turn" { - var turn: typeof core.Array.turn; + const turn: typeof core.Array.turn; export = turn; } declare module "core-js/fn/array/unshift" { - var unshift: typeof core.Array.unshift; + const unshift: typeof core.Array.unshift; export = unshift; } declare module "core-js/fn/array/values" { - var values: typeof core.Array.values; + const values: typeof core.Array.values; export = values; } declare module "core-js/fn/date" { - var Date: typeof core.Date; + const Date: typeof core.Date; export = Date; } declare module "core-js/fn/date/add-locale" { - var addLocale: typeof core.addLocale; + const addLocale: typeof core.addLocale; export = addLocale; } declare module "core-js/fn/date/format" { - var format: typeof core.Date.format; + const format: typeof core.Date.format; export = format; } declare module "core-js/fn/date/formatUTC" { - var formatUTC: typeof core.Date.formatUTC; + const formatUTC: typeof core.Date.formatUTC; export = formatUTC; } declare module "core-js/fn/function" { - var Function: typeof core.Function; + const Function: typeof core.Function; export = Function; } declare module "core-js/fn/function/has-instance" { - var hasInstance: (value: any) => boolean; + const hasInstance: (value: any) => boolean; export = hasInstance; } declare module "core-js/fn/function/name" { } declare module "core-js/fn/function/part" { - var part: typeof core.Function.part; + const part: typeof core.Function.part; export = part; } declare module "core-js/fn/math" { - var Math: typeof core.Math; + const Math: typeof core.Math; export = Math; } declare module "core-js/fn/math/acosh" { - var acosh: typeof core.Math.acosh; + const acosh: typeof core.Math.acosh; export = acosh; } declare module "core-js/fn/math/asinh" { - var asinh: typeof core.Math.asinh; + const asinh: typeof core.Math.asinh; export = asinh; } declare module "core-js/fn/math/atanh" { - var atanh: typeof core.Math.atanh; + const atanh: typeof core.Math.atanh; export = atanh; } declare module "core-js/fn/math/cbrt" { - var cbrt: typeof core.Math.cbrt; + const cbrt: typeof core.Math.cbrt; export = cbrt; } declare module "core-js/fn/math/clz32" { - var clz32: typeof core.Math.clz32; + const clz32: typeof core.Math.clz32; export = clz32; } declare module "core-js/fn/math/cosh" { - var cosh: typeof core.Math.cosh; + const cosh: typeof core.Math.cosh; export = cosh; } declare module "core-js/fn/math/expm1" { - var expm1: typeof core.Math.expm1; + const expm1: typeof core.Math.expm1; export = expm1; } declare module "core-js/fn/math/fround" { - var fround: typeof core.Math.fround; + const fround: typeof core.Math.fround; export = fround; } declare module "core-js/fn/math/hypot" { - var hypot: typeof core.Math.hypot; + const hypot: typeof core.Math.hypot; export = hypot; } declare module "core-js/fn/math/imul" { - var imul: typeof core.Math.imul; + const imul: typeof core.Math.imul; export = imul; } declare module "core-js/fn/math/log10" { - var log10: typeof core.Math.log10; + const log10: typeof core.Math.log10; export = log10; } declare module "core-js/fn/math/log1p" { - var log1p: typeof core.Math.log1p; + const log1p: typeof core.Math.log1p; export = log1p; } declare module "core-js/fn/math/log2" { - var log2: typeof core.Math.log2; + const log2: typeof core.Math.log2; export = log2; } declare module "core-js/fn/math/sign" { - var sign: typeof core.Math.sign; + const sign: typeof core.Math.sign; export = sign; } declare module "core-js/fn/math/sinh" { - var sinh: typeof core.Math.sinh; + const sinh: typeof core.Math.sinh; export = sinh; } declare module "core-js/fn/math/tanh" { - var tanh: typeof core.Math.tanh; + const tanh: typeof core.Math.tanh; export = tanh; } declare module "core-js/fn/math/trunc" { - var trunc: typeof core.Math.trunc; + const trunc: typeof core.Math.trunc; export = trunc; } declare module "core-js/fn/number" { - var Number: typeof core.Number; + const Number: typeof core.Number; export = Number; } declare module "core-js/fn/number/epsilon" { - var EPSILON: typeof core.Number.EPSILON; + const EPSILON: typeof core.Number.EPSILON; export = EPSILON; } declare module "core-js/fn/number/is-finite" { - var isFinite: typeof core.Number.isFinite; + const isFinite: typeof core.Number.isFinite; export = isFinite; } declare module "core-js/fn/number/is-integer" { - var isInteger: typeof core.Number.isInteger; + const isInteger: typeof core.Number.isInteger; export = isInteger; } declare module "core-js/fn/number/is-nan" { - var isNaN: typeof core.Number.isNaN; + const isNaN: typeof core.Number.isNaN; export = isNaN; } declare module "core-js/fn/number/is-safe-integer" { - var isSafeInteger: typeof core.Number.isSafeInteger; + const isSafeInteger: typeof core.Number.isSafeInteger; export = isSafeInteger; } declare module "core-js/fn/number/max-safe-integer" { - var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER; + const MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER; export = MAX_SAFE_INTEGER; } declare module "core-js/fn/number/min-safe-integer" { - var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER; + const MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER; export = MIN_SAFE_INTEGER; } declare module "core-js/fn/number/parse-float" { - var parseFloat: typeof core.Number.parseFloat; + const parseFloat: typeof core.Number.parseFloat; export = parseFloat; } declare module "core-js/fn/number/parse-int" { - var parseInt: typeof core.Number.parseInt; + const parseInt: typeof core.Number.parseInt; export = parseInt; } declare module "core-js/fn/number/random" { - var random: typeof core.Number.random; + const random: typeof core.Number.random; export = random; } declare module "core-js/fn/object" { - var Object: typeof core.Object; + const Object: typeof core.Object; export = Object; } declare module "core-js/fn/object/assign" { - var assign: typeof core.Object.assign; + const assign: typeof core.Object.assign; export = assign; } declare module "core-js/fn/object/classof" { - var classof: typeof core.Object.classof; + const classof: typeof core.Object.classof; export = classof; } declare module "core-js/fn/object/create" { - var create: typeof core.Object.create; + const create: typeof core.Object.create; export = create; } declare module "core-js/fn/object/define" { - var define: typeof core.Object.define; + const define: typeof core.Object.define; export = define; } declare module "core-js/fn/object/define-properties" { - var defineProperties: typeof core.Object.defineProperties; + const defineProperties: typeof core.Object.defineProperties; export = defineProperties; } declare module "core-js/fn/object/define-property" { - var defineProperty: typeof core.Object.defineProperty; + const defineProperty: typeof core.Object.defineProperty; export = defineProperty; } declare module "core-js/fn/object/entries" { - var entries: typeof core.Object.entries; + const entries: typeof core.Object.entries; export = entries; } declare module "core-js/fn/object/freeze" { - var freeze: typeof core.Object.freeze; + const freeze: typeof core.Object.freeze; export = freeze; } declare module "core-js/fn/object/get-own-property-descriptor" { - var getOwnPropertyDescriptor: typeof core.Object.getOwnPropertyDescriptor; + const getOwnPropertyDescriptor: typeof core.Object.getOwnPropertyDescriptor; export = getOwnPropertyDescriptor; } declare module "core-js/fn/object/get-own-property-descriptors" { - var getOwnPropertyDescriptors: typeof core.Object.getOwnPropertyDescriptors; + const getOwnPropertyDescriptors: typeof core.Object.getOwnPropertyDescriptors; export = getOwnPropertyDescriptors; } declare module "core-js/fn/object/get-own-property-names" { - var getOwnPropertyNames: typeof core.Object.getOwnPropertyNames; + const getOwnPropertyNames: typeof core.Object.getOwnPropertyNames; export = getOwnPropertyNames; } declare module "core-js/fn/object/get-own-property-symbols" { - var getOwnPropertySymbols: typeof core.Object.getOwnPropertySymbols; + const getOwnPropertySymbols: typeof core.Object.getOwnPropertySymbols; export = getOwnPropertySymbols; } declare module "core-js/fn/object/get-prototype-of" { - var getPrototypeOf: typeof core.Object.getPrototypeOf; + const getPrototypeOf: typeof core.Object.getPrototypeOf; export = getPrototypeOf; } declare module "core-js/fn/object/is" { - var is: typeof core.Object.is; + const is: typeof core.Object.is; export = is; } declare module "core-js/fn/object/is-extensible" { - var isExtensible: typeof core.Object.isExtensible; + const isExtensible: typeof core.Object.isExtensible; export = isExtensible; } declare module "core-js/fn/object/is-frozen" { - var isFrozen: typeof core.Object.isFrozen; + const isFrozen: typeof core.Object.isFrozen; export = isFrozen; } declare module "core-js/fn/object/is-object" { - var isObject: typeof core.Object.isObject; + const isObject: typeof core.Object.isObject; export = isObject; } declare module "core-js/fn/object/is-sealed" { - var isSealed: typeof core.Object.isSealed; + const isSealed: typeof core.Object.isSealed; export = isSealed; } declare module "core-js/fn/object/keys" { - var keys: typeof core.Object.keys; + const keys: typeof core.Object.keys; export = keys; } declare module "core-js/fn/object/make" { - var make: typeof core.Object.make; + const make: typeof core.Object.make; export = make; } declare module "core-js/fn/object/prevent-extensions" { - var preventExtensions: typeof core.Object.preventExtensions; + const preventExtensions: typeof core.Object.preventExtensions; export = preventExtensions; } declare module "core-js/fn/object/seal" { - var seal: typeof core.Object.seal; + const seal: typeof core.Object.seal; export = seal; } declare module "core-js/fn/object/set-prototype-of" { - var setPrototypeOf: typeof core.Object.setPrototypeOf; + const setPrototypeOf: typeof core.Object.setPrototypeOf; export = setPrototypeOf; } declare module "core-js/fn/object/values" { - var values: typeof core.Object.values; + const values: typeof core.Object.values; export = values; } declare module "core-js/fn/reflect" { - var Reflect: typeof core.Reflect; + const Reflect: typeof core.Reflect; export = Reflect; } declare module "core-js/fn/reflect/apply" { - var apply: typeof core.Reflect.apply; + const apply: typeof core.Reflect.apply; export = apply; } declare module "core-js/fn/reflect/construct" { - var construct: typeof core.Reflect.construct; + const construct: typeof core.Reflect.construct; export = construct; } declare module "core-js/fn/reflect/define-property" { - var defineProperty: typeof core.Reflect.defineProperty; + const defineProperty: typeof core.Reflect.defineProperty; export = defineProperty; } declare module "core-js/fn/reflect/delete-property" { - var deleteProperty: typeof core.Reflect.deleteProperty; + const deleteProperty: typeof core.Reflect.deleteProperty; export = deleteProperty; } declare module "core-js/fn/reflect/enumerate" { - var enumerate: typeof core.Reflect.enumerate; + const enumerate: typeof core.Reflect.enumerate; export = enumerate; } declare module "core-js/fn/reflect/get" { - var get: typeof core.Reflect.get; + const get: typeof core.Reflect.get; export = get; } declare module "core-js/fn/reflect/get-own-property-descriptor" { - var getOwnPropertyDescriptor: typeof core.Reflect.getOwnPropertyDescriptor; + const getOwnPropertyDescriptor: typeof core.Reflect.getOwnPropertyDescriptor; export = getOwnPropertyDescriptor; } declare module "core-js/fn/reflect/get-prototype-of" { - var getPrototypeOf: typeof core.Reflect.getPrototypeOf; + const getPrototypeOf: typeof core.Reflect.getPrototypeOf; export = getPrototypeOf; } declare module "core-js/fn/reflect/has" { - var has: typeof core.Reflect.has; + const has: typeof core.Reflect.has; export = has; } declare module "core-js/fn/reflect/is-extensible" { - var isExtensible: typeof core.Reflect.isExtensible; + const isExtensible: typeof core.Reflect.isExtensible; export = isExtensible; } declare module "core-js/fn/reflect/own-keys" { - var ownKeys: typeof core.Reflect.ownKeys; + const ownKeys: typeof core.Reflect.ownKeys; export = ownKeys; } declare module "core-js/fn/reflect/prevent-extensions" { - var preventExtensions: typeof core.Reflect.preventExtensions; + const preventExtensions: typeof core.Reflect.preventExtensions; export = preventExtensions; } declare module "core-js/fn/reflect/set" { - var set: typeof core.Reflect.set; + const set: typeof core.Reflect.set; export = set; } declare module "core-js/fn/reflect/set-prototype-of" { - var setPrototypeOf: typeof core.Reflect.setPrototypeOf; + const setPrototypeOf: typeof core.Reflect.setPrototypeOf; export = setPrototypeOf; } declare module "core-js/fn/regexp" { - var RegExp: typeof core.RegExp; + const RegExp: typeof core.RegExp; export = RegExp; } declare module "core-js/fn/regexp/escape" { - var escape: typeof core.RegExp.escape; + const escape: typeof core.RegExp.escape; export = escape; } declare module "core-js/fn/string" { - var String: typeof core.String; + const String: typeof core.String; export = String; } declare module "core-js/fn/string/at" { - var at: typeof core.String.at; + const at: typeof core.String.at; export = at; } declare module "core-js/fn/string/code-point-at" { - var codePointAt: typeof core.String.codePointAt; + const codePointAt: typeof core.String.codePointAt; export = codePointAt; } declare module "core-js/fn/string/ends-with" { - var endsWith: typeof core.String.endsWith; + const endsWith: typeof core.String.endsWith; export = endsWith; } declare module "core-js/fn/string/escape-html" { - var escapeHTML: typeof core.String.escapeHTML; + const escapeHTML: typeof core.String.escapeHTML; export = escapeHTML; } declare module "core-js/fn/string/from-code-point" { - var fromCodePoint: typeof core.String.fromCodePoint; + const fromCodePoint: typeof core.String.fromCodePoint; export = fromCodePoint; } declare module "core-js/fn/string/includes" { - var includes: typeof core.String.includes; + const includes: typeof core.String.includes; export = includes; } declare module "core-js/fn/string/lpad" { - var lpad: typeof core.String.lpad; + const lpad: typeof core.String.lpad; export = lpad; } declare module "core-js/fn/string/raw" { - var raw: typeof core.String.raw; + const raw: typeof core.String.raw; export = raw; } declare module "core-js/fn/string/repeat" { - var repeat: typeof core.String.repeat; + const repeat: typeof core.String.repeat; export = repeat; } declare module "core-js/fn/string/rpad" { - var rpad: typeof core.String.rpad; + const rpad: typeof core.String.rpad; export = rpad; } declare module "core-js/fn/string/starts-with" { - var startsWith: typeof core.String.startsWith; + const startsWith: typeof core.String.startsWith; export = startsWith; } declare module "core-js/fn/string/unescape-html" { - var unescapeHTML: typeof core.String.unescapeHTML; + const unescapeHTML: typeof core.String.unescapeHTML; export = unescapeHTML; } declare module "core-js/fn/symbol" { - var Symbol: typeof core.Symbol; + const Symbol: typeof core.Symbol; export = Symbol; } declare module "core-js/fn/symbol/for" { - var _for: typeof core.Symbol.for; + const _for: typeof core.Symbol.for; export = _for; } declare module "core-js/fn/symbol/has-instance" { - var hasInstance: typeof core.Symbol.hasInstance; + const hasInstance: typeof core.Symbol.hasInstance; export = hasInstance; } declare module "core-js/fn/symbol/is-concat-spreadable" { - var isConcatSpreadable: typeof core.Symbol.isConcatSpreadable; + const isConcatSpreadable: typeof core.Symbol.isConcatSpreadable; export = isConcatSpreadable; } declare module "core-js/fn/symbol/iterator" { - var iterator: typeof core.Symbol.iterator; + const iterator: typeof core.Symbol.iterator; export = iterator; } declare module "core-js/fn/symbol/key-for" { - var keyFor: typeof core.Symbol.keyFor; + const keyFor: typeof core.Symbol.keyFor; export = keyFor; } declare module "core-js/fn/symbol/match" { - var match: typeof core.Symbol.match; + const match: typeof core.Symbol.match; export = match; } declare module "core-js/fn/symbol/replace" { - var replace: typeof core.Symbol.replace; + const replace: typeof core.Symbol.replace; export = replace; } declare module "core-js/fn/symbol/search" { - var search: typeof core.Symbol.search; + const search: typeof core.Symbol.search; export = search; } declare module "core-js/fn/symbol/species" { - var species: typeof core.Symbol.species; + const species: typeof core.Symbol.species; export = species; } declare module "core-js/fn/symbol/split" { - var split: typeof core.Symbol.split; + const split: typeof core.Symbol.split; export = split; } declare module "core-js/fn/symbol/to-primitive" { - var toPrimitive: typeof core.Symbol.toPrimitive; + const toPrimitive: typeof core.Symbol.toPrimitive; export = toPrimitive; } declare module "core-js/fn/symbol/to-string-tag" { - var toStringTag: typeof core.Symbol.toStringTag; + const toStringTag: typeof core.Symbol.toStringTag; export = toStringTag; } declare module "core-js/fn/symbol/unscopables" { - var unscopables: typeof core.Symbol.unscopables; + const unscopables: typeof core.Symbol.unscopables; export = unscopables; } declare module "core-js/es5" { @@ -1335,93 +1335,93 @@ declare module "core-js/es6" { export = core; } declare module "core-js/es6/array" { - var Array: typeof core.Array; + const Array: typeof core.Array; export = Array; } declare module "core-js/es6/function" { - var Function: typeof core.Function; + const Function: typeof core.Function; export = Function; } declare module "core-js/es6/map" { - var Map: typeof core.Map; + const Map: typeof core.Map; export = Map; } declare module "core-js/es6/math" { - var Math: typeof core.Math; + const Math: typeof core.Math; export = Math; } declare module "core-js/es6/number" { - var Number: typeof core.Number; + const Number: typeof core.Number; export = Number; } declare module "core-js/es6/object" { - var Object: typeof core.Object; + const Object: typeof core.Object; export = Object; } declare module "core-js/es6/promise" { - var Promise: typeof core.Promise; + const Promise: typeof core.Promise; export = Promise; } declare module "core-js/es6/reflect" { - var Reflect: typeof core.Reflect; + const Reflect: typeof core.Reflect; export = Reflect; } declare module "core-js/es6/regexp" { - var RegExp: typeof core.RegExp; + const RegExp: typeof core.RegExp; export = RegExp; } declare module "core-js/es6/set" { - var Set: typeof core.Set; + const Set: typeof core.Set; export = Set; } declare module "core-js/es6/string" { - var String: typeof core.String; + const String: typeof core.String; export = String; } declare module "core-js/es6/symbol" { - var Symbol: typeof core.Symbol; + const Symbol: typeof core.Symbol; export = Symbol; } declare module "core-js/es6/weak-map" { - var WeakMap: typeof core.WeakMap; + const WeakMap: typeof core.WeakMap; export = WeakMap; } declare module "core-js/es6/weak-set" { - var WeakSet: typeof core.WeakSet; + const WeakSet: typeof core.WeakSet; export = WeakSet; } declare module "core-js/es7" { export = core; } declare module "core-js/es7/array" { - var Array: typeof core.Array; + const Array: typeof core.Array; export = Array; } declare module "core-js/es7/map" { - var Map: typeof core.Map; + const Map: typeof core.Map; export = Map; } declare module "core-js/es7/object" { - var Object: typeof core.Object; + const Object: typeof core.Object; export = Object; } declare module "core-js/es7/regexp" { - var RegExp: typeof core.RegExp; + const RegExp: typeof core.RegExp; export = RegExp; } declare module "core-js/es7/set" { - var Set: typeof core.Set; + const Set: typeof core.Set; export = Set; } declare module "core-js/es7/string" { - var String: typeof core.String; + const String: typeof core.String; export = String; } declare module "core-js/js" { export = core; } declare module "core-js/js/array" { - var Array: typeof core.Array; + const Array: typeof core.Array; export = Array; } declare module "core-js/web" { @@ -1450,47 +1450,47 @@ declare module "core-js/library/core/$for" { export = $for; } declare module "core-js/library/core/_" { - var _: typeof core._; + const _: typeof core._; export = _; } declare module "core-js/library/core/array" { - var Array: typeof core.Array; + const Array: typeof core.Array; export = Array; } declare module "core-js/library/core/date" { - var Date: typeof core.Date; + const Date: typeof core.Date; export = Date; } declare module "core-js/library/core/delay" { - var delay: typeof core.delay; + const delay: typeof core.delay; export = delay; } declare module "core-js/library/core/dict" { - var Dict: typeof core.Dict; + const Dict: typeof core.Dict; export = Dict; } declare module "core-js/library/core/function" { - var Function: typeof core.Function; + const Function: typeof core.Function; export = Function; } declare module "core-js/library/core/global" { - var global: typeof core.global; + const global: typeof core.global; export = global; } declare module "core-js/library/core/log" { - var log: typeof core.log; + const log: typeof core.log; export = log; } declare module "core-js/library/core/number" { - var Number: typeof core.Number; + const Number: typeof core.Number; export = Number; } declare module "core-js/library/core/object" { - var Object: typeof core.Object; + const Object: typeof core.Object; export = Object; } declare module "core-js/library/core/string" { - var String: typeof core.String; + const String: typeof core.String; export = String; } declare module "core-js/library/fn/$for" { @@ -1498,613 +1498,613 @@ declare module "core-js/library/fn/$for" { export = $for; } declare module "core-js/library/fn/_" { - var _: typeof core._; + const _: typeof core._; export = _; } declare module "core-js/library/fn/clear-immediate" { - var clearImmediate: typeof core.clearImmediate; + const clearImmediate: typeof core.clearImmediate; export = clearImmediate; } declare module "core-js/library/fn/delay" { - var delay: typeof core.delay; + const delay: typeof core.delay; export = delay; } declare module "core-js/library/fn/dict" { - var Dict: typeof core.Dict; + const Dict: typeof core.Dict; export = Dict; } declare module "core-js/library/fn/get-iterator" { - var getIterator: typeof core.getIterator; + const getIterator: typeof core.getIterator; export = getIterator; } declare module "core-js/library/fn/global" { - var global: typeof core.global; + const global: typeof core.global; export = global; } declare module "core-js/library/fn/is-iterable" { - var isIterable: typeof core.isIterable; + const isIterable: typeof core.isIterable; export = isIterable; } declare module "core-js/library/fn/log" { - var log: typeof core.log; + const log: typeof core.log; export = log; } declare module "core-js/library/fn/map" { - var Map: typeof core.Map; + const Map: typeof core.Map; export = Map; } declare module "core-js/library/fn/promise" { - var Promise: typeof core.Promise; + const Promise: typeof core.Promise; export = Promise; } declare module "core-js/library/fn/set" { - var Set: typeof core.Set; + const Set: typeof core.Set; export = Set; } declare module "core-js/library/fn/set-immediate" { - var setImmediate: typeof core.setImmediate; + const setImmediate: typeof core.setImmediate; export = setImmediate; } declare module "core-js/library/fn/set-interval" { - var setInterval: typeof core.setInterval; + const setInterval: typeof core.setInterval; export = setInterval; } declare module "core-js/library/fn/set-timeout" { - var setTimeout: typeof core.setTimeout; + const setTimeout: typeof core.setTimeout; export = setTimeout; } declare module "core-js/library/fn/weak-map" { - var WeakMap: typeof core.WeakMap; + const WeakMap: typeof core.WeakMap; export = WeakMap; } declare module "core-js/library/fn/weak-set" { - var WeakSet: typeof core.WeakSet; + const WeakSet: typeof core.WeakSet; export = WeakSet; } declare module "core-js/library/fn/array" { - var Array: typeof core.Array; + const Array: typeof core.Array; export = Array; } declare module "core-js/library/fn/array/concat" { - var concat: typeof core.Array.concat; + const concat: typeof core.Array.concat; export = concat; } declare module "core-js/library/fn/array/copy-within" { - var copyWithin: typeof core.Array.copyWithin; + const copyWithin: typeof core.Array.copyWithin; export = copyWithin; } declare module "core-js/library/fn/array/entries" { - var entries: typeof core.Array.entries; + const entries: typeof core.Array.entries; export = entries; } declare module "core-js/library/fn/array/every" { - var every: typeof core.Array.every; + const every: typeof core.Array.every; export = every; } declare module "core-js/library/fn/array/fill" { - var fill: typeof core.Array.fill; + const fill: typeof core.Array.fill; export = fill; } declare module "core-js/library/fn/array/filter" { - var filter: typeof core.Array.filter; + const filter: typeof core.Array.filter; export = filter; } declare module "core-js/library/fn/array/find" { - var find: typeof core.Array.find; + const find: typeof core.Array.find; export = find; } declare module "core-js/library/fn/array/find-index" { - var findIndex: typeof core.Array.findIndex; + const findIndex: typeof core.Array.findIndex; export = findIndex; } declare module "core-js/library/fn/array/for-each" { - var forEach: typeof core.Array.forEach; + const forEach: typeof core.Array.forEach; export = forEach; } declare module "core-js/library/fn/array/from" { - var from: typeof core.Array.from; + const from: typeof core.Array.from; export = from; } declare module "core-js/library/fn/array/includes" { - var includes: typeof core.Array.includes; + const includes: typeof core.Array.includes; export = includes; } declare module "core-js/library/fn/array/index-of" { - var indexOf: typeof core.Array.indexOf; + const indexOf: typeof core.Array.indexOf; export = indexOf; } declare module "core-js/library/fn/array/join" { - var join: typeof core.Array.join; + const join: typeof core.Array.join; export = join; } declare module "core-js/library/fn/array/keys" { - var keys: typeof core.Array.keys; + const keys: typeof core.Array.keys; export = keys; } declare module "core-js/library/fn/array/last-index-of" { - var lastIndexOf: typeof core.Array.lastIndexOf; + const lastIndexOf: typeof core.Array.lastIndexOf; export = lastIndexOf; } declare module "core-js/library/fn/array/map" { - var map: typeof core.Array.map; + const map: typeof core.Array.map; export = map; } declare module "core-js/library/fn/array/of" { - var of: typeof core.Array.of; + const of: typeof core.Array.of; export = of; } declare module "core-js/library/fn/array/pop" { - var pop: typeof core.Array.pop; + const pop: typeof core.Array.pop; export = pop; } declare module "core-js/library/fn/array/push" { - var push: typeof core.Array.push; + const push: typeof core.Array.push; export = push; } declare module "core-js/library/fn/array/reduce" { - var reduce: typeof core.Array.reduce; + const reduce: typeof core.Array.reduce; export = reduce; } declare module "core-js/library/fn/array/reduce-right" { - var reduceRight: typeof core.Array.reduceRight; + const reduceRight: typeof core.Array.reduceRight; export = reduceRight; } declare module "core-js/library/fn/array/reverse" { - var reverse: typeof core.Array.reverse; + const reverse: typeof core.Array.reverse; export = reverse; } declare module "core-js/library/fn/array/shift" { - var shift: typeof core.Array.shift; + const shift: typeof core.Array.shift; export = shift; } declare module "core-js/library/fn/array/slice" { - var slice: typeof core.Array.slice; + const slice: typeof core.Array.slice; export = slice; } declare module "core-js/library/fn/array/some" { - var some: typeof core.Array.some; + const some: typeof core.Array.some; export = some; } declare module "core-js/library/fn/array/sort" { - var sort: typeof core.Array.sort; + const sort: typeof core.Array.sort; export = sort; } declare module "core-js/library/fn/array/splice" { - var splice: typeof core.Array.splice; + const splice: typeof core.Array.splice; export = splice; } declare module "core-js/library/fn/array/turn" { - var turn: typeof core.Array.turn; + const turn: typeof core.Array.turn; export = turn; } declare module "core-js/library/fn/array/unshift" { - var unshift: typeof core.Array.unshift; + const unshift: typeof core.Array.unshift; export = unshift; } declare module "core-js/library/fn/array/values" { - var values: typeof core.Array.values; + const values: typeof core.Array.values; export = values; } declare module "core-js/library/fn/date" { - var Date: typeof core.Date; + const Date: typeof core.Date; export = Date; } declare module "core-js/library/fn/date/add-locale" { - var addLocale: typeof core.addLocale; + const addLocale: typeof core.addLocale; export = addLocale; } declare module "core-js/library/fn/date/format" { - var format: typeof core.Date.format; + const format: typeof core.Date.format; export = format; } declare module "core-js/library/fn/date/formatUTC" { - var formatUTC: typeof core.Date.formatUTC; + const formatUTC: typeof core.Date.formatUTC; export = formatUTC; } declare module "core-js/library/fn/function" { - var Function: typeof core.Function; + const Function: typeof core.Function; export = Function; } declare module "core-js/library/fn/function/has-instance" { - var hasInstance: (value: any) => boolean; + const hasInstance: (value: any) => boolean; export = hasInstance; } declare module "core-js/library/fn/function/name" { } declare module "core-js/library/fn/function/part" { - var part: typeof core.Function.part; + const part: typeof core.Function.part; export = part; } declare module "core-js/library/fn/math" { - var Math: typeof core.Math; + const Math: typeof core.Math; export = Math; } declare module "core-js/library/fn/math/acosh" { - var acosh: typeof core.Math.acosh; + const acosh: typeof core.Math.acosh; export = acosh; } declare module "core-js/library/fn/math/asinh" { - var asinh: typeof core.Math.asinh; + const asinh: typeof core.Math.asinh; export = asinh; } declare module "core-js/library/fn/math/atanh" { - var atanh: typeof core.Math.atanh; + const atanh: typeof core.Math.atanh; export = atanh; } declare module "core-js/library/fn/math/cbrt" { - var cbrt: typeof core.Math.cbrt; + const cbrt: typeof core.Math.cbrt; export = cbrt; } declare module "core-js/library/fn/math/clz32" { - var clz32: typeof core.Math.clz32; + const clz32: typeof core.Math.clz32; export = clz32; } declare module "core-js/library/fn/math/cosh" { - var cosh: typeof core.Math.cosh; + const cosh: typeof core.Math.cosh; export = cosh; } declare module "core-js/library/fn/math/expm1" { - var expm1: typeof core.Math.expm1; + const expm1: typeof core.Math.expm1; export = expm1; } declare module "core-js/library/fn/math/fround" { - var fround: typeof core.Math.fround; + const fround: typeof core.Math.fround; export = fround; } declare module "core-js/library/fn/math/hypot" { - var hypot: typeof core.Math.hypot; + const hypot: typeof core.Math.hypot; export = hypot; } declare module "core-js/library/fn/math/imul" { - var imul: typeof core.Math.imul; + const imul: typeof core.Math.imul; export = imul; } declare module "core-js/library/fn/math/log10" { - var log10: typeof core.Math.log10; + const log10: typeof core.Math.log10; export = log10; } declare module "core-js/library/fn/math/log1p" { - var log1p: typeof core.Math.log1p; + const log1p: typeof core.Math.log1p; export = log1p; } declare module "core-js/library/fn/math/log2" { - var log2: typeof core.Math.log2; + const log2: typeof core.Math.log2; export = log2; } declare module "core-js/library/fn/math/sign" { - var sign: typeof core.Math.sign; + const sign: typeof core.Math.sign; export = sign; } declare module "core-js/library/fn/math/sinh" { - var sinh: typeof core.Math.sinh; + const sinh: typeof core.Math.sinh; export = sinh; } declare module "core-js/library/fn/math/tanh" { - var tanh: typeof core.Math.tanh; + const tanh: typeof core.Math.tanh; export = tanh; } declare module "core-js/library/fn/math/trunc" { - var trunc: typeof core.Math.trunc; + const trunc: typeof core.Math.trunc; export = trunc; } declare module "core-js/library/fn/number" { - var Number: typeof core.Number; + const Number: typeof core.Number; export = Number; } declare module "core-js/library/fn/number/epsilon" { - var EPSILON: typeof core.Number.EPSILON; + const EPSILON: typeof core.Number.EPSILON; export = EPSILON; } declare module "core-js/library/fn/number/is-finite" { - var isFinite: typeof core.Number.isFinite; + const isFinite: typeof core.Number.isFinite; export = isFinite; } declare module "core-js/library/fn/number/is-integer" { - var isInteger: typeof core.Number.isInteger; + const isInteger: typeof core.Number.isInteger; export = isInteger; } declare module "core-js/library/fn/number/is-nan" { - var isNaN: typeof core.Number.isNaN; + const isNaN: typeof core.Number.isNaN; export = isNaN; } declare module "core-js/library/fn/number/is-safe-integer" { - var isSafeInteger: typeof core.Number.isSafeInteger; + const isSafeInteger: typeof core.Number.isSafeInteger; export = isSafeInteger; } declare module "core-js/library/fn/number/max-safe-integer" { - var MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER; + const MAX_SAFE_INTEGER: typeof core.Number.MAX_SAFE_INTEGER; export = MAX_SAFE_INTEGER; } declare module "core-js/library/fn/number/min-safe-integer" { - var MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER; + const MIN_SAFE_INTEGER: typeof core.Number.MIN_SAFE_INTEGER; export = MIN_SAFE_INTEGER; } declare module "core-js/library/fn/number/parse-float" { - var parseFloat: typeof core.Number.parseFloat; + const parseFloat: typeof core.Number.parseFloat; export = parseFloat; } declare module "core-js/library/fn/number/parse-int" { - var parseInt: typeof core.Number.parseInt; + const parseInt: typeof core.Number.parseInt; export = parseInt; } declare module "core-js/library/fn/number/random" { - var random: typeof core.Number.random; + const random: typeof core.Number.random; export = random; } declare module "core-js/library/fn/object" { - var Object: typeof core.Object; + const Object: typeof core.Object; export = Object; } declare module "core-js/library/fn/object/assign" { - var assign: typeof core.Object.assign; + const assign: typeof core.Object.assign; export = assign; } declare module "core-js/library/fn/object/classof" { - var classof: typeof core.Object.classof; + const classof: typeof core.Object.classof; export = classof; } declare module "core-js/library/fn/object/create" { - var create: typeof core.Object.create; + const create: typeof core.Object.create; export = create; } declare module "core-js/library/fn/object/define" { - var define: typeof core.Object.define; + const define: typeof core.Object.define; export = define; } declare module "core-js/library/fn/object/define-properties" { - var defineProperties: typeof core.Object.defineProperties; + const defineProperties: typeof core.Object.defineProperties; export = defineProperties; } declare module "core-js/library/fn/object/define-property" { - var defineProperty: typeof core.Object.defineProperty; + const defineProperty: typeof core.Object.defineProperty; export = defineProperty; } declare module "core-js/library/fn/object/entries" { - var entries: typeof core.Object.entries; + const entries: typeof core.Object.entries; export = entries; } declare module "core-js/library/fn/object/freeze" { - var freeze: typeof core.Object.freeze; + const freeze: typeof core.Object.freeze; export = freeze; } declare module "core-js/library/fn/object/get-own-property-descriptor" { - var getOwnPropertyDescriptor: typeof core.Object.getOwnPropertyDescriptor; + const getOwnPropertyDescriptor: typeof core.Object.getOwnPropertyDescriptor; export = getOwnPropertyDescriptor; } declare module "core-js/library/fn/object/get-own-property-descriptors" { - var getOwnPropertyDescriptors: typeof core.Object.getOwnPropertyDescriptors; + const getOwnPropertyDescriptors: typeof core.Object.getOwnPropertyDescriptors; export = getOwnPropertyDescriptors; } declare module "core-js/library/fn/object/get-own-property-names" { - var getOwnPropertyNames: typeof core.Object.getOwnPropertyNames; + const getOwnPropertyNames: typeof core.Object.getOwnPropertyNames; export = getOwnPropertyNames; } declare module "core-js/library/fn/object/get-own-property-symbols" { - var getOwnPropertySymbols: typeof core.Object.getOwnPropertySymbols; + const getOwnPropertySymbols: typeof core.Object.getOwnPropertySymbols; export = getOwnPropertySymbols; } declare module "core-js/library/fn/object/get-prototype-of" { - var getPrototypeOf: typeof core.Object.getPrototypeOf; + const getPrototypeOf: typeof core.Object.getPrototypeOf; export = getPrototypeOf; } declare module "core-js/library/fn/object/is" { - var is: typeof core.Object.is; + const is: typeof core.Object.is; export = is; } declare module "core-js/library/fn/object/is-extensible" { - var isExtensible: typeof core.Object.isExtensible; + const isExtensible: typeof core.Object.isExtensible; export = isExtensible; } declare module "core-js/library/fn/object/is-frozen" { - var isFrozen: typeof core.Object.isFrozen; + const isFrozen: typeof core.Object.isFrozen; export = isFrozen; } declare module "core-js/library/fn/object/is-object" { - var isObject: typeof core.Object.isObject; + const isObject: typeof core.Object.isObject; export = isObject; } declare module "core-js/library/fn/object/is-sealed" { - var isSealed: typeof core.Object.isSealed; + const isSealed: typeof core.Object.isSealed; export = isSealed; } declare module "core-js/library/fn/object/keys" { - var keys: typeof core.Object.keys; + const keys: typeof core.Object.keys; export = keys; } declare module "core-js/library/fn/object/make" { - var make: typeof core.Object.make; + const make: typeof core.Object.make; export = make; } declare module "core-js/library/fn/object/prevent-extensions" { - var preventExtensions: typeof core.Object.preventExtensions; + const preventExtensions: typeof core.Object.preventExtensions; export = preventExtensions; } declare module "core-js/library/fn/object/seal" { - var seal: typeof core.Object.seal; + const seal: typeof core.Object.seal; export = seal; } declare module "core-js/library/fn/object/set-prototype-of" { - var setPrototypeOf: typeof core.Object.setPrototypeOf; + const setPrototypeOf: typeof core.Object.setPrototypeOf; export = setPrototypeOf; } declare module "core-js/library/fn/object/values" { - var values: typeof core.Object.values; + const values: typeof core.Object.values; export = values; } declare module "core-js/library/fn/reflect" { - var Reflect: typeof core.Reflect; + const Reflect: typeof core.Reflect; export = Reflect; } declare module "core-js/library/fn/reflect/apply" { - var apply: typeof core.Reflect.apply; + const apply: typeof core.Reflect.apply; export = apply; } declare module "core-js/library/fn/reflect/construct" { - var construct: typeof core.Reflect.construct; + const construct: typeof core.Reflect.construct; export = construct; } declare module "core-js/library/fn/reflect/define-property" { - var defineProperty: typeof core.Reflect.defineProperty; + const defineProperty: typeof core.Reflect.defineProperty; export = defineProperty; } declare module "core-js/library/fn/reflect/delete-property" { - var deleteProperty: typeof core.Reflect.deleteProperty; + const deleteProperty: typeof core.Reflect.deleteProperty; export = deleteProperty; } declare module "core-js/library/fn/reflect/enumerate" { - var enumerate: typeof core.Reflect.enumerate; + const enumerate: typeof core.Reflect.enumerate; export = enumerate; } declare module "core-js/library/fn/reflect/get" { - var get: typeof core.Reflect.get; + const get: typeof core.Reflect.get; export = get; } declare module "core-js/library/fn/reflect/get-own-property-descriptor" { - var getOwnPropertyDescriptor: typeof core.Reflect.getOwnPropertyDescriptor; + const getOwnPropertyDescriptor: typeof core.Reflect.getOwnPropertyDescriptor; export = getOwnPropertyDescriptor; } declare module "core-js/library/fn/reflect/get-prototype-of" { - var getPrototypeOf: typeof core.Reflect.getPrototypeOf; + const getPrototypeOf: typeof core.Reflect.getPrototypeOf; export = getPrototypeOf; } declare module "core-js/library/fn/reflect/has" { - var has: typeof core.Reflect.has; + const has: typeof core.Reflect.has; export = has; } declare module "core-js/library/fn/reflect/is-extensible" { - var isExtensible: typeof core.Reflect.isExtensible; + const isExtensible: typeof core.Reflect.isExtensible; export = isExtensible; } declare module "core-js/library/fn/reflect/own-keys" { - var ownKeys: typeof core.Reflect.ownKeys; + const ownKeys: typeof core.Reflect.ownKeys; export = ownKeys; } declare module "core-js/library/fn/reflect/prevent-extensions" { - var preventExtensions: typeof core.Reflect.preventExtensions; + const preventExtensions: typeof core.Reflect.preventExtensions; export = preventExtensions; } declare module "core-js/library/fn/reflect/set" { - var set: typeof core.Reflect.set; + const set: typeof core.Reflect.set; export = set; } declare module "core-js/library/fn/reflect/set-prototype-of" { - var setPrototypeOf: typeof core.Reflect.setPrototypeOf; + const setPrototypeOf: typeof core.Reflect.setPrototypeOf; export = setPrototypeOf; } declare module "core-js/library/fn/regexp" { - var RegExp: typeof core.RegExp; + const RegExp: typeof core.RegExp; export = RegExp; } declare module "core-js/library/fn/regexp/escape" { - var escape: typeof core.RegExp.escape; + const escape: typeof core.RegExp.escape; export = escape; } declare module "core-js/library/fn/string" { - var String: typeof core.String; + const String: typeof core.String; export = String; } declare module "core-js/library/fn/string/at" { - var at: typeof core.String.at; + const at: typeof core.String.at; export = at; } declare module "core-js/library/fn/string/code-point-at" { - var codePointAt: typeof core.String.codePointAt; + const codePointAt: typeof core.String.codePointAt; export = codePointAt; } declare module "core-js/library/fn/string/ends-with" { - var endsWith: typeof core.String.endsWith; + const endsWith: typeof core.String.endsWith; export = endsWith; } declare module "core-js/library/fn/string/escape-html" { - var escapeHTML: typeof core.String.escapeHTML; + const escapeHTML: typeof core.String.escapeHTML; export = escapeHTML; } declare module "core-js/library/fn/string/from-code-point" { - var fromCodePoint: typeof core.String.fromCodePoint; + const fromCodePoint: typeof core.String.fromCodePoint; export = fromCodePoint; } declare module "core-js/library/fn/string/includes" { - var includes: typeof core.String.includes; + const includes: typeof core.String.includes; export = includes; } declare module "core-js/library/fn/string/lpad" { - var lpad: typeof core.String.lpad; + const lpad: typeof core.String.lpad; export = lpad; } declare module "core-js/library/fn/string/raw" { - var raw: typeof core.String.raw; + const raw: typeof core.String.raw; export = raw; } declare module "core-js/library/fn/string/repeat" { - var repeat: typeof core.String.repeat; + const repeat: typeof core.String.repeat; export = repeat; } declare module "core-js/library/fn/string/rpad" { - var rpad: typeof core.String.rpad; + const rpad: typeof core.String.rpad; export = rpad; } declare module "core-js/library/fn/string/starts-with" { - var startsWith: typeof core.String.startsWith; + const startsWith: typeof core.String.startsWith; export = startsWith; } declare module "core-js/library/fn/string/unescape-html" { - var unescapeHTML: typeof core.String.unescapeHTML; + const unescapeHTML: typeof core.String.unescapeHTML; export = unescapeHTML; } declare module "core-js/library/fn/symbol" { - var Symbol: typeof core.Symbol; + const Symbol: typeof core.Symbol; export = Symbol; } declare module "core-js/library/fn/symbol/for" { - var _for: typeof core.Symbol.for; + const _for: typeof core.Symbol.for; export = _for; } declare module "core-js/library/fn/symbol/has-instance" { - var hasInstance: typeof core.Symbol.hasInstance; + const hasInstance: typeof core.Symbol.hasInstance; export = hasInstance; } declare module "core-js/library/fn/symbol/is-concat-spreadable" { - var isConcatSpreadable: typeof core.Symbol.isConcatSpreadable; + const isConcatSpreadable: typeof core.Symbol.isConcatSpreadable; export = isConcatSpreadable; } declare module "core-js/library/fn/symbol/iterator" { - var iterator: typeof core.Symbol.iterator; + const iterator: typeof core.Symbol.iterator; export = iterator; } declare module "core-js/library/fn/symbol/key-for" { - var keyFor: typeof core.Symbol.keyFor; + const keyFor: typeof core.Symbol.keyFor; export = keyFor; } declare module "core-js/library/fn/symbol/match" { - var match: typeof core.Symbol.match; + const match: typeof core.Symbol.match; export = match; } declare module "core-js/library/fn/symbol/replace" { - var replace: typeof core.Symbol.replace; + const replace: typeof core.Symbol.replace; export = replace; } declare module "core-js/library/fn/symbol/search" { - var search: typeof core.Symbol.search; + const search: typeof core.Symbol.search; export = search; } declare module "core-js/library/fn/symbol/species" { - var species: typeof core.Symbol.species; + const species: typeof core.Symbol.species; export = species; } declare module "core-js/library/fn/symbol/split" { - var split: typeof core.Symbol.split; + const split: typeof core.Symbol.split; export = split; } declare module "core-js/library/fn/symbol/to-primitive" { - var toPrimitive: typeof core.Symbol.toPrimitive; + const toPrimitive: typeof core.Symbol.toPrimitive; export = toPrimitive; } declare module "core-js/library/fn/symbol/to-string-tag" { - var toStringTag: typeof core.Symbol.toStringTag; + const toStringTag: typeof core.Symbol.toStringTag; export = toStringTag; } declare module "core-js/library/fn/symbol/unscopables" { - var unscopables: typeof core.Symbol.unscopables; + const unscopables: typeof core.Symbol.unscopables; export = unscopables; } declare module "core-js/library/es5" { @@ -2114,93 +2114,93 @@ declare module "core-js/library/es6" { export = core; } declare module "core-js/library/es6/array" { - var Array: typeof core.Array; + const Array: typeof core.Array; export = Array; } declare module "core-js/library/es6/function" { - var Function: typeof core.Function; + const Function: typeof core.Function; export = Function; } declare module "core-js/library/es6/map" { - var Map: typeof core.Map; + const Map: typeof core.Map; export = Map; } declare module "core-js/library/es6/math" { - var Math: typeof core.Math; + const Math: typeof core.Math; export = Math; } declare module "core-js/library/es6/number" { - var Number: typeof core.Number; + const Number: typeof core.Number; export = Number; } declare module "core-js/library/es6/object" { - var Object: typeof core.Object; + const Object: typeof core.Object; export = Object; } declare module "core-js/library/es6/promise" { - var Promise: typeof core.Promise; + const Promise: typeof core.Promise; export = Promise; } declare module "core-js/library/es6/reflect" { - var Reflect: typeof core.Reflect; + const Reflect: typeof core.Reflect; export = Reflect; } declare module "core-js/library/es6/regexp" { - var RegExp: typeof core.RegExp; + const RegExp: typeof core.RegExp; export = RegExp; } declare module "core-js/library/es6/set" { - var Set: typeof core.Set; + const Set: typeof core.Set; export = Set; } declare module "core-js/library/es6/string" { - var String: typeof core.String; + const String: typeof core.String; export = String; } declare module "core-js/library/es6/symbol" { - var Symbol: typeof core.Symbol; + const Symbol: typeof core.Symbol; export = Symbol; } declare module "core-js/library/es6/weak-map" { - var WeakMap: typeof core.WeakMap; + const WeakMap: typeof core.WeakMap; export = WeakMap; } declare module "core-js/library/es6/weak-set" { - var WeakSet: typeof core.WeakSet; + const WeakSet: typeof core.WeakSet; export = WeakSet; } declare module "core-js/library/es7" { export = core; } declare module "core-js/library/es7/array" { - var Array: typeof core.Array; + const Array: typeof core.Array; export = Array; } declare module "core-js/library/es7/map" { - var Map: typeof core.Map; + const Map: typeof core.Map; export = Map; } declare module "core-js/library/es7/object" { - var Object: typeof core.Object; + const Object: typeof core.Object; export = Object; } declare module "core-js/library/es7/regexp" { - var RegExp: typeof core.RegExp; + const RegExp: typeof core.RegExp; export = RegExp; } declare module "core-js/library/es7/set" { - var Set: typeof core.Set; + const Set: typeof core.Set; export = Set; } declare module "core-js/library/es7/string" { - var String: typeof core.String; + const String: typeof core.String; export = String; } declare module "core-js/library/js" { export = core; } declare module "core-js/library/js/array" { - var Array: typeof core.Array; + const Array: typeof core.Array; export = Array; } declare module "core-js/library/web" { diff --git a/csvtojson/csvtojson-tests.ts b/csvtojson/csvtojson-tests.ts index 4368d00494..a4ee3d76d4 100644 --- a/csvtojson/csvtojson-tests.ts +++ b/csvtojson/csvtojson-tests.ts @@ -16,7 +16,7 @@ csv({ noheader: true }) console.log(csvRow); // => [1,2,3] , [4,5,6] , [7,8,9] }) .on('done', () => { - //parsing finished + // parsing finished }); // event emitter version using Converter class @@ -26,7 +26,7 @@ new csv.Converter({ noheader: true }) console.log(csvRow); // => [1,2,3] , [4,5,6] , [7,8,9] }) .on('done', () => { - //parsing finished + // parsing finished }); // callback version using Converter class diff --git a/csvtojson/index.d.ts b/csvtojson/index.d.ts index 9ba01212c7..504311f47a 100644 --- a/csvtojson/index.d.ts +++ b/csvtojson/index.d.ts @@ -8,7 +8,6 @@ import * as stream from 'stream'; declare namespace csvtojson { - /** * Stream options */ @@ -18,7 +17,6 @@ declare namespace csvtojson { * Converter options */ interface ConverterOptions { - /** * Delimiter used for seperating columns. Use "auto" if delimiter is unknown in advance, * in this case, delimiter will be auto-detected (by best attempt). Use an array to give @@ -173,7 +171,6 @@ declare namespace csvtojson { * Converts provided CSV input to a JSON object. */ class Converter extends stream.Transform { - /** * Initializes a new instance of a Converter * @param {ConverterOptions} options converter options diff --git a/d3-array/d3-array-tests.ts b/d3-array/d3-array-tests.ts index 7dbe08bad0..bb713192e8 100644 --- a/d3-array/d3-array-tests.ts +++ b/d3-array/d3-array-tests.ts @@ -26,7 +26,6 @@ class NumCoercible { } class MixedObject { - num: number; str: string; numeric: NumCoercible; @@ -289,7 +288,6 @@ num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14 num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14), 1); num = mixedObjectDateBisectorObject.right(mixedObjectArray, new Date(2015, 3, 14), 3, 4); - // ascending() ----------------------------------------------------------------- num = d3Array.ascending(undefined, 20); @@ -339,12 +337,11 @@ crossed = d3Array.cross(['x', 'y'], [1, 2]); let strArray: string[] = d3Array.cross([2, 3], [5, 6], (a, b) => (a + b) + 'px'); strArray = d3Array.cross([2, 3], [5, 6], (a, b) => { - let aa: number = a; - let bb: number = b; + const aa: number = a; + const bb: number = b; return (aa + bb) + 'px'; }); - // pairs() --------------------------------------------------------------------- let pairs: Array<[MixedObject, MixedObject]>; @@ -353,8 +350,8 @@ pairs = d3Array.pairs(mergedArray); numbersArray = d3Array.pairs(mergedArray, (a, b) => b.num - a.num); numbersArray = d3Array.pairs(mergedArray, (a, b) => { - let aa: MixedObject = a; - let bb: MixedObject = b; + const aa: MixedObject = a; + const bb: MixedObject = b; return bb.num - aa.num; }); @@ -374,7 +371,6 @@ const testObject = { const x: Array = d3Array.permute(testObject, ['name', 'val', 'when', 'more']); - // range() --------------------------------------------------------------------- numbersArray = d3Array.range(10); @@ -389,7 +385,6 @@ mergedArray = d3Array.shuffle(mergedArray, 1); mergedArray = d3Array.shuffle(mergedArray, 1, 3); - // ticks() --------------------------------------------------------------------- numbersArray = d3Array.ticks(1, 10, 5); @@ -519,8 +514,6 @@ const mixedObject: MixedObject = testBin[0]; // with element type MixedObject date = testBin.x0; // bin lower bound is Date date = testBin.x1; // bin upper bound is Date - - // Histogram Tresholds ========================================================= num = d3Array.thresholdFreedmanDiaconis([-1, 0, 1, 1, 3, 20, 234], -1, 234); diff --git a/d3-array/index.d.ts b/d3-array/index.d.ts index d938a8c032..ccd2d568bb 100644 --- a/d3-array/index.d.ts +++ b/d3-array/index.d.ts @@ -9,7 +9,6 @@ // Shared Types and Interfaces // -------------------------------------------------------------------------- - /** * Administrivia: JavaScript primitive types and Date */ @@ -26,7 +25,6 @@ interface Numeric { // Descriptive Statistics // -------------------------------------------------------------------------------------- - /** * Return the maximum value in the array of strings using natural order. */ @@ -67,8 +65,6 @@ export function min(array: T[], accessor: (datum: T, index: number, array: T[ */ export function min(array: T[], accessor: (datum: T, index: number, array: T[]) => U | undefined | null): U | undefined; - - /** * Return the min and max simultaneously. */ @@ -139,7 +135,6 @@ export function variance(array: Array): */ export function variance(array: T[], accessor: (datum: T, index: number, array: T[]) => number | undefined | null): number | undefined; - // -------------------------------------------------------------------------------------- // Searching Arrays // -------------------------------------------------------------------------------------- @@ -155,7 +150,7 @@ export function bisectRight(array: number[], x: number, lo?: number, hi?: number export function bisectRight(array: string[], x: string, lo?: number, hi?: number): number; export function bisectRight(array: Date[], x: Date, lo?: number, hi?: number): number; -export var bisect: typeof bisectRight; +export const bisect: typeof bisectRight; export interface Bisector { left: (array: T[], x: U, lo?: number, hi?: number) => number; @@ -244,7 +239,6 @@ export function range(stop: number): number[]; */ export function range(start: number, stop: number, step?: number): number[]; - /** * Randomizes the order of the specified array using the Fisher–Yates shuffle. */ @@ -261,13 +255,11 @@ export function ticks(start: number, stop: number, count: number): number[]; */ export function tickStep(start: number, stop: number, count: number): number[]; - /** * Transpose a matrix provided in Array of Arrays format. */ export function transpose(matrix: T[][]): T[][]; - /** * Returns an array of arrays, where the ith array contains the ith element from each of the argument arrays. * The returned array is truncated in length to the shortest array in arrays. If arrays contains only a single array, the returned array @@ -294,8 +286,6 @@ export type ThresholdCountGenerator = (values: number[], min?: number, max?: num */ export type ThresholdArrayGenerator = (values: Value[], min?: Value, max?: Value) => Value[]; - - export interface HistogramGenerator { (data: Datum[]): Array>; value(): (d: Datum, i: number, data: Datum[]) => Value; diff --git a/d3-axis/d3-axis-tests.ts b/d3-axis/d3-axis-tests.ts index 1a4077d690..f2b47beaa8 100644 --- a/d3-axis/d3-axis-tests.ts +++ b/d3-axis/d3-axis-tests.ts @@ -26,8 +26,6 @@ import { Transition } from 'd3-transition'; import { timeMinute } from 'd3-time'; import { format } from 'd3-format'; - - // -------------------------------------------------------------------------- // Preparatory Steps // -------------------------------------------------------------------------- @@ -81,8 +79,6 @@ leftAxis = leftAxis.scale(scalePow()); const powerScale: ScalePower = leftAxis.scale>(); // powerScale = leftAxis.scale(); // fails, without casting as AxisScale is purposely generic - - bottomAxis = bottomAxis.scale(scaleOrdinal()); // bottomAxis = bottomAxis.scale(scalePow()) // fails, domain of scale incompatible with domain of axis diff --git a/d3-axis/index.d.ts b/d3-axis/index.d.ts index cd8ed94714..4a65952070 100644 --- a/d3-axis/index.d.ts +++ b/d3-axis/index.d.ts @@ -11,7 +11,6 @@ import { Selection, TransitionLike } from 'd3-selection'; // Shared Types and Interfaces // -------------------------------------------------------------------------- - /** * A helper interface to describe the minimal contract to be met by a time interval * which can be passed into the Axis.ticks(...) or Axis.tickArguments(...) methods when @@ -171,7 +170,6 @@ export interface Axis { */ tickValues(values: null): this; - /** * Returns the currently set tick format function, which defaults to null. */ @@ -258,7 +256,6 @@ export interface Axis { * @param padding Padding in pixels (Default is 3). */ tickPadding(padding: number): this; - } /** diff --git a/d3-brush/d3-brush-tests.ts b/d3-brush/d3-brush-tests.ts index 367cc05d1b..2d9ee319aa 100644 --- a/d3-brush/d3-brush-tests.ts +++ b/d3-brush/d3-brush-tests.ts @@ -19,7 +19,6 @@ interface BrushDatum { filterZoomEvent: boolean; } - // ----------------------------------------------------------------------------- // Test Define BrushBehavior // ----------------------------------------------------------------------------- @@ -48,7 +47,6 @@ brush = brush.extent(function(d, i, group) { // chainable brush = brush.filter(function(d, i, group) { - // Cast d3 event to D3ZoomEvent to be used in filter logic const e = > event; @@ -80,7 +78,6 @@ brush = brush.on('end', brushed); // brush = brush.on('end', wrongHandler1); // fails, wrongHandler event handler has wrong this // brush = brush.on('end', wrongHandler2); // fails, wrongHandler event handler has wrong datum type - brushed = brush.on('end'); // chainable remove handler @@ -97,8 +94,6 @@ brush.on('end', function(d, i, g) { // do anything }); - - // ----------------------------------------------------------------------------- // Test Attach Brush Behavior // ----------------------------------------------------------------------------- @@ -121,10 +116,8 @@ const gX = select('svg') filterZoomEvent: true }); - gX.call(brushX); - // ----------------------------------------------------------------------------- // Test Use Brush Behavior // ----------------------------------------------------------------------------- @@ -155,7 +148,6 @@ brush.move(gTransition, function(d, i, group) { return selection; }); - const gXTransition = gX.transition(); // 1d brush move with Selection @@ -178,15 +170,12 @@ brush.move(gXTransition, function(d, i, group) { return selection; }); - // ----------------------------------------------------------------------------- // Test Brush Event Interface // ----------------------------------------------------------------------------- - const e: d3Brush.D3BrushEvent = event; - const target: d3Brush.BrushBehavior = e.target; const type: 'start' | 'brush' | 'end' | string = e.type; const brushSelection: d3Brush.BrushSelection = e.selection; diff --git a/d3-brush/index.d.ts b/d3-brush/index.d.ts index 5c89465bce..644e6c06f7 100644 --- a/d3-brush/index.d.ts +++ b/d3-brush/index.d.ts @@ -189,7 +189,6 @@ export interface BrushBehavior { * with this as the current DOM element. */ on(typenames: string, listener: ValueFn): this; - } /** diff --git a/d3-chord/d3-chord-tests.ts b/d3-chord/d3-chord-tests.ts index c826c81fac..b66f39787a 100644 --- a/d3-chord/d3-chord-tests.ts +++ b/d3-chord/d3-chord-tests.ts @@ -10,7 +10,6 @@ import * as d3Chord from 'd3-chord'; import { select, Selection } from 'd3-selection'; import { ascending } from 'd3-array'; - // --------------------------------------------------------------------- // Preparatory Steps // --------------------------------------------------------------------- @@ -39,7 +38,6 @@ let numAccessor: (this: SVGPathElement, d: d3Chord.ChordSubgroup, ...args: any[] // Test Chord // --------------------------------------------------------------------- - // chord() create ChordLayout generator =============================== let chordLayout: d3Chord.ChordLayout; @@ -64,7 +62,6 @@ chordLayout = chordLayout.sortSubgroups(ascending); chordLayout = chordLayout.sortSubgroups(null); comparatorFn = chordLayout.sortSubgroups(); - // sortChords() -------------------------------------------------------- chordLayout = chordLayout.sortChords(ascending); @@ -75,10 +72,8 @@ comparatorFn = chordLayout.sortChords(); chords = chordLayout(matrix); - // Test supporting interfaces ========================================== - const length: number = chords.length; chordGroups = chords.groups; @@ -98,7 +93,6 @@ num = chordSubgroup.endAngle; num = chordSubgroup.value; num = chordSubgroup.index; - // --------------------------------------------------------------------- // Test Ribbon // --------------------------------------------------------------------- @@ -140,7 +134,6 @@ svgRibbon = svgRibbon.target(d => { subgroupAccessor = svgRibbon.target(); - // radius() ----------------------------------------------------------- canvasRibbon = canvasRibbon.radius(30); diff --git a/d3-geo/d3-geo-tests.ts b/d3-geo/d3-geo-tests.ts index a29dce0e8b..b5ad28f3e2 100644 --- a/d3-geo/d3-geo-tests.ts +++ b/d3-geo/d3-geo-tests.ts @@ -144,7 +144,7 @@ contained = d3Geo.geoContains(sampleExtendedFeatureCollection, [0, 0]); // geoDistance(...) ======================================================= -let distance: number = d3Geo.geoDistance([54, 2], [53, 1]); +const distance: number = d3Geo.geoDistance([54, 2], [53, 1]); // geoLength(...) ========================================================= @@ -160,19 +160,19 @@ length = d3Geo.geoLength(sampleExtendedFeatureCollection); // geoInterpolate(...) ==================================================== -let interpolateFct: (t: number) => [number, number] = d3Geo.geoInterpolate([54, 2], [53, 1]); +const interpolateFct: (t: number) => [number, number] = d3Geo.geoInterpolate([54, 2], [53, 1]); // geoRotation(...) ======================================================= // create rotation ----------------------------------------------------- -let rotation: d3Geo.GeoRotation = d3Geo.geoRotation([90, 45]); -let rotation2: d3Geo.GeoRotation = d3Geo.geoRotation([90, 45, 27.5]); +const rotation: d3Geo.GeoRotation = d3Geo.geoRotation([90, 45]); +const rotation2: d3Geo.GeoRotation = d3Geo.geoRotation([90, 45, 27.5]); // use rotation -------------------------------------------------------- -let point: [number, number] = rotation([54, 2]); -let inverted: [number, number] = rotation.invert([54, 2]); +const point: [number, number] = rotation([54, 2]); +const inverted: [number, number] = rotation.invert([54, 2]); // ---------------------------------------------------------------------- // Spherical Shapes - geoCircle @@ -185,24 +185,23 @@ let circleGeneratorSimple: d3Geo.GeoCircleGenerator = d3Geo.geoCircle( // complex use as part of object class Circulator { - constructor(radius: number, precision: number) { this.r = radius; this.p = precision; this.circleGenerator = d3Geo.geoCircle() - .radius(function (datum) { - let t: Circulator = this; - let d: [number, number] | undefined = datum; + .radius(function(datum) { + const t: Circulator = this; + const d: [number, number] | undefined = datum; return this.r; }) - .precision(function (datum) { - let t: Circulator = this; - let d: [number, number] | undefined = datum; + .precision(function(datum) { + const t: Circulator = this; + const d: [number, number] | undefined = datum; return this.p; }) - .center(function (datum) { - let t: Circulator = this; - let d: [number, number] | undefined = datum; + .center(function(datum) { + const t: Circulator = this; + const d: [number, number] | undefined = datum; return d ? d : [0, 0]; }); } @@ -219,28 +218,28 @@ class Circulator { } } -let circulator = new Circulator(50, 2); +const circulator = new Circulator(50, 2); // Configure CircleGenerator ============================================ // center(...) ---------------------------------------------------------- -let centerFctSimple: ((this: any, d: any, ...args: any[]) => [number, number]) = circleGeneratorSimple.center(); +const centerFctSimple: ((this: any, d: any, ...args: any[]) => [number, number]) = circleGeneratorSimple.center(); -let c: [number, number] = [54, 2]; +const c: [number, number] = [54, 2]; circleGeneratorSimple = circleGeneratorSimple.center(() => c); circleGeneratorSimple = circleGeneratorSimple.center(c); // radius(...) ----------------------------------------------------------- -let radius: ((...args: any[]) => number) = circleGeneratorSimple.radius(); +const radius: ((...args: any[]) => number) = circleGeneratorSimple.radius(); circleGeneratorSimple = circleGeneratorSimple.radius(() => 5); circleGeneratorSimple = circleGeneratorSimple.radius(2); // precision(...) -------------------------------------------------------- -let precision: ((...args: any[]) => number) = circleGeneratorSimple.precision(); +const precision: ((...args: any[]) => number) = circleGeneratorSimple.precision(); circleGeneratorSimple = circleGeneratorSimple.precision(() => 5); circleGeneratorSimple = circleGeneratorSimple.precision(2); @@ -253,7 +252,6 @@ let circlePolygon: GeoJSON.Polygon = circleGeneratorSimple(); circlePolygon = circulator.getCirclePolygon([5, 5]); circlePolygon = circulator.getCirclePolygon(); - // ---------------------------------------------------------------------- // Spherical Shapes - geoGraticule // ---------------------------------------------------------------------- @@ -266,44 +264,44 @@ let graticuleGenerator: d3Geo.GeoGraticuleGenerator = d3Geo.geoGraticule(); // extent(...) ----------------------------------------------------------- -let extent: [[number, number], [number, number]] = graticuleGenerator.extent(); +const extent: [[number, number], [number, number]] = graticuleGenerator.extent(); graticuleGenerator = graticuleGenerator.extent([[-180, -80], [180, 80]]); // extentMajor(...) --------------------------------------------------------- -let extentMajor: [[number, number], [number, number]] = graticuleGenerator.extentMajor(); +const extentMajor: [[number, number], [number, number]] = graticuleGenerator.extentMajor(); graticuleGenerator = graticuleGenerator.extentMajor([[-180, -80], [180, 80]]); // extentMinor(...) --------------------------------------------------------- -let extentMinor: [[number, number], [number, number]] = graticuleGenerator.extentMinor(); +const extentMinor: [[number, number], [number, number]] = graticuleGenerator.extentMinor(); graticuleGenerator = graticuleGenerator.extentMinor([[-180, -80], [180, 80]]); // step(...) ---------------------------------------------------------------- -let step: [number, number] = graticuleGenerator.step(); +const step: [number, number] = graticuleGenerator.step(); graticuleGenerator = graticuleGenerator.step([10, 10]); // stepMajor(...) ----------------------------------------------------------- -let stepMajor: [number, number] = graticuleGenerator.stepMajor(); +const stepMajor: [number, number] = graticuleGenerator.stepMajor(); graticuleGenerator = graticuleGenerator.stepMajor([10, 10]); // stepMinor(...) ------------------------------------------------------------ -let stepMinor: [number, number] = graticuleGenerator.stepMinor(); +const stepMinor: [number, number] = graticuleGenerator.stepMinor(); graticuleGenerator = graticuleGenerator.stepMinor([10, 10]); // precision(...) ------------------------------------------------------------- -let precision1: number = graticuleGenerator.precision(); +const precision1: number = graticuleGenerator.precision(); graticuleGenerator = graticuleGenerator.precision(5); // Use GeoGraticuleGenerator ============================================ let multiString: GeoJSON.MultiLineString = graticuleGenerator(); -let lines: GeoJSON.LineString[] = graticuleGenerator.lines(); -let polygon2: GeoJSON.Polygon = graticuleGenerator.outline(); +const lines: GeoJSON.LineString[] = graticuleGenerator.lines(); +const polygon2: GeoJSON.Polygon = graticuleGenerator.outline(); // geoGraticule10() ===================================================== @@ -317,24 +315,22 @@ multiString = d3Geo.geoGraticule10(); // Pre-Defined Raw Projection Factories ================================= -let azimuthalEqualAreaRaw: d3Geo.GeoRawProjection = d3Geo.geoAzimuthalEqualAreaRaw(); -let azimuthalEquidistantRaw: d3Geo.GeoRawProjection = d3Geo.geoAzimuthalEquidistantRaw(); -let conicConformalRaw: d3Geo.GeoRawProjection = d3Geo.geoConicConformalRaw(0, 0); -let conicEqualAreaRaw: d3Geo.GeoRawProjection = d3Geo.geoConicEqualAreaRaw(0, 0); -let conicEquidistantRaw: d3Geo.GeoRawProjection = d3Geo.geoConicEquidistantRaw(0, 0); -let equirectangularRaw: d3Geo.GeoRawProjection = d3Geo.geoEquirectangularRaw(); -let gnomonicRaw: d3Geo.GeoRawProjection = d3Geo.geoGnomonicRaw(); -let mercatorRaw: d3Geo.GeoRawProjection = d3Geo.geoMercatorRaw(); -let orthographicRaw: d3Geo.GeoRawProjection = d3Geo.geoOrthographicRaw(); -let stereographicRaw: d3Geo.GeoRawProjection = d3Geo.geoStereographicRaw(); -let transverseMercatorRaw: d3Geo.GeoRawProjection = d3Geo.geoTransverseMercatorRaw(); +const azimuthalEqualAreaRaw: d3Geo.GeoRawProjection = d3Geo.geoAzimuthalEqualAreaRaw(); +const azimuthalEquidistantRaw: d3Geo.GeoRawProjection = d3Geo.geoAzimuthalEquidistantRaw(); +const conicConformalRaw: d3Geo.GeoRawProjection = d3Geo.geoConicConformalRaw(0, 0); +const conicEqualAreaRaw: d3Geo.GeoRawProjection = d3Geo.geoConicEqualAreaRaw(0, 0); +const conicEquidistantRaw: d3Geo.GeoRawProjection = d3Geo.geoConicEquidistantRaw(0, 0); +const equirectangularRaw: d3Geo.GeoRawProjection = d3Geo.geoEquirectangularRaw(); +const gnomonicRaw: d3Geo.GeoRawProjection = d3Geo.geoGnomonicRaw(); +const mercatorRaw: d3Geo.GeoRawProjection = d3Geo.geoMercatorRaw(); +const orthographicRaw: d3Geo.GeoRawProjection = d3Geo.geoOrthographicRaw(); +const stereographicRaw: d3Geo.GeoRawProjection = d3Geo.geoStereographicRaw(); +const transverseMercatorRaw: d3Geo.GeoRawProjection = d3Geo.geoTransverseMercatorRaw(); // Use Raw Projection ===================================================== -let rawProjectionPoint: [number, number] = azimuthalEqualAreaRaw(54, 2); -let rawProjectionInvertedPoint: [number, number] = azimuthalEqualAreaRaw.invert(180, 6); - - +const rawProjectionPoint: [number, number] = azimuthalEqualAreaRaw(54, 2); +const rawProjectionInvertedPoint: [number, number] = azimuthalEqualAreaRaw.invert(180, 6); // ---------------------------------------------------------------------- // Pre-Defined Projections @@ -342,39 +338,38 @@ let rawProjectionInvertedPoint: [number, number] = azimuthalEqualAreaRaw.invert( // Create predefined Projection from factory ============================= -let albers: d3Geo.GeoConicProjection = d3Geo.geoAlbers(); -let albersUsa: d3Geo.GeoProjection = d3Geo.geoAlbersUsa(); -let azimuthalEqualArea: d3Geo.GeoProjection = d3Geo.geoAzimuthalEqualArea(); -let azimuthalEquidistant: d3Geo.GeoProjection = d3Geo.geoAzimuthalEquidistant(); +const albers: d3Geo.GeoConicProjection = d3Geo.geoAlbers(); +const albersUsa: d3Geo.GeoProjection = d3Geo.geoAlbersUsa(); +const azimuthalEqualArea: d3Geo.GeoProjection = d3Geo.geoAzimuthalEqualArea(); +const azimuthalEquidistant: d3Geo.GeoProjection = d3Geo.geoAzimuthalEquidistant(); let conicConformal: d3Geo.GeoConicProjection = d3Geo.geoConicConformal(); -let conicEqualArea: d3Geo.GeoConicProjection = d3Geo.geoConicEqualArea(); -let conicEquidistant: d3Geo.GeoConicProjection = d3Geo.geoConicEquidistant(); -let cquirectangular: d3Geo.GeoProjection = d3Geo.geoEquirectangular(); -let gnomonic: d3Geo.GeoProjection = d3Geo.geoGnomonic(); -let mercator: d3Geo.GeoProjection = d3Geo.geoMercator(); -let orthographic: d3Geo.GeoProjection = d3Geo.geoOrthographic(); -let stereographic: d3Geo.GeoProjection = d3Geo.geoStereographic(); -let transverseMercator: d3Geo.GeoProjection = d3Geo.geoTransverseMercator(); +const conicEqualArea: d3Geo.GeoConicProjection = d3Geo.geoConicEqualArea(); +const conicEquidistant: d3Geo.GeoConicProjection = d3Geo.geoConicEquidistant(); +const cquirectangular: d3Geo.GeoProjection = d3Geo.geoEquirectangular(); +const gnomonic: d3Geo.GeoProjection = d3Geo.geoGnomonic(); +const mercator: d3Geo.GeoProjection = d3Geo.geoMercator(); +const orthographic: d3Geo.GeoProjection = d3Geo.geoOrthographic(); +const stereographic: d3Geo.GeoProjection = d3Geo.geoStereographic(); +const transverseMercator: d3Geo.GeoProjection = d3Geo.geoTransverseMercator(); // ---------------------------------------------------------------------- // Create New Projections // ---------------------------------------------------------------------- +const geoProjection: d3Geo.GeoProjection = d3Geo.geoProjection(azimuthalEqualAreaRaw); -let geoProjection: d3Geo.GeoProjection = d3Geo.geoProjection(azimuthalEqualAreaRaw); - -let mutate: () => d3Geo.GeoProjection = d3Geo.geoProjectionMutator(() => azimuthalEqualAreaRaw); +const mutate: () => d3Geo.GeoProjection = d3Geo.geoProjectionMutator(() => azimuthalEqualAreaRaw); let constructedProjection: d3Geo.GeoProjection = mutate(); // Use Projection ========================================================== -let projected: [number, number] = constructedProjection([54, 2]); -let inverted2: [number, number] = constructedProjection.invert([54, 2]); +const projected: [number, number] = constructedProjection([54, 2]); +const inverted2: [number, number] = constructedProjection.invert([54, 2]); // TODO ????? // let stream: d3Geo.Stream = constructedProjection.stream([54, 2]); -let clipAngle: number = constructedProjection.clipAngle(); +const clipAngle: number = constructedProjection.clipAngle(); constructedProjection = constructedProjection.clipAngle(null); constructedProjection = constructedProjection.clipAngle(45); @@ -388,14 +383,14 @@ constructedProjection = constructedProjection.scale(45); let translate: [number, number] = constructedProjection.translate(); constructedProjection = constructedProjection.translate([480, 250]); -let center: [number, number] = constructedProjection.center(); +const center: [number, number] = constructedProjection.center(); constructedProjection = constructedProjection.center([0, 0]); -let rotate: [number, number, number] = constructedProjection.rotate(); +const rotate: [number, number, number] = constructedProjection.rotate(); constructedProjection = constructedProjection.rotate([0, 0]); constructedProjection = constructedProjection.rotate([0, 0, 0]); -let precision2: number = constructedProjection.precision(); +const precision2: number = constructedProjection.precision(); constructedProjection = constructedProjection.precision(0.707); constructedProjection = constructedProjection.fitExtent([[0, 0], [960, 500]], samplePolygon); @@ -423,7 +418,7 @@ constructedProjection = constructedProjection.fitSize([960, 500], sampleExtended // ---------------------------------------------------------------------- // parallels(...) ------------------------------------------------------ -let parallels: [number, number] = conicConformal.parallels(); +const parallels: [number, number] = conicConformal.parallels(); conicConformal = conicConformal.parallels([20, 20]); // test method inheritance from GeoProjection --------------------------- @@ -434,7 +429,7 @@ conicConformal = conicConformal.fitSize([960, 500], samplePolygon); // inherited // GeoPath Generator // ---------------------------------------------------------------------- -let minimalRenderingContextMockUp: d3Geo.GeoContext = { +const minimalRenderingContextMockUp: d3Geo.GeoContext = { beginPath: () => { return; }, moveTo: (x: number, y: number) => { return; }, lineTo: (x: number, y: number) => { return; }, @@ -460,12 +455,12 @@ geoPathSVG = d3Geo.geoPath(); +const geoPathProjectionMinimal: d3Geo.GeoStreamWrapper = geoPathCanvas.projection(); +const geoPathProjectionUnion: d3Geo.GeoProjection | d3Geo.GeoConicProjection | d3Geo.GeoStreamWrapper = geoPathCanvas.projection(); +const geoPathProjection: d3Geo.GeoProjection = geoPathCanvas.projection(); geoPathSVG = geoPathSVG.projection(conicConformal); -let geoPathConicProjection: d3Geo.GeoConicProjection = geoPathSVG.projection(); +const geoPathConicProjection: d3Geo.GeoConicProjection = geoPathSVG.projection(); // geoPathConicProjection = geoPathSVG.projection(); // fails without casting to GeoConicProjection, or alternatively custom typeguard // geoPathConicProjection = geoPathSVG.projection(); // fails as SampleProperties does not extend minimal interface @@ -474,8 +469,7 @@ let geoPathConicProjection: d3Geo.GeoConicProjection = geoPathSVG.projection(); // pointRadius(...) ------------------------------------------------------ geoPathCanvas = geoPathCanvas.pointRadius(5); -let geoPathCanvasPointRadiusAccessor: ((this: any, d: d3Geo.GeoPermissibleObjects, ...args: any[]) => number) | number = geoPathCanvas.pointRadius(); +const geoPathCanvasPointRadiusAccessor: ((this: any, d: d3Geo.GeoPermissibleObjects, ...args: any[]) => number) | number = geoPathCanvas.pointRadius(); -geoPathSVG = geoPathSVG.pointRadius(function (datum) { - let that: SVGPathElement = this; - let d: d3Geo.ExtendedFeature = datum; +geoPathSVG = geoPathSVG.pointRadius(function(datum) { + const that: SVGPathElement = this; + const d: d3Geo.ExtendedFeature = datum; return datum.properties.name === 'Alabama' ? 10 : 15; }); -let geoPathSVGPointRadiusAccessor: number | ((this: SVGPathElement, d: d3Geo.ExtendedFeature, ...args: any[]) => number) = geoPathSVG.pointRadius(); +const geoPathSVGPointRadiusAccessor: number | ((this: SVGPathElement, d: d3Geo.ExtendedFeature, ...args: any[]) => number) = geoPathSVG.pointRadius(); // let geoPathSVGPointRadiusAccessorWrong1: number | ((this: SVGCircleElement, d: d3Geo.ExtendedFeature, ...args: any[]) => number) // = geoPathSVG.pointRadius(); // fails, mismatch in this context // let geoPathSVGPointRadiusAccessorWrong2: number | ((this: SVGPathElement, d: d3Geo.GeoGeometryObjects, ...args: any[]) => number) = geoPathSVG.pointRadius(); // fails, mismatch in object datum type @@ -521,7 +515,6 @@ geoPathArea = geoPathCanvas.area(sampleExtendedFeatureCollection); // geoPathArea = geoPathSVG.area(sampleExtendedFeatureCollection); // fails, wrong data object type - // bounds(...) ------------------------------------------------------ let geoPathBounds: [[number, number], [number, number]] = geoPathCanvas.bounds(samplePolygon); @@ -550,7 +543,6 @@ geoPathCentroid = geoPathCanvas.centroid(sampleExtendedFeatureCollection); // geoPathCentroid = geoPathSVG.centroid(sampleExtendedFeatureCollection); // fails, wrong data object type - // measure(...) ------------------------------------------------------ let geoPathMeasure: number = geoPathCanvas.measure(samplePolygon); @@ -579,22 +571,19 @@ geoPathCanvas(sampleExtendedFeatureCollection); // Use path string generator for SVGPathElement -let svgPath: Selection, any, any>; +declare const svgPath: Selection, any, any>; svgPath.attr('d', geoPathSVG); -let svgCircleWrong: Selection, any, any>; +declare const svgCircleWrong: Selection, any, any>; // svgCircleWrong.attr('d', geoPathSVG); // fails, mismatch in `this` context -let svgPathWrong: Selection; +declare const svgPathWrong: Selection; // svgPathWrong.attr('d', geoPathSVG); // fails, mismatch in datum type - - - // ---------------------------------------------------------------------- // Context interface // ---------------------------------------------------------------------- -let context: d3Geo.GeoContext = { +const context: d3Geo.GeoContext = { beginPath: () => { return; }, moveTo: (x: number, y: number) => { return; }, lineTo: (x: number, y: number) => { return; }, @@ -608,7 +597,7 @@ let context: d3Geo.GeoContext = { // geoTransform(...) ==================================================== -let transformFunction: { stream: (s: d3Geo.GeoStream) => {} } = d3Geo.geoTransform({}); +const transformFunction: { stream: (s: d3Geo.GeoStream) => {} } = d3Geo.geoTransform({}); interface CustomTranformProto extends d3Geo.GeoTransformPrototype { a: number; @@ -617,14 +606,13 @@ interface CustomTranformProto extends d3Geo.GeoTransformPrototype { let customTransformProto: CustomTranformProto; customTransformProto = { - point: function (x, y) { + point(x, y) { return this.stream.point(x + this.a, -y); }, a: 10 }; -let t: { stream: (s: d3Geo.GeoStream) => (CustomTranformProto & d3Geo.GeoStream) } = d3Geo.geoTransform(customTransformProto); - +const t: { stream: (s: d3Geo.GeoStream) => (CustomTranformProto & d3Geo.GeoStream) } = d3Geo.geoTransform(customTransformProto); // geoIdentity() ======================================================== @@ -675,7 +663,7 @@ reflecting = identityTransform.reflectY(); // ---------------------------------------------------------------------- // Stream interface // ---------------------------------------------------------------------- -let stream: d3Geo.GeoStream; +declare const stream: d3Geo.GeoStream; stream.point(0, 0); stream.point(0, 0, 0); @@ -696,4 +684,3 @@ d3Geo.geoStream(sampleExtendedFeature1, stream); d3Geo.geoStream(sampleExtendedFeature2, stream); d3Geo.geoStream(sampleFeatureCollection, stream); d3Geo.geoStream(sampleExtendedFeatureCollection, stream); - diff --git a/d3-geo/index.d.ts b/d3-geo/index.d.ts index dfc58a5f9e..1e9fed9b92 100644 --- a/d3-geo/index.d.ts +++ b/d3-geo/index.d.ts @@ -274,7 +274,6 @@ export interface GeoRotation { */ export function geoRotation(angles: [number, number] | [number, number, number]): GeoRotation; - // ---------------------------------------------------------------------- // Spherical Shapes // ---------------------------------------------------------------------- @@ -535,8 +534,6 @@ export interface GeoStream { sphere?(): void; } - - // geoStream(...) ======================================================= /** @@ -575,15 +572,10 @@ export function geoStream(object: GeoGeometryObjects, stream: GeoStream): void; */ export function geoStream(object: ExtendedGeometryCollection, stream: GeoStream): void; - - // ---------------------------------------------------------------------- // Projections // ---------------------------------------------------------------------- - - - /** * Raw projections are point transformation functions that are used to implement custom projections; they typically passed to d3.geoProjection or d3.geoProjectionMutator. * They are exposed here to facilitate the derivation of related projections. @@ -737,7 +729,6 @@ export interface GeoProjection extends GeoStreamWrapper { */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection): this; - /** * Sets the projection’s scale and translate to fit the specified geographic feature in the center of an extent with the given size and top-left corner of [0, 0]. * Returns the projection. @@ -845,7 +836,6 @@ export interface GeoProjection extends GeoStreamWrapper { * A Conic Projection */ export interface GeoConicProjection extends GeoProjection { - /** * Return the standard parallels for the conic projection in degrees. */ @@ -856,10 +846,8 @@ export interface GeoConicProjection extends GeoProjection { * @param value A two-dimensional array representing the standard parallels in degrees. */ parallels(value: [number, number]): this; - } - // geoPath ============================================================== /** @@ -869,7 +857,6 @@ export interface GeoConicProjection extends GeoProjection { * For reference to the CanvasRenderingContext2D see https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D */ export interface GeoContext { - /** * Adds an arc to the path with center point (x, y) and radius r starting at startAngle and ending at endAngle. * The arc is drawn in clockwise directio by default. @@ -921,7 +908,6 @@ export interface GeoContext { * The second generic corresponds to the type of the DatumObject which will be passed into the geo path generator for rendering. */ export interface GeoPath { - /** * Renders the given object, which may be any GeoJSON feature or geometry object: * @@ -1084,7 +1070,6 @@ export interface GeoPath { * It is passed the object to be rendered, and any additional arguments which have been passed into the call to the render function of the path generator. */ pointRadius(value: (this: This, object: DatumObject, ...args: any[]) => number): this; - } /** @@ -1143,9 +1128,6 @@ export function geoPath(projection?: */ export function geoPath(projection?: GeoProjection | GeoStreamWrapper | null, context?: GeoContext | null): GeoPath; - - - // geoProjection ========================================================== /** @@ -1366,7 +1348,6 @@ export function geoTransform(methods: T): { str * Geo Identity Transform */ export interface GeoIdentityTranform extends GeoStreamWrapper { - /** * Returns the current viewport clip extent which defaults to null. */ @@ -1431,7 +1412,6 @@ export interface GeoIdentityTranform extends GeoStreamWrapper { */ fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection): this; - /** * Sets the projection’s scale and translate to fit the specified geographic feature in the center of an extent with the given size and top-left corner of [0, 0]. * Returns the projection. diff --git a/d3-selection-multi/index.d.ts b/d3-selection-multi/index.d.ts index 30268ad3aa..da3c64e5e3 100644 --- a/d3-selection-multi/index.d.ts +++ b/d3-selection-multi/index.d.ts @@ -8,7 +8,6 @@ import {Selection, BaseType, ArrayLike, ValueFn} from 'd3-selection'; import {Transition} from 'd3-transition'; - /** * An object mapping attribute (or style or property) names to value accessors * @@ -29,7 +28,7 @@ declare module 'd3-selection' { * The third generic "PElement" refers to the type of the parent element(s) in the D3 selection. * The fourth generic "PDatum" refers to the type of the datum of the parent element(s). */ - export interface Selection { + interface Selection { /** * Set multiple attributes on the given selection. Attribute values may be constant or derived from each node and its bound data. * @@ -85,7 +84,7 @@ declare module 'd3-transition' { * The third generic "PElement" refers to the type of the parent element(s) in the D3 selection in the Transition. * The fourth generic "PDatum" refers to the type of the datum of the parent element(s) in the Transition. */ - export interface Transition { + interface Transition { /** * Set multiple attribute values. The transition will animate from the present value to the new value. Attribute values may be constant or derived from each node and its bound data. * diff --git a/d3-shape/d3-shape-tests.ts b/d3-shape/d3-shape-tests.ts index 204f1e7eb1..3ac854df2b 100644 --- a/d3-shape/d3-shape-tests.ts +++ b/d3-shape/d3-shape-tests.ts @@ -147,7 +147,6 @@ svgArc = svgArc.padRadius(null); accessorArcDatumNumberOrNull = svgArc.padRadius(); - // use Arc(...) generator ============================================================ // centroid(...) --------------------------------------------------------------------- @@ -160,7 +159,6 @@ const centroid: [number, number] = svgArc.centroid(arcDatum); // use with canvas canvasArc(arcDefaultDatum); - // use with svg const pArc: Selection = select('.arc-paths'); // mock @@ -171,7 +169,6 @@ pArc.attr('d', svgArc); // wrongArc1.attr('d', svgArc); // fails, incompatible this contexts // wrongArc2.attr('d', svgArc); // fails, incompatible datum types - // pathStringMaybe = svgArc(arcDatum); // fails, wrong this type for invocation // Use with custom object @@ -230,12 +227,10 @@ interface PieDatum { name: string; } - let accessorPieDatumNumber: (this: any, data: PieDatum[], ...args: any[]) => number; // PieArcDatum interface ============================================================= - const pieArcObject: d3Shape.PieArcDatum = { data: { val: 10, @@ -280,7 +275,6 @@ pie = pie.value((d, i, data) => { pieValueAccessor = pie.value(); - // sort(...) --------------------------------------------------------------------------- let pieSorter: ((a: PieDatum, b: PieDatum) => number) | null; @@ -332,7 +326,6 @@ defaultPie = defaultPie.padAngle(0.03); pie = pie.padAngle(d => { console.log(d.length > 0 ? d[0].val : 'no data'); // data type is Array return 0.03; - }); accessorPieDatumNumber = pie.padAngle(); @@ -351,7 +344,6 @@ let pieChart: Array>; pieChart = pie(pieData); - // ----------------------------------------------------------------------------------- // Test Line Generators // ----------------------------------------------------------------------------------- @@ -519,7 +511,6 @@ const radialLineData: RadialLineDatum[] = [ const radialLinePathStringMaybe: string | null = radialLine(radialLineData); - // ----------------------------------------------------------------------------------- // Test Area Generators // ----------------------------------------------------------------------------------- @@ -808,7 +799,6 @@ areaRadialLineGenerator = radialArea.lineInnerRadius(); areaRadialLineGenerator = radialArea.lineEndAngle(); areaRadialLineGenerator = radialArea.lineOuterRadius(); - // ----------------------------------------------------------------------------------- // Test Curve Factories // ----------------------------------------------------------------------------------- @@ -1002,7 +992,6 @@ pSymbol.attr('d', svgSymbol); // wrongSymbol1.attr('d', svgSymbol); // fails, incompatible this contexts // wrongSymbol2.attr('d', svgSymbol); // fails, incompatible datum types - // pathStringMaybe = svgSymbol(symbolDatum); // fails, wrong this type for invocation // Use with custom object @@ -1056,7 +1045,6 @@ const sym = new Symbolizer(100, 'square'); pathStringMaybe = sym.getPathString(); pathStringMaybe = sym.getPathString({ size: 10, type: 'circle' }); - // Test pre-fab symbols =============================================================== const symbolArray: d3Shape.SymbolType[] = d3Shape.symbols; @@ -1099,7 +1087,6 @@ const stackData: StackDatum[] = [ { values: { bananas: 12, apples: 10, oranges: 50 } } ]; - // Create stack generator ========================================================== let defaultStack: d3Shape.Stack; @@ -1110,7 +1097,6 @@ let overlyComplicatedStack: d3Shape.Stack; overlyComplicatedStack = d3Shape.stack(); - // Configure stack generator ======================================================= // keys(...) ---------------------------------------------------------------------- @@ -1181,8 +1167,6 @@ num = seriesPoint[0]; num = seriesPoint[1]; seriesDatum = seriesPoint.data; - - // Test stack orders =============================================================== let order: number[]; diff --git a/d3-shape/index.d.ts b/d3-shape/index.d.ts index 367a9dee2b..e1d80b6786 100644 --- a/d3-shape/index.d.ts +++ b/d3-shape/index.d.ts @@ -790,7 +790,6 @@ export function line(): Line<[number, number]>; */ export function line(): Line; - /** * The radial line generator produces a spline or polyline, as in a line chart. * @@ -1285,7 +1284,6 @@ export function area(): Area; * The generic refers to the data type of an element in the input array passed into the area generator. */ export interface RadialArea { - /** * Generates a radial area for the given array of data. * @@ -1670,7 +1668,7 @@ export interface CurveFactory { * The first and last points are triplicated such that the spline starts at the first point and ends at the last point, * and is tangent to the line between the first and second points, and to the line between the penultimate and last points. */ -export var curveBasis: CurveFactory; +export const curveBasis: CurveFactory; /** * A curve factory for closed cubic basis spline generators. @@ -1678,7 +1676,7 @@ export var curveBasis: CurveFactory; * The curve generators produce a closed cubic basis spline using the specified control points. * When a line segment ends, the first three control points are repeated, producing a closed loop with C2 continuity. */ -export var curveBasisClosed: CurveFactory; +export const curveBasisClosed: CurveFactory; /** * A curve factory for open cubic basis spline generators. @@ -1686,7 +1684,7 @@ export var curveBasisClosed: CurveFactory; * The curve generators produce a cubic basis spline using the specified control points. * Unlike basis, the first and last points are not repeated, and thus the curve typically does not intersect these points. */ -export var curveBasisOpen: CurveFactory; +export const curveBasisOpen: CurveFactory; /** * A curve factory for straightened cubic basis spline generators. @@ -1719,8 +1717,7 @@ export interface CurveBundleFactory extends CurveFactoryLineOnly { * * This curve does not implement curve.areaStart and curve.areaEnd; it is intended to work with d3.line, not d3.area. */ -export var curveBundle: CurveBundleFactory; - +export const curveBundle: CurveBundleFactory; /** * A curve factory for cubic cardinal spline generators. @@ -1741,7 +1738,7 @@ export interface CurveCardinalFactory extends CurveFactory { * The curve generators produce a cubic cardinal spline using the specified control points, with one-sided differences used for the first and last piece. * The default tension is 0. */ -export var curveCardinal: CurveCardinalFactory; +export const curveCardinal: CurveCardinalFactory; /** * A curve factory for closed cubic cardinal spline generators. @@ -1750,7 +1747,7 @@ export var curveCardinal: CurveCardinalFactory; * When a line segment ends, the first three control points are repeated, producing a closed loop. * The default tension is 0. */ -export var curveCardinalClosed: CurveCardinalFactory; +export const curveCardinalClosed: CurveCardinalFactory; /** * A curve factory for open cubic cardinal spline generators. @@ -1760,7 +1757,7 @@ export var curveCardinalClosed: CurveCardinalFactory; * and thus the curve starts at the second point and ends at the penultimate point. * The default tension is 0. */ -export var curveCardinalOpen: CurveCardinalFactory; +export const curveCardinalOpen: CurveCardinalFactory; /** * A curve factory for cubic Catmull–Rom spline generators. @@ -1784,7 +1781,7 @@ export interface CurveCatmullRomFactory extends CurveFactory { * which defaults to 0.5, as proposed by Yuksel et al. in On the Parameterization of Catmull–Rom Curves, * with one-sided differences used for the first and last piece. */ -export var curveCatmullRom: CurveCatmullRomFactory; +export const curveCatmullRom: CurveCatmullRomFactory; /** * A curve factory for cubic Catmull–Rom spline generators. @@ -1793,7 +1790,7 @@ export var curveCatmullRom: CurveCatmullRomFactory; * which defaults to 0.5, as proposed by Yuksel et al. When a line segment ends, * the first three control points are repeated, producing a closed loop. */ -export var curveCatmullRomClosed: CurveCatmullRomFactory; +export const curveCatmullRomClosed: CurveCatmullRomFactory; /** * A curve factory for cubic Catmull–Rom spline generators. @@ -1802,22 +1799,21 @@ export var curveCatmullRomClosed: CurveCatmullRomFactory; * which defaults to 0.5, as proposed by Yuksel et al. Unlike curveCatmullRom, one-sided differences are not used for the first and last piece, * and thus the curve starts at the second point and ends at the penultimate point. */ -export var curveCatmullRomOpen: CurveCatmullRomFactory; - +export const curveCatmullRomOpen: CurveCatmullRomFactory; /** * A curve factory for polyline generators. * * The curve generators produce a polyline through the specified points. */ -export var curveLinear: CurveFactory; +export const curveLinear: CurveFactory; /** * A curve factory for closed polyline generators. * * The curve generators produce a closed polyline through the specified points by repeating the first point when the line segment ends. */ -export var curveLinearClosed: CurveFactory; +export const curveLinearClosed: CurveFactory; /** * A curve factory for cubic spline generators preserving monotonicity in y. @@ -1826,7 +1822,7 @@ export var curveLinearClosed: CurveFactory; * “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations. * Local extrema can occur only at grid points where they are given by the data, but not in between two adjacent grid points.” */ -export var curveMonotoneX: CurveFactory; +export const curveMonotoneX: CurveFactory; /** * A curve factory for cubic spline generators preserving monotonicity in x. @@ -1835,14 +1831,14 @@ export var curveMonotoneX: CurveFactory; * “a smooth curve with continuous first-order derivatives that passes through any given set of data points without spurious oscillations. * Local extrema can occur only at grid points where they are given by the data, but not in between two adjacent grid points.” */ -export var curveMonotoneY: CurveFactory; +export const curveMonotoneY: CurveFactory; /** * A curve factory for natural cubic spline generators. * * The curve generators produce a natural cubic spline with the second derivative of the spline set to zero at the endpoints. */ -export var curveNatural: CurveFactory; +export const curveNatural: CurveFactory; /** * A curve factory for step function (midpoint) generators. @@ -1850,7 +1846,7 @@ export var curveNatural: CurveFactory; * The curve generators produce a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. * The y-value changes at the midpoint of each pair of adjacent x-values. */ -export var curveStep: CurveFactory; +export const curveStep: CurveFactory; /** * A curve factory for step function (after) generators. @@ -1858,7 +1854,7 @@ export var curveStep: CurveFactory; * The curve generators produce a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. * The y-value changes after the x-value. */ -export var curveStepAfter: CurveFactory; +export const curveStepAfter: CurveFactory; /** * A curve factory for step function (before) generators. @@ -1866,8 +1862,7 @@ export var curveStepAfter: CurveFactory; * The curve generators produce a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. * The y-value changes before the x-value. */ -export var curveStepBefore: CurveFactory; - +export const curveStepBefore: CurveFactory; // ----------------------------------------------------------------------------------- // SYMBOLS @@ -1990,7 +1985,6 @@ export interface Symbol { * @param context null, to remove rendering context. */ context(context: null): this; - } /** @@ -2017,43 +2011,42 @@ export function symbol(): Symbol; * An array containing the set of all built-in symbol types: circle, cross, diamond, square, star, triangle, and wye. * Useful for constructing the range of an ordinal scale should you wish to use a shape encoding for categorical data. */ -export var symbols: SymbolType[]; +export const symbols: SymbolType[]; /** * The circle symbol type. */ -export var symbolCircle: SymbolType; +export const symbolCircle: SymbolType; /** * The Greek cross symbol type, with arms of equal length. */ -export var symbolCross: SymbolType; +export const symbolCross: SymbolType; /** * The rhombus symbol type. */ -export var symbolDiamond: SymbolType; +export const symbolDiamond: SymbolType; /** * The square symbol type. */ -export var symbolSquare: SymbolType; +export const symbolSquare: SymbolType; /** * The pentagonal star (pentagram) symbol type. */ -export var symbolStar: SymbolType; +export const symbolStar: SymbolType; /** * he up-pointing triangle symbol type. */ -export var symbolTriangle: SymbolType; +export const symbolTriangle: SymbolType; /** * The Y-shape symbol type. */ -export var symbolWye: SymbolType; - +export const symbolWye: SymbolType; // ----------------------------------------------------------------------------------- // STACKS @@ -2221,7 +2214,6 @@ export interface Stack { * The offset function is then responsible for updating the lower and upper values in the series array to layout the stack. */ offset(offset: (series: Series, order: number[]) => void): this; - } /** diff --git a/d3-transition/d3-transition-tests.ts b/d3-transition/d3-transition-tests.ts index c2917aaf94..ba0ae99750 100644 --- a/d3-transition/d3-transition-tests.ts +++ b/d3-transition/d3-transition-tests.ts @@ -122,7 +122,6 @@ const enterCircles = circles .style('stroke', d => d.color) .style('fill', d => d.color); - const exitCircles = circles.exit(); // Note: need to re-type datum type, as the exit selection elements have the 'old data' // -------------------------------------------------------------------------- @@ -166,7 +165,6 @@ const duration: number = enterTransition.duration(); enterTransition = enterTransition.delay(500); // settable and chainable const delay: number = enterTransition.delay(); - // ease() --------------------------------------------------------------- let easingFn: (normalizedTime: number) => number; @@ -207,8 +205,6 @@ firstDivTransition = bodyTransition.select(function(d, i, g) { return this.querySelector('div')!; // 'this' type is HTMLElement, return type is HTMLDivElement }); - - // selectAll() --------------------------------------------------------------- // assume paragraphs were previously selected and their data were set to ParagraphDatum type @@ -323,7 +319,6 @@ select('body') .transition().duration(100) .text(d => d.test); // selection datum type - // test, when it is not certain, whether an element of the type to be selected exists let maybeG1: d3Transition.Transition; @@ -343,7 +338,6 @@ maybeG1 = selectAll('svg') } else { return null; } - }); // Tweening Function Use ===================================================== @@ -366,7 +360,6 @@ exitTransition = exitTransition.styleTween('fill', function(d, i, group) { let tweenFnAccessor: undefined | ((this: SVGCircleElement, datum?: CircleDatum, i?: number, group?: SVGCircleElement[] | ArrayLike) => ((t: number) => void)); - // chainable updateTransition = updateTransition.tween('fillColor', null); // remove named tween @@ -407,7 +400,6 @@ exitTransition.remove(); let listener: undefined | ((this: SVGCircleElement, datum: CircleDatum, index: number, group: SVGCircleElement[] | ArrayLike) => void); - enterTransition = enterTransition.on('end', function(d, i, g) { const that: SVGCircleElement = this; // const that2: HTMLElement = this; // fails, type mismatch @@ -433,7 +425,6 @@ enterTransition = enterTransition.on('end', null); // check chaining return type // Test Control Flow // -------------------------------------------------------------------------- - // each() ------------------------------------------------------------------------------- // each(valueFn: (this: GElement, datum?: Datum, index?: number, group?: Array | ArrayLike) => void): Transition; @@ -524,7 +515,3 @@ updateTransitionActive = d3Transition.active { + interface Selection { /** * Interrupts the active transition of the specified name on the selected elements, and cancels any pending transitions with the specified name, if any. * If a name is not specified, null is used. @@ -88,7 +88,6 @@ export function interrupt(node: BaseType, name?: string): void; * The fourth generic "PDatum" refers to the type of the datum of the parent element(s) in the Transition. */ export interface Transition { - // Sub-selection ------------------------- /** diff --git a/d3-zoom/d3-zoom-tests.ts b/d3-zoom/d3-zoom-tests.ts index f4a1c0944e..b583bfc8b6 100644 --- a/d3-zoom/d3-zoom-tests.ts +++ b/d3-zoom/d3-zoom-tests.ts @@ -52,7 +52,6 @@ function drawPointOnCanvas(radius: number) { }; } - // SVG Prep ------------------------------------------------------------------- interface SVGDatum { @@ -66,7 +65,6 @@ const svg = select('svg') .attr('width', d => d.width) .attr('height', d => d.height); - const g = svg.append('g'); g.selectAll() @@ -85,7 +83,6 @@ interface GroupDatum { toK: number; } - // -------------------------------------------------------------------------- // Test Define ZoomBehaviour // -------------------------------------------------------------------------- @@ -93,7 +90,6 @@ interface GroupDatum { // Canvas Example ----------------------------------------------------------- function zoomedCanvas(this: HTMLCanvasElement, d: CanvasDatum) { - // Cast d3 event to D3ZoomEvent to be used in zoom event handler const e = > event; if (context) { @@ -115,7 +111,6 @@ canvasZoom = d3Zoom.zoom() // SVG Example -------------------------------------------------------------- function zoomedSVGOverlay(this: SVGRectElement) { - // Cast d3 event to D3ZoomEvent to be used in zoom event handler const e = > event; @@ -126,7 +121,6 @@ let svgZoom: d3Zoom.ZoomBehavior; svgZoom = d3Zoom.zoom(); - // filter() ---------------------------------------------------------------- // chainable @@ -141,7 +135,6 @@ svgZoom = svgZoom.filter(function(d, i, group) { let filterFn: (this: SVGRectElement, d: SVGDatum, index: number, group: SVGRectElement[]) => boolean; filterFn = svgZoom.filter(); - // extent() --------------------------------------------------------------- let extentAccessor: (this: SVGRectElement, d: SVGDatum, index: number, group: SVGRectElement[]) => [[number, number], [number, number]]; @@ -172,7 +165,6 @@ svgZoom = svgZoom.translateExtent([[-500, -500], [500, 500]]); let translateExtent: [[number, number], [number, number]]; translateExtent = svgZoom.translateExtent(); - // duration() -------------------------------------------------------------- // chainable @@ -187,7 +179,6 @@ svgZoom = svgZoom.interpolate(interpolateZoom); svgZoom = svgZoom.interpolate(interpolate); svgZoom = svgZoom.interpolate(interpolateArray); - // getter let basicInterpolatorFactory: (a: ZoomView, b: ZoomView) => ((t: number) => ZoomView); @@ -220,7 +211,6 @@ if (zoomHandler) { // Test Attach ZoomBehaviour // -------------------------------------------------------------------------- - // Canvas Example ----------------------------------------------------------- // attach the zoom behavior to the canvas element diff --git a/d3-zoom/index.d.ts b/d3-zoom/index.d.ts index 87a55e9b2a..904f7b8e62 100644 --- a/d3-zoom/index.d.ts +++ b/d3-zoom/index.d.ts @@ -8,7 +8,6 @@ import { ArrayLike, Selection, TransitionLike, ValueFn } from 'd3-selection'; import { ZoomView, ZoomInterpolator } from 'd3-interpolate'; - // -------------------------------------------------------------------------- // Shared Type Definitions and Interfaces // -------------------------------------------------------------------------- diff --git a/d3/d3-tests.ts b/d3/d3-tests.ts index ca4932d27c..1efb46be8e 100644 --- a/d3/d3-tests.ts +++ b/d3/d3-tests.ts @@ -1,6 +1,5 @@ import * as d3 from 'd3'; - // TODO: complete tests. Note the tests here should be limited to // testing existence of re-exported members of the // constituent modules comprising the D3 version 4 standard bundle @@ -8,5 +7,3 @@ import * as d3 from 'd3'; // Ability to access d3-select related properties const d: d3.Selection = d3.selection(); - - diff --git a/datatables.net-fixedheader/datatables.net-fixedheader-tests.ts b/datatables.net-fixedheader/datatables.net-fixedheader-tests.ts index 561b968ba9..72d8665838 100644 --- a/datatables.net-fixedheader/datatables.net-fixedheader-tests.ts +++ b/datatables.net-fixedheader/datatables.net-fixedheader-tests.ts @@ -1,5 +1,5 @@ $(document).ready(() => { - var config: DataTables.Settings = { + const config: DataTables.Settings = { // FixedHeader extension options fixedHeader: { footer: true, diff --git a/datatables.net-fixedheader/index.d.ts b/datatables.net-fixedheader/index.d.ts index caf3987d35..cb0b363b65 100644 --- a/datatables.net-fixedheader/index.d.ts +++ b/datatables.net-fixedheader/index.d.ts @@ -6,7 +6,7 @@ /// declare namespace DataTables { - export interface Settings { + interface Settings { /* * FixedHeader extension options */ diff --git a/datatables.net-select/datatables.net-select-tests.ts b/datatables.net-select/datatables.net-select-tests.ts index 5d8fdd8dc6..9b7eb24c2a 100644 --- a/datatables.net-select/datatables.net-select-tests.ts +++ b/datatables.net-select/datatables.net-select-tests.ts @@ -1,5 +1,5 @@ $(document).ready(() => { - var config: DataTables.Settings = { + const config: DataTables.Settings = { // Select extension options select: { blurable: true, diff --git a/datatables.net-select/index.d.ts b/datatables.net-select/index.d.ts index 96529a10c1..201d00ba27 100644 --- a/datatables.net-select/index.d.ts +++ b/datatables.net-select/index.d.ts @@ -6,7 +6,7 @@ /// declare namespace DataTables { - export interface Settings { + interface Settings { /* * Select extension options */ diff --git a/dookie/dookie-tests.ts b/dookie/dookie-tests.ts index 44cd6ec7ac..476538b8de 100644 --- a/dookie/dookie-tests.ts +++ b/dookie/dookie-tests.ts @@ -1,8 +1,5 @@ - -import {push, pull} from './index'; +import {push, pull} from 'dookie'; (async () => { - await push('mongodb://localhost:27017/test', {test: [{ok: 1}, {ok: 2}]}); - })(); diff --git a/ej.web.all/index.d.ts b/ej.web.all/index.d.ts index b1c4261705..ca17c06c5a 100644 --- a/ej.web.all/index.d.ts +++ b/ej.web.all/index.d.ts @@ -65198,4 +65198,4 @@ data(key: "ejTreeMap"): ej.datavisualization.TreeMap; data(key: "ejTreeView"): ej.TreeView; data(key: "ejUploadbox"): ej.Uploadbox; data(key: "ejWaitingPopup"): ej.WaitingPopup; -} \ No newline at end of file +} diff --git a/ej.web.all/tslint.json b/ej.web.all/tslint.json index b0b7c81ba5..845d9d8168 100644 --- a/ej.web.all/tslint.json +++ b/ej.web.all/tslint.json @@ -1 +1,9 @@ -{ "extends": "../tslint.json" } \ No newline at end of file +{ + "extends": "../tslint.json", + "rules": { + "comment-format": false, + "no-consecutive-blank-lines": false, + "no-padding": false, + "no-redundant-modifiers": false + } +} diff --git a/ember/ember-tests.ts b/ember/ember-tests.ts index 91e1f61f6f..99f00aae6f 100644 --- a/ember/ember-tests.ts +++ b/ember/ember-tests.ts @@ -1,4 +1,4 @@ -var App: any; +let App: any; App = Em.Application.create(); @@ -22,7 +22,7 @@ declare class MyPerson extends Em.Object { static createMan(): MyPerson; } -var Person1 = Em.Object.extend({ +const Person1 = Em.Object.extend({ say: (thing: string) => { alert(thing); } @@ -31,7 +31,7 @@ var Person1 = Em.Object.extend({ declare class MyPerson2 extends Em.Object { helloWorld(): void; } -var tom = Person1.create({ +const tom = Person1.create({ name: 'Tom Dale', helloWorld() { this.say('Hi my name is ' + this.get('name')); @@ -48,10 +48,9 @@ Person1.reopenClass({ } }); // ReSharper disable once DuplicatingLocalDeclaration -declare var Person1: typeof MyPerson; Person1.createMan().get('isMan'); -var person = Person1.create({ +const person = Person1.create({ firstName: 'Yehuda', lastName: 'Katz' }); @@ -63,13 +62,13 @@ App.todosController = Em.Object.create({ Em.Object.create({ isDone: false }) ], remaining: (function() { - var todos = this.get('todos'); + const todos = this.get('todos'); return todos.filterProperty('isDone', false).get('length'); }).property('todos.@each.isDone') }); -var todos = App.todosController.get('todos'); -var todo = todos.objectAt(0); +const todos = App.todosController.get('todos'); +let todo = todos.objectAt(0); todo.set('isDone', true); App.todosController.get('remaining'); todo = Em.Object.create({ isDone: false }); @@ -109,29 +108,29 @@ App.userController = Em.Object.create({ Handlebars.registerHelper('highlight', (property: string, options: any) => new Handlebars.SafeString('' + "some value" + '')); -var coolView = App.CoolView.create(); +const coolView = App.CoolView.create(); -var Person2 = Em.Object.extend({ +const Person2 = Em.Object.extend({ sayHello() { console.log('Hello from ' + this.get('name')); } }); -var people = [ +const people = [ Person2.create({ name: 'Juan' }), Person2.create({ name: 'Charles' }), Person2.create({ name: 'Majd' }) ]; people.invoke('sayHello'); -var arr = [Em.Object.create(), Em.Object.create()]; +const arr = [Em.Object.create(), Em.Object.create()]; arr.setEach('name', 'unknown'); arr.getEach('name'); -var Person3 = Em.Object.extend({ +const Person3 = Em.Object.extend({ name: null, isHappy: false }); -var people2 = [ +const people2 = [ Person3.create({ name: 'Yehuda', isHappy: true }), Person3.create({ name: 'Majd', isHappy: false }) ]; @@ -145,7 +144,7 @@ people2.everyProperty('isHappy', true); people2.someProperty('isHappy', true); // Examples taken from http://emberjs.com/api/classes/Em.RSVP.Promise.html -var promise = new Em.RSVP.Promise((resolve: Function, reject: Function) => { +const promise = new Em.RSVP.Promise((resolve: Function, reject: Function) => { // on success resolve('ok!'); @@ -159,15 +158,15 @@ promise.then((value: any) => { // on rejection }); -var mix1 = Ember.Mixin.create({ +const mix1 = Ember.Mixin.create({ foo: 1 }); -var mix2 = Ember.Mixin.create({ +const mix2 = Ember.Mixin.create({ bar: 2 }); -var component1 = Ember.Component.extend( mix1, mix2, { +const component1 = Ember.Component.extend( mix1, mix2, { lyft: Ember.inject.service(), cars: Ember.computed.readOnly('lyft.cars') }); diff --git a/ember/index.d.ts b/ember/index.d.ts index dca7004163..1e014759cc 100644 --- a/ember/index.d.ts +++ b/ember/index.d.ts @@ -7,7 +7,6 @@ /// declare namespace EmberStates { - interface Transition { targetName: string; urlMethod: string; @@ -151,16 +150,13 @@ declare namespace EmberStates { */ followRedirects(): Ember.RSVP.Promise; } - } // Get an alias to the global Array type to use in inner scope below. type GlobalArray = T[]; declare namespace EmberTesting { - namespace Test { - class Adapter { asyncEnd(): void; asyncStart(): void; @@ -168,9 +164,7 @@ declare namespace EmberTesting { } class QUnitAdapter extends Adapter { } - } - } interface Function { @@ -349,13 +343,10 @@ interface EnumerableConfigurationOptions { type ItemIndexEnumerableCallbackTarget = (callback: ItemIndexEnumerableCallback, target?: any) => any[]; - type ItemIndexEnumerableCallback = (item: any, index: number, enumerable: Ember.Enumerable) => void; - type ReduceCallback = (previousValue: any, item: any, index: number, enumerable: Ember.Enumerable) => void; - interface TransitionsHash { contexts: any[]; exitStates: Ember.State[]; @@ -388,7 +379,7 @@ declare namespace Ember { Alias for jQuery. **/ // ReSharper disable once DuplicatingLocalDeclaration - var $: JQueryStatic; + const $: JQueryStatic; /** Creates an Ember.NativeArray from an Array like object. Does not modify the original object. Ember.A is not needed if Ember.EXTEND_PROTOTYPES is true (the default value). However, it is @@ -651,7 +642,7 @@ declare namespace Ember { removeObject(object: any): any; removeObjects(objects: Enumerable): MutableEnumberable; } - var BOOTED: boolean; + const BOOTED: boolean; /** Connects the properties of two objects so that whenever the value of one property changes, the other property will be changed also. @@ -967,17 +958,17 @@ declare namespace Ember { **/ class Descriptor { } namespace ENV { - export var EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES; - export var LOG_BINDINGS: boolean; - export var LOG_STACKTRACE_ON_DEPRECATION: boolean; - export var LOG_VERSION: boolean; - export var MODEL_FACTORY_INJECTIONS: boolean; - export var RAISE_ON_DEPRECATION: boolean; + const EXTEND_PROTOTYPES: typeof Ember.EXTEND_PROTOTYPES; + const LOG_BINDINGS: boolean; + const LOG_STACKTRACE_ON_DEPRECATION: boolean; + const LOG_VERSION: boolean; + const MODEL_FACTORY_INJECTIONS: boolean; + const RAISE_ON_DEPRECATION: boolean; } namespace EXTEND_PROTOTYPES { - export var Array: boolean; - export var Function: boolean; - export var String: boolean; + const Array: boolean; + const Function: boolean; + const String: boolean; } /** This is the object instance returned when you get the @each property on an array. It uses @@ -1049,7 +1040,7 @@ declare namespace Ember { **/ // Restore this to 'typeof Error' when https://github.com/Microsoft/TypeScript/issues/983 is resolved // ReSharper disable once DuplicatingLocalDeclaration - var Error: any; // typeof Error; + const Error: any; // typeof Error; /** Handles delegating browser events to their corresponding Ember.Views. For example, when you click on a view, Ember.EventDispatcher ensures that that view's mouseDown method gets called. @@ -1082,12 +1073,12 @@ declare namespace Ember { one(name: string, target: any, method: Function): Evented; trigger(name: string, ...args: string[]): void; } - var FROZEN_ERROR: string; + const FROZEN_ERROR: string; class Freezable { freeze(): Freezable; isFrozen: boolean; } - var GUID_KEY: string; + const GUID_KEY: string; namespace Handlebars { function compile(string: string): Function; function compile(environment: any, options?: any, context?: any, asObject?: any): any; @@ -1104,7 +1095,7 @@ declare namespace Ember { } function parse(string: string): any; function print(ast: any): void; - var logger: typeof Ember.Logger; + const logger: typeof Ember.Logger; function log(level: string, str: string): void; } class HashLocation extends Object { @@ -1140,8 +1131,8 @@ declare namespace Ember { static isMethod: boolean; rootURL: string; } - var IS_BINDING: RegExp; - var inject: { + const IS_BINDING: RegExp; + const inject: { controller(name?: string): Controller; service(name?: string): Service; }; @@ -1158,15 +1149,15 @@ declare namespace Ember { subscribe(pattern: string, object: any): void; unsubscribe(subscriber: any): void; } - var K: Function; - var LOG_BINDINGS: boolean; - var LOG_STACKTRACE_ON_DEPRECATION: boolean; - var LOG_VERSION: boolean; + const K: Function; + const LOG_BINDINGS: boolean; + const LOG_STACKTRACE_ON_DEPRECATION: boolean; + const LOG_VERSION: boolean; class Location { create(options?: {}): any; registerImplementation(name: string, implementation: any): void; } - var Logger: { + const Logger: { assert(param: any): void; debug(...args: any[]): void; error(...args: any[]): void; @@ -1175,7 +1166,7 @@ declare namespace Ember { warn(...args: any[]): void; }; function MANDATORY_SETTER_FUNCTION(value: string): void; - var META_KEY: string; + const META_KEY: string; class Map { copy(): Map; static create(): Map; @@ -1305,7 +1296,7 @@ declare namespace Ember { hasEnumerableObservers: boolean; lastObject: any; } - var NAME_KEY: string; + const NAME_KEY: string; class Namespace extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; @@ -1425,7 +1416,7 @@ declare namespace Ember { static isClass: boolean; static isMethod: boolean; } - var ORDER_DEFINITION: string[]; + const ORDER_DEFINITION: string[]; class Object extends CoreObject implements Observable { addObserver: ModifyObserver; beginPropertyChanges(): Observable; @@ -1530,7 +1521,6 @@ declare namespace Ember { } class Promise implements Thenable { - /** Promise objects represent the eventual result of an asynchronous operation. The primary way of interacting with a promise is through its `then` method, which @@ -1591,7 +1581,6 @@ declare namespace Ember { the [routing guide](http://emberjs.com/guides/routing/) for documentation. */ class Route extends Object implements ActionHandlerMixin, Evented { - static isClass: boolean; static isMethod: boolean; @@ -1817,7 +1806,6 @@ declare namespace Ember { */ redirect(): EmberStates.Transition; - /** Refresh the model on this route and any child routes, firing the `beforeModel`, `model`, and `afterModel` hooks in a similar fashion @@ -2157,7 +2145,7 @@ declare namespace Ember { toggleProperty(keyName: string): boolean; /* /Observable */ } - var STRINGS: boolean; + const STRINGS: boolean; class State extends Object implements Evented { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; @@ -2236,7 +2224,7 @@ declare namespace Ember { function underscore(str: string): string; function w(str: string): string[]; } - var TEMPLATES: {}; + const TEMPLATES: {}; class TargetActionSupport { triggerAction(opts: {}): boolean; } @@ -2253,8 +2241,8 @@ declare namespace Ember { function registerHelper(name: string, helperMethod: Function): void; function registerAsyncHelper(name: string, helperMethod: Function): void; - var adapter: Object; - var QUnitAdapter: Object; + const adapter: Object; + const QUnitAdapter: Object; function registerWaiter(callback: Function): void; function registerWaiter(context: any, callback: Function): void; @@ -2325,18 +2313,18 @@ declare namespace Ember { bubbles: boolean; onEvent: string; } - var VERSION: string; + const VERSION: string; class ViewTargetActionSupport extends Mixin { target: any; actionContext: any; } - var ViewUtils: {}; // TODO: define interface + const ViewUtils: {}; // TODO: define interface function addListener(obj: any, eventName: string, target: Function | any, method: Function | string, once?: boolean): void; - var addObserver: ModifyObserver; + const addObserver: ModifyObserver; /** Ember.alias is deprecated. Please use Ember.aliasMethod or Ember.computed.alias instead. **/ - var alias: typeof deprecateFunc; + const alias: typeof deprecateFunc; function aliasMethod(methodName: string): Descriptor; function assert(desc: string, test: boolean): void; function beginPropertyChanges(): void; @@ -2346,7 +2334,7 @@ declare namespace Ember { function changeProperties(callback: Function, binding?: any): void; function compare(v: any, w: any): number; // ReSharper disable once DuplicatingLocalDeclaration - var computed: { + const computed: { (...args: any[]): ComputedProperty; alias(dependentKey: string): ComputedProperty; and(...args: string[]): ComputedProperty; @@ -2385,7 +2373,7 @@ declare namespace Ember { Ember.empty is deprecated. Please use Ember.isEmpty instead. **/ // ReSharper disable once DuplicatingLocalDeclaration - var empty: typeof deprecateFunc; + const empty: typeof deprecateFunc; function endPropertyChanges(): void; function finishChains(obj: any): void; function generateController(container: Container, controllerName: string, context: any): Controller; @@ -2394,7 +2382,7 @@ declare namespace Ember { /** getPath is deprecated since get now supports paths. **/ - var getPath: typeof deprecateFunc; + const getPath: typeof deprecateFunc; function getWithDefault(root: string, key: string, defaultValue: any): any; function guidFor(obj: any): string; function handleErrors(func: Function, context: any): any; @@ -2407,7 +2395,7 @@ declare namespace Ember { function isEmpty(obj: any): boolean; function isEqual(a: any, b: any): boolean; function isGlobalPath(path: string): boolean; - var isNamespace: boolean; + const isNamespace: boolean; function isNone(obj: any): boolean; function isPrototypeOf(obj: {}): boolean; function isWatching(obj: any, key: string): boolean; @@ -2416,7 +2404,7 @@ declare namespace Ember { function listenersFor(obj: any, eventName: string): any[]; function listenersUnion(obj: any, eventName: string, otherActions: any[]): void; // ReSharper disable once DuplicatingLocalDeclaration - var lookup: {}; // TODO: define interface + const lookup: {}; // TODO: define interface function makeArray(obj: any): any[]; function merge(original: any, updates: any): any; function meta(obj: any): {}; @@ -2424,14 +2412,14 @@ declare namespace Ember { /** Ember.none is deprecated. Please use Ember.isNone instead. **/ - var none: typeof deprecateFunc; + const none: typeof deprecateFunc; function observer(...args: any[]): Function; function observersFor(obj: any, path: string): any[]; function onLoad(name: string, callback: Function): void; - var onError: Error; + const onError: Error; function overrideChains(obj: any, keyName: string, m: any): boolean; // ReSharper disable once DuplicatingLocalDeclaration - var platform: { + const platform: { defineProperty: boolean; hasPropertyAccessors: boolean; }; @@ -2443,7 +2431,7 @@ declare namespace Ember { function removeObserver(obj: any, path: string, target: any, method: Function): any; function required(): Descriptor; function rewatch(obj: any): void; - var run: { + const run: { (method: Function): void; (target: any, method: Function): void; begin(): void; @@ -2466,7 +2454,7 @@ declare namespace Ember { /** setPath is deprecated since set now supports paths. **/ - var setPath: typeof deprecateFunc; + const setPath: typeof deprecateFunc; function setProperties(self: any, hash: {}): any; function subscribe(pattern: string, object: any): void; function toLocaleString(): string; @@ -2477,13 +2465,13 @@ declare namespace Ember { /** trySetPath has been renamed to trySet. **/ - var trySetPath: typeof deprecateFunc; + const trySetPath: typeof deprecateFunc; function typeOf(item: any): string; function unwatch(obj: any, keyPath: string): void; function unwatchKey(obj: any, keyName: string): void; function unwatchPath(obj: any, keyPath: string): void; // ReSharper disable once DuplicatingLocalDeclaration - var uuid: number; + const uuid: number; function valueOf(): {}; function warn(message: string, test?: boolean): void; function watch(obj: any, keyPath: string): void; @@ -2491,18 +2479,17 @@ declare namespace Ember { function watchPath(obj: any, keyPath: string): void; function watchedEvents(obj: {}): any[]; function wrap(func: Function, superFunc: Function): Function; - var _ContainerProxyMixin: Mixin; - var _RegistryProxyMixin: Mixin; + const _ContainerProxyMixin: Mixin; + const _RegistryProxyMixin: Mixin; function getOwner(object: any): any; function setOwner(object: any, owner: any): void; - var testing: boolean; - var MODEL_FACTORY_INJECTIONS: boolean; + const testing: boolean; + const MODEL_FACTORY_INJECTIONS: boolean; function assign(original: any, ...sources: any[]): any; } import Em = Ember; - /** * External ambient module - to allow "import Ember from 'ember';" to work correctly */ diff --git a/env-to-object/index.d.ts b/env-to-object/index.d.ts index 1ec7a3c994..8bbca83f48 100644 --- a/env-to-object/index.d.ts +++ b/env-to-object/index.d.ts @@ -4,11 +4,11 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace env { - export interface Mappings { + interface Mappings { [enviromentVariableName: string]: Mapping; } - export type Mapping = IntegerMapping | BooleanMapping | GenericMapping; + type Mapping = IntegerMapping | BooleanMapping | GenericMapping; interface GenericMapping { keypath: string; @@ -26,14 +26,14 @@ declare namespace env { strict: boolean; } - export interface Parsers { + interface Parsers { [parserName: string]: (str: string, opts: any) => any; } - export interface Options { + interface Options { parsers: Parsers; } } -declare function env(map: env.Mappings, options?: env.Options): any; +declare function env(map: env.Mappings, options?: env.Options): any; export = env; diff --git a/expect/expect-tests.ts b/expect/expect-tests.ts index 3e08e0d747..c4312d1ada 100644 --- a/expect/expect-tests.ts +++ b/expect/expect-tests.ts @@ -1,4 +1,3 @@ - /// import {Expectation, Extension, Spy, createSpy, isSpy, assert, spyOn, extend, restoreSpies} from 'expect'; diff --git a/expect/index.d.ts b/expect/index.d.ts index 7b4e95e2b5..8e3422a4d9 100644 --- a/expect/index.d.ts +++ b/expect/index.d.ts @@ -4,11 +4,11 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace expect { - export type CompareValues = (a: T, b: T) => boolean; - export type Comparator = (target: {}, key: string) => boolean; - export type KeyType = string | number; + type CompareValues = (a: T, b: T) => boolean; + type Comparator = (target: {}, key: string) => boolean; + type KeyType = string | number; - export class Expectation { + class Expectation { constructor(actual: any); toExist(message?: string): Expectation; toBeTruthy(message?: string): Expectation; @@ -61,16 +61,16 @@ declare namespace expect { withArgs(...args: any[]): Expectation; } - export interface Extension { + interface Extension { [name: string]: (args?: any[]) => void; } - export interface Call { + interface Call { context: T; arguments: any[]; } - export interface Spy { + interface Spy { (...args: any[]): void; __isSpy: boolean; calls: Array>; @@ -84,14 +84,12 @@ declare namespace expect { reset(): void; } - - export function createSpy(fn?: (...args: any[]) => any, restore?: (...args: any[]) => any): Spy; - export function spyOn(object: T, methodName: string): Spy; - export function isSpy(object: {}): boolean; - export function restoreSpies(): void; - export function assert(condition: boolean, messageFormat: string, ...extraArgs: any[]): void; - export function extend(extension: Extension): void; - + function createSpy(fn?: (...args: any[]) => any, restore?: (...args: any[]) => any): Spy; + function spyOn(object: T, methodName: string): Spy; + function isSpy(object: {}): boolean; + function restoreSpies(): void; + function assert(condition: boolean, messageFormat: string, ...extraArgs: any[]): void; + function extend(extension: Extension): void; } declare function expect(actual: T): expect.Expectation; diff --git a/express-rate-limit/express-rate-limit-tests.ts b/express-rate-limit/express-rate-limit-tests.ts index 761a6d23f8..624a2da10d 100644 --- a/express-rate-limit/express-rate-limit-tests.ts +++ b/express-rate-limit/express-rate-limit-tests.ts @@ -1,12 +1,12 @@ import RateLimit = require("express-rate-limit"); -var apiLimiter = new RateLimit({ +const apiLimiter = new RateLimit({ windowMs: 15 * 60 * 1000, // 15 minutes max: 100, delayMs: 0 // disabled }); -var createAccountLimiter = new RateLimit({ +const createAccountLimiter = new RateLimit({ windowMs: 60 * 60 * 1000, // 1 hour window delayAfter: 1, // begin slowing down responses after the first request delayMs: 3 * 1000, // slow down subsequent responses by 3 seconds per request @@ -20,6 +20,6 @@ class SomeStore implements RateLimit.Store { resetKey(key: string) { }; }; -var limiterWithStore = new RateLimit({ +const limiterWithStore = new RateLimit({ store: new SomeStore() }); diff --git a/express-rate-limit/index.d.ts b/express-rate-limit/index.d.ts index 38ef8f8b29..ce09dbbf51 100644 --- a/express-rate-limit/index.d.ts +++ b/express-rate-limit/index.d.ts @@ -8,13 +8,13 @@ import express = require("express"); declare namespace RateLimit { type StoreIncrementCallback = (err?: {}, hits?: number) => void; - export interface Store { + interface Store { incr: (key: string, cb: StoreIncrementCallback) => void; resetAll: () => void; resetKey: (key: string) => void; } - export interface Options { + interface Options { delayAfter?: number; delayMs?: number; handlers?: () => any; @@ -29,9 +29,5 @@ declare namespace RateLimit { } } -interface RateLimitStatic { - new(options: RateLimit.Options): express.RequestHandler; -} - -declare var RateLimit: RateLimitStatic; +declare var RateLimit: new (options: RateLimit.Options) => express.RequestHandler; export = RateLimit; diff --git a/extract-zip/index.d.ts b/extract-zip/index.d.ts index 52ce40094f..9edd2fcb31 100644 --- a/extract-zip/index.d.ts +++ b/extract-zip/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace extract { - export interface Options { + interface Options { dir?: string; defaultDirMode?: number; defaultFileMode?: number; diff --git a/fabric/fabric-tests.ts b/fabric/fabric-tests.ts index 923b29d896..e94b676104 100644 --- a/fabric/fabric-tests.ts +++ b/fabric/fabric-tests.ts @@ -1,7 +1,7 @@ import * as fabric from "fabric"; function sample1() { - var canvas = new fabric.Canvas('c', { + const canvas = new fabric.Canvas('c', { hoverCursor: 'pointer', selection: false, }); @@ -13,7 +13,7 @@ function sample1() { e.target.opacity = 1; }); - for (var i = 0, len = 15; i < len; i++) { + for (let i = 0; i < 15; i++) { fabric.Image.fromURL('../assets/ladybug.png', img => { img.set({ left: fabric.util.getRandomInt(0, 600), @@ -33,17 +33,16 @@ function sample1() { } function sample2() { - - var dot: fabric.Circle, i: number, - t1: number, t2: number, - startTimer = () => { - t1 = new Date().getTime(); - return t1; - }, - stopTimer = () => { - t2 = new Date().getTime(); - return t2 - t1; - }, + let dot: fabric.Circle, i: number; + let t1: number, t2: number; + const startTimer = () => { + t1 = new Date().getTime(); + return t1; + }; + const stopTimer = () => { + t2 = new Date().getTime(); + return t2 - t1; + }, getRandomInt = fabric.util.getRandomInt, rainbow = ["#ffcc66", "#ccff66", "#66ccff", "#ff6fcf", "#ff6666"], rainbowEnd = rainbow.length - 1; @@ -51,7 +50,7 @@ function sample2() { // // Rendering canvas #1 // - var canvas1 = new fabric.Canvas('c1', { backgroundColor: "#000" }), + const canvas1 = new fabric.Canvas('c1', { backgroundColor: "#000" }), results1 = document.getElementById('results-c1'); startTimer(); @@ -66,11 +65,10 @@ function sample2() { } results1.innerHTML = 'Regular rendering of 100 elements in ' + stopTimer() + 'ms'; - // // Rendering canvas #2 // - var canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddRemove: false }), + const canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddRemove: false }), results2 = document.getElementById('results-c2'); startTimer(); @@ -88,35 +86,34 @@ function sample2() { } function sample3() { - - var $: (id: string) => HTMLElement = (id: string) => document.getElementById(id); + const $: (id: string) => HTMLElement = (id: string) => document.getElementById(id); function applyFilter(index: number, filter: any) { - var obj: fabric.Image = canvas.getActiveObject(); + const obj: fabric.Image = canvas.getActiveObject(); obj.filters[index] = filter; obj.applyFilters(canvas.renderAll.bind(canvas)); } function applyFilterValue(index: number, prop: string, value: any) { - var obj: fabric.Image = canvas.getActiveObject(); + const obj: fabric.Image = canvas.getActiveObject(); if (obj.filters[index]) { obj.applyFilters(canvas.renderAll.bind(canvas)); } } - var canvas = new fabric.Canvas('c', { backgroundImage: '../lib/bg.png' }), + const canvas = new fabric.Canvas('c', { backgroundImage: '../lib/bg.png' }), f = fabric.Image.filters; canvas.on({ 'object:selected': () => { fabric.util.toArray(document.getElementsByTagName('input')).forEach(el => { el.disabled = false; }); - var filters = ['grayscale', 'invert', 'remove-white', 'sepia', 'sepia2', 'brightness', + const filters = ['grayscale', 'invert', 'remove-white', 'sepia', 'sepia2', 'brightness', 'noise', 'gradient-transparency', 'pixelate', 'blur', 'sharpen']; - for (var i = 0; i < filters.length; i++) { - var checkBox = $(filters[i]); - var image = canvas.getActiveObject(); + for (let i = 0; i < filters.length; i++) { + const checkBox = $(filters[i]); + const image = canvas.getActiveObject(); checkBox.checked = !!image.filters[i]; } }, @@ -126,7 +123,7 @@ function sample3() { }); fabric.Image.fromURL('../assets/printio.png', img => { - var oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9); + const oImg = img.set({ left: 300, top: 300, angle: -15 }).scale(0.9); canvas.add(oImg).renderAll(); canvas.setActiveObject(oImg); }); @@ -211,11 +208,10 @@ function sample3() { } function sample4() { + const canvas = new fabric.Canvas('c'); + const $: (id: string) => HTMLElement = id => document.getElementById(id); - var canvas = new fabric.Canvas('c'); - var $: (id: string) => HTMLElement = id => document.getElementById(id); - - var rect = new fabric.Rect({ + const rect = new fabric.Rect({ width: 100, height: 100, top: 150, @@ -225,32 +221,31 @@ function sample4() { canvas.add(rect); - var angleControl = $('angle-control'); + const angleControl = $('angle-control'); angleControl.onchange = function(this: HTMLInputElement) { rect.setAngle(+this.value).setCoords(); canvas.renderAll(); }; - var scaleControl = $('scale-control'); + const scaleControl = $('scale-control'); scaleControl.onchange = function(this: HTMLInputElement) { rect.scale(+this.value).setCoords(); canvas.renderAll(); }; - var topControl = $('top-control'); + const topControl = $('top-control'); topControl.onchange = function(this: HTMLInputElement) { rect.setTop(+this.value).setCoords(); canvas.renderAll(); }; - var leftControl = $('left-control'); + const leftControl = $('left-control'); leftControl.onchange = function(this: HTMLInputElement) { rect.setLeft(+this.value).setCoords(); canvas.renderAll(); }; function updateControls() { - scaleControl.value = rect.getScaleX().toString(); angleControl.value = rect.getAngle().toString(); leftControl.value = rect.getLeft().toString(); @@ -263,7 +258,6 @@ function sample4() { }); } - declare module "fabric" { export interface CircleWithLineInfos extends Circle { line1?: Line; @@ -274,8 +268,8 @@ declare module "fabric" { } function sample5() { - var makeCircle = (left: number, top: number, line1?: fabric.Line, line2?: fabric.Line, line3?: fabric.Line, line4?: fabric.Line): fabric.Circle => { - var c = new fabric.Circle({ + const makeCircle = (left: number, top: number, line1?: fabric.Line, line2?: fabric.Line, line3?: fabric.Line, line4?: fabric.Line): fabric.Circle => { + const c = new fabric.Circle({ left, top, strokeWidth: 5, @@ -300,9 +294,9 @@ function sample5() { }); } - var canvas = new fabric.Canvas('c', { selection: false }); + const canvas = new fabric.Canvas('c', { selection: false }); - var line = makeLine([250, 125, 250, 175]), + const line = makeLine([250, 125, 250, 175]), line2 = makeLine([250, 175, 250, 250]), line3 = makeLine([250, 250, 300, 350]), line4 = makeLine([250, 250, 200, 350]), @@ -322,7 +316,7 @@ function sample5() { ); canvas.on('object:moving', e => { - var p = e.target; + const p = e.target; p.line1 && p.line1.set({ 'x2': p.left, 'y2': p.top }); p.line2 && p.line2.set({ 'x1': p.left, 'y1': p.top }); p.line3 && p.line3.set({ 'x1': p.left, 'y1': p.top }); @@ -332,9 +326,9 @@ function sample5() { } function sample6() { - var canvas = new fabric.Canvas('c'); + const canvas = new fabric.Canvas('c'); fabric.loadSVGFromURL('../assets/135.svg', objects => { - var obj = objects[0].scale(0.25); + const obj = objects[0].scale(0.25); canvas.centerObject(obj); canvas.add(obj); @@ -344,17 +338,15 @@ function sample6() { canvas.add(obj.clone(() => { }).set({ left: 480, top: 400, angle: 15 })); canvas.on('mouse:move', options => { - var p = canvas.getPointer(options.e); + const p = canvas.getPointer(options.e); canvas.forEachObject(obj => { - var distX = Math.abs(p.x - obj.left), + const distX = Math.abs(p.x - obj.left), distY = Math.abs(p.y - obj.top), dist = Math.round(Math.sqrt(Math.pow(distX, 2) + Math.pow(distY, 2))); obj.setOpacity(1 / (dist / 20)); }); - }); - }); } @@ -365,22 +357,20 @@ declare module "fabric" { } function sample7() { - - var canvas = new fabric.Canvas('c', { selection: false }); + const canvas = new fabric.Canvas('c', { selection: false }); setInterval(() => { fabric.Image.fromURL('../assets/ladybug.png', obj => { - var img = obj; + const img = obj; img.set('left', fabric.util.getRandomInt(200, 600)).set('top', -50); img.movingLeft = !!Math.round(Math.random()); canvas.add(img); }); }, 1000); - - var animate = (function animate() { + const animate = (function animate() { canvas.forEachObject(obj => { - var img = obj; + const img = obj; img.left += (img.movingLeft ? -1 : 1); img.top += 1; if (img.left > 900 || img.top > 500) { @@ -397,7 +387,6 @@ function sample7() { } function sample8() { - function pad(str: string, length: number): string { while (str.length < length) { str = '0' + str; @@ -405,7 +394,7 @@ function sample8() { return str; } - var getRandomInt = fabric.util.getRandomInt; + const getRandomInt = fabric.util.getRandomInt; function getRandomColor() { return ( @@ -423,18 +412,18 @@ function sample8() { (fabric.Object.prototype as any).cornersize = 30; } - var canvas = new fabric.Canvas('canvas'); + const canvas = new fabric.Canvas('canvas'); // canvas.controlsAboveOverlay = true; function updateComplexity() { setTimeout(() => { - var element = document.getElementById('complexity').childNodes[1]; + const element = document.getElementById('complexity').childNodes[1]; element.innerHTML = ' ' + canvas.complexity(); }, 100); } document.getElementById('commands').onclick = (ev: any) => { - var ev: any = ev || window.event; + ev = ev || window.event; if (ev.preventDefault) { ev.preventDefault(); @@ -442,12 +431,12 @@ function sample8() { ev.returnValue = false; } - var element: any = ev.target || ev.srcElement; + let element: any = ev.target || ev.srcElement; if (element.nodeName.toLowerCase() === 'strong') { element = element.parentNode; } - var className = element.className, + const className = element.className, offset = 50, left = fabric.util.getRandomInt(0 + offset, 700 - offset), top = fabric.util.getRandomInt(0 + offset, 500 - offset), @@ -455,7 +444,6 @@ function sample8() { width = fabric.util.getRandomInt(30, 50), opacity = ((min: number, max: number) => Math.random() * (max - min) + min)(0.5, 1); - switch (className) { case 'rect': canvas.add(new fabric.Rect({ @@ -519,11 +507,11 @@ function sample8() { break; case 'shape': - var id: any = element.id; + const id: any = element.id; const match = /\d+$/.exec(id); if (match) { fabric.loadSVGFromURL('../assets/' + match[0] + '.svg', (objects, options) => { - var loadedObject = fabric.util.groupSVGElements(objects, options); + const loadedObject = fabric.util.groupSVGElements(objects, options); loadedObject.set({ left, @@ -552,13 +540,12 @@ function sample8() { }; document.getElementById('execute').onclick = () => { - var code = ( document.getElementById('canvas-console')).value; + const code = ( document.getElementById('canvas-console')).value; if (!(/^\s+$/).test(code)) { eval(code); // tslint:disable-line:no-eval } }; - document.getElementById('rasterize').onclick = () => { if (!fabric.Canvas.supports('toDataURL')) { alert('This browser doesn\'t provide means to serialize canvas to an image'); @@ -567,14 +554,14 @@ function sample8() { } }; - var removeSelectedEl = document.getElementById('remove-selected'); + const removeSelectedEl = document.getElementById('remove-selected'); removeSelectedEl.onclick = () => { - var activeObject = canvas.getActiveObject(), + const activeObject = canvas.getActiveObject(), activeGroup = canvas.getActiveGroup(); if (activeObject) { canvas.remove(activeObject); } else if (activeGroup) { - var objectsInGroup = activeGroup.getObjects(); + const objectsInGroup = activeGroup.getObjects(); canvas.discardActiveGroup(); objectsInGroup.forEach(object => { canvas.remove(object); @@ -582,9 +569,9 @@ function sample8() { } }; - var supportsInputOfType = (type: string) => { + const supportsInputOfType = (type: string) => { return () => { - var el = document.createElement('input'); + const el = document.createElement('input'); try { el.type = type; } catch (err) { } @@ -592,18 +579,18 @@ function sample8() { }; }; - var supportsSlider = supportsInputOfType('range'), + const supportsSlider = supportsInputOfType('range'), supportsColorpicker = supportsInputOfType('color'); if (supportsSlider()) { (() => { - var controls = document.getElementById('controls'); + const controls = document.getElementById('controls'); - var sliderLabel = document.createElement('label'); + const sliderLabel = document.createElement('label'); sliderLabel.htmlFor = 'opacity'; sliderLabel.innerHTML = 'Opacity: '; - var slider = document.createElement('input'); + const slider = document.createElement('input'); try { slider.type = 'range'; } catch (err) { } @@ -616,7 +603,7 @@ function sample8() { canvas.calcOffset(); slider.onchange = function() { - var activeObject = canvas.getActiveObject(), + const activeObject = canvas.getActiveObject(), activeGroup = canvas.getActiveGroup(); if (activeObject || activeGroup) { @@ -629,14 +616,14 @@ function sample8() { if (supportsColorpicker()) { (() => { - var controls = document.getElementById('controls'); + const controls = document.getElementById('controls'); - var label = document.createElement('label'); + const label = document.createElement('label'); label.htmlFor = 'color'; label.innerHTML = 'Color: '; label.style.marginLeft = '10px'; - var colorpicker = document.createElement('input'); + const colorpicker = document.createElement('input'); colorpicker.type = 'color'; colorpicker.id = 'color'; colorpicker.style.width = '40px'; @@ -647,7 +634,7 @@ function sample8() { canvas.calcOffset(); colorpicker.onchange = function() { - var activeObject = canvas.getActiveObject(), + const activeObject = canvas.getActiveObject(), activeGroup = canvas.getActiveGroup(); if (activeObject || activeGroup) { @@ -658,9 +645,9 @@ function sample8() { })(); } - var lockHorizontallyEl = document.getElementById('lock-horizontally'); + const lockHorizontallyEl = document.getElementById('lock-horizontally'); lockHorizontallyEl.onclick = () => { - var activeObject: any = canvas.getActiveObject(); + const activeObject: any = canvas.getActiveObject(); if (activeObject) { activeObject.lockMovementX = !activeObject.lockMovementX; lockHorizontallyEl.innerHTML = activeObject.lockMovementX @@ -669,9 +656,9 @@ function sample8() { } }; - var lockVerticallyEl = document.getElementById('lock-vertically'); + const lockVerticallyEl = document.getElementById('lock-vertically'); lockVerticallyEl.onclick = () => { - var activeObject: any = canvas.getActiveObject(); + const activeObject: any = canvas.getActiveObject(); if (activeObject) { activeObject.lockMovementY = !activeObject.lockMovementY; lockVerticallyEl.innerHTML = activeObject.lockMovementY @@ -680,9 +667,9 @@ function sample8() { } }; - var lockScalingXEl = document.getElementById('lock-scaling-x'); + const lockScalingXEl = document.getElementById('lock-scaling-x'); lockScalingXEl.onclick = () => { - var activeObject: any = canvas.getActiveObject(); + const activeObject: any = canvas.getActiveObject(); if (activeObject) { activeObject.lockScalingX = !activeObject.lockScalingX; lockScalingXEl.innerHTML = activeObject.lockScalingX @@ -691,9 +678,9 @@ function sample8() { } }; - var lockScalingYEl = document.getElementById('lock-scaling-y'); + const lockScalingYEl = document.getElementById('lock-scaling-y'); lockScalingYEl.onclick = () => { - var activeObject: any = canvas.getActiveObject(); + const activeObject: any = canvas.getActiveObject(); if (activeObject) { activeObject.lockScalingY = !activeObject.lockScalingY; lockScalingYEl.innerHTML = activeObject.lockScalingY @@ -702,9 +689,9 @@ function sample8() { } }; - var lockRotationEl = document.getElementById('lock-rotation'); + const lockRotationEl = document.getElementById('lock-rotation'); lockRotationEl.onclick = () => { - var activeObject: any = canvas.getActiveObject(); + const activeObject: any = canvas.getActiveObject(); if (activeObject) { activeObject.lockRotation = !activeObject.lockRotation; lockRotationEl.innerHTML = activeObject.lockRotation @@ -713,9 +700,9 @@ function sample8() { } }; - var gradientifyBtn = document.getElementById('gradientify'); + const gradientifyBtn = document.getElementById('gradientify'); - var activeObjectButtons = [ + const activeObjectButtons = [ lockHorizontallyEl, lockVerticallyEl, lockScalingXEl, @@ -725,16 +712,16 @@ function sample8() { gradientifyBtn ]; - var opacityEl = document.getElementById('opacity'); + const opacityEl = document.getElementById('opacity'); if (opacityEl) { activeObjectButtons.push(opacityEl); } - var colorEl = document.getElementById('color'); + const colorEl = document.getElementById('color'); if (colorEl) { activeObjectButtons.push(colorEl); } - for (var i = activeObjectButtons.length; i--; ) { + for (let i = activeObjectButtons.length; i--; ) { activeObjectButtons[i]; } @@ -742,9 +729,9 @@ function sample8() { canvas.on('group:selected', onObjectSelected); function onObjectSelected(e: fabric.IEvent) { - var selectedObject = e.target; + const selectedObject = e.target; - for (var i = activeObjectButtons.length; i--; ) { + for (let i = activeObjectButtons.length; i--; ) { activeObjectButtons[i]; } @@ -756,18 +743,18 @@ function sample8() { } canvas.on('selection:cleared', e => { - for (var i = activeObjectButtons.length; i--; ) { + for (let i = activeObjectButtons.length; i--; ) { activeObjectButtons[i]; } }); - var drawingModeEl = document.getElementById('drawing-mode'), + const drawingModeEl = document.getElementById('drawing-mode'), drawingOptionsEl = document.getElementById('drawing-mode-options'), drawingColorEl = document.getElementById('drawing-color'), drawingLineWidthEl = document.getElementById('drawing-line-width'); drawingModeEl.onclick = () => { - var canvasWithDrawingMode: any = canvas; + const canvasWithDrawingMode: any = canvas; canvasWithDrawingMode.isDrawingMode = !canvasWithDrawingMode.isDrawingMode; if (canvasWithDrawingMode.isDrawingMode) { drawingModeEl.innerHTML = 'Cancel drawing mode'; @@ -794,12 +781,11 @@ function sample8() { canvas.freeDrawingColor = drawingColorEl.value; canvas.freeDrawingLineWidth = parseInt(drawingLineWidthEl.value, 10) || 1; - - var text = 'Lorem ipsum dolor sit amet,\nconsectetur adipisicing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore magna aliqua.\n' + + const text = 'Lorem ipsum dolor sit amet,\nconsectetur adipisicing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore magna aliqua.\n' + 'Ut enim ad minim veniam,\nquis nostrud exercitation ullamco\nlaboris nisi ut aliquip ex ea commodo consequat.'; document.getElementById('add-text').onclick = () => { - var textSample = new fabric.Text(text.slice(0, getRandomInt(0, text.length)), { + const textSample = new fabric.Text(text.slice(0, getRandomInt(0, text.length)), { left: getRandomInt(350, 400), top: getRandomInt(350, 400), fontFamily: 'helvetica', @@ -813,13 +799,12 @@ function sample8() { updateComplexity(); }; - document.onkeydown = e => { - var obj = canvas.getActiveObject() || canvas.getActiveGroup(); + const obj = canvas.getActiveObject() || canvas.getActiveGroup(); if (obj && e.keyCode === 8) { // this is horrible. need to fix, so that unified interface can be used if (obj.type === 'group') { - // var groupObjects = obj.getObjects(); + // const groupObjects = obj.getObjects(); // canvas.discardActiveGroup(); // groupObjects.forEach(function(obj) { // canvas.remove(obj); @@ -842,7 +827,7 @@ function sample8() { } gradientifyBtn.onclick = () => { - var obj = canvas.getActiveObject(); + const obj = canvas.getActiveObject(); if (obj) { obj.setGradient("fill", { x2: (getRandomInt(0, 1) ? 0 : obj.width), @@ -856,17 +841,17 @@ function sample8() { } }; - var textEl = document.getElementById('text'); + const textEl = document.getElementById('text'); if (textEl) { textEl.onfocus = function() { - var activeObject = canvas.getActiveObject(); + const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { this.value = ( activeObject).text; } }; textEl.onkeyup = function(e) { - var activeObject = canvas.getActiveObject(); + const activeObject = canvas.getActiveObject(); if (activeObject) { if (!this.value) { canvas.discardActiveObject(); @@ -878,11 +863,11 @@ function sample8() { }; } - var cmdUnderlineBtn = document.getElementById('text-cmd-underline'); + const cmdUnderlineBtn = document.getElementById('text-cmd-underline'); if (cmdUnderlineBtn) { activeObjectButtons.push(cmdUnderlineBtn); cmdUnderlineBtn.onclick = function() { - var activeObject = canvas.getActiveObject(); + const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { activeObject.textDecoration = (activeObject.textDecoration === 'underline' ? '' : 'underline'); this.className = activeObject.textDecoration ? 'selected' : ''; @@ -891,11 +876,11 @@ function sample8() { }; } - var cmdLinethroughBtn = document.getElementById('text-cmd-linethrough'); + const cmdLinethroughBtn = document.getElementById('text-cmd-linethrough'); if (cmdLinethroughBtn) { activeObjectButtons.push(cmdLinethroughBtn); cmdLinethroughBtn.onclick = function() { - var activeObject = canvas.getActiveObject(); + const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { activeObject.textDecoration = (activeObject.textDecoration === 'line-through' ? '' : 'line-through'); this.className = activeObject.textDecoration ? 'selected' : ''; @@ -904,11 +889,11 @@ function sample8() { }; } - var cmdOverlineBtn = document.getElementById('text-cmd-overline'); + const cmdOverlineBtn = document.getElementById('text-cmd-overline'); if (cmdOverlineBtn) { activeObjectButtons.push(cmdOverlineBtn); cmdOverlineBtn.onclick = function() { - var activeObject = canvas.getActiveObject(); + const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { activeObject.textDecoration = (activeObject.textDecoration === 'overline' ? '' : 'overline'); this.className = activeObject.textDecoration ? 'selected' : ''; @@ -917,11 +902,11 @@ function sample8() { }; } - var cmdBoldBtn = document.getElementById('text-cmd-bold'); + const cmdBoldBtn = document.getElementById('text-cmd-bold'); if (cmdBoldBtn) { activeObjectButtons.push(cmdBoldBtn); cmdBoldBtn.onclick = function() { - var activeObject = canvas.getActiveObject(); + const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { activeObject.fontWeight = (activeObject.fontWeight === 'bold' ? '' : 'bold'); this.className = activeObject.fontWeight ? 'selected' : ''; @@ -930,11 +915,11 @@ function sample8() { }; } - var cmdItalicBtn = document.getElementById('text-cmd-italic'); + const cmdItalicBtn = document.getElementById('text-cmd-italic'); if (cmdItalicBtn) { activeObjectButtons.push(cmdItalicBtn); cmdItalicBtn.onclick = function() { - var activeObject = canvas.getActiveObject(); + const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { activeObject.fontStyle = (activeObject.fontStyle === 'italic' ? '' : 'italic'); this.className = activeObject.fontStyle ? 'selected' : ''; @@ -943,11 +928,11 @@ function sample8() { }; } - var cmdShadowBtn = document.getElementById('text-cmd-shadow'); + const cmdShadowBtn = document.getElementById('text-cmd-shadow'); if (cmdShadowBtn) { activeObjectButtons.push(cmdShadowBtn); cmdShadowBtn.onclick = function() { - var activeObject = canvas.getActiveObject(); + const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { activeObject.shadow = !activeObject.shadow ? 'rgba(0,0,0,0.2) 2px 2px 10px' : ''; this.className = activeObject.shadow ? 'selected' : ''; @@ -956,11 +941,11 @@ function sample8() { }; } - var textAlignSwitch = document.getElementById('text-align'); + const textAlignSwitch = document.getElementById('text-align'); if (textAlignSwitch) { activeObjectButtons.push(textAlignSwitch); textAlignSwitch.onchange = function(this: HTMLInputElement) { - var activeObject = canvas.getActiveObject(); + const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { activeObject.textAlign = this.value.toLowerCase(); canvas.renderAll(); @@ -968,11 +953,11 @@ function sample8() { }; } - var fontFamilySwitch = document.getElementById('font-family'); + const fontFamilySwitch = document.getElementById('font-family'); if (fontFamilySwitch) { activeObjectButtons.push(fontFamilySwitch); fontFamilySwitch.onchange = function(this: HTMLInputElement) { - var activeObject = canvas.getActiveObject(); + const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { activeObject.fontFamily = this.value; canvas.renderAll(); @@ -980,10 +965,10 @@ function sample8() { }; } - var bgColorField = document.getElementById('text-bg-color'); + const bgColorField = document.getElementById('text-bg-color'); if (bgColorField) { bgColorField.onchange = function(this: HTMLInputElement) { - var activeObject = canvas.getActiveObject(); + const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { activeObject.backgroundColor = this.value; canvas.renderAll(); @@ -991,10 +976,10 @@ function sample8() { }; } - var strokeColorField = document.getElementById('text-stroke-color'); + const strokeColorField = document.getElementById('text-stroke-color'); if (strokeColorField) { strokeColorField.onchange = function(this: HTMLInputElement) { - var activeObject = canvas.getActiveObject(); + const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { activeObject.stroke = this.value; canvas.renderAll(); @@ -1004,9 +989,9 @@ function sample8() { if (supportsSlider) { (() => { - var container = document.getElementById('text-controls'); - var slider = document.createElement('input'); - var label = document.createElement('label'); + const container = document.getElementById('text-controls'); + const slider = document.createElement('input'); + const label = document.createElement('label'); label.innerHTML = 'Line height: '; try { slider.type = 'range'; } catch (err) { } slider.min = "0"; @@ -1017,7 +1002,7 @@ function sample8() { label.appendChild(slider); slider.title = "Line height"; slider.onchange = function() { - var activeObject = canvas.getActiveObject(); + const activeObject = canvas.getActiveObject(); if (activeObject && activeObject.type === 'text') { activeObject.lineHeight = +this.value; canvas.renderAll(); @@ -1031,9 +1016,9 @@ function sample8() { } document.getElementById('load-svg').onclick = () => { - var svg = ( document.getElementById('svg-console')).value; + const svg = ( document.getElementById('svg-console')).value; fabric.loadSVGFromString(svg, (objects, options) => { - var obj = fabric.util.groupSVGElements(objects, options); + const obj = fabric.util.groupSVGElements(objects, options); canvas.add(obj).centerObject(obj).renderAll(); obj.setCoords(); }); @@ -1041,7 +1026,7 @@ function sample8() { } function sample9() { - var canvas = new fabric.Canvas('c'); + const canvas = new fabric.Canvas('c'); canvas.setBackgroundImage('yolo.jpg', () => { "a"; }, { opacity: 45 }); canvas.setBackgroundImage('yolo.jpg', () => { "a"; }); } diff --git a/fabric/index.d.ts b/fabric/index.d.ts index 881be190bd..27a4188f52 100644 --- a/fabric/index.d.ts +++ b/fabric/index.d.ts @@ -5,8 +5,8 @@ export as namespace fabric; -export var isLikelyNode: boolean; -export var isTouchSupported: boolean; +export const isLikelyNode: boolean; +export const isTouchSupported: boolean; ///////////////////////////////////////////////////////////// // farbic Functions @@ -1289,7 +1289,6 @@ export class StaticCanvas { */ fxStraightenObject(object: Object): StaticCanvas - static EMPTY_JSON: string; /** * Provides a way to check support of some of the canvas methods @@ -2997,8 +2996,8 @@ interface IRectOptions extends IObjectOptions { * Vertical border radius */ ry?: number; - } + export interface Rect extends IRectOptions {} export class Rect extends Object { /** @@ -3950,8 +3949,8 @@ export class BaseBrush { * @param {Object|String} [options] Options object or string (e.g. "2px 2px 10px rgba(0,0,0,0.2)") */ setShadow(options: string|any): BaseBrush; - } + export class CircleBrush extends BaseBrush { /** * Width of a brush @@ -3969,6 +3968,7 @@ export class CircleBrush extends BaseBrush { */ addPoint(pointer: any): Point } + export class SprayBrush extends BaseBrush { /** * Width of a brush @@ -4147,7 +4147,6 @@ interface IUtilArc { * @param {Number} y3 */ getBoundsOfCurve(x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): Point[]; - } interface IUtilDomEvent { @@ -4298,7 +4297,6 @@ interface IUtilClass { * (be careful modifying objects defined here as this would affect all instances) */ createClass(properties?: any): void; - } interface IUtilObject { @@ -4517,7 +4515,7 @@ interface IUtilMisc { isTransparent(ctx: CanvasRenderingContext2D, x: number, y: number, tolerance: number): boolean; } -export var util: IUtil; +export const util: IUtil; interface IUtil extends IUtilAnimation, IUtilArc, IObservable, IUtilDomEvent, IUtilDomMisc, IUtilDomRequest, IUtilDomStyle, IUtilClass, IUtilMisc { ease: IUtilAnimEase; diff --git a/fetch.io/fetch.io-tests.ts b/fetch.io/fetch.io-tests.ts index 4e14a7a9a9..538da8e74b 100644 --- a/fetch.io/fetch.io-tests.ts +++ b/fetch.io/fetch.io-tests.ts @@ -1,60 +1,59 @@ +import Fetch from 'fetch.io'; -import Fetch from 'fetch.io' - -const request = new Fetch() +const request = new Fetch(); request .get('') .query({}) - .json() + .json(); request .delete('') - .json() + .json(); request .head('') - .json() + .json(); request .options('') - .json() + .json(); request .put('') - .json() + .json(); request .config('key', 'value') - .json() + .json(); request .config({key: 'value'}) - .json() + .json(); request .config('set', 'value') - .json() + .json(); request .set({key: 'value'}) - .json() + .json(); request .type('json') - .json() + .json(); request .get('') .query({}) - .text() + .text(); request .get('') .query({}) - .then(() => {}) + .then(() => {}); request .post('') .send({}) - .json() + .json(); diff --git a/fullcalendar/fullcalendar-tests.ts b/fullcalendar/fullcalendar-tests.ts index 63328a9cef..4557a94eef 100644 --- a/fullcalendar/fullcalendar-tests.ts +++ b/fullcalendar/fullcalendar-tests.ts @@ -33,7 +33,6 @@ $('#calendar').fullCalendar({ $('#calendar').fullCalendar({ eventSources: [ - // source with no options "http://www.google.com/your_feed_url1/", @@ -84,15 +83,14 @@ $('#calendar').fullCalendar({ dragOpacity: .5 }); -var view = $('#calendar').fullCalendar('getView'); +const view = $('#calendar').fullCalendar('getView'); alert("The view's title is " + view.title); $(document).ready(() => { - - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); + const date = new Date(); + const d = date.getDate(); + const m = date.getMonth(); + const y = date.getFullYear(); $('#calendar').fullCalendar({ header: { @@ -148,15 +146,13 @@ $(document).ready(() => { } ] }); - }); $(document).ready(() => { - - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); + const date = new Date(); + const d = date.getDate(); + const m = date.getMonth(); + const y = date.getFullYear(); $('#calendar').fullCalendar({ header: { @@ -213,15 +209,13 @@ $(document).ready(() => { } ] }); - }); $(document).ready(() => { - - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); + const date = new Date(); + const d = date.getDate(); + const m = date.getMonth(); + const y = date.getFullYear(); $('#calendar').fullCalendar({ header: { @@ -267,15 +261,13 @@ $(document).ready(() => { } ] }); - }); $(document).ready(() => { - - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); + const date = new Date(); + const d = date.getDate(); + const m = date.getMonth(); + const y = date.getFullYear(); $('#calendar').fullCalendar({ editable: true, @@ -332,15 +324,13 @@ $(document).ready(() => { } ] }); - }); $(document).ready(() => { - - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); + const date = new Date(); + const d = date.getDate(); + const m = date.getMonth(); + const y = date.getFullYear(); $('#calendar').fullCalendar({ header: { @@ -386,7 +376,6 @@ $(document).ready(() => { } ] }); - }); $('#my-prev-button').click(() => { @@ -404,7 +393,7 @@ $('#my-today-button').click(() => { $('#calendar').fullCalendar('gotoDate', 1, 0, 1); $('#my-button').click(() => { - var d = $('#calendar').fullCalendar('getDate'); + const d = $('#calendar').fullCalendar('getDate'); alert("The current date of the calendar is " + d); }); @@ -429,7 +418,6 @@ $('#calendar').fullCalendar({ $('#calendar').fullCalendar({ dayClick(date, allDay, jsEvent, view) { - if (allDay) { alert('Clicked on the entire day: ' + date); } else { @@ -442,20 +430,17 @@ $('#calendar').fullCalendar({ // change the day's background color just for fun $(this).css('background-color', 'red'); - } }); $('#calendar').fullCalendar({ eventClick(calEvent, jsEvent, view) { - alert('Event: ' + calEvent.title); alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY); alert('View: ' + view.name); // change the border color just for fun $(this).css('border-color', 'red'); - } }); @@ -477,9 +462,7 @@ $('#calendar').fullCalendar({ }); $('#calendar').fullCalendar({ - eventSources: [ - // your event source { url: '/myfeed.php', @@ -496,13 +479,10 @@ $('#calendar').fullCalendar({ } // any other sources... - ] - }); $('#calendar').fullCalendar({ - events: { url: '/myfeed.php', type: 'POST', @@ -516,22 +496,17 @@ $('#calendar').fullCalendar({ color: 'yellow', // a non-ajax option textColor: 'black' // a non-ajax option } - }); $('#calendar').fullCalendar({ - events: { url: '/myfeed.php', cache: true } - }); $('#calendar').fullCalendar({ - eventSources: [ - // your event source { url: '/myfeed.php', // use the `url` property @@ -540,9 +515,7 @@ $('#calendar').fullCalendar({ } // any other sources... - ] - }); $('#calendar').fullCalendar({ @@ -569,9 +542,7 @@ $('#calendar').fullCalendar({ }); $('#calendar').fullCalendar({ - eventSources: [ - // your event source { events: [ // put the array in the `events` property @@ -594,9 +565,7 @@ $('#calendar').fullCalendar({ } // any other event sources... - ] - }); $('#calendar').fullCalendar({ @@ -610,7 +579,7 @@ $('#calendar').fullCalendar({ end: Math.round(end.toDate().getTime() / 1000) }, success(doc) { - var events: any[] = []; + const events: any[] = []; $(doc).find('event').each(() => { events.push({ title: $(this).attr('title'), @@ -624,9 +593,7 @@ $('#calendar').fullCalendar({ }); $('#calendar').fullCalendar({ - eventSources: [ - // your event source { events(start: moment.Moment, end: moment.Moment, timezone: string | boolean, callback: (events: FullCalendar.EventObject[]) => void) { @@ -635,11 +602,8 @@ $('#calendar').fullCalendar({ color: 'yellow', // an option! textColor: 'black' // an option! } - // any other sources... - ] - }); $('#calendar').fullCalendar({ @@ -651,11 +615,9 @@ $('#calendar').fullCalendar({ $('#calendar').fullCalendar({ eventClick(event, element) { - event.title = "CLICKED!"; $('#calendar').fullCalendar('updateEvent', event); - } }); @@ -712,11 +674,10 @@ $('#draggable1').draggable(); $('#draggable2').draggable(); $(document).ready(() => { - - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); + const date = new Date(); + const d = date.getDate(); + const m = date.getMonth(); + const y = date.getFullYear(); $('#calendar').fullCalendar({ theme: true, @@ -773,17 +734,15 @@ $(document).ready(() => { } ] }); - }); $(document).ready(() => { /* initialize the external events -----------------------------------------------------------------*/ $('#external-events div.external-event').each(() => { - // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/) // it doesn't need to have a start or end - var eventObject = { + const eventObject = { title: $.trim($(this).text()) // use the element's text as the event title }; @@ -796,7 +755,6 @@ $(document).ready(() => { revert: true, // will cause the event to go back to its revertDuration: 0 // original position after the drag }); - }); /* initialize the calendar -----------------------------------------------------------------*/ @@ -812,10 +770,10 @@ $(document).ready(() => { drop(date, allDay) { // this function is called when something is dropped // retrieve the dropped element's stored Event Object - var originalEventObject = $(this).data('eventObject'); + const originalEventObject = $(this).data('eventObject'); // we need to copy it, so that multiple events don't have a reference to the same object - var copiedEventObject: any = $.extend({}, originalEventObject); + const copiedEventObject: any = $.extend({}, originalEventObject); // assign it the date that was reported copiedEventObject.start = date; @@ -835,10 +793,10 @@ $(document).ready(() => { }); $(document).ready(() => { - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); + const date = new Date(); + const d = date.getDate(); + const m = date.getMonth(); + const y = date.getFullYear(); $('#calendar').fullCalendar({ theme: true, diff --git a/fullcalendar/v1/fullcalendar-tests.ts b/fullcalendar/v1/fullcalendar-tests.ts index ede55bc0b1..c2c0da1948 100644 --- a/fullcalendar/v1/fullcalendar-tests.ts +++ b/fullcalendar/v1/fullcalendar-tests.ts @@ -30,7 +30,6 @@ $('#calendar').fullCalendar({ $('#calendar').fullCalendar({ eventSources: [ - // source with no options "http://www.google.com/your_feed_url1/", @@ -81,15 +80,14 @@ $('#calendar').fullCalendar({ dragOpacity: .5 }); -var view = $('#calendar').fullCalendar('getView'); +const view = $('#calendar').fullCalendar('getView'); alert("The view's title is " + view.title); $(document).ready(() => { - - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); + const date = new Date(); + const d = date.getDate(); + const m = date.getMonth(); + const y = date.getFullYear(); $('#calendar').fullCalendar({ header: { @@ -145,15 +143,13 @@ $(document).ready(() => { } ] }); - }); $(document).ready(() => { - - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); + const date = new Date(); + const d = date.getDate(); + const m = date.getMonth(); + const y = date.getFullYear(); $('#calendar').fullCalendar({ header: { @@ -210,15 +206,13 @@ $(document).ready(() => { } ] }); - }); $(document).ready(() => { - - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); + const date = new Date(); + const d = date.getDate(); + const m = date.getMonth(); + const y = date.getFullYear(); $('#calendar').fullCalendar({ header: { @@ -264,15 +258,13 @@ $(document).ready(() => { } ] }); - }); $(document).ready(() => { - - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); + const date = new Date(); + const d = date.getDate(); + const m = date.getMonth(); + const y = date.getFullYear(); $('#calendar').fullCalendar({ editable: true, @@ -329,15 +321,13 @@ $(document).ready(() => { } ] }); - }); $(document).ready(() => { - - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); + const date = new Date(); + const d = date.getDate(); + const m = date.getMonth(); + const y = date.getFullYear(); $('#calendar').fullCalendar({ header: { @@ -383,7 +373,6 @@ $(document).ready(() => { } ] }); - }); $('#my-prev-button').click(() => { @@ -401,7 +390,7 @@ $('#my-today-button').click(() => { $('#calendar').fullCalendar('gotoDate', 1, 0, 1); $('#my-button').click(() => { - var d = $('#calendar').fullCalendar('getDate'); + const d = $('#calendar').fullCalendar('getDate'); alert("The current date of the calendar is " + d); }); @@ -426,7 +415,6 @@ $('#calendar').fullCalendar({ $('#calendar').fullCalendar({ dayClick(date, allDay, jsEvent, view) { - if (allDay) { alert('Clicked on the entire day: ' + date); } else { @@ -439,20 +427,17 @@ $('#calendar').fullCalendar({ // change the day's background color just for fun $(this).css('background-color', 'red'); - } }); $('#calendar').fullCalendar({ eventClick(calEvent, jsEvent, view) { - alert('Event: ' + calEvent.title); alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY); alert('View: ' + view.name); // change the border color just for fun $(this).css('border-color', 'red'); - } }); @@ -474,9 +459,7 @@ $('#calendar').fullCalendar({ }); $('#calendar').fullCalendar({ - eventSources: [ - // your event source { url: '/myfeed.php', @@ -493,13 +476,10 @@ $('#calendar').fullCalendar({ } // any other sources... - ] - }); $('#calendar').fullCalendar({ - events: { url: '/myfeed.php', type: 'POST', @@ -513,22 +493,17 @@ $('#calendar').fullCalendar({ color: 'yellow', // a non-ajax option textColor: 'black' // a non-ajax option } - }); $('#calendar').fullCalendar({ - events: { url: '/myfeed.php', cache: true } - }); $('#calendar').fullCalendar({ - eventSources: [ - // your event source { url: '/myfeed.php', // use the `url` property @@ -537,9 +512,7 @@ $('#calendar').fullCalendar({ } // any other sources... - ] - }); $('#calendar').fullCalendar({ @@ -566,9 +539,7 @@ $('#calendar').fullCalendar({ }); $('#calendar').fullCalendar({ - eventSources: [ - // your event source { events: [ // put the array in the `events` property @@ -591,9 +562,7 @@ $('#calendar').fullCalendar({ } // any other event sources... - ] - }); $('#calendar').fullCalendar({ @@ -607,7 +576,7 @@ $('#calendar').fullCalendar({ end: Math.round(end.getTime() / 1000) }, success(doc) { - var events: any[] = []; + const events: any[] = []; $(doc).find('event').each(() => { events.push({ title: $(this).attr('title'), @@ -621,9 +590,7 @@ $('#calendar').fullCalendar({ }); $('#calendar').fullCalendar({ - eventSources: [ - // your event source { events(start: any, end: any, callback: any) { @@ -634,9 +601,7 @@ $('#calendar').fullCalendar({ } // any other sources... - ] - }); $('#calendar').fullCalendar({ @@ -648,11 +613,9 @@ $('#calendar').fullCalendar({ $('#calendar').fullCalendar({ eventClick(event, element) { - event.title = "CLICKED!"; $('#calendar').fullCalendar('updateEvent', event); - } }); @@ -709,11 +672,10 @@ $('#draggable1').draggable(); $('#draggable2').draggable(); $(document).ready(() => { - - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); + const date = new Date(); + const d = date.getDate(); + const m = date.getMonth(); + const y = date.getFullYear(); $('#calendar').fullCalendar({ theme: true, @@ -770,17 +732,15 @@ $(document).ready(() => { } ] }); - }); $(document).ready(() => { /* initialize the external events -----------------------------------------------------------------*/ $('#external-events div.external-event').each(() => { - // create an Event Object (http://arshaw.com/fullcalendar/docs/event_data/Event_Object/) // it doesn't need to have a start or end - var eventObject = { + const eventObject = { title: $.trim($(this).text()) // use the element's text as the event title }; @@ -793,7 +753,6 @@ $(document).ready(() => { revert: true, // will cause the event to go back to its revertDuration: 0 // original position after the drag }); - }); /* initialize the calendar -----------------------------------------------------------------*/ @@ -809,10 +768,10 @@ $(document).ready(() => { drop(date, allDay) { // this function is called when something is dropped // retrieve the dropped element's stored Event Object - var originalEventObject = $(this).data('eventObject'); + const originalEventObject = $(this).data('eventObject'); // we need to copy it, so that multiple events don't have a reference to the same object - var copiedEventObject: any = $.extend({}, originalEventObject); + const copiedEventObject: any = $.extend({}, originalEventObject); // assign it the date that was reported copiedEventObject.start = date; diff --git a/fullcalendar/v1/index.d.ts b/fullcalendar/v1/index.d.ts index 9f521ca8fc..4fcb41731b 100644 --- a/fullcalendar/v1/index.d.ts +++ b/fullcalendar/v1/index.d.ts @@ -8,8 +8,7 @@ import * as moment from "moment"; declare global { namespace FullCalendar { - export interface Calendar { - + interface Calendar { /** * Formats a Date object into a string. */ @@ -36,22 +35,21 @@ declare global { version: string; } - export interface BusinessHours { + interface BusinessHours { start: moment.Duration; end: moment.Duration; dow: number[]; } - export interface Timespan { + interface Timespan { start: moment.Moment; end: moment.Moment; } - export interface Options extends AgendaOptions, EventDraggingResizingOptions, DroppingExternalElementsOptions, SelectionOptions { - + interface Options extends AgendaOptions, EventDraggingResizingOptions, DroppingExternalElementsOptions, SelectionOptions { // General display - http://arshaw.com/fullcalendar/docs/display/ - header?: { + header?: { left: string; center: string; right: string; @@ -152,11 +150,9 @@ declare global { eventAfterRender?: (event: EventObject, element: HTMLDivElement, view: ViewObject) => void; eventAfterAllRender?: (view: ViewObject) => void; eventDestroy?: (event: EventObject, element: JQuery, view: ViewObject) => void; - - } - export interface ViewOptionHash { + interface ViewOptionHash { month?: any; week?: any; day?: any; @@ -172,7 +168,7 @@ declare global { /** * Agenda Options - http://arshaw.com/fullcalendar/docs/agenda/ */ - export interface AgendaOptions { + interface AgendaOptions { allDaySlot?: boolean; allDayText?: string; slotDuration?: moment.Duration; @@ -188,7 +184,7 @@ declare global { /* * Event Dragging & Resizing */ - export interface EventDraggingResizingOptions { + interface EventDraggingResizingOptions { editable?: boolean; eventStartEditable?: boolean; eventDurationEditable?: boolean; @@ -207,7 +203,7 @@ declare global { /* * Selection - http://arshaw.com/fullcalendar/docs/selection/ */ - export interface SelectionOptions { + interface SelectionOptions { selectable?: boolean; selectHelper?: boolean | ((start: moment.Moment, end: moment.Moment) => HTMLElement); unselectAuto?: boolean; @@ -218,14 +214,14 @@ declare global { unselect?: (view: ViewObject, jsEvent: Event) => void; } - export interface DroppingExternalElementsOptions { + interface DroppingExternalElementsOptions { droppable?: boolean; dropAccept?: string | ((draggable: any) => boolean); drop?: (date: moment.Moment, jsEvent: MouseEvent, ui: any) => void; eventReceive?: (event: EventObject) => void; } - export interface ButtonTextObject { + interface ButtonTextObject { prev?: string; next?: string; prevYear?: string; @@ -236,7 +232,7 @@ declare global { day?: string; } - export interface EventObject extends Timespan { + interface EventObject extends Timespan { id?: any; // String/number title: string; allDay?: boolean; @@ -251,15 +247,14 @@ declare global { rendering?: string; } - export interface ViewObject extends Timespan { + interface ViewObject extends Timespan { name: string; title: string; intervalStart: moment.Moment; intervalEnd: moment.Moment; } - export interface EventSource extends JQueryAjaxSettings { - + interface EventSource extends JQueryAjaxSettings { /** * This has one of the following types: * @@ -281,11 +276,9 @@ declare global { startParam?: string; endParam?: string; } - } interface JQuery { - /** * Get/Set option value */ diff --git a/gaussian/index.d.ts b/gaussian/index.d.ts index f0012597cb..fb34d74641 100644 --- a/gaussian/index.d.ts +++ b/gaussian/index.d.ts @@ -9,7 +9,7 @@ export = gaussian; export as namespace gaussian; declare namespace gaussian { - export interface Gaussian { + interface Gaussian { /** * the mean (μ) of the distribution */ diff --git a/geodesy/geodesy-tests.ts b/geodesy/geodesy-tests.ts index 53c3b5c05c..e3ce4f627a 100644 --- a/geodesy/geodesy-tests.ts +++ b/geodesy/geodesy-tests.ts @@ -23,7 +23,6 @@ const zoneMgrs = mgrs.zone; mgrs.toString(); mgrs.toUtm(); - // Static Functions Mgrs.parse('31U DQ 48251 11932'); diff --git a/geodesy/index.d.ts b/geodesy/index.d.ts index d5436f073d..12adb4d7c1 100644 --- a/geodesy/index.d.ts +++ b/geodesy/index.d.ts @@ -43,7 +43,7 @@ export interface Ellipsoids { Bessel1841: Ellipsoid; } -export declare class Mgrs { +export class Mgrs { zone: number; band: string; e100k: string; @@ -68,7 +68,7 @@ export declare class Mgrs { toString(digits?: 2 | 4 | 6 | 8 | 10): string; } -export declare class Utm { +export class Utm { zone: number; hemisphere: hemisphere; easting: number; @@ -91,11 +91,11 @@ export declare class Utm { toString(digits?: number): string; } -export declare namespace Dms { - export let separator: string; +export namespace Dms { + let separator: string; } -export declare class Dms { +export class Dms { static parseDMS(dmsStr: string): number; static toDMS(deg: number, format?: format, dp?: 0 | 2 | 4): string; static toLat(deg: number, format?: format, dp?: 0 | 2 | 4): string; @@ -104,7 +104,7 @@ export declare class Dms { static compassPoint(bearing: number, precision?: 1 | 2 | 3): string; } -export declare class Vector3d { +export class Vector3d { x: number; y: number; z: number; @@ -125,7 +125,7 @@ export declare class Vector3d { applyTransform(t: number[]): Vector3d; } -export declare class OsGridRef { +export class OsGridRef { easting: number; northing: number; constructor(easting: number, northing: number); @@ -135,7 +135,7 @@ export declare class OsGridRef { toString(digits?: number): string; } -export declare class LatLonEllipsoidal { +export class LatLonEllipsoidal { lat: number; lon: number; datum: Datum; diff --git a/geolib/index.d.ts b/geolib/index.d.ts index 69a6c99353..95779ab2c9 100644 --- a/geolib/index.d.ts +++ b/geolib/index.d.ts @@ -4,25 +4,25 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace geolib { - export interface PositionAsDecimal { + interface PositionAsDecimal { latitude: number; longitude: number; } - export interface PositionAsSexadecimal { + interface PositionAsSexadecimal { latitude: string; longitude: string; } - export interface PositionWithElevation extends PositionAsDecimal { + interface PositionWithElevation extends PositionAsDecimal { elevation?: number; } - export interface PositionInTime extends PositionAsDecimal { + interface PositionInTime extends PositionAsDecimal { time: number; } - export interface Bound { + interface Bound { minLat: number; maxLat: number; minLng: number; @@ -31,19 +31,19 @@ declare namespace geolib { maxElev?: number; } - export interface CompassDirection { + interface CompassDirection { rough: string; exact: string; } - export interface Distance { + interface Distance { latitude: number; longitude: number; distance: number; key: string; } - export interface SpeedOption { + interface SpeedOption { unit: string; } @@ -60,13 +60,11 @@ declare namespace geolib { */ function getDistanceSimple(start: PositionAsDecimal|PositionAsSexadecimal, end: PositionAsDecimal|PositionAsSexadecimal, accuracy?: number): number; - /** Calculates the geographical center of all points in a collection of geo coordinates * Takes an object or array of coordinates and calculates the center of it. */ function getCenter(coords: PositionAsDecimal[]): PositionAsDecimal; - /** Calculates the center of the bounds of geo coordinates. Takes an array of coordinates, * calculate the border of those, and gives back the center of that rectangle. On polygons * like political borders (eg. states), this may gives a closer result to human expectation, @@ -76,28 +74,24 @@ declare namespace geolib { */ function getCenterOfBounds(coords: PositionAsDecimal[]): PositionAsDecimal; - /** Calculates the bounds of geo coordinates. * * Returns maximum and minimum, latitude, longitude, and elevation (if provided) in form of an object */ function getBounds(coords: PositionWithElevation[]): Bound; - /** Checks whether a point is inside of a polygon or not. Note: the polygon coords must be in correct order! * * Returns true or false */ function isPointInside(latlng: PositionAsDecimal, polygon: PositionAsDecimal[]): boolean; - /** Similar to is point inside: checks whether a point is inside of a circle or not. * * Returns true or false */ function isPointInCircle(latlng: PositionAsDecimal, center: PositionAsDecimal, radius: number): boolean; - /** Gets rhumb line bearing of two points. Find out about the difference between rhumb line and great circle bearing on Wikipedia. * Rhumb line should be fine in most cases: http://en.wikipedia.org/wiki/Rhumb_line#General_and_mathematical_description Function * is heavily based on Doug Vanderweide's great PHP version (licensed under GPL 3.0) @@ -107,14 +101,12 @@ declare namespace geolib { */ function getRhumbLineBearing(originLL: PositionAsDecimal, destLL: PositionAsDecimal): number; - /** Gets great circle bearing of two points. See description of getRhumbLineBearing for more information. * * Returns calculated bearing as integer */ function getBearing(originLL: PositionAsDecimal, destLL: PositionAsDecimal): number; - /** Gets the compass direction from an origin coordinate (originLL) to a destination coordinate (destLL). * Bearing mode. Can be either circle or rhumbline (default). * @@ -122,15 +114,12 @@ declare namespace geolib { */ function getCompassDirection(originLL: PositionAsDecimal, destLL: PositionAsDecimal, bearingMode?: string): CompassDirection; - /** Sorts an object or array of coords by distance from a reference coordinate */ function orderByDistance(latlng: PositionAsDecimal, coords: PositionAsDecimal[]): Distance[]; - /** Finds the nearest coordinate to a reference coordinate. */ function findNearest(latlng: PositionAsDecimal, coords: PositionAsDecimal[], offset?: number, limit?: number): Distance[]; - /** Calculates the length of a collection of coordinates. * * Returns the length of the path in meters */ @@ -142,11 +131,9 @@ declare namespace geolib { */ function getSpeed(coords: PositionInTime[], option?: SpeedOption): number; - /** Calculates if given point lies in a line formed by start and end */ function isPointInLine(point: PositionAsDecimal, start: PositionAsDecimal, end: PositionAsDecimal): boolean; - /** Converts a given distance (in meters) to another unit. * distance distance to be converted (source must be in meter). unit can be one of: * - m (meter) @@ -161,11 +148,9 @@ declare namespace geolib { */ function convertUnit(unit: string, distance: number, round?: number): number; - /** Converts a sexagesimal coordinate to decimal format */ function sexagesimal2decimal(coord: string): number; - /** Converts a decimal coordinate to sexagesimal format */ function decimal2sexagesimal(coord: number): string; @@ -184,11 +169,9 @@ declare namespace geolib { */ function elevation(latlng: any): number; - /** Checks if a coordinate is already in decimal format and, if not, converts it to */ function useDecimal(latlng: string|number): number; - /** Computes the destination point given an initial point, a distance (in meters) and a bearing (in degrees). * If no radius is given it defaults to the mean earth radius of 6371000 meter. * diff --git a/geolib/tslint.json b/geolib/tslint.json index 377cc837d4..d3631e8907 100644 --- a/geolib/tslint.json +++ b/geolib/tslint.json @@ -1 +1,6 @@ -{ "extends": "../tslint.json" } +{ + "extends": "../tslint.json", + "rules": { + "no-useless-files": false + } +} diff --git a/get-stdin/index.d.ts b/get-stdin/index.d.ts index 9539b520b9..2d1b15ae98 100644 --- a/get-stdin/index.d.ts +++ b/get-stdin/index.d.ts @@ -7,7 +7,7 @@ declare function getStdin(): Promise; declare namespace getStdin { - export function buffer(): Promise; + function buffer(): Promise; } export = getStdin; diff --git a/google-protobuf/google-protobuf-tests.ts b/google-protobuf/google-protobuf-tests.ts index 389a3b117a..809d8dfb7c 100644 --- a/google-protobuf/google-protobuf-tests.ts +++ b/google-protobuf/google-protobuf-tests.ts @@ -83,7 +83,7 @@ class MySimple extends jspb.Message { var reader = new jspb.BinaryReader(bytes); var msg = new MySimple; return MySimple.deserializeBinaryFromReader(msg, reader); - }; + } static deserializeBinaryFromReader(msg: MySimple, reader: jspb.BinaryReader): MySimple { while (reader.nextField()) { @@ -170,13 +170,13 @@ class MySimple extends jspb.Message { } } return msg; - }; + } serializeBinary(): Uint8Array { var writer = new jspb.BinaryWriter(); MySimple.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); - }; + } static serializeBinaryToWriter(message: MySimple, writer: jspb.BinaryWriter) { const f1 = message.getMyString(); @@ -296,229 +296,229 @@ class MySimple extends jspb.Message { google_protobuf_wrappers_pb.DoubleValue.serializeBinaryToWriter ); } - }; + } getMyString(): string { return jspb.Message.getFieldWithDefault(this, 1, ""); - }; + } setMyString(value: string) { jspb.Message.setField(this, 1, value); - }; + } getMyBool(): boolean { return jspb.Message.getFieldWithDefault(this, 2, false); - }; + } setMyBool(value: boolean) { jspb.Message.setField(this, 2, value); - }; + } - getSomeLabelsList(): Array { - return jspb.Message.getField(this, 3); - }; + getSomeLabelsList(): string[] { + return jspb.Message.getField(this, 3) as string[]; + } setSomeLabelsList(value: Array) { jspb.Message.setField(this, 3, value || []); - }; + } addSomeLabels(value: string, opt_index?: number) { jspb.Message.addToRepeatedField(this, 3, value, opt_index); - }; + } clearSomeLabelsList() { this.setSomeLabelsList([]); - }; + } getSomeCodeGeneratorRequest(): google_protobuf_compiler_plugin_pb.CodeGeneratorRequest { return jspb.Message.getWrapperField(this, google_protobuf_compiler_plugin_pb.CodeGeneratorRequest, 4) as google_protobuf_compiler_plugin_pb.CodeGeneratorRequest; - }; + } setSomeCodeGeneratorRequest(value?: google_protobuf_compiler_plugin_pb.CodeGeneratorRequest) { jspb.Message.setWrapperField(this, 4, value); - }; + } clearSomeCodeGeneratorRequest() { this.setSomeCodeGeneratorRequest(undefined); - }; + } hasSomeCodeGeneratorRequest(): boolean { return jspb.Message.getField(this, 4) != null; - }; + } getSomeAny(): google_protobuf_any_pb.Any { return jspb.Message.getWrapperField(this, google_protobuf_any_pb.Any, 5) as google_protobuf_any_pb.Any; - }; + } setSomeAny(value?: google_protobuf_any_pb.Any) { jspb.Message.setWrapperField(this, 5, value); - }; + } clearSomeAny() { this.setSomeAny(undefined); - }; + } hasSomeAny(): boolean { return jspb.Message.getField(this, 5) != null; - }; + } getSomeMethod(): google_protobuf_api_pb.Method { return jspb.Message.getWrapperField(this, google_protobuf_api_pb.Method, 6) as google_protobuf_api_pb.Method; - }; + } setSomeMethod(value?: google_protobuf_api_pb.Method) { jspb.Message.setWrapperField(this, 6, value); - }; + } clearSomeMethod() { this.setSomeMethod(undefined); - }; + } hasSomeMethod(): boolean { return jspb.Message.getField(this, 6) != null; - }; + } getSomeGeneratedCodeInfo(): google_protobuf_descriptor_pb.GeneratedCodeInfo { return jspb.Message.getWrapperField(this, google_protobuf_descriptor_pb.GeneratedCodeInfo, 7) as google_protobuf_descriptor_pb.GeneratedCodeInfo; - }; + } setSomeGeneratedCodeInfo(value?: google_protobuf_descriptor_pb.GeneratedCodeInfo) { jspb.Message.setWrapperField(this, 7, value); - }; + } clearSomeGeneratedCodeInfo() { this.setSomeGeneratedCodeInfo(undefined); - }; + } hasSomeGeneratedCodeInfo(): boolean { return jspb.Message.getField(this, 7) != null; - }; + } getSomeDuration(): google_protobuf_duration_pb.Duration { return jspb.Message.getWrapperField(this, google_protobuf_duration_pb.Duration, 8) as google_protobuf_duration_pb.Duration; - }; + } setSomeDuration(value?: google_protobuf_duration_pb.Duration) { jspb.Message.setWrapperField(this, 8, value); - }; + } clearSomeDuration() { this.setSomeDuration(undefined); - }; + } hasSomeDuration(): boolean { return jspb.Message.getField(this, 8) != null; - }; + } getSomeEmpty(): google_protobuf_empty_pb.Empty { return jspb.Message.getWrapperField(this, google_protobuf_empty_pb.Empty, 9) as google_protobuf_empty_pb.Empty; - }; + } setSomeEmpty(value?: google_protobuf_empty_pb.Empty) { jspb.Message.setWrapperField(this, 9, value); - }; + } clearSomeEmpty() { this.setSomeEmpty(undefined); - }; + } hasSomeEmpty(): boolean { return jspb.Message.getField(this, 9) != null; - }; + } getSomeFieldMask(): google_protobuf_field_mask_pb.FieldMask { return jspb.Message.getWrapperField(this, google_protobuf_field_mask_pb.FieldMask, 10) as google_protobuf_field_mask_pb.FieldMask; - }; + } setSomeFieldMask(value?: google_protobuf_field_mask_pb.FieldMask) { jspb.Message.setWrapperField(this, 10, value); - }; + } clearSomeFieldMask() { this.setSomeFieldMask(undefined); - }; + } hasSomeFieldMask(): boolean { return jspb.Message.getField(this, 10) != null; - }; + } getSomeSourceContext(): google_protobuf_source_context_pb.SourceContext { return jspb.Message.getWrapperField(this, google_protobuf_source_context_pb.SourceContext, 11) as google_protobuf_source_context_pb.SourceContext; - }; + } setSomeSourceContext(value?: google_protobuf_source_context_pb.SourceContext) { jspb.Message.setWrapperField(this, 11, value); - }; + } clearSomeSourceContext() { this.setSomeSourceContext(undefined); - }; + } hasSomeSourceContext(): boolean { return jspb.Message.getField(this, 11) != null; - }; + } getSomeStruct(): google_protobuf_struct_pb.Struct { return jspb.Message.getWrapperField(this, google_protobuf_struct_pb.Struct, 12) as google_protobuf_struct_pb.Struct; - }; + } setSomeStruct(value?: google_protobuf_struct_pb.Struct) { jspb.Message.setWrapperField(this, 12, value); - }; + } clearSomeStruct() { this.setSomeStruct(undefined); - }; + } hasSomeStruct(): boolean { return jspb.Message.getField(this, 12) != null; - }; + } getSomeTimestamp(): google_protobuf_timestamp_pb.Timestamp { return jspb.Message.getWrapperField(this, google_protobuf_timestamp_pb.Timestamp, 13) as google_protobuf_timestamp_pb.Timestamp; - }; + } setSomeTimestamp(value?: google_protobuf_timestamp_pb.Timestamp) { jspb.Message.setWrapperField(this, 13, value); - }; + } clearSomeTimestamp() { this.setSomeTimestamp(undefined); - }; + } hasSomeTimestamp(): boolean { return jspb.Message.getField(this, 13) != null; - }; + } getSomeType(): google_protobuf_type_pb.Type { return jspb.Message.getWrapperField(this, google_protobuf_type_pb.Type, 14) as google_protobuf_type_pb.Type; - }; + } setSomeType(value?: google_protobuf_type_pb.Type) { jspb.Message.setWrapperField(this, 14, value); - }; + } clearSomeType() { this.setSomeType(undefined); - }; + } hasSomeType(): boolean { return jspb.Message.getField(this, 14) != null; - }; + } getSomeDoubleValue(): google_protobuf_wrappers_pb.DoubleValue { return jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.DoubleValue, 15) as google_protobuf_wrappers_pb.DoubleValue; - }; + } setSomeDoubleValue(value?: google_protobuf_wrappers_pb.DoubleValue) { jspb.Message.setWrapperField(this, 15, value); - }; + } clearSomeDoubleValue() { this.setSomeDoubleValue(undefined); - }; + } hasSomeDoubleValue(): boolean { return jspb.Message.getField(this, 15) != null; - }; + } }; diff --git a/google-protobuf/index.d.ts b/google-protobuf/index.d.ts index cf6a7e218a..9dcb7ea609 100644 --- a/google-protobuf/index.d.ts +++ b/google-protobuf/index.d.ts @@ -3,115 +3,118 @@ // Definitions by: Marcus Longmuir // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -type ByteSource = ArrayBuffer|Uint8Array|number[]|string; -type ScalarFieldType = boolean|number|string; +type ByteSource = ArrayBuffer | Uint8Array | number[] | string; +type ScalarFieldType = boolean | number | string; type RepeatedFieldType = ScalarFieldType[] | Uint8Array[]; type AnyFieldType = ScalarFieldType | RepeatedFieldType | Uint8Array; -type FieldValue = (string|number|boolean|Uint8Array|any/*This should be Array, but that isn't allowed*/|undefined) +type FieldValue = string | number | boolean | Uint8Array | FieldValueArray | undefined; +interface FieldValueArray extends Array {} // tslint:disable-line no-empty-interface export abstract class Message { getJsPbMessageId(): (string | undefined); - static initialize(msg: Message, - data: Message.MessageArray, - messageId: (string | number), - suggestedPivot: number, - repeatedFields: number[], - oneofFields?: number[][] | null): void; - static toObjectList(field: T[], - toObjectFn: (includeInstance: boolean, - data: T) => {}, - includeInstance?: boolean): {}[]; - static toObjectExtension(msg: Message, - obj: {}, - extensions: {[key: number]: ExtensionFieldInfo}, - getExtensionFn: (fieldInfo: ExtensionFieldInfo) => Message, - includeInstance?: boolean): void; - serializeBinaryExtensions(proto: Message, - writer: BinaryWriter, - extensions: {[key: number]: ExtensionFieldBinaryInfo}, - getExtensionFn: (fieldInfo: ExtensionFieldInfo) => T): void - readBinaryExtension(proto: Message, - reader: BinaryReader, - extensions: {[key: number]: ExtensionFieldBinaryInfo}, - setExtensionFn: (fieldInfo: ExtensionFieldInfo, - val: T) => void): void - static getField(msg: Message, - fieldNumber: number): FieldValue|null; - static getOptionalFloatingPointField(msg: Message, - fieldNumber: number): (number | undefined); - static getRepeatedFloatingPointField(msg: Message, - fieldNumber: number): number[]; + static initialize( + msg: Message, + data: Message.MessageArray, + messageId: (string | number), + suggestedPivot: number, + repeatedFields: number[], + oneofFields?: number[][] | null): void; + static toObjectList( + field: T[], + toObjectFn: (includeInstance: boolean, data: T) => {}, + includeInstance?: boolean): Array<{}>; + static toObjectExtension( + msg: Message, + obj: {}, + extensions: {[key: number]: ExtensionFieldInfo}, + getExtensionFn: (fieldInfo: ExtensionFieldInfo) => Message, + includeInstance?: boolean): void; + serializeBinaryExtensions( + proto: Message, + writer: BinaryWriter, + extensions: { [key: number]: ExtensionFieldBinaryInfo }, + getExtensionFn: (fieldInfo: ExtensionFieldInfo) => T): void + readBinaryExtension( + proto: Message, + reader: BinaryReader, + extensions: {[key: number]: ExtensionFieldBinaryInfo}, + setExtensionFn: (fieldInfo: ExtensionFieldInfo, + val: T) => void): void + static getField(msg: Message, fieldNumber: number): FieldValue|null; + static getOptionalFloatingPointField(msg: Message, fieldNumber: number): number | undefined; + static getRepeatedFloatingPointField(msg: Message, fieldNumber: number): number[]; static bytesAsB64(bytes: Uint8Array): string; static bytesAsU8(str: string): Uint8Array; static bytesListAsB64(bytesList: Uint8Array[]): string[]; static bytesListAsU8(strList: string[]): Uint8Array[]; - static getFieldWithDefault(msg: Message, - fieldNumber: number, - defaultValue: T): T; - static getMapField(msg: Message, - fieldNumber: number, - noLazyCreate: boolean, - valueCtor: typeof Message): Map; - static setField(msg: Message, - fieldNumber: number, - value: FieldValue): void; - static addToRepeatedField(msg: Message, - fieldNumber: number, - value: any, - index?: number): void; - static setOneofField(msg: Message, - fieldNumber: number, - oneof: number[], - value: FieldValue): void; - static computeOneofCase(msg: Message, - oneof: number[]): number; - static getWrapperField(msg: Message, - ctor: typeof Message, - fieldNumber: number, - required?: number): Message; - static getRepeatedWrapperField(msg: Message, - ctor: typeof Message, - fieldNumber: number): Message[]; - static setWrapperField(msg: Message, - fieldNumber: number, - value?: (Message|Map)): void; - static setOneofWrapperField(msg: Message, - fieldNumber: number, - oneof: number[], - value: any): void; - static setRepeatedWrapperField(msg: Message, - fieldNumber: number, - value: any): void; - static addToRepeatedWrapperField(msg: Message, - fieldNumber: number, - value: any, - ctor: typeof Message, - index: number): any; - static toMap(field: any[], - mapKeyGetterFn: (field: any) => string, - toObjectFn?: Message.StaticToObject, - includeInstance?: boolean): void; + static getFieldWithDefault(msg: Message, fieldNumber: number, defaultValue: T): T; + static getMapField( + msg: Message, + fieldNumber: number, + noLazyCreate: boolean, + valueCtor: typeof Message): Map; + static setField( + msg: Message, + fieldNumber: number, + value: FieldValue): void; + static addToRepeatedField( + msg: Message, + fieldNumber: number, + value: any, + index?: number): void; + static setOneofField( + msg: Message, + fieldNumber: number, + oneof: number[], + value: FieldValue): void; + static computeOneofCase(msg: Message, oneof: number[]): number; + static getWrapperField( + msg: Message, + ctor: typeof Message, + fieldNumber: number, + required?: number): Message; + static getRepeatedWrapperField( + msg: Message, + ctor: typeof Message, + fieldNumber: number): Message[]; + static setWrapperField( + msg: Message, + fieldNumber: number, + value?: (Message|Map)): void; + static setOneofWrapperField( + msg: Message, + fieldNumber: number, + oneof: number[], + value: any): void; + static setRepeatedWrapperField( + msg: Message, + fieldNumber: number, + value: any): void; + static addToRepeatedWrapperField( + msg: Message, + fieldNumber: number, + value: any, + ctor: typeof Message, + index: number): any; + static toMap( + field: any[], + mapKeyGetterFn: (field: any) => string, + toObjectFn?: Message.StaticToObject, + includeInstance?: boolean): void; toArray(): Message.MessageArray; toString(): string; getExtension(fieldInfo: ExtensionFieldInfo): T; - setExtension(fieldInfo: ExtensionFieldInfo, - value: T): void; - static difference(m1: T, - m2: T): T; - static equals(m1: Message, - m2: Message): boolean; - static compareExtensions(extension1: {}, - extension2: {}): boolean; - static compareFields(field1: any, - field2: any): boolean; + setExtension(fieldInfo: ExtensionFieldInfo, value: T): void; + static difference(m1: T, m2: T): T; + static equals(m1: Message, m2: Message): boolean; + static compareExtensions(extension1: {}, extension2: {}): boolean; + static compareFields(field1: any, field2: any): boolean; cloneMessage(): Message; clone(): Message; static clone(msg: T): T; static cloneMessage(msg: T): T; - static copyInto(fromMessage: Message, - toMessage: Message): void; - static registerMessageType(id: number, - constructor: typeof Message): void; + static copyInto(fromMessage: Message, toMessage: Message): void; + static registerMessageType(id: number, constructor: typeof Message): void; abstract serializeBinary(): Uint8Array; abstract toObject(includeInstance?: boolean): {}; @@ -122,16 +125,13 @@ export abstract class Message { static deserializeBinaryFromReader(message: Message, reader: BinaryReader): Message; static serializeBinaryToWriter(message: Message, writer: BinaryWriter): void; static toObject(includeInstance: boolean, msg: Message): {}; - static extensions: {[key: number]: ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: ExtensionFieldBinaryInfo}; + static extensions: { [key: number]: ExtensionFieldInfo }; + static extensionsBinary: { [key: number]: ExtensionFieldBinaryInfo }; } export namespace Message { - export type MessageArray = any[]; // This type needs to reference itself - interface StaticToObject { - (includeInstance: boolean, - msg: Message): {}; - } + type MessageArray = any[]; // This type needs to reference itself + type StaticToObject = (includeInstance: boolean, msg: Message) => {}; } export class ExtensionFieldInfo { @@ -140,11 +140,12 @@ export class ExtensionFieldInfo { ctor: typeof Message; toObjectFn: Message.StaticToObject; isRepeated: number; - constructor(fieldIndex: number, - fieldName: {[key: string]: number}, - ctor: typeof Message, - toObjectFn: Message.StaticToObject, - isRepeated: number); + constructor( + fieldIndex: number, + fieldName: {[key: string]: number}, + ctor: typeof Message, + toObjectFn: Message.StaticToObject, + isRepeated: number); isMessageType(): boolean; } @@ -152,41 +153,40 @@ export class ExtensionFieldBinaryInfo { fieldInfo: ExtensionFieldInfo; binaryReaderFn: BinaryRead; binaryWriterFn: BinaryWrite; - opt_binaryMessageSerializeFn: (msg: Message, - writer: BinaryWriter) => void; - opt_binaryMessageDeserializeFn: (msg: Message, - reader: BinaryReader) => Message; + opt_binaryMessageSerializeFn: (msg: Message, writer: BinaryWriter) => void; + opt_binaryMessageDeserializeFn: (msg: Message, reader: BinaryReader) => Message; opt_isPacked: boolean; - constructor(fieldInfo: ExtensionFieldInfo, - binaryReaderFn: BinaryRead, - binaryWriterFn: BinaryWrite, - opt_binaryMessageSerializeFn: (msg: Message, - writer: BinaryWriter) => void, - opt_binaryMessageDeserializeFn: (msg: Message, - reader: BinaryReader) => Message, - opt_isPacked: boolean); + constructor( + fieldInfo: ExtensionFieldInfo, + binaryReaderFn: BinaryRead, + binaryWriterFn: BinaryWrite, + opt_binaryMessageSerializeFn: (msg: Message, writer: BinaryWriter) => void, + opt_binaryMessageDeserializeFn: (msg: Message, reader: BinaryReader) => Message, + opt_isPacked: boolean); } export class Map { - constructor(arr: Array<[K, V]>, - valueCtor?: {new(init: any): V}); + constructor( + arr: Array<[K, V]>, + valueCtor?: {new(init: any): V}); toArray(): Array<[K, V]>; - toObject(includeInstance: boolean, - valueToObject: (includeInstance: boolean) => any): Array<[K, V]>; - static fromObject(entries: Array<[K, V]>, - valueCtor: any, - valueFromObject: any): Map; + toObject( + includeInstance: boolean, + valueToObject: (includeInstance: boolean) => any): Array<[K, V]>; + static fromObject( + entries: Array<[K, V]>, + valueCtor: any, + valueFromObject: any): Map; getLength(): number; clear(): void; del(key: K): boolean; getEntryList(): Array<[K, V]>; entries(): Map.Iterator<[K, V]>; keys(): Map.Iterator; - forEach(callback: (entry: V, - key: K) => void, - thisArg?: {}): void; - set(key: K, - value: V): void; + forEach( + callback: (entry: V, key: K) => void, + thisArg?: {}): void; + set(key: K, value: V): void; get(key: K): (V | undefined); has(key: K): boolean; } @@ -196,43 +196,24 @@ export namespace Map { interface Iterator { next(): IteratorResult; } - type IteratorResult = { - done: boolean, - value: T, + interface IteratorResult { + done: boolean; + value: T; } } -interface BinaryReadReader { - (msg: any, - binaryReader: BinaryReader): void; -} +type BinaryReadReader = (msg: any, binaryReader: BinaryReader) => void; -interface BinaryRead { - (msg: any, - reader: BinaryReadReader): void; -} +type BinaryRead = (msg: any, reader: BinaryReadReader) => void; -interface BinaryWriteCallback { - (value: any, - binaryWriter: BinaryWriter): void; -} +type BinaryWriteCallback = (value: any, binaryWriter: BinaryWriter) => void; -interface BinaryWrite { - (fieldNumber: number, - value: any, - writerCallback: BinaryWriteCallback): void; -} +type BinaryWrite = (fieldNumber: number, value: any, writerCallback: BinaryWriteCallback) => void; export class BinaryReader { - constructor(bytes?: ByteSource, - start?: number, - length?: number); - static alloc(bytes?: ByteSource, - start?: number, - length?: number): BinaryReader; - alloc(bytes?: ByteSource, - start?: number, - length?: number): BinaryReader; + constructor(bytes?: ByteSource, start?: number, length?: number); + static alloc(bytes?: ByteSource, start?: number, length?: number): BinaryReader; + alloc(bytes?: ByteSource, start?: number, length?: number): BinaryReader; free(): void; getFieldCursor(): number; getCursor(): number; @@ -241,9 +222,7 @@ export class BinaryReader { getWireType(): BinaryConstants.WireType; isEndGroup(): boolean; getError(): boolean; - setBlock(bytes?: ByteSource, - start?: number, - length?: number): void; + setBlock(bytes?: ByteSource, start?: number, length?: number): void; reset(): void; advance(count: number): void; nextField(): boolean; @@ -255,14 +234,11 @@ export class BinaryReader { skipFixed64Field(): void; skipGroup(): void; skipField(): void; - registerReadCallback(callbackName: string, - callback: (binaryReader: BinaryReader) => any): void; + registerReadCallback(callbackName: string, callback: (binaryReader: BinaryReader) => any): void; runReadCallback(callbackName: string): any; readAny(fieldType: BinaryConstants.FieldType): AnyFieldType; readMessage: BinaryRead; - readGroup(field: number, - message: Message, - reader: BinaryReadReader): void; + readGroup(field: number, message: Message, reader: BinaryReadReader): void; getFieldDecoder(): BinaryDecoder; readInt32(): number; readInt32String(): string; @@ -317,186 +293,99 @@ export class BinaryReader { export class BinaryWriter { constructor(); - writeSerializedMessage(bytes: Uint8Array, - start: number, - end: number): void; - maybeWriteSerializedMessage(bytes?: Uint8Array, - start?: number, - end?: number): void; + writeSerializedMessage(bytes: Uint8Array, start: number, end: number): void; + maybeWriteSerializedMessage(bytes?: Uint8Array, start?: number, end?: number): void; reset(): void; getResultBuffer(): Uint8Array; getResultBase64String(): string; beginSubMessage(field: number): void; endSubMessage(field: number): void; - writeAny(fieldType: BinaryConstants.FieldType, - field: number, - value: AnyFieldType): void; - writeInt32(field: number, - value?: number): void; - writeInt32String(field: number, - value?: string): void; - writeInt64(field: number, - value?: number): void; - writeInt64String(field: number, - value?: string): void; - writeUint32(field: number, - value?: number): void; - writeUint32String(field: number, - value?: string): void; - writeUint64(field: number, - value?: number): void; - writeUint64String(field: number, - value?: string): void; - writeSint32(field: number, - value?: number): void; - writeSint64(field: number, - value?: number): void; - writeSint64String(field: number, - value?: string): void; - writeFixed32(field: number, - value?: number): void; - writeFixed64(field: number, - value?: number): void; - writeFixed64String(field: number, - value?: string): void; - writeSfixed32(field: number, - value?: number): void; - writeSfixed64(field: number, - value?: number): void; - writeSfixed64String(field: number, - value?: string): void; - writeFloat(field: number, - value?: number): void; - writeDouble(field: number, - value?: number): void; - writeBool(field: number, - value?: boolean): void; - writeEnum(field: number, - value?: number): void; - writeString(field: number, - value?: string): void; - writeBytes(field: number, - value?: ByteSource): void; + writeAny(fieldType: BinaryConstants.FieldType, field: number, value: AnyFieldType): void; + writeInt32(field: number, value?: number): void; + writeInt32String(field: number, value?: string): void; + writeInt64(field: number, value?: number): void; + writeInt64String(field: number, value?: string): void; + writeUint32(field: number, value?: number): void; + writeUint32String(field: number, value?: string): void; + writeUint64(field: number, value?: number): void; + writeUint64String(field: number, value?: string): void; + writeSint32(field: number, value?: number): void; + writeSint64(field: number, value?: number): void; + writeSint64String(field: number, value?: string): void; + writeFixed32(field: number, value?: number): void; + writeFixed64(field: number, value?: number): void; + writeFixed64String(field: number, value?: string): void; + writeSfixed32(field: number, value?: number): void; + writeSfixed64(field: number, value?: number): void; + writeSfixed64String(field: number, value?: string): void; + writeFloat(field: number, value?: number): void; + writeDouble(field: number, value?: number): void; + writeBool(field: number, value?: boolean): void; + writeEnum(field: number, value?: number): void; + writeString(field: number, value?: string): void; + writeBytes(field: number, value?: ByteSource): void; writeMessage: BinaryWrite; - writeGroup(field: number, - value: any, - writeCallback: BinaryWriteCallback): void; - writeFixedHash64(field: number, - value?: string): void; - writeVarintHash64(field: number, - value?: string): void; - writeRepeatedInt32(field: number, - value?: number[]): void; - writeRepeatedInt32String(field: number, - value?: string[]): void; - writeRepeatedInt64(field: number, - value?: number[]): void; - writeRepeatedInt64String(field: number, - value?: string[]): void; - writeRepeatedUint32(field: number, - value?: number[]): void; - writeRepeatedUint32String(field: number, - value?: string[]): void; - writeRepeatedUint64(field: number, - value?: number[]): void; - writeRepeatedUint64String(field: number, - value?: string[]): void; - writeRepeatedSint32(field: number, - value?: number[]): void; - writeRepeatedSint64(field: number, - value?: number[]): void; - writeRepeatedSint64String(field: number, - value?: string[]): void; - writeRepeatedFixed32(field: number, - value?: number[]): void; - writeRepeatedFixed64(field: number, - value?: number[]): void; - writeRepeatedFixed64String(field: number, - value?: string[]): void; - writeRepeatedSfixed32(field: number, - value?: number[]): void; - writeRepeatedSfixed64(field: number, - value?: number[]): void; - writeRepeatedSfixed64String(field: number, - value?: string[]): void; - writeRepeatedFloat(field: number, - value?: number[]): void; - writeRepeatedDouble(field: number, - value?: number[]): void; - writeRepeatedBool(field: number, - value?: boolean[]): void; - writeRepeatedEnum(field: number, - value?: number[]): void; - writeRepeatedString(field: number, - value?: string[]): void; - writeRepeatedBytes(field: number, - value?: ByteSource[]): void; - writeRepeatedMessage(field: number, - value: Message[], - writerCallback: BinaryWriteCallback): void; - writeRepeatedGroup(field: number, - value: Message[], - writerCallback: BinaryWriteCallback): void; - writeRepeatedFixedHash64(field: number, - value?: string[]): void; - writeRepeatedVarintHash64(field: number, - value?: string[]): void; - writePackedInt32(field: number, - value?: number[]): void; - writePackedInt32String(field: number, - value?: string[]): void; - writePackedInt64(field: number, - value?: number[]): void; - writePackedInt64String(field: number, - value?: string[]): void; - writePackedUint32(field: number, - value?: number[]): void; - writePackedUint32String(field: number, - value?: string[]): void; - writePackedUint64(field: number, - value?: number[]): void; - writePackedUint64String(field: number, - value?: string[]): void; - writePackedSint32(field: number, - value?: number[]): void; - writePackedSint64(field: number, - value?: number[]): void; - writePackedSint64String(field: number, - value?: string[]): void; - writePackedFixed32(field: number, - value?: number[]): void; - writePackedFixed64(field: number, - value?: number[]): void; - writePackedFixed64String(field: number, - value?: string[]): void; - writePackedSfixed32(field: number, - value?: number[]): void; - writePackedSfixed64(field: number, - value?: number[]): void; - writePackedSfixed64String(field: number, - value?: string[]): void; - writePackedFloat(field: number, - value?: number[]): void; - writePackedDouble(field: number, - value?: number[]): void; - writePackedBool(field: number, - value?: boolean[]): void; - writePackedEnum(field: number, - value?: number[]): void; - writePackedFixedHash64(field: number, - value?: string[]): void; - writePackedVarintHash64(field: number, - value?: string[]): void; + writeGroup(field: number, value: any, writeCallback: BinaryWriteCallback): void; + writeFixedHash64(field: number, value?: string): void; + writeVarintHash64(field: number, value?: string): void; + writeRepeatedInt32(field: number, value?: number[]): void; + writeRepeatedInt32String(field: number, value?: string[]): void; + writeRepeatedInt64(field: number, value?: number[]): void; + writeRepeatedInt64String(field: number, value?: string[]): void; + writeRepeatedUint32(field: number, value?: number[]): void; + writeRepeatedUint32String(field: number, value?: string[]): void; + writeRepeatedUint64(field: number, value?: number[]): void; + writeRepeatedUint64String(field: number, value?: string[]): void; + writeRepeatedSint32(field: number, value?: number[]): void; + writeRepeatedSint64(field: number, value?: number[]): void; + writeRepeatedSint64String(field: number, value?: string[]): void; + writeRepeatedFixed32(field: number, value?: number[]): void; + writeRepeatedFixed64(field: number, value?: number[]): void; + writeRepeatedFixed64String(field: number, value?: string[]): void; + writeRepeatedSfixed32(field: number, value?: number[]): void; + writeRepeatedSfixed64(field: number, value?: number[]): void; + writeRepeatedSfixed64String(field: number, value?: string[]): void; + writeRepeatedFloat(field: number, value?: number[]): void; + writeRepeatedDouble(field: number, value?: number[]): void; + writeRepeatedBool(field: number, value?: boolean[]): void; + writeRepeatedEnum(field: number, value?: number[]): void; + writeRepeatedString(field: number, value?: string[]): void; + writeRepeatedBytes(field: number, value?: ByteSource[]): void; + writeRepeatedMessage(field: number, value: Message[], writerCallback: BinaryWriteCallback): void; + writeRepeatedGroup(field: number, value: Message[], writerCallback: BinaryWriteCallback): void; + writeRepeatedFixedHash64(field: number, value?: string[]): void; + writeRepeatedVarintHash64(field: number, value?: string[]): void; + writePackedInt32(field: number, value?: number[]): void; + writePackedInt32String(field: number, value?: string[]): void; + writePackedInt64(field: number, value?: number[]): void; + writePackedInt64String(field: number, value?: string[]): void; + writePackedUint32(field: number, value?: number[]): void; + writePackedUint32String(field: number, value?: string[]): void; + writePackedUint64(field: number, value?: number[]): void; + writePackedUint64String(field: number, value?: string[]): void; + writePackedSint32(field: number, value?: number[]): void; + writePackedSint64(field: number, value?: number[]): void; + writePackedSint64String(field: number, value?: string[]): void; + writePackedFixed32(field: number, value?: number[]): void; + writePackedFixed64(field: number, value?: number[]): void; + writePackedFixed64String(field: number, value?: string[]): void; + writePackedSfixed32(field: number, value?: number[]): void; + writePackedSfixed64(field: number, value?: number[]): void; + writePackedSfixed64String(field: number, value?: string[]): void; + writePackedFloat(field: number, value?: number[]): void; + writePackedDouble(field: number, value?: number[]): void; + writePackedBool(field: number, value?: boolean[]): void; + writePackedEnum(field: number, value?: number[]): void; + writePackedFixedHash64(field: number, value?: string[]): void; + writePackedVarintHash64(field: number, value?: string[]): void; } export class BinaryEncoder { constructor(); length(): number; end(): number[]; - writeSplitVarint64(lowBits: number, - highBits: number): void; - writeSplitFixed64(lowBits: number, - highBits: number): void; + writeSplitVarint64(lowBits: number, highBits: number): void; + writeSplitFixed64(lowBits: number, highBits: number): void; writeUnsignedVarint32(value: number): void; writeSignedVarint32(value: number): void; writeUnsignedVarint64(value: number): void; @@ -524,19 +413,13 @@ export class BinaryEncoder { } export class BinaryDecoder { - constructor(bytes?: ByteSource, - start?: number, - length?: number) - static alloc(bytes?: ByteSource, - start?: number, - length?: number): BinaryDecoder; + constructor(bytes?: ByteSource, start?: number, length?: number) + static alloc(bytes?: ByteSource, start?: number, length?: number): BinaryDecoder; free(): void; clone(): BinaryDecoder; clear(): void; getBuffer(): Uint8Array; - setBlock(data: ByteSource, - start?: number, - length?: number): void; + setBlock(data: ByteSource, start?: number, length?: number): void; getEnd(): number; setEnd(end: number): void; reset(): void; @@ -581,21 +464,22 @@ export class BinaryDecoder { } export class BinaryIterator { - constructor(decoder?: BinaryDecoder, - next?: () => number|boolean|string|null, - elements?: Array) - static alloc(decoder?: BinaryDecoder, - next?: () => number|boolean|string|null, - elements?: Array): BinaryIterator; + constructor( + decoder?: BinaryDecoder, next?: () => number | boolean | string | null, + elements?: Array) + static alloc( + decoder?: BinaryDecoder, + next?: () => number | boolean | string | null, + elements?: Array): BinaryIterator; free(): void; clear(): void; - get(): (ScalarFieldType | null); + get(): ScalarFieldType | null; atEnd(): boolean; - next(): (ScalarFieldType | null); + next(): ScalarFieldType | null; } export namespace BinaryConstants { - export enum FieldType { + enum FieldType { INVALID = -1, DOUBLE = 1, FLOAT = 2, @@ -619,7 +503,7 @@ export namespace BinaryConstants { VHASH64 = 31, } - export enum WireType { + enum WireType { INVALID = -1, VARINT = 0, FIXED64 = 1, @@ -649,11 +533,10 @@ export namespace BinaryConstants { } export namespace arith { - export class UInt64 { + class UInt64 { lo: number; hi: number; - constructor(lo: number, - hi: number); + constructor(lo: number, hi: number); cmp(other: UInt64): number; rightShift(): UInt64; leftShift(): UInt64; @@ -662,8 +545,7 @@ export namespace arith { zero(): boolean; add(other: UInt64): UInt64; sub(other: UInt64): UInt64; - static mul32x32(a: number, - b: number): UInt64; + static mul32x32(a: number, b: number): UInt64; mul(a: number): UInt64; div(divisor: number): [UInt64, UInt64]; toString(): string; @@ -671,11 +553,10 @@ export namespace arith { clone(): UInt64; } - export class Int64 { + class Int64 { lo: number; hi: number; - constructor(lo: number, - hi: number); + constructor(lo: number, hi: number); add(other: Int64): Int64; sub(other: Int64): Int64; clone(): Int64; @@ -684,4 +565,4 @@ export namespace arith { } } -// jspb.utils package excluded as it likely shouldn't be called by user code \ No newline at end of file +// jspb.utils package excluded as it likely shouldn't be called by user code diff --git a/google.analytics/google.analytics-tests.ts b/google.analytics/google.analytics-tests.ts index 32df930cc9..ac2a99fd2e 100644 --- a/google.analytics/google.analytics-tests.ts +++ b/google.analytics/google.analytics-tests.ts @@ -40,10 +40,10 @@ describe('UniversalAnalytics', () => { ga.getByName('aNamedTracker'); }); it('should excercise Tracker APIs', () => { - var tracker: UniversalAnalytics.Tracker = ga.create('UA-65432-1', 'auto'); - var aString: string = tracker.get('aString'); - var aNumber: number = tracker.get('aNumber'); - var anObject: {} = tracker.get<{}>('anObject'); + const tracker: UniversalAnalytics.Tracker = ga.create('UA-65432-1', 'auto'); + const aString: string = tracker.get('aString'); + const aNumber: number = tracker.get('aNumber'); + const anObject: {} = tracker.get<{}>('anObject'); tracker.send('pageview'); tracker.send('pageview', {some: 'details'}); tracker.set('aString', aString); @@ -66,7 +66,6 @@ describe("tester Google Analytics Tracker _gat object", () => { it("can create _anonymizeIp", () => { _gat._anonymizeIp(); }); - }); describe("tester Google Analytics Code _gaq object", () => { @@ -76,17 +75,16 @@ describe("tester Google Analytics Code _gaq object", () => { _gaq.push(['_trackPageview']); _gaq.push(() => { - var tracker = _gat._getTrackerByName('UA-65432-1'); + const tracker = _gat._getTrackerByName('UA-65432-1'); tracker._trackPageview(); } ); }); }); - describe("tester Google Analytics Code Tracker object", () => { it("can create Tracker object and call methods", () => { - var tracker = _gat._getTrackerByName('UA-65432-1'); + const tracker = _gat._getTrackerByName('UA-65432-1'); tracker._trackPageview(); tracker._getName(); tracker._getAccount(); diff --git a/google.analytics/index.d.ts b/google.analytics/index.d.ts index bfed2eb277..c8bf91fd74 100644 --- a/google.analytics/index.d.ts +++ b/google.analytics/index.d.ts @@ -42,7 +42,7 @@ declare namespace UniversalAnalytics { enum HitType { 'pageview', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing' } - + // https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference interface FieldsObject { diff --git a/google.fonts/google.fonts-tests.ts b/google.fonts/google.fonts-tests.ts index 7d63cd77fd..dd401a340e 100644 --- a/google.fonts/google.fonts-tests.ts +++ b/google.fonts/google.fonts-tests.ts @@ -1,8 +1,7 @@ function test(list: google.fonts.WebfontList) { + const f = list.items[0]; - var f = list.items[0]; - - var info = [ + const info = [ f.category, f.family, f.kind, @@ -10,7 +9,7 @@ function test(list: google.fonts.WebfontList) { f.version ]; - var urls = f.variants.map( + const urls = f.variants.map( v => f.files[v] ); } diff --git a/google.fonts/index.d.ts b/google.fonts/index.d.ts index 959447b198..b5741ff196 100644 --- a/google.fonts/index.d.ts +++ b/google.fonts/index.d.ts @@ -4,13 +4,12 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace google.fonts { - - export interface WebfontList { + interface WebfontList { kind: string; items: WebfontFamily[]; } - export interface WebfontFamily { + interface WebfontFamily { category?: string; kind: string; family: string; diff --git a/graphite-udp/graphite-udp-tests.ts b/graphite-udp/graphite-udp-tests.ts index c61ad172cd..1cdb5d74e6 100644 --- a/graphite-udp/graphite-udp-tests.ts +++ b/graphite-udp/graphite-udp-tests.ts @@ -1,13 +1,13 @@ import graphite = require('graphite-udp'); // Test creation of client directly. -let client = new graphite.Client(); +const client = new graphite.Client(); client.put('test', 1); client.add('test', 1); client.close(); // Create client with helper -let client2 = graphite.createClient(); +const client2 = graphite.createClient(); client2.put('test2', 1); client2.add('test2', 1); client2.close(); @@ -22,9 +22,7 @@ graphite.createClient({ suffix: 'suffix', interval: 60 * 1000, verbose: true, - callback: (error: Error, metrics: any): void => { - - } + callback: (error: Error, metrics: any): void => {} }); // Test creation options with class directly. @@ -37,7 +35,5 @@ new graphite.Client({ suffix: 'suffix', interval: 60 * 1000, verbose: true, - callback: (error: Error, metrics: any): void => { - - } + callback: (error: Error, metrics: any): void => {} }); diff --git a/graphite-udp/index.d.ts b/graphite-udp/index.d.ts index 218888b39a..e36afa76d0 100644 --- a/graphite-udp/index.d.ts +++ b/graphite-udp/index.d.ts @@ -3,7 +3,6 @@ // Definitions by: Eric Byers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - interface ClientOptions { /** * graphite server host or ip @@ -65,7 +64,6 @@ interface ClientOptions { } export class Client { - constructor(clientOptions?: ClientOptions); /** diff --git a/griddle-react/index.d.ts b/griddle-react/index.d.ts index 7586e4dcbd..e8f817b5a1 100644 --- a/griddle-react/index.d.ts +++ b/griddle-react/index.d.ts @@ -30,7 +30,7 @@ SOFTWARE. import * as React from 'react'; -type ReactClass = React.ComponentClass | React.StatelessComponent +type ReactClass = React.ComponentClass | React.StatelessComponent; export interface CustomColumnComponentProps { data: any; @@ -80,9 +80,7 @@ export interface ColumnMetaData { visible?: boolean; } -export interface BodyCssClassNameFunction { - (rowData: T): string; -} +export type BodyCssClassNameFunction = (rowData: T) => string; export interface RowMetaData { bodyCssClassName?: BodyCssClassNameFunction | string; @@ -90,7 +88,7 @@ export interface RowMetaData { export interface GriddleProps { columns?: string[]; - columnMetadata?: ColumnMetaData[]; + columnMetadata?: Array>; rowMetadata?: RowMetaData; results?: T[]; resultsPerPage?: number; @@ -115,15 +113,15 @@ export interface GriddleProps { useCustomFilterer?: boolean; useCustomFilterComponent?: boolean; useGriddleStyles?: boolean; - customRowComponent?: ReactClass> - customGridComponent?: ReactClass> - customPagerComponent?: ReactClass - customFilterComponent?: ReactClass + customRowComponent?: ReactClass>; + customGridComponent?: ReactClass>; + customPagerComponent?: ReactClass; + customFilterComponent?: ReactClass; customFilterer?(items: T[], query: any): T[]; enableToggleCustom?: boolean; noDataMessage?: string; noDataClassName?: string; - customNoDataComponent?: ReactClass + customNoDataComponent?: ReactClass; showTableHeading?: boolean; showPager?: boolean; useFixedHeader?: boolean; @@ -136,7 +134,7 @@ export interface GriddleProps { externalCurrentPage?: number; externalSortColumn?: string; externalSortAscending?: boolean; - externalLoadingComponent?: ReactClass + externalLoadingComponent?: ReactClass; externalIsLoading?: boolean; enableInfiniteScroll?: boolean; bodyHeight?: number; diff --git a/griddle-react/test/CustomColumnComponent.tsx b/griddle-react/test/CustomColumnComponent.tsx index 83adc8f05a..e47b2c36bb 100644 --- a/griddle-react/test/CustomColumnComponent.tsx +++ b/griddle-react/test/CustomColumnComponent.tsx @@ -8,23 +8,23 @@ import * as React from 'react'; import Griddle, { CustomColumnComponentProps } from 'griddle-react'; interface MyCustomResult { - name: string, - test: string + name: string; + test: string; } class LinkComponent extends React.Component, any> { render() { - var url = "speakers/" + this.props.rowData.test + "/" + this.props.data; - return {this.props.data} + const url = "speakers/" + this.props.rowData.test + "/" + this.props.data; + return {this.props.data}; } } const StatelessFunctionComponent = (props: CustomColumnComponentProps) => { - var url = "speakers/" + props.rowData.test + "/" + props.data; - return {props.data} + const url = "speakers/" + props.rowData.test + "/" + props.data; + return {props.data}; }; -var columnMeta = [ +const columnMeta = [ { columnName: "name", order: 1, @@ -33,7 +33,7 @@ var columnMeta = [ customComponent: StatelessFunctionComponent }]; -var results: MyCustomResult[] = [ +const results: MyCustomResult[] = [ { name: 'David Hara', test: 'blah' @@ -44,7 +44,7 @@ var results: MyCustomResult[] = [ } ]; -var rowMetaData = { +const rowMetaData = { bodyCssClassName: (rowData: MyCustomResult) => { return rowData.test; } @@ -54,7 +54,7 @@ class CustomColumnComponentGrid extends React.Component { render() { type TypedGriddle = new () => Griddle; const TypedGriddle = Griddle as TypedGriddle; - + return ( { }; } -export default CustomColumnComponentGrid; \ No newline at end of file +export default CustomColumnComponentGrid; diff --git a/griddle-react/test/CustomFilterComponent.tsx b/griddle-react/test/CustomFilterComponent.tsx index e7508887f5..3de40132f1 100644 --- a/griddle-react/test/CustomFilterComponent.tsx +++ b/griddle-react/test/CustomFilterComponent.tsx @@ -10,7 +10,6 @@ import Griddle, { CustomFilterComponentProps } from 'griddle-react'; const CustomFilterFunction = (items: ResultType[], query: string): ResultType[] => { return _.filter(items, (item) => { - let match = false; _.forIn(item, (value, key) => { if (String(value).toLowerCase().indexOf(query.toLowerCase()) >= 0) { @@ -53,30 +52,29 @@ interface ResultType { favoriteNumber: number; } -var someData: ResultType[] = [ +const someData: ResultType[] = [ { - "id": 0, - "name": "Mayer Leonard", - "city": "Kapowsin", - "state": "Hawaii", - "country": "United Kingdom", - "company": "Ovolo", - "favoriteNumber": 7 + id: 0, + name: "Mayer Leonard", + city: "Kapowsin", + state: "Hawaii", + country: "United Kingdom", + company: "Ovolo", + favoriteNumber: 7 }, { - "id": 1, - "name": "Koch Becker", - "city": "Johnsonburg", - "state": "New Jersey", - "country": "Madagascar", - "company": "Eventage", - "favoriteNumber": 2 + id: 1, + name: "Koch Becker", + city: "Johnsonburg", + state: "New Jersey", + country: "Madagascar", + company: "Eventage", + favoriteNumber: 2 } ]; class CustomFilterComponentGrid extends React.Component { render() { - type TypedGriddle = new () => Griddle; const TypedGriddle = Griddle as TypedGriddle; diff --git a/griddle-react/test/CustomHeaderComponent.tsx b/griddle-react/test/CustomHeaderComponent.tsx index aed7d348aa..af9d1d6ea3 100644 --- a/griddle-react/test/CustomHeaderComponent.tsx +++ b/griddle-react/test/CustomHeaderComponent.tsx @@ -17,7 +17,7 @@ class HeaderComponent extends React.Component) { - this.props.filterByColumn(e.currentTarget.value, this.props.columnName) + this.props.filterByColumn(e.currentTarget.value, this.props.columnName); } render() { @@ -40,28 +40,28 @@ interface ResultType { favoriteNumber: number; } -var someData: ResultType[] = [ +const someData: ResultType[] = [ { - "id": 0, - "name": "Mayer Leonard", - "city": "Kapowsin", - "state": "Hawaii", - "country": "United Kingdom", - "company": "Ovolo", - "favoriteNumber": 7 + id: 0, + name: "Mayer Leonard", + city: "Kapowsin", + state: "Hawaii", + country: "United Kingdom", + company: "Ovolo", + favoriteNumber: 7 }, { - "id": 1, - "name": "Koch Becker", - "city": "Johnsonburg", - "state": "New Jersey", - "country": "Madagascar", - "company": "Eventage", - "favoriteNumber": 2 + id: 1, + name: "Koch Becker", + city: "Johnsonburg", + state: "New Jersey", + country: "Madagascar", + company: "Eventage", + favoriteNumber: 2 } ]; -var columnMeta: ColumnMetaData[] = [ +const columnMeta: Array> = [ { columnName: 'name', order: 1, @@ -82,7 +82,6 @@ var columnMeta: ColumnMetaData[] = [ class CustomHeaderComponentGrid extends React.Component { render() { - type TypedGriddle = new () => Griddle; const TypedGriddle = Griddle as TypedGriddle; diff --git a/griddle-react/griddle-react-tests.tsx b/griddle-react/test/index.tsx similarity index 73% rename from griddle-react/griddle-react-tests.tsx rename to griddle-react/test/index.tsx index 5f241feeb5..3e0b1c76ff 100644 --- a/griddle-react/griddle-react-tests.tsx +++ b/griddle-react/test/index.tsx @@ -7,28 +7,28 @@ Copyright (c) 2016 David Hara import * as React from 'react'; import { render } from 'react-dom'; import Griddle, { CustomColumnComponentProps } from 'griddle-react'; -import CustomColumnComponentGrid from './test/CustomColumnComponent'; -import CustomHeaderComponentGrid from './test/CustomHeaderComponent'; -import CustomFilterComponentGrid from './test/CustomFilterComponent'; +import CustomColumnComponentGrid from './CustomColumnComponent'; +import CustomHeaderComponentGrid from './CustomHeaderComponent'; +import CustomFilterComponentGrid from './CustomFilterComponent'; interface MyCustomResult { - name: string, - test: string + name: string; + test: string; } class LinkComponent extends React.Component, any> { render() { - var url = "speakers/" + this.props.rowData.test + "/" + this.props.data; - return {this.props.data} + const url = "speakers/" + this.props.rowData.test + "/" + this.props.data; + return {this.props.data}; } } const StatelessFunctionComponent = (props: CustomColumnComponentProps) => { - var url = "speakers/" + props.rowData.test + "/" + props.data; - return {props.data} + const url = "speakers/" + props.rowData.test + "/" + props.data; + return {props.data}; }; -var columnMeta = [ +const columnMeta = [ { columnName: "name", order: 1, @@ -37,7 +37,7 @@ var columnMeta = [ customComponent: StatelessFunctionComponent }]; -var results: MyCustomResult[] = [ +const results: MyCustomResult[] = [ { name: 'David Hara', test: 'blah' @@ -48,7 +48,7 @@ var results: MyCustomResult[] = [ } ]; -var rowMetaData = { +const rowMetaData = { bodyCssClassName: (rowData: MyCustomResult) => { return rowData.test; } diff --git a/griddle-react/tsconfig.json b/griddle-react/tsconfig.json index 5dd6f9d98b..3de8b9abda 100644 --- a/griddle-react/tsconfig.json +++ b/griddle-react/tsconfig.json @@ -19,7 +19,7 @@ }, "files": [ "index.d.ts", - "griddle-react-tests.tsx", + "test/index.tsx", "test/CustomColumnComponent.tsx", "test/CustomFilterComponent.tsx", "test/CustomHeaderComponent.tsx" diff --git a/handsontable/handsontable-tests.ts b/handsontable/handsontable-tests.ts index f744c10483..8ff99cc0b7 100644 --- a/handsontable/handsontable-tests.ts +++ b/handsontable/handsontable-tests.ts @@ -1,8 +1,6 @@ - - function test_HandsontableInit() { - var elem = document.createElement('div'); - var hot = new Handsontable(elem, { + const elem = document.createElement('div'); + const hot = new Handsontable(elem, { allowEmpty: true, allowInsertColumn: true, allowInsertRow: true, @@ -206,8 +204,8 @@ function test_HandsontableInit() { } function test_HandsontableMethods() { - var elem = document.createElement('div'); - var hot = new Handsontable(elem, {}); + const elem = document.createElement('div'); + const hot = new Handsontable(elem, {}); hot.addHook('foo', []); hot.addHookOnce('foo', []); hot.alter('foo', 123, 123, 'foo', true); @@ -298,4 +296,4 @@ class MyCustomHotPlugin extends Handsontable.plugins.BasePlugin { isEnabled(): boolean { return !!this.hot.getSettings().manualRowMove; } -} \ No newline at end of file +} diff --git a/handsontable/index.d.ts b/handsontable/index.d.ts index e569ee58f7..ed2f0db27f 100644 --- a/handsontable/index.d.ts +++ b/handsontable/index.d.ts @@ -311,7 +311,6 @@ declare namespace ht { editor?: string | EditorConstructor; selectOptions?: any[]; width?: number; - } interface CellProperties { @@ -506,7 +505,7 @@ declare var Handsontable: { }; declare module "handsontable" { - export var Handsontable: { + const Handsontable: { new (element: Element, options: ht.Options): ht.Methods; plugins: ht.Plugins; hooks: ht.Hooks; diff --git a/highcharts/highstock.d.ts b/highcharts/highstock.d.ts index bd7f0bffd4..35c1179ff1 100644 --- a/highcharts/highstock.d.ts +++ b/highcharts/highstock.d.ts @@ -30,10 +30,10 @@ declare namespace Highstock { } interface RangeSelectorButton { - type: string; //Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'. + type: string; // Defines the timespan, can be one of 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' and 'all'. count?: number; text: string; - dataGrouping?: any; //not sure how this works + dataGrouping?: any; // not sure how this works } interface RangeSelectorOptions { @@ -97,7 +97,6 @@ declare namespace Highstock { } } - declare global { interface JQuery { highcharts(type: "StockChart"): Highstock.ChartObject; @@ -117,7 +116,6 @@ declare global { **/ highcharts(type: "StockChart", options: Highstock.Options, callback: (chart: Highstock.ChartObject) => void): JQuery; - highcharts(type: string): Highcharts.ChartObject; highcharts(type: string, options: Highcharts.Options): JQuery; highcharts(type: string, options: Highcharts.Options, callback: (chart: Highcharts.ChartObject) => void): JQuery; @@ -126,4 +124,4 @@ declare global { declare var Highstock: Highstock.Static; export = Highstock; -export as namespace Highstock; \ No newline at end of file +export as namespace Highstock; diff --git a/highcharts/index.d.ts b/highcharts/index.d.ts index 1885d5940f..9fe60ef542 100644 --- a/highcharts/index.d.ts +++ b/highcharts/index.d.ts @@ -530,8 +530,8 @@ declare namespace Highcharts { */ gridLineColor?: string; /** - * The dash or dot style of the grid lines. For possible values, - * see {@http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/plotoptions/series-dashstyle-all/|this demonstration}. + * The dash or dot style of the grid lines. For possible values, + * see {@http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/plotoptions/series-dashstyle-all/|this demonstration}. * Defaults to Solid. * @since 1.2 */ @@ -629,7 +629,7 @@ declare namespace Highcharts { */ minorGridLineColor?: string; /** - * The dash or dot style of the minor grid lines. For possible values, + * The dash or dot style of the minor grid lines. For possible values, * see {@link http://jsfiddle.net/gh/get/jquery/1.7.1/highslide-software/highcharts.com/tree/master/samples/highcharts/plotoptions/series-dashstyle-all/|this demonstration}. * @default 'Solid' */ @@ -3329,7 +3329,6 @@ declare namespace Highcharts { * The default action is to toggle the visibility of the point. This can be prevented by calling event.preventDefault(). */ legendItemClick?: (event: Event) => boolean | void; - } interface Halo { @@ -5318,7 +5317,7 @@ declare namespace Highcharts { interface CrosshairObject { color?: string | Gradient; width?: number; - dashStyle?: string; //Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot + dashStyle?: string; // Solid ShortDash ShortDot ShortDashDot ShortDashDotDot Dot Dash LongDash DashDot LongDashDot LongDashDotDot zIndex?: number; } @@ -5741,7 +5740,7 @@ declare namespace Highcharts { * @param {number} min The new minimum value * @param {number} max The new maximum value * @param {boolean} redraw Whether to redraw the chart or wait for an explicit call to chart.redraw(). - * @param {boolean | Animation} animation When true, the resize will be animated with default animation options. + * @param {boolean | Animation} animation When true, the resize will be animated with default animation options. * The animation can also be a configuration object with properties duration and easing. * @since 1.2.0 */ @@ -5792,7 +5791,7 @@ declare namespace Highcharts { * @param {AxisOptions} options The Axis options, as documented under xAxis and yAxis. * @param [boolean] isX Whether it is an X axis or Y axis * @param [boolean] redraw Defaults to true. Whether to redraw the chart after the series is added. See the redraw() method. - * @param [boolean | Animation] animation Defaults to true. When true, the series' updating will be animated with default animation options. + * @param [boolean | Animation] animation Defaults to true. When true, the series' updating will be animated with default animation options. * The animation can also be a configuration object with properties duration and easing. * @return {AxisObject} * @since 3.0 @@ -5841,9 +5840,9 @@ declare namespace Highcharts { /** * Exporting module required. Submit an SVG version of the chart to a server along with some parameters for * conversion. - * @param {ExportingOptions} options Exporting options. Out of the exporting options, the following options can be given as parameters to the exportChart method. - * All options default to the values given in the exporting config options. filename: the filename for the export without extension, - * url: the URL for the server module to do the conversion, width: the width of the PNG or JPEG image generated on the server, + * @param {ExportingOptions} options Exporting options. Out of the exporting options, the following options can be given as parameters to the exportChart method. + * All options default to the values given in the exporting config options. filename: the filename for the export without extension, + * url: the URL for the server module to do the conversion, width: the width of the PNG or JPEG image generated on the server, * type: the MIME type of the converted image, sourceWidth: the width of the source (in-page) chart, sourceHeight: the height of the source chart. * @since 2.0 */ @@ -5851,9 +5850,9 @@ declare namespace Highcharts { /** * Exporting module required. Submit an SVG version of the chart to a server along with some parameters for * conversion. - * @param {ExportingOptions} options Exporting options. Out of the exporting options, the following options can be given as parameters to the exportChart method. - * All options default to the values given in the exporting config options. filename: the filename for the export without extension, - * url: the URL for the server module to do the conversion, width: the width of the PNG or JPEG image generated on the server, + * @param {ExportingOptions} options Exporting options. Out of the exporting options, the following options can be given as parameters to the exportChart method. + * All options default to the values given in the exporting config options. filename: the filename for the export without extension, + * url: the URL for the server module to do the conversion, width: the width of the PNG or JPEG image generated on the server, * type: the MIME type of the converted image, sourceWidth: the width of the source (in-page) chart, sourceHeight: the height of the source chart. * @param {Options} chartOptions Additional chart options for the exported chart. For example a different background color can be added here. * @since 2.0 @@ -5892,7 +5891,7 @@ declare namespace Highcharts { get(id: string): AxisObject | SeriesObject | PointObject; /** * Exporting module required. Get an SVG string representing the chart. - * @param {Options} additionalOptions Chart options to add to the exported chart in addition to the options given for the original chart. + * @param {Options} additionalOptions Chart options to add to the exported chart in addition to the options given for the original chart. * For example if series.lineWidth should be greater in the exported chart than in the original, or the chart should have a different background color, this is added here. * @return {string} * @since 2.0 @@ -5934,7 +5933,7 @@ declare namespace Highcharts { * more than one operation on the chart before redrawing, for example add a number of points. In those cases it is a * waste of resources to redraw the chart for each new point added. So you add the points and call chart.redraw() * after. - * @param [boolean | Animation] animation Defaults to true. When true, the update will be animated with default animation options. + * @param [boolean | Animation] animation Defaults to true. When true, the update will be animated with default animation options. * The animation can also be a configuration object with properties duration and easing. * @since 1.2.0 */ @@ -6018,9 +6017,9 @@ declare namespace Highcharts { /** * This is the constructor for creating a new chart object. * @param {Options} options The chart options - * @param callback A function to execute when the chart object is finished loading and rendering. In most cases the chart is built in one thread, - * but in Internet Explorer version 8 or less the chart is sometimes initiated before the document is ready, - * and in these cases the chart object will not be finished directly after callingnew Highcharts.Chart(). + * @param callback A function to execute when the chart object is finished loading and rendering. In most cases the chart is built in one thread, + * but in Internet Explorer version 8 or less the chart is sometimes initiated before the document is ready, + * and in these cases the chart object will not be finished directly after callingnew Highcharts.Chart(). * s a consequence, code that relies on the newly built Chart object should always run in the callback. Defining a chart.event.load handler is equivalent. * @return {ChartObject} */ @@ -6036,9 +6035,9 @@ declare namespace Highcharts { * This is the constructor for creating a new chart object. * @param {string|HTMLElement} renderTo The id or a reference to a DOM element where the chart should be rendered (since v4.2.0). * @param {Options} options The chart options - * @param callback A function to execute when the chart object is finished loading and rendering. In most cases the chart is built in one thread, - * but in Internet Explorer version 8 or less the chart is sometimes initiated before the document is ready, - * and in these cases the chart object will not be finished directly after callingnew Highcharts.Chart(). + * @param callback A function to execute when the chart object is finished loading and rendering. In most cases the chart is built in one thread, + * but in Internet Explorer version 8 or less the chart is sometimes initiated before the document is ready, + * and in these cases the chart object will not be finished directly after callingnew Highcharts.Chart(). * As a consequence, code that relies on the newly built Chart object should always run in the callback. Defining a chart.event.load handler is equivalent. * @return {ChartObject} */ @@ -6062,7 +6061,7 @@ declare namespace Highcharts { * Apply numeric attributes to the SVG/VML element by animation. See Element.attr() for more information on setting * attributes. * @param {any} attributes A set of attributes to apply. - * @param {any} animation Optional animation parameters that are passed over to jQuery or other framework. + * @param {any} animation Optional animation parameters that are passed over to jQuery or other framework. * Valid properties depend on the library, but options like duration, easing and complete are supported by jQuery. * @return {ElementObject} * @since 2.0 @@ -6152,7 +6151,7 @@ declare namespace Highcharts { circle(centerX: number, centerY: number, radius: number): ElementObject; /** * Add an SVG/VML group. - * @param [string] name The name of the group. This will be used in the class name, which will be 'highcharts-'+ name. + * @param [string] name The name of the group. This will be used in the class name, which will be 'highcharts-'+ name. * Other Element objects are added to the group by using the group as the first parameter in .add() for the wrappers * @return {ElementObject} * @since 2.0 @@ -6181,7 +6180,7 @@ declare namespace Highcharts { * @param [number] anchorX If the shape has a pointer, like the chevron on a callout shape, anchorX is the x position to point to. * @param [number] anchorY If the shape has a pointer, like the chevron on a callout shape, anchorY is the y position to point to. * @param [boolean] useHTML Use HTML to render the text of the label. - * @param [boolean] baseline Whether the label should be vertically aligned by the text baseline, which makes it behave like the text element, + * @param [boolean] baseline Whether the label should be vertically aligned by the text baseline, which makes it behave like the text element, * or by the top left side, which makes it behave like a HTML div. * @param [string] className A class name for the g element surrounding the label. * @return {ElementObject} @@ -6309,9 +6308,9 @@ declare namespace Highcharts { percentage: number; /** * Remove the point from the series. - * @param [boolean] redraw Defaults to true. Whether to redraw the chart after the point is removed.If doing more operations on the chart, + * @param [boolean] redraw Defaults to true. Whether to redraw the chart after the point is removed.If doing more operations on the chart, * it is a good idea to set redraw to false and call chart.redraw() after. - * @param [boolean|Animation] animation Defaults to true. When true, the graph's updating will be animated with default animation options. + * @param [boolean|Animation] animation Defaults to true. When true, the graph's updating will be animated with default animation options. * The animation can also be a configuration object with properties duration and easing. * @since 1.2.0 */ @@ -6319,7 +6318,7 @@ declare namespace Highcharts { /** * Select or unselect the point. * @param [boolean] select When true, the point is selected. When false, the point is unselected. When null or undefined, the selection state is toggled. - * @param [boolean] accumulate When true, the selection is added to other selected points. When false, other selected points are deselected. + * @param [boolean] accumulate When true, the selection is added to other selected points. When false, other selected points are deselected. * Internally in Highcharts,selected points are accumulated on Control, Shift or Cmd clicking the point. * @since 1.2.0 */ @@ -6339,7 +6338,7 @@ declare namespace Highcharts { * is selected. * @param [boolean] sliced When true, the point is sliced out. When false, the point is set in. When null or undefined, the sliced state is toggled. * @param [boolean] redraw Defaults to true. Whether to redraw the chart after the point is altered. - * @param [boolean|Animation] animation Defaults to true. When true, the move will be animated with default animation options. + * @param [boolean|Animation] animation Defaults to true. When true, the move will be animated with default animation options. * The animation can also be a configuration object with properties duration and easing. * @since 1.2.0 */ @@ -6350,12 +6349,12 @@ declare namespace Highcharts { total: number; /** * Update the point with new values. - * @param {number|[number,number]|DataPoint} options The point options. Point options are handled as described under the series.data item for each series type. - * For example for a line series, if options is a single number, the point will be given that number as the main y value. If it is an array, + * @param {number|[number,number]|DataPoint} options The point options. Point options are handled as described under the series.data item for each series type. + * For example for a line series, if options is a single number, the point will be given that number as the main y value. If it is an array, * it will be interpreted as x and y values respectively. If it is an object, advanced options are applied. - * @param [boolean] redraw Defaults to true. Whether to redraw the chart after the point is updated.If doing more operations on the chart, + * @param [boolean] redraw Defaults to true. Whether to redraw the chart after the point is updated.If doing more operations on the chart, * it is a good idea to set redraw to false and call chart.redraw() after. - * @param {boolean|Animation} animation Defaults to true. When true, the update will be animated with default animation options. + * @param {boolean|Animation} animation Defaults to true. When true, the update will be animated with default animation options. * The animation can also be a configuration object with properties duration and easing. * @since 1.2.0 */ @@ -6392,11 +6391,11 @@ declare namespace Highcharts { * the start or in the middle of the series. * @param {number|[number,number]|DataPoint} The point options. If options is a single number, a point with that y value is appended to the series. * If it is an array, it will be interpreted as x and y values respectively. If it is an object, advanced options as outlined under series.data are applied. - * @param [boolean=true] redraw - Whether to redraw the chart after the point is added. When adding more than one point, + * @param [boolean=true] redraw - Whether to redraw the chart after the point is added. When adding more than one point, * it is highly recommended that the redraw option be set to false, and instead chart.redraw() is explicitly called after the adding of points is finished. - * @param [boolean=false] shift - When shift is true, one point is shifted off the start of the series as one is appended to the end. + * @param [boolean=false] shift - When shift is true, one point is shifted off the start of the series as one is appended to the end. * Use this option for live charts monitoring a value over time. - * @param [(boolean|Animation)=false] animation - When shift is true, one point is shifted off the start of the series as one is appended to the end. + * @param [(boolean|Animation)=false] animation - When shift is true, one point is shifted off the start of the series as one is appended to the end. * Use this option for live charts monitoring a value over time. * @since 1.2.0 */ @@ -6429,7 +6428,7 @@ declare namespace Highcharts { options: IndividualSeriesOptions; /** * Remove the series from the chart. - * @param [boolean=true] redraw - Whether to redraw the chart after the series is removed.If doing more operations on the chart, + * @param [boolean=true] redraw - Whether to redraw the chart after the series is removed.If doing more operations on the chart, * it is a good idea to set redraw to false and call chart.redraw() after. * @since 1.2.0 */ @@ -6440,7 +6439,7 @@ declare namespace Highcharts { * @param {number} index - The index of the point in the data array. * @param [boolean=true] redraw - Whether to redraw the chart after the point is added. When adding more than one point, * it is highly recommended that the redraw option be set to false, and instead chart.redraw() is explicitly called after the adding of points is finished. - * @param [boolean|Animation=true] animation - When true, the graph will be animated with default animation options. + * @param [boolean|Animation=true] animation - When true, the graph will be animated with default animation options. * The animation can also be a configuration object with properties duration and easing. * @since 4.1.0 */ @@ -6461,11 +6460,11 @@ declare namespace Highcharts { * Apply a new set of data to the series and optionally redraw it. Note that this method throws away all points and * creates new ones. For updating the values of existing points, use Point.update() instead. * @param {number[]|number[][]|DataPoint[]} data - Takes an array of data in the same format as described under seriesdata for the given series type. - * @param [boolean=true] redraw - Whether to redraw the chart after the series is altered.If doing more operations on the chart, + * @param [boolean=true] redraw - Whether to redraw the chart after the series is altered.If doing more operations on the chart, * it is a good idea to set redraw to false and call chart.redraw() after. - * @param [boolean|Animation] animation - When the updated data is the same length as the existing data, points will be updated by default, + * @param [boolean|Animation] animation - When the updated data is the same length as the existing data, points will be updated by default, * and animation visualizes how the points are changed. Set false to disable animation, or a configuration object to set duration or easing. - * @param [boolean] updatePoints - When the updated data is the same length as the existing data, points will be updated instead of replace. + * @param [boolean] updatePoints - When the updated data is the same length as the existing data, points will be updated instead of replace. * This option prevents this, and makes setData behave like it did prior to Highcharts 3.0.10. * @since 1.2.0 */ @@ -6473,7 +6472,7 @@ declare namespace Highcharts { /** * A utility function to show or hide the series with an optional redraw. * @param [boolean] visible - Whether to show or hide the series. If undefined, the visibility is toggled. - * @param [boolean=true] redraw - Whether to redraw the chart after the series is altered.If doing more operations on the chart, + * @param [boolean=true] redraw - Whether to redraw the chart after the series is altered.If doing more operations on the chart, * it is a good idea to set redraw to false and call chart.redraw() after. * @since 1.2.0 */ @@ -6493,7 +6492,7 @@ declare namespace Highcharts { * elements from the series is removed, and it is initiated from scratch. Therefore, this method is more performance * expensive than some other utility methods like setData or setVisible. * @param {IndividualSeriesOptions} options New options that will be merged into the series' existing options. - * @param [boolean] redraw - Whether to redraw the chart after the series is altered. If doing more operations on the chart, + * @param [boolean] redraw - Whether to redraw the chart after the series is altered. If doing more operations on the chart, * it is a good idea to set redraw to false and call chart.redraw() after. * @since 1.2.0 */ diff --git a/highcharts/modules/map/index.d.ts b/highcharts/modules/map/index.d.ts index d5945ddbf7..04d5a77aea 100644 --- a/highcharts/modules/map/index.d.ts +++ b/highcharts/modules/map/index.d.ts @@ -7,11 +7,11 @@ import * as highcharts from 'highcharts'; import * as geojson from 'geojson'; declare module 'highcharts' { - export interface Static { + interface Static { mapChart(renderTo: string | HTMLElement, options: MapOptions, callback?: (chart: highcharts.ChartObject) => void): highcharts.ChartObject; } - export interface MapOptions { + interface MapOptions { chart?: highcharts.ChartOptions; legend?: highcharts.LegendOptions; @@ -43,24 +43,13 @@ declare module 'highcharts' { type?: string; } - export interface Navigation { + interface Navigation {} - } + interface MapSeriesOptionsDataLabels {} - export interface MapSeriesOptionsDataLabels { + interface MapSeriesOptionsStates {} - } + interface MapSeriesOptionsTooltip {} - export interface MapSeriesOptionsStates { - - } - - export interface MapSeriesOptionsTooltip { - - } - - export interface ColorAxis { - - } + interface ColorAxis {} } - diff --git a/highcharts/test/highstock.ts b/highcharts/test/highstock.ts index f4ba041caa..7fde17d3ce 100644 --- a/highcharts/test/highstock.ts +++ b/highcharts/test/highstock.ts @@ -1,11 +1,10 @@ /// import * as Highcharts from "highcharts"; -var someData = [1, 2, 3, 4, 5, 6, 7, 8, 9]; +const someData = [1, 2, 3, 4, 5, 6, 7, 8, 9]; $(() => { $('#container').highcharts('StockChart', { - chart: { type: "arearange" }, diff --git a/highcharts/test/index.ts b/highcharts/test/index.ts index 88fa3e8114..622ebfa8be 100644 --- a/highcharts/test/index.ts +++ b/highcharts/test/index.ts @@ -1,5 +1,5 @@ -/// -import * as Highcharts from "highcharts"; // May also use /// +/// +import * as Highcharts from "highcharts"; // May also use /// function originalTests() { Highcharts.setOptions({ @@ -15,14 +15,12 @@ function originalTests() { } }); - - var animate: Highcharts.Animation = { + const animate: Highcharts.Animation = { duration: 200, easing: "linear" }; - - var gradient: Highcharts.Gradient = { + const gradient: Highcharts.Gradient = { linearGradient: { x1: 0, y1: 0, @@ -33,11 +31,11 @@ function originalTests() { [0, 'rgb(255, 255, 255)'], [1, 'rgb(200, 200, 255)'] ] - } + }; - var color = "#fcfcff"; + const color = "#fcfcff"; - var chart1 = new Highcharts.Chart({ + const chart1 = new Highcharts.Chart({ chart: { renderTo: "container" }, @@ -56,7 +54,7 @@ function originalTests() { console.log(( chart1.series[0].options).dashStyle); - var chart2 = new Highcharts.Chart({ + const chart2 = new Highcharts.Chart({ chart: { renderTo: 'container', width: 400, @@ -109,11 +107,11 @@ function originalTests() { }] }); - var div: HTMLDivElement; - var r = new Highcharts.Renderer(div, 20, 30); - var box = r.text("Hello", 10, 10).getBBox(); + const div: HTMLDivElement = null as any; + const r = new Highcharts.Renderer(div, 20, 30); + const box = r.text("Hello", 10, 10).getBBox(); - var highChartSettings: Highcharts.Options = { + const highChartSettings: Highcharts.Options = { chart: { width: 400, height: 400 @@ -125,18 +123,18 @@ function originalTests() { }] }; - var container = $("#container").highcharts(highChartSettings, (chart) => { + const container = $("#container").highcharts(highChartSettings, (chart) => { chart.series[0].setVisible(true, true); }); - var singleYAxisOptions: Highcharts.Options = { + const singleYAxisOptions: Highcharts.Options = { yAxis: {} }; - var multipleYAxisOptions: Highcharts.Options = { + const multipleYAxisOptions: Highcharts.Options = { yAxis: [{}, {}] }; - var renderToIdChart = new Highcharts.Chart("container", { + const renderToIdChart = new Highcharts.Chart("container", { xAxis: {}, series: [ { data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], @@ -145,7 +143,7 @@ function originalTests() { }] }); - var renderToElementChart = new Highcharts.Chart(div, { + const renderToElementChart = new Highcharts.Chart(div, { xAxis: {}, series: [ { data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], @@ -154,7 +152,7 @@ function originalTests() { }] }); - var createWithFunction = Highcharts.chart({ + const createWithFunction = Highcharts.chart({ xAxis: {}, series: [ { data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], @@ -163,7 +161,7 @@ function originalTests() { }] }); - var createWithFunctionRenderToId = Highcharts.chart("container", { + const createWithFunctionRenderToId = Highcharts.chart("container", { xAxis: {}, series: [ { data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], @@ -172,7 +170,7 @@ function originalTests() { }] }); - var createWithFunctionRenderToElement = Highcharts.chart(div, { + const createWithFunctionRenderToElement = Highcharts.chart(div, { xAxis: {}, series: [ { data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4], @@ -183,7 +181,7 @@ function originalTests() { } function test_alldefaults() { - var options: Highcharts.Options = { + const options: Highcharts.Options = { chart: {}, credits: {}, data: {}, @@ -207,13 +205,13 @@ function test_alldefaults() { } function test_ChartOptions() { - var emptyChartOptions: Highcharts.ChartOptions = { + const emptyChartOptions: Highcharts.ChartOptions = { events: {}, options3d: {}, resetZoomButton: {} }; - var allValuesSet: Highcharts.ChartOptions = { + const allValuesSet: Highcharts.ChartOptions = { alignTicks: false, animation: { duration: 500, @@ -320,7 +318,7 @@ function test_ChartOptions() { zoomType: "x" }; - //alignticks example + // alignticks example $('#container').highcharts({ chart: { alignTicks: true, @@ -350,7 +348,7 @@ function test_ChartOptions() { y: 70 }, tooltip: { - formatter: function () { + formatter() { return ' ' + this.series.name + '
' + this.x + ': ' + this.y; } }, @@ -378,9 +376,9 @@ function test_ChartOptions() { data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4] }] }); - var i = 1; + let i = 1; $('#update').click(() => { - var chart = $('#container').highcharts(); + const chart = $('#container').highcharts(); chart.series[0].data[0].update(i % 2 ? 200 : 0); i += 1; }); @@ -410,7 +408,7 @@ function test_ChartOptions() { y: 70 }, tooltip: { - formatter: function () { + formatter() { return ` ${this.series.name}
${this.x}: ${this.y}`; } }, @@ -448,8 +446,8 @@ function test_ChartOptions() { $('#container').highcharts({ chart: { events: { - addSeries: function () { - var label = ( this).renderer.label('A series was added, about to redraw chart', 100, 120) + addSeries() { + const label = ( this).renderer.label('A series was added, about to redraw chart', 100, 120) .attr({ fill: Highcharts.getOptions().colors[0], padding: 10, @@ -477,7 +475,7 @@ function test_ChartOptions() { // activate the button $('#button').click(() => { - var chart = $('#container').highcharts(); + const chart = $('#container').highcharts(); chart.addSeries({ data: [216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5] @@ -578,7 +576,7 @@ function test_ChartOptions() { } function test_CreditsOptions() { - var allDefaults: Highcharts.CreditsOptions = {}; + const allDefaults: Highcharts.CreditsOptions = {}; // custom url and text example $('#container').highcharts({ @@ -597,7 +595,7 @@ function test_CreditsOptions() { function test_Data() { // all defaults - var data: Highcharts.DataOptions = {}; + const data: Highcharts.DataOptions = {}; // data from table example $('#container').highcharts({ @@ -675,7 +673,7 @@ function test_Data() { } function test_Drilldown() { - var allDefaults: Highcharts.DrilldownOptions = {}; + const allDefaults: Highcharts.DrilldownOptions = {}; // multiseries drilldown example $('#container').highcharts({ @@ -858,7 +856,7 @@ function test_Drilldown() { } function test_Exporting() { - var allDefaults: Highcharts.ExportingOptions = {}; + const allDefaults: Highcharts.ExportingOptions = {}; // source size example $('#container').highcharts({ @@ -890,13 +888,13 @@ function test_Exporting() { } function test_Loading() { - var allDefaults: Highcharts.LoadingOptions = {}; + const allDefaults: Highcharts.LoadingOptions = {}; // examples // the button handler - var isLoading = false, - $button = $('#button'), - chart: Highcharts.ChartObject; + let isLoading = false; + const $button = $('#button'); + let chart: Highcharts.ChartObject; $button.click(() => { if (!isLoading) { @@ -932,7 +930,7 @@ function test_Loading() { } function test_Navigation() { - var allDefaults: Highcharts.NavigationOptions = {}; + const allDefaults: Highcharts.NavigationOptions = {}; // examples $('#container').highcharts({ @@ -974,7 +972,7 @@ function test_Navigation() { } function test_NoData() { - var allDefaults: Highcharts.NoDataOptions = {}; + const allDefaults: Highcharts.NoDataOptions = {}; // example $('#container').highcharts({ @@ -1000,7 +998,7 @@ function test_NoData() { } function test_AreaOptions() { - var allDefaults: Highcharts.AreaChartSeriesOptions = {}; + const allDefaults: Highcharts.AreaChartSeriesOptions = {}; // examples $('#container').highcharts({ @@ -1036,7 +1034,7 @@ function test_AreaOptions() { } function test_AreaRange() { - var allDefaults: Highcharts.AreaRangeChartSeriesOptions = {}; + const allDefaults: Highcharts.AreaRangeChartSeriesOptions = {}; // example $('#container').highcharts({ @@ -1046,8 +1044,7 @@ function test_AreaRange() { }, series: [ { data: (((arr: number[], len: number) => { - var i: number; - for (i = 0; i < len; i = i + 1) { + for (let i = 0; i < len; i = i + 1) { arr.push(i); } return arr; @@ -1092,20 +1089,19 @@ function test_AreaRange() { }, series: [ { name: 'Temperatures', - data: data, + data, dataLabels: { enabled: true, yHigh: 20, yLow: -20 } }] - }); }); } function test_Bar() { - var allDefaults: Highcharts.BarChartSeriesOptions = {}; + const allDefaults: Highcharts.BarChartSeriesOptions = {}; $('#container').highcharts({ chart: { @@ -1230,7 +1226,7 @@ function test_Bar() { } function test_BoxPlot() { - var allDefaults: Highcharts.BoxPlotChartSeriesOptions = {}; + const allDefaults: Highcharts.BoxPlotChartSeriesOptions = {}; // boxplot example $('#container').highcharts({ @@ -1282,7 +1278,7 @@ function test_BoxPlot() { } function test_Bubble() { - var allDefaults: Highcharts.BubbleChartSeriesOptions = {}; + const allDefaults: Highcharts.BubbleChartSeriesOptions = {}; // bubble example $('#container').highcharts({ @@ -1365,19 +1361,19 @@ function test_Bubble() { } function test_Column() { - var allDefaults: Highcharts.ColumnChartSeriesOptions = {}; + const allDefaults: Highcharts.ColumnChartSeriesOptions = {}; // same options as bar chart } function test_ColumnRange() { - var allDefaults: Highcharts.ColumnRangeChartSeriesOptions = {}; + const allDefaults: Highcharts.ColumnRangeChartSeriesOptions = {}; // same options as bar chart and datalabels from arearange } function test_ErrorBar() { - var allDefaults: Highcharts.ErrorBarChartSeriesOptions = {}; + const allDefaults: Highcharts.ErrorBarChartSeriesOptions = {}; // error bar styling example $('#container').highcharts({ @@ -1428,7 +1424,7 @@ function test_ErrorBar() { } function test_Funnel() { - var allDefaults: Highcharts.FunnelChartSeriesOptions = {}; + const allDefaults: Highcharts.FunnelChartSeriesOptions = {}; // funnel demo $('#container').highcharts({ @@ -1472,7 +1468,7 @@ function test_Funnel() { } function test_Gauge() { - var allDefaults: Highcharts.GaugeChartSeriesOptions = {}; + const allDefaults: Highcharts.GaugeChartSeriesOptions = {}; // example $('#container').highcharts({ @@ -1526,7 +1522,7 @@ function test_Gauge() { } function test_HeatMap() { - var allDefaults: Highcharts.HeatMapSeriesOptions = {}; + const allDefaults: Highcharts.HeatMapSeriesOptions = {}; // heatmap demo $('#container').highcharts({ @@ -1586,7 +1582,7 @@ function test_HeatMap() { } function test_Line() { - var allDefaults: Highcharts.LineChartSeriesOptions = {}; + const allDefaults: Highcharts.LineChartSeriesOptions = {}; // step example $('#container').highcharts({ @@ -1616,7 +1612,7 @@ function test_Line() { } function test_Pie() { - var allDefaults: Highcharts.PieChartSeriesOptions = {}; + const allDefaults: Highcharts.PieChartSeriesOptions = {}; // pie demo $('#container').highcharts({ @@ -1757,7 +1753,7 @@ function test_Pie() { } function test_Polygon() { - var allDefaults: Highcharts.PolygonChartSeriesOptions = {}; + const allDefaults: Highcharts.PolygonChartSeriesOptions = {}; $('#container').highcharts({ chart: { @@ -1786,7 +1782,7 @@ function test_Polygon() { } function test_Pyramid() { - var allDefaults: Highcharts.PyramidChartSeriesOptions = {}; + const allDefaults: Highcharts.PyramidChartSeriesOptions = {}; // pyramid demo $('#container').highcharts({ @@ -1825,10 +1821,10 @@ function test_Pyramid() { } function test_SolidGauge() { - var allDefaults: Highcharts.SolidGaugeChartSeriesOptions = {}; + const allDefaults: Highcharts.SolidGaugeChartSeriesOptions = {}; // partial solid gauge demo - var gaugeOptions: Highcharts.Options = { + const gaugeOptions: Highcharts.Options = { chart: { type: 'solidgauge' }, @@ -1880,10 +1876,10 @@ function test_SolidGauge() { } function test_TreeMap() { - var allDefaults: Highcharts.TreeMapChartSeriesOptions = {}; + const allDefaults: Highcharts.TreeMapChartSeriesOptions = {}; // allowDrillToNode - var treeMap: Highcharts.TreeMapChartSeriesOptions = { + const treeMap: Highcharts.TreeMapChartSeriesOptions = { type: "treemap", layoutAlgorithm: 'squarified', allowDrillToNode: true, @@ -1932,10 +1928,10 @@ function test_TreeMap() { } function test_Waterfall() { - var allDefaults: Highcharts.WaterFallChartSeriesOptions = {}; + const allDefaults: Highcharts.WaterFallChartSeriesOptions = {}; // partial waterfall demo - var series: Highcharts.WaterFallChartSeriesOptions = { + const series: Highcharts.WaterFallChartSeriesOptions = { upColor: Highcharts.getOptions().colors[2], color: Highcharts.getOptions().colors[3], data: [{ @@ -1964,7 +1960,7 @@ function test_Waterfall() { }], dataLabels: { enabled: true, - formatter: function () { + formatter() { return Highcharts.numberFormat(this.y / 1000, 0, ',') + 'k'; }, style: { @@ -1978,9 +1974,9 @@ function test_Waterfall() { } function test_AxisOptions() { - var allDefaults: Highcharts.AxisOptions = {}; + const allDefaults: Highcharts.AxisOptions = {}; - var axis: Highcharts.AxisOptions = { + const axis: Highcharts.AxisOptions = { allowDecimals: false, alternateGridColor: '#000000', breaks: [{ @@ -2014,7 +2010,7 @@ function test_AxisOptions() { distance: 10, enabled: true, format: "format", - formatter: function () { return this.value; }, + formatter() { return this.value; }, maxStaggerLines: 5, overflow: false, padding: 10, @@ -2133,7 +2129,7 @@ function test_AxisOptions() { } function test_AxisObject() { - var axis = $("#container").highcharts().xAxis[0]; + const axis = $("#container").highcharts().xAxis[0]; axis.addPlotBand({ from: 5.5, to: 7.5, @@ -2148,7 +2144,7 @@ function test_AxisObject() { id: 'plot-line-1' }); axis.removePlotLine('plot-line-1'); - var extremes = axis.getExtremes(); + const extremes = axis.getExtremes(); console.log('dataMax: ' + extremes.dataMax + '
' + 'dataMin: ' + extremes.dataMin + '
' + 'max: ' + extremes.max + '
' + @@ -2173,7 +2169,7 @@ function test_AxisObject() { } function test_ChartObject() { - var chart = $("#container").highcharts(); + const chart = $("#container").highcharts(); chart.addAxis( {}); chart.addAxis( {}, true); chart.addAxis( {}, true, false); @@ -2184,25 +2180,25 @@ function test_ChartObject() { chart.addSeries( {}, false, false); chart.addSeries( {}, false, { duration: 50 }); chart.addSeriesAsDrilldown( {}, {}); - var container = chart.container; + const container = chart.container; console.log(container.id); chart.destroy(); chart.drillUp(); chart.exportChart( {}, {}); chart.exportChartLocal( {}, {}); - var object = chart.get('axisIdOrSeriesIdOrPointId'); - var svg1 = chart.getSVG(); - var svg2 = chart.getSVG( {}); - var selectedPoints = chart.getSelectedPoints(); - var selectedSeries = chart.getSelectedSeries(); + const object = chart.get('axisIdOrSeriesIdOrPointId'); + const svg1 = chart.getSVG(); + const svg2 = chart.getSVG( {}); + const selectedPoints = chart.getSelectedPoints(); + const selectedSeries = chart.getSelectedSeries(); chart.hideLoading(); - var options = chart.options; + const options = chart.options; chart.print(); chart.redraw(); chart.redraw(false); chart.redraw({ duration: 50, easing: 'fadeIn' }); chart.reflow(); - var series = chart.series; + const series = chart.series; chart.setSize(200, 200); chart.setSize(200, 200, false); chart.setSize(200, 200, { duration: 50 }); @@ -2210,14 +2206,14 @@ function test_ChartObject() { chart.setTitle({}, {}, false); chart.showLoading(); chart.showLoading("Loading label"); - var firstXAxis = chart.xAxis[0]; - var firstYAxis = chart.yAxis[0]; - var legend = chart.legend; + const firstXAxis = chart.xAxis[0]; + const firstYAxis = chart.yAxis[0]; + const legend = chart.legend; } function test_ElementObject() { - var renderer = new Highcharts.Renderer($("#container")[0], 400, 400); - var group = renderer.g().add(); + const renderer = new Highcharts.Renderer($("#container")[0], 400, 400); + const group = renderer.g().add(); renderer .circle(200, 150, 100) .attr({ @@ -2226,7 +2222,7 @@ function test_ElementObject() { 'stroke-width': 1 }) .add(group); - var rect = renderer + const rect = renderer .rect(90, 150, 100, 100, 5) .attr({ fill: '#C5FFC5', @@ -2242,7 +2238,7 @@ function test_ElementObject() { 'stroke-width': 10 }); rect.destroy(); - var styledText = renderer + const styledText = renderer .text('Series 1', 140, 140) .attr({ rotation: -25 @@ -2252,15 +2248,15 @@ function test_ElementObject() { fontSize: '16px' }) .add(); - var bbox = styledText.getBBox(); + const bbox = styledText.getBBox(); styledText.on('click', () => { }); group.toFront(); } function test_PointObject() { - var point = $('#container').highcharts().get('point1'); - var category = point.category; - var percentage = point.percentage; + const point = $('#container').highcharts().get('point1'); + const category = point.category; + const percentage = point.percentage; point.index; point.remove(); point.remove(false); @@ -2268,26 +2264,26 @@ function test_PointObject() { point.select(); point.select(false); point.select(false, true); - var isSelected = point.selected; - var series = point.series; + const isSelected = point.selected; + const series = point.series; point.slice(); point.slice(false); point.slice(false, false); point.slice(false, false, false); point.slice(false, false, { duration: 50 }); - var total = point.total; + const total = point.total; point.update(0); point.update([0, 0]); point.update({}); point.update({}, false); point.update({}, false, false); point.update({}, false, { duration: 50 }); - var x = point.x; - var y = point.y; + const x = point.x; + const y = point.y; } function test_RendererObject() { - var renderer = $('#container').highcharts().renderer; + const renderer = $('#container').highcharts().renderer; renderer.arc(0, 0, 20, 10, 0, Math.PI); renderer.circle(0, 0, 100); renderer.g('groupName'); @@ -2299,7 +2295,7 @@ function test_RendererObject() { } function test_SeriesObject() { - var series = $('#container').highcharts().get('series1'); + const series = $('#container').highcharts().get('series1'); series.addPoint(0); series.addPoint([0, 0]); series.addPoint({}); @@ -2307,11 +2303,11 @@ function test_SeriesObject() { series.addPoint({}, false, true); series.addPoint({}, false, true, false); series.addPoint({}, false, true, { duration: 50 }); - var chart = series.chart; - var data = series.data; + const chart = series.chart; + const data = series.data; series.hide(); - var name = series.name; - var options = series.options; + const name = series.name; + const options = series.options; series.remove(); series.remove(false); series.removePoint(0); @@ -2320,7 +2316,7 @@ function test_SeriesObject() { series.removePoint(0, false, { duration: 50 }); series.select(); series.select(true); - var isSelected = series.selected; + const isSelected = series.selected; series.setData([0, 1, 2]); series.setData([[0, 0], [1, 1], [2, 2]]); series.setData([{}, {}, {}]); @@ -2332,15 +2328,15 @@ function test_SeriesObject() { series.setVisible(true); series.setVisible(true, false); series.show(); - var type = series.type; + const type = series.type; series.update({}); series.update({}, false); - var visible = series.visible; - var xAxis = series.xAxis; - var yAxis = series.yAxis; + const visible = series.visible; + const xAxis = series.xAxis; + const yAxis = series.yAxis; } function test_LegendObject() { - var legend = $('#container').highcharts().legend; + const legend = $('#container').highcharts().legend; legend.update({}); legend.update({}, false); } diff --git a/highcharts/test/no-data-to-display.ts b/highcharts/test/no-data-to-display.ts index e2bb453714..348d2a2ad7 100644 --- a/highcharts/test/no-data-to-display.ts +++ b/highcharts/test/no-data-to-display.ts @@ -1,8 +1,8 @@ function test_NoDataToDisplay() { - var chart = $("#container").highcharts(); - var chartHasData = chart.hasData(); + const chart = $("#container").highcharts(); + const chartHasData = chart.hasData(); chart.hideNoData(); chart.showNoData("Custom no data message"); } -HighchartsNoDataToDisplay(Highcharts); \ No newline at end of file +HighchartsNoDataToDisplay(Highcharts); diff --git a/htmlescape/index.d.ts b/htmlescape/index.d.ts index 51d8eae58d..23b9425e16 100644 --- a/htmlescape/index.d.ts +++ b/htmlescape/index.d.ts @@ -5,7 +5,7 @@ declare function htmlescape(o: any): string; declare namespace htmlescape { - export function sanitize(s: string): string; + function sanitize(s: string): string; } export = htmlescape; diff --git a/http-codes/index.d.ts b/http-codes/index.d.ts index e106812f0c..0be3973652 100644 --- a/http-codes/index.d.ts +++ b/http-codes/index.d.ts @@ -3,65 +3,65 @@ // Definitions by: Mohamed Hegazy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export declare const ACCEPTED: number; -export declare const ALREADY_REPORTED: number; -export declare const BAD_GATEWAY: number; -export declare const BAD_REQUEST: number; -export declare const BANDWIDTH_LIMIT_EXCEEDED: number; -export declare const CONFLICT: number; -export declare const CONTINUE: number; -export declare const CREATED: number; -export declare const EXPECTATION_FAILED: number; -export declare const FAILED_DEPENDENCY: number; -export declare const FORBIDDEN: number; -export declare const FOUND: number; -export declare const GATEWAY_TIMEOUT: number; -export declare const GONE: number; -export declare const HTTP_VERSION_NOT_SUPPORTED: number; -export declare const IM_A_TEAPOT: number; -export declare const IM_USED: number; -export declare const INSUFFICIENT_STORAGE: number; -export declare const INTERNAL_SERVER_ERROR: number; -export declare const LENGTH_REQUIRED: number; -export declare const LOCKED: number; -export declare const LOOP_DETECTED: number; -export declare const METHOD_NOT_ALLOWED: number; -export declare const MISDIRECTED_REQUEST: number; -export declare const MOVED_PERMANENTLY: number; -export declare const MULTIPLE_CHOICES: number; -export declare const MULTI_STATUS: number; -export declare const NETWORK_AUTHENTICATION_REQUIRED: number; -export declare const NON_AUTHORITATIVE_INFORMATION: number; -export declare const NOT_ACCEPTABLE: number; -export declare const NOT_EXTENDED: number; -export declare const NOT_FOUND: number; -export declare const NOT_IMPLEMENTED: number; -export declare const NOT_MODIFIED: number; -export declare const NO_CONTENT: number; -export declare const OK: number; -export declare const PARTIAL_CONTENT: number; -export declare const PAYLOAD_TOO_LARGE: number; -export declare const PAYMENT_REQUIRED: number; -export declare const PERMANENT_REDIRECT: number; -export declare const PRECONDITION_FAILED: number; -export declare const PRECONDITION_REQUIRED: number; -export declare const PROCESSING: number; -export declare const PROXY_AUTHENTICATION_REQUIRED: number; -export declare const RANGE_NOT_SATISFIABLE: number; -export declare const REQUEST_HEADER_FIELDS_TOO_LARGE: number; -export declare const REQUEST_TIMEOUT: number; -export declare const RESET_CONTENT: number; -export declare const SEE_OTHER: number; -export declare const SERVICE_UNAVAILABLE: number; -export declare const SWITCHING_PROTOCOLS: number; -export declare const TEMPORARY_REDIRECT: number; -export declare const TOO_MANY_REQUESTS: number; -export declare const UNAUTHORIZED: number; -export declare const UNAVAILABLE_FOR_LEGAL_REASONS: number; -export declare const UNORDERED_COLLECTION: number; -export declare const UNPROCESSABLE_ENTITY: number; -export declare const UNSUPPORTED_MEDIA_TYPE: number; -export declare const UPGRADE_REQUIRED: number; -export declare const URI_TOO_LONG: number; -export declare const USE_PROXY: number; -export declare const VARIANT_ALSO_NEGOTIATES: number; +export const ACCEPTED: number; +export const ALREADY_REPORTED: number; +export const BAD_GATEWAY: number; +export const BAD_REQUEST: number; +export const BANDWIDTH_LIMIT_EXCEEDED: number; +export const CONFLICT: number; +export const CONTINUE: number; +export const CREATED: number; +export const EXPECTATION_FAILED: number; +export const FAILED_DEPENDENCY: number; +export const FORBIDDEN: number; +export const FOUND: number; +export const GATEWAY_TIMEOUT: number; +export const GONE: number; +export const HTTP_VERSION_NOT_SUPPORTED: number; +export const IM_A_TEAPOT: number; +export const IM_USED: number; +export const INSUFFICIENT_STORAGE: number; +export const INTERNAL_SERVER_ERROR: number; +export const LENGTH_REQUIRED: number; +export const LOCKED: number; +export const LOOP_DETECTED: number; +export const METHOD_NOT_ALLOWED: number; +export const MISDIRECTED_REQUEST: number; +export const MOVED_PERMANENTLY: number; +export const MULTIPLE_CHOICES: number; +export const MULTI_STATUS: number; +export const NETWORK_AUTHENTICATION_REQUIRED: number; +export const NON_AUTHORITATIVE_INFORMATION: number; +export const NOT_ACCEPTABLE: number; +export const NOT_EXTENDED: number; +export const NOT_FOUND: number; +export const NOT_IMPLEMENTED: number; +export const NOT_MODIFIED: number; +export const NO_CONTENT: number; +export const OK: number; +export const PARTIAL_CONTENT: number; +export const PAYLOAD_TOO_LARGE: number; +export const PAYMENT_REQUIRED: number; +export const PERMANENT_REDIRECT: number; +export const PRECONDITION_FAILED: number; +export const PRECONDITION_REQUIRED: number; +export const PROCESSING: number; +export const PROXY_AUTHENTICATION_REQUIRED: number; +export const RANGE_NOT_SATISFIABLE: number; +export const REQUEST_HEADER_FIELDS_TOO_LARGE: number; +export const REQUEST_TIMEOUT: number; +export const RESET_CONTENT: number; +export const SEE_OTHER: number; +export const SERVICE_UNAVAILABLE: number; +export const SWITCHING_PROTOCOLS: number; +export const TEMPORARY_REDIRECT: number; +export const TOO_MANY_REQUESTS: number; +export const UNAUTHORIZED: number; +export const UNAVAILABLE_FOR_LEGAL_REASONS: number; +export const UNORDERED_COLLECTION: number; +export const UNPROCESSABLE_ENTITY: number; +export const UNSUPPORTED_MEDIA_TYPE: number; +export const UPGRADE_REQUIRED: number; +export const URI_TOO_LONG: number; +export const USE_PROXY: number; +export const VARIANT_ALSO_NEGOTIATES: number; diff --git a/jasmine-ajax/index.d.ts b/jasmine-ajax/index.d.ts index 6ec4020d00..4e227add1b 100644 --- a/jasmine-ajax/index.d.ts +++ b/jasmine-ajax/index.d.ts @@ -84,5 +84,5 @@ declare class MockAjax { } declare namespace jasmine { - export var Ajax: MockAjax; + const Ajax: MockAjax; } diff --git a/jasmine-ajax/jasmine-ajax-tests.ts b/jasmine-ajax/jasmine-ajax-tests.ts index d94b205d13..96b7020577 100644 --- a/jasmine-ajax/jasmine-ajax-tests.ts +++ b/jasmine-ajax/jasmine-ajax-tests.ts @@ -5,12 +5,11 @@ /// - declare function getJasmineRequireObj(); describe('StubTracker', () => { beforeEach(() => { - var Constructor = getJasmineRequireObj().AjaxStubTracker(); + const Constructor = getJasmineRequireObj().AjaxStubTracker(); this.tracker = new Constructor(); }); @@ -19,21 +18,21 @@ describe('StubTracker', () => { }); it('finds an added stub', () => { - var stub = { matches: () => true }; + const stub = { matches: () => true }; this.tracker.addStub(stub); expect(this.tracker.findStub()).toBe(stub); }); it('skips an added stub that does not match', () => { - var stub = { matches: () => false }; + const stub = { matches: () => false }; this.tracker.addStub(stub); expect(this.tracker.findStub()).toBeUndefined(); }); it('passes url, data, and method to the stub', () => { - var stub = { matches: jasmine.createSpy('matches') }; + const stub = { matches: jasmine.createSpy('matches') }; this.tracker.addStub(stub); this.tracker.findStub('url', 'data', 'method'); @@ -42,7 +41,7 @@ describe('StubTracker', () => { }); it('can clear out all stubs', () => { - var stub = { matches: jasmine.createSpy('matches') }; + const stub = { matches: jasmine.createSpy('matches') }; this.tracker.addStub(stub); this.tracker.findStub(); @@ -58,9 +57,9 @@ describe('StubTracker', () => { }); it('uses the most recently added stub that matches', () => { - var stub1 = { matches: () => true }; - var stub2 = { matches: () => false }; - var stub3 = { matches: () => false }; + const stub1 = { matches: () => true }; + const stub2 = { matches: () => false }; + const stub3 = { matches: () => false }; this.tracker.addStub(stub1); this.tracker.addStub(stub2); @@ -74,9 +73,9 @@ describe('FakeRequest', () => { beforeEach(() => { this.requestTracker = { track: jasmine.createSpy('trackRequest') }; this.stubTracker = { findStub() { } }; - var parserInstance = this.parserInstance = jasmine.createSpy('parse'); + const parserInstance = this.parserInstance = jasmine.createSpy('parse'); this.paramParser = { findParser: () => ({ parse: parserInstance }) }; - var eventBus = this.fakeEventBus = { + const eventBus = this.fakeEventBus = { addEventListener: jasmine.createSpy('addEventListener'), trigger: jasmine.createSpy('trigger'), removeEventListener: jasmine.createSpy('removeEventListener') @@ -95,15 +94,15 @@ describe('FakeRequest', () => { }); it('extends from the global XMLHttpRequest', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); expect(request.extraAttribute).toEqual('my cool attribute'); }); it('skips XMLHttpRequest attributes that IE does not want copied', () => { // use real window here so it will correctly go red on IE if it breaks - var FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(window, this.requestTracker, this.stubTracker, this.paramParser); - var request = new FakeRequest(); + const FakeRequest = getJasmineRequireObj().AjaxFakeRequest(this.eventBusFactory)(window, this.requestTracker, this.stubTracker, this.paramParser); + const request = new FakeRequest(); expect(request.responseBody).toBeUndefined(); expect(request.responseXML).toBeUndefined(); @@ -111,20 +110,20 @@ describe('FakeRequest', () => { }); it('tracks the request', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); expect(this.requestTracker.track).toHaveBeenCalledWith(request); }); it('has default request headers and override mime type', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); expect(request.requestHeaders).toEqual({}); expect(request.overriddenMimeType).toBeNull(); }); it('saves request information when opened', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open('METHOD', 'URL', 'ignore_async', 'USERNAME', 'PASSWORD'); expect(request.method).toEqual('METHOD'); @@ -134,7 +133,7 @@ describe('FakeRequest', () => { }); it('saves an override mime type', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.overrideMimeType('application/text; charset: utf-8'); @@ -142,7 +141,7 @@ describe('FakeRequest', () => { }); it('saves request headers', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.setRequestHeader('X-Header-1', 'value1'); request.setRequestHeader('X-Header-2', 'value2'); @@ -154,7 +153,7 @@ describe('FakeRequest', () => { }); it('combines request headers with the same header name', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.setRequestHeader('X-Header', 'value1'); request.setRequestHeader('X-Header', 'value2'); @@ -163,7 +162,7 @@ describe('FakeRequest', () => { }); it('finds the content-type request header', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.setRequestHeader('ContEnt-tYPe', 'application/text+xml'); @@ -248,9 +247,9 @@ describe('FakeRequest', () => { this.request.send(); this.fakeEventBus.trigger.calls.reset(); - var request = this.request; - var events = []; - var headers = [ + const request = this.request; + const events = []; + const headers = [ { name: 'X-Header', value: 'foo' } ]; @@ -284,7 +283,7 @@ describe('FakeRequest', () => { this.request.open(); this.request.send(); this.request.respondWith({}); - var request = this.request; + const request = this.request; expect(() => { request.responseTimeout(); @@ -295,7 +294,7 @@ describe('FakeRequest', () => { this.request.open(); this.request.send(); this.request.respondWith({}); - var request = this.request; + const request = this.request; expect(() => { request.respondWith({}); @@ -306,7 +305,7 @@ describe('FakeRequest', () => { this.request.open(); this.request.send(); this.request.respondWith({}); - var request = this.request; + const request = this.request; expect(() => { request.responseError({}); @@ -335,7 +334,7 @@ describe('FakeRequest', () => { this.request.ontimeout = jasmine.createSpy('timeout'); this.request.onloadend = jasmine.createSpy('loadend'); - var args = this.fakeEventBus.addEventListener.calls.allArgs(); + const args = this.fakeEventBus.addEventListener.calls.allArgs(); for (const [eventName, busCallback] of args) { busCallback(); expect(this.request['on' + eventName]).toHaveBeenCalled(); @@ -462,10 +461,10 @@ describe('FakeRequest', () => { }); it('ticks the jasmine clock on timeout', () => { - var clock = { tick: jasmine.createSpy('tick') }; + const clock = { tick: jasmine.createSpy('tick') }; spyOn(jasmine, 'clock').and.returnValue(clock); - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -475,13 +474,13 @@ describe('FakeRequest', () => { }); it('has an initial status of null', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); expect(request.status).toBeNull(); }); it('has an aborted status', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.abort(); @@ -490,7 +489,7 @@ describe('FakeRequest', () => { }); it('has a status from the response', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -501,7 +500,7 @@ describe('FakeRequest', () => { }); it('has a statusText from the response', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -512,7 +511,7 @@ describe('FakeRequest', () => { }); it('saves off any data sent to the server', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send('foo=bar&baz=quux'); @@ -520,7 +519,7 @@ describe('FakeRequest', () => { }); it('parses data sent to the server', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send('foo=bar&baz=quux'); @@ -530,7 +529,7 @@ describe('FakeRequest', () => { }); it('skips parsing if no data was sent', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -539,7 +538,7 @@ describe('FakeRequest', () => { }); it('saves responseText', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -549,7 +548,7 @@ describe('FakeRequest', () => { }); it('defaults responseText if none is given', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -559,7 +558,7 @@ describe('FakeRequest', () => { }); it('retrieves individual response headers', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -574,7 +573,7 @@ describe('FakeRequest', () => { }); it('retrieves individual response headers case-insensitively', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -589,7 +588,7 @@ describe('FakeRequest', () => { }); it('retrieves a combined response header', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -605,11 +604,11 @@ describe('FakeRequest', () => { }); it("doesn't pollute the response headers of other XHRs", () => { - var request1 = new this.FakeRequest(); + const request1 = new this.FakeRequest(); request1.open(); request1.send(); - var request2 = new this.FakeRequest(); + const request2 = new this.FakeRequest(); request2.open(); request2.send(); @@ -621,7 +620,7 @@ describe('FakeRequest', () => { }); it('retrieves all response headers', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -638,7 +637,7 @@ describe('FakeRequest', () => { }); it('sets the content-type header to the specified contentType when no other headers are supplied', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -649,7 +648,7 @@ describe('FakeRequest', () => { }); it('sets a default content-type header if no contentType and headers are supplied', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -660,7 +659,7 @@ describe('FakeRequest', () => { }); it('has no responseXML by default', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -670,7 +669,7 @@ describe('FakeRequest', () => { }); it('parses a text/xml document into responseXML', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -687,7 +686,7 @@ describe('FakeRequest', () => { }); it('parses an application/xml document into responseXML', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -704,7 +703,7 @@ describe('FakeRequest', () => { }); it('parses a custom blah+xml document into responseXML', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -721,7 +720,7 @@ describe('FakeRequest', () => { }); it('defaults the response attribute to the responseText', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -731,7 +730,7 @@ describe('FakeRequest', () => { }); it('has a text response when the responseType is blank', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -741,7 +740,7 @@ describe('FakeRequest', () => { }); it('has a text response when the responseType is text', () => { - var request = new this.FakeRequest(); + const request = new this.FakeRequest(); request.open(); request.send(); @@ -751,16 +750,15 @@ describe('FakeRequest', () => { }); }); - describe("Jasmine Mock Ajax (for toplevel)", () => { - var request, anotherRequest, response; - var success, error, complete; - var client, onreadystatechange; - var sharedContext: any = {}; - var fakeGlobal, mockAjax; + let request, anotherRequest, response; + let success, error, complete; + let client, onreadystatechange; + const sharedContext: any = {}; + let fakeGlobal, mockAjax; beforeEach(() => { - var fakeXMLHttpRequest = jasmine.createSpy('realFakeXMLHttpRequest'); + const fakeXMLHttpRequest = jasmine.createSpy('realFakeXMLHttpRequest'); fakeGlobal = { XMLHttpRequest: fakeXMLHttpRequest, DOMParser: window['DOMParser'], @@ -832,7 +830,6 @@ describe("Jasmine Mock Ajax (for toplevel)", () => { }); describe("mockAjax.requests.mostRecent()", () => { - describe("when there is one request queued", () => { it("should return the request", () => { expect(mockAjax.requests.mostRecent()).toEqual(request); @@ -921,7 +918,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => { client.send(); request = mockAjax.requests.mostRecent(); - var responseObject = { status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: "json" }; + const responseObject = { status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: "json" }; request.respondWith(responseObject); @@ -948,7 +945,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => { }); it("should return a JavaScript object for XHR2 response", () => { - var responseText = sharedContext.responseText; + const responseText = sharedContext.responseText; expect(success.calls.mostRecent().args[0]).toEqual(responseText); expect(response.responseText).toEqual(responseText); @@ -967,7 +964,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => { client.send(); request = mockAjax.requests.mostRecent(); - var responseObject = { status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: 'json' }; + const responseObject = { status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}', responseType: 'json' }; request.respondWith(responseObject); @@ -982,7 +979,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => { }); it("should return the provided override for the XHR2 response", () => { - var responseText = sharedContext.responseText; + const responseText = sharedContext.responseText; expect(response.responseText).toEqual(responseText); expect(response.response).toEqual({ foo: "bar" }); @@ -999,7 +996,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => { client.send(); request = mockAjax.requests.mostRecent(); - var responseObject = { + const responseObject = { status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: { 'X-Header1': 'header 1 value', 'X-Header2': 'header 2 value', @@ -1033,7 +1030,7 @@ describe("Jasmine Mock Ajax (for toplevel)", () => { client.send(); request = mockAjax.requests.mostRecent(); - var responseObject = { + const responseObject = { status: 200, statusText: "OK", responseText: '["foo"]', responseHeaders: [ { name: 'X-Header', value: 'header value 1' }, { name: 'X-Header', value: 'header value 2' } @@ -1201,10 +1198,9 @@ describe("Jasmine Mock Ajax (for toplevel)", () => { }); }); - function sharedAjaxResponseBehaviorForZepto_Success(context) { describe("the success response", () => { - var xhr; + let xhr; beforeEach(() => { xhr = context.responseCallback.calls.mostRecent().args[2]; }); @@ -1218,7 +1214,7 @@ function sharedAjaxResponseBehaviorForZepto_Success(context) { }); it("should have the expected xhr2 response", () => { - var expected = context.response || context.responseType === 'json' ? JSON.parse(context.responseText) : context.responseText; + const expected = context.response || context.responseType === 'json' ? JSON.parse(context.responseText) : context.responseText; expect(xhr.response).toEqual(expected); }); @@ -1234,7 +1230,7 @@ function sharedAjaxResponseBehaviorForZepto_Success(context) { function sharedAjaxResponseBehaviorForZepto_Failure(context) { describe("the failure response", () => { - var xhr; + let xhr; beforeEach(() => { xhr = context.responseCallback.calls.mostRecent().args[0]; }); @@ -1248,7 +1244,7 @@ function sharedAjaxResponseBehaviorForZepto_Failure(context) { }); it("should have the expected xhr2 response", () => { - var expected = context.response || xhr.responseType === 'json' ? JSON.parse(xhr.responseText) : xhr.responseText; + const expected = context.response || xhr.responseType === 'json' ? JSON.parse(xhr.responseText) : xhr.responseText; expect(xhr.response).toEqual(expected); }); @@ -1264,13 +1260,13 @@ function sharedAjaxResponseBehaviorForZepto_Failure(context) { describe('ParamParser', () => { beforeEach(() => { - var Constructor = getJasmineRequireObj().AjaxParamParser(); + const Constructor = getJasmineRequireObj().AjaxParamParser(); expect(Constructor).toEqual(jasmine.any(Function)); this.parser = new Constructor(); }); it('has a default parser', () => { - var parser = this.parser.findParser({ contentType: () => { } }), + const parser = this.parser.findParser({ contentType: () => { } }), parsed = parser.parse('3+stooges=shemp&3+stooges=larry%20%26%20moe%20%26%20curly&some%3Dthing=else+entirely'); expect(parsed).toEqual({ @@ -1280,7 +1276,7 @@ describe('ParamParser', () => { }); it('should detect and parse json', () => { - var data = { + const data = { foo: 'bar', baz: ['q', 'u', 'u', 'x'], nested: { @@ -1296,7 +1292,7 @@ describe('ParamParser', () => { }); it('should parse json with further qualifiers on content-type', () => { - var data = { + const data = { foo: 'bar', baz: ['q', 'u', 'u', 'x'], nested: { @@ -1312,14 +1308,14 @@ describe('ParamParser', () => { }); it('should have custom parsers take precedence', () => { - var custom = { + const custom = { test: jasmine.createSpy('test').and.returnValue(true), parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') }; this.parser.add(custom); - var parser = this.parser.findParser({ contentType: () => { } }), + const parser = this.parser.findParser({ contentType: () => { } }), parsed = parser.parse('custom_format'); expect(parsed).toEqual('parsedFormat'); @@ -1328,14 +1324,14 @@ describe('ParamParser', () => { }); it('should skip custom parsers that do not match', () => { - var custom = { + const custom = { test: jasmine.createSpy('test').and.returnValue(false), parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') }; this.parser.add(custom); - var parser = this.parser.findParser({ contentType: () => { } }), + const parser = this.parser.findParser({ contentType: () => { } }), parsed = parser.parse('custom_format'); expect(parsed).toEqual({ custom_format: ['undefined'] }); @@ -1344,14 +1340,14 @@ describe('ParamParser', () => { }); it('removes custom parsers when reset', () => { - var custom = { + const custom = { test: jasmine.createSpy('test').and.returnValue(true), parse: jasmine.createSpy('parse').and.returnValue('parsedFormat') }; this.parser.add(custom); - var parser = this.parser.findParser({ contentType: () => { } }), + let parser = this.parser.findParser({ contentType: () => { } }), parsed = parser.parse('custom_format'); expect(parsed).toEqual('parsedFormat'); @@ -1389,31 +1385,31 @@ describe('RequestStub', () => { }); it('matches just by exact url', () => { - var stub = new this.RequestStub('www.example.com/foo'); + const stub = new this.RequestStub('www.example.com/foo'); expect(stub)['toMatchRequest']('www.example.com/foo'); }); it('does not match if the url differs', () => { - var stub = new this.RequestStub('www.example.com/foo'); + const stub = new this.RequestStub('www.example.com/foo'); expect(stub).not['toMatchRequest']('www.example.com/bar'); }); it('matches unordered query params', () => { - var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); + const stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); expect(stub)['toMatchRequest']('www.example.com?baz=quux&foo=bar'); }); it('requires all specified query params to be there', () => { - var stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); + const stub = new this.RequestStub('www.example.com?foo=bar&baz=quux'); expect(stub).not['toMatchRequest']('www.example.com?foo=bar'); }); it('can match the url with a RegExp', () => { - var stub = new this.RequestStub(/ba[rz]/); + const stub = new this.RequestStub(/ba[rz]/); expect(stub)['toMatchRequest']('bar'); expect(stub)['toMatchRequest']('baz'); @@ -1421,7 +1417,7 @@ describe('RequestStub', () => { }); it('requires the method to match if supplied', () => { - var stub = new this.RequestStub('www.example.com/foo', null, 'POST'); + const stub = new this.RequestStub('www.example.com/foo', null, 'POST'); expect(stub).not['toMatchRequest']('www.example.com/foo'); expect(stub).not['toMatchRequest']('www.example.com/foo', null, 'GET'); @@ -1429,7 +1425,7 @@ describe('RequestStub', () => { }); it('requires the data submitted to match if supplied', () => { - var stub = new this.RequestStub('/foo', 'foo=bar&baz=quux'); + const stub = new this.RequestStub('/foo', 'foo=bar&baz=quux'); expect(stub)['toMatchRequest']('/foo', 'baz=quux&foo=bar'); expect(stub).not['toMatchRequest']('/foo', 'foo=bar'); @@ -1438,7 +1434,7 @@ describe('RequestStub', () => { describe('RequestTracker', () => { beforeEach(() => { - var Constructor = getJasmineRequireObj().AjaxRequestTracker(); + const Constructor = getJasmineRequireObj().AjaxRequestTracker(); this.tracker = new Constructor(); }); @@ -1511,7 +1507,7 @@ describe('RequestTracker', () => { this.tracker.track({ url: 'bar' }); this.tracker.track({ url: 'baz' }); - var func = request => request.url === 'bar'; + const func = request => request.url === 'bar'; expect(this.tracker.filter(func)).toEqual([{ url: 'bar' }]); }); @@ -1527,7 +1523,7 @@ describe('EventBus', () => { }); it('calls an event listener', () => { - var callback = jasmine.createSpy('callback'); + const callback = jasmine.createSpy('callback'); this.bus.addEventListener('foo', callback); this.bus.trigger('foo'); @@ -1536,7 +1532,7 @@ describe('EventBus', () => { }); it('calls an event listener with additional arguments', () => { - var callback = jasmine.createSpy('callback'); + const callback = jasmine.createSpy('callback'); this.bus.addEventListener('foo', callback); this.bus.trigger('foo', 'bar'); @@ -1545,7 +1541,7 @@ describe('EventBus', () => { }); it('only triggers callbacks for the specified event', () => { - var fooCallback = jasmine.createSpy('foo'), + const fooCallback = jasmine.createSpy('foo'), barCallback = jasmine.createSpy('bar'); this.bus.addEventListener('foo', fooCallback); @@ -1558,8 +1554,8 @@ describe('EventBus', () => { }); it('calls all the callbacks for the specified event', () => { - var callback1 = jasmine.createSpy('callback'); - var callback2 = jasmine.createSpy('otherCallback'); + const callback1 = jasmine.createSpy('callback'); + const callback2 = jasmine.createSpy('otherCallback'); this.bus.addEventListener('foo', callback1); this.bus.addEventListener('foo', callback2); @@ -1571,14 +1567,14 @@ describe('EventBus', () => { }); it('works if there are no callbacks for the event', () => { - var bus = this.bus; + const bus = this.bus; expect(() => { bus.trigger('notActuallyThere'); }).not.toThrow(); }); it('does not call listeners that have been removed', () => { - var callback = jasmine.createSpy('callback'); + const callback = jasmine.createSpy('callback'); this.bus.addEventListener('foo', callback); this.bus.removeEventListener('foo', callback); @@ -1588,8 +1584,8 @@ describe('EventBus', () => { }); it('only removes the specified callback', () => { - var callback1 = jasmine.createSpy('callback'); - var callback2 = jasmine.createSpy('otherCallback'); + const callback1 = jasmine.createSpy('callback'); + const callback2 = jasmine.createSpy('otherCallback'); this.bus.addEventListener('foo', callback1); this.bus.addEventListener('foo', callback2); @@ -1603,12 +1599,12 @@ describe('EventBus', () => { }); describe("Webmock style mocking", () => { - var successSpy, errorSpy, response, fakeGlobal, mockAjax; + let successSpy, response, fakeGlobal, mockAjax; - var sendRequest = function(fakeGlobal, url?, method?) { + const sendRequest = function(fakeGlobal, url?, method?) { url = url || "http://example.com/someApi"; method = method || 'GET'; - var xhr = new fakeGlobal.XMLHttpRequest(); + const xhr = new fakeGlobal.XMLHttpRequest(); xhr.onreadystatechange = args => { if (this.readyState === (this.DONE || 4)) { // IE 8 doesn't support DONE response = this; @@ -1681,15 +1677,15 @@ describe("Webmock style mocking", () => { }); describe("withMock", () => { - var sendRequest = fakeGlobal => { - var xhr = new fakeGlobal.XMLHttpRequest(); + const sendRequest = fakeGlobal => { + const xhr = new fakeGlobal.XMLHttpRequest(); xhr.open("GET", "http://example.com/someApi"); xhr.send(); }; it("installs the mock for passed in function, and uninstalls when complete", () => { - var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), + const xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), xmlHttpRequestCtor = spyOn(window as any, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), fakeGlobal = { XMLHttpRequest: xmlHttpRequestCtor }, mockAjax = new MockAjax(fakeGlobal); @@ -1704,7 +1700,7 @@ describe("withMock", () => { }); it("properly uninstalls when the passed in function throws", () => { - var xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), + const xmlHttpRequest = jasmine.createSpyObj('XMLHttpRequest', ['open', 'send']), xmlHttpRequestCtor = spyOn(window as any, 'XMLHttpRequest').and.returnValue(xmlHttpRequest), fakeGlobal = { XMLHttpRequest: xmlHttpRequestCtor }, mockAjax = new MockAjax(fakeGlobal); @@ -1722,7 +1718,7 @@ describe("withMock", () => { describe("mockAjax", () => { it("throws an error if installed multiple times", () => { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, mockAjax = new MockAjax(fakeGlobal); @@ -1735,7 +1731,7 @@ describe("mockAjax", () => { }); it("does not throw an error if uninstalled between installs", () => { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, mockAjax = new MockAjax(fakeGlobal); @@ -1749,7 +1745,7 @@ describe("mockAjax", () => { }); it("does not replace XMLHttpRequest until it is installed", () => { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, mockAjax = new MockAjax(fakeGlobal); @@ -1763,7 +1759,7 @@ describe("mockAjax", () => { }); it("replaces the global XMLHttpRequest on uninstall", () => { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, mockAjax = new MockAjax(fakeGlobal); @@ -1775,7 +1771,7 @@ describe("mockAjax", () => { }); it("clears requests and stubs upon uninstall", () => { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, mockAjax = new MockAjax(fakeGlobal); @@ -1794,24 +1790,24 @@ describe("mockAjax", () => { }); it("allows the httpRequest to be retrieved", () => { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, mockAjax = new MockAjax(fakeGlobal); mockAjax.install(); - var request = new ( fakeGlobal.XMLHttpRequest)(); + const request = new ( fakeGlobal.XMLHttpRequest)(); expect(mockAjax.requests.count()).toBe(1); expect(mockAjax.requests.mostRecent()).toBe(request); }); it("allows the httpRequests to be cleared", () => { - var fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), + const fakeXmlHttpRequest = jasmine.createSpy('fakeXmlHttpRequest'), fakeGlobal = { XMLHttpRequest: fakeXmlHttpRequest }, mockAjax = new MockAjax(fakeGlobal); mockAjax.install(); - var request = new ( fakeGlobal.XMLHttpRequest)(); + const request = new ( fakeGlobal.XMLHttpRequest)(); expect(mockAjax.requests.mostRecent()).toBe(request); mockAjax.requests.reset(); diff --git a/jenkins/index.d.ts b/jenkins/index.d.ts index 5db91893a6..027cc8e0cf 100644 --- a/jenkins/index.d.ts +++ b/jenkins/index.d.ts @@ -65,7 +65,7 @@ declare namespace create { }; } - export interface JenkinsPromisifiedAPI { + interface JenkinsPromisifiedAPI { info(): Promise; build: { get(name: string, n: number): Promise; diff --git a/jenkins/jenkins-tests.ts b/jenkins/jenkins-tests.ts index 0b409a4b87..98b30d4b73 100644 --- a/jenkins/jenkins-tests.ts +++ b/jenkins/jenkins-tests.ts @@ -20,7 +20,7 @@ jenkins.build.log('example', 1, (err, data) => { console.log('log', data); }); -var log = jenkins.build.logStream('example', 1); +const log = jenkins.build.logStream('example', 1); log.on('data', (text: string) => { process.stdout.write(text); @@ -202,4 +202,4 @@ jenkins.view.remove('example', 'jobExample', (err) => { const jenkins2 = J({ baseUrl: 'http://user:pass@localhost:8080', crumbIssuer: true, promisify: true }); jenkins2.info().then(info => console.log(info)); -jenkins2.job.exists('example').then(exists => { var b: boolean = exists; }); +jenkins2.job.exists('example').then(exists => { const b: boolean = exists; }); diff --git a/jfs/index.d.ts b/jfs/index.d.ts index ba6edb26bc..8383f58981 100644 --- a/jfs/index.d.ts +++ b/jfs/index.d.ts @@ -7,21 +7,21 @@ declare const JsonFileStore: JsonFileStore.JsonFileStore; declare namespace JsonFileStore { - export interface Storable { + interface Storable { [key: string]: any; } - export interface Options { + interface Options { type?: 'single' | 'memory'; pretty?: boolean; saveId?: boolean | string; } - export interface JsonFileStore { + interface JsonFileStore { new (name?: string, opts?: Options): Instance; } - export interface Instance { + interface Instance { save(id: K, o: V, cb?: (err?: Error, id?: K) => void): void; save(o: V, cb?: (err?: Error, id?: string) => void): void; diff --git a/jfs/jfs-tests.ts b/jfs/jfs-tests.ts index d53d1305a2..e736e3b668 100644 --- a/jfs/jfs-tests.ts +++ b/jfs/jfs-tests.ts @@ -33,7 +33,7 @@ db.all((err, objs) => { }); // get all synchronously -var objs = db.allSync(); +const objs = db.allSync(); // delete by ID db.delete('foo', err => { diff --git a/jmespath/jmespath-tests.ts b/jmespath/jmespath-tests.ts index 04034acf67..b254a503b4 100644 --- a/jmespath/jmespath-tests.ts +++ b/jmespath/jmespath-tests.ts @@ -1,6 +1,6 @@ import jmespath = require("jmespath"); const a = jmespath.search({foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "foo.bar.baz[2]"); -const b = jmespath.search({foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "foo.bar") -const c = jmespath.search({"foo": [{"first": "a", "last": "b"}, {"first": "c", "last": "d"}]}, "foo[*].first"); -const d = jmespath.search({"foo": [{"age": 20}, {"age": 25}, {"age": 30}, {"age": 35}, {"age": 40}]}, "foo[?age > `30`]"); +const b = jmespath.search({foo: {bar: {baz: [0, 1, 2, 3, 4]}}}, "foo.bar"); +const c = jmespath.search({foo: [{first: "a", last: "b"}, {first: "c", last: "d"}]}, "foo[*].first"); +const d = jmespath.search({foo: [{age: 20}, {age: 25}, {age: 30}, {age: 35}, {age: 40}]}, "foo[?age > `30`]"); diff --git a/jquery-mask-plugin/index.d.ts b/jquery-mask-plugin/index.d.ts index 61f3a69359..270828856f 100644 --- a/jquery-mask-plugin/index.d.ts +++ b/jquery-mask-plugin/index.d.ts @@ -6,7 +6,6 @@ /// declare namespace jQueryMask { - interface Invalid { p: number; v: string; @@ -42,11 +41,9 @@ declare namespace jQueryMask { [key: string]: Pattern | {} | undefined; placeholder?: string; } - } interface JQuery { - /** * Applies the mask to the matching selector elements. * @param mask should be a string or a function. @@ -72,4 +69,4 @@ interface JQuery { * @returns Masked value. */ masked(value: string): string; -} \ No newline at end of file +} diff --git a/jquery-mask-plugin/jquery-mask-plugin-tests.ts b/jquery-mask-plugin/jquery-mask-plugin-tests.ts index 36362eccf7..310cec421b 100644 --- a/jquery-mask-plugin/jquery-mask-plugin-tests.ts +++ b/jquery-mask-plugin/jquery-mask-plugin-tests.ts @@ -1,4 +1,3 @@ - // basic usage $(document).ready(() => { $('.date').mask('00/00/0000'); @@ -53,7 +52,7 @@ let options: jQueryMask.Options = { console.log('cep changed! ', cep); }, onInvalid(val: Object, e: Event, f: JQuery, invalid: jQueryMask.Invalid[], options: jQueryMask.Options) { - var error = invalid[0]; + const error = invalid[0]; console.log("Digit: ", error.v, " is invalid for the position: ", error.p, ". We expect something like: ", error.e); } }; @@ -116,4 +115,4 @@ $('.date').unmask(); $('.date').cleanVal(); // Getting a masked value programmatically -$('.date').masked('19840807'); \ No newline at end of file +$('.date').masked('19840807'); diff --git a/jquery-toastmessage-plugin/index.d.ts b/jquery-toastmessage-plugin/index.d.ts index 2666ecbd0b..6ca6816e21 100644 --- a/jquery-toastmessage-plugin/index.d.ts +++ b/jquery-toastmessage-plugin/index.d.ts @@ -5,7 +5,7 @@ /// -declare interface JQuery { +interface JQuery { toastmessage: JQueryToastmessage.ToastmessageStatic; } @@ -54,4 +54,4 @@ declare namespace JQueryToastmessage { /** callback function when the toastmessage is closed @default null */ close?: () => void; } -} \ No newline at end of file +} diff --git a/jquery-toastmessage-plugin/jquery-toastmessage-plugin-tests.ts b/jquery-toastmessage-plugin/jquery-toastmessage-plugin-tests.ts index f11813cfbb..ae096da350 100644 --- a/jquery-toastmessage-plugin/jquery-toastmessage-plugin-tests.ts +++ b/jquery-toastmessage-plugin/jquery-toastmessage-plugin-tests.ts @@ -7,11 +7,11 @@ $().toastmessage('showErrorToast', "some message here"); // user configured toastmessage: const toastObject = $().toastmessage('showToast', { - text : 'Hello World', - sticky : true, - position : 'top-right', - type : 'success', - close : function () {console.log("toast is closed ...");} + text: 'Hello World', + sticky: true, + position: 'top-right', + type: 'success', + close() { console.log("toast is closed ..."); } }); $().toastmessage('removeToast', toastObject); @@ -20,33 +20,33 @@ $().toastmessage('removeToast', toastObject); $().toastmessage({sticky : true}); // saving the newly created toast into a variable -var myToast = $().toastmessage('showNoticeToast', 'some message here'); +const myToast = $().toastmessage('showNoticeToast', 'some message here'); // removing the toast $().toastmessage('removeToast', myToast); // user configuration of all toastmessages to come: $().toastmessage({ - text : 'Hello World', - sticky : true, - position : 'top-right', - type : 'success', - close : function () {console.log("toast is closed ...");} + text: 'Hello World', + sticky: true, + position: 'top-right', + type: 'success', + close() { console.log("toast is closed ..."); } }); $().toastmessage({ - inEffectDuration: 600, // in effect duration in miliseconds - stayTime: 3000, // time in miliseconds before the item has to disappear - text: '', // content of the item - sticky: false, // should the toast item sticky or not? - type: 'notice', // notice, warning, error, success - position: 'top-right', // top-left, top-center, top-right, middle-left, middle-center, middle-right - // Position of the toast container holding different toast. - // Position can be set only once at the very first call, - // changing the position after the first call does nothing - closeText: '', // text which will be shown as close button, - // set to '' when you want to introduce an image via css - close: undefined // callback function when the toastmessage is closed + inEffectDuration: 600, // in effect duration in miliseconds + stayTime: 3000, // time in miliseconds before the item has to disappear + text: '', // content of the item + sticky: false, // should the toast item sticky or not? + type: 'notice', // notice, warning, error, success + position: 'top-right', // top-left, top-center, top-right, middle-left, middle-center, middle-right + // Position of the toast container holding different toast. + // Position can be set only once at the very first call, + // changing the position after the first call does nothing + closeText: '', // text which will be shown as close button, + // set to '' when you want to introduce an image via css + close: undefined // callback function when the toastmessage is closed }); /* code examples from tests */ @@ -58,28 +58,28 @@ $().toastmessage('showNoticeToast', "NOTICE"); $().toastmessage('showWarningToast', "WARNING"); $().toastmessage('showErrorToast', "ERROR"); $().toastmessage({ - sticky : true, - position : 'top-right', + sticky: true, + position: 'top-right', closeText: '' }); $().toastmessage('showToast', { - text : 'Success Dialog', - type : 'success' + text: 'Success Dialog', + type: 'success' }); $().toastmessage('showToast', { - text : 'Success Dialog', - sticky : true, - position : 'top-right', - type : 'success', + text: 'Success Dialog', + sticky: true, + position: 'top-right', + type: 'success', closeText: '', - close : () => {} + close() {} }); -var toast = $().toastmessage('showToast', { - text : 'Success Dialog', - sticky : true, - position : 'top-right', - type : 'success', +const toast = $().toastmessage('showToast', { + text: 'Success Dialog', + sticky: true, + position: 'top-right', + type: 'success', closeText: '', - close : () => {} + close() {} }); -$().toastmessage('removeToast', toast, { close : () => {} }); +$().toastmessage('removeToast', toast, { close() {} }); diff --git a/jquery.tools/index.d.ts b/jquery.tools/index.d.ts index e511a961fd..fa1bc80cb4 100644 --- a/jquery.tools/index.d.ts +++ b/jquery.tools/index.d.ts @@ -3,16 +3,15 @@ // Definitions by: Joe Skeen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - /// -declare interface JQuery { +interface JQuery { overlay(opts?: JQueryTools.overlay.OverlayOptions): JQuery; overlay(opts?: JQueryTools.overlay.OverlayOptions): T; data(key: 'overlay'): JQueryTools.overlay.Overlay; } -declare interface JQueryStatic { +interface JQueryStatic { tools: JQueryTools.ToolsStatic; } diff --git a/jquery.tools/jquery.tools-tests.ts b/jquery.tools/jquery.tools-tests.ts index 443425e76b..5092b49bff 100644 --- a/jquery.tools/jquery.tools-tests.ts +++ b/jquery.tools/jquery.tools-tests.ts @@ -2,7 +2,7 @@ $("img[rel]").overlay(); - var triggers = $(".modalInput").overlay({ + const triggers = $(".modalInput").overlay({   // some mask tweaks suitable for modal dialogs mask: { @@ -14,10 +14,10 @@ closeOnClick: false }); - var buttons = $("#yesno button").click(function(this: JQuery, e: JQueryEventObject) { + const buttons = $("#yesno button").click(function(this: JQuery, e: JQueryEventObject) {   // get user input - var yes = buttons.index(this) === 0; + const yes = buttons.index(this) === 0;   // do something with the answer triggers.eq(0).html("You clicked " + (yes ? "yes" : "no")); @@ -42,7 +42,7 @@ $("#prompt form").submit(function(this: JQuery, e: JQueryEventObject) { triggers.data('overlay').close();   // get user input - var input = $("input", this).val(); + const input = $("input", this).val();   // do something with the answer triggers.eq(1).html(input); @@ -101,7 +101,7 @@ $(function() {   onBeforeLoad() { // grab wrapper element inside content - var wrap = this.getOverlay().find(".contentWrap"); + const wrap = this.getOverlay().find(".contentWrap");   // load the page specified in the trigger wrap.load(this.getTrigger().attr("href")); @@ -112,7 +112,7 @@ $(function() { $(() => { // positions for each overlay - var positions = [ + const positions = [ [0, 530], [400, 20], [400, 530], @@ -143,7 +143,7 @@ $(() => { $.tools.overlay.addEffect("drop", function(css, done) {   // use Overlay API to gain access to crucial elements - var conf = this.getConf(), + const conf = this.getConf(), overlay = this.getOverlay();   // determine initial position for the overlay diff --git a/js-data-http/index.d.ts b/js-data-http/index.d.ts index 2fa9c0e09a..2a2fafcedb 100644 --- a/js-data-http/index.d.ts +++ b/js-data-http/index.d.ts @@ -6,7 +6,6 @@ import * as JSData from 'js-data'; declare module 'js-data' { - interface DSHttpAdapterOptions { serialize?: (resourceName: string, data: any) => any; deserialize?: (resourceName: string, data: any) => any; @@ -27,7 +26,6 @@ declare module 'js-data' { } interface DSHttpAdapter extends IDSAdapter { - new(options?: DSHttpAdapterOptions): DSHttpAdapter; defaults: DSHttpAdapterOptions; @@ -44,4 +42,4 @@ declare module 'js-data' { declare var DSHttpAdapter: JSData.DSHttpAdapter; export = DSHttpAdapter; -export as namespace DSHttpAdapter; \ No newline at end of file +export as namespace DSHttpAdapter; diff --git a/js-data-http/js-data-http-tests.ts b/js-data-http/js-data-http-tests.ts index d98cdd642a..082d34a71f 100644 --- a/js-data-http/js-data-http-tests.ts +++ b/js-data-http/js-data-http-tests.ts @@ -3,14 +3,14 @@ import DSHttpAdapter = require("js-data-http"); declare var axios: any; -var adapter = new DSHttpAdapter(); -var store = new JSData.DS(); +const adapter = new DSHttpAdapter(); +const store = new JSData.DS(); store.registerAdapter('http', adapter, { default: true }); adapter.defaults.basePath = '/api'; adapter.http = axios; -var ADocument: JSData.DSResourceDefinition = store.defineResource('document'); +const ADocument: JSData.DSResourceDefinition = store.defineResource('document'); ADocument.inject({ id: 5, author: 'John' }); @@ -79,9 +79,9 @@ adapter.GET('/user/1').then(data => { data.config; // {...} }); -var User: JSData.DSResourceDefinition = store.defineResource('user'); +const User: JSData.DSResourceDefinition = store.defineResource('user'); -var params: any = { +let params: any = { age: { '>': 30 } @@ -119,7 +119,7 @@ ADocument.find(5).then((document: any) => { ADocument.get(document.id); // { id: 5, author: 'John Anderson' } }); -var params: any = { +params = { author: 'John' }; diff --git a/js-quantities/index.d.ts b/js-quantities/index.d.ts index 5d4a8df304..ab76433c0d 100644 --- a/js-quantities/index.d.ts +++ b/js-quantities/index.d.ts @@ -5,7 +5,7 @@ declare const Qty: Qty.Type; -declare interface Qty { +interface Qty { readonly numerator: string[]; readonly denominator: string[]; readonly scalar: number; @@ -39,7 +39,6 @@ declare interface Qty { } declare namespace Qty { - interface Type { (value: Source): Qty; (value: number, unit: string): Qty; diff --git a/js-quantities/js-quantities-tests.ts b/js-quantities/js-quantities-tests.ts index ed69816dc3..e7734e7520 100644 --- a/js-quantities/js-quantities-tests.ts +++ b/js-quantities/js-quantities-tests.ts @@ -84,13 +84,13 @@ Qty('10ohm').inverse(); // '.1/ohm' (not '.1S', although they are equivalent) // however, the 'to' command will convert between inverses also Qty('10ohm').to('S'); // '.1S' -var convert = Qty.swiftConverter('m/h', 'ft/s'); // Configures converter +const convert = Qty.swiftConverter('m/h', 'ft/s'); // Configures converter // Converting single value -var converted = convert(2500); // => 2.278.. +const converted = convert(2500); // => 2.278.. // Converting large array of values -var convertedSerie = convert([2500, 5000]); // => [2.278.., 4.556.., ...] +const convertedSerie = convert([2500, 5000]); // => [2.278.., 4.556.., ...] qty1.eq(qty2); // => true if both quantities are equal (1m == 100cm => true) qty1.same(qty2); // => true if both quantities are same (1m == 100cm => false) @@ -138,10 +138,10 @@ qty = Qty('1.1234 m'); qty.format(); // same units, default formatter => '1.234 m' qty.format('cm'); // converted to 'cm', default formatter => '123.45 cm' -var configurableRoundingFormatter = (maxDecimals: number) => { +const configurableRoundingFormatter = (maxDecimals: number) => { return (scalar: number, units: string) => { - var pow = Math.pow(10, maxDecimals); - var rounded = Math.round(scalar * pow) / pow; + const pow = Math.pow(10, maxDecimals); + const rounded = Math.round(scalar * pow) / pow; return rounded + ' ' + units; }; @@ -200,13 +200,13 @@ describe("js-quantities", () => { describe("initialization", () => { it("should create unit only", () => { - var qty = Qty("m"); + const qty = Qty("m"); expect(qty.numerator).toEqual([""]); expect(qty.scalar).toBe(1); }); it("should create unitless", () => { - var qty = Qty("1"); + let qty = Qty("1"); expect(qty.toFloat()).toBe(1); expect(qty.numerator).toEqual(["<1>"]); expect(qty.denominator).toEqual(["<1>"]); @@ -217,21 +217,21 @@ describe("js-quantities", () => { }); it("should create unitless from numbers", () => { - var qty = Qty(1.5); + const qty = Qty(1.5); expect(qty.toFloat()).toBe(1.5); expect(qty.numerator).toEqual(["<1>"]); expect(qty.denominator).toEqual(["<1>"]); }); it("should create from numbers with explicit units", () => { - var qty = Qty(1.5, "m"); + const qty = Qty(1.5, "m"); expect(qty.scalar).toBe(1.5); expect(qty.numerator).toEqual([""]); expect(qty.denominator).toEqual(["<1>"]); }); it("temperatures should have base unit in kelvin", () => { - var qty = Qty("1 tempK").toBase(); + let qty = Qty("1 tempK").toBase(); expect(qty.scalar).toBe(1); expect(qty.units()).toBe("tempK"); @@ -249,7 +249,7 @@ describe("js-quantities", () => { }); it("temperature degrees should have base unit in kelvin", () => { - var qty = Qty("1 degK").toBase(); + let qty = Qty("1 degK").toBase(); expect(qty.scalar).toBe(1); expect(qty.units()).toBe("degK"); @@ -272,7 +272,7 @@ describe("js-quantities", () => { expect(() => { Qty("-459.68 tempF"); }).toThrow("Temperatures must not be less than absolute zero"); expect(() => { Qty("-1 tempR"); }).toThrow("Temperatures must not be less than absolute zero"); - var qty = Qty("1 tempK"); + let qty = Qty("1 tempK"); expect(() => { qty.mul("-1"); }).toThrow("Temperatures must not be less than absolute zero"); qty = Qty("0 tempK"); @@ -289,28 +289,28 @@ describe("js-quantities", () => { }); it("should create simple", () => { - var qty = Qty("1m"); + const qty = Qty("1m"); expect(qty.scalar).toBe(1); expect(qty.numerator).toEqual([""]); expect(qty.denominator).toEqual(["<1>"]); }); it("should create negative", () => { - var qty = Qty("-1m"); + const qty = Qty("-1m"); expect(qty.scalar).toBe(-1); expect(qty.numerator).toEqual([""]); expect(qty.denominator).toEqual(["<1>"]); }); it("should create compound", () => { - var qty = Qty("1 N*m"); + const qty = Qty("1 N*m"); expect(qty.scalar).toBe(1); expect(qty.numerator).toEqual(["", ""]); expect(qty.denominator).toEqual(["<1>"]); }); it("should create pressure units in term of height of water", () => { - var qty = Qty("1 inH2O"); + let qty = Qty("1 inH2O"); expect(qty.scalar).toBe(1); expect(qty.numerator).toEqual([""]); @@ -320,14 +320,14 @@ describe("js-quantities", () => { }); it("should create with denominator", () => { - var qty = Qty("1 m/s"); + const qty = Qty("1 m/s"); expect(qty.scalar).toBe(1); expect(qty.numerator).toEqual([""]); expect(qty.denominator).toEqual([""]); }); it("should create with denominator only", () => { - var qty = Qty("1 /s"); + let qty = Qty("1 /s"); expect(qty.scalar).toBe(1); expect(qty.numerator).toEqual(["<1>"]); expect(qty.denominator).toEqual([""]); @@ -344,7 +344,7 @@ describe("js-quantities", () => { }); it("should create with powers", () => { - var qty = Qty("1 m^2/s^2"); + let qty = Qty("1 m^2/s^2"); expect(qty.scalar).toBe(1); expect(qty.numerator).toEqual(["", ""]); expect(qty.denominator).toEqual(["", ""]); @@ -359,14 +359,14 @@ describe("js-quantities", () => { }); it("should create with zero power", () => { - var qty = Qty("1 m^0"); + const qty = Qty("1 m^0"); expect(qty.scalar).toBe(1); expect(qty.numerator).toEqual(["<1>"]); expect(qty.denominator).toEqual(["<1>"]); }); it("should create with negative powers", () => { - var qty = Qty("1 m^2 s^-2"); + const qty = Qty("1 m^2 s^-2"); expect(qty.scalar).toBe(1); expect(qty.numerator).toEqual(["", ""]); expect(qty.denominator).toEqual(["", ""]); @@ -374,26 +374,26 @@ describe("js-quantities", () => { }); it("should accept powers without ^ syntax (simple)", () => { - var qty1 = Qty("1 m2"); - var qty2 = Qty("1 m^2"); + const qty1 = Qty("1 m2"); + const qty2 = Qty("1 m^2"); expect(qty1.eq(qty2)).toBe(true); }); it("should accept powers without ^ syntax (negative power)", () => { - var qty1 = Qty("1 m-2"); - var qty2 = Qty("1 m^-2"); + const qty1 = Qty("1 m-2"); + const qty2 = Qty("1 m^-2"); expect(qty1.eq(qty2)).toBe(true); }); it("should accept powers without ^ syntax (compound)", () => { - var qty1 = Qty("1 m^2 kg^2 J^2/s^2"); - var qty2 = Qty("1 m2 kg2 J2/s2"); + const qty1 = Qty("1 m^2 kg^2 J^2/s^2"); + const qty2 = Qty("1 m2 kg2 J2/s2"); expect(qty1.eq(qty2)).toBe(true); }); it("should accept powers without ^ syntax (compound and negative power)", () => { - var qty1 = Qty("1 m^2 kg^2 J^2 s^-2"); - var qty2 = Qty("1 m2 kg2 J2 s-2"); + const qty1 = Qty("1 m^2 kg^2 J^2 s^-2"); + const qty2 = Qty("1 m2 kg2 J2 s-2"); expect(qty1.eq(qty2)).toBe(true); }); @@ -424,7 +424,7 @@ describe("js-quantities", () => { }); it("should set baseScalar", () => { - var qty = Qty("0.018 MPa"); + let qty = Qty("0.018 MPa"); expect(qty.baseScalar).toBe(18000); qty = Qty("66 cm3"); @@ -432,8 +432,8 @@ describe("js-quantities", () => { }); it("should keep init value as is", () => { - var initValue = " 66 cm3 "; - var qty = Qty(initValue); + const initValue = " 66 cm3 "; + const qty = Qty(initValue); expect(qty.initValue).toEqual(initValue); }); @@ -443,7 +443,7 @@ describe("js-quantities", () => { }); it("should allow whitespaces between sign and scalar", () => { - var qty = Qty("- 1m"); + const qty = Qty("- 1m"); expect(qty.scalar).toEqual(-1); expect(qty.units()).toEqual("m"); @@ -457,23 +457,23 @@ describe("js-quantities", () => { describe("isCompatible", () => { it("should return true with compatible quantities", () => { - var qty1 = Qty("1 m*kg/s"); - var qty2 = Qty("1 in*pound/min"); + const qty1 = Qty("1 m*kg/s"); + let qty2 = Qty("1 in*pound/min"); expect(qty1.isCompatible(qty2)).toBe(true); qty2 = Qty("1 in/min"); expect(qty1.isCompatible(qty2)).toBe(false); }); it("should return true with dimensionless quantities", () => { - var qty1 = Qty("1"); - var qty2 = Qty("2"); + const qty1 = Qty("1"); + const qty2 = Qty("2"); expect(qty1.isCompatible(qty2)).toBe(true); }); }); describe("conversion", () => { it("should convert to base units", () => { - var qty = Qty("100 cm"); + let qty = Qty("100 cm"); expect(qty.toBase().scalar).toBe(1); expect(qty.toBase().units()).toBe("m"); qty = Qty("10 cm"); @@ -485,7 +485,7 @@ describe("js-quantities", () => { }); it("should convert to compatible units", () => { - var qty = Qty("10 cm"); + let qty = Qty("10 cm"); expect(qty.to("ft").scalar).toBe(Qty.divSafe(0.1, 0.3048)); qty = Qty("2m^3"); expect(qty.to("l").scalar).toBe(2000); @@ -518,7 +518,7 @@ describe("js-quantities", () => { }); it("should convert temperatures to compatible units", () => { - var qty = Qty("0 tempK"); + let qty = Qty("0 tempK"); expect(qty.to("tempC").scalar).toBe(-273.15); qty = Qty("0 tempF"); @@ -532,7 +532,7 @@ describe("js-quantities", () => { }); it("should convert temperature degrees to compatible units", () => { - var qty = Qty("0 degK"); + let qty = Qty("0 degK"); expect(qty.to("degC").scalar).toBe(0); qty = Qty("1 degK/s"); @@ -547,7 +547,7 @@ describe("js-quantities", () => { it("should convert temperature degrees to temperatures", () => { // according to ruby-units, deg -> temp conversion adds the degress to 0 kelvin before converting - var qty = Qty("100 degC"); + let qty = Qty("100 degC"); expect(qty.to("tempC").scalar).toBeCloseTo(-173.15, 10); qty = Qty("273.15 degC"); @@ -559,7 +559,7 @@ describe("js-quantities", () => { it("should convert temperatures to temperature degrees", () => { // according to ruby-units, temp -> deg conversion always uses the 0 relative degrees - var qty = Qty("100 tempC"); + let qty = Qty("100 tempC"); expect(qty.to("degC").scalar).toBe(100); qty = Qty("0 tempK"); @@ -576,8 +576,8 @@ describe("js-quantities", () => { }); it("should calculate inverses", () => { - var qty = Qty("1 ohm"); - var result = qty.to("siemens"); + let qty = Qty("1 ohm"); + let result = qty.to("siemens"); expect(result.scalar).toBe(1); expect(result.kind()).toBe("conductance"); @@ -611,7 +611,7 @@ describe("js-quantities", () => { }); it("should return itself if target units are the same", () => { - var qty = Qty("123 cm3"); + let qty = Qty("123 cm3"); expect(qty.to("cm3")).toBe(qty); expect(qty.to("cm^3")).toBe(qty); @@ -621,7 +621,7 @@ describe("js-quantities", () => { }); it("should be cached", () => { - var qty = Qty("100 m"), + const qty = Qty("100 m"), converted = qty.to("ft"); expect(qty.to("ft") === converted).toBe(true); @@ -630,16 +630,16 @@ describe("js-quantities", () => { describe("comparison", () => { it("should return true when comparing equal quantities", () => { - var qty1 = Qty("1cm"); - var qty2 = Qty("10mm"); + const qty1 = Qty("1cm"); + const qty2 = Qty("10mm"); expect(qty1.eq(qty2)).toBe(true); }); it("should compare compatible quantities", () => { - var qty1 = Qty("1cm"); - var qty2 = Qty("1mm"); - var qty3 = Qty("10mm"); - var qty4 = Qty("28A"); + const qty1 = Qty("1cm"); + const qty2 = Qty("1mm"); + const qty3 = Qty("10mm"); + const qty4 = Qty("28A"); expect(qty1.compareTo(qty2)).toBe(1); expect(qty2.compareTo(qty1)).toBe(-1); expect(qty1.compareTo(qty3)).toBe(0); @@ -654,21 +654,20 @@ describe("js-quantities", () => { }); it("should compare identical quantities", () => { - var qty1 = Qty("1cm"); - var qty2 = Qty("1cm"); - var qty3 = Qty("10mm"); + const qty1 = Qty("1cm"); + const qty2 = Qty("1cm"); + const qty3 = Qty("10mm"); expect(qty1.same(qty2)).toBe(true); expect(qty1.same(qty3)).toBe(false); }); it("should accept strings as parameter", () => { - var qty = Qty("1 cm"); + const qty = Qty("1 cm"); expect(qty.lt("0.5 cm")).toBe(false); expect(qty.lte("1 cm")).toBe(true); expect(qty.gte("3 mm")).toBe(true); expect(qty.gt("5 m")).toBe(false); }); - }); describe("non-ASCII character", () => { @@ -692,16 +691,15 @@ describe("js-quantities", () => { }); describe("math", () => { - it("should add quantities", () => { - var qty1 = Qty("2.5m"); - var qty2 = Qty("3m"); + const qty1 = Qty("2.5m"); + let qty2 = Qty("3m"); expect(qty1.add(qty2).scalar).toBe(5.5); expect(qty1.add("3m").scalar).toBe(5.5); qty2 = Qty("3cm"); - var result = qty1.add(qty2); + let result = qty1.add(qty2); expect(result.scalar).toBe(2.53); expect(result.units()).toBe("m"); @@ -716,15 +714,15 @@ describe("js-quantities", () => { }); it("should fail to add unlike quantities", () => { - var qty1 = Qty("3m"); - var qty2 = Qty("2s"); + const qty1 = Qty("3m"); + const qty2 = Qty("2s"); expect(() => { qty1.add(qty2); }).toThrow("Incompatible units"); expect(() => { qty2.add(qty1); }).toThrow("Incompatible units"); }); it("should fail to add inverse quantities", () => { - var qty1 = Qty("10S"); - var qty2 = qty1.inverse(); + let qty1 = Qty("10S"); + let qty2 = qty1.inverse(); expect(() => { qty1.add(qty2); }).toThrow("Incompatible units"); expect(() => { qty2.add(qty1); }).toThrow("Incompatible units"); @@ -735,15 +733,15 @@ describe("js-quantities", () => { }); it("should subtract quantities", () => { - var qty1 = Qty("2.5m"); - var qty2 = Qty("3m"); + const qty1 = Qty("2.5m"); + let qty2 = Qty("3m"); expect(qty1.sub(qty2).scalar).toBe(-0.5); expect(qty1.sub("2m").scalar).toBe(0.5); expect(qty1.sub("-2m").scalar).toBe(4.5); qty2 = Qty("3cm"); - var result = qty1.sub(qty2); + let result = qty1.sub(qty2); expect(result.scalar).toBe(2.47); expect(result.units()).toBe("m"); @@ -753,15 +751,15 @@ describe("js-quantities", () => { }); it("should fail to subtract unlike quantities", () => { - var qty1 = Qty("3m"); - var qty2 = Qty("2s"); + const qty1 = Qty("3m"); + const qty2 = Qty("2s"); expect(() => { qty1.sub(qty2); }).toThrow("Incompatible units"); expect(() => { qty2.sub(qty1); }).toThrow("Incompatible units"); }); it("should fail to subtract inverse quantities", () => { - var qty1 = Qty("10S"); - var qty2 = qty1.inverse(); + let qty1 = Qty("10S"); + let qty2 = qty1.inverse(); expect(() => { qty1.sub(qty2); }).toThrow("Incompatible units"); expect(() => { qty2.sub(qty1); }).toThrow("Incompatible units"); @@ -772,9 +770,9 @@ describe("js-quantities", () => { }); it("should multiply quantities", () => { - var qty1 = Qty("2.5m"); - var qty2 = Qty("3m"); - var result = qty1.mul(qty2); + const qty1 = Qty("2.5m"); + let qty2 = Qty("3m"); + let result = qty1.mul(qty2); expect(result.scalar).toBe(7.5); expect(result.units()).toBe("m2"); expect(result.kind()).toBe("area"); @@ -807,10 +805,10 @@ describe("js-quantities", () => { }); it("should multiply unlike quantities", () => { - var qty1 = Qty("2.5 m"); - var qty2 = Qty("3 N"); + let qty1 = Qty("2.5 m"); + let qty2 = Qty("3 N"); - var result = qty1.mul(qty2); + let result = qty1.mul(qty2); expect(result.scalar).toBe(7.5); qty1 = Qty("2.5 m^2"); @@ -822,11 +820,11 @@ describe("js-quantities", () => { }); it("should multiply inverse quantities", () => { - var qty1 = Qty("10S"); - var qty2 = Qty(".5S").inverse(); // 2/S - var qty3 = qty1.inverse(); // .1/S + const qty1 = Qty("10S"); + const qty2 = Qty(".5S").inverse(); // 2/S + const qty3 = qty1.inverse(); // .1/S - var result = qty1.mul(qty2); + let result = qty1.mul(qty2); expect(result.scalar).toBe(20); expect(result.isUnitless()).toBe(true); expect(result.units()).toBe(""); @@ -848,20 +846,20 @@ describe("js-quantities", () => { }); it("should divide quantities", () => { - var qty1 = Qty("2.5m"); - var qty2 = Qty("3m"); - var qty3 = Qty("0m"); + const qty1 = Qty("2.5m"); + const qty2 = Qty("3m"); + const qty3 = Qty("0m"); expect(() => { qty1.div(qty3); }).toThrow("Divide by zero"); expect(() => { qty1.div(0); }).toThrow("Divide by zero"); expect(qty3.div(qty1).scalar).toBe(0); - var result = qty1.div(qty2); + let result = qty1.div(qty2); expect(result.scalar).toBe(2.5 / 3); expect(result.units()).toBe(""); expect(result.kind()).toBe("unitless"); - var qty4 = Qty("3cm"); + const qty4 = Qty("3cm"); result = qty1.div(qty4); expect(result.scalar).toBe(2.5 / 0.03); expect(result.units()).toBe(""); @@ -876,20 +874,20 @@ describe("js-quantities", () => { }); it("should divide unlike quantities", () => { - var qty1 = Qty("7.5kg"); - var qty2 = Qty("2.5m^2"); + const qty1 = Qty("7.5kg"); + const qty2 = Qty("2.5m^2"); - var result = qty1.div(qty2); + const result = qty1.div(qty2); expect(result.scalar).toBe(3); expect(result.units()).toBe("kg/m2"); }); it("should divide inverse quantities", () => { - var qty1 = Qty("10 S"); - var qty2 = Qty(".5 S").inverse(); // 2/S - var qty3 = qty1.inverse(); // .1/S + const qty1 = Qty("10 S"); + const qty2 = Qty(".5 S").inverse(); // 2/S + const qty3 = qty1.inverse(); // .1/S - var result = qty1.div(qty2); + let result = qty1.div(qty2); expect(result.scalar).toBe(5); expect(result.units()).toBe("S2"); @@ -905,18 +903,16 @@ describe("js-quantities", () => { expect(result.scalar).toBe(0.01); expect(result.units()).toBe("1/S2"); }); - }); describe("math with temperatures", () => { - it("should add temperature degrees", () => { - var qty = Qty("2degC"); + let qty = Qty("2degC"); expect(qty.add("3degF").scalar).toBeCloseTo(11 / 3, 10); expect(qty.add("-1degC").scalar).toBe(1); qty = Qty("2 degC"); - var result = qty.add("2 degF"); + let result = qty.add("2 degF"); expect(result.scalar).toBe(28 / 9); expect(result.units()).toBe("degC"); @@ -932,14 +928,14 @@ describe("js-quantities", () => { }); it("should not add two temperatures", () => { - var qty = Qty("2tempC"); + const qty = Qty("2tempC"); expect(() => { qty.add("1 tempF"); }).toThrow("Cannot add two temperatures"); expect(() => { qty.add("1 tempC"); }).toThrow("Cannot add two temperatures"); }); it("should add temperatures to degrees", () => { - var qty = Qty("2degC"); - var result = qty.add("3tempF"); + let qty = Qty("2degC"); + let result = qty.add("3tempF"); expect(result.scalar).toBe(33 / 5); expect(result.units()).toBe("tempF"); @@ -954,33 +950,33 @@ describe("js-quantities", () => { }); it("should subtract degrees from degrees", () => { - var qty = Qty("2degC"); + const qty = Qty("2degC"); expect(qty.sub("1.5degK").scalar).toBe(0.5); expect(qty.sub("-2degC").scalar).toBe(4); expect(qty.sub("1degF").scalar).toBe(2 - 5 / 9); expect(qty.sub("-1degC").scalar).toBe(3); - var result = qty.sub("degC"); + const result = qty.sub("degC"); expect(result.scalar).toBe(1); expect(result.units()).toBe("degC"); }); it("should subtract degrees from temperatures", () => { - var qty = Qty("2tempC"); + const qty = Qty("2tempC"); expect(qty.sub("1.5degK").scalar).toBe(0.5); expect(qty.sub("-2degC").scalar).toBe(4); expect(qty.sub("1degF").scalar).toBe(2 - 5 / 9); expect(qty.sub("-1degC").scalar).toBe(3); - var result = qty.sub("degC"); + const result = qty.sub("degC"); expect(result.scalar).toBe(1); expect(result.units()).toBe("tempC"); }); it("should subtract temperatures from temperatures", () => { - var qty = Qty("2tempC"); + const qty = Qty("2tempC"); - var result = qty.sub("1.5tempK"); + let result = qty.sub("1.5tempK"); expect(result.scalar).toBe(273.65); expect(result.units()).toBe("degC"); @@ -994,14 +990,14 @@ describe("js-quantities", () => { }); it("should not subtract temperatures from degrees", () => { - var qty = Qty("2degC"); + const qty = Qty("2degC"); expect(() => { qty.sub("1 tempF"); }).toThrow("Cannot subtract a temperature from a differential degree unit"); expect(() => { qty.sub("1 tempC"); }).toThrow("Cannot subtract a temperature from a differential degree unit"); }); it("should multiply temperature degrees", () => { - var qty = Qty("2degF"); - var result = qty.mul(3); + let qty = Qty("2degF"); + let result = qty.mul(3); expect(result.scalar).toBe(6); expect(result.units()).toBe("degF"); @@ -1022,12 +1018,12 @@ describe("js-quantities", () => { }); it("should not multiply temperatures except by scalar", () => { - var qty = Qty("2tempF"); + const qty = Qty("2tempF"); expect(() => { qty.mul("1 tempC"); }).toThrow("Cannot multiply by temperatures"); expect(() => { qty.mul("1 degC"); }).toThrow("Cannot multiply by temperatures"); expect(() => { Qty("1 tempC*s"); }).toThrow("Cannot multiply by temperatures"); - var result = qty.mul(2); + let result = qty.mul(2); expect(result.scalar).toBe(4); expect(result.units()).toBe("tempF"); @@ -1037,10 +1033,10 @@ describe("js-quantities", () => { }); it("should multiply temperature degrees with unlike quantities", () => { - var qty1 = Qty("2.5 degF"); - var qty2 = Qty("3 m"); + let qty1 = Qty("2.5 degF"); + let qty2 = Qty("3 m"); - var result = qty1.mul(qty2); + let result = qty1.mul(qty2); expect(result.scalar).toBe(7.5); qty1 = Qty("2.5 degF"); @@ -1052,23 +1048,23 @@ describe("js-quantities", () => { }); it("should divide temperature degrees with unlike quantities", () => { - var qty1 = Qty("7.5degF"); - var qty2 = Qty("2.5m^2"); + const qty1 = Qty("7.5degF"); + const qty2 = Qty("2.5m^2"); - var result = qty1.div(qty2); + const result = qty1.div(qty2); expect(result.scalar).toBe(3); expect(result.units()).toBe("degF/m2"); }); it("should divide temperature degree quantities", () => { - var qty = Qty("2.5 degF"); + const qty = Qty("2.5 degF"); expect(() => { qty.div("0 degF"); }).toThrow("Divide by zero"); expect(() => { qty.div(0); }).toThrow("Divide by zero"); expect(Qty("0 degF").div(qty).scalar).toBe(0); expect(Qty("0 degF").div(qty).units()).toBe(""); - var result = qty.div("3 degF"); + let result = qty.div("3 degF"); expect(result.scalar).toBe(2.5 / 3); expect(result.units()).toBe(""); expect(result.kind()).toBe("unitless"); @@ -1094,11 +1090,10 @@ describe("js-quantities", () => { // inverse is division: 1/x expect(() => { Qty("tempF").inverse(); }).toThrow("Cannot divide with temperatures"); - var result = Qty("4 tempF").div(2); + const result = Qty("4 tempF").div(2); expect(result.scalar).toBe(2); expect(result.units()).toBe("tempF"); }); - }); describe("errors", () => { @@ -1112,16 +1107,15 @@ describe("js-quantities", () => { }); describe("utility methods", () => { - it("should accept string as parameter for compatibility tests", () => { - var qty = Qty("1 mm"); + const qty = Qty("1 mm"); expect(qty.isCompatible("2 mm")).toBe(true); expect(qty.isCompatible("2 mm^3")).toBe(false); }); it("should return kind", () => { - var qty = Qty("1 mm"); + let qty = Qty("1 mm"); expect(qty.kind()).toBe("length"); qty = Qty("1 N"); @@ -1129,7 +1123,7 @@ describe("js-quantities", () => { }); it("should know if a quantity is in base units", () => { - var qty = Qty("100 cm"); + let qty = Qty("100 cm"); expect(qty.isBase()).toBe(false); qty = Qty("1m"); @@ -1137,7 +1131,7 @@ describe("js-quantities", () => { }); it("should return unit part of quantities", () => { - var qty = Qty("1"); + let qty = Qty("1"); expect(qty.units()).toBe(""); qty = Qty("1 /s"); expect(qty.units()).toBe("1/s"); @@ -1152,12 +1146,11 @@ describe("js-quantities", () => { qty = Qty("1 cm^2*J^3/s^2*A^2"); expect(qty.units()).toBe("cm2*J3/s2*A2"); }); - }); describe("toString", () => { it("should generate readable human output", () => { - var qty = Qty("2m"); + let qty = Qty("2m"); expect(qty.toString()).toBe("2 m"); expect(qty.toString("cm")).toBe("200 cm"); expect(qty.toString("km")).toBe("0.002 km"); @@ -1176,7 +1169,7 @@ describe("js-quantities", () => { }); it("should round readable human output when max decimals is specified", () => { - var qty = (Qty("2m")).div(3); + let qty = Qty("2m").div(3); expect(qty.toString("cm", 2)).toBe("66.67 cm"); qty = Qty("2.8m"); @@ -1187,14 +1180,14 @@ describe("js-quantities", () => { }); it("should round to max decimals", () => { - var qty = (Qty("2.987654321 m")); + const qty = Qty("2.987654321 m"); expect(qty.toString(3)).toBe("2.988 m"); expect(qty.toString(0)).toBe("3 m"); }); it("should round according to precision passed as quantity", () => { - var qty = Qty("5.17 ft"); + const qty = Qty("5.17 ft"); expect(qty.toString(Qty("ft"))).toBe("5 ft"); expect(qty.toString(Qty("2 ft"))).toBe("6 ft"); @@ -1206,49 +1199,48 @@ describe("js-quantities", () => { }); it("should return same output with successive calls", () => { - var qty = Qty("123 cm3"); + const qty = Qty("123 cm3"); expect(qty.toString("cm3", 0)).toBe("123 cm3"); expect(qty.toString("cm3", 0)).toBe("123 cm3"); }); it("should return identical output when called with no parameters or same units", () => { - var qty = Qty("123 cm3"); + const qty = Qty("123 cm3"); expect(qty.toString()).toBe(qty.toString("cm3")); }); - }); describe("format", () => { describe("provided default formatter", () => { it("should be applied to output", () => { - var qty = (Qty("2.987654321 m")); + const qty = Qty("2.987654321 m"); expect(qty.format()).toBe("2.987654321 m"); }); }); describe("custom formatter", () => { - var roundingFormatter = (maxDecimals: number) => { + const roundingFormatter = (maxDecimals: number) => { return (scalar: number, units: string) => { - var pow = Math.pow(10, maxDecimals); - var rounded = Math.round(scalar * pow) / pow; + const pow = Math.pow(10, maxDecimals); + const rounded = Math.round(scalar * pow) / pow; return rounded + " " + units; }; }; it("should be applied to output", () => { - var qty = (Qty("2.987654321 m")); + const qty = Qty("2.987654321 m"); expect(qty.format(roundingFormatter(3))).toBe("2.988 m"); expect(qty.format(roundingFormatter(0))).toBe("3 m"); }); it("should be applied after conversion to target units", () => { - var qty = (Qty("2m")).div(3); + let qty = Qty("2m").div(3); expect(qty.format("cm", roundingFormatter(2))).toBe("66.67 cm"); - var intRoundingFormatter = roundingFormatter(0); + const intRoundingFormatter = roundingFormatter(0); qty = Qty("2.8m"); expect(qty.format("m", intRoundingFormatter)).toBe("3 m"); expect(qty.format("cm", intRoundingFormatter)).toBe("280 cm"); @@ -1257,7 +1249,7 @@ describe("js-quantities", () => { }); describe("globally set as default formatter", () => { - var previousFormatter: Qty.Formatter; + let previousFormatter: Qty.Formatter; beforeEach(() => { previousFormatter = Qty.formatter; @@ -1270,7 +1262,7 @@ describe("js-quantities", () => { }); it("should be applied when no formatter is passed", () => { - var qty = (Qty("2.987654321 m")); + const qty = Qty("2.987654321 m"); expect(qty.format()).toBe("2.988 m"); }); @@ -1280,7 +1272,7 @@ describe("js-quantities", () => { describe("precision rounding", () => { it("should round according to precision passed as quantity with same units", () => { - var qty = Qty("5.17 ft"); + const qty = Qty("5.17 ft"); expect(qty.toPrec(Qty("ft")).toString()).toBe("5 ft"); expect(qty.toPrec(Qty("2 ft")).toString()).toBe("6 ft"); @@ -1294,7 +1286,7 @@ describe("js-quantities", () => { }); it("should allow string as precision parameter", () => { - var qty = Qty("5.17 ft"); + const qty = Qty("5.17 ft"); expect(qty.toPrec("ft").toString()).toBe("5 ft"); expect(qty.toPrec("0.5 ft").toString()).toBe("5 ft"); @@ -1302,7 +1294,7 @@ describe("js-quantities", () => { }); it("should round according to precision passed as quantity with different prefixes", () => { - var qty = Qty("6.3782 m"); + const qty = Qty("6.3782 m"); expect(qty.toPrec(Qty("dm")).toString()).toBe("6.4 m"); expect(qty.toPrec(Qty("cm")).toString()).toBe("6.38 m"); @@ -1312,7 +1304,7 @@ describe("js-quantities", () => { }); it("should round according to precision passed as quantity with different compatible units", () => { - var qty = Qty("1.146 MPa"); + let qty = Qty("1.146 MPa"); expect(qty.toPrec(Qty("0.1 bar")).toString()).toBe("1.15 MPa"); expect(qty.toPrec(Qty("0.01 MPa")).toString()).toBe("1.15 MPa"); expect(qty.toPrec(Qty("dbar")).toString()).toBe("1.15 MPa"); @@ -1371,25 +1363,25 @@ describe("js-quantities", () => { it("should convert value", () => { // TODO Same test but with m/h -> ft/s triggers rounding issue // (For the sake of speed, converter does not check and fix rounding issues) - var converter = Qty.swiftConverter("m/h", "m/s"); + const converter = Qty.swiftConverter("m/h", "m/s"); expect(converter(2500)).toEqual(Qty("2500 m/h").to("m/s").scalar); }); it("should returned value unchanged when units are identical", () => { - var converter = Qty.swiftConverter("m/h", "m/h"); + const converter = Qty.swiftConverter("m/h", "m/h"); expect(converter(2500)).toEqual(2500); }); it("should convert temperatures", () => { - var converter = Qty.swiftConverter("tempF", "tempC"); + const converter = Qty.swiftConverter("tempF", "tempC"); expect(converter(32)).toEqual(0); }); it("should convert degrees", () => { - var converter = Qty.swiftConverter("degC", "degF"); + const converter = Qty.swiftConverter("degC", "degF"); expect(converter(10)).toEqual(18); }); @@ -1397,7 +1389,7 @@ describe("js-quantities", () => { describe("array of values", () => { it("should be converted", () => { - var converter = Qty.swiftConverter("MPa", "bar"), + const converter = Qty.swiftConverter("MPa", "bar"), values = [250, 10, 15], expected = [2500, 100, 150]; @@ -1413,8 +1405,8 @@ describe("js-quantities", () => { }); it("should not contain duplicate kind names", () => { - var kinds = Qty.getKinds(); - var map: { [key: string]: number } = {}; + const kinds = Qty.getKinds(); + const map: { [key: string]: number } = {}; kinds.forEach(kind => { map[kind] = 1; }); @@ -1500,14 +1492,14 @@ describe("js-quantities", () => { }); it('should not be defined as base unit', () => { - var qty = Qty("F"); + const qty = Qty("F"); expect(qty.isBase()).toBe(false); expect(qty.toBase().units()).toEqual("s4*A2/m2*kg"); }); it('should be parsed when prefixed', () => { - var qty = Qty("100 nF"); + const qty = Qty("100 nF"); expect(qty.eq(Qty("100 F").div(1e9))).toBe(true); expect(qty.baseScalar).toEqual(1e-7); diff --git a/jsnlog/index.d.ts b/jsnlog/index.d.ts index e252d5cf36..4d1c707b4f 100644 --- a/jsnlog/index.d.ts +++ b/jsnlog/index.d.ts @@ -25,7 +25,6 @@ // JSNLog. declare namespace JL { - interface JSNLogOptions { enabled?: boolean; maxMessages?: number; @@ -88,7 +87,6 @@ declare namespace JL { declare function __jsnlog_configure(jsnlog: any): void; - // Ambient declaration of the JL function itself declare function JL(loggerName?: string): JL.JSNLogLogger; @@ -97,20 +95,20 @@ declare function JL(loggerName?: string): JL.JSNLogLogger; // overload ambient declarations with non-ambient declarations. declare namespace JL { - export function setOptions(options: JSNLogOptions): void; - export function createAjaxAppender(appenderName: string): JSNLogAjaxAppender; - export function createConsoleAppender(appenderName: string): JSNLogConsoleAppender; + function setOptions(options: JSNLogOptions): void; + function createAjaxAppender(appenderName: string): JSNLogAjaxAppender; + function createConsoleAppender(appenderName: string): JSNLogConsoleAppender; - export class Exception { + class Exception { constructor(data: any, inner?: any); } - export function getOffLevel(): number; - export function getTraceLevel(): number; - export function getDebugLevel(): number; - export function getInfoLevel(): number; - export function getWarnLevel(): number; - export function getErrorLevel(): number; - export function getFatalLevel(): number; - export function getAllLevel(): number; + function getOffLevel(): number; + function getTraceLevel(): number; + function getDebugLevel(): number; + function getInfoLevel(): number; + function getWarnLevel(): number; + function getErrorLevel(): number; + function getFatalLevel(): number; + function getAllLevel(): number; } diff --git a/jsnlog/jsnlog-tests.ts b/jsnlog/jsnlog-tests.ts index c988234394..c7610aba78 100644 --- a/jsnlog/jsnlog-tests.ts +++ b/jsnlog/jsnlog-tests.ts @@ -1,16 +1,14 @@ - - // ---------------------------------------------------------- // JL -var offLevel: number = JL.getOffLevel(); -var traceLevel: number = JL.getTraceLevel(); -var debugLevel: number = JL.getDebugLevel(); -var infoLevel: number = JL.getInfoLevel(); -var warnLevel: number = JL.getWarnLevel(); -var errorLevel: number = JL.getErrorLevel(); -var fatalLevel: number = JL.getFatalLevel(); -var allLevel: number = JL.getAllLevel(); +const offLevel: number = JL.getOffLevel(); +const traceLevel: number = JL.getTraceLevel(); +const debugLevel: number = JL.getDebugLevel(); +const infoLevel: number = JL.getInfoLevel(); +const warnLevel: number = JL.getWarnLevel(); +const errorLevel: number = JL.getErrorLevel(); +const fatalLevel: number = JL.getFatalLevel(); +const allLevel: number = JL.getAllLevel(); JL.setOptions({ enabled: true, @@ -25,12 +23,12 @@ JL.setOptions({ // ---------------------------------------------------------- // Exception -var e = new JL.Exception("i is too small!"); +const e = new JL.Exception("i is too small!"); // ---------------------------------------------------------- // Ajax Appender -var ajaxAppender1: JL.JSNLogAjaxAppender = JL.createAjaxAppender('ajaxAppender'); +const ajaxAppender1: JL.JSNLogAjaxAppender = JL.createAjaxAppender('ajaxAppender'); ajaxAppender1.setOptions({ level: 5000, @@ -48,7 +46,7 @@ ajaxAppender1.setOptions({ // ---------------------------------------------------------- // Console Appender -var consoleAppender1: JL.JSNLogConsoleAppender = JL.createConsoleAppender('consoleAppender'); +const consoleAppender1: JL.JSNLogConsoleAppender = JL.createConsoleAppender('consoleAppender'); consoleAppender1.setOptions({ level: 5000, @@ -61,13 +59,12 @@ consoleAppender1.setOptions({ batchSize: 2 }); - // ---------------------------------------------------------- // Loggers -var logger1: JL.JSNLogLogger = JL('mylogger'); +const logger1: JL.JSNLogLogger = JL('mylogger'); -var exception = {}; +const exception = {}; logger1.trace('log message').debug({ x: 1, y: 2}); logger1.info(() => 5); @@ -85,4 +82,3 @@ logger1.setOptions({ appenders: [ ajaxAppender1, consoleAppender1 ], onceOnly: [ 'regex1', 'regex2' ] }); - diff --git a/jui-core/index.d.ts b/jui-core/index.d.ts index 0f1184c0a3..6d15361d8e 100644 --- a/jui-core/index.d.ts +++ b/jui-core/index.d.ts @@ -132,7 +132,6 @@ interface UtilBase { */ typeCheck(typeName: string, value: any): boolean; - typeCheckObj(uiObj: any, list: any): void; /** @@ -318,7 +317,6 @@ interface UtilBase { inArray(target: any, list: any[]): number; - trim(text: string): string; ready: ((...args: any[]) => void); @@ -398,7 +396,6 @@ interface JuiStatic { */ add(uiIns: any): void; - /** * @method emit * Generates a custom event to an applicable component @@ -443,7 +440,6 @@ interface UICollection { } interface UICore { - tpl?: any; event?: any; @@ -543,7 +539,6 @@ interface UICore { //noinspection TypeScriptUnresolvedVariable export interface UIEvent extends UICore { - root?: any; /** @@ -809,7 +804,6 @@ interface UtilMath { matrix3d(a: T[], b: T[]): T[]; inverseMatrix3d(a: any[]): any[]; - } export interface UtilScaleOrdinal extends Function { diff --git a/jui-core/jui-core-tests.ts b/jui-core/jui-core-tests.ts index c0677926e6..a5d4f23bcb 100644 --- a/jui-core/jui-core-tests.ts +++ b/jui-core/jui-core-tests.ts @@ -1,4 +1,4 @@ -import {jui, UtilColor, UtilBase} from "./index"; +import {jui, UtilColor, UtilBase} from "jui-core"; jui.ready(["util.color"], (color: UtilColor) => { console.log(color.rgb("#ff0000")); diff --git a/jui-grid/index.d.ts b/jui-grid/index.d.ts index 0fee7cc271..31b3ca2b51 100644 --- a/jui-grid/index.d.ts +++ b/jui-grid/index.d.ts @@ -232,7 +232,6 @@ export interface GridTable extends UIEvent { * Determines whether to use the move function when you fire row draggable event. */ moveRow?: boolean, - }): this; root?: any; @@ -612,9 +611,7 @@ export interface GridTable extends UIEvent { } export interface GridXTable extends UIEvent { - (selector: any, options?: { - - }): this; + (selector: any, options?: {}): this; render(isTree?: boolean): void; diff --git a/jui-grid/jui-grid-tests.ts b/jui-grid/jui-grid-tests.ts index 1fb65c4b97..2609e94021 100644 --- a/jui-grid/jui-grid-tests.ts +++ b/jui-grid/jui-grid-tests.ts @@ -1,8 +1,7 @@ /// import {jui} from 'jui-core'; -import {GridTable, GridXTable, GridRow} from "./index"; - +import {GridTable, GridXTable, GridRow} from "jui-grid"; jui.ready([ "grid.table" ], (table: GridTable) => { const table_1: GridTable = table("#table_1", { @@ -41,7 +40,7 @@ jui.ready([ "grid.table" ], (table: GridTable) => { ]); const table_3_submit: Function = (index: number) => { - var name = $(table_3.root).find(".name").val(), + const name = $(table_3.root).find(".name").val(), age = $(table_3.root).find(".age").val(), location = $(table_3.root).find(".location").val(); @@ -52,7 +51,7 @@ jui.ready([ "grid.table" ], (table: GridTable) => { }); jui.ready([ "grid.xtable" ], (xtable: GridXTable) => { - var page = 1; + let page = 1; const xtable_2: GridXTable = xtable("#xtable_2", { fields: [ "name", "age", "location" ], @@ -63,9 +62,9 @@ jui.ready([ "grid.xtable" ], (xtable: GridXTable) => { }); const xtable_2_submit: Function = () => { - var result: any[] = []; + const result: any[] = []; - for (var i = 0; i < 1000000; i++) { + for (let i = 0; i < 1000000; i++) { result.push({ name: "Alvin" + i, age: Math.floor(Math.random() * 100) + 1, location: "LA" }); } @@ -81,7 +80,6 @@ jui.ready([ "grid.xtable" ], (xtable: GridXTable) => { }; }); - jui.ready([ "grid.xtable" ], (xtable: GridXTable) => { const xtable_4: GridXTable = xtable("#xtable_4", { fields: [ "name", "age", "location" ], @@ -130,9 +128,9 @@ jui.ready([ "grid.xtable" ], (xtable: GridXTable) => { }); const xtable_6_submit: Function = () => { - var result: any[] = []; + const result: any[] = []; - for (var i = 0; i < 1000000; i++) { + for (let i = 0; i < 1000000; i++) { result.push({ name: "Alvin" + i, age: Math.floor(Math.random() * 100) + 1, location: "LA" }); } @@ -178,5 +176,4 @@ jui.ready([ "grid.xtable" ], (xtable: GridXTable) => { { index: "0.5", type: "fold", data: { url: "/sitemap.xml", count: 10 } }, { index: "0.6", type: "fold", data: { url: "/package.json", count: 5 } } ]); - }); diff --git a/jui/index.d.ts b/jui/index.d.ts index c1dec57e39..24e5ed215c 100644 --- a/jui/index.d.ts +++ b/jui/index.d.ts @@ -6,7 +6,6 @@ import {UIEvent} from 'jui-core'; export interface UIAccordion extends UIEvent { - (selector: any, options?: { tpl?: any, event?: any, @@ -91,10 +90,8 @@ export interface UIColorPicker { getColor(type: string): string|{}; setColor(value: string|{}): void; - } - export interface UICombo { (selector: any, options?: { tpl?: any, @@ -201,7 +198,6 @@ export interface UICombo { reload(): void; } - export interface UIDatePicker { (selector: any, options?: { tpl?: any, @@ -399,7 +395,6 @@ export interface UIDropdown { reload(): void; } - export interface UIModal { (selector: any, options?: { tpl?: any, @@ -460,7 +455,6 @@ export interface UIModal { resize(): void; } - export interface UINotify { (selector: any, options?: { tpl?: any, @@ -611,7 +605,6 @@ export interface UIProgress { setStriped(isStriped: boolean): void; setValue(v: number): void; getValue(): number; - } export interface UIProperty { @@ -716,7 +709,6 @@ export interface UISlider { tooltip?: boolean, format?: string, progress?: boolean - }): this; /** @@ -750,10 +742,8 @@ export interface UISlider { * @return {Number} value */ getToValue(): number; - } - export interface UISplitter { (selector: any, options?: { tpl?: any, @@ -849,7 +839,6 @@ export interface UISwitch { } export interface UITab { - (selector: any, options?: { tpl?: any, event?: any, @@ -1011,7 +1000,6 @@ export interface UITooltip { * Sets the content of a tooltip (referring to the title properties in markup) */ title?: string, - }): this; /** diff --git a/jui/jui-tests.ts b/jui/jui-tests.ts index 8a7a5d03f4..5cc6dd93f2 100644 --- a/jui/jui-tests.ts +++ b/jui/jui-tests.ts @@ -118,5 +118,4 @@ jui.ready([ }); console.log(selectInstance.getValue()); - }); diff --git a/jump.js/index.d.ts b/jump.js/index.d.ts index fdef97c712..111c41d59a 100644 --- a/jump.js/index.d.ts +++ b/jump.js/index.d.ts @@ -3,14 +3,17 @@ // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare type TransitionFunc = (t: number, b: number, c: number, d: number) => number; -declare interface JumpOptions { - duration?: number; - offset?: number; - callback?: () => void; - easing?: TransitionFunc; - a11y?: boolean; -} -declare type Jump = (target: string | Element | number, opts?: JumpOptions) => void; -declare const jump: Jump; export = jump; + +declare function jump(target: string | Element | number, opts?: jump.Options): void; + +declare namespace jump { + type TransitionFunc = (t: number, b: number, c: number, d: number) => number; + interface Options { + duration?: number; + offset?: number; + callback?: () => void; + easing?: TransitionFunc; + a11y?: boolean; + } +} diff --git a/keycloak-js/index.d.ts b/keycloak-js/index.d.ts index 540084d6fd..9f7e817df1 100644 --- a/keycloak-js/index.d.ts +++ b/keycloak-js/index.d.ts @@ -14,13 +14,13 @@ export = Keycloak; declare function Keycloak(config?: string|{}): Keycloak.KeycloakInstance; declare namespace Keycloak { - export type KeycloakAdapterName = 'cordova'|'default'; - export type KeycloakOnLoad = 'login-required'|'check-sso'; - export type KeycloakResponseMode = 'query'|'fragment'; - export type KeycloakResponseType = 'code'|'id_token token'|'code id_token token'; - export type KeycloakFlow = 'standard'|'implicit'|'hybrid'; + type KeycloakAdapterName = 'cordova'|'default'; + type KeycloakOnLoad = 'login-required'|'check-sso'; + type KeycloakResponseMode = 'query'|'fragment'; + type KeycloakResponseType = 'code'|'id_token token'|'code id_token token'; + type KeycloakFlow = 'standard'|'implicit'|'hybrid'; - export interface KeycloakInitOptions { + interface KeycloakInitOptions { /** * @private Undocumented. */ @@ -81,7 +81,7 @@ declare namespace Keycloak { flow?: KeycloakFlow; } - export interface KeycloakLoginOptions { + interface KeycloakLoginOptions { /** * @private Undocumented. */ @@ -131,9 +131,9 @@ declare namespace Keycloak { locale?: string; } - export type KeycloakPromiseCallback = (result: T) => void; + type KeycloakPromiseCallback = (result: T) => void; - export interface KeycloakPromise { + interface KeycloakPromise { /** * Function to call if the promised action succeeds. */ @@ -145,12 +145,12 @@ declare namespace Keycloak { error(callback: KeycloakPromiseCallback): KeycloakPromise; } - export interface KeycloakError { + interface KeycloakError { error: string; error_description: string; } - export interface KeycloakAdapter { + interface KeycloakAdapter { login(options?: KeycloakLoginOptions): KeycloakPromise; logout(options?: any): KeycloakPromise; register(options?: KeycloakLoginOptions): KeycloakPromise; @@ -158,7 +158,7 @@ declare namespace Keycloak { redirectUri(options: { redirectUri: string; }, encodeHash: boolean): string; } - export interface KeycloakProfile { + interface KeycloakProfile { id?: string; username?: string; email?: string; @@ -176,7 +176,7 @@ declare namespace Keycloak { * A client for the Keycloak authentication server. * @see {@link https://keycloak.gitbooks.io/securing-client-applications-guide/content/topics/oidc/javascript-adapter.html|Keycloak JS adapter documentation} */ - export interface KeycloakInstance { + interface KeycloakInstance { /** * Is true if the user is authenticated, false otherwise. */ diff --git a/keycloak-js/keycloak-authz.d.ts b/keycloak-js/keycloak-authz.d.ts index 4db057ad97..b15c505257 100644 --- a/keycloak-js/keycloak-authz.d.ts +++ b/keycloak-js/keycloak-authz.d.ts @@ -11,11 +11,11 @@ export = KeycloakAuthorization; declare function KeycloakAuthorization(keycloak: Keycloak.KeycloakInstance): KeycloakAuthorization.KeycloakAuthorizationInstance; declare namespace KeycloakAuthorization { - export interface KeycloakAuthorizationPromise { + interface KeycloakAuthorizationPromise { then(onGrant: (rpt: string) => void, onDeny: () => void, onError: () => void): void; } - export interface KeycloakAuthorizationInstance { + interface KeycloakAuthorizationInstance { rpt: any; config: { rpt_endpoint: string }; diff --git a/keygrip/index.d.ts b/keygrip/index.d.ts index b5929aaec6..4c858839c9 100644 --- a/keygrip/index.d.ts +++ b/keygrip/index.d.ts @@ -3,13 +3,13 @@ // Definitions by: jKey Lu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare interface Keygrip { +interface Keygrip { sign(data: any): string; verify(data: any, digest: string): boolean; index(data: any, digest: string): number; } -declare interface KeygripFunction { +interface KeygripFunction { new (keys: string[], algorithm?: string, encoding?: string): Keygrip; (keys: string[], algorithm?: string, encoding?: string): Keygrip; } diff --git a/kii-cloud-sdk/index.d.ts b/kii-cloud-sdk/index.d.ts index 8dec3a94c8..0879b355bd 100644 --- a/kii-cloud-sdk/index.d.ts +++ b/kii-cloud-sdk/index.d.ts @@ -15,7 +15,7 @@ declare namespace KiiCloud { KiiACLSendMessageToTopic, } - export enum KiiSite { + enum KiiSite { US, JP, CN, @@ -24,7 +24,7 @@ declare namespace KiiCloud { EU } - export enum KiiAnalyticsSite { + enum KiiAnalyticsSite { US, JP, CN, @@ -207,7 +207,7 @@ declare namespace KiiCloud { /** * The main SDK class */ - export class Kii { + class Kii { /** * Kii SDK Build Number * @@ -673,7 +673,7 @@ declare namespace KiiCloud { /** * Represents a KiiACL object */ - export class KiiACL { + class KiiACL { /** * Get the list of active ACLs associated with this object from the server * @@ -809,7 +809,7 @@ declare namespace KiiCloud { /** * Represents a KiiACLEntry object */ - export class KiiACLEntry { + class KiiACLEntry { /** * The action that is being permitted/restricted. Possible values: *

@@ -898,7 +898,7 @@ declare namespace KiiCloud { /** * The main SDK class */ - export class KiiAnalytics { + class KiiAnalytics { /** * Retrieve the current app ID * @@ -1107,7 +1107,7 @@ declare namespace KiiCloud { * * When retrieving ACL from an object, test for this class to determine the subject type. */ - export class KiiAnonymousUser { + class KiiAnonymousUser { /** * Returns the ID of Anonymous user. */ @@ -1119,7 +1119,7 @@ declare namespace KiiCloud { * * When retrieving ACL from an object, test for this class to determine the subject type. Example: */ - export class KiiAnyAuthenticatedUser { + class KiiAnyAuthenticatedUser { /** * Returns the ID of AuthenticatedUser user. */ @@ -1136,7 +1136,7 @@ declare namespace KiiCloud { * * Application administrator context. Entities obtained from this class will be manipulated by application admin. */ - export class KiiAppAdminContext { + class KiiAppAdminContext { /** * Creates a reference to a bucket operated by app admin. *

The bucket will be created/accessed within this app's scope @@ -1983,7 +1983,7 @@ declare namespace KiiCloud { /** * Represents a KiiBucket object */ - export class KiiBucket { + class KiiBucket { /** * The name of this bucket * @@ -2332,7 +2332,7 @@ declare namespace KiiCloud { /** * Represents a KiiClause expression object */ - export class KiiClause { + class KiiClause { /** * Create a KiiClause with the AND operator concatenating multiple KiiClause objects * @@ -2542,7 +2542,7 @@ declare namespace KiiCloud { /** * A Parser for error string or error object returned by SDK. */ - export class KiiErrorParser { + class KiiErrorParser { /** * Parse an error string or error object returned by SDK. * @@ -2574,7 +2574,7 @@ declare namespace KiiCloud { /** * Represents Geo Point. */ - export class KiiGeoPoint { + class KiiGeoPoint { /** * Return the latitide of this point. */ @@ -2607,7 +2607,7 @@ declare namespace KiiCloud { /** * Represents a KiiGroup object */ - export class KiiGroup { + class KiiGroup { /** * * @@ -3310,7 +3310,7 @@ declare namespace KiiCloud { /** * Represents a KiiObject object */ - export class KiiObject { + class KiiObject { /** * Get the UUID of the given object, assigned by the server * @@ -4160,7 +4160,7 @@ declare namespace KiiCloud { /** * Represents a KiiPushInstallation object */ - export class KiiPushInstallation { + class KiiPushInstallation { /** * Register the id issued by GCM to the Kii cloud for current logged in user. * @@ -4315,7 +4315,7 @@ declare namespace KiiCloud { /** * Builder of push message */ - export class KiiPushMessageBuilder { + class KiiPushMessageBuilder { /** * instantiate builder with push message data. * By default all push channels (gcm, apns, jpush, mqtt) is enabled. @@ -4591,7 +4591,7 @@ declare namespace KiiCloud { /** * Represents a KiiPushSubscription. */ - export class KiiPushSubscription { + class KiiPushSubscription { /** * Subscribe to bucket or topic. * @@ -4770,7 +4770,7 @@ declare namespace KiiCloud { /** * Represents a KiiQuery object */ - export class KiiQuery { + class KiiQuery { /** * Get the limit of the current query * @@ -4826,7 +4826,7 @@ declare namespace KiiCloud { /** * Represents a server side code entry in KiiCloud. */ - export class KiiServerCodeEntry { + class KiiServerCodeEntry { /** * Execute this server code entry.
* If argument is an empty object or not type of Object, callbacks.failure or reject callback of promise will be called.
@@ -4911,7 +4911,7 @@ declare namespace KiiCloud { /** * Represents a server side code execution result in KiiCloud. */ - export class KiiServerCodeExecResult { + class KiiServerCodeExecResult { /** * Get calculated number of executed steps. * @@ -4930,7 +4930,7 @@ declare namespace KiiCloud { /** * Represents a KiiSocialConnect object */ - export class KiiSocialConnect { + class KiiSocialConnect { /** * * @@ -5533,7 +5533,7 @@ declare namespace KiiCloud { /** * Represents a Thing object */ - export class KiiThing { + class KiiThing { /** * of this thing. * For details refer to {@link KiiThing.register} @@ -6446,7 +6446,7 @@ declare namespace KiiCloud { /** * represents a KiiThingContext object */ - export class KiiThingContext { + class KiiThingContext { /** * Creates a reference to a bucket in App scope operated by thing. * @@ -6608,7 +6608,7 @@ declare namespace KiiCloud { /** * Represents a Topic object. */ - export class KiiTopic { + class KiiTopic { /** * get name of this topic * @@ -6814,7 +6814,7 @@ declare namespace KiiCloud { /** * Represents a KiiUser object */ - export class KiiUser { + class KiiUser { /** * * @@ -8657,7 +8657,7 @@ declare namespace KiiCloud { /** * Represents a KiiUser builder */ - export class KiiUserBuilder { + class KiiUserBuilder { /** * Create a KiiUser builder with identifier. * diff --git a/kii-cloud-sdk/kii-cloud-sdk-tests.ts b/kii-cloud-sdk/kii-cloud-sdk-tests.ts index 40abd1e8d4..bd25adeeb0 100644 --- a/kii-cloud-sdk/kii-cloud-sdk-tests.ts +++ b/kii-cloud-sdk/kii-cloud-sdk-tests.ts @@ -1,9 +1,7 @@ - - function main() { Kii.initializeWithSite("abc", "def", KiiSite.JP); - var user = KiiUser.userWithUsername("name", "password"); + const user = KiiUser.userWithUsername("name", "password"); user.register({ success(user: KiiUser) { @@ -27,18 +25,18 @@ function main() { }); user.setLocale("en"); - var locale: string = user.getLocale(); + const locale: string = user.getLocale(); - var anotherUser: KiiUser = KiiUserBuilder + const anotherUser: KiiUser = KiiUserBuilder .builderWithIdentifier("id", "password") .setEmailAddress("mail@example.org") .build(); - var bucket = Kii.bucketWithName("foo"); - var clause1 = KiiClause.lessThan("x", 1); - var clause2 = KiiClause.greaterThan("y", 1); - var clause3 = KiiClause.and(clause1, clause2); - var query = KiiQuery.queryWithClause(clause3); + const bucket = Kii.bucketWithName("foo"); + const clause1 = KiiClause.lessThan("x", 1); + const clause2 = KiiClause.greaterThan("y", 1); + const clause3 = KiiClause.and(clause1, clause2); + const query = KiiQuery.queryWithClause(clause3); bucket.executeQuery(query, { success: (query: KiiQuery, @@ -51,10 +49,10 @@ function main() { bucket.executeQuery(query) .then((params: [KiiQuery, KiiObject[], KiiQuery]) => { - var [query, results, nextQuery] = params; + const [query, results, nextQuery] = params; }); - var object = bucket.createObject(); + const object = bucket.createObject(); object.set("foo", 1); @@ -93,11 +91,11 @@ function main() { KiiThing.loadWithVendorThingID("thing ID") .then((thing) => { - var isOnline: boolean = thing.isOnline(); - var onlineStatusModifiedAt: Date = thing.getOnlineStatusModifiedAt(); + const isOnline: boolean = thing.isOnline(); + const onlineStatusModifiedAt: Date = thing.getOnlineStatusModifiedAt(); }); - var error = KiiErrorParser.parse(""); + const error = KiiErrorParser.parse(""); error.code.toLowerCase(); } diff --git a/knuddels-userapps-api/index.d.ts b/knuddels-userapps-api/index.d.ts index 52183f832f..98eb30e054 100644 --- a/knuddels-userapps-api/index.d.ts +++ b/knuddels-userapps-api/index.d.ts @@ -7,21 +7,25 @@ interface Json { [x: string]: string | number | boolean | Date | Json | JsonArray; } +// tslint:disable-next-line no-empty-interface interface JsonArray extends Array { } // serializable objects (for persistence) type KnuddelsSerializable = string | number | boolean | User | BotUser; interface KnuddelsJson { [x: string]: string | number | boolean | Date | KnuddelsJson | KnuddelsJsonArray | KnuddelsSerializable; } +// tslint:disable-next-line no-empty-interface interface KnuddelsJsonArray extends Array { } // "data" that may be send between apps and between server and client type KnuddelsEvent = string | Json | KnuddelsEventArray; +// tslint:disable-next-line no-empty-interface interface KnuddelsEventArray extends Array { } + /** * App ist die abstrakte Klasse einer konkreten App, die ein Entwickler schreiben kann. * Im eigenen Javascript-Code muss eine Variable mit dem Namen App vorhanden sein, damit eine App lauffähig ist. */ -declare interface App { +interface App { /** * Dieses Methode wird aufgerufen, sobald ein Nutzer versucht den Channel zu betreten. * Die App kann nun entscheiden, ob der Nutzer den Channel betreten darf. @@ -533,9 +537,15 @@ declare class BotUser extends User { * Hat ein Channelbesitzer eine gewisse Menge Schulden angesammelt, so schalten wir alle Apps in diesem Channel ab. *
Es können nur Knuddel transferiert werden zu Nutzern mit UserType.Human. */ - transferKnuddel(receivingUserOrAccount: (User|KnuddelAccount), knuddelAmount: KnuddelAmount, - parameters?: { displayReasonText?: string; transferDisplayType?: KnuddelTransferDisplayType; - onSuccess?: () => void; onError?: (message: string) => void; }): void; + transferKnuddel( + receivingUserOrAccount: User | KnuddelAccount, + knuddelAmount: KnuddelAmount, + parameters?: { + displayReasonText?: string; + transferDisplayType?: KnuddelTransferDisplayType; + onSuccess?: () => void; + onError?: (message: string) => void; + }): void; } /** @@ -869,8 +879,8 @@ declare class Client { /** * Klasse, mit der clientseitige Farbobjekte erstellt werden können. */ -declare module Client { - export class Color { +declare namespace Client { + class Color { /** * Erzeugt ein Color-Objekt mit RGB-Werten. */ @@ -901,8 +911,8 @@ declare module Client { /** * Klasse, die es ermöglicht ein Event via Client/dispatchEvent:method zu versenden. */ -declare module Client { - export class Event { +declare namespace Client { + class Event { /** * Erzeugt ein Event. */ @@ -913,8 +923,8 @@ declare module Client { /** * Klasse, die es ermöglicht den Inhalte zu steuern, die im Bereich liegen, der das HTML User Interface hostet. */ -declare module Client { - export class HostFrame { +declare namespace Client { + class HostFrame { /** * Setzt den Titel der Seite im gezoomten Modus (nur Android). */ @@ -1960,7 +1970,7 @@ declare class SingleDiceResult { /** * Diese Dokumentation beschreibt, welche Erweiterungen am serverseitigen String-Objekt vorgenommen wurden. */ -declare interface String { +interface String { /** * Die Methode liefert den String zurück, auf dem sie aufgerufen wurde mit KCode escaped. */ @@ -2454,8 +2464,9 @@ declare class UserAccess { * Loopt über alle zugreifbaren User sortiert nach Registrierzeitpunkt und * führt für jeden User das übergebene Callback aus. */ - eachAccessibleUser(callback: (user: User, index: number, accessibleUserCount: number, key?: string) => boolean, - parameters?: { onStart?: (accessibleUserCount: number, key?: string) => void; + eachAccessibleUser( + callback: (user: User, index: number, accessibleUserCount: number, key?: string) => boolean, + parameters?: { onStart?: (accessibleUserCount: number, key?: string) => void; onEnd?: (accessibleUserCount: number, key?: string) => void; }): void; } @@ -2570,9 +2581,17 @@ declare class UserPersistenceNumbers { * Ruft eine Funktion für alle Nutzer auf, die einen bestimmten key in der UserPersistence gesetzt haben. * Hierbei greifen die übergebenen Filter. */ - static each(key: string, callback: { user: User; value: number; index: number; totalCount: number; key: string; }, - parameters?: { ascending?: boolean; minimumValue?: number; maximumValue?: number; maximumCount?: number; - onStart?: (totalCount: number, key: string) => void; onEnd?: (totalCount: number, key: string) => void; }): void; + static each( + key: string, + callback: { user: User; value: number; index: number; totalCount: number; key: string; }, + parameters?: { + ascending?: boolean; + minimumValue?: number; + maximumValue?: number; + maximumCount?: number; + onStart?: (totalCount: number, key: string) => void; + onEnd?: (totalCount: number, key: string) => void; + }): void; /** * Liefert alle keys, die für User in der Persistence * gespeichert wurden. @@ -2689,4 +2708,3 @@ declare class VideoChannelData { */ getStreamingVideoUsers(): User[]; } - diff --git a/knuddels-userapps-api/knuddels-userapps-api-tests.ts b/knuddels-userapps-api/knuddels-userapps-api-tests.ts index a940b7f19b..dadd8b93b6 100644 --- a/knuddels-userapps-api/knuddels-userapps-api-tests.ts +++ b/knuddels-userapps-api/knuddels-userapps-api-tests.ts @@ -1,5 +1,4 @@ class Server implements App { - private usersPlaying: { [nick: string]: number } = {}; private isShuttingDown: boolean = false; @@ -10,7 +9,7 @@ class Server implements App { KnuddelsServer.getChannel() .getOnlineUsers(UserType.Human) .forEach((user) => { - this.onUserJoined(user) + this.onUserJoined(user); }); }; @@ -22,7 +21,7 @@ class Server implements App { }; onUserLeft(user: User) { - if (this.usersPlaying[user.getNick()] == 1) { + if (this.usersPlaying[user.getNick()] === 1) { KnuddelsServer.getDefaultBotUser() .transferKnuddel(user, new KnuddelAmount(1), 'Du hast den Channel verlassen.'); @@ -34,7 +33,7 @@ class Server implements App { if (!this.isShuttingDown) { this.isShuttingDown = true; - for (let key in this.usersPlaying) { + for (const key in this.usersPlaying) { const userId = KnuddelsServer.getUserAccess() .getUserId(key); const user = KnuddelsServer.getUserAccess() @@ -58,14 +57,13 @@ class Server implements App { if (!sender.canSendAppContent(this.appContent)) { knuddelTransfer.reject('Sorry, mit diesem Gerät kannst du gerade nicht spielen.'); } else if (sender.isChannelOwner() && knuddelTransfer.getKnuddelAmount() - .asNumber() != 1) { + .asNumber() !== 1) { knuddelTransfer.accept(); } else if (this.isShuttingDown) { knuddelTransfer.reject('Du App nimmt gerade keine neuen Spieler an.'); } else if (this.usersPlaying[sender.getNick()]) { knuddelTransfer.reject('Du spielst bereits.'); - } else if (knuddelTransfer.getKnuddelAmount() - .asNumber() != 1) { + } else if (knuddelTransfer.getKnuddelAmount().asNumber() !== 1) { const botNick = KnuddelsServer.getDefaultBotUser() .getNick() .escapeKCode(); @@ -76,7 +74,7 @@ class Server implements App { }; onKnuddelReceived(user: User, receiver: User, knuddelAmount: KnuddelAmount) { - if (knuddelAmount.asNumber() == 1) { + if (knuddelAmount.asNumber() === 1) { this.usersPlaying[user.getNick()] = 1; user.sendAppContent(this.appContent); } else { @@ -85,27 +83,23 @@ class Server implements App { }; onEventReceived(user: User, key: string, data: string) { - if (key == 'selectedEntry' && this.usersPlaying[user.getNick()] == 1) { + if (key === 'selectedEntry' && this.usersPlaying[user.getNick()] === 1) { this.usersPlaying[user.getNick()] = 2; setTimeout(() => { - - let doorNumber = parseInt(data[data.length - 1], 10); - - let winningDoorNumber = RandomOperations.nextInt(0, 2) + 1; - - let hasWon = winningDoorNumber == doorNumber; - - let text = hasWon + const doorNumber = parseInt(data[data.length - 1], 10); + const winningDoorNumber = RandomOperations.nextInt(0, 2) + 1; + const hasWon = winningDoorNumber === doorNumber; + const text = hasWon ? 'Richtig getippt' : 'Knapp daneben'; user.getAppContentSession(AppViewMode.Overlay) .getAppContent() .sendEvent('openDoor', { - 'door': doorNumber, - 'winningDoor': winningDoorNumber, - 'text': text, + door: doorNumber, + winningDoor: winningDoorNumber, + text, }); if (hasWon) { @@ -127,7 +121,6 @@ class Server implements App { }, 1500); } }; - } declare let App: Server; // tell the compiler that "App" will be available diff --git a/koa-basic-auth/index.d.ts b/koa-basic-auth/index.d.ts index 2cbf888606..0fff3bb731 100644 --- a/koa-basic-auth/index.d.ts +++ b/koa-basic-auth/index.d.ts @@ -6,11 +6,8 @@ import * as Koa from "koa"; declare function auth(opts: { - name: string; - pass: string; - }): Koa.Middleware; export = auth; diff --git a/koa-json-error/koa-json-error-tests.ts b/koa-json-error/koa-json-error-tests.ts index 77a13a1f64..31779f7bd9 100644 --- a/koa-json-error/koa-json-error-tests.ts +++ b/koa-json-error/koa-json-error-tests.ts @@ -5,4 +5,4 @@ const app = new Koa(); app.use(error({ preFormat: err => Object.assign({}, err) -})); \ No newline at end of file +})); diff --git a/koa-jwt/index.d.ts b/koa-jwt/index.d.ts index e2a4435aef..ba60bd8e61 100644 --- a/koa-jwt/index.d.ts +++ b/koa-jwt/index.d.ts @@ -10,7 +10,7 @@ export = jwt; declare function jwt(options: jwt.Options): Koa.Middleware; declare namespace jwt { - export interface Options { + interface Options { secret: string | Buffer; key?: string; getToken?: (opts: jwt.Options) => string; diff --git a/koa-jwt/koa-jwt-tests.ts b/koa-jwt/koa-jwt-tests.ts index 793bf50872..88bd75e739 100644 --- a/koa-jwt/koa-jwt-tests.ts +++ b/koa-jwt/koa-jwt-tests.ts @@ -1,7 +1,7 @@ import koa = require('koa'); import jwt = require('koa-jwt'); -var app = new koa(); +const app = new koa(); app.use(jwt({ secret: 'some-secret-key' diff --git a/koa-pug/index.d.ts b/koa-pug/index.d.ts index 836d7c88fe..f478072953 100644 --- a/koa-pug/index.d.ts +++ b/koa-pug/index.d.ts @@ -5,19 +5,16 @@ import * as koa from "koa"; - export = Pug; - /** main module */ declare class Pug { constructor(options?: Pug.PugOptions); use(app: koa): void; } - declare namespace Pug { - export interface PugOptions { + interface PugOptions { viewPath?: string; pretty?: boolean; compileDebug?: boolean; @@ -28,14 +25,12 @@ declare namespace Pug { basedir?: string; app?: koa; } - export interface PugCtxOptions extends PugOptions { + interface PugCtxOptions extends PugOptions { fromString: boolean; } - export interface PugLocals { [str: string]: any; } + interface PugLocals { [str: string]: any; } } - - /** plugin */ declare module 'koa' { interface Context { diff --git a/koa-pug/tslint.json b/koa-pug/tslint.json index 377cc837d4..d3631e8907 100644 --- a/koa-pug/tslint.json +++ b/koa-pug/tslint.json @@ -1 +1,6 @@ -{ "extends": "../tslint.json" } +{ + "extends": "../tslint.json", + "rules": { + "no-useless-files": false + } +} diff --git a/kramed/index.d.ts b/kramed/index.d.ts index 41984f9dc5..c7cc41b7e6 100644 --- a/kramed/index.d.ts +++ b/kramed/index.d.ts @@ -157,4 +157,4 @@ export interface KramedOptions { smartypants?: boolean; } -export declare var kramed: KramedStatic; \ No newline at end of file +export const kramed: KramedStatic; diff --git a/kramed/kramed-tests.ts b/kramed/kramed-tests.ts index 0782742234..2ec7ea833b 100644 --- a/kramed/kramed-tests.ts +++ b/kramed/kramed-tests.ts @@ -1,7 +1,6 @@ - import { KramedOptions, kramed, KramedParser, KramedStatic, KramedRenderer } from 'kramed'; -var options: KramedOptions = { +const options: KramedOptions = { gfm: true, tables: true, breaks: false, @@ -9,7 +8,7 @@ var options: KramedOptions = { sanitize: true, smartLists: true, silent: false, - highlight: function (code: string, lang: string) { + highlight(code: string, lang: string) { return ''; }, langPrefix: 'lang-', @@ -18,26 +17,24 @@ var options: KramedOptions = { }; function callback() { - console.log('callback called'); + 'callback called'; } kramed.setOptions(options); -console.log(kramed('i am using __kramdown__.')); -console.log(kramed('i am using __kramdown__.', options)); -console.log(kramed('i am using __kramdown__.', callback)); -console.log(kramed('i am using __kramdown__.', options, callback)); +kramed('i am using __kramdown__.'); +kramed('i am using __kramdown__.', options); +kramed('i am using __kramdown__.', callback); +kramed('i am using __kramdown__.', options, callback); -console.log(kramed.parse('i am using __kramdown__.')); -console.log(kramed.parse('i am using __kramdown__.', options)); -console.log(kramed.parse('i am using __kramdown__.', callback)); -console.log(kramed.parse('i am using __kramdown__.', options, callback)); +kramed.parse('i am using __kramdown__.'); +kramed.parse('i am using __kramdown__.', options); +kramed.parse('i am using __kramdown__.', callback); +kramed.parse('i am using __kramdown__.', options, callback); -var text = 'something'; -var tokens = kramed.lexer(text, options); -console.log(kramed.parser(tokens)); +const text = 'something'; +const tokens = kramed.lexer(text, options); +kramed.parser(tokens); -var renderer = new kramed.Renderer(); -renderer.heading = function(text, level, raw) { - return text + level.toString() + raw; -}; +const renderer = new kramed.Renderer(); +renderer.heading = (text, level, raw) => text + level.toString() + raw; diff --git a/kramed/tsconfig.json b/kramed/tsconfig.json index 50f51102f7..dec874decf 100644 --- a/kramed/tsconfig.json +++ b/kramed/tsconfig.json @@ -1,7 +1,9 @@ { "compilerOptions": { "module": "commonjs", - "target": "es6", + "lib": [ + "es6" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/leaflet-draw/index.d.ts b/leaflet-draw/index.d.ts index 3e2963f18b..300c97b80f 100644 --- a/leaflet-draw/index.d.ts +++ b/leaflet-draw/index.d.ts @@ -6,14 +6,12 @@ /// declare namespace L { - export interface MapOptions { + interface MapOptions { drawControl?: boolean; } namespace Control { - - export interface DrawConstructorOptions { - + interface DrawConstructorOptions { /** * The initial position of the control (one of the map corners). * @@ -34,11 +32,9 @@ declare namespace L { * Default value: false */ edit: EditOptions; - } - export interface DrawOptions { - + interface DrawOptions { /** * Polyline draw handler options. Set to false to disable handler. * @@ -75,8 +71,7 @@ declare namespace L { marker?: DrawOptions.MarkerOptions; } - export interface EditOptions { - + interface EditOptions { /** * This is the FeatureGroup that stores all editable shapes. * THIS IS REQUIRED FOR THE EDIT TOOLBAR TO WORK @@ -100,21 +95,17 @@ declare namespace L { remove?: DrawOptions.DeleteHandlerOptions; } - export interface Draw extends Control { + interface Draw extends Control { setDrawingOptions(options: DrawOptions): void; } - export class Draw { + class Draw { constructor(options?: DrawConstructorOptions); } - } - namespace DrawOptions { - - export interface PolylineOptions { - + interface PolylineOptions { /** * Determines if line segments can cross. * @@ -165,8 +156,7 @@ declare namespace L { repeatMode?: boolean; } - export interface PolygonOptions extends PolylineOptions { - + interface PolygonOptions extends PolylineOptions { /** * Show the area of the drawn polygon in m², ha or km². * The area is only approximate and become less accurate the larger the polygon is. @@ -176,8 +166,7 @@ declare namespace L { showArea?: boolean; } - export interface RectangleOptions { - + interface RectangleOptions { /** * The options used when drawing the rectangle on the map. * @@ -193,8 +182,7 @@ declare namespace L { repeatMode?: boolean; } - export interface CircleOptions { - + interface CircleOptions { /** * The options used when drawing the circle on the map. * @@ -210,8 +198,7 @@ declare namespace L { repeatMode?: boolean; } - export interface MarkerOptions { - + interface MarkerOptions { /** * TThe icon displayed when drawing a marker. * @@ -234,7 +221,7 @@ declare namespace L { repeatMode?: boolean; } - export interface EditHandlerOptions { + interface EditHandlerOptions { /** * The path options for how the layers will look while in edit mode. * If this is set to null the editable path options will not be set. @@ -244,37 +231,30 @@ declare namespace L { selectedPathOptions?: L.PathOptions; } - export interface DeleteHandlerOptions { + interface DeleteHandlerOptions { } - } namespace Draw { - namespace Event { - - export const CREATED: string; - export const EDITED: string; - export const DELETED: string; - export const DRAWSTART: string; - export const DRAWSTOP: string; - export const DRAWVERTEX: string; - export const EDITSTART: string; - export const EDITMOVE: string; - export const EDITRESIZE: string; - export const EDITVERTEX: string; - export const EDITSTOP: string; - export const DELETESTART: string; - export const DELETESTOP: string; - + const CREATED: string; + const EDITED: string; + const DELETED: string; + const DRAWSTART: string; + const DRAWSTOP: string; + const DRAWVERTEX: string; + const EDITSTART: string; + const EDITMOVE: string; + const EDITRESIZE: string; + const EDITVERTEX: string; + const EDITSTOP: string; + const DELETESTART: string; + const DELETESTOP: string; } - } namespace DrawEvents { - - export interface Created { - + interface Created { /** * Layer that was just created. */ @@ -286,8 +266,7 @@ declare namespace L { layerType: string; } - export interface Edited { - + interface Edited { /** * List of all layers just edited on the map. */ @@ -297,52 +276,49 @@ declare namespace L { /** * Triggered when layers have been removed (and saved) from the FeatureGroup. */ - export interface Deleted { - + interface Deleted { /** * List of all layers just removed from the map. */ layers: LayerGroup; } - export interface DrawStart { - + interface DrawStart { /** * The type of layer this is. One of: polyline, polygon, rectangle, circle, marker */ layerType: string; } - export interface DrawStop { - + interface DrawStop { /** * The type of layer this is. One of: polyline, polygon, rectangle, circle, marker */ layerType: string; } - export interface EditStart { + interface EditStart { /** * The type of edit this is. One of: edit */ handler: string; } - export interface EditStop { + interface EditStop { /** * The type of edit this is. One of: edit */ handler: string; } - export interface DeleteStart { + interface DeleteStart { /** * The type of edit this is. One of: remove */ handler: string; } - export interface DeleteStop { + interface DeleteStop { /** * The type of edit this is. One of: remove */ @@ -351,15 +327,14 @@ declare namespace L { } namespace GeometryUtil { - /** * Returns the area of a polygon drawn with leaflet.draw */ - export function geodesicArea(coordinates: L.LatLngLiteral[]): number; + function geodesicArea(coordinates: L.LatLngLiteral[]): number; /** * Returns a readable area string in yards or metric */ - export function readableArea(area: number, isMetric: boolean): string; + function readableArea(area: number, isMetric: boolean): string; } } diff --git a/leaflet-draw/leaflet-draw-tests.ts b/leaflet-draw/leaflet-draw-tests.ts index 8ad6e2a804..9729747851 100644 --- a/leaflet-draw/leaflet-draw-tests.ts +++ b/leaflet-draw/leaflet-draw-tests.ts @@ -1,12 +1,12 @@ -var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', +const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', osmAttrib = '© OpenStreetMap contributors', osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}), map = L.map('map', {layers: [osm], center: L.latLng(-37.7772, 175.2756), zoom: 15 }); -var drawnItems = L.featureGroup(); +const drawnItems = L.featureGroup(); map.addLayer(drawnItems); -var drawControl = new L.Control.Draw({ +const drawControl = new L.Control.Draw({ position: 'topleft' , draw: { polygon: { @@ -36,8 +36,8 @@ var drawControl = new L.Control.Draw({ map.addControl(drawControl); map.on('draw:created', (e: any) => { - var drawEvent = (e as L.DrawEvents.Created); - var type = drawEvent.layerType, + const drawEvent = e as L.DrawEvents.Created; + const type = drawEvent.layerType, layer = drawEvent.layer; drawnItems.addLayer(layer); diff --git a/leaflet-imageoverlay-rotated/index.d.ts b/leaflet-imageoverlay-rotated/index.d.ts index acb4d7f172..a60a1d4b37 100644 --- a/leaflet-imageoverlay-rotated/index.d.ts +++ b/leaflet-imageoverlay-rotated/index.d.ts @@ -6,22 +6,21 @@ /// declare namespace L { - namespace ImageOverlay { - - export interface Rotated extends L.ImageOverlay { - reposition(topleft: L.LatLngExpression, - topright: L.LatLngExpression, - bottomleft: L.LatLngExpression): void; + interface Rotated extends L.ImageOverlay { + reposition( + topleft: L.LatLngExpression, + topright: L.LatLngExpression, + bottomleft: L.LatLngExpression): void; } } namespace imageOverlay { - - export function rotated(imgSrc: string | HTMLImageElement | HTMLCanvasElement, - topleft: L.LatLngExpression, - topright: L.LatLngExpression, - bottomleft: L.LatLngExpression, - options?: L.ImageOverlayOptions): L.ImageOverlay.Rotated; + function rotated( + imgSrc: string | HTMLImageElement | HTMLCanvasElement, + topleft: L.LatLngExpression, + topright: L.LatLngExpression, + bottomleft: L.LatLngExpression, + options?: L.ImageOverlayOptions): L.ImageOverlay.Rotated; } } diff --git a/leaflet-imageoverlay-rotated/leaflet-imageoverlay-rotated-tests.ts b/leaflet-imageoverlay-rotated/leaflet-imageoverlay-rotated-tests.ts index 1b2ffd6c20..50db445f79 100644 --- a/leaflet-imageoverlay-rotated/leaflet-imageoverlay-rotated-tests.ts +++ b/leaflet-imageoverlay-rotated/leaflet-imageoverlay-rotated-tests.ts @@ -1,8 +1,8 @@ -var topleft = L.latLng(40.52256691873593, -3.7743186950683594); -var topright = L.latLng(40.5210255066156, -3.7734764814376835); -var bottomleft = L.latLng(40.52180437272552, -3.7768453359603886); +const topleft = L.latLng(40.52256691873593, -3.7743186950683594); +const topright = L.latLng(40.5210255066156, -3.7734764814376835); +const bottomleft = L.latLng(40.52180437272552, -3.7768453359603886); -var overlay = L.imageOverlay.rotated("image.jpg", topleft, topright, bottomleft, { +const overlay = L.imageOverlay.rotated("image.jpg", topleft, topright, bottomleft, { opacity: 0.5, interactive: true }); diff --git a/leaflet-label/index.d.ts b/leaflet-label/index.d.ts index 879f456e2d..da3fafd1a1 100644 --- a/leaflet-label/index.d.ts +++ b/leaflet-label/index.d.ts @@ -68,7 +68,7 @@ declare global { new(options?: LabelOptions): Label; } - var Label: LabelStatic; + const Label: LabelStatic; interface Label extends IEventPowered