diff --git a/types/ably/ably-tests.ts b/types/ably/ably-tests.ts
index 026ef48adc..bc50d03ce6 100644
--- a/types/ably/ably-tests.ts
+++ b/types/ably/ably-tests.ts
@@ -1,6 +1,6 @@
import * as Ably from 'ably';
-declare var console: { log(message: any): void };
+declare const console: { log(message: any): void };
const ApiKey = 'appId.keyId:secret';
const client = new Ably.Realtime(ApiKey);
@@ -19,10 +19,9 @@ client.connection.on('failed', () => {
// failed connection
});
-
// Subscribing to a channel
-var channel = client.channels.get('test');
+const channel = client.channels.get('test');
channel.subscribe(message => {
message.name; // 'greeting'
message.data; // 'Hello World!'
@@ -68,7 +67,6 @@ channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direct
console.log(messagesPage.items.length);
});
-
// Presence on a channel
// Getting presence:
@@ -118,7 +116,7 @@ channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direct
// Generate a random 256-bit key for demonstration purposes (in
// practice you need to create one and distribute it to clients yourselves)
Ably.Realtime.Crypto.generateRandomKey((err, key) => {
- var channel = client.channels.get('channelName', { cipher: { key } });
+ const channel = client.channels.get('channelName', { cipher: { key } });
channel.subscribe(message => {
message.name; // 'name is not encrypted'
@@ -136,7 +134,7 @@ channel.setOptions({cipher: {key: ''}}, () => {
// Using the REST API
-var restChannel = restClient.channels.get('test');
+const restChannel = restClient.channels.get('test');
// Publishing to a channel
@@ -195,7 +193,6 @@ restChannel.presence.history((err, messagesPage) => { // PaginatedResult
// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history
restChannel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direction: 'forwards' }, (err, messagesPage) => {});
-
// Generate Token and Token Request
// See https://www.ably.io/documentation/general/authentication for an explanation of Ably's authentication mechanism.
@@ -206,7 +203,7 @@ client.auth.requestToken((err, tokenDetails) => {
// see https://www.ably.io/documentation/rest/authentication/#token-details for its properties
// Now we have the token, we can send it to someone who can instantiate a client with it:
- var clientUsingToken = new Ably.Realtime(tokenDetails.token);
+ const clientUsingToken = new Ably.Realtime(tokenDetails.token);
});
// requestToken can take two optional params
@@ -242,15 +239,15 @@ client.stats({ limit: 50 }, (err, statsPage) => { // statsPage as Paginat
client.time({}, (err, time) => {}); // time is in ms since epoch
// Getting decoded Message objects from JSON
-var messages = Ably.Realtime.Message.fromEncodedArray([{ id: 'foo' }]);
+const messages = Ably.Realtime.Message.fromEncodedArray([{ id: 'foo' }]);
console.log(messages[0].id);
-var message = Ably.Rest.Message.fromEncoded({ id: 'foo' });
+const message = Ably.Rest.Message.fromEncoded({ id: 'foo' });
console.log(message.id);
// Getting decoded PresenceMessage objects from JSON
-var presenceMessages = Ably.Realtime.PresenceMessage.fromEncodedArray([{ id: 'foo' }]);
+const presenceMessages = Ably.Realtime.PresenceMessage.fromEncodedArray([{ id: 'foo' }]);
console.log(presenceMessages[0].action);
-var presenceMessage = Ably.Rest.PresenceMessage.fromEncoded({ id: 'foo' });
+const presenceMessage = Ably.Rest.PresenceMessage.fromEncoded({ id: 'foo' });
console.log(presenceMessage.action);
diff --git a/types/ably/index.d.ts b/types/ably/index.d.ts
index b8d1eb9bfe..7bfc2338b6 100644
--- a/types/ably/index.d.ts
+++ b/types/ably/index.d.ts
@@ -3,7 +3,7 @@
// Definitions by: Ably
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-declare namespace ablyLib {
+export namespace ablyLib {
namespace ChannelState {
type INITIALIZED = 'initialized';
type ATTACHING = 'attaching';
@@ -130,15 +130,15 @@ declare namespace ablyLib {
* A function which is called when a new token is required.
* The role of the callback is to either generate a signed TokenRequest which may then be submitted automatically
* by the library to the Ably REST API requestToken; or to provide a valid token in as a TokenDetails object.
- **/
- authCallback?: (data: TokenParams, callback: (error: ErrorInfo | string, tokenRequestOrDetails: TokenDetails | TokenRequest | string) => void) => void;
+ */
+ authCallback?(data: TokenParams, callback: (error: ErrorInfo | string, tokenRequestOrDetails: TokenDetails | TokenRequest | string) => void): void;
authHeaders?: { [index: string]: string };
authMethod?: HTTPMethods;
authParams?: { [index: string]: string };
/**
* A URL that the library may use to obtain a token string (in plain text format), or a signed TokenRequest or TokenDetails (in JSON format).
- **/
+ */
authUrl?: string;
key?: string;
queryTime?: boolean;
@@ -259,13 +259,13 @@ declare namespace ablyLib {
/**
* A number controlling the verbosity of the output. Valid values are: 0 (no logs), 1 (errors only),
* 2 (errors plus connection and channel state changes), 3 (high-level debug output), and 4 (full debug output).
- **/
+ */
level?: number;
/**
* A function to handle each line of log output. If handler is not specified, console.log is used.
- **/
- handler?: (...args: any[]) => void;
+ */
+ handler?(...args: any[]): void;
}
interface ChannelEvent {
@@ -398,7 +398,7 @@ declare namespace ablyLib {
}
interface Crypto {
- generateRandomKey: (callback: (error: ErrorInfo, key: string) => void) => void;
+ generateRandomKey(callback: (error: ErrorInfo, key: string) => void): void;
}
class Connection extends EventEmitter {
diff --git a/types/accounting/accounting-tests.ts b/types/accounting/accounting-tests.ts
index 0c11683c65..a397c559eb 100644
--- a/types/accounting/accounting-tests.ts
+++ b/types/accounting/accounting-tests.ts
@@ -27,8 +27,6 @@ accounting.formatMoney(5318008, {
// Will recursively format an array of values:
accounting.formatMoney([123, 456, [78, 9]], "$", 0); // ["$123", "$456", ["$78", "$9"]]
-
-
// formatColumn
// Format list of numbers for display:
@@ -40,8 +38,6 @@ accounting.formatColumn([123, 12345], "$ ", 0); // ["$ 123", "$ 12,345"]
// List of numbers can be a multi-dimensional array (formatColumn is applied recursively):
accounting.formatColumn([[1, 100], [900, 9]]); // [["$ 1.00", "$100.00"], ["$900.00", "$ 9.00"]]
-
-
// formatNumber
// Example usage:
@@ -58,16 +54,11 @@ accounting.formatNumber(5318008, {
// Will recursively format an array of values:
accounting.formatNumber([123456, [7890, 123]]); // ["123,456", ["7,890", "123"]]
-
-
// toFixed
(0.615).toFixed(2); // "0.61"
accounting.toFixed(0.615, 2); // "0.62"
-
-
-
// unformat
// Example usage:
diff --git a/types/adal/index.d.ts b/types/adal/index.d.ts
index 18ca3d8079..552ca468aa 100644
--- a/types/adal/index.d.ts
+++ b/types/adal/index.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for ADAL.JS 1.0.13
+// Type definitions for ADAL.JS 1.0.14
// Project: https://github.com/AzureAD/azure-activedirectory-library-for-js
// Definitions by: mmaitre314
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -29,6 +29,7 @@ declare namespace adal {
loginResource?: string;
resource?: string;
extraQueryParameter?: string;
+ navigateToLoginRequestUrl?: boolean;
}
interface User {
diff --git a/types/amplify/amplify-tests.ts b/types/amplify/amplify-tests.ts
index ab4a9bf1bd..62b00052dd 100644
--- a/types/amplify/amplify-tests.ts
+++ b/types/amplify/amplify-tests.ts
@@ -155,15 +155,11 @@ amplify.request("twitter-search", { term: "amplifyjs" } );
// Similarly, we can create a request that searches for mentions, by accepting a username:
- amplify.request.define("twitter-mentions", "ajax", {
- url: "http://search.twitter.com/search.json",
- dataType: "jsonp",
- dataMap: data => {
- return {
- q: "@" + data.user
- };
- }
- });
+amplify.request.define("twitter-mentions", "ajax", {
+ url: "http://search.twitter.com/search.json",
+ dataType: "jsonp",
+ dataMap: data => ({ q: "@" + data.user }),
+});
amplify.request("twitter-mentions", { user: "amplifyjs" });
@@ -241,11 +237,11 @@ amplify.request({
// amplify.request comes with built in support for status.The status parameter appears in the default success or error callbacks when using an ajax definition.
- amplify.request.define("statusExample1", "ajax", {
- // ...
- });
+amplify.request.define("statusExample1", "ajax", {
+ // ...
+});
- amplify.request({
+amplify.request({
resourceId: "statusExample1",
success: (data, status) => {
},
diff --git a/types/amqplib/amqplib-tests.ts b/types/amqplib/amqplib-tests.ts
index 24dade85dc..8bfcf3c9b4 100644
--- a/types/amqplib/amqplib-tests.ts
+++ b/types/amqplib/amqplib-tests.ts
@@ -1,7 +1,7 @@
// promise api tests
import amqp = require('amqplib');
-var msg = 'Hello World';
+const msg = 'Hello World';
// test promise api
amqp.connect('amqp://localhost')
@@ -21,11 +21,10 @@ amqp.connect('amqp://localhost')
});
// test promise api properties
-var amqpMessage: amqp.Message;
+let amqpMessage: amqp.Message;
amqpMessage.properties.contentType = 'application/json';
-var amqpAssertExchangeOptions: amqp.Options.AssertExchange;
-var anqpAssertExchangeReplies: amqp.Replies.AssertExchange;
-
+let amqpAssertExchangeOptions: amqp.Options.AssertExchange;
+let anqpAssertExchangeReplies: amqp.Replies.AssertExchange;
// callback api tests
import amqpcb = require('amqplib/callback_api');
@@ -59,7 +58,7 @@ amqpcb.connect('amqp://localhost', (err, connection) => {
});
// test callback api properties
-var amqpcbMessage: amqpcb.Message;
+let amqpcbMessage: amqpcb.Message;
amqpcbMessage.properties.contentType = 'application/json';
-var amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange;
-var anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;
+let amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange;
+let anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;
diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts
index 637ebda708..53fd245f1d 100644
--- a/types/angular/angular-tests.ts
+++ b/types/angular/angular-tests.ts
@@ -820,8 +820,8 @@ angular.module('docsTimeDirective', [])
.directive('myCurrentTime', ['$interval', 'dateFilter', ($interval: any, dateFilter: any) => {
return {
link(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) {
- let format: any,
- timeoutId: any;
+ let format: any;
+ let timeoutId: any;
function updateTime() {
element.text(dateFilter(new Date(), format));
@@ -896,7 +896,10 @@ angular.module('docsIsoFnBindExample', [])
angular.module('dragModule', [])
.directive('myDraggable', ['$document', ($document: any) => {
return (scope: any, element: any, attr: any) => {
- let startX = 0, startY = 0, x = 0, y = 0;
+ let startX = 0;
+ let startY = 0;
+ let x = 0;
+ let y = 0;
element.css({
position: 'relative',
diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts
index 6ff43a5290..727944fbb1 100644
--- a/types/angular/index.d.ts
+++ b/types/angular/index.d.ts
@@ -413,7 +413,7 @@ declare namespace angular {
// https://docs.angularjs.org/api/ng/directive/ngModelOptions
interface INgModelOptions {
updateOn?: string;
- debounce?: any;
+ debounce?: number | { [key: string]: number; };
allowInvalid?: boolean;
getterSetter?: boolean;
timezone?: string;
@@ -602,7 +602,7 @@ declare namespace angular {
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
(delay?: number, invokeApply?: boolean): IPromise;
- (fn: (...args: any[]) => T, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise;
+ (fn: (...args: any[]) => T | IPromise, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise;
cancel(promise?: IPromise): boolean;
}
@@ -875,7 +875,8 @@ declare namespace angular {
* @param identifierStart The function that will decide whether the given character is a valid identifier start character.
* @param identifierContinue The function that will decide whether the given character is a valid identifier continue character.
**/
- setIdentifierFns(identifierStart?: (character: string, codePoint: number) => boolean,
+ setIdentifierFns(
+ identifierStart?: (character: string, codePoint: number) => boolean,
identifierContinue?: (character: string, codePoint: number) => boolean): void;
}
diff --git a/types/angular/tslint.json b/types/angular/tslint.json
index 196218148d..057f35a770 100644
--- a/types/angular/tslint.json
+++ b/types/angular/tslint.json
@@ -6,11 +6,13 @@
"quotemark": [true, "single"],
"variable-name": [true, "check-format"],
+ // Below are all TODOs
"callable-types": false,
"ban-types": false,
"interface-name": false,
- "no-empty-interface": false,
+ "jsdoc-format": false,
"max-line-length": false,
+ "no-empty-interface": false,
"unified-signatures": false,
"void-return": false
}
diff --git a/types/applepayjs/applepayjs-tests.ts b/types/applepayjs/applepayjs-tests.ts
index 26c61396ae..5adf61e45c 100644
--- a/types/applepayjs/applepayjs-tests.ts
+++ b/types/applepayjs/applepayjs-tests.ts
@@ -21,7 +21,6 @@ describe("ApplePaySession", () => {
}
});
it("can create a new instance", () => {
-
const version = 1;
const paymentRequest = {
countryCode: "US",
@@ -42,7 +41,6 @@ describe("ApplePaySession", () => {
const session = new ApplePaySession(version, paymentRequest);
});
it("can call static methods", () => {
-
const merchantIdentifier = "MyMerchantId";
let canMakePayments: boolean = ApplePaySession.canMakePayments();
@@ -59,7 +57,6 @@ describe("ApplePaySession", () => {
});
});
it("can call instance methods", () => {
-
const version = 1;
const paymentRequest = {
countryCode: "US",
@@ -171,7 +168,6 @@ describe("ApplePaySession", () => {
});
describe("ApplePayPaymentRequest", () => {
it("can create a new instance", () => {
-
let paymentRequest: ApplePayJS.ApplePayPaymentRequest = {
applicationData: "ApplicationData",
countryCode: "GB",
diff --git a/types/applepayjs/index.d.ts b/types/applepayjs/index.d.ts
index 52af393ebd..744e1fd044 100644
--- a/types/applepayjs/index.d.ts
+++ b/types/applepayjs/index.d.ts
@@ -7,7 +7,6 @@
* A session object for managing the payment process on the web.
*/
declare class ApplePaySession extends EventTarget {
-
/**
* Creates a new instance of the ApplePaySession class.
* @param version - The version of the ApplePay JS API you are using.
@@ -164,12 +163,10 @@ declare class ApplePaySession extends EventTarget {
}
declare namespace ApplePayJS {
-
/**
* Defines a line item in a payment request - for example, total, tax, discount, or grand total.
*/
interface ApplePayLineItem {
-
/**
* A short, localized description of the line item.
*/
@@ -190,7 +187,6 @@ declare namespace ApplePayJS {
* Represents the result of authorizing a payment request and contains encrypted payment information.
*/
interface ApplePayPayment {
-
/**
* The encrypted token for an authorized payment.
*/
@@ -211,7 +207,6 @@ declare namespace ApplePayJS {
* The ApplePayPaymentAuthorizedEvent class defines the attributes contained by the ApplePaySession.onpaymentauthorized callback function.
*/
abstract class ApplePayPaymentAuthorizedEvent extends Event {
-
/**
* The payment token used to authorize a payment.
*/
@@ -222,7 +217,6 @@ declare namespace ApplePayJS {
* Encapsulates contact information needed for billing and shipping.
*/
interface ApplePayPaymentContact {
-
/**
* An email address for the contact.
*/
@@ -278,7 +272,6 @@ declare namespace ApplePayJS {
* Contains information about an Apple Pay payment card.
*/
interface ApplePayPaymentMethod {
-
/**
* A string, suitable for display, that describes the card.
*/
@@ -305,7 +298,6 @@ declare namespace ApplePayJS {
* The ApplePayPaymentMethodSelectedEvent class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function.
*/
abstract class ApplePayPaymentMethodSelectedEvent extends Event {
-
/**
* The card used to complete a payment.
*/
@@ -316,7 +308,6 @@ declare namespace ApplePayJS {
* Represents a provisioned payment card for Apple Pay payments.
*/
interface ApplePayPaymentPass {
-
/**
* The unique identifier for the primary account number for the payment card.
*/
@@ -347,7 +338,6 @@ declare namespace ApplePayJS {
* Encapsulates a request for payment, including information about payment processing capabilities, the payment amount, and shipping information.
*/
interface ApplePayPaymentRequest {
-
/**
* The merchant's two-letter ISO 3166 country code.
*/
@@ -419,7 +409,6 @@ declare namespace ApplePayJS {
* Contains the user's payment credentials.
*/
interface ApplePayPaymentToken {
-
/**
* An object containing the encrypted payment data.
*/
@@ -440,7 +429,6 @@ declare namespace ApplePayJS {
* The ApplePayShippingContactSelectedEvent class defines the attributes contained by the ApplePaySession.onshippingcontactselected callback function.
*/
abstract class ApplePayShippingContactSelectedEvent extends Event {
-
/**
* The shipping address selected by the user.
*/
@@ -451,7 +439,6 @@ declare namespace ApplePayJS {
* Defines a shipping method for delivering physical goods.
*/
interface ApplePayShippingMethod {
-
/**
* A short description of the shipping method.
*/
@@ -477,7 +464,6 @@ declare namespace ApplePayJS {
* The ApplePayShippingMethodSelectedEvent class defines the attribute contained by the ApplePaySession.onshippingmethodselected callback function.
*/
abstract class ApplePayShippingMethodSelectedEvent extends Event {
-
/**
* The shipping method selected by the user.
*/
@@ -488,7 +474,6 @@ declare namespace ApplePayJS {
* The ApplePayValidateMerchantEvent class defines the attributes contained by the ApplePaySession.onvalidatemerchant callback function.
*/
abstract class ApplePayValidateMerchantEvent extends Event {
-
/**
* The URL used to validate the merchant server.
*/
@@ -496,7 +481,6 @@ declare namespace ApplePayJS {
}
abstract class Event {
-
readonly bubbles: boolean;
cancelBubble: boolean;
diff --git a/types/applepayjs/tslint.json b/types/applepayjs/tslint.json
index 0344a1a3fa..377cc837d4 100644
--- a/types/applepayjs/tslint.json
+++ b/types/applepayjs/tslint.json
@@ -1,3 +1 @@
-{
- "extends": "../tslint.json"
-}
+{ "extends": "../tslint.json" }
diff --git a/types/applicationinsights-js/applicationinsights-js-tests.ts b/types/applicationinsights-js/applicationinsights-js-tests.ts
index 66bc1f268d..1a4d585795 100644
--- a/types/applicationinsights-js/applicationinsights-js-tests.ts
+++ b/types/applicationinsights-js/applicationinsights-js-tests.ts
@@ -1,6 +1,6 @@
// More samples on: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md
-var config: Microsoft.ApplicationInsights.IConfig = {
+const config: Microsoft.ApplicationInsights.IConfig = {
instrumentationKey: "",
endpointUrl: "endpointUrl",
emitLineDelimitedJson: false,
@@ -30,7 +30,7 @@ var config: Microsoft.ApplicationInsights.IConfig = {
isStorageUseDisabled: true
};
-var appInsights: Microsoft.ApplicationInsights.IAppInsights = {
+appInsights = {
config,
context: null,
queue: null,
@@ -91,9 +91,8 @@ appInsights.setAuthenticatedUserContext("userId", "accountId");
// set config dynamically
appInsights.config.instrumentationKey = "";
-
// TelementryContext
-var context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context;
+const context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context;
context.application.ver = "v0.0.0";
context.application.build = "1.1.1";
@@ -113,54 +112,54 @@ context.operation.id = "1";
context.operation.syntheticSource = "testAgent";
// track
-var data = new Microsoft.Telemetry.Base();
-var envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(data, "name");
+const data = new Microsoft.Telemetry.Base();
+const envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(data, "name");
context.track(envelope);
-context.addTelemetryInitializer((envelope) => false);
+context.addTelemetryInitializer(telemetryEnvelope => false);
// track event
-var eventObj = new Microsoft.ApplicationInsights.Telemetry.Event("test", null, null);
-var eventData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Event.dataType, eventObj);
-var eventEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(eventData, Microsoft.ApplicationInsights.Telemetry.Event.envelopeType);
+const eventObj = new Microsoft.ApplicationInsights.Telemetry.Event("test", null, null);
+const eventData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Event.dataType, eventObj);
+const eventEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(eventData, Microsoft.ApplicationInsights.Telemetry.Event.envelopeType);
context.track(eventEnvelope);
// track exception
-var exceptionObj = new Microsoft.ApplicationInsights.Telemetry.Exception(new Error(), "handledAt", null, null, AI.SeverityLevel.Critical);
-var exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(
+const exceptionObj = new Microsoft.ApplicationInsights.Telemetry.Exception(new Error(), "handledAt", null, null, AI.SeverityLevel.Critical);
+const exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(
Microsoft.ApplicationInsights.Telemetry.Exception.dataType, exceptionObj);
-var exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType);
+const exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType);
context.track(exceptionEnvelope);
// track metric
-var metricObj = new Microsoft.ApplicationInsights.Telemetry.Metric("name", 1234, 1, 0, 100, null);
-var metricData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Metric.dataType, metricObj);
-var metricEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(metricData, Microsoft.ApplicationInsights.Telemetry.Metric.envelopeType);
+const metricObj = new Microsoft.ApplicationInsights.Telemetry.Metric("name", 1234, 1, 0, 100, null);
+const metricData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Metric.dataType, metricObj);
+const metricEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(metricData, Microsoft.ApplicationInsights.Telemetry.Metric.envelopeType);
context.track(metricEnvelope);
// track page view
-var pageViewObj = new Microsoft.ApplicationInsights.Telemetry.PageView("page name", "url", 999, null, null);
-var pageViewData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.PageView.dataType, pageViewObj);
-var pageViewEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewData, Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType);
+const pageViewObj = new Microsoft.ApplicationInsights.Telemetry.PageView("page name", "url", 999, null, null);
+const pageViewData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.PageView.dataType, pageViewObj);
+const pageViewEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewData, Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType);
context.track(pageViewEnvelope);
// track page view performance
-var pageViewPerfObj = new Microsoft.ApplicationInsights.Telemetry.PageViewPerformance("page name", "url", 999, null, null);
-var pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(
+const pageViewPerfObj = new Microsoft.ApplicationInsights.Telemetry.PageViewPerformance("page name", "url", 999, null, null);
+const pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(
Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.dataType, pageViewPerfObj);
-var pageViewPerfEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewPerfData, Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.envelopeType);
+const pageViewPerfEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewPerfData, Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.envelopeType);
context.track(pageViewPerfEnvelope);
// track remote dependency
-var remoteDepObj = new Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData("id", "url", "command", 1, true, 1234, "GET");
-var remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(
+const remoteDepObj = new Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData("id", "url", "command", 1, true, 1234, "GET");
+const remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(
Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.dataType, remoteDepObj);
-var remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType);
+const remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType);
context.track(pageViewPerfEnvelope);
// track trace
-var traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", null);
-var traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj);
-var traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType);
-context.track(traceEnvelope);
\ No newline at end of file
+const traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", null);
+const traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj);
+const traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType);
+context.track(traceEnvelope);
diff --git a/types/applicationinsights-js/index.d.ts b/types/applicationinsights-js/index.d.ts
index ede1584bb5..cce53f5823 100644
--- a/types/applicationinsights-js/index.d.ts
+++ b/types/applicationinsights-js/index.d.ts
@@ -195,8 +195,8 @@ declare module Microsoft.ApplicationInsights.Context {
interface IInternal {
/**
- * The SDK version used to create this telemetry item.
- */
+ * The SDK version used to create this telemetry item.
+ */
sdkVersion: string;
/**
* The SDK agent version.
@@ -206,15 +206,15 @@ declare module Microsoft.ApplicationInsights.Context {
interface ISample {
/**
- * Sample rate
- */
+ * Sample rate
+ */
sampleRate: number;
}
interface ISession {
/**
- * The session ID.
- */
+ * The session ID.
+ */
id: string;
/**
* The true if this is the first session
@@ -258,8 +258,8 @@ declare module Microsoft.ApplicationInsights.Context {
interface IUser {
/**
- * The telemetry configuration.
- */
+ * The telemetry configuration.
+ */
config: any;
/**
* The user ID.
@@ -345,12 +345,12 @@ declare module Microsoft.ApplicationInsights.Telemetry {
measurements: Microsoft.ApplicationInsights.FieldType;
};
/**
- * Constructs a new isntance of the ExceptionTelemetry object
- */
+ * Constructs a new isntance of the ExceptionTelemetry object
+ */
constructor(exception: Error, handledAt?: string, properties?: any, measurements?: any, severityLevel?: AI.SeverityLevel);
/**
- * Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.
- */
+ * Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.
+ */
static CreateSimpleException(message: string, typeName: string, assembly: string, fileName: string, details: string, line: number, handledAt?: string): Telemetry.Exception;
}
@@ -414,8 +414,8 @@ declare module Microsoft.ApplicationInsights.Telemetry {
getIsValid(): boolean;
private durationMs;
/**
- * Gets the total duration (PLT) in milliseconds. Check getIsValid() before using this method.
- */
+ * Gets the total duration (PLT) in milliseconds. Check getIsValid() before using this method.
+ */
getDurationMs(): number;
/**
* Constructs a new instance of the PageEventTelemetry object
@@ -423,8 +423,8 @@ declare module Microsoft.ApplicationInsights.Telemetry {
constructor(name: string, url: string, unused: number, properties?: any, measurements?: any);
static getPerformanceTiming(): PerformanceTiming;
/**
- * Returns true is window performance timing API is supported, false otherwise.
- */
+ * Returns true is window performance timing API is supported, false otherwise.
+ */
static isPerformanceTimingSupported(): PerformanceTiming;
/**
* As page loads different parts of performance timing numbers get set. When all of them are set we can report it.
@@ -615,16 +615,16 @@ declare module Microsoft.ApplicationInsights {
interface ITelemetryContext {
/**
- * The object describing a component tracked by this object.
- */
+ * The object describing a component tracked by this object.
+ */
application: Context.IApplication;
/**
* The object describing a device tracked by this object.
*/
device: Context.IDevice;
/**
- * The object describing internal settings.
- */
+ * The object describing internal settings.
+ */
internal: Context.IInternal;
/**
* The object describing a location tracked by this object.
@@ -635,8 +635,8 @@ declare module Microsoft.ApplicationInsights {
*/
operation: Context.IOperation;
/**
- * The object describing sampling settings.
- */
+ * The object describing sampling settings.
+ */
sample: Context.ISample;
/**
* The object describing a user tracked by this object.
@@ -647,13 +647,13 @@ declare module Microsoft.ApplicationInsights {
*/
session: Context.ISession;
/**
- * Adds telemetry initializer to the collection. Telemetry initializers will be called one by one
- * before telemetry item is pushed for sending and in the order they were added.
- */
+ * Adds telemetry initializer to the collection. Telemetry initializers will be called one by one
+ * before telemetry item is pushed for sending and in the order they were added.
+ */
addTelemetryInitializer(telemetryInitializer: (envelope: Microsoft.ApplicationInsights.IEnvelope) => boolean): any;
/**
- * Tracks telemetry object.
- */
+ * Tracks telemetry object.
+ */
track(envelope: Microsoft.ApplicationInsights.IEnvelope): any;
}
@@ -662,23 +662,23 @@ declare module Microsoft.ApplicationInsights {
context: ITelemetryContext;
queue: Array<() => void>;
/**
- * Starts timing how long the user views a page or other item. Call this when the page opens.
- * This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
- * @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
- */
+ * Starts timing how long the user views a page or other item. Call this when the page opens.
+ * This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
+ * @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
+ */
startTrackPage(name?: string): any;
/**
- * Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.
- * @param name The string you used as the name in startTrackPage. Defaults to the document title.
- * @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
- * @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
- * @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
- */
- stopTrackPage(name?: string, url?: string, properties?: {
- [name: string]: string;
- }, measurements?: {
- [name: string]: number;
- }): any;
+ * Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.
+ * @param name The string you used as the name in startTrackPage. Defaults to the document title.
+ * @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
+ * @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
+ * @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
+ */
+ stopTrackPage(
+ name?: string,
+ url?: string,
+ properties?: { [name: string]: string },
+ measurements?: { [name: string]: number }): any;
/**
* Logs that a page or other item was viewed.
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
@@ -687,11 +687,11 @@ declare module Microsoft.ApplicationInsights {
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
* @param duration number - the number of milliseconds it took to load the page. Defaults to undefined. If set to default value, page load time is calculated internally.
*/
- trackPageView(name?: string, url?: string, properties?: {
- [name: string]: string;
- }, measurements?: {
- [name: string]: number;
- }, duration?: number): any;
+ trackPageView(
+ name?: string,
+ url?: string,
+ properties?: { [name: string]: string },
+ measurements?: { [name: string]: number }, duration?: number): any;
/**
* Start timing an extended event. Call {@link stopTrackEvent} to log the event when it ends.
* @param name A string that identifies this event uniquely within the document.
@@ -703,22 +703,20 @@ declare module Microsoft.ApplicationInsights {
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
- stopTrackEvent(name: string, properties?: {
- [name: string]: string;
- }, measurements?: {
- [name: string]: number;
- }): any;
+ stopTrackEvent(
+ name: string,
+ properties?: { [name: string]: string },
+ measurements?: { [name: string]: number }): any;
/**
- * Log a user action or other occurrence.
- * @param name A string to identify this event in the portal.
- * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
- * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
- */
- trackEvent(name: string, properties?: {
- [name: string]: string;
- }, measurements?: {
- [name: string]: number;
- }): any;
+ * Log a user action or other occurrence.
+ * @param name A string to identify this event in the portal.
+ * @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
+ * @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
+ */
+ trackEvent(
+ name: string,
+ properties?: { [name: string]: string },
+ measurements?: { [name: string]: number }): any;
/**
* Log a dependency call
* @param id unique id, this is used by the backend o correlate server requests. Use Util.newId() to generate a unique Id.
@@ -737,11 +735,12 @@ declare module Microsoft.ApplicationInsights {
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
* @param severityLevel AI.SeverityLevel - severity level
*/
- trackException(exception: Error, handledAt?: string, properties?: {
- [name: string]: string;
- }, measurements?: {
- [name: string]: number;
- }, severityLevel?: AI.SeverityLevel): any;
+ trackException(
+ exception: Error,
+ handledAt?: string,
+ properties?: { [name: string]: string },
+ measurements?: { [name: string]: number },
+ severityLevel?: AI.SeverityLevel): any;
/**
* Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators.
* To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the
@@ -752,28 +751,30 @@ declare module Microsoft.ApplicationInsights {
* @param min The smallest measurement in the sample. Defaults to the average.
* @param max The largest measurement in the sample. Defaults to the average.
*/
- trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: {
- [name: string]: string;
- }): any;
+ trackMetric(
+ name: string,
+ average: number,
+ sampleCount?: number,
+ min?: number,
+ max?: number,
+ properties?: { [name: string]: string }): any;
/**
- * Log a diagnostic message.
- * @param message A message string
- * @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
- */
- trackTrace(message: string, properties?: {
- [name: string]: string;
- }): any;
+ * Log a diagnostic message.
+ * @param message A message string
+ * @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
+ */
+ trackTrace(message: string, properties?: { [name: string]: string }): any;
/**
* Immediately send all queued telemetry.
*/
flush(): any;
/**
- * Sets the autheticated user id and the account id in this session.
- * User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars.
- *
- * @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
- * @param accountId {string} - An optional string to represent the account associated with the authenticated user.
- */
+ * Sets the autheticated user id and the account id in this session.
+ * User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars.
+ *
+ * @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
+ * @param accountId {string} - An optional string to represent the account associated with the authenticated user.
+ */
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string): any;
/**
* Clears the authenticated user id and the account id from the user context.
@@ -796,4 +797,4 @@ declare module 'applicationinsights-js' {
const AppInsights: Microsoft.ApplicationInsights.IAppInsights;
}
-declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
\ No newline at end of file
+declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
diff --git a/types/arcgis-rest-api/arcgis-rest-api-tests.ts b/types/arcgis-rest-api/arcgis-rest-api-tests.ts
index 0f4cf3d926..3955b02f35 100644
--- a/types/arcgis-rest-api/arcgis-rest-api-tests.ts
+++ b/types/arcgis-rest-api/arcgis-rest-api-tests.ts
@@ -8,4 +8,4 @@ point = {
spatialReference: {
wkid: 4326
}
-};
\ No newline at end of file
+};
diff --git a/types/arcgis-rest-api/index.d.ts b/types/arcgis-rest-api/index.d.ts
index 65a02a4367..0992772fec 100644
--- a/types/arcgis-rest-api/index.d.ts
+++ b/types/arcgis-rest-api/index.d.ts
@@ -65,7 +65,6 @@ export interface BezierCurve {
export type JsonCurve = CircularArc | Arc | OldCircularArc | BezierCurve;
-
export interface SpatialReferenceWkid {
wkid?: number;
latestWkid?: number;
@@ -131,7 +130,6 @@ export interface Envelope extends Geometry {
export type esriGeometryType = "esriGeometryPoint" | "esriGeometryMultipoint" | "esriGeometryPolyline" | "esriGeometryPolygon" | "esriGeometryEnvelope";
-
export type Color = [number, number, number, number];
export type SimpleMarkerSymbolStyle = "esriSMSCircle" | "esriSMSCross" | "esriSMSDiamond" | "esriSMSSquare" | "esriSMSX" | "esriSMSTriangle";
export type SimpleLineSymbolStyle = "esriSLSDash" | "esriSLSDashDot" | "esriSLSDashDotDot" | "esriSLSDot" | "esriSLSNull" | "esriSLSSolid";
@@ -181,7 +179,6 @@ export interface PictureSourced {
"angle"?: number;
"xoffset"?: number;
"yoffset"?: number;
-
}
export interface PictureMarkerSymbol extends MarkerSymbol, PictureSourced {
@@ -217,4 +214,4 @@ export interface TextSymbol extends MarkerSymbol {
"kerning"?: boolean;
"font"?: Font;
"text"?: string; // only applicable when specified as a client-side graphic.
-}
\ No newline at end of file
+}
diff --git a/types/arcgis-to-geojson-utils/arcgis-to-geojson-utils-tests.ts b/types/arcgis-to-geojson-utils/arcgis-to-geojson-utils-tests.ts
index 2e9337793a..5cb9d9472e 100644
--- a/types/arcgis-to-geojson-utils/arcgis-to-geojson-utils-tests.ts
+++ b/types/arcgis-to-geojson-utils/arcgis-to-geojson-utils-tests.ts
@@ -14,7 +14,7 @@ const geojsonPoint: GeoJSON.Point = {
};
// parse ArcGIS JSON, convert it to GeoJSON
-var geojson = utils.arcgisToGeoJSON(arcgisPoint);
+const geojson = utils.arcgisToGeoJSON(arcgisPoint);
// take GeoJSON and convert it to ArcGIS JSON
-var arcgis = utils.geojsonToArcGIS(geojsonPoint);
\ No newline at end of file
+const arcgis = utils.geojsonToArcGIS(geojsonPoint);
diff --git a/types/arcgis-to-geojson-utils/index.d.ts b/types/arcgis-to-geojson-utils/index.d.ts
index 94a86022a3..65c78a4230 100644
--- a/types/arcgis-to-geojson-utils/index.d.ts
+++ b/types/arcgis-to-geojson-utils/index.d.ts
@@ -15,4 +15,4 @@ export function arcgisToGeoJSON(arcgis: T): GeoJSON.G
/**
* Converts a GeoJSON geometry into a ArcGIS geometry.
*/
-export function geojsonToArcGIS(geojson: GeoJSON.GeometryObject): ArcGis.Geometry;
\ No newline at end of file
+export function geojsonToArcGIS(geojson: GeoJSON.GeometryObject): ArcGis.Geometry;
diff --git a/types/array-uniq/array-uniq-tests.ts b/types/array-uniq/array-uniq-tests.ts
index 8674d2508c..b6c90c620a 100644
--- a/types/array-uniq/array-uniq-tests.ts
+++ b/types/array-uniq/array-uniq-tests.ts
@@ -2,4 +2,4 @@ import arrayUniq = require("array-uniq");
arrayUniq([1, 1, 2, 3, 3]);
-arrayUniq(["foo", "foo", "bar", "foo"]);
\ No newline at end of file
+arrayUniq(["foo", "foo", "bar", "foo"]);
diff --git a/types/array-uniq/index.d.ts b/types/array-uniq/index.d.ts
index 25d97c0a94..d05ad76072 100644
--- a/types/array-uniq/index.d.ts
+++ b/types/array-uniq/index.d.ts
@@ -5,4 +5,4 @@
declare function arrayUniq(arr: T[]): T[];
-export = arrayUniq;
\ No newline at end of file
+export = arrayUniq;
diff --git a/types/artyom.js/artyom.js-tests.ts b/types/artyom.js/artyom.js-tests.ts
index 67e5908883..d301c9a6f4 100644
--- a/types/artyom.js/artyom.js-tests.ts
+++ b/types/artyom.js/artyom.js-tests.ts
@@ -29,4 +29,4 @@ artyom.getVoices();
artyom.getLanguage();
// Get the artyom.js version
-artyom.getVersion();
\ No newline at end of file
+artyom.getVersion();
diff --git a/types/artyom.js/index.d.ts b/types/artyom.js/index.d.ts
index ae120015ca..b4f85781c6 100644
--- a/types/artyom.js/index.d.ts
+++ b/types/artyom.js/index.d.ts
@@ -22,16 +22,16 @@ interface SpeechRecognition extends EventTarget {
start(): void;
stop(): void;
abort(): void;
- onaudiostart: (ev: Event) => any;
- onsoundstart: (ev: Event) => any;
- onspeechstart: (ev: Event) => any;
- onspeechend: (ev: Event) => any;
- onsoundend: (ev: Event) => any;
- onresult: (ev: SpeechRecognitionEvent) => any;
- onnomatch: (ev: SpeechRecognitionEvent) => any;
- onerror: (ev: SpeechRecognitionError) => any;
- onstart: (ev: Event) => any;
- onend: (ev: Event) => any;
+ onaudiostart(ev: Event): any;
+ onsoundstart(ev: Event): any;
+ onspeechstart(ev: Event): any;
+ onspeechend(ev: Event): any;
+ onsoundend(ev: Event): any;
+ onresult(ev: SpeechRecognitionEvent): any;
+ onnomatch(ev: SpeechRecognitionEvent): any;
+ onerror(ev: SpeechRecognitionError): any;
+ onstart(ev: Event): any;
+ onend(ev: Event): any;
}
interface SpeechRecognitionStatic {
@@ -106,7 +106,7 @@ interface SpeechSynthesis extends EventTarget {
speaking: boolean;
paused: boolean;
- onvoiceschanged: (ev: Event) => any;
+ onvoiceschanged(ev: Event): any;
speak(utterance: SpeechSynthesisUtterance): void;
cancel(): void;
pause(): void;
@@ -128,13 +128,13 @@ interface SpeechSynthesisUtterance extends EventTarget {
rate: number;
pitch: number;
- onstart: (ev: SpeechSynthesisEvent) => any;
- onend: (ev: SpeechSynthesisEvent) => any;
- onerror: (ev: SpeechSynthesisErrorEvent) => any;
- onpause: (ev: SpeechSynthesisEvent) => any;
- onresume: (ev: SpeechSynthesisEvent) => any;
- onmark: (ev: SpeechSynthesisEvent) => any;
- onboundary: (ev: SpeechSynthesisEvent) => any;
+ onstart(ev: SpeechSynthesisEvent): any;
+ onend(ev: SpeechSynthesisEvent): any;
+ onerror(ev: SpeechSynthesisErrorEvent): any;
+ onpause(ev: SpeechSynthesisEvent): any;
+ onresume(ev: SpeechSynthesisEvent): any;
+ onmark(ev: SpeechSynthesisEvent): any;
+ onboundary(ev: SpeechSynthesisEvent): any;
}
interface SpeechSynthesisUtteranceStatic {
@@ -211,7 +211,7 @@ declare namespace Artyom {
/** Triggers of the command */
indexes: string[];
/** Logic to execute when the command is triggered */
- action: (i: number, wildcard?: string, full?: string) => void;
+ action(i: number, wildcard?: string, full?: string): void;
/** Description of the command */
description?: string;
/** Flag to specify is a command is either normal or smart */
@@ -502,7 +502,7 @@ declare namespace Artyom {
/**
* Method to bla, bla, bla...
*/
- static getInstance(): ArtyomJS
+ static getInstance(): ArtyomJS;
}
}
diff --git a/types/assert-plus/index.d.ts b/types/assert-plus/index.d.ts
index 5de187cb85..d79172bc49 100644
--- a/types/assert-plus/index.d.ts
+++ b/types/assert-plus/index.d.ts
@@ -122,7 +122,6 @@ export function AssertionError(options: any, message ?: string): void;
*/
export function fail(actual: any, expected: any, message: any, operator: any): void;
-
/**
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
*
@@ -353,5 +352,4 @@ export function doesNotThrow(block: any, error ?: any, message ?: string): void;
*/
export function ifError(value: any): void;
-
export as namespace AssertPlus;
diff --git a/types/awesomplete/awesomplete-tests.ts b/types/awesomplete/awesomplete-tests.ts
index 5a33aeb135..6cea0e1bca 100644
--- a/types/awesomplete/awesomplete-tests.ts
+++ b/types/awesomplete/awesomplete-tests.ts
@@ -1,6 +1,6 @@
import * as Awesomplete from 'awesomplete';
-var input = document.getElementById("myinput");
+const input = document.getElementById("myinput");
new Awesomplete(input, {list: "#mylist"});
new Awesomplete(input, {list: document.querySelector("#mylist")});
@@ -9,7 +9,7 @@ new Awesomplete(input, {
list: ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"]
});
-var awesomplete = new Awesomplete(input);
+const awesomplete = new Awesomplete(input);
awesomplete.list = ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"];
new Awesomplete(input, {
@@ -46,15 +46,15 @@ new Awesomplete('input[data-multiple]', {
},
replace: (text: string) => {
- var before = this.input.value.match(/^.+,\s*|/)[0];
+ const before = this.input.value.match(/^.+,\s*|/)[0];
this.input.value = before + text + ", ";
}
});
-var ajax = new XMLHttpRequest();
+const ajax = new XMLHttpRequest();
ajax.open("GET", "https://restcountries.eu/rest/v1/lang/fr", true);
ajax.onload = () => {
- var list = JSON.parse(ajax.responseText).map((i: any) => i.name);
+ const list = JSON.parse(ajax.responseText).map((i: any) => i.name);
new Awesomplete(document.querySelector("#ajax-example input"), { list });
};
ajax.send();
diff --git a/types/awesomplete/index.d.ts b/types/awesomplete/index.d.ts
index 41abc36be6..4612d66210 100644
--- a/types/awesomplete/index.d.ts
+++ b/types/awesomplete/index.d.ts
@@ -6,14 +6,14 @@
declare class Awesomplete {
constructor(input: Element | HTMLElement | string, o?: Awesomplete.Options);
static all: any[];
- static $$: (expr: string | NodeSelector, con?: any) => NodeList;
+ static $$(expr: string | NodeSelector, con?: any): NodeList;
static ITEM: (text: string, input: string) => HTMLElement;
static $: {
(expr: string|Element, con?: NodeSelector): string | Element;
- regExpEscape: (s: { replace: (arg0: RegExp, arg1: string) => void }) => any;
- create: (tag: string, o: any) => HTMLElement;
- fire: (target: EventTarget, type: string, properties: any) => any;
- siblingIndex: (el: Element) => number;
+ regExpEscape(s: { replace(arg0: RegExp, arg1: string): void }): any;
+ create(tag: string, o: any): HTMLElement;
+ fire(target: EventTarget, type: string, properties: any): any;
+ siblingIndex(el: Element): number;
};
static FILTER_STARTSWITH: (text: string, input: string) => boolean;
static FILTER_CONTAINS: (text: string, input: string) => boolean;
@@ -45,11 +45,11 @@ declare namespace Awesomplete {
minChars?: number;
maxItems?: number;
autoFirst?: boolean;
- data?: (item: Suggestion, input: string) => string;
- filter?: (text: string, input: string) => boolean;
- sort?: (left: number | any[], right: number | any[]) => number;
- item?: (text: string, input: string) => HTMLElement;
- replace?: (text: string) => void;
+ data?(item: Suggestion, input: string): string;
+ filter?(text: string, input: string): boolean;
+ sort?(left: number | any[], right: number | any[]): number;
+ item?(text: string, input: string): HTMLElement;
+ replace?(text: string): void;
}
}
diff --git a/types/babel-code-frame/index.d.ts b/types/babel-code-frame/index.d.ts
index ebfde63c4c..19d18b6df8 100644
--- a/types/babel-code-frame/index.d.ts
+++ b/types/babel-code-frame/index.d.ts
@@ -4,7 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface BabelCodeFrameOptions {
- /** Syntax highlight the code as JavaScript for terminals. default: false*/
+ /** Syntax highlight the code as JavaScript for terminals. default: false */
highlightCode?: boolean;
/** The number of lines to show above the error. default: 2 */
linesBelow?: number;
diff --git a/types/base-64/index.d.ts b/types/base-64/index.d.ts
index ddd10db17b..26cb9c4a41 100644
--- a/types/base-64/index.d.ts
+++ b/types/base-64/index.d.ts
@@ -22,4 +22,4 @@ export function encode(input: string): string;
* with atob() as described in the HTML Standard.
* see: https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-atob
*/
-export function decode(input: string): string;
\ No newline at end of file
+export function decode(input: string): string;
diff --git a/types/bigi/bigi-tests.ts b/types/bigi/bigi-tests.ts
index 70569bb919..ef9d7421d3 100644
--- a/types/bigi/bigi-tests.ts
+++ b/types/bigi/bigi-tests.ts
@@ -1,9 +1,9 @@
import BigInteger = require('bigi');
-var b1 = BigInteger.fromHex("188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012");
-var b2 = BigInteger.fromHex("07192B95FFC8DA78631011ED6B24CDD573F977A11E794811");
+const b1 = BigInteger.fromHex("188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012");
+const b2 = BigInteger.fromHex("07192B95FFC8DA78631011ED6B24CDD573F977A11E794811");
-var b3 = b1.multiply(b2);
+const b3 = b1.multiply(b2);
console.log(b3.toHex());
-// => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132
\ No newline at end of file
+// => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132
diff --git a/types/bignumber.js/bignumber.js-tests.ts b/types/bignumber.js/bignumber.js-tests.ts
index 9dc96dd7ea..8ea0775dba 100644
--- a/types/bignumber.js/bignumber.js-tests.ts
+++ b/types/bignumber.js/bignumber.js-tests.ts
@@ -1,5 +1,5 @@
-var x: BigNumber.BigNumber = new BigNumber(9);
-var y = new BigNumber(x);
+let x: BigNumber.BigNumber = new BigNumber(9);
+let y = new BigNumber(x);
BigNumber(435.345);
@@ -27,7 +27,7 @@ new BigNumber(1.23456789);
new BigNumber(1.23456789, 10);
BigNumber.config({ DECIMAL_PLACES: 5 });
-var BN = BigNumber.another({ DECIMAL_PLACES: 9 });
+let BN = BigNumber.another({ DECIMAL_PLACES: 9 });
x = new BigNumber(1);
y = new BN(1);
@@ -112,14 +112,14 @@ BigNumber.config({
BigNumber.config(40, 7, [-10, 20], 500, 1, 1, 3, 80);
-var obj = BigNumber.config();
+const obj = BigNumber.config();
obj.ERRORS;
obj.RANGE;
x = new BigNumber('3257869345.0378653');
BigNumber.max(4e9, x, '123456789.9');
-var arr = [12, '13', new BigNumber(14)];
+let arr = [12, '13', new BigNumber(14)];
BigNumber.max(arr);
x = new BigNumber('3257869345.0378653');
@@ -137,7 +137,7 @@ BigNumber.config({ ROUNDING_MODE: 2 });
x = new BigNumber(-0.8);
y = x.absoluteValue();
-var z = y.abs();
+let z = y.abs();
x = new BigNumber(1.3);
x.ceil();
@@ -300,7 +300,7 @@ y.toFixed(2);
y.toFixed(2, 1);
y.toFixed(5);
-var format = {
+const format = {
decimalSeparator: '.',
groupSeparator: ',',
groupSize: 3,
@@ -332,7 +332,7 @@ x.toFormat(6);
x = new BigNumber(1.75);
x.toFraction();
-var pi = new BigNumber('3.14159265358');
+const pi = new BigNumber('3.14159265358');
pi.toFraction();
pi.toFraction(100000);
pi.toFraction(10000);
@@ -344,7 +344,7 @@ x = new BigNumber('177.7e+457');
y = new BigNumber(235.4325);
z = new BigNumber('0.0098074');
-var str = JSON.stringify([x, y, z]);
+const str = JSON.stringify([x, y, z]);
JSON.parse(str, (key, val) => key === '' ? val : new BigNumber(val));
diff --git a/types/bignumber.js/index.d.ts b/types/bignumber.js/index.d.ts
index 10423b1ed3..d627ad136c 100644
--- a/types/bignumber.js/index.d.ts
+++ b/types/bignumber.js/index.d.ts
@@ -673,4 +673,4 @@ declare namespace BigNumber {
*/
isBigNumber: true;
}
-}
\ No newline at end of file
+}
diff --git a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts
index bdaee3ee83..7267fe5d26 100644
--- a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts
+++ b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts
@@ -3,9 +3,9 @@
import bigi = require('bigi');
import bitcoin = require('bitcoinjs-lib');
-declare var it: any;
-declare var describe: any;
-declare var assert: any;
+declare const it: any;
+declare const describe: any;
+declare const assert: any;
describe('bitcoinjs-lib (basic)', () => {
it('can generate a random bitcoin address', () => {
@@ -13,18 +13,18 @@ describe('bitcoinjs-lib (basic)', () => {
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
// generate random keyPair
- var keyPair = bitcoin.ECPair.makeRandom({ rng });
- var address = keyPair.getAddress();
+ const keyPair = bitcoin.ECPair.makeRandom({ rng });
+ const address = keyPair.getAddress();
assert.strictEqual(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64');
});
it('can generate an address from a SHA256 hash', () => {
- var hash = bitcoin.crypto.sha256('correct horse battery staple');
- var d = bigi.fromBuffer(hash);
+ const hash = bitcoin.crypto.sha256('correct horse battery staple');
+ const d = bigi.fromBuffer(hash);
- var keyPair = new bitcoin.ECPair(d);
- var address = keyPair.getAddress();
+ const keyPair = new bitcoin.ECPair(d);
+ const address = keyPair.getAddress();
assert.strictEqual(address, '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8');
});
@@ -33,26 +33,26 @@ describe('bitcoinjs-lib (basic)', () => {
// for testing only
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
- var litecoin = bitcoin.networks.litecoin;
+ const litecoin = bitcoin.networks.litecoin;
- var keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng });
- var wif = keyPair.toWIF();
- var address = keyPair.getAddress();
+ const keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng });
+ const wif = keyPair.toWIF();
+ const address = keyPair.getAddress();
assert.strictEqual(address, 'LZJSxZbjqJ2XVEquqfqHg1RQTDdfST5PTn');
assert.strictEqual(wif, 'T7A4PUSgTDHecBxW1ZiYFrDNRih2o7M8Gf9xpoCgudPF9gDiNvuS');
});
it('can import an address via WIF', () => {
- var keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct');
- var address = keyPair.getAddress();
+ const keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct');
+ const address = keyPair.getAddress();
assert.strictEqual(address, '19AAjaTUbRjQCMuVczepkoPswiZRhjtg31');
});
it('can create a Transaction', () => {
- var keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
- var tx = new bitcoin.TransactionBuilder();
+ const keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
+ const tx = new bitcoin.TransactionBuilder();
tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0);
tx.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000);
diff --git a/types/bittorrent-protocol/bittorrent-protocol-tests.ts b/types/bittorrent-protocol/bittorrent-protocol-tests.ts
index f5f6b4649f..c32b2af368 100644
--- a/types/bittorrent-protocol/bittorrent-protocol-tests.ts
+++ b/types/bittorrent-protocol/bittorrent-protocol-tests.ts
@@ -7,7 +7,7 @@ class TestExtension implements Protocol.Extension {
}
net.createServer(socket => {
- var wire = new Protocol();
+ const wire = new Protocol();
wire.use(TestExtension);
diff --git a/types/bittorrent-protocol/index.d.ts b/types/bittorrent-protocol/index.d.ts
index 6d838a90f5..b5ef1a4a44 100644
--- a/types/bittorrent-protocol/index.d.ts
+++ b/types/bittorrent-protocol/index.d.ts
@@ -10,30 +10,30 @@ import * as stream from 'stream';
declare const BittorrentProtocol: BittorrentProtocol.BittorrentProtocol;
declare namespace BittorrentProtocol {
- export interface BittorrentProtocol {
+ interface BittorrentProtocol {
new (): Wire;
(): Wire;
}
- export interface ExtensionConstructor {
+ interface ExtensionConstructor {
new (wire: Wire): Extension;
}
- export interface Extension {
- onHandshake?: (infoHash: string, peerId: string, extensions: { [name: string]: boolean }) => void;
- onExtendedHandshake?: (handshake: { [key: string]: any }) => void;
- onMessage?: (buf: Buffer) => void;
+ interface Extension {
+ onHandshake?(infoHash: string, peerId: string, extensions: { [name: string]: boolean }): void;
+ onExtendedHandshake?(handshake: { [key: string]: any }): void;
+ onMessage?(buf: Buffer): void;
name: string;
}
- export interface Request {
+ interface Request {
piece: number;
offset: number;
length: number;
- callback: () => void;
+ callback(): void;
}
- export interface Wire extends stream.Duplex {
+ interface Wire extends stream.Duplex {
readonly peerId: string; // remote peer id (hex string)
readonly peerIdBuffer: Buffer; // remote peer id (Buffer)
readonly type: 'webrtc' | 'tcpIncoming' | 'tcpOutgoing' | 'webSeed'; // connection type
diff --git a/types/blacklist/blacklist-tests.ts b/types/blacklist/blacklist-tests.ts
index 0f465dd62a..5c5803c45c 100644
--- a/types/blacklist/blacklist-tests.ts
+++ b/types/blacklist/blacklist-tests.ts
@@ -1,4 +1,4 @@
-var someInput = { a: 1, b: 2, c: 3 };
+const someInput = { a: 1, b: 2, c: 3 };
import blacklist = require('blacklist');
@@ -10,4 +10,4 @@ blacklist(someInput, {
b: false, // b will be in the result
c: 1 > 2 // false, therefore c will be in the result
});
-// => { b: 2, c: 3 }
\ No newline at end of file
+// => { b: 2, c: 3 }
diff --git a/types/body-parser/index.d.ts b/types/body-parser/index.d.ts
index 2b17b20ed4..54a9b463ed 100644
--- a/types/body-parser/index.d.ts
+++ b/types/body-parser/index.d.ts
@@ -17,11 +17,11 @@ declare namespace bodyParser {
inflate?: boolean;
limit?: number | string;
type?: string | string[] | ((req: Request) => any);
- verify?: (req: Request, res: Response, buf: Buffer, encoding: string) => void;
+ verify?(req: Request, res: Response, buf: Buffer, encoding: string): void;
}
interface OptionsJson extends Options {
- reviever?: (key: string, value: any) => any;
+ reviever?(key: string, value: any): any;
strict?: boolean;
}
diff --git a/types/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts b/types/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts
index 70c8f8a586..9f2b780f44 100644
--- a/types/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts
+++ b/types/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker-tests.ts
@@ -157,7 +157,7 @@ function inputParser(inputDate: string | Date | moment.Moment) {
return moment();
}
}
-};
+}
function test_parseInputDate() {
let undef: undefined;
diff --git a/types/bootstrap.v3.datetimepicker/index.d.ts b/types/bootstrap.v3.datetimepicker/index.d.ts
index 653135057d..7b54c57dae 100644
--- a/types/bootstrap.v3.datetimepicker/index.d.ts
+++ b/types/bootstrap.v3.datetimepicker/index.d.ts
@@ -19,11 +19,11 @@ export as namespace BootstrapV3DatetimePicker;
type InputParser = (input: string | Date | moment.Moment) => moment.Moment;
export interface Datetimepicker {
- /**Clears the datepicker by setting the value to null */
+ /** Clears the datepicker by setting the value to null */
clear(): void;
- /**Returns the component's model current date, a moment object or null if not set. */
+ /** Returns the component's model current date, a moment object or null if not set. */
date(): moment.Moment;
- /**Takes string, Date, moment, null parameter and sets the components model current moment to it.
+ /** Takes string, Date, moment, null parameter and sets the components model current moment to it.
* Passing a null value unsets the components model current moment.
* Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration.
* Throws:
@@ -33,32 +33,34 @@ export interface Datetimepicker {
* - dp.change - In case newDate is different from current moment
*/
date(date: moment.Moment | Date | string | null): void;
- /**Destroys the widget and removes all attached event listeners */
+ /** Destroys the widget and removes all attached event listeners */
destroy(): void;
- /**Disables the input element, the component is attached to, by adding a disabled="true" attribute to it. If the widget was visible before that call it is hidden.
+ /** Disables the input element, the component is attached to, by adding a disabled="true" attribute to it. If the widget was visible before that call it is hidden.
* Emits:
* - dp.hide - if the widget was visible before that call
*/
disable(): void;
- /**Enables the input element, the component is attached to, by removing disabled attribute from it. */
+ /** Enables the input element, the component is attached to, by removing disabled attribute from it. */
enable(): void;
- /**Hides the widget
+ /** Hides the widget
* Emits:
* - dp.hide - if the widget was visible before that call
*/
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. */
+ /**
+ * 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;
- /**Takes an object variable with option key:value properties and configures the component. Use this to update multiple options on the component. */
+ /** 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;
- /**Shows the widget
+ /** Shows the widget
* Emits:
* - dp.show - if the widget was hidden before that call
* - dp.change - if the widget is opened for the first time and the useCurrent is set to true or to a granularity value and the input element the component is attached to has an empty value
*/
show(): void;
- /**Shows or hides the widget
+ /** Shows or hides the widget
* Emits:
* - dp.hide - if the widget is hidden after the toggle call
* - dp.show - if the widget is show after the toggle call
@@ -70,97 +72,108 @@ export interface Datetimepicker {
//// Below are the getters/setters for the properties of the 'options(): DatetimepickerOptions' ////
////////////////////////////////////////////////////////////////////////////////////////////////////
- /**Returns the options.allowInputToggle option. */
+ /** Returns the options.allowInputToggle option. */
allowInputToggle(): boolean;
- /**If true, the picker will show on textbox focus and icon click when used in a button group */
+ /** If true, the picker will show on textbox focus and icon click when used in a button group */
allowInputToggle(value: boolean): void;
- /**Returns the current options.calendarWeeks option configuration */
+ /** Returns the current options.calendarWeeks option configuration */
calendarWeeks(): boolean;
- /**Set if the week numbers will appear to the left on the days view */
+ /** Set if the week numbers will appear to the left on the days view */
calendarWeeks(value: boolean): void;
- /**Returns the options.collapse option configuration */
+ /** Returns the options.collapse option configuration */
collapse(): boolean;
- /**If set to false the picker will display similar to sideBySide except vertical. */
+ /** If set to false the picker will display similar to sideBySide except vertical. */
collapse(value: boolean): void;
- /**Returns the options.daysOfWeekDisabled configuration
+ /**
+ * Returns the options.daysOfWeekDisabled configuration
* IMPORTANT! Throws exception if not set explicitly https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1459
- */
+ */
daysOfWeekDisabled(): number[];
- /**Takes an [ Number:0 to 6 ] and disallow the user to select weekdays that exist in this array.
+ /** 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: number[]): void;
- /**Returns the options.dayViewHeaderFormat option. */
+ /** Returns the options.dayViewHeaderFormat option. */
dayViewHeaderFormat(): string;
- /**Used to customize the header of the day view. */
+ /** Used to customize the header of the day view. */
dayViewHeaderFormat(value: string): void;
- /**Returns a moment with the options.defaultDate option configuration or false if not set */
+ /** Returns a moment with the options.defaultDate option configuration or false if not set */
defaultDate(): moment.Moment | boolean;
- /**Will set the picker's inital date.
+ /**
+ * Will set the picker's inital date.
* If a boolean:false value is passed the options.defaultDate parameter is cleared.
* Throws:
* - TypeError - if the provided date doesn't pass validation, including disabledDates, enabledDates, minDate, maxDate, and daysOfWeekDisabled
* - TypeError - if the provided date cannot be parsed by momentjs
*/
defaultDate(date: string | Date | moment.Moment | boolean): void;
- /**Returns the options.disabledDates option.
+ /**
+ * Returns the options.disabledDates option.
* NOTES: probably should be: disabledDates(): boolean | Array; see: DatetimepickerOptions
- */
+ */
disabledDates(): boolean | any;
- /**Takes an array of values and disallows the user to select those days.
+ /**
+ * Takes an array of values and disallows the user to select those days.
* Setting this takes precedence over options.minDate, options.maxDate configuration.
* Also calling this function removes the configuration of options.enabledDates if such exist.
* Note: These values are matched with Day granularity.
*/
disabledDates(dates: boolean | Array): void;
- /**Returns the options.disabledHours option.
+ /**
+ * Returns the options.disabledHours option.
* 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. */
+ /**
+ * 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 | number[]): void;
- /**Returns the options.disabledTimeIntervals option, or... not exactly
+ /** 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 | moment.Moment[][];
- /**Disables time selection between the given moments
+ /** Disables time selection between the given moments
* eg: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]]
*/
disabledTimeIntervals(value: boolean | moment.Moment[][]): void;
- /**Returns the options.enabledDates option
+ /**
+ * Returns the options.enabledDates option
* NOTES: probably should be: enabledDates(): boolean | Array; see: DatetimepickerOptions
- */
+ */
enabledDates(): boolean | any;
- /**Takes an array of values and allows the user to select only from those days.
+ /** Takes an array of values and allows the user to select only from those days.
* Setting this takes precedence over options.minDate, options.maxDate configuration.
* Also calling this function removes the configuration of options.disabledDates if such exist.
* Note: These values are matched with Day granularity.
*/
enabledDates(dates: boolean | Array): void;
- /**Returns the options.enabledHours option.
+ /**
+ * Returns the options.enabledHours option.
* 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. */
+ /**
+ * 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 | number[]): void;
- /**Returns a boolean or array with the options.extraFormats option configuration */
+ /** 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 */
+ /** Takes an array of valid input moment format options, or boolean:false */
extraFormats(formats: boolean | Array): void;
- /**Returns the options.focusOnShow option. */
+ /** Returns the options.focusOnShow option. */
focusOnShow(): boolean;
- /**If false, the textbox will not be given focus when the picker is shown */
+ /** If false, the textbox will not be given focus when the picker is shown */
focusOnShow(value: boolean): void;
- /**Returns the component's options.format string */
+ /** Returns the component's options.format string */
format(): boolean | string | moment.MomentBuiltinFormat;
- /**Takes a moment.js format string and sets the components options.format.
+ /** Takes a moment.js format string and sets the components options.format.
* This is used for displaying and also for parsing input strings either from the input element the component is attached to or the date() function.
* The parameter can also be a boolean:false in which case the format is set to the locale's L LT.
* Note: this is also used to determine if the TimePicker sub component will display the hours in 12 or 24 format. (if "a" or "h" exists in the passed string then a 12 hour mode is set)
@@ -168,40 +181,41 @@ export interface Datetimepicker {
* - TypeError - if format is boolean:true
*/
format(format: boolean | string | moment.MomentBuiltinFormat): void;
- /**Returns options.icons */
+ /** Returns options.icons */
icons(): Icons;
- /**Takes an Object of strings.
+ /** Takes an Object of strings.
* Throws:
* - TypeError - if icons parameter is not an Object
*/
icons(icons: Icons): void;
- /**Returns the options.ignoreReadonly option. */
+ /** Returns the options.ignoreReadonly option. */
ignoreReadonly(): boolean;
- /**Set this to true to allow the picker to be used even if the input field is readonly. This will not bypass the disabled property */
+ /** Set this to true to allow the picker to be used even if the input field is readonly. This will not bypass the disabled property */
ignoreReadonly(value: boolean): void;
- /**Returns the options.inline option. */
+ /** Returns the options.inline option. */
inline(): boolean;
- /**Used to customize the header of the day view. */
+ /** Used to customize the header of the day view. */
inline(value: boolean): void;
- /**Returns the options.keepInvalid option. */
+ /** Returns the options.keepInvalid option. */
keepInvalid(): boolean;
- /**If true, invalid dates will not be reverted to a previous selection or changed. */
+ /** If true, invalid dates will not be reverted to a previous selection or changed. */
keepInvalid(value: boolean): void;
- /**Returns a string variable with the currently set options.keyBinds option. */
+ /** Returns a string variable with the currently set options.keyBinds option. */
keyBinds(): any;
- /**Allows for several keyBinding functions to be specified for ease of access or accessibility. For defaults see {@link http://eonasdan.github.io/bootstrap-datetimepicker/Options/#keybinds}.
- */
+ /**
+ * Allows for several keyBinding functions to be specified for ease of access or accessibility. For defaults see {@link http://eonasdan.github.io/bootstrap-datetimepicker/Options/#keybinds}.
+ */
keyBinds(value: any): void;
- /**Returns the currently set locale of the options.locale */
+ /** Returns the currently set locale of the options.locale */
locale(): string;
- /**Takes a string of any valid moment locale e.g. de for German.
+ /** Takes a string of any valid moment locale e.g. de for German.
* Throws:
* - TypeError - if the locale is not loaded via a separate script or moment-with-locale
*/
locale(newLocale: string): void;
- /**Returns the currently set moment of the options.maxDate or false if not set */
+ /** Returns the currently set moment of the options.maxDate or false if not set */
maxDate(): moment.Moment | boolean;
- /**Takes a parameter and disallows the user to select a moment that is after that moment.
+ /** Takes a parameter and disallows the user to select a moment that is after that moment.
* If a boolean:false value is passed options.maxDate is cleared and there is no restriction to the maximum moment the user can select.
* Note: If the parameter is before the currently selected moment the currently selected moment changes to maxDate
* Throws:
@@ -213,9 +227,9 @@ export interface Datetimepicker {
* - dp.error - if the new maxDate is after currently selected moment
*/
maxDate(date: moment.Moment | Date | string | boolean): void;
- /**Returns the currently set moment of the options.minDate or false if not set */
+ /** Returns the currently set moment of the options.minDate or false if not set */
minDate(): moment.Moment | boolean;
- /**Takes a parameter and disallows the user to select a moment that is before that moment.
+ /** Takes a parameter and disallows the user to select a moment that is before that moment.
* If a boolean:false value is passed the options.minDate parameter is cleared and there is no restriction to the miminum moment the user can select.
* Note: If the parameter is after the currently selected moment the currently selected moment changes to minDate parameter
* Throws:
@@ -227,31 +241,31 @@ export interface Datetimepicker {
* - dp.error - if the new minDate is after currently selected moment
*/
minDate(date: moment.Moment | Date | string | boolean): void;
- /**Returns the options.parseInputDate option */
+ /** Returns the options.parseInputDate option */
parseInputDate(): InputParser | undefined;
- /**Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
+ /** Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
* {@link http://eonasdan.github.io/bootstrap-datetimepicker/Functions/#parseinputdate}
*/
parseInputDate(value: InputParser): void;
- /**Returns the options.showClear option. */
+ /** Returns the options.showClear option. */
showClear(): boolean;
- /**Set if the clear date button will appear on the widget */
+ /** Set if the clear date button will appear on the widget */
showClear(value: boolean): void;
- /**Returns the options.showClose option. */
+ /** Returns the options.showClose option. */
showClose(): boolean;
- /**If true, an icon will be displayed on the toolbar that will hide the picker */
+ /** If true, an icon will be displayed on the toolbar that will hide the picker */
showClose(value: boolean): void;
- /**Returns the options.showTodayButton option. */
+ /** Returns the options.showTodayButton option. */
showTodayButton(): boolean;
- /**Set if the Today button will appear on the widget */
+ /** Set if the Today button will appear on the widget */
showTodayButton(value: boolean): void;
- /**Returns a boolean of the options.sideBySide. */
+ /** Returns a boolean of the options.sideBySide. */
sideBySide(): boolean;
- /**If sideBySide is true and the time picker is used, both components will display side by side instead of collapsing. */
+ /** If sideBySide is true and the time picker is used, both components will display side by side instead of collapsing. */
sideBySide(value: boolean): void;
- /**Returns a number with the options.stepping option configuration */
+ /** Returns a number with the options.stepping option configuration */
stepping(): number;
- /**This will be the amount the up/down arrows move the minute value with a time picker. */
+ /** This will be the amount the up/down arrows move the minute value with a time picker. */
stepping(step: number): void;
/** Returns a string of options.timeZone */
timeZone(): string | null;
@@ -260,24 +274,24 @@ export interface Datetimepicker {
* - TypeError - if tooltips parameter is not a string or null
*/
timeZone(timeZone: string | null): void;
- /**Returns the options.toolbarplacement option. */
+ /** Returns the options.toolbarplacement option. */
toolbarPlacement(): string;
- /**Changes the placement of the toolbar where the today, clear, component switch icon are located.
+ /** Changes the placement of the toolbar where the today, clear, component switch icon are located.
* See valid values at DatetimepickerOptions.toolbarplacement
* Throws:
* - TypeError - if the parameter is not a valid value
*/
toolbarPlacement(value: string): void;
- /**Returns the options.tooltips option */
+ /** Returns the options.tooltips option */
tooltips(): Tooltips;
- /**Sets the tooltips for icons.
+ /** Sets the tooltips for icons.
* Throws:
* - TypeError - if tooltips parameter is not an Object
*/
tooltips(value: Tooltips): void;
- /**Returns the options.useCurrent option configuration */
+ /** Returns the options.useCurrent option configuration */
useCurrent(): boolean | string;
- /**Takes a boolean or string.
+ /** Takes a boolean or string.
* If a boolean true is passed and the components model moment is not set (either through setDate or through a valid value on the input element the component is attached to)
* then the first time the user opens the datetimepicker widget the value is initialized to the current moment of the action.
* If a false boolean is passed then no initialization happens on the input element.
@@ -287,28 +301,28 @@ export interface Datetimepicker {
* Note: If the options.defaultDate is set or the input element the component is attached to has already a value that takes precedence and the functionality of useCurrent is not triggered!
*/
useCurrent(value: boolean | string): void;
- /**Returns the options.useStrict */
+ /** Returns the options.useStrict */
useStrict(): boolean;
- /**If useStrict is true, momentjs parsing rules will be stricter when determining if a date is valid or not. */
+ /** If useStrict is true, momentjs parsing rules will be stricter when determining if a date is valid or not. */
useStrict(value: boolean): void;
- /**Returns the options.viewDate option. */
+ /** Returns the options.viewDate option. */
viewDate(): boolean | moment.Moment;
- /**This will change the viewDate without changing or setting the selected date. */
+ /** This will change the viewDate without changing or setting the selected date. */
viewDate(value: string | Date | moment.Moment | boolean): void;
- /**Returns the options.viewMode. */
+ /** Returns the options.viewMode. */
viewMode(): string;
- /**Takes a string. See valid values at DatetimepickerOptions.viewMode
+ /** Takes a string. See valid values at DatetimepickerOptions.viewMode
* Throws:
* - TypeError - if the parameter is not a string or not a valid value
*/
viewMode(value: string): void;
- /**Returns a $(element) variable with the currently set options.widgetParent option. */
+ /** Returns a $(element) variable with the currently set options.widgetParent option. */
widgetParent(): string | JQuery | null;
- /**Takes a string or $(element) value. */
+ /** Takes a string or $(element) value. */
widgetParent(widgetParent: string | JQuery | null): void;
- /**Returns the options.widgetPositioning object */
+ /** Returns the options.widgetPositioning object */
widgetPositioning(): WidgetPositioningOptions;
- /**WidgetPositioning defines where the dropdown with the widget will appear relative to the input element the component is attached to.
+ /** WidgetPositioning defines where the dropdown with the widget will appear relative to the input element the component is attached to.
* "auto" is the default value for both horizontal and vertical keys and it tries to automatically place the dropdown in a position that is visible to the user.
* Usually you should not override those options unless you have a special need in your layout.
*/
@@ -316,91 +330,91 @@ export interface Datetimepicker {
}
export interface DatetimepickerOptions {
- /**If true, the picker will show on textbox focus and icon click when used in a button group
+ /** If true, the picker will show on textbox focus and icon click when used in a button group
* @default: false
*/
allowInputToggle?: boolean;
- /**Shows the week of the year to the left of first day of the week.
+ /** Shows the week of the year to the left of first day of the week.
* @default: false
*/
calendarWeeks?: boolean;
- /**Using a Bootstraps collapse to switch between date/time pickers.
+ /** Using a Bootstraps collapse to switch between date/time pickers.
* @default: true
*/
collapse?: boolean;
- /**Disables the section of days of the week, e.g. weekends.
+ /** Disables the section of days of the week, e.g. weekends.
* Accepts: array of numbers from 0-6
* @default: false
*/
daysOfWeekDisabled?: number[] | boolean;
- /**Changes the heading of the datepicker when in "days" view.
+ /** Changes the heading of the datepicker when in "days" view.
* @default: "MMMM YYYY"
*/
dayViewHeaderFormat?: string;
- /**Will cause the date picker to stay open after a blur event.
+ /** Will cause the date picker to stay open after a blur event.
* @default: false
*/
debug?: boolean;
- /**Sets the picker default date/time. Overrides useCurrent
+ /** Sets the picker default date/time. Overrides useCurrent
* @default: false
*/
defaultDate?: boolean | moment.Moment | Date | string;
- /**Disables selection of dates in the array, e.g. holidays
+ /** Disables selection of dates 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.
* eg disabledDates = ["2010-10-10"]; -> disabledDated will be { "2010-01-01": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
disabledDates?: boolean | Array | any;
- /**Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
+ /** Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
* @default: false
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the hours, values being true.
* eg disabledHours = [0, 1]; -> disabledHours will be { "0": true, "1": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
disabledHours?: boolean | number[] | any;
- /**Disables time selection between the given moments
+ /** Disables time selection between the given moments
* eg: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]]
* @default: false
*/
disabledTimeIntervals?: boolean | moment.Moment[][];
- /**Disables selection of dates NOT in the array, e.g. holidays
+ /** 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.
* eg enabledDates = ["2010-10-10"]; -> enabledDated will be { "2010-01-01": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
enabledDates?: boolean | Array | any;
- /**Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
+ /** Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
* @default: false
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the hours, values being true.
* eg enabledHours = [0, 1]; -> enabledHours will be { "0": true, "1": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
enabledHours?: boolean | number[];
- /**Allows for several input formats to be valid. See: https://github.com/Eonasdan/bootstrap-datetimepicker/pull/666
+ /** Allows for several input formats to be valid. See: https://github.com/Eonasdan/bootstrap-datetimepicker/pull/666
* @default: false
*/
extraFormats?: boolean | Array;
- /**If false, the textbox will not be given focus when the picker is shown
+ /** If false, the textbox will not be given focus when the picker is shown
* @default: true
*/
focusOnShow?: boolean;
- /**See momentjs' docs for valid formats. Format also dictates what components are shown, e.g. MM/dd/YYYY will not display the time picker.
+ /** See momentjs' docs for valid formats. Format also dictates what components are shown, e.g. MM/dd/YYYY will not display the time picker.
* @default: false
*/
format?: boolean | string | moment.MomentBuiltinFormat;
- /**Change the default icons for the pickers functions. */
+ /** Change the default icons for the pickers functions. */
icons?: Icons;
- /**Allow date picker show event to fire even when the associated input element has the readonly="readonly"property.
+ /** Allow date picker show event to fire even when the associated input element has the readonly="readonly"property.
* @default: false
*/
ignoreReadonly?: boolean;
- /**Will display the picker inline without the need of a input field. This will also hide borders and shadows.
+ /** Will display the picker inline without the need of a input field. This will also hide borders and shadows.
* @default: false
*/
inline?: boolean;
- /**Allows for custom events to fire on keyboard press.
+ /** Allows for custom events to fire on keyboard press.
* eg: keybinds: {
* up: (widget) => console.log(widget),
* "control up": (widget) => console.log(widget)
@@ -408,52 +422,52 @@ export interface DatetimepickerOptions {
* The widget parameter is false, if the datepicker is closed.
*/
keyBinds?: { [key: string]: (widget: boolean | JQuery) => void };
- /**Will cause the date picker to not revert or overwrite invalid dates.
+ /** Will cause the date picker to not revert or overwrite invalid dates.
* @default: false
*/
keepInvalid?: boolean;
- /**Will cause the date picker to stay open after selecting a date if no time components are being used.
+ /** Will cause the date picker to stay open after selecting a date if no time components are being used.
* @default: false
*/
keepOpen?: boolean;
- /**See momentjs for valid locales. You must include moment-with-locales.js or a local js file.
+ /** See momentjs for valid locales. You must include moment-with-locales.js or a local js file.
* @default: moment.locale()
*/
locale?: string;
- /**Prevents date/time selections after this date.
+ /** Prevents date/time selections after this date.
* maxDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected.
* @default: false
*/
maxDate?: boolean | moment.Moment | Date | string;
- /**Prevents date/time selections before this date.
+ /** Prevents date/time selections before this date.
* minDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected.
* @default: false
*/
minDate?: boolean | moment.Moment | Date | string;
- /**Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
+ /** Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
* {@link http://eonasdan.github.io/bootstrap-datetimepicker/Functions/#parseinputdate}
*/
parseInputDate?: InputParser;
- /**Show the "Clear" button in the icon toolbar.
+ /** Show the "Clear" button in the icon toolbar.
* Clicking the "Clear" button will set the calendar to null.
* @default: false
*/
showClear?: boolean;
- /**Show the "Close" button in the icon toolbar.
+ /** Show the "Close" button in the icon toolbar.
* Clicking the "Close" button will call hide()
* @default: false
*/
showClose?: boolean;
- /**Show the "Today" button in the icon toolbar.
+ /** Show the "Today" button in the icon toolbar.
* Clicking the "Today" button will set the calendar view and set the date to now.
* @default: false
*/
showTodayButton?: boolean;
- /**Shows the picker side by side when using the time and date together.
+ /** Shows the picker side by side when using the time and date together.
* @default: false
*/
sideBySide?: boolean;
- /**Number of minutes the up/down arrow's will move the minutes value in the time picker
+ /** Number of minutes the up/down arrow's will move the minutes value in the time picker
* @default: 1
*/
stepping?: number;
@@ -462,30 +476,30 @@ export interface DatetimepickerOptions {
* @default: ""
*/
timeZone?: string | null;
- /**Changes the placement of the icon toolbar.
+ /** Changes the placement of the icon toolbar.
* @default: "default"
*/
toolbarPlacement?: "default" | "top" | "bottom";
- /**This will change the tooltips over each icon to a custom string */
+ /** This will change the tooltips over each icon to a custom string */
tooltips?: Tooltips;
- /**On show, will set the picker to the current date/time
+ /** On show, will set the picker to the current date/time
* @default: true
*/
useCurrent?: boolean;
- /**Defines if moment should use strict date parsing when considering a date to be valid
+ /** Defines if moment should use strict date parsing when considering a date to be valid
* @default: false
*/
useStrict?: boolean;
- /**This will change the viewDate without changing or setting the selected date.
+ /** This will change the viewDate without changing or setting the selected date.
* @default: false
*/
viewDate?: boolean | moment.Moment | Date | string;
- /**The default view to display when the picker is shown.
+ /** The default view to display when the picker is shown.
* Note: To limit the picker to selecting, for instance the year and month, use format: MM/YYYY
* @default: "days"
*/
viewMode?: "decades" | "years" | "months" | "days";
- /**On picker show, places the widget at the identifier (string) or jQuery object if the element has css position: "relative"
+ /** On picker show, places the widget at the identifier (string) or jQuery object if the element has css position: "relative"
* @default: null
*/
widgetParent?: string | JQuery | null;
@@ -493,23 +507,23 @@ export interface DatetimepickerOptions {
}
export interface Icons {
- /**default: "glyphicon glyphicon-trash" */
+ /** default: "glyphicon glyphicon-trash" */
clear?: string;
- /**default: "glyphicon glyphicon-remove" */
+ /** default: "glyphicon glyphicon-remove" */
close?: string;
- /**default: "glyphicon glyphicon-calendar" */
+ /** default: "glyphicon glyphicon-calendar" */
date?: string;
- /**default: "glyphicon glyphicon-time" */
+ /** default: "glyphicon glyphicon-time" */
down?: string;
- /**default: "glyphicon glyphicon-chevron-left" */
+ /** default: "glyphicon glyphicon-chevron-left" */
next?: string;
- /**default: "glyphicon glyphicon-screenshot" */
+ /** default: "glyphicon glyphicon-screenshot" */
previous?: string;
- /**default: "glyphicon glyphicon-chevron-right" */
+ /** default: "glyphicon glyphicon-chevron-right" */
time?: string;
- /**default: "glyphicon glyphicon-chevron-down" */
+ /** default: "glyphicon glyphicon-chevron-down" */
today?: string;
- /**default: "glyphicon glyphicon-chevron-up" */
+ /** default: "glyphicon glyphicon-chevron-up" */
up?: string;
}
@@ -551,14 +565,14 @@ export interface Event extends JQueryEventObject {
}
export interface ChangeEvent extends Event {
- /**Previous date. False if the previous date is null. */
+ /** Previous date. False if the previous date is null. */
oldDate: moment.Moment | boolean;
}
export interface UpdateEvent extends JQueryEventObject {
- /**Change type as a momentjs format token. e.g. yyyy on year change */
+ /** Change type as a momentjs format token. e.g. yyyy on year change */
change: string;
- /**New viewDate. */
+ /** New viewDate. */
viewDate: moment.Moment;
}
diff --git a/types/braintree-web/index.d.ts b/types/braintree-web/index.d.ts
index 6d896a5efe..a30a880684 100644
--- a/types/braintree-web/index.d.ts
+++ b/types/braintree-web/index.d.ts
@@ -7,7 +7,7 @@
* @module braintree-web/american-express
* @description This module is for use with Amex Express Checkout. To accept American Express cards, use Hosted Fields.
*/
-declare namespace BraintreeWeb {
+declare namespace braintree {
export interface AmericanExpress {
/**
* @static
@@ -24,22 +24,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
- }
-
- /**
- * @class
- * @param {object} options Options
- * @description You cannot use this constructor directly. Use {@link module:braintree-web/american-express.create|braintree.american-express.create} instead.
- * @classdesc This class allows you use a nonce to interact with American Express Checkout. To accept American Express cards, use Hosted Fields.
- */
- export class AmericanExpress {
- /**
- * @class
- * @param {object} options Options
- * @description You cannot use this constructor directly. Use {@link module:braintree-web/american-express.create|braintree.american-express.create} instead.
- * @classdesc This class allows you use a nonce to interact with American Express Checkout. To accept American Express cards, use Hosted Fields.
- */
- constructor(options: any);
/**
* Gets the rewards balance associated with a Braintree nonce.
@@ -63,7 +47,7 @@ declare namespace BraintreeWeb {
* });
* });
*/
- public getRewardsBalance(options: { nonce: string }, callback: callback): void;
+ getRewardsBalance(options: { nonce: string }, callback: callback): void;
/**
* Gets the Express Checkout nonce profile given a nonce from American Express.
@@ -87,121 +71,123 @@ declare namespace BraintreeWeb {
* });
* });
*/
- public getExpressCheckoutProfile(options: { nonce: string }, callback: callback): void;
+ getExpressCheckoutProfile(options: { nonce: string }, callback: callback): void;
}
}
-// more info https://developer.apple.com/reference/applepayjs/1916082-applepay_js_data_types/paymentrequest
+declare namespace braintree {
+ // more info https://developer.apple.com/reference/applepayjs/1916082-applepay_js_data_types/paymentrequest
-// billingContact
-// Billing contact information for the user.
-// countryCode
-//Required.The merchant’s two- letter ISO 3166 country code.
-// currencyCode
-// Required.The three- letter ISO 4217 currency code for the payment.
-// lineItems
-//A set of line items that explain recurring payments and additional charges.
-// merchantCapabilities
-// Required.The payment capabilities supported by the merchant.The value must be one or more of supports3DS, supportsEMV, supportsCredit, or supportsDebit.
-// requiredBillingContactFields
-// The billing information that is required from the user.The value must be one or more of postalAddress, phone, email, or name.
-// requiredShippingContactFields
-// The shipping information that is required from the user.The value must be one or more of postalAddress, phone, email, or name.
-// shippingContact
-// Shipping contact information for the user.
-// shippingMethods
-//A set of available shipping methods.Totals for all shipping methods must be non- negative to pass validation.
-// shippingType
-// How the items are to be shipped.This property is optional.If specified, it must be one or more of shipping, delivery, storePickup, or servicePickup.The default value is shipping.
-// supportedNetworks
-// Required.The payment networks supported by the merchant.The value must be one or more of amex, discover, interac, masterCard, privateLabel, or visa.
-// total
-// Required.The total amount for the payment.The total must be greater than zero and have a label to pass validation.
-interface ApplePayPaymentRequest {
- total: {
- label: string;
- amount: string;
- };
- countryCode: string;
- currencyCode: string;
- supportedNetworks: string[];
- merchantCapabilities: string[];
+ // billingContact
+ // Billing contact information for the user.
+ // countryCode
+ //Required.The merchant’s two- letter ISO 3166 country code.
+ // currencyCode
+ // Required.The three- letter ISO 4217 currency code for the payment.
+ // lineItems
+ //A set of line items that explain recurring payments and additional charges.
+ // merchantCapabilities
+ // Required.The payment capabilities supported by the merchant.The value must be one or more of supports3DS, supportsEMV, supportsCredit, or supportsDebit.
+ // requiredBillingContactFields
+ // The billing information that is required from the user.The value must be one or more of postalAddress, phone, email, or name.
+ // requiredShippingContactFields
+ // The shipping information that is required from the user.The value must be one or more of postalAddress, phone, email, or name.
+ // shippingContact
+ // Shipping contact information for the user.
+ // shippingMethods
+ //A set of available shipping methods.Totals for all shipping methods must be non- negative to pass validation.
+ // shippingType
+ // How the items are to be shipped.This property is optional.If specified, it must be one or more of shipping, delivery, storePickup, or servicePickup.The default value is shipping.
+ // supportedNetworks
+ // Required.The payment networks supported by the merchant.The value must be one or more of amex, discover, interac, masterCard, privateLabel, or visa.
+ // total
+ // Required.The total amount for the payment.The total must be greater than zero and have a label to pass validation.
+ interface ApplePayPaymentRequest {
+ total: {
+ label: string;
+ amount: string;
+ };
+ countryCode: string;
+ currencyCode: string;
+ supportedNetworks: string[];
+ merchantCapabilities: string[];
- billingContact?: any;
- shippingContact?: any;
- shippingMethods?: any;
- shippingType?: any;
- requiredBillingContactFields?: any;
- requiredShippingContactFields?: any;
-}
+ billingContact?: any;
+ shippingContact?: any;
+ shippingMethods?: any;
+ shippingType?: any;
+ requiredBillingContactFields?: any;
+ requiredShippingContactFields?: any;
+ }
-declare enum ApplePayStatusCodes {
- // The requested action succeeded.
- STATUS_SUCCESS = 1,
- // The requested action failed.
- STATUS_FAILURE,
- // The billing address is not valid.
- STATUS_INVALID_BILLING_POSTAL_ADDRESS,
- // The shipping address is not valid.
- STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,
- // The shipping contact information is not valid.
- STATUS_INVALID_SHIPPING_CONTACT,
- // The required PIN information was not provided. Cards on the China Union Pay payment network may require a PIN to authenticate the transaction.
- STATUS_PIN_REQUIRED,
- // The PIN information is not valid.Cards on the China Union Pay network may require a PIN.
- STATUS_PIN_INCORRECT,
- // The maximum number of tries for a PIN has been reached and the user has been locked out. Cards on the China Union Pay network may require a PIN.
- STATUS_PIN_LOCKOUT,
-}
+ export enum ApplePayStatusCodes {
+ // The requested action succeeded.
+ STATUS_SUCCESS = 1,
+ // The requested action failed.
+ STATUS_FAILURE,
+ // The billing address is not valid.
+ STATUS_INVALID_BILLING_POSTAL_ADDRESS,
+ // The shipping address is not valid.
+ STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,
+ // The shipping contact information is not valid.
+ STATUS_INVALID_SHIPPING_CONTACT,
+ // The required PIN information was not provided. Cards on the China Union Pay payment network may require a PIN to authenticate the transaction.
+ STATUS_PIN_REQUIRED,
+ // The PIN information is not valid.Cards on the China Union Pay network may require a PIN.
+ STATUS_PIN_INCORRECT,
+ // The maximum number of tries for a PIN has been reached and the user has been locked out. Cards on the China Union Pay network may require a PIN.
+ STATUS_PIN_LOCKOUT,
+ }
-interface ApplePayPayload {
- merchantIdentifier: string;
- domainName: string;
- displayName: string;
-}
+ interface ApplePayPayload {
+ merchantIdentifier: string;
+ domainName: string;
+ displayName: string;
+ }
-declare class ApplePaySession {
- constructor(version: number, request: ApplePayPaymentRequest);
+ export class ApplePaySession {
+ constructor(version: number, request: ApplePayPaymentRequest);
- canMakePayments(): boolean;
+ canMakePayments(): boolean;
- canMakePaymentsWithActiveCard(merchantIdentifier: string): boolean;
+ canMakePaymentsWithActiveCard(merchantIdentifier: string): boolean;
- completeMerchantValidation(merchantSession: any): void;
+ completeMerchantValidation(merchantSession: any): void;
- abort(): void;
+ abort(): void;
- begin(): void;
+ begin(): void;
- completePayment(status: ApplePayStatusCodes): void;
+ completePayment(status: ApplePayStatusCodes): void;
- completePaymentMethodSelection(newTotal: any, newLineItems: any): void;
+ completePaymentMethodSelection(newTotal: any, newLineItems: any): void;
- completeShippingContactSelection(status: ApplePayStatusCodes, newShippingMethods: any, newTotal: any, newLineItems: any): void;
+ completeShippingContactSelection(status: ApplePayStatusCodes, newShippingMethods: any, newTotal: any, newLineItems: any): void;
- completeShippingMethodSelection(status: ApplePayStatusCodes, newTotal: any, newLineItems: any): void;
+ completeShippingMethodSelection(status: ApplePayStatusCodes, newTotal: any, newLineItems: any): void;
- supportsVersion(version: number): boolean;
+ supportsVersion(version: number): boolean;
- oncancel: (event: any) => void;
+ oncancel: (event: any) => void;
- onpaymentauthorized: (event: any) => void;
+ onpaymentauthorized: (event: any) => void;
- onpaymentmethodselected: (event: any) => void;
+ onpaymentmethodselected: (event: any) => void;
- onshippingcontactselected: (event: any) => void;
+ onshippingcontactselected: (event: any) => void;
- onshippingmethodselected: (event: any) => void;
+ onshippingmethodselected: (event: any) => void;
- onvalidatemerchant: (event: any) => void;
+ onvalidatemerchant: (event: any) => void;
+ }
}
/**
* @module braintree-web/apple-pay
* @description Accept Apple Pay on the Web. *This component is currently in beta and is subject to change.*
*/
-declare namespace BraintreeWeb {
+declare namespace braintree {
export interface ApplePay {
/**
* @static
@@ -218,22 +204,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
- }
-
- /**
- * @class
- * @param {object} options Options
- * @description You cannot use this constructor directly. Use {@link module:braintree-web/apple-pay.create|braintree.apple-pay.create} instead.
- * @classdesc This class represents an Apple Pay component. Instances of this class have methods for validating the merchant server and tokenizing payments.
- */
- export class ApplePay {
- /**
- * @class
- * @param {object} options Options
- * @description You cannot use this constructor directly. Use {@link module:braintree-web/apple-pay.create|braintree.apple-pay.create} instead.
- * @classdesc This class represents an Apple Pay component. Instances of this class have methods for validating the merchant server and tokenizing payments.
- */
- constructor(options: any);
/**
* Merges a payment request with Braintree defaults
@@ -260,7 +230,7 @@ declare namespace BraintreeWeb {
* // { total: { }, countryCode: 'US', currencyCode: 'USD', merchantCapabilities: [ ], supportedNetworks: [ ] }
*
*/
- public createPaymentRequest(paymentRequest: ApplePayPaymentRequest): ApplePayPaymentRequest
+ createPaymentRequest(paymentRequest: ApplePayPaymentRequest): ApplePayPaymentRequest
/**
* Validates the merchant website, as required by ApplePaySession before payment can be authorized.
@@ -302,7 +272,7 @@ declare namespace BraintreeWeb {
* };
* });
*/
- public performValidation(options: { validationURL: string, displayName?: string, merchantIdentifier?: string }, callback: callback): void;
+ performValidation(options: { validationURL: string, displayName?: string, merchantIdentifier?: string }, callback: callback): void;
/**
* Tokenizes an Apple Pay payment.
@@ -332,16 +302,14 @@ declare namespace BraintreeWeb {
* };
* });
*/
- public tokenize(options: { token: any }, callback: callback): void;
-
+ tokenize(options: { token: any }, callback: callback): void;
}
}
/** @module braintree-web/client */
-declare namespace BraintreeWeb {
+declare namespace braintree {
/**
* This object is returned by {@link Client#getConfiguration|getConfiguration}. This information is used extensively by other Braintree modules to properly configure themselves.
- * @typedef {object} Client~configuration
* @property {object} client The braintree-web/client parameters.
* @property {string} client.authorization A tokenizationKey or clientToken.
* @property {object} gatewayConfiguration Gateway-supplied configuration.
@@ -398,30 +366,13 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
- }
-
- /**
- * @class
- * @param {Client~configuration} configuration Options
- * @description Do not use this constructor directly. Use {@link module:braintree-web/client.create|braintree.client.create} instead.
- * @classdesc This class is required by many other Braintree components. It serves as the base API layer that communicates with our servers. It is also capable of being used to formulate direct calls to our servers, such as direct credit card tokenization. See {@link Client#request}.
- */
- export class Client {
- /**
- * @class
- * @param {Client~configuration} configuration Options
- * @description Do not use this constructor directly. Use {@link module:braintree-web/client.create|braintree.client.create} instead.
- * @classdesc This class is required by many other Braintree components. It serves as the base API layer that communicates with our servers. It is also capable of being used to formulate direct calls to our servers, such as direct credit card tokenization. See {@link Client#request}.
- */
- constructor(configuration: Configuration);
-
/**
* Returns a copy of the configuration values.
* @public
* @returns {Client~configuration} configuration
*/
- public getConfiguration(): Configuration;
+ getConfiguration(): Configuration;
/**
* Used by other modules to formulate all network requests to the Braintree gateway. It is also capable of being used directly from your own form to tokenize credit card information. However, be sure to satisfy PCI compliance if you use direct card tokenization.
@@ -470,13 +421,12 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
- public request(options: { method: string, endpoint: string, data: any, timeout?: number }, callback: callback): void;
-
+ request(options: { method: string, endpoint: string, data: any, timeout?: number }, callback: callback): void;
}
}
/** @module braintree-web/data-collector */
-declare namespace BraintreeWeb {
+declare namespace braintree {
export interface DataCollector {
/**
* @static
@@ -496,24 +446,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
- }
-
- /**
- * @class
- * @global
- * @name DataCollector
- * @description Do not use this constructor directly. Use {@link module:braintree-web/data-collector.create|braintree-web.data-collector.create} instead.
- * @classdesc This class is used for advanced fraud integration with PayPal and Kount. Instances of this class have {@link DataCollector#deviceData|deviceData} which is used to correlate user sessions with server transactions. Before using DataCollector, make sure you have enabled advanced fraud protection in the Braintree gateway. To use your own Kount ID, contact our support team ([support@braintreepayments.com](mailto:support@braintreepayments.com) or [877.434.2894](tel:877.434.2894)).
- */
- export class DataCollector {
- /**
- * @class
- * @global
- * @name DataCollector
- * @description Do not use this constructor directly. Use {@link module:braintree-web/data-collector.create|braintree-web.data-collector.create} instead.
- * @classdesc This class is used for advanced fraud integration with PayPal and Kount. Instances of this class have {@link DataCollector#deviceData|deviceData} which is used to correlate user sessions with server transactions.
- */
- constructor();
/**
* @memberof DataCollector
@@ -534,12 +466,11 @@ declare namespace BraintreeWeb {
* @returns {void}
*/
teardown(callback?: callback): void;
-
}
}
/** @module braintree-web/hosted-fields */
-declare namespace BraintreeWeb {
+declare namespace braintree {
/**
* Fields used in {@link module:braintree-web/hosted-fields~fieldOptions fields options}
* @typedef {object} field
@@ -578,7 +509,6 @@ declare namespace BraintreeWeb {
}
/**
- * @typedef {object} HostedFields~hostedFieldsCard
* @description Information about the card type, sent in {@link HostedFields~stateObject|stateObjects}.
* @property {string} type The code-friendly representation of the card type. It will be one of the following strings:
* - `american-express`
@@ -618,7 +548,6 @@ declare namespace BraintreeWeb {
}
/**
- * @typedef {object} HostedFields~hostedFieldsFieldData
* @description Data about Hosted Fields fields, sent in {@link HostedFields~stateObject|stateObjects}.
* @property {HTMLElement} container Reference to the container DOM element on your page associated with the current event.
* @property {boolean} isFocused Whether or not the input is currently focused.
@@ -641,7 +570,6 @@ declare namespace BraintreeWeb {
}
/**
- * @typedef {object} HostedFields~stateObject
* @description The event payload sent from {@link HostedFields#on|on} or {@link HostedFields#getState|getState}.
* @property {HostedFields~hostedFieldsCard[]} cards
* This will return an array of potential {@link HostedFields~hostedFieldsCard|cards}. If the card type has been determined, the array will contain only one card.
@@ -679,7 +607,6 @@ declare namespace BraintreeWeb {
}
/**
- * @typedef {object} HostedFields~tokenizePayload
* @property {string} nonce The payment method nonce.
* @property {object} details Additional account details.
* @property {string} details.cardType Type of card, ex: Visa, MasterCard.
@@ -781,22 +708,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
- }
-
- /**
- * @class HostedFields
- * @param {object} options The Hosted Fields {@link module:braintree-web/hosted-fields.create create} options.
- * @description Do not use this constructor directly. Use {@link module:braintree-web/hosted-fields.create|braintree-web.hosted-fields.create} instead.
- * @classdesc This class represents a Hosted Fields component produced by {@link module:braintree-web/hosted-fields.create|braintree-web/hosted-fields.create}. Instances of this class have methods for interacting with the input fields within Hosted Fields' iframes.
- */
- export class HostedFields {
- /**
- * @class HostedFields
- * @param {object} options The Hosted Fields {@link module:braintree-web/hosted-fields.create create} options.
- * @description Do not use this constructor directly. Use {@link module:braintree-web/hosted-fields.create|braintree-web.hosted-fields.create} instead.
- * @classdesc This class represents a Hosted Fields component produced by {@link module:braintree-web/hosted-fields.create|braintree-web/hosted-fields.create}. Instances of this class have methods for interacting with the input fields within Hosted Fields' iframes.
- */
- constructor(options: any);
/**
* @name HostedFields#on
@@ -829,7 +740,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
- public teardown(callback?: callback): void;
+ teardown(callback?: callback): void;
/**
* Tokenizes fields and returns a nonce payload.
@@ -872,7 +783,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
- public tokenize(options?: { vault: boolean }, callback?: callback): void;
+ tokenize(options?: { vault: boolean }, callback?: callback): void;
/**
* Add a class to a {@link module:braintree-web/hosted-fields~field field}. Useful for updating field styles when events occur elsewhere in your checkout.
@@ -889,7 +800,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
- public addClass(field: string, classname: string, callback?: callback): void;
+ addClass(field: string, classname: string, callback?: callback): void;
/**
* Removes a class to a {@link module:braintree-web/hosted-fields~field field}. Useful for updating field styles when events occur elsewhere in your checkout.
@@ -910,7 +821,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
- public removeClass(field: string, classname: string, callback?: callback): void;
+ removeClass(field: string, classname: string, callback?: callback): void;
/**
* Sets the placeholder of a {@link module:braintree-web/hosted-fields~field field}.
@@ -940,7 +851,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
- public setPlaceholder(field: string, placeholder: string, callback?: callback): void;
+ setPlaceholder(field: string, placeholder: string, callback?: callback): void;
/**
* Clear the value of a {@link module:braintree-web/hosted-fields~field field}.
@@ -960,7 +871,7 @@ declare namespace BraintreeWeb {
* hostedFieldsInstance.clear('cvv');
* hostedFieldsInstance.clear('expirationDate');
*/
- public clear(field: string, callback?: callback): void;
+ clear(field: string, callback?: callback): void;
/**
* Returns an {@link HostedFields~stateObject|object} that includes the state of all fields and possible card types.
@@ -973,14 +884,13 @@ declare namespace BraintreeWeb {
* return state.fields[key].isValid;
* });
*/
- public getState(): any;
+ getState(): any;
}
}
/** @module braintree-web/paypal */
-declare namespace BraintreeWeb {
+declare namespace braintree {
/**
- * @typedef {object} PayPal~tokenizeReturn
* @property {Function} close A handle to close the PayPal checkout flow.
*/
interface PayPalTokenizeReturn {
@@ -988,7 +898,6 @@ declare namespace BraintreeWeb {
}
/**
- * @typedef {object} PayPal~tokenizePayload
* @property {string} nonce The payment method nonce.
* @property {string} type The payment method type, always `PayPalAccount`.
* @property {object} details Additional PayPal account details.
@@ -1082,20 +991,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
- }
-
- /**
- * @class
- * @param {object} options see {@link module:braintree-web/paypal.create|paypal.create}
- * @classdesc This class represents a PayPal component. Instances of this class have methods for launching auth dialogs and other programmatic interactions with the PayPal component.
- */
- export class PayPal {
- /**
- * @class
- * @param {object} options see {@link module:braintree-web/paypal.create|paypal.create}
- * @classdesc This class represents a PayPal component. Instances of this class have methods for launching auth dialogs and other programmatic interactions with the PayPal component.
- */
- constructor(options: any);
/**
* Launches the PayPal login flow and returns a nonce payload. Only one PayPal login flow should be active at a time. One way to achieve this is to disable your PayPal button while the flow is open.
@@ -1192,7 +1087,7 @@ declare namespace BraintreeWeb {
* });
* @returns {PayPal~tokenizeReturn} A handle to close the PayPal checkout frame.
*/
- public tokenize(options: { flow: string, intent: string, offerCredit: boolean, useraction: string, amount: (string | number), currency: string, displayName: string, locale: string, enableShippingAddress: boolean, shippingAddressOverride: PayPalShippingAddress, shippingAddressEditable: boolean, billingAgreementDescription: string }, callback: callback): PayPalTokenizeReturn;
+ tokenize(options: { flow: string, intent: string, offerCredit: boolean, useraction: string, amount: (string | number), currency: string, displayName: string, locale: string, enableShippingAddress: boolean, shippingAddressOverride: PayPalShippingAddress, shippingAddressEditable: boolean, billingAgreementDescription: string }, callback: callback): PayPalTokenizeReturn;
/**
* Cleanly tear down anything set up by {@link module:braintree-web/paypal.create|create}.
@@ -1200,15 +1095,13 @@ declare namespace BraintreeWeb {
* @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
* @returns {void}
*/
- public teardown(callback?: () => void): void;
-
+ teardown(callback?: () => void): void;
}
}
/** @module braintree-web/three-d-secure */
-declare namespace BraintreeWeb {
+declare namespace braintree {
/**
- * @typedef {object} ThreeDSecure~verifyPayload
* @property {string} nonce The new payment method nonce produced by the 3D Secure lookup. The original nonce passed into {@link ThreeDSecure#verifyCard|verifyCard} was consumed. This new nonce should be used to transact on your server.
* @property {object} details Additional account details.
* @property {string} details.cardType Type of card, ex: Visa, MasterCard.
@@ -1250,23 +1143,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
- }
-
- /**
- * @class
- * @param {object} options 3D Secure {@link module:braintree-web/three-d-secure.create create} options
- * @description Do not use this constructor directly. Use {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create} instead.
- * @classdesc This class represents a ThreeDSecure component produced by {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create}. Instances of this class have a method for launching a 3D Secure authentication flow.
- */
- export class ThreeDSecure {
- /**
- * @class
- * @param {object} options 3D Secure {@link module:braintree-web/three-d-secure.create create} options
- * @description Do not use this constructor directly. Use {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create} instead.
- * @classdesc This class represents a ThreeDSecure component produced by {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create}. Instances of this class have a method for launching a 3D Secure authentication flow.
- */
- constructor(options: any);
-
/**
* @callback ThreeDSecure~addFrameCallback
@@ -1329,7 +1205,7 @@ declare namespace BraintreeWeb {
* }
* });
*/
- public verifyCard(options: { nonce: string, amount: number, addFrame: (err?: BraintreeError, iframe?: HTMLIFrameElement) => void, removeFrame: () => void }, callback: callback): void;
+ verifyCard(options: { nonce: string, amount: number, addFrame: (err?: BraintreeError, iframe?: HTMLIFrameElement) => void, removeFrame: () => void }, callback: callback): void;
/**
* Cancel the 3DS flow and return the verification payload if available.
@@ -1349,7 +1225,7 @@ declare namespace BraintreeWeb {
* verifyPayload.liabilityShiftPossible; // boolean
* });
*/
- public cancelVerifyCard(callback: callback): void;
+ cancelVerifyCard(callback: callback): void;
/**
* Cleanly tear down anything set up by {@link module:braintree-web/three-d-secure.create|create}
@@ -1357,7 +1233,7 @@ declare namespace BraintreeWeb {
* @param {errback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
* @returns {void}
*/
- public teardown(callback?: callback): void;
+ teardown(callback?: callback): void;
}
}
@@ -1365,9 +1241,8 @@ declare namespace BraintreeWeb {
* @module braintree-web/unionpay
* @description This module allows you to accept UnionPay payments. *It is currently in beta and is subject to change.*
*/
-declare namespace BraintreeWeb {
+declare namespace braintree {
/**
- * @typedef {object} UnionPay~tokenizePayload
* @property {string} nonce The payment method nonce.
* @property {string} type Always CreditCard.
* @property {object} details Additional account details:
@@ -1388,7 +1263,6 @@ declare namespace BraintreeWeb {
}
/**
- * @typedef {object} UnionPay~enrollPayload
* @property {string} enrollmentId UnionPay enrollment ID. This value should be passed to `tokenize`.
* @property {boolean} smsCodeRequired UnionPay `smsCodeRequired` flag.
*
true - the user will receive an SMS code that needs to be supplied for tokenization.
@@ -1400,7 +1274,6 @@ declare namespace BraintreeWeb {
}
/**
- * @typedef {object} UnionPay~fetchCapabilitiesPayload
* @property {boolean} isUnionPay Determines if this card is a UnionPay card.
* @property {boolean} isDebit Determines if this card is a debit card. This property is only present if `isUnionPay` is `true`.
* @property {object} unionPay UnionPay specific properties. This property is only present if `isUnionPay` is `true`.
@@ -1443,22 +1316,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
- }
-
- /**
- * @class
- * @param {object} options See {@link module:braintree-web/unionpay.create|unionpay.create}.
- * @description You cannot use this constructor directly. Use {@link module:braintree-web/unionpay.create|braintree-web.unionpay.create} instead.
- * @classdesc This class represents a UnionPay component. Instances of this class have methods for {@link UnionPay#fetchCapabilities fetching capabilities} of UnionPay cards, {@link UnionPay#enroll enrolling} a UnionPay card, and {@link UnionPay#tokenize tokenizing} a UnionPay card.
- */
- export class UnionPay {
- /**
- * @class
- * @param {object} options See {@link module:braintree-web/unionpay.create|unionpay.create}.
- * @description You cannot use this constructor directly. Use {@link module:braintree-web/unionpay.create|braintree-web.unionpay.create} instead.
- * @classdesc This class represents a UnionPay component. Instances of this class have methods for {@link UnionPay#fetchCapabilities fetching capabilities} of UnionPay cards, {@link UnionPay#enroll enrolling} a UnionPay card, and {@link UnionPay#tokenize tokenizing} a UnionPay card.
- */
- constructor(options: any);
/**
* Fetches the capabilities of a card, including whether or not the SMS enrollment process is required.
@@ -1531,7 +1388,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
- public fetchCapabilities(options: { card: any, hostedFields: HostedFields }, callback: callback): void;
+ fetchCapabilities(options: { card: any, hostedFields: HostedFields }, callback: callback): void;
/**
* Enrolls a UnionPay card. Use {@link UnionPay#fetchCapabilities|fetchCapabilities} to determine if the SMS enrollment process is required.
@@ -1594,7 +1451,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
- public enroll(options: { card: any, hostedFields: HostedFields, mobile: any }, callback: callback): void;
+ enroll(options: { card: any, hostedFields: HostedFields, mobile: any }, callback: callback): void;
/**
* Tokenizes a UnionPay card and returns a nonce payload.
@@ -1643,7 +1500,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
- public tokenize(options: { card: any, hostedFields: HostedFields, enrollmentId: string, smsCode: string }, callback: callback): void;
+ tokenize(options: { card: any, hostedFields: HostedFields, enrollmentId: string, smsCode: string }, callback: callback): void;
/**
* Cleanly tear down anything set up by {@link module:braintree-web/unionpay.create|create}. This only needs to be called when using UnionPay with Hosted Fields.
@@ -1659,8 +1516,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
- public teardown(callback?: callback): void;
-
+ teardown(callback?: callback): void;
}
/**
@@ -1683,21 +1539,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
- }
-
- /**
- * @class
- * @param {object} options See {@link module:braintree-web/us-bank-account.create|us-bank-account.create}.
- * @classdesc This class represents a US Bank Account component. Instances of this class can tokenize raw bank details or present a bank login. You cannot use this constructor directly. Use {@link module:braintree-web/us-bank-account.create|braintree.us-bank-account.create} instead.
- */
- export class USBankAccount {
- /**
- * @class
- * @param {object} options See {@link module:braintree-web/us-bank-account.create|us-bank-account.create}.
- * @classdesc This class represents a US Bank Account component. Instances of this class can tokenize raw bank details or present a bank login. You cannot use this constructor directly. Use {@link module:braintree-web/us-bank-account.create|braintree.us-bank-account.create} instead.
- */
- constructor(options: any)
-
/**
* Tokenizes bank information to return a payment method nonce. You can tokenize bank details by providing information like account and routing numbers. You can also tokenize with a bank login UI that prompts the customer to log into their bank account.
@@ -1778,7 +1619,7 @@ declare namespace BraintreeWeb {
* });
* });
*/
- public tokenize(options: { mandateText: string, bankDetails: any, bankLogin: any }, callback: callback): void;
+ tokenize(options: { mandateText: string, bankDetails: any, bankLogin: any }, callback: callback): void;
/**
* Cleanly tear down anything set up by {@link module:braintree-web/us-bank-account.create|create}.
@@ -1786,77 +1627,53 @@ declare namespace BraintreeWeb {
* @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
* @returns {void}
*/
- public teardown(callback?: callback): void;
-
- }
-
-}
-
-declare namespace BraintreeError {
- /**
- * Enum for {@link BraintreeError} types.
- * @name BraintreeError.types
- * @enum
- * @readonly
- * @memberof BraintreeError
- * @property {string} CUSTOMER An error caused by the customer.
- * @property {string} MERCHANT An error that is actionable by the merchant.
- * @property {string} NETWORK An error due to a network problem.
- * @property {string} INTERNAL An error caused by Braintree code.
- * @property {string} UNKNOWN An error where the origin is unknown.
- */
- export enum Types {
- CUSTOMER,
- MERCHANT,
- NETWORK,
- INTERNAL,
- UNKNOWN
+ teardown(callback?: callback): void;
}
}
-/**
- * @class
- * @global
- * @param {object} options Construction options
- * @classdesc This class is used to report error conditions, frequently as the first parameter to callbacks throughout the Braintree SDK.
- * @description You cannot use this constructor directly. Interact with instances of this class through {@link callback callbacks}.
- */
-declare class BraintreeError {
- /**
- * @class
- * @global
- * @param {object} options Construction options
- * @classdesc This class is used to report error conditions, frequently as the first parameter to callbacks throughout the Braintree SDK.
- * @description You cannot use this constructor directly. Interact with instances of this class through {@link callback callbacks}.
- */
- constructor(options: any);
+declare namespace braintree {
+ export namespace BraintreeError {
+ /**
+ * Enum for {@link BraintreeError} types.
+ * @name BraintreeError.types
+ * @enum
+ * @readonly
+ * @memberof BraintreeError
+ * @property {string} CUSTOMER An error caused by the customer.
+ * @property {string} MERCHANT An error that is actionable by the merchant.
+ * @property {string} NETWORK An error due to a network problem.
+ * @property {string} INTERNAL An error caused by Braintree code.
+ * @property {string} UNKNOWN An error where the origin is unknown.
+ */
+ export type Types = "CUSTOMER" | "MERCHANT" | "NETWORK" | "INTERNAL" | "UNKNOWN";
+ }
- /**
- * @type {string}
- * @description A code that corresponds to specific errors.
- */
- code: string;
+ export interface BraintreeError {
+ /**
+ * @type {string}
+ * @description A code that corresponds to specific errors.
+ */
+ code: string;
- /**
- * @type {string}
- * @description A short description of the error.
- */
- message: string;
+ /**
+ * @type {string}
+ * @description A short description of the error.
+ */
+ message: string;
- /**
- * @type {BraintreeError.types}
- * @description The type of error.
- */
- type: BraintreeError.Types;
+ /**
+ * @type {BraintreeError.types}
+ * @description The type of error.
+ */
+ type: BraintreeError.Types;
- /**
- * @type {object=}
- * @description Additional information about the error, such as an underlying network error response.
- */
- details: any;
-}
+ /**
+ * @type {object=}
+ * @description Additional information about the error, such as an underlying network error response.
+ */
+ details: any;
+ }
-declare namespace BraintreeWeb {
/**
* @global
* @callback callback
@@ -1895,39 +1712,40 @@ declare namespace BraintreeWeb {
* braintreeClient.create(...);
* });
*/
-interface BraintreeStatic {
+declare namespace braintree {
/** @type {module:braintree-web/client} */
- client: BraintreeWeb.Client;
+ export var client: braintree.Client;
/** @type {module:braintree-web/paypal} */
- paypal: BraintreeWeb.PayPal;
+ export var paypal: braintree.PayPal;
/** @type {module:braintree-web/hosted-fields} */
- hostedFields: BraintreeWeb.HostedFields;
+ export var hostedFields: braintree.HostedFields;
/** @type {module:braintree-web/three-d-secure} */
- threeDSecure: BraintreeWeb.ThreeDSecure;
+ export var threeDSecure: braintree.ThreeDSecure;
/** @type {module:braintree-web/data-collector} */
- dataCollector: BraintreeWeb.DataCollector;
+ export var dataCollector: braintree.DataCollector;
/** @type {module:braintree-web/american-express} */
- americanExpress: BraintreeWeb.AmericanExpress;
+ export var americanExpress: braintree.AmericanExpress;
/** @type {module:braintree-web/unionpay} */
- unionpay: BraintreeWeb.UnionPay;
+ export var unionpay: braintree.UnionPay;
/** @type {module:braintree-web/apple-pay} */
- applePay: BraintreeWeb.ApplePay;
+ export var applePay: braintree.ApplePay;
- /** @type {module:braintree-web/us-bank-account} */
- usBankAccount: BraintreeWeb.USBankAccount;
+ /** @type {module:braintree-web/us-bank-account} */
+ export var usBankAccount: braintree.USBankAccount;
/**
* @description The current version of the SDK, i.e. `3.0.2`.
* @type {string}
*/
- VERSION: string;
+ export var VERSION: string;
}
-declare var braintree: BraintreeStatic;
+export = braintree;
+export as namespace braintree;
diff --git a/types/braintree-web/test/node.ts b/types/braintree-web/test/node.ts
new file mode 100644
index 0000000000..9eed5b228d
--- /dev/null
+++ b/types/braintree-web/test/node.ts
@@ -0,0 +1,440 @@
+import * as braintree from 'braintree-web';
+
+let version: string = braintree.VERSION;
+
+let clientToken: string = "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiI0YjlhYzVmYmI4ZTNkYzQzMmFkZjJhNzBlNjZlMWNjY2M5ODRkYzE4ZTM4YmY4NjYzZTM5NjM3NWZjYmQzY2U5fGNyZWF0ZWRfYXQ9MjAxNi0wOS0wOFQwNTowMzo0MC4xNjk1NTUwMzUrMDAwMFx1MDAyNm1lcmNoYW50X2lkPTM0OHBrOWNnZjNiZ3l3MmJcdTAwMjZwdWJsaWNfa2V5PTJuMjQ3ZHY4OWJxOXZtcHIiLCJjb25maWdVcmwiOiJodHRwczovL2FwaS5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tOjQ0My9tZXJjaGFudHMvMzQ4cGs5Y2dmM2JneXcyYi9jbGllbnRfYXBpL3YxL2NvbmZpZ3VyYXRpb24iLCJjaGFsbGVuZ2VzIjpbXSwiZW52aXJvbm1lbnQiOiJzYW5kYm94IiwiY2xpZW50QXBpVXJsIjoiaHR0cHM6Ly9hcGkuc2FuZGJveC5icmFpbnRyZWVnYXRld2F5LmNvbTo0NDMvbWVyY2hhbnRzLzM0OHBrOWNnZjNiZ3l3MmIvY2xpZW50X2FwaSIsImFzc2V0c1VybCI6Imh0dHBzOi8vYXNzZXRzLmJyYWludHJlZWdhdGV3YXkuY29tIiwiYXV0aFVybCI6Imh0dHBzOi8vYXV0aC52ZW5tby5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tIiwiYW5hbHl0aWNzIjp7InVybCI6Imh0dHBzOi8vY2xpZW50LWFuYWx5dGljcy5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tLzM0OHBrOWNnZjNiZ3l3MmIifSwidGhyZWVEU2VjdXJlRW5hYmxlZCI6dHJ1ZSwicGF5cGFsRW5hYmxlZCI6dHJ1ZSwicGF5cGFsIjp7ImRpc3BsYXlOYW1lIjoiQWNtZSBXaWRnZXRzLCBMdGQuIChTYW5kYm94KSIsImNsaWVudElkIjpudWxsLCJwcml2YWN5VXJsIjoiaHR0cDovL2V4YW1wbGUuY29tL3BwIiwidXNlckFncmVlbWVudFVybCI6Imh0dHA6Ly9leGFtcGxlLmNvbS90b3MiLCJiYXNlVXJsIjoiaHR0cHM6Ly9hc3NldHMuYnJhaW50cmVlZ2F0ZXdheS5jb20iLCJhc3NldHNVcmwiOiJodHRwczovL2NoZWNrb3V0LnBheXBhbC5jb20iLCJkaXJlY3RCYXNlVXJsIjpudWxsLCJhbGxvd0h0dHAiOnRydWUsImVudmlyb25tZW50Tm9OZXR3b3JrIjp0cnVlLCJlbnZpcm9ubWVudCI6Im9mZmxpbmUiLCJ1bnZldHRlZE1lcmNoYW50IjpmYWxzZSwiYnJhaW50cmVlQ2xpZW50SWQiOiJtYXN0ZXJjbGllbnQzIiwiYmlsbGluZ0FncmVlbWVudHNFbmFibGVkIjp0cnVlLCJtZXJjaGFudEFjY291bnRJZCI6ImFjbWV3aWRnZXRzbHRkc2FuZGJveCIsImN1cnJlbmN5SXNvQ29kZSI6IlVTRCJ9LCJjb2luYmFzZUVuYWJsZWQiOmZhbHNlLCJtZXJjaGFudElkIjoiMzQ4cGs5Y2dmM2JneXcyYiIsInZlbm1vIjoib2ZmIn0=";
+
+braintree.client.create({
+ authorization: clientToken
+}, function (error: braintree.BraintreeError, clientInstance: any) {
+
+ var form: HTMLFormElement = document.getElementById('my-form-id') as HTMLFormElement;
+ var data: { creditCard: braintree.CreditCardInfo } = {
+ creditCard: {
+ number: form['cc-number'].value,
+ cvv: form['cc-cvv'].value,
+ expirationDate: form['cc-date'].value,
+ billingAddress: {
+ postalCode: form['cc-postal'].value
+ }
+ }
+ };
+
+ clientInstance.request({
+ endpoint: 'payment_methods/credit_cards',
+ method: 'post',
+ data: data
+ }, function (requestErr: braintree.BraintreeError, response: { creditCards: any[]; }) {
+ if (requestErr) { throw new Error(requestErr.message); }
+
+ console.log('Got nonce:', response.creditCards[0].nonce);
+ });
+
+ braintree.hostedFields.create({
+ client: clientInstance,
+ styles: {
+ 'input': {
+ 'font-size': '16pt',
+ 'color': '#3A3A3A'
+ },
+
+ '.number': {
+ 'font-family': 'monospace'
+ },
+ '.valid': {
+ 'color': 'green'
+ }
+ },
+ fields: {
+ number: {
+ selector: '#card-number'
+ },
+ cvv: {
+ selector: '#cvv',
+ type: 'password'
+ },
+ expirationMonth: {
+ selector: '#expiration-month',
+ select: {
+ options: ["01 - Jan", "02 - Feb", "03 - Mar", "04 - Apr", "05 - May", "06 - Jun", "07 - Jul", "08 - Aug", "09 - Sep", "10 - Oct", "11 - Nov", "12 - Dec"]
+ }
+ },
+ expirationYear: {
+ selector: '#expiration-year',
+ select: true
+ }
+ }
+ }, function (hostedFieldsErr?: braintree.BraintreeError, hostedFieldsInstance?: any) {
+
+ if (hostedFieldsErr) {
+ // Handle error in Hosted Fields creation
+ console.log(`Error Code: ${error.code}, Type: ${error.type}, Message: ${error.message}, Details: ${error.details}`);
+ return;
+ }
+
+ let form = new HTMLFormElement();
+
+ form.addEventListener('submit', function (event: Event) {
+ event.preventDefault();
+
+ hostedFieldsInstance.tokenize(function (tokenizeErr: braintree.BraintreeError, payload: braintree.HostedFieldsTokenizePayload) {
+ if (tokenizeErr) {
+ // Handle error in Hosted Fields tokenization
+ switch (tokenizeErr.code) {
+ case 'HOSTED_FIELDS_FIELDS_EMPTY':
+ console.error('All fields are empty! Please fill out the form.');
+ break;
+ case 'HOSTED_FIELDS_FIELDS_INVALID':
+ console.error('Some fields are invalid:', tokenizeErr.details.invalidFieldKeys);
+ break;
+ case 'HOSTED_FIELDS_FAILED_TOKENIZATION':
+ console.error('Tokenization failed server side. Is the card valid?');
+ break;
+ case 'HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR':
+ console.error('Network error occurred when tokenizing.');
+ break;
+ default:
+ console.error('Something bad happened!', tokenizeErr);
+ }
+ return;
+ }
+
+ // Put `payload.nonce` into the `payment-method-nonce` input, and then
+ // submit the form. Alternatively, you could send the nonce to your server
+ // with AJAX.
+ (document.querySelector('input[name="payment-method-nonce"]') as HTMLInputElement).value = payload.nonce;
+ form.submit();
+ });
+ }, false);
+
+ hostedFieldsInstance.on('focus', function (event: braintree.HostedFieldsStateObject) {
+ console.log(event.emittedBy, 'has been focused');
+ });
+
+ hostedFieldsInstance.teardown(function (teardownErr: braintree.BraintreeError) {
+ if (teardownErr) {
+ console.error('Could not tear down Hosted Fields!');
+ } else {
+ console.info('Hosted Fields has been torn down!');
+ }
+ });
+
+ hostedFieldsInstance.tokenize({
+ vault: true
+ }, function (tokenizeErr: braintree.BraintreeError, payload: braintree.HostedFieldsTokenizePayload) {
+ if (tokenizeErr) {
+ console.error(tokenizeErr);
+ } else {
+ console.log('Got nonce:', payload.nonce);
+ }
+ });
+
+ hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: braintree.BraintreeError) {
+ if (addClassErr) {
+ console.error(addClassErr);
+ }
+ });
+
+ hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: braintree.BraintreeError) {
+ if (addClassErr) {
+ console.error(addClassErr);
+ return;
+ }
+
+ // some time later...
+ hostedFieldsInstance.removeClass('number', 'custom-class');
+ });
+
+ hostedFieldsInstance.setPlaceholder('number', '4111 1111 1111 1111', function (placeholderErr: braintree.BraintreeError) {
+ if (placeholderErr) {
+ console.error(placeholderErr);
+ }
+ });
+
+ hostedFieldsInstance.on('cardTypeChange', function (event: braintree.HostedFieldsStateObject) {
+ // Update the placeholder value if there is only one possible card type
+ if (event.cards.length === 1) {
+ braintree.hostedFields.setPlaceholder('cvv', event.cards[0].code.name, function (placeholderErr: braintree.BraintreeError) {
+ if (placeholderErr) {
+ // Handle errors, such as invalid field name
+ console.error(placeholderErr);
+ }
+ });
+ }
+ });
+
+ hostedFieldsInstance.clear('number', function (clearErr: braintree.BraintreeError) {
+ if (clearErr) {
+ console.error(clearErr);
+ }
+ });
+
+ hostedFieldsInstance.clear('number');
+ hostedFieldsInstance.clear('cvv');
+ hostedFieldsInstance.clear('expirationDate');
+
+ var state = braintree.hostedFields.getState();
+
+ var formValid = Object.keys(state.fields).every(function (key) {
+ return state.fields[key].isValid;
+ });
+ });
+
+ braintree.applePay.create({ client: clientInstance }, function (createErr?: braintree.BraintreeError, applePayInstance?: any) {
+ if (createErr) {
+ // Handle error in client creation
+ console.log(`Error Code: ${error.code}, Type: ${error.type}, Message: ${error.message}, Details: ${error.details}`);
+
+ return;
+ }
+
+ let request = {
+ countryCode: 'US',
+ currencyCode: 'USD',
+ supportedNetworks: ['visa', 'masterCard'],
+ merchantCapabilities: ['supports3DS'],
+ total: { label: 'Your Label', amount: '10.00' },
+ };
+
+ var paymentRequest = braintree.applePay.createPaymentRequest(request);
+
+ console.log(paymentRequest);
+ // { total: { }, countryCode: 'US', currencyCode: 'USD', merchantCapabilities: [ ], supportedNetworks: [ ] }
+ });
+
+ braintree.applePay.create({ client: clientInstance }, function (createErr, applePayInstance) {
+ let request = {
+ countryCode: 'US',
+ currencyCode: 'USD',
+ supportedNetworks: ['visa', 'masterCard'],
+ merchantCapabilities: ['supports3DS'],
+ total: { label: 'Your Label', amount: '10.00' },
+ };
+
+ var session = new braintree.ApplePaySession(1, request);
+
+ session.onvalidatemerchant = function (event: { validationURL: string }) {
+ braintree.applePay.performValidation({
+ validationURL: event.validationURL
+ }, function (err, validationData) {
+ if (err) {
+ console.error(err);
+ session.abort();
+ return;
+ }
+ session.completeMerchantValidation(validationData);
+ });
+ };
+ });
+
+ braintree.applePay.create({ client: clientInstance }, function (createErr, applePayInstance) {
+ let request = {
+ countryCode: 'US',
+ currencyCode: 'USD',
+ supportedNetworks: ['visa', 'masterCard'],
+ merchantCapabilities: ['supports3DS'],
+ total: { label: 'Your Label', amount: '10.00' },
+ };
+
+ var session = new braintree.ApplePaySession(1, request);
+
+ session.onpaymentauthorized = function (event) {
+ braintree.applePay.tokenize({
+ token: event.payment.token
+ }, function (err, tokenizedPayload) {
+ if (err) {
+ session.completePayment(braintree.ApplePayStatusCodes.STATUS_FAILURE);
+ return;
+ }
+ session.completePayment(braintree.ApplePayStatusCodes.STATUS_SUCCESS);
+
+ // Send the tokenizedPayload to your server.
+ });
+ };
+ });
+
+ braintree.paypal.create({
+ client: clientInstance
+ }, function (createErr, paypalInstance) {
+ if (createErr) {
+ if (createErr.code === 'PAYPAL_BROWSER_NOT_SUPPORTED') {
+ console.error('This browser is not supported.');
+ } else {
+ console.error('Error!', createErr);
+ }
+ }
+
+ let button = new HTMLButtonElement();
+
+ button.addEventListener('click', function () {
+ // Disable the button so that we don't attempt to open multiple popups.
+ button.setAttribute('disabled', 'disabled');
+
+ // Because PayPal tokenization opens a popup, this must be called
+ // as a result of a user action, such as a button click.
+ paypalInstance.tokenize({
+ flow: 'vault' // Required
+ // Any other tokenization options
+ }, function (tokenizeErr: braintree.BraintreeError, payload: braintree.PayPalTokenizePayload) {
+ button.removeAttribute('disabled');
+
+ if (tokenizeErr) {
+ // Handle tokenization errors or premature flow closure
+
+ switch (tokenizeErr.code) {
+ case 'PAYPAL_POPUP_CLOSED':
+ console.error('Customer closed PayPal popup.');
+ break;
+ case 'PAYPAL_ACCOUNT_TOKENIZATION_FAILED':
+ console.error('PayPal tokenization failed. See details:', tokenizeErr.details);
+ break;
+ case 'PAYPAL_FLOW_FAILED':
+ console.error('Unable to initialize PayPal flow. Are your options correct?', tokenizeErr.details);
+ break;
+ default:
+ console.error('Error!', tokenizeErr);
+ }
+ } else {
+ // Submit payload.nonce to your server
+ }
+ });
+ });
+ });
+
+ braintree.unionpay.create({ client: clientInstance }, function (createErr, unionpayInstance) {
+ if (createErr) {
+ console.error(createErr);
+ return;
+ }
+
+ unionpayInstance.fetchCapabilities({
+ card: {
+ number: '4111111111111111'
+ }
+ }, function (fetchErr: braintree.BraintreeError, cardCapabilities: braintree.UnionPayFetchCapabilitiesPayload) {
+ if (fetchErr) {
+ console.error(fetchErr);
+ return;
+ }
+
+ if (cardCapabilities.isUnionPay) {
+ if (cardCapabilities.unionPay && !cardCapabilities.unionPay.isSupported) {
+ // Braintree cannot process this UnionPay card.
+ // Ask the user for a different card.
+ return;
+ }
+
+ if (cardCapabilities.isDebit) {
+ // CVV and expiration date are not required
+ } else {
+ // CVV and expiration date are required
+ }
+
+ // Show mobile phone number field for enrollment
+ }
+ });
+
+ unionpayInstance.enroll({
+ card: {
+ number: '4111111111111111',
+ expirationMonth: '12',
+ expirationYear: '2038'
+ },
+ mobile: {
+ countryCode: '62',
+ number: '111111111111'
+ }
+ }, function (enrollErr: braintree.BraintreeError, response: braintree.UnionPayEnrollPayload) {
+ if (enrollErr) {
+ console.error(enrollErr);
+ return;
+ }
+
+ if (response.smsCodeRequired) {
+ // If smsCodeRequired, wait for SMS auth code from customer
+ // Then use response.enrollmentId during {@link UnionPay#tokenize}
+ } else {
+ // SMS code is not required from the user.
+ // {@link UnionPay#tokenize} can be called immediately
+ }
+ });
+
+ let enrollResponse: {
+ enrollmentId: string
+ };
+
+ unionpayInstance.tokenize({
+ card: {
+ number: '4111111111111111',
+ expirationMonth: '12',
+ expirationYear: '2038',
+ cvv: '123'
+ },
+ enrollmentId: enrollResponse.enrollmentId, // Returned from enroll
+ smsCode: '11111' // Received by customer's phone, if SMS enrollment was required. Otherwise it should be omitted
+ }, function (tokenizeErr: braintree.BraintreeError, response: braintree.UnionPayTokenizePayload) {
+ if (tokenizeErr) {
+ console.error(tokenizeErr);
+ return;
+ }
+
+ // Send response.nonce to your server
+ });
+
+ unionpayInstance.teardown(function (teardownErr: braintree.BraintreeError) {
+ if (teardownErr) {
+ console.error('Could not tear down UnionPay.');
+ } else {
+ console.log('UnionPay has been torn down.');
+ }
+ });
+ });
+});
+
+let existingNonce = "fake-valid-nonce";
+let submitNonceToServer: (nonce: string) => void;
+
+braintree.threeDSecure.verifyCard({
+ nonce: existingNonce,
+ amount: 123.45,
+ addFrame: function (err, iframe) {
+ // Set up your UI and add the iframe.
+ let my3DSContainer = document.createElement('div');
+ my3DSContainer.appendChild(iframe);
+ document.body.appendChild(my3DSContainer);
+ },
+ removeFrame: function () {
+ let my3DSContainer = document.createElement('div');
+
+ // Remove UI that you added in addFrame.
+ document.body.removeChild(my3DSContainer);
+ }
+}, function (err: braintree.BraintreeError, payload: braintree.ThreeDSecureVerifyPayload) {
+ if (err) {
+ console.error(err);
+ return;
+ }
+
+ if (payload.liabilityShifted) {
+ // Liablity has shifted
+ submitNonceToServer(payload.nonce);
+ } else if (payload.liabilityShiftPossible) {
+ // Liablity may still be shifted
+ // Decide if you want to submit the nonce
+ } else {
+ // Liablity has not shifted and will not shift
+ // Decide if you want to submit the nonce
+ }
+});
+
+braintree.threeDSecure.cancelVerifyCard(function (err: braintree.BraintreeError, verifyPayload: braintree.ThreeDSecureVerifyPayload) {
+ if (err) {
+ // Handle error
+ console.log(err.message); // No verification payload available
+ return;
+ }
+
+ verifyPayload.nonce; // The nonce returned from the 3ds lookup call
+ verifyPayload.liabilityShifted; // boolean
+ verifyPayload.liabilityShiftPossible; // boolean
+});
diff --git a/types/braintree-web/braintree-web-tests.ts b/types/braintree-web/test/web.ts
similarity index 86%
rename from types/braintree-web/braintree-web-tests.ts
rename to types/braintree-web/test/web.ts
index c9aee724c0..22073363d4 100644
--- a/types/braintree-web/braintree-web-tests.ts
+++ b/types/braintree-web/test/web.ts
@@ -4,10 +4,10 @@ let clientToken: string = "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiO
braintree.client.create({
authorization: clientToken
-}, function (error: BraintreeError, clientInstance: any) {
+}, function (error: braintree.BraintreeError, clientInstance: any) {
var form: HTMLFormElement = document.getElementById('my-form-id') as HTMLFormElement;
- var data: { creditCard: BraintreeWeb.CreditCardInfo } = {
+ var data: { creditCard: braintree.CreditCardInfo } = {
creditCard: {
number: form['cc-number'].value,
cvv: form['cc-cvv'].value,
@@ -22,7 +22,7 @@ braintree.client.create({
endpoint: 'payment_methods/credit_cards',
method: 'post',
data: data
- }, function (requestErr: BraintreeError, response: { creditCards: any[]; }) {
+ }, function (requestErr: braintree.BraintreeError, response: { creditCards: any[]; }) {
if (requestErr) { throw new Error(requestErr.message); }
console.log('Got nonce:', response.creditCards[0].nonce);
@@ -62,7 +62,7 @@ braintree.client.create({
select: true
}
}
- }, function (hostedFieldsErr?: BraintreeError, hostedFieldsInstance?: any) {
+ }, function (hostedFieldsErr?: braintree.BraintreeError, hostedFieldsInstance?: any) {
if (hostedFieldsErr) {
// Handle error in Hosted Fields creation
@@ -75,7 +75,7 @@ braintree.client.create({
form.addEventListener('submit', function (event: Event) {
event.preventDefault();
- hostedFieldsInstance.tokenize(function (tokenizeErr: BraintreeError, payload: BraintreeWeb.HostedFieldsTokenizePayload) {
+ hostedFieldsInstance.tokenize(function (tokenizeErr: braintree.BraintreeError, payload: braintree.HostedFieldsTokenizePayload) {
if (tokenizeErr) {
// Handle error in Hosted Fields tokenization
switch (tokenizeErr.code) {
@@ -105,11 +105,11 @@ braintree.client.create({
});
}, false);
- hostedFieldsInstance.on('focus', function (event: BraintreeWeb.HostedFieldsStateObject) {
+ hostedFieldsInstance.on('focus', function (event: braintree.HostedFieldsStateObject) {
console.log(event.emittedBy, 'has been focused');
});
- hostedFieldsInstance.teardown(function (teardownErr: BraintreeError) {
+ hostedFieldsInstance.teardown(function (teardownErr: braintree.BraintreeError) {
if (teardownErr) {
console.error('Could not tear down Hosted Fields!');
} else {
@@ -119,7 +119,7 @@ braintree.client.create({
hostedFieldsInstance.tokenize({
vault: true
- }, function (tokenizeErr: BraintreeError, payload: BraintreeWeb.HostedFieldsTokenizePayload) {
+ }, function (tokenizeErr: braintree.BraintreeError, payload: braintree.HostedFieldsTokenizePayload) {
if (tokenizeErr) {
console.error(tokenizeErr);
} else {
@@ -127,13 +127,13 @@ braintree.client.create({
}
});
- hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: BraintreeError) {
+ hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: braintree.BraintreeError) {
if (addClassErr) {
console.error(addClassErr);
}
});
- hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: BraintreeError) {
+ hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: braintree.BraintreeError) {
if (addClassErr) {
console.error(addClassErr);
return;
@@ -143,16 +143,16 @@ braintree.client.create({
hostedFieldsInstance.removeClass('number', 'custom-class');
});
- hostedFieldsInstance.setPlaceholder('number', '4111 1111 1111 1111', function (placeholderErr: BraintreeError) {
+ hostedFieldsInstance.setPlaceholder('number', '4111 1111 1111 1111', function (placeholderErr: braintree.BraintreeError) {
if (placeholderErr) {
console.error(placeholderErr);
}
});
- hostedFieldsInstance.on('cardTypeChange', function (event: BraintreeWeb.HostedFieldsStateObject) {
+ hostedFieldsInstance.on('cardTypeChange', function (event: braintree.HostedFieldsStateObject) {
// Update the placeholder value if there is only one possible card type
if (event.cards.length === 1) {
- braintree.hostedFields.setPlaceholder('cvv', event.cards[0].code.name, function (placeholderErr: BraintreeError) {
+ braintree.hostedFields.setPlaceholder('cvv', event.cards[0].code.name, function (placeholderErr: braintree.BraintreeError) {
if (placeholderErr) {
// Handle errors, such as invalid field name
console.error(placeholderErr);
@@ -161,7 +161,7 @@ braintree.client.create({
}
});
- hostedFieldsInstance.clear('number', function (clearErr: BraintreeError) {
+ hostedFieldsInstance.clear('number', function (clearErr: braintree.BraintreeError) {
if (clearErr) {
console.error(clearErr);
}
@@ -178,7 +178,7 @@ braintree.client.create({
});
});
- braintree.applePay.create({ client: clientInstance }, function (createErr?: BraintreeError, applePayInstance?: any) {
+ braintree.applePay.create({ client: clientInstance }, function (createErr?: braintree.BraintreeError, applePayInstance?: any) {
if (createErr) {
// Handle error in client creation
console.log(`Error Code: ${error.code}, Type: ${error.type}, Message: ${error.message}, Details: ${error.details}`);
@@ -209,7 +209,7 @@ braintree.client.create({
total: { label: 'Your Label', amount: '10.00' },
};
- var session = new ApplePaySession(1, request);
+ var session = new braintree.ApplePaySession(1, request);
session.onvalidatemerchant = function (event: { validationURL: string }) {
braintree.applePay.performValidation({
@@ -234,17 +234,17 @@ braintree.client.create({
total: { label: 'Your Label', amount: '10.00' },
};
- var session = new ApplePaySession(1, request);
+ var session = new braintree.ApplePaySession(1, request);
session.onpaymentauthorized = function (event) {
braintree.applePay.tokenize({
token: event.payment.token
}, function (err, tokenizedPayload) {
if (err) {
- session.completePayment(ApplePayStatusCodes.STATUS_FAILURE);
+ session.completePayment(braintree.ApplePayStatusCodes.STATUS_FAILURE);
return;
}
- session.completePayment(ApplePayStatusCodes.STATUS_SUCCESS);
+ session.completePayment(braintree.ApplePayStatusCodes.STATUS_SUCCESS);
// Send the tokenizedPayload to your server.
});
@@ -273,7 +273,7 @@ braintree.client.create({
paypalInstance.tokenize({
flow: 'vault' // Required
// Any other tokenization options
- }, function (tokenizeErr: BraintreeError, payload: BraintreeWeb.PayPalTokenizePayload) {
+ }, function (tokenizeErr: braintree.BraintreeError, payload: braintree.PayPalTokenizePayload) {
button.removeAttribute('disabled');
if (tokenizeErr) {
@@ -309,7 +309,7 @@ braintree.client.create({
card: {
number: '4111111111111111'
}
- }, function (fetchErr: BraintreeError, cardCapabilities: BraintreeWeb.UnionPayFetchCapabilitiesPayload) {
+ }, function (fetchErr: braintree.BraintreeError, cardCapabilities: braintree.UnionPayFetchCapabilitiesPayload) {
if (fetchErr) {
console.error(fetchErr);
return;
@@ -342,7 +342,7 @@ braintree.client.create({
countryCode: '62',
number: '111111111111'
}
- }, function (enrollErr: BraintreeError, response: BraintreeWeb.UnionPayEnrollPayload) {
+ }, function (enrollErr: braintree.BraintreeError, response: braintree.UnionPayEnrollPayload) {
if (enrollErr) {
console.error(enrollErr);
return;
@@ -370,7 +370,7 @@ braintree.client.create({
},
enrollmentId: enrollResponse.enrollmentId, // Returned from enroll
smsCode: '11111' // Received by customer's phone, if SMS enrollment was required. Otherwise it should be omitted
- }, function (tokenizeErr: BraintreeError, response: BraintreeWeb.UnionPayTokenizePayload) {
+ }, function (tokenizeErr: braintree.BraintreeError, response: braintree.UnionPayTokenizePayload) {
if (tokenizeErr) {
console.error(tokenizeErr);
return;
@@ -379,7 +379,7 @@ braintree.client.create({
// Send response.nonce to your server
});
- unionpayInstance.teardown(function (teardownErr: BraintreeError) {
+ unionpayInstance.teardown(function (teardownErr: braintree.BraintreeError) {
if (teardownErr) {
console.error('Could not tear down UnionPay.');
} else {
@@ -407,7 +407,7 @@ braintree.threeDSecure.verifyCard({
// Remove UI that you added in addFrame.
document.body.removeChild(my3DSContainer);
}
-}, function (err: BraintreeError, payload: BraintreeWeb.ThreeDSecureVerifyPayload) {
+}, function (err: braintree.BraintreeError, payload: braintree.ThreeDSecureVerifyPayload) {
if (err) {
console.error(err);
return;
@@ -425,7 +425,7 @@ braintree.threeDSecure.verifyCard({
}
});
-braintree.threeDSecure.cancelVerifyCard(function (err: BraintreeError, verifyPayload: BraintreeWeb.ThreeDSecureVerifyPayload) {
+braintree.threeDSecure.cancelVerifyCard(function (err: braintree.BraintreeError, verifyPayload: braintree.ThreeDSecureVerifyPayload) {
if (err) {
// Handle error
console.log(err.message); // No verification payload available
@@ -435,4 +435,4 @@ braintree.threeDSecure.cancelVerifyCard(function (err: BraintreeError, verifyPay
verifyPayload.nonce; // The nonce returned from the 3ds lookup call
verifyPayload.liabilityShifted; // boolean
verifyPayload.liabilityShiftPossible; // boolean
-});
\ No newline at end of file
+});
diff --git a/types/braintree-web/tsconfig.json b/types/braintree-web/tsconfig.json
index abc64cd9c3..d326f77f12 100644
--- a/types/braintree-web/tsconfig.json
+++ b/types/braintree-web/tsconfig.json
@@ -18,6 +18,7 @@
},
"files": [
"index.d.ts",
- "braintree-web-tests.ts"
+ "test/web.ts",
+ "test/node.ts"
]
-}
\ No newline at end of file
+}
diff --git a/types/camelcase-keys/camelcase-keys-tests.ts b/types/camelcase-keys/camelcase-keys-tests.ts
index ed2865e9ce..099b8c4a14 100644
--- a/types/camelcase-keys/camelcase-keys-tests.ts
+++ b/types/camelcase-keys/camelcase-keys-tests.ts
@@ -3,8 +3,8 @@ import camelcaseKeys = require('camelcase-keys');
camelcaseKeys({'foo-bar': true});
// => {fooBar: true}
-camelcaseKeys({'foo-bar': true, 'nested': {unicorn_rainbow: true}}, {deep: true});
+camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true});
// => {fooBar: true, nested: {unicornRainbow: true}}
-camelcaseKeys({'_': [], 'foo-bar': true});
-// => {_: [], fooBar: true}
\ No newline at end of file
+camelcaseKeys({_: [], 'foo-bar': true});
+// => {_: [], fooBar: true}
diff --git a/types/charm/charm-tests.ts b/types/charm/charm-tests.ts
index d87a360084..09dc93184e 100644
--- a/types/charm/charm-tests.ts
+++ b/types/charm/charm-tests.ts
@@ -8,7 +8,8 @@ const text = 'Always after me lucky charms.';
let offset = 0;
const iv = setInterval(() => {
- let y = 0, dy = 1;
+ let y = 0;
+ let dy = 1;
for (let i = 0; i < 40; i++) {
const color = colors[(i + offset) % colors.length];
const c = text[(i + offset) % text.length];
diff --git a/types/chunked-dc/index.d.ts b/types/chunked-dc/index.d.ts
index ab3acd6901..d200c07899 100644
--- a/types/chunked-dc/index.d.ts
+++ b/types/chunked-dc/index.d.ts
@@ -5,14 +5,13 @@
// Interfaces
declare namespace chunkedDc {
-
- /** common.ts **/
+ /** common.ts */
interface CommonStatic {
HEADER_LENGTH: number;
}
- /** chunker.ts **/
+ /** chunker.ts */
interface Chunker extends IterableIterator {
hasNext: boolean;
@@ -24,7 +23,7 @@ declare namespace chunkedDc {
new(id: number, message: Uint8Array, chunkSize: number): Chunker;
}
- /** unchunker.ts **/
+ /** unchunker.ts */
type MessageListener = (message: Uint8Array, context?: any) => void;
@@ -38,13 +37,12 @@ declare namespace chunkedDc {
new(): Unchunker;
}
- /** main.ts **/
+ /** main.ts */
interface Standalone {
Chunker: ChunkerStatic;
Unchunker: UnchunkerStatic;
}
-
}
// Entry point for the packed ES5 version:
diff --git a/types/clipboard/index.d.ts b/types/clipboard/index.d.ts
index 5f12a41d5f..861d8c326b 100644
--- a/types/clipboard/index.d.ts
+++ b/types/clipboard/index.d.ts
@@ -27,21 +27,21 @@ declare namespace Clipboard {
* @param {Element} elem Current element
* @returns {String} Only 'cut' or 'copy'.
*/
- action?: (elem: Element) => string;
+ action?(elem: Element): string;
/**
* Overwrites default target input element.
* @param {Element} elem Current element
* @returns {Element} element to use.
*/
- target?: (elem: Element) => Element;
+ target?(elem: Element): Element;
/**
* Returns the explicit text to copy.
* @param {Element} elem Current element
* @returns {String} Text to be copied.
*/
- text?: (elem: Element) => string;
+ text?(elem: Element): string;
}
interface Event {
diff --git a/types/clndr/clndr-tests.ts b/types/clndr/clndr-tests.ts
index 018d9a6000..07bff7f9e4 100644
--- a/types/clndr/clndr-tests.ts
+++ b/types/clndr/clndr-tests.ts
@@ -89,4 +89,4 @@ myCalendar
.setEvents([])
.addEvents([])
.removeEvents(event => event.id === 'idToRemove')
- .destroy();
\ No newline at end of file
+ .destroy();
diff --git a/types/code/code-tests.ts b/types/code/code-tests.ts
index c3455577d9..1c2fa78fe5 100644
--- a/types/code/code-tests.ts
+++ b/types/code/code-tests.ts
@@ -16,7 +16,7 @@ expect([1, 2, 3]).to.part.include([1, 4]);
expect(10, "Age").to.be.above(5);
-const func = function() { return arguments; };
+const func = function() { return arguments; }; // tslint:disable-line only-arrow-functions
expect(func()).to.be.arguments();
expect([1, 2]).to.be.an.array();
diff --git a/types/code/index.d.ts b/types/code/index.d.ts
index dacd122915..a17f844d3a 100644
--- a/types/code/index.d.ts
+++ b/types/code/index.d.ts
@@ -174,7 +174,7 @@ interface Settings {
/**
* Truncate long assertion error messages for readability?
* Defaults to true.
- */
+ */
truncateMessages?: boolean;
/**
* Ignore object prototypes when doing a deep comparison?
diff --git a/types/codependency/codependency-tests.ts b/types/codependency/codependency-tests.ts
index e0f8a793a6..2d39f4be52 100644
--- a/types/codependency/codependency-tests.ts
+++ b/types/codependency/codependency-tests.ts
@@ -1,8 +1,9 @@
-let requirePeer = codependency.register(module), package: any;
- requirePeer = codependency.register(module, {index: ["dependencies", "devDependencies"]});
- requirePeer = codependency.get("some-middleware");
- package = requirePeer("some-peer-dependency-package");
- package = requirePeer("some-peer-dependency-package", {optional: true});
- package = requirePeer("some-peer-dependency-package", {dontThrow: true});
- package = requirePeer("some-peer-dependency-package", {optional: true, dontThrow: true});
- package = requirePeer.resolve("peer-package-name");
\ No newline at end of file
+let requirePeer = codependency.register(module);
+let package: any;
+requirePeer = codependency.register(module, {index: ["dependencies", "devDependencies"]});
+requirePeer = codependency.get("some-middleware");
+package = requirePeer("some-peer-dependency-package");
+package = requirePeer("some-peer-dependency-package", {optional: true});
+package = requirePeer("some-peer-dependency-package", {dontThrow: true});
+package = requirePeer("some-peer-dependency-package", {optional: true, dontThrow: true});
+package = requirePeer.resolve("peer-package-name");
diff --git a/types/codependency/index.d.ts b/types/codependency/index.d.ts
index 2ec424588d..c533a52e8e 100644
--- a/types/codependency/index.d.ts
+++ b/types/codependency/index.d.ts
@@ -22,8 +22,8 @@ interface RequirePeerFunctionOptions {
interface RequirePeerFunction {
(name: string, options?: RequirePeerFunctionOptions): any;
- resolve: (name: string) => DependencyInfo;
+ resolve(name: string): DependencyInfo;
}
export function register(baseModule: NodeModule, options?: {index: string[]}): RequirePeerFunction;
-export function get(middlewareName: string): RequirePeerFunction;
\ No newline at end of file
+export function get(middlewareName: string): RequirePeerFunction;
diff --git a/types/coinstring/coinstring-tests.ts b/types/coinstring/coinstring-tests.ts
index 1cc3fb9a42..556fe1bfc6 100644
--- a/types/coinstring/coinstring-tests.ts
+++ b/types/coinstring/coinstring-tests.ts
@@ -1,66 +1,62 @@
import cs = require('coinstring');
-var privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
-var privateKeyHexBuf = new Buffer(privateKeyHex, 'hex');
-var version = 0x80; // Bitcoin private key
+let privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
+let privateKeyHexBuf = new Buffer(privateKeyHex, 'hex');
+let version = 0x80; // Bitcoin private key
console.log(cs.encode(privateKeyHexBuf, version));
// => 5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD
-var hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8"; // hash representing uncompressed
-var hash160Buf = new Buffer(hash160, 'hex');
-var version = 0x00; // Bitcoin public address
+let hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8"; // hash representing uncompressed
+let hash160Buf = new Buffer(hash160, 'hex');
+version = 0x00; // Bitcoin public address
console.log(cs.encode(hash160Buf, version));
// => 16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS
-var privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
+privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
// for compressed, append "01"
privateKeyHex += '01';
-var privateKeyHexBuf = new Buffer(privateKeyHex, 'hex');
-var version = 0x80; // Bitcoin private key
+privateKeyHexBuf = new Buffer(privateKeyHex, 'hex');
+version = 0x80; // Bitcoin private key
console.log(cs.encode(privateKeyHexBuf, version));
// => KwomKti1X3tYJUUMb1TGSM2mrZk1wb1aHisUNHCQXTZq5auC2qc3
-var hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8"; // hash representing uncompressed
-var hash160Buf = new Buffer(hash160, 'hex');
-var version = 0x1E; // Dogecoin public address
+hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8"; // hash representing uncompressed
+hash160Buf = new Buffer(hash160, 'hex');
+version = 0x1E; // Dogecoin public address
console.log(cs.encode(hash160Buf, version));
// => DAcq9oJpZZAjr56RmF7Y5zmWboZWQ4HAsW
-
-var data = "000000000000000000873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d50800e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35";
-var buffer = new Buffer(data, 'hex');
-var versionBuffer = new Buffer('0488ade4', 'hex'); // 0488ade4 is a consant listed in the aforementioned bip32 wiki.
+const data = "000000000000000000873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d50800e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35";
+const buffer = new Buffer(data, 'hex');
+const versionBuffer = new Buffer('0488ade4', 'hex'); // 0488ade4 is a consant listed in the aforementioned bip32 wiki.
console.log(cs.encode(buffer, versionBuffer));
// => xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi
+privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
+privateKeyHexBuf = new Buffer(privateKeyHex, 'hex');
+version = 0x80; // Bitcoin private key
-var privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
-var privateKeyHexBuf = new Buffer(privateKeyHex, 'hex');
-var version = 0x80; // Bitcoin private key
-
-var toBtcWif = cs.createEncoder(version);
+const toBtcWif = cs.createEncoder(version);
// later in your program
console.log(toBtcWif(privateKeyHexBuf));
// => 5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD
+const wif = "5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD";
+version = 0x80; // Bitcoin private key
-var wif = "5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD";
-var version = 0x80; // Bitcoin private key
+const fromBtcWif = cs.createDecoder(version);
-var fromBtcWif = cs.createDecoder(version);
+hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8"; // hash representing uncompressed
+hash160Buf = new Buffer(hash160, 'hex');
+version = 0x6F; // Bitcoin Testnet Address
-
-var hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8"; // hash representing uncompressed
-var hash160Buf = new Buffer(hash160, 'hex');
-var version = 0x6F; // Bitcoin Testnet Address
-
-var testnetAddressValidator = cs.createValidator(version);
-console.log(testnetAddressValidator("mkzgubTA5Ahi6BPSkE6MN9pEafRutznkMe")); // => true
\ No newline at end of file
+const testnetAddressValidator = cs.createValidator(version);
+console.log(testnetAddressValidator("mkzgubTA5Ahi6BPSkE6MN9pEafRutznkMe")); // => true
diff --git a/types/colors/index.d.ts b/types/colors/index.d.ts
index e087bd0714..68d6fe593e 100644
--- a/types/colors/index.d.ts
+++ b/types/colors/index.d.ts
@@ -48,46 +48,46 @@ interface Color {
export function setTheme(theme: any): void;
-export var enabled: boolean;
+export let enabled: boolean;
-export var strip: Color;
-export var stripColors: Color;
+export const strip: Color;
+export const stripColors: Color;
-export var black: Color;
-export var red: Color;
-export var green: Color;
-export var yellow: Color;
-export var blue: Color;
-export var magenta: Color;
-export var cyan: Color;
-export var white: Color;
-export var gray: Color;
-export var grey: Color;
+export const black: Color;
+export const red: Color;
+export const green: Color;
+export const yellow: Color;
+export const blue: Color;
+export const magenta: Color;
+export const cyan: Color;
+export const white: Color;
+export const gray: Color;
+export const grey: Color;
-export var bgBlack: Color;
-export var bgRed: Color;
-export var bgGreen: Color;
-export var bgYellow: Color;
-export var bgBlue: Color;
-export var bgMagenta: Color;
-export var bgCyan: Color;
-export var bgWhite: Color;
+export const bgBlack: Color;
+export const bgRed: Color;
+export const bgGreen: Color;
+export const bgYellow: Color;
+export const bgBlue: Color;
+export const bgMagenta: Color;
+export const bgCyan: Color;
+export const bgWhite: Color;
-export var reset: Color;
-export var bold: Color;
-export var dim: Color;
-export var italic: Color;
-export var underline: Color;
-export var inverse: Color;
-export var hidden: Color;
-export var strikethrough: Color;
+export const reset: Color;
+export const bold: Color;
+export const dim: Color;
+export const italic: Color;
+export const underline: Color;
+export const inverse: Color;
+export const hidden: Color;
+export const strikethrough: Color;
-export var rainbow: Color;
-export var zebra: Color;
-export var america: Color;
-export var trap: Color;
-export var random: Color;
-export var zalgo: Color;
+export const rainbow: Color;
+export const zebra: Color;
+export const america: Color;
+export const trap: Color;
+export const random: Color;
+export const zalgo: Color;
declare global {
interface String {
@@ -130,4 +130,4 @@ declare global {
random: string;
zalgo: string;
}
-}
\ No newline at end of file
+}
diff --git a/types/colors/safe.d.ts b/types/colors/safe.d.ts
index c2145b7bc1..306b656b2b 100644
--- a/types/colors/safe.d.ts
+++ b/types/colors/safe.d.ts
@@ -1,4 +1,4 @@
-export var enabled: boolean;
+export const enabled: boolean;
export function strip(str: string): string;
export function stripColors(str: string): string;
diff --git a/types/connect-ensure-login/index.d.ts b/types/connect-ensure-login/index.d.ts
index fb1716abf9..bbf827922c 100644
--- a/types/connect-ensure-login/index.d.ts
+++ b/types/connect-ensure-login/index.d.ts
@@ -23,51 +23,51 @@ interface LoggedOutOptions {
}
/**
-* Ensure that a user is logged in before proceeding to next route middleware.
-*
-* This middleware ensures that a user is logged in. If a request is received
-* that is unauthenticated, the request will be redirected to a login page (by
-* default to `/login`).
-*
-* Additionally, `returnTo` will be be set in the session to the URL of the
-* current request. After authentication, this value can be used to redirect
-* the user to the page that was originally requested.
-*
-* Examples:
-*
-* app.get('/profile',
-* ensureLoggedIn(),
-* function(req, res) { ... });
-*
-* app.get('/profile',
-* ensureLoggedIn('/signin'),
-* function(req, res) { ... });
-*
-* app.get('/profile',
-* ensureLoggedIn({ redirectTo: '/session/new', setReturnTo: false }),
-* function(req, res) { ... });
-*/
+ * Ensure that a user is logged in before proceeding to next route middleware.
+ *
+ * This middleware ensures that a user is logged in. If a request is received
+ * that is unauthenticated, the request will be redirected to a login page (by
+ * default to `/login`).
+ *
+ * Additionally, `returnTo` will be be set in the session to the URL of the
+ * current request. After authentication, this value can be used to redirect
+ * the user to the page that was originally requested.
+ *
+ * Examples:
+ *
+ * app.get('/profile',
+ * ensureLoggedIn(),
+ * function(req, res) { ... });
+ *
+ * app.get('/profile',
+ * ensureLoggedIn('/signin'),
+ * function(req, res) { ... });
+ *
+ * app.get('/profile',
+ * ensureLoggedIn({ redirectTo: '/session/new', setReturnTo: false }),
+ * function(req, res) { ... });
+ */
export function ensureLoggedIn(options?: LoggedInOptions | string): RequestHandler;
/**
-* Ensure that no user is logged in before proceeding to next route middleware.
-*
-* This middleware ensures that no user is logged in. If a request is received
-* that is authenticated, the request will be redirected to another page (by
-* default to `/`).
-*
-* Examples:
-*
-* app.get('/login',
-* ensureLoggedOut(),
-* function(req, res) { ... });
-*
-* app.get('/login',
-* ensureLoggedOut('/home'),
-* function(req, res) { ... });
-*
-* app.get('/login',
-* ensureLoggedOut({ redirectTo: '/home' }),
-* function(req, res) { ... });
-*/
+ * Ensure that no user is logged in before proceeding to next route middleware.
+ *
+ * This middleware ensures that no user is logged in. If a request is received
+ * that is authenticated, the request will be redirected to another page (by
+ * default to `/`).
+ *
+ * Examples:
+ *
+ * app.get('/login',
+ * ensureLoggedOut(),
+ * function(req, res) { ... });
+ *
+ * app.get('/login',
+ * ensureLoggedOut('/home'),
+ * function(req, res) { ... });
+ *
+ * app.get('/login',
+ * ensureLoggedOut({ redirectTo: '/home' }),
+ * function(req, res) { ... });
+ */
export function ensureLoggedOut(options?: LoggedOutOptions | string): RequestHandler;
diff --git a/types/convert-source-map/convert-source-map-tests.ts b/types/convert-source-map/convert-source-map-tests.ts
index 96a638ca93..c591f124c6 100644
--- a/types/convert-source-map/convert-source-map-tests.ts
+++ b/types/convert-source-map/convert-source-map-tests.ts
@@ -2,11 +2,11 @@ import convert = require("convert-source-map");
// tslint:disable:max-line-length
-var json = convert
+const json = convert
.fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
.toJSON();
-var modified = convert
+const modified = convert
.fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
.setProperty('sources', ['CONSOLE.LOG("HI");'])
.toJSON();
diff --git a/types/convert-source-map/index.d.ts b/types/convert-source-map/index.d.ts
index e1577c4070..9576e5a08f 100644
--- a/types/convert-source-map/index.d.ts
+++ b/types/convert-source-map/index.d.ts
@@ -35,7 +35,6 @@ export interface SourceMapConverter {
getProperty(key: string): any;
}
-
/** Returns source map converter from given object */
export function fromObject(obj: any): SourceMapConverter;
@@ -72,13 +71,13 @@ export function removeComments(src: string): string;
export function removeMapFileComments(src: string): string;
/** Returns the regex used to find source map comments */
-export var commentRegex: RegExp;
+export const commentRegex: RegExp;
/** Returns the regex used to find source map comments pointing to map files */
-export var mapFileCommentRegex: RegExp;
+export const mapFileCommentRegex: RegExp;
/** Returns a comment that links to an external source map via file.
* By default, the comment is formatted like: //# sourceMappingURL=..., which you would normally see in a JS source file.
* When options.multiline == true, the comment is formatted like: /*# sourceMappingURL=... *\/, which you would find in a CSS source file.
*/
-export function generateMapFileComment(file: string, options?: { multiline?: boolean }): string;
\ No newline at end of file
+export function generateMapFileComment(file: string, options?: { multiline?: boolean }): string;
diff --git a/types/cookies/cookies-tests.ts b/types/cookies/cookies-tests.ts
index 112246907c..c65bcbd4aa 100644
--- a/types/cookies/cookies-tests.ts
+++ b/types/cookies/cookies-tests.ts
@@ -3,9 +3,9 @@ import * as http from 'http';
const server = http.createServer((req, res) => {
const cookies = new Cookies(req, res);
- let unsigned: string,
- signed: string,
- tampered: string;
+ let unsigned: string;
+ let signed: string;
+ let tampered: string;
if (req.url === "/set") {
cookies
diff --git a/types/core-js/index.d.ts b/types/core-js/index.d.ts
index dc37560d4d..9593bc7a76 100644
--- a/types/core-js/index.d.ts
+++ b/types/core-js/index.d.ts
@@ -26,13 +26,13 @@ and limitations under the License.
interface SymbolConstructor {
/**
- * Non-standard. Use simple mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
- */
+ * Non-standard. Use simple mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
+ */
useSimple(): void;
/**
- * Non-standard. Use setter mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
- */
+ * Non-standard. Use setter mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
+ */
userSetter(): void;
}
@@ -80,202 +80,202 @@ interface Set {
interface ArrayConstructor {
/**
- * Appends new elements to an array, and returns the new length of the array.
- * @param items New elements of the Array.
- */
+ * Appends new elements to an array, and returns the new length of the array.
+ * @param items New elements of the Array.
+ */
push(array: ArrayLike, ...items: T[]): number;
/**
- * Removes the last element from an array and returns it.
- */
+ * Removes the last element from an array and returns it.
+ */
pop(array: ArrayLike): T;
/**
- * Combines two or more arrays.
- * @param items Additional items to add to the end of array1.
- */
+ * Combines two or more arrays.
+ * @param items Additional items to add to the end of array1.
+ */
concat(array: ArrayLike, ...items: Array): T[];
/**
- * Adds all the elements of an array separated by the specified separator string.
- * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
- */
+ * Adds all the elements of an array separated by the specified separator string.
+ * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
+ */
join(array: ArrayLike, separator?: string): string;
/**
- * Reverses the elements in an Array.
- */
+ * Reverses the elements in an Array.
+ */
reverse(array: ArrayLike): T[];
/**
- * Removes the first element from an array and returns it.
- */
+ * Removes the first element from an array and returns it.
+ */
shift(array: ArrayLike): T;
/**
- * Returns a section of an array.
- * @param start The beginning of the specified portion of the array.
- * @param end The end of the specified portion of the array.
- */
+ * Returns a section of an array.
+ * @param start The beginning of the specified portion of the array.
+ * @param end The end of the specified portion of the array.
+ */
slice(array: ArrayLike, start?: number, end?: number): T[];
/**
- * Sorts an array.
- * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.
- */
+ * Sorts an array.
+ * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.
+ */
sort(array: ArrayLike, compareFn?: (a: T, b: T) => number): T[];
/**
- * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
- * @param start The zero-based location in the array from which to start removing elements.
- * @param deleteCount The number of elements to remove.
- * @param items Elements to insert into the array in place of the deleted elements.
- */
+ * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
+ * @param start The zero-based location in the array from which to start removing elements.
+ * @param deleteCount The number of elements to remove.
+ * @param items Elements to insert into the array in place of the deleted elements.
+ */
splice(array: ArrayLike, start: number, deleteCount?: number, ...items: T[]): T[];
/**
- * Inserts new elements at the start of an array.
- * @param items Elements to insert at the start of the Array.
- */
+ * Inserts new elements at the start of an array.
+ * @param items Elements to insert at the start of the Array.
+ */
unshift(array: ArrayLike, ...items: T[]): number;
/**
- * Returns the index of the first occurrence of a value in an array.
- * @param searchElement The value to locate in the array.
- * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
- */
+ * Returns the index of the first occurrence of a value in an array.
+ * @param searchElement The value to locate in the array.
+ * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
+ */
indexOf(array: ArrayLike, searchElement: T, fromIndex?: number): number;
/**
- * Returns the index of the last occurrence of a specified value in an array.
- * @param searchElement The value to locate in the array.
- * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.
- */
+ * Returns the index of the last occurrence of a specified value in an array.
+ * @param searchElement The value to locate in the array.
+ * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.
+ */
lastIndexOf(array: ArrayLike, earchElement: T, fromIndex?: number): number;
/**
- * Determines whether all the members of an array satisfy the specified test.
- * @param callbackfn A function that accepts up to three arguments.
- * The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
- */
+ * Determines whether all the members of an array satisfy the specified test.
+ * @param callbackfn A function that accepts up to three arguments.
+ * The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
+ * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
+ */
every(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
/**
- * Determines whether the specified callback function returns true for any element of an array.
- * @param callbackfn A function that accepts up to three arguments.
- * The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
- */
+ * Determines whether the specified callback function returns true for any element of an array.
+ * @param callbackfn A function that accepts up to three arguments.
+ * The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
+ * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
+ */
some(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
/**
- * Performs the specified action for each element in an array.
- * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
- */
+ * Performs the specified action for each element in an array.
+ * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
+ * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
+ */
forEach(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
/**
- * Calls a defined callback function on each element of an array, and returns an array that contains the results.
- * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
- */
+ * Calls a defined callback function on each element of an array, and returns an array that contains the results.
+ * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
+ * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
+ */
map(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
/**
- * Returns the elements of an array that meet the condition specified in a callback function.
- * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
- */
+ * Returns the elements of an array that meet the condition specified in a callback function.
+ * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
+ * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
+ */
filter(array: ArrayLike, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
/**
- * Calls the specified callback function for all the elements in an array.
- * The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
- * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
- * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
- * The first call to the callbackfn function provides this value as an argument instead of an array value.
- */
+ * Calls the specified callback function for all the elements in an array.
+ * The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
+ * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
+ * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
+ * The first call to the callbackfn function provides this value as an argument instead of an array value.
+ */
reduce(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
/**
- * Calls the specified callback function for all the elements in an array.
- * The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
- * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
- * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
- * The first call to the callbackfn function provides this value as an argument instead of an array value.
- */
+ * Calls the specified callback function for all the elements in an array.
+ * The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
+ * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
+ * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
+ * The first call to the callbackfn function provides this value as an argument instead of an array value.
+ */
reduce(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
/**
- * Calls the specified callback function for all the elements in an array, in descending order.
- * The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
- * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
- * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
- * The first call to the callbackfn function provides this value as an argument instead of an array value.
- */
+ * Calls the specified callback function for all the elements in an array, in descending order.
+ * The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
+ * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
+ * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
+ * The first call to the callbackfn function provides this value as an argument instead of an array value.
+ */
reduceRight(array: ArrayLike, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
/**
- * Calls the specified callback function for all the elements in an array, in descending order.
- * The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
- * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
- * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
- * The first call to the callbackfn function provides this value as an argument instead of an array value.
- */
+ * Calls the specified callback function for all the elements in an array, in descending order.
+ * The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
+ * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
+ * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
+ * The first call to the callbackfn function provides this value as an argument instead of an array value.
+ */
reduceRight(array: ArrayLike, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
/**
- * Returns an array of key, value pairs for every entry in the array
- */
+ * Returns an array of key, value pairs for every entry in the array
+ */
entries(array: ArrayLike): IterableIterator<[number, T]>;
/**
- * Returns an list of keys in the array
- */
+ * Returns an list of keys in the array
+ */
keys(array: ArrayLike): IterableIterator;
/**
- * Returns an list of values in the array
- */
+ * Returns an list of values in the array
+ */
values(array: ArrayLike): IterableIterator;
/**
- * Returns the value of the first element in the array where predicate is true, and undefined
- * otherwise.
- * @param predicate find calls predicate once for each element of the array, in ascending
- * order, until it finds one where predicate returns true. If such an element is found, find
- * immediately returns that element value. Otherwise, find returns undefined.
- * @param thisArg If provided, it will be used as the this value for each invocation of
- * predicate. If it is not provided, undefined is used instead.
- */
+ * Returns the value of the first element in the array where predicate is true, and undefined
+ * otherwise.
+ * @param predicate find calls predicate once for each element of the array, in ascending
+ * order, until it finds one where predicate returns true. If such an element is found, find
+ * immediately returns that element value. Otherwise, find returns undefined.
+ * @param thisArg If provided, it will be used as the this value for each invocation of
+ * predicate. If it is not provided, undefined is used instead.
+ */
find(array: ArrayLike, predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): T;
/**
- * Returns the index of the first element in the array where predicate is true, and undefined
- * otherwise.
- * @param predicate find calls predicate once for each element of the array, in ascending
- * order, until it finds one where predicate returns true. If such an element is found, find
- * immediately returns that element value. Otherwise, find returns undefined.
- * @param thisArg If provided, it will be used as the this value for each invocation of
- * predicate. If it is not provided, undefined is used instead.
- */
+ * Returns the index of the first element in the array where predicate is true, and undefined
+ * otherwise.
+ * @param predicate find calls predicate once for each element of the array, in ascending
+ * order, until it finds one where predicate returns true. If such an element is found, find
+ * immediately returns that element value. Otherwise, find returns undefined.
+ * @param thisArg If provided, it will be used as the this value for each invocation of
+ * predicate. If it is not provided, undefined is used instead.
+ */
findIndex(array: ArrayLike, predicate: (value: T) => boolean, thisArg?: any): number;
/**
- * Returns the this object after filling the section identified by start and end with value
- * @param value value to fill array section with
- * @param start index to start filling the array at. If start is negative, it is treated as
- * length+start where length is the length of the array.
- * @param end index to stop filling the array at. If end is negative, it is treated as
- * length+end.
- */
+ * Returns the this object after filling the section identified by start and end with value
+ * @param value value to fill array section with
+ * @param start index to start filling the array at. If start is negative, it is treated as
+ * length+start where length is the length of the array.
+ * @param end index to stop filling the array at. If end is negative, it is treated as
+ * length+end.
+ */
fill(array: ArrayLike, value: T, start?: number, end?: number): T[];
/**
- * Returns the this object after copying a section of the array identified by start and end
- * to the same array starting at position target
- * @param target If target is negative, it is treated as length+target where length is the
- * length of the array.
- * @param start If start is negative, it is treated as length+start. If end is negative, it
- * is treated as length+end.
- * @param end If not specified, length of the this object is used as its default value.
- */
+ * Returns the this object after copying a section of the array identified by start and end
+ * to the same array starting at position target
+ * @param target If target is negative, it is treated as length+target where length is the
+ * length of the array.
+ * @param start If start is negative, it is treated as length+start. If end is negative, it
+ * is treated as length+end.
+ * @param end If not specified, length of the this object is used as its default value.
+ */
copyWithin(array: ArrayLike, target: number, start: number, end?: number): T[];
includes(array: ArrayLike, value: T, fromIndex?: number): boolean;
@@ -290,23 +290,23 @@ interface ArrayConstructor {
interface ObjectConstructor {
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
isObject(value: any): boolean;
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
classof(value: any): string;
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
define(target: T, mixin: any): T;
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
make(proto: T, mixin?: any): T;
}
@@ -322,8 +322,8 @@ interface Log extends Console {
}
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
declare var log: Log;
// #############################################################################################
@@ -369,8 +369,8 @@ interface DictConstructor {
}
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
declare var Dict: DictConstructor;
// #############################################################################################
@@ -380,8 +380,8 @@ declare var Dict: DictConstructor;
interface Function {
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
part(...args: any[]): any;
}
@@ -392,13 +392,13 @@ interface Function {
interface Date {
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
format(template: string, locale?: string): string;
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
formatUTC(template: string, locale?: string): string;
}
@@ -409,13 +409,13 @@ interface Date {
interface Array {
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
turn(callbackfn: (memo: U, value: T, index: number, array: T[]) => void, memo?: U): U;
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
turn(callbackfn: (memo: T[], value: T, index: number, array: T[]) => void, memo?: T[]): T[];
}
@@ -426,8 +426,8 @@ interface Array {
interface Number {
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
[Symbol.iterator](): IterableIterator;
}
@@ -438,13 +438,13 @@ interface Number {
interface String {
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
escapeHTML(): string;
/**
- * Non-standard.
- */
+ * Non-standard.
+ */
unescapeHTML(): string;
}
diff --git a/types/cpy/cpy-tests.ts b/types/cpy/cpy-tests.ts
index 047c9943bf..3bc0cbb32a 100644
--- a/types/cpy/cpy-tests.ts
+++ b/types/cpy/cpy-tests.ts
@@ -4,7 +4,6 @@ cpy(['src/*.png', '!src/goat.png'], 'dist').then(() => {
console.log('files copied');
});
-
cpy('foo.js', 'destination', {
rename: basename => `prefix-${basename}`
-});
\ No newline at end of file
+});
diff --git a/types/cpy/index.d.ts b/types/cpy/index.d.ts
index 039d0b84fb..8ef585250b 100644
--- a/types/cpy/index.d.ts
+++ b/types/cpy/index.d.ts
@@ -4,4 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = cpy;
-declare function cpy(src: string | string[], dest: string, opts?: { cwd?: string, parents?: boolean, rename?: (s: string) => string }): Promise;
+declare function cpy(
+ src: string | string[],
+ dest: string,
+ opts?: { cwd?: string, parents?: boolean, rename?(s: string): string }): Promise;
diff --git a/types/croppie/croppie-tests.ts b/types/croppie/croppie-tests.ts
index 92f6d5ca18..26b2449408 100644
--- a/types/croppie/croppie-tests.ts
+++ b/types/croppie/croppie-tests.ts
@@ -7,7 +7,6 @@ const c = new Croppie(document.getElementById('item'), {
enableOrientation: false,
});
-
c.bind({
url: 'demo/demo-2.jpg',
orientation: 4,
diff --git a/types/croppie/index.d.ts b/types/croppie/index.d.ts
index afd0c0112c..78ab07ad61 100644
--- a/types/croppie/index.d.ts
+++ b/types/croppie/index.d.ts
@@ -27,7 +27,6 @@ export default class Croppie {
destroy(): void;
}
-
export type CropType = 'square' | 'circle';
export type Format = 'jpeg' | 'png' | 'webp';
diff --git a/types/csrf/csrf-tests.ts b/types/csrf/csrf-tests.ts
new file mode 100644
index 0000000000..fd3849eb64
--- /dev/null
+++ b/types/csrf/csrf-tests.ts
@@ -0,0 +1,16 @@
+import Tokens = require('csrf');
+
+const csrf = new Tokens();
+
+// test synchronous secret/token creation
+const secret = csrf.secretSync();
+const token = csrf.create(secret);
+csrf.verify(secret, token);
+
+// test asynchronous secret/token creation
+csrf.secret((err: Error, secret: string) => {
+ if (err) throw err;
+
+ const token = csrf.create(secret);
+ csrf.verify(secret, token);
+});
diff --git a/types/csrf/index.d.ts b/types/csrf/index.d.ts
new file mode 100644
index 0000000000..df1e455eb8
--- /dev/null
+++ b/types/csrf/index.d.ts
@@ -0,0 +1,62 @@
+// Type definitions for b_ 1.3
+// Project: https://github.com/pillarjs/csrf
+// Definitions by: Markis Taylor
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+type SecretCallback = (err: Error | null, secret: string) => void;
+
+interface TokensOptions {
+ /**
+ * The string length of the salt (default: 8)
+ */
+ saltLength: number;
+ /**
+ * The byte length of the secret key (default: 18)
+ */
+ secretLength: number;
+}
+
+declare class Tokens {
+ /**
+ * Token generation/verification class.
+ *
+ * @param {object} [options]
+ * @param {number} [options.saltLength=8] The string length of the salt
+ * @param {number} [options.secretLength=18] The byte length of the secret key
+ * @public
+ */
+ constructor(options?: TokensOptions)
+
+ /**
+ * Create a new CSRF token.
+ *
+ * @param {string} secret The secret for the token.
+ * @public
+ */
+ create(secret: string): string;
+
+ /**
+ * Create a new secret key.
+ *
+ * @param {function} [callback]
+ * @public
+ */
+ secret(callback?: SecretCallback): Promise;
+
+ /**
+ * Create a new secret key synchronously.
+ * @public
+ */
+ secretSync(): string;
+
+ /**
+ * Verify if a given token is valid for a given secret.
+ *
+ * @param {string} secret
+ * @param {string} token
+ * @public
+ */
+ verify(secret: string, token: string): boolean;
+}
+
+export = Tokens;
diff --git a/types/csrf/tsconfig.json b/types/csrf/tsconfig.json
new file mode 100644
index 0000000000..658116154e
--- /dev/null
+++ b/types/csrf/tsconfig.json
@@ -0,0 +1,22 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "lib": [
+ "es6"
+ ],
+ "noImplicitAny": true,
+ "noImplicitThis": true,
+ "strictNullChecks": true,
+ "baseUrl": "../",
+ "typeRoots": [
+ "../"
+ ],
+ "types": [],
+ "noEmit": true,
+ "forceConsistentCasingInFileNames": true
+ },
+ "files": [
+ "index.d.ts",
+ "csrf-tests.ts"
+ ]
+}
diff --git a/types/csrf/tslint.json b/types/csrf/tslint.json
new file mode 100644
index 0000000000..377cc837d4
--- /dev/null
+++ b/types/csrf/tslint.json
@@ -0,0 +1 @@
+{ "extends": "../tslint.json" }
diff --git a/types/csv-stringify/csv-stringify-tests.ts b/types/csv-stringify/csv-stringify-tests.ts
index a05f35d368..d7a6f0196b 100644
--- a/types/csv-stringify/csv-stringify-tests.ts
+++ b/types/csv-stringify/csv-stringify-tests.ts
@@ -12,7 +12,6 @@ stringify([["1", "2", "3"], ["4", "5", "6"]], {
// nothing
});
-
stream = stringify({ delimiter: "," });
stream.write(["1", "2", "3"]);
diff --git a/types/csv-stringify/index.d.ts b/types/csv-stringify/index.d.ts
index e65695c059..a636547187 100644
--- a/types/csv-stringify/index.d.ts
+++ b/types/csv-stringify/index.d.ts
@@ -55,7 +55,6 @@ declare namespace stringify {
* special values are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified).
*/
rowDelimiter?: string;
-
}
interface Stringifier extends NodeJS.ReadWriteStream {
diff --git a/types/csvtojson/index.d.ts b/types/csvtojson/index.d.ts
index 504311f47a..c0ff659dd3 100644
--- a/types/csvtojson/index.d.ts
+++ b/types/csvtojson/index.d.ts
@@ -183,7 +183,7 @@ declare namespace csvtojson {
* @param {string} str the string to convert
* @return {Converter} returns this object for chaining
*/
- fromString(str: string): this
+ fromString(str: string): this;
/**
* Reads in a CSV from a string.
@@ -197,7 +197,7 @@ declare namespace csvtojson {
* @param {string} filePath the path to the CSV file
* @return {Converter} returns this object for chaining
*/
- fromFile(filePath: string): this
+ fromFile(filePath: string): this;
/**
* Reads in a CSV from a file.
@@ -211,7 +211,7 @@ declare namespace csvtojson {
* @param {Stream} stream the stream
* @return {Converter} returns this object for chaining
*/
- fromStream(stream: NodeJS.ReadableStream): this
+ fromStream(stream: NodeJS.ReadableStream): this;
/**
* Reads in a CSV from a stream.
diff --git a/types/csvtojson/tslint.json b/types/csvtojson/tslint.json
index 377cc837d4..b0e7084e94 100644
--- a/types/csvtojson/tslint.json
+++ b/types/csvtojson/tslint.json
@@ -1 +1,6 @@
-{ "extends": "../tslint.json" }
+{
+ "extends": "../tslint.json",
+ "rules": {
+ "ban-types": false
+ }
+}
diff --git a/types/currency-formatter/currencies.d.ts b/types/currency-formatter/currencies.d.ts
index 163bd578de..4d65a9ab53 100644
--- a/types/currency-formatter/currencies.d.ts
+++ b/types/currency-formatter/currencies.d.ts
@@ -1,2 +1,2 @@
import { currencies } from "./index";
-export = currencies;
\ No newline at end of file
+export = currencies;
diff --git a/types/currency-formatter/currency-formatter-tests.ts b/types/currency-formatter/currency-formatter-tests.ts
index a64b9bc48f..f06f53ce05 100644
--- a/types/currency-formatter/currency-formatter-tests.ts
+++ b/types/currency-formatter/currency-formatter-tests.ts
@@ -42,6 +42,5 @@ currencyFormatter.format(-10, {
// => ($10)
-
import currencies = require('currency-formatter/currencies');
currencies === currencyFormatter.currencies;
diff --git a/types/d3-array/index.d.ts b/types/d3-array/index.d.ts
index ccd2d568bb..8f5d4eab2e 100644
--- a/types/d3-array/index.d.ts
+++ b/types/d3-array/index.d.ts
@@ -153,8 +153,8 @@ export function bisectRight(array: Date[], x: Date, lo?: number, hi?: number): n
export const bisect: typeof bisectRight;
export interface Bisector {
- left: (array: T[], x: U, lo?: number, hi?: number) => number;
- right: (array: T[], x: U, lo?: number, hi?: number) => number;
+ left(array: T[], x: U, lo?: number, hi?: number): number;
+ right(array: T[], x: U, lo?: number, hi?: number): number;
}
export function bisector(comparator: (a: T, b: U) => number): Bisector;
diff --git a/types/d3-axis/index.d.ts b/types/d3-axis/index.d.ts
index 4a65952070..9cee537067 100644
--- a/types/d3-axis/index.d.ts
+++ b/types/d3-axis/index.d.ts
@@ -61,10 +61,10 @@ export interface Axis {
(context: Selection): void;
/**
- * Render the axis to the given context.
- *
- * @param context A transition defined on SVG containers (either SVG or G elements).
- */
+ * Render the axis to the given context.
+ *
+ * @param context A transition defined on SVG containers (either SVG or G elements).
+ */
(context: TransitionLike): void;
/**
@@ -142,10 +142,10 @@ export interface Axis {
tickArguments(args: [AxisTimeInterval, string]): this;
/**
- * Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
- *
- * @param args An array with arguments suitable for the scale to be used for tick generation
- */
+ * Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
+ *
+ * @param args An array with arguments suitable for the scale to be used for tick generation
+ */
tickArguments(args: any[]): this;
/**
diff --git a/types/d3-drag/d3-drag-tests.ts b/types/d3-drag/d3-drag-tests.ts
index deb5a6dc55..4283cb259f 100644
--- a/types/d3-drag/d3-drag-tests.ts
+++ b/types/d3-drag/d3-drag-tests.ts
@@ -55,7 +55,6 @@ let circleDrag: d3Drag.DragBehavior;
-
// create new drag behavior ------------------------------------------
circleDrag = d3Drag.drag(); // Use short form method
@@ -99,7 +98,6 @@ filterFn = function(d) {
// chainable
circleDrag = circleDrag.filter(function(d, i, group) {
-
return (d.color !== 'green' && this.r.baseVal.value < 10) ? !event.button : true; // 'this' is SVGCircleElement and d is CircleDatum
});
@@ -192,10 +190,8 @@ const wrongSelection: Selection = select = event;
-
circleDrag = e.target; // target return drag behavior
const type: string = e.type;
@@ -224,7 +220,6 @@ handler = e.on('dragged');
// fails, handler with wrong datum type
// let wrongHandler4: ((this:SVGCircleElement, d:{test: number}, i: number, group: SVGCircleElement[] | NodeListOf)=> void) | undefined = e.on('dragged');
-
// -----------------------------------------------------------------------------
// Test dragDisable() and dragEnable()
// -----------------------------------------------------------------------------
diff --git a/types/d3-drag/index.d.ts b/types/d3-drag/index.d.ts
index d49e0bbc02..d3a65fb377 100644
--- a/types/d3-drag/index.d.ts
+++ b/types/d3-drag/index.d.ts
@@ -7,12 +7,10 @@
import { ArrayLike, Selection, ValueFn } from 'd3-selection';
-
// --------------------------------------------------------------------------
// Shared Type Definitions and Interfaces
// --------------------------------------------------------------------------
-
/**
* DraggedElementBaseType serves as an alias for the 'minimal' data type which can be selected
* without 'd3-drag' (and related code in 'd3-selection') trying to use properties internally which would otherwise not
@@ -20,7 +18,6 @@ import { ArrayLike, Selection, ValueFn } from 'd3-selection';
*/
export type DraggedElementBaseType = Element;
-
/**
* Container element type usable for mouse/touch functions
*/
diff --git a/types/d3-dsv/v0/index.d.ts b/types/d3-dsv/v0/index.d.ts
index 82ccd0f87f..18701f64ea 100644
--- a/types/d3-dsv/v0/index.d.ts
+++ b/types/d3-dsv/v0/index.d.ts
@@ -4,11 +4,11 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** A parser and formatter for DSV (CSV and TSV) files. Extracted from D3. */
-declare var loader: (
- /** the symbol used to seperate cells in the row.*/
+declare function loader(
+ /** the symbol used to seperate cells in the row. */
delimiter: string,
/** example: "text/plain" */
- encoding?: string) => D3Dsv;
+ encoding?: string): D3Dsv;
export = loader;
export as namespace d3_dsv;
@@ -16,21 +16,21 @@ export as namespace d3_dsv;
/** A parser and formatter for DSV (CSV and TSV) files. Extracted from D3. */
interface D3Dsv {
/**
- Parses the specified string, which is the contents of a CSV file, returning an array of objects representing the parsed rows.
- The string is assumed to be RFC4180-compliant.
- Unlike the parseRows method, this method requires that the first line of the CSV file contains a comma-separated list of column names;
- these column names become the attributes on the returned objects.
- For example, consider the following CSV file:
-
- Year,Make,Model,Length
- 1997,Ford,E350,2.34
- 2000,Mercury,Cougar,2.38
-
- The resulting JavaScript array is:
-
- [ {"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"},
- {"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"} ]
- */
+ * Parses the specified string, which is the contents of a CSV file, returning an array of objects representing the parsed rows.
+ * The string is assumed to be RFC4180-compliant.
+ * Unlike the parseRows method, this method requires that the first line of the CSV file contains a comma-separated list of column names;
+ * these column names become the attributes on the returned objects.
+ * For example, consider the following CSV file:
+ *
+ * Year,Make,Model,Length
+ * 1997,Ford,E350,2.34
+ * 2000,Mercury,Cougar,2.38
+ *
+ * The resulting JavaScript array is:
+ *
+ * [ {"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"},
+ * {"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"} ]
+ */
parse(
table: string,
/** coerce cells (strings) into different types or modify them. return null to strip this row from the output results. */
@@ -38,42 +38,42 @@ interface D3Dsv {
): TRow[];
/**
- Parses the specified string, which is the contents of a CSV file, returning an array of arrays representing the parsed rows.
- The string is assumed to be RFC4180-compliant.
- Unlike the parse method, this method treats the header line as a standard row, and should be used whenever the CSV file does not contain a header.
- Each row is represented as an array rather than an object.
- Rows may have variable length.
- For example, consider the following CSV file:
-
- 1997,Ford,E350,2.34
- 2000,Mercury,Cougar,2.38
- The resulting JavaScript array is:
-
- [ ["1997", "Ford", "E350", "2.34"],
- ["2000", "Mercury", "Cougar", "2.38"] ]
- Note that the values themselves are always strings; they will not be automatically converted to numbers. See parse for details.
- */
+ * Parses the specified string, which is the contents of a CSV file, returning an array of arrays representing the parsed rows.
+ * The string is assumed to be RFC4180-compliant.
+ * Unlike the parse method, this method treats the header line as a standard row, and should be used whenever the CSV file does not contain a header.
+ * Each row is represented as an array rather than an object.
+ * Rows may have variable length.
+ * For example, consider the following CSV file:
+ *
+ * 1997,Ford,E350,2.34
+ * 2000,Mercury,Cougar,2.38
+ * The resulting JavaScript array is:
+ *
+ * [ ["1997", "Ford", "E350", "2.34"],
+ * ["2000", "Mercury", "Cougar", "2.38"] ]
+ * Note that the values themselves are always strings; they will not be automatically converted to numbers. See parse for details.
+ */
parseRows(
table: string,
- /** coerce cells (strings) into different types or modify them. return null to strip this row from the output results.*/
+ /** coerce cells (strings) into different types or modify them. return null to strip this row from the output results. */
accessor?: (row: string[]) => TRow
): TRow[];
/**
- Converts the specified array of rows into comma-separated values format, returning a string.
- This operation is the reverse of parse.
- Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,).
- Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes.
-
- Each row should be an object, and all object properties will be converted into fields.
- For greater control over which properties are converted, convert the rows into arrays containing only the properties that should be converted and use formatRows.
- */
+ * Converts the specified array of rows into comma-separated values format, returning a string.
+ * This operation is the reverse of parse.
+ * Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,).
+ * Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes.
+ *
+ * Each row should be an object, and all object properties will be converted into fields.
+ * For greater control over which properties are converted, convert the rows into arrays containing only the properties that should be converted and use formatRows.
+ */
format(rows: any[]): string;
/**
- Converts the specified array of rows into comma-separated values format, returning a string.
- This operation is the reverse of parseRows. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,).
- Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes.
- */
+ * Converts the specified array of rows into comma-separated values format, returning a string.
+ * This operation is the reverse of parseRows. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,).
+ * Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes.
+ */
formatRows(rows: any[]): string;
}
diff --git a/types/d3-ease/d3-ease-tests.ts b/types/d3-ease/d3-ease-tests.ts
index b50ceba9a4..67a0f32b1b 100644
--- a/types/d3-ease/d3-ease-tests.ts
+++ b/types/d3-ease/d3-ease-tests.ts
@@ -23,7 +23,6 @@ t_out = d3Ease.easeCubicIn(t_in);
t_out = d3Ease.easeCubicOut(t_in);
t_out = d3Ease.easeCubicInOut(t_in);
-
let easePolyFactory: d3Ease.PolynomialEasingFactory;
easePolyFactory = d3Ease.easePoly;
diff --git a/types/d3-ease/index.d.ts b/types/d3-ease/index.d.ts
index 704b55e5e0..3de6fd2e87 100644
--- a/types/d3-ease/index.d.ts
+++ b/types/d3-ease/index.d.ts
@@ -94,25 +94,24 @@ export interface PolynomialEasingFactory {
* Symmetric polynomial easing/easing factory; scales polyIn for t in [0, 0.5] and polyOut for t in [0.5, 1].
* If the exponent is not specified, it defaults to 3, equivalent to cubic.
*/
-export var easePoly: PolynomialEasingFactory;
+export const easePoly: PolynomialEasingFactory;
/**
* Polynomial easing/easing factory; raises t to the specified exponent.
* If the exponent is not specified, it defaults to 3, equivalent to cubicIn.
*/
-export var easePolyIn: PolynomialEasingFactory;
+export const easePolyIn: PolynomialEasingFactory;
/**
* Reverse polynomial easing/easing factory; equivalent to 1 - polyIn(1 - t).
* If the exponent is not specified, it defaults to 3, equivalent to cubicOut.
*/
-export var easePolyOut: PolynomialEasingFactory;
+export const easePolyOut: PolynomialEasingFactory;
/**
* Symmetric polynomial easing/easing factory; scales polyIn for t in [0, 0.5] and polyOut for t in [0.5, 1].
* If the exponent is not specified, it defaults to 3, equivalent to cubic.
*/
-export var easePolyInOut: PolynomialEasingFactory;
-
+export const easePolyInOut: PolynomialEasingFactory;
/**
* Symmetric sinusoidal easing; scales sinIn for t in [0, 0.5] and sinOut for t in [0.5, 1].
@@ -226,7 +225,6 @@ export function easeBounceOut(normalizedTime: number): number;
*/
export function easeBounceInOut(normalizedTime: number): number;
-
/**
* Anticipatory easing function factory
*/
@@ -249,26 +247,25 @@ export interface BackEasingFactory {
* Symmetric anticipatory easing; scales backIn for t in [0, 0.5] and backOut for t in [0.5, 1].
* The degree of overshoot is configurable; it not specified, it defaults to 1.70158.
*/
-export var easeBack: BackEasingFactory;
+export const easeBack: BackEasingFactory;
/**
* Anticipatory easing, like a dancer bending his knees before jumping off the floor.
* The degree of overshoot is configurable; it not specified, it defaults to 1.70158.
*/
-export var easeBackIn: BackEasingFactory;
+export const easeBackIn: BackEasingFactory;
/**
* Reverse anticipatory easing; equivalent to 1 - backIn(1 - t).
* The degree of overshoot is configurable; it not specified, it defaults to 1.70158.
*/
-export var easeBackOut: BackEasingFactory;
+export const easeBackOut: BackEasingFactory;
/**
* Symmetric anticipatory easing; scales backIn for t in [0, 0.5] and backOut for t in [0.5, 1].
* The degree of overshoot is configurable; it not specified, it defaults to 1.70158.
*/
-export var easeBackInOut: BackEasingFactory;
-
+export const easeBackInOut: BackEasingFactory;
/**
* Elastic easing function factory
@@ -287,11 +284,11 @@ export interface ElasticEasingFactory {
*/
amplitude(a: number): ElasticEasingFactory;
/**
- * Returns a new elastic easing with the specified amplitude a.
- * Defaults to 0.3,if not specified.
- *
- * @param p Period for elastic easing.
- */
+ * Returns a new elastic easing with the specified amplitude a.
+ * Defaults to 0.3,if not specified.
+ *
+ * @param p Period for elastic easing.
+ */
period(p: number): ElasticEasingFactory;
}
@@ -300,25 +297,25 @@ export interface ElasticEasingFactory {
* The amplitude and period of the oscillation are configurable;
* if not specified, they default to 1 and 0.3, respectively.
*/
-export var easeElastic: ElasticEasingFactory;
+export const easeElastic: ElasticEasingFactory;
/**
* Elastic easing, like a rubber band.
* The amplitude and period of the oscillation are configurable;
* if not specified, they default to 1 and 0.3, respectively.
*/
-export var easeElasticIn: ElasticEasingFactory;
+export const easeElasticIn: ElasticEasingFactory;
/**
* Reverse elastic easing; equivalent to 1 - elasticIn(1 - t).
* The amplitude and period of the oscillation are configurable;
* if not specified, they default to 1 and 0.3, respectively.
*/
-export var easeElasticOut: ElasticEasingFactory;
+export const easeElasticOut: ElasticEasingFactory;
/**
* Symmetric elastic easing; scales elasticIn for t in [0, 0.5] and elasticOut for t in [0.5, 1].
* The amplitude and period of the oscillation are configurable;
* if not specified, they default to 1 and 0.3, respectively.
*/
-export var easeElasticInOut: ElasticEasingFactory;
+export const easeElasticInOut: ElasticEasingFactory;
diff --git a/types/d3-force/d3-force-tests.ts b/types/d3-force/d3-force-tests.ts
index 0ecd7555d3..c08e1b5cee 100644
--- a/types/d3-force/d3-force-tests.ts
+++ b/types/d3-force/d3-force-tests.ts
@@ -6,7 +6,6 @@
* are not intended as functional tests.
*/
-
import * as d3Force from 'd3-force';
// -------------------------------------------------------------------------------------
@@ -30,7 +29,6 @@ interface Graph {
links: SimLink[];
}
-
const graph: Graph = {
nodes: [
{ id: 'Myriel', group: 1, r: 5 },
@@ -112,7 +110,6 @@ forceCollide = d3Force.forceCollide((node, index, nodes) => {
return n.r;
});
-
// Configure Collision force -----------------------------------------------------------
let radiusAccessor: (node: SimNode, i: number, nodes: SimNode[]) => number;
@@ -139,7 +136,6 @@ num = forceCollide.strength();
forceCollide = forceCollide.iterations(10);
num = forceCollide.iterations();
-
// Use Collision force -----------------------------------------------------------------
forceCollide.initialize(graph.nodes);
@@ -157,7 +153,6 @@ forceLink = d3Force.forceLink();
// with link data
forceLink = d3Force.forceLink(graph.links);
-
// Configure Link force -----------------------------------------------------------
let linkNumberAccessor: (link: SimLink, i: number, links: SimLink[]) => number;
@@ -181,7 +176,6 @@ num = simLink.value;
num = simLink.d;
num = simLink.s;
-
// id (node id accessor)
forceLink = forceLink.id((node, index, nodes) => {
@@ -220,13 +214,11 @@ linkNumberAccessor = forceLink.strength();
forceLink = forceLink.iterations(10);
num = forceLink.iterations();
-
// Use Link force -----------------------------------------------------------------
forceLink.initialize(graph.nodes);
forceLink(0.1); // alpha
-
// ManyBody ============================================================================
// create ManyBody force --------------------------------------------------------------
@@ -255,7 +247,6 @@ simNodeNumberAccessor = forceCharge.strength();
forceCharge = forceCharge.theta(0.8);
num = forceCharge.theta();
-
// distanceMin
forceCharge = forceCharge.distanceMin(1);
@@ -266,13 +257,11 @@ num = forceCharge.distanceMin();
forceCharge = forceCharge.distanceMax(1000);
num = forceCharge.distanceMax();
-
// Use ManyBody force -----------------------------------------------------------------
forceCharge.initialize(graph.nodes);
forceCharge(0.1); // alpha
-
// ForceX ==============================================================================
// create ForceX force --------------------------------------------------------------
@@ -327,7 +316,6 @@ simNodeNumberAccessor = forcePosX.x();
forcePosX.initialize(graph.nodes);
forcePosX(0.1); // alpha
-
// ForceY ==============================================================================
// create ForceY force --------------------------------------------------------------
@@ -388,7 +376,6 @@ forcePosY(0.1); // alpha
// Create Force Simulation =============================================================
-
let nodeSimulation: d3Force.Simulation;
let nodeLinkSimulation: d3Force.Simulation;
@@ -435,7 +422,6 @@ num = nodeLinkSimulation.alphaTarget();
nodeLinkSimulation = nodeLinkSimulation.velocityDecay(0.4);
num = nodeLinkSimulation.velocityDecay();
-
// force() -----------------------------------------------------------------------------
nodeSimulation = nodeSimulation.force('posx', forcePosX);
@@ -444,7 +430,6 @@ nodeSimulation.force('posy', forcePosY);
// Remove force
nodeSimulation = nodeSimulation.force('posx', null);
-
nodeLinkSimulation = nodeLinkSimulation.force('link', forceLink);
nodeLinkSimulation
@@ -480,7 +465,6 @@ simLinks = nodeLinkSimulation.force>('link')
// fLink = nodeLinkSimulation.force('link')!; // fails, as ForceLink specific properties are missing from 'generic' force
-
// on() --------------------------------------------------------------------------------
function drawLink(d: SimLink) {
@@ -502,7 +486,6 @@ function drawNode(d: SimNode) {
}
nodeLinkSimulation = nodeLinkSimulation.on('tick', function ticked() {
-
const that: d3Force.Simulation = this;
if (context) {
diff --git a/types/d3-force/index.d.ts b/types/d3-force/index.d.ts
index 6faa27449a..23f83c7ea3 100644
--- a/types/d3-force/index.d.ts
+++ b/types/d3-force/index.d.ts
@@ -3,7 +3,6 @@
// Definitions by: Tom Wanzek , Alex Ford , Boris Yankov
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
// Last module patch version validated against: 1.0.4
// -----------------------------------------------------------------------
@@ -356,7 +355,6 @@ export interface Force {} } = d3Geo.geoTransform({});
+const transformFunction: { stream(s: d3Geo.GeoStream): {} } = d3Geo.geoTransform({});
interface CustomTranformProto extends d3Geo.GeoTransformPrototype {
a: number;
@@ -612,7 +612,7 @@ customTransformProto = {
a: 10
};
-const t: { stream: (s: d3Geo.GeoStream) => (CustomTranformProto & d3Geo.GeoStream) } = d3Geo.geoTransform(customTransformProto);
+const t: { stream(s: d3Geo.GeoStream): CustomTranformProto & d3Geo.GeoStream } = d3Geo.geoTransform(customTransformProto);
// geoIdentity() ========================================================
diff --git a/types/d3-geo/index.d.ts b/types/d3-geo/index.d.ts
index 1e9fed9b92..f6e4fa150d 100644
--- a/types/d3-geo/index.d.ts
+++ b/types/d3-geo/index.d.ts
@@ -699,14 +699,14 @@ export interface GeoProjection extends GeoStreamWrapper {
*/
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature): this;
/**
- * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent.
- * Returns the projection.
- *
- * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
- *
- * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
- * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
- */
+ * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent.
+ * Returns the projection.
+ *
+ * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
+ *
+ * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
+ * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
+ */
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection>): this;
/**
* Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of the given extent.
@@ -719,14 +719,14 @@ export interface GeoProjection extends GeoStreamWrapper {
*/
fitExtent(extent: [[number, number], [number, number]], object: GeoGeometryObjects): this;
/**
- * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent.
- * Returns the projection.
- *
- * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
- *
- * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
- * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
- */
+ * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent.
+ * Returns the projection.
+ *
+ * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
+ *
+ * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
+ * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
+ */
fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection): this;
/**
@@ -1340,7 +1340,7 @@ export interface GeoTransformPrototype {
*
* @param methods An object with custom method implementations, which are used to create a transform projection.
*/
-export function geoTransform(methods: T): { stream: (s: GeoStream) => (T & GeoStream) };
+export function geoTransform(methods: T): { stream(s: GeoStream): T & GeoStream };
// geoIdentity() =================================================================
@@ -1382,14 +1382,14 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
*/
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature): this;
/**
- * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent.
- * Returns the projection.
- *
- * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
- *
- * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
- * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
- */
+ * Sets the projection’s scale and translate to fit the specified geographic feature collection in the center of the given extent.
+ * Returns the projection.
+ *
+ * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
+ *
+ * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
+ * @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
+ */
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection>): this;
/**
* Sets the projection’s scale and translate to fit the specified geographic geometry object in the center of the given extent.
@@ -1402,14 +1402,14 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
*/
fitExtent(extent: [[number, number], [number, number]], object: GeoGeometryObjects): this;
/**
- * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent.
- * Returns the projection.
- *
- * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
- *
- * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
- * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
- */
+ * Sets the projection’s scale and translate to fit the specified geographic geometry collection in the center of the given extent.
+ * Returns the projection.
+ *
+ * Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
+ *
+ * @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
+ * @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
+ */
fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection): this;
/**
diff --git a/types/d3-scale/d3-scale-tests.ts b/types/d3-scale/d3-scale-tests.ts
index c1feb4766a..f317e342ec 100644
--- a/types/d3-scale/d3-scale-tests.ts
+++ b/types/d3-scale/d3-scale-tests.ts
@@ -92,7 +92,6 @@ linearScaleNumString = linearScaleNumString.domain(domainNumeric);
linearScaleNumString = linearScaleNumString.domain(domainNumbers);
domainNumbers = linearScaleNumString.domain();
-
// range(...) -----------------------------------------------------------------
linearScaleNumber = linearScaleNumber.range(rangeNumbers);
@@ -138,7 +137,6 @@ linearScaleNumString = linearScaleNumber.interpolate((a, b) => {
// nice(...) -----------------------------------------------------------------------
-
// chainable
linearScaleNumber = linearScaleNumber.nice();
linearScaleNumber = linearScaleNumber.nice(5);
@@ -180,7 +178,6 @@ powerScaleNumber = d3Scale.scalePow();
powerScaleString = d3Scale.scalePow();
powerScaleNumString = d3Scale.scalePow();
-
let squarerootScaleNumber: d3Scale.ScalePower;
let squarerootScaleString: d3Scale.ScalePower;
let squarerootScaleNumString: d3Scale.ScalePower;
@@ -211,7 +208,6 @@ powerScaleNumString = powerScaleNumString.domain(domainNumeric);
powerScaleNumString = powerScaleNumString.domain(domainNumbers);
domainNumbers = powerScaleNumString.domain();
-
// range(...) -----------------------------------------------------------------
powerScaleNumber = powerScaleNumber.range(rangeNumbers);
@@ -282,7 +278,6 @@ const copiedPowerScale: d3Scale.ScalePower = powerScaleNumString
// Logarithmic Scale Factory
// -------------------------------------------------------------------------------
-
// scaleLog() ---------------------------------------------------------------------
let logScaleNumber: d3Scale.ScaleLogarithmic;
@@ -293,7 +288,6 @@ logScaleNumber = d3Scale.scaleLog();
logScaleString = d3Scale.scaleLog();
logScaleNumString = d3Scale.scaleLog();
-
// ScaleLogarithmic Interface ========================================================
// base --------------------------------------------------------------------
@@ -316,7 +310,6 @@ logScaleNumString = logScaleNumString.domain(domainNumeric);
logScaleNumString = logScaleNumString.domain(domainNumbers);
domainNumbers = logScaleNumString.domain();
-
// range(...) -----------------------------------------------------------------
logScaleNumber = logScaleNumber.range(rangeNumbers);
@@ -393,10 +386,8 @@ let identityScale: d3Scale.ScaleIdentity;
identityScale = d3Scale.scaleIdentity();
-
// ScaleIdentity Interface ========================================================
-
// domain(...) -----------------------------------------------------------------
identityScale = identityScale.domain(domainNumeric);
@@ -434,12 +425,10 @@ tickFormatNumberFn = identityScale.tickFormat(5, '+%');
outputNumber = identityScale(10);
-
// copy(...) -----------------------------------------------------------------
const copiedIdentityScale: d3Scale.ScaleIdentity = identityScale.copy();
-
// -------------------------------------------------------------------------------
// Time Scale Factories
// -------------------------------------------------------------------------------
@@ -454,7 +443,6 @@ localTimeScaleNumber = d3Scale.scaleTime();
localTimeScaleString = d3Scale.scaleTime();
localTimeScaleNumString = d3Scale.scaleTime();
-
let utcScaleNumber: d3Scale.ScaleTime;
let utcScaleString: d3Scale.ScaleTime;
let utcScaleNumString: d3Scale.ScaleTime;
@@ -475,7 +463,6 @@ domainDates = localTimeScaleString.domain();
localTimeScaleNumString = localTimeScaleNumString.domain(domainDates);
domainDates = localTimeScaleNumString.domain();
-
// range(...) -----------------------------------------------------------------
localTimeScaleNumber = localTimeScaleNumber.range(rangeNumbers);
@@ -534,7 +521,6 @@ if (timeInterval !== null) {
ticksDates = localTimeScaleNumString.ticks(timeInterval);
}
-
// tickFormat(...) -----------------------------------------------------------------
tickFormatDateFn = localTimeScaleNumber.tickFormat();
@@ -543,7 +529,6 @@ if (timeInterval !== null) {
tickFormatDateFn = localTimeScaleNumber.tickFormat(timeInterval, '%I %p');
}
-
// (...) value mapping from domain to output -----------------------------------
outputNumber = localTimeScaleNumber(new Date(2016, 6, 4));
@@ -595,8 +580,6 @@ outputString = sequentialScaleColorString(10);
const copiedSequentialScale: d3Scale.ScaleSequential = sequentialScaleColorString.copy();
-
-
// -------------------------------------------------------------------------------
// Color Interpolators for Sequential Scale Factory
// -------------------------------------------------------------------------------
@@ -619,7 +602,6 @@ colorInterpolator = d3Scale.interpolateCool;
colorInterpolator = d3Scale.interpolateCubehelixDefault;
-
// -------------------------------------------------------------------------------
// Quantize Scale Factory
// -------------------------------------------------------------------------------
@@ -632,7 +614,6 @@ let quantizeScaleString: d3Scale.ScaleQuantize;
quantizeScaleNumber = d3Scale.scaleQuantize();
quantizeScaleString = d3Scale.scaleQuantize();
-
// ScaleQuantize Interface ========================================================
// domain(...) -----------------------------------------------------------------
@@ -649,7 +630,6 @@ rangeNumbers = quantizeScaleNumber.range();
quantizeScaleString = quantizeScaleString.range(['steelblue', 'brown']);
rangeStrings = quantizeScaleString.range();
-
// invertExtent(...) -----------------------------------------------------------------
numExtent = quantizeScaleNumber.invertExtent(500);
@@ -681,12 +661,10 @@ outputNumber = quantizeScaleNumber(0.51);
const copiedQuantizeScale: d3Scale.ScaleQuantize = quantizeScaleNumber.copy();
-
// -------------------------------------------------------------------------------
// Quantile Scale Factory
// -------------------------------------------------------------------------------
-
// scaleQuantile() -----------------------------------------------------------------
let quantileScaleNumber: d3Scale.ScaleQuantile;
@@ -695,7 +673,6 @@ let quantileScaleString: d3Scale.ScaleQuantile;
quantileScaleNumber = d3Scale.scaleQuantile();
quantileScaleString = d3Scale.scaleQuantile();
-
// ScaleQuantile Interface ========================================================
// domain(...) -----------------------------------------------------------------
@@ -714,7 +691,6 @@ rangeNumbers = quantileScaleNumber.range();
quantileScaleString = quantileScaleString.range(['q25', 'q50', 'q75']);
rangeStrings = quantileScaleString.range();
-
// invertExtent(...) -----------------------------------------------------------------
numExtent = quantileScaleNumber.invertExtent(2);
@@ -733,7 +709,6 @@ outputNumber = quantileScaleNumber(0.51);
const copiedQuantileScale: d3Scale.ScaleQuantile = quantileScaleNumber.copy();
-
// -------------------------------------------------------------------------------
// Threshold Scale Factory
// -------------------------------------------------------------------------------
@@ -746,7 +721,6 @@ let thresholdScaleNumberString: d3Scale.ScaleThreshold;
thresholdScaleNumberNumber = d3Scale.scaleThreshold();
thresholdScaleNumberString = d3Scale.scaleThreshold();
-
// ScaleThreshold Interface ========================================================
// domain(...) -----------------------------------------------------------------
@@ -764,7 +738,6 @@ rangeNumbers = thresholdScaleNumberNumber.range();
thresholdScaleNumberString = thresholdScaleNumberString.range(['steelblue', 'seagreen', 'brown']);
rangeStrings = thresholdScaleNumberString.range();
-
// invertExtent(...) -----------------------------------------------------------------
numOrUndefinedExtent = thresholdScaleNumberNumber.invertExtent(100);
@@ -781,7 +754,6 @@ outputString = thresholdScaleNumberString(0.9);
const copiedThresholdScale: d3Scale.ScaleThreshold = thresholdScaleNumberString.copy();
-
// -------------------------------------------------------------------------------
// Ordinal Scale Factory
// -------------------------------------------------------------------------------
@@ -794,7 +766,6 @@ let ordinalScaleStringNumber: d3Scale.ScaleOrdinal;
ordinalScaleStringString = d3Scale.scaleOrdinal();
ordinalScaleStringNumber = d3Scale.scaleOrdinal();
-
// ScaleOrdinal Interface ========================================================
// domain(...) -----------------------------------------------------------------
@@ -812,7 +783,6 @@ rangeStrings = ordinalScaleStringString.range();
ordinalScaleStringNumber = ordinalScaleStringNumber.range([-1, 0, 1]);
rangeNumbers = ordinalScaleStringNumber.range();
-
// unknown(...) and d3Scale.scaleImplicit --------------------------------------
const implicit: { name: 'implicit' } = d3Scale.scaleImplicit;
@@ -839,7 +809,6 @@ outputNumber = ordinalScaleStringNumber('negative');
const copiedOrdinalScale: d3Scale.ScaleOrdinal = ordinalScaleStringNumber.copy();
-
// -------------------------------------------------------------------------------
// Band Scale Factory
// -------------------------------------------------------------------------------
@@ -852,7 +821,6 @@ let bandScaleCoercible: d3Scale.ScaleBand;
bandScaleString = d3Scale.scaleBand();
bandScaleCoercible = d3Scale.scaleBand();
-
// ScaleBand Interface ========================================================
// domain(...) -----------------------------------------------------------------
@@ -870,12 +838,10 @@ let rangeExtent: [number, number] = bandScaleString.range();
bandScaleCoercible = bandScaleCoercible.range([0, 300]);
rangeExtent = bandScaleCoercible.range();
-
// rangeRound(...) -----------------------------------------------------------------
bandScaleString = bandScaleString.rangeRound([0, 300]);
-
// round(...) -----------------------------------------------------------------
bandScaleCoercible = bandScaleCoercible.round(true);
@@ -891,7 +857,6 @@ num = bandScaleString.paddingInner();
bandScaleString = bandScaleString.paddingOuter(0.1);
num = bandScaleString.paddingOuter();
-
// padding(...) -----------------------------------------------------------------
bandScaleString = bandScaleString.padding(0.1);
@@ -910,7 +875,6 @@ num = bandScaleString.bandwidth();
num = bandScaleString.step();
-
// (...) value mapping from domain to output -----------------------------------
outputNumberMaybe = bandScaleString('neutral');
@@ -921,7 +885,6 @@ outputNumberMaybe = bandScaleCoercible(new StringCoercible('negative'));
const copiedBandScale: d3Scale.ScaleBand = bandScaleCoercible.copy();
-
// -------------------------------------------------------------------------------
// Point Scale Factory
// -------------------------------------------------------------------------------
@@ -934,7 +897,6 @@ let pointScaleCoercible: d3Scale.ScalePoint;
pointScaleString = d3Scale.scalePoint();
pointScaleCoercible = d3Scale.scalePoint();
-
// ScalePoint Interface ========================================================
// domain(...) -----------------------------------------------------------------
@@ -952,18 +914,15 @@ rangeExtent = pointScaleString.range();
pointScaleCoercible = pointScaleCoercible.range([0, 300]);
rangeExtent = pointScaleCoercible.range();
-
// rangeRound(...) -----------------------------------------------------------------
pointScaleString = pointScaleString.rangeRound([0, 300]);
-
// round(...) -----------------------------------------------------------------
pointScaleCoercible = pointScaleCoercible.round(true);
roundingFlag = pointScaleCoercible.round();
-
// padding(...) -----------------------------------------------------------------
pointScaleString = pointScaleString.padding(0.1);
diff --git a/types/d3-scale/index.d.ts b/types/d3-scale/index.d.ts
index 2ba9eeec8a..8a114d90e1 100644
--- a/types/d3-scale/index.d.ts
+++ b/types/d3-scale/index.d.ts
@@ -33,16 +33,15 @@ export interface InterpolatorFactory {
* A helper interface for a continuous scale defined over a numeric domain.
*/
export interface ScaleContinuousNumeric {
-
/**
- * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
- *
- * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
- *
- * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
- *
- * @param value A numeric value from the domain.
- */
+ * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
+ *
+ * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
+ *
+ * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
+ *
+ * @param value A numeric value from the domain.
+ */
(value: number | { valueOf(): number }): Output;
/**
@@ -163,7 +162,6 @@ export interface ScaleContinuousNumeric {
* Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa.
*/
copy(): this;
-
}
// -------------------------------------------------------------------------------
@@ -188,7 +186,6 @@ export interface ScaleContinuousNumeric {
* convert the interpolated range element to a corresponding output element.
*/
export interface ScaleLinear extends ScaleContinuousNumeric {
-
/**
* Returns the scale’s current interpolator factory, which defaults to interpolate.
*/
@@ -222,7 +219,6 @@ export interface ScaleLinear extends ScaleContinuousNumeric(interpolate: InterpolatorFactory): ScaleLinear;
-
}
/**
@@ -281,7 +277,6 @@ export function scaleLinear(): ScaleLinear;
* convert the interpolated range element to a corresponding output element.
*/
export interface ScalePower extends ScaleContinuousNumeric {
-
/**
* Returns the scale’s current interpolator factory, which defaults to interpolate.
*/
@@ -428,7 +423,6 @@ export function scaleSqrt(): ScalePower;
* convert the interpolated range element to a corresponding output element.
*/
export interface ScaleLogarithmic extends ScaleContinuousNumeric {
-
/**
* Returns a copy of the scale’s current domain.
*/
@@ -578,16 +572,15 @@ export function scaleLog(): ScaleLogarithmic;
* These scales are occasionally useful when working with pixel coordinates, say in conjunction with an axis or brush.
*/
export interface ScaleIdentity {
-
/**
- * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
- *
- * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
- *
- * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
- *
- * @param value A numeric value from the domain.
- */
+ * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
+ *
+ * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
+ *
+ * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
+ *
+ * @param value A numeric value from the domain.
+ */
(value: number | { valueOf(): number }): number;
/**
@@ -688,7 +681,6 @@ export interface ScaleIdentity {
*/
export function scaleIdentity(): ScaleIdentity;
-
// -------------------------------------------------------------------------------
// Time Scale Factories
// -------------------------------------------------------------------------------
@@ -710,16 +702,15 @@ export function scaleIdentity(): ScaleIdentity;
* convert the interpolated range element to a corresponding output element.
*/
export interface ScaleTime {
-
/**
- * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
- *
- * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
- *
- * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
- *
- * @param value A temporal value from the domain. If the value is not a Date, it will be coerced to Date.
- */
+ * Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
+ *
+ * If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
+ *
+ * Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
+ *
+ * @param value A temporal value from the domain. If the value is not a Date, it will be coerced to Date.
+ */
(value: Date | number | { valueOf(): number }): Output;
/**
@@ -1022,14 +1013,13 @@ export function scaleUtc(): ScaleTime;
* The generic corresponds to the data type of the output of the interpolator underlying the scale.
*/
export interface ScaleSequential