Fix various lint errors (#15530)

This commit is contained in:
Andy 2017-03-30 17:42:07 -07:00 committed by GitHub
parent 51430746a2
commit f2b6506ba5
51 changed files with 517 additions and 573 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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;
export function decode(input: string): string;

View File

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

View File

@ -673,4 +673,4 @@ declare namespace BigNumber {
*/
isBigNumber: true;
}
}
}

View File

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

View File

@ -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<T> {
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<T>(array: ArrayLike<T>, ...items: T[]): number;
/**
* Removes the last element from an array and returns it.
*/
* Removes the last element from an array and returns it.
*/
pop<T>(array: ArrayLike<T>): 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<T>(array: ArrayLike<T>, ...items: Array<T[]| T>): 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<T>(array: ArrayLike<T>, separator?: string): string;
/**
* Reverses the elements in an Array.
*/
* Reverses the elements in an Array.
*/
reverse<T>(array: ArrayLike<T>): T[];
/**
* Removes the first element from an array and returns it.
*/
* Removes the first element from an array and returns it.
*/
shift<T>(array: ArrayLike<T>): 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<T>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>, ...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<T>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>, 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<T, U>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>, 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<T, U>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>, 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<T, U>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>): IterableIterator<[number, T]>;
/**
* Returns an list of keys in the array
*/
* Returns an list of keys in the array
*/
keys<T>(array: ArrayLike<T>): IterableIterator<number>;
/**
* Returns an list of values in the array
*/
* Returns an list of values in the array
*/
values<T>(array: ArrayLike<T>): IterableIterator<T>;
/**
* 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<T>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>, 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<T>(array: ArrayLike<T>, target: number, start: number, end?: number): T[];
includes<T>(array: ArrayLike<T>, 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<T>(target: T, mixin: any): T;
/**
* Non-standard.
*/
* Non-standard.
*/
make<T>(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<T> {
/**
* Non-standard.
*/
* Non-standard.
*/
turn<U>(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<T> {
interface Number {
/**
* Non-standard.
*/
* Non-standard.
*/
[Symbol.iterator](): IterableIterator<number>;
}
@ -438,13 +438,13 @@ interface Number {
interface String {
/**
* Non-standard.
*/
* Non-standard.
*/
escapeHTML(): string;
/**
* Non-standard.
*/
* Non-standard.
*/
unescapeHTML(): string;
}

View File

@ -84,5 +84,5 @@ declare namespace HtmlWebpackPlugin {
/** @deprecated use MinifyOptions */
type MinifyConfig = MinifyOptions;
/** @deprecated use Options */
type Config = Options;
type Config = Options;
}

View File

@ -7,24 +7,24 @@ declare namespace md5 {
type message = string | any[] | Uint8Array | ArrayBuffer;
interface Md5 {
array: () => number[];
arrayBuffer: () => ArrayBuffer;
buffer: () => ArrayBuffer;
digest: () => number[];
hex: () => string;
toString: () => string;
update: (message: message) => Md5;
array(): number[];
arrayBuffer(): ArrayBuffer;
buffer(): ArrayBuffer;
digest(): number[];
hex(): string;
toString(): string;
update(message: message): Md5;
}
interface md5 {
(message: message): string;
hex: (message: message) => string;
array: (message: message) => number[];
digest: (message: message) => number[];
arrayBuffer: (message: message) => ArrayBuffer;
buffer: (message: message) => ArrayBuffer;
create: () => Md5;
update: (message: message) => Md5;
hex(message: message): string;
array(message: message): number[];
digest(message: message): number[];
arrayBuffer(message: message): ArrayBuffer;
buffer(message: message): ArrayBuffer;
create(): Md5;
update(message: message): Md5;
}
}

View File

@ -1,16 +1,22 @@
{
"extends": "../tslint.json",
"rules": {
"adjacent-overload-signatures": false,
"align": false,
"array-type": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"ban-types": false,
"eofline": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"no-empty-interface": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"one-line": false,
"one-variable-per-declaration": false,
"prefer-const": false,
"semicolon": false,
"triple-equals": false,

View File

@ -3,7 +3,7 @@
// Definitions by: Pascal Birchler <https://github.com/swissspidy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace massive {
export namespace massive {
interface ConnectionOptions {
connectionString?: string;
db?: string;
@ -11,10 +11,9 @@ declare namespace massive {
interface Doc {
findDoc(context: any, callback: ResultCallback): void;
searchDoc(options: {
keys: string[];
term: string;
}, callback: ResultCallback): void;
searchDoc(
options: { keys: string[], term: string },
callback: ResultCallback): void;
saveDoc(context: string, callback: ResultCallback): void;
destroy(context: any, callback: ResultCallback): void;
}
@ -32,7 +31,7 @@ declare namespace massive {
}
interface QueryFunction {
find: (params: any|any[], callback: ResultCallback) => void;
find(params: any|any[], callback: ResultCallback): void;
}
interface QueryArguments {
@ -52,16 +51,16 @@ export interface Massive {
practice: Table;
practicesession: Table;
sport: Table;
testdata: (callback: ResultCallback) => void;
testdata(callback: ResultCallback): void;
team: Table;
teammember: Table;
teamsport: Table;
scriptsDir: string;
connectionString: string;
query: () => void;
stream: () => void;
executeSqlFile: (args: any, next: ResultCallback) => void;
end: () => void;
query(): void;
stream(): void;
executeSqlFile(args: any, next: ResultCallback): void;
end(): void;
tables: Array<massive.Doc|Table>;
views: any[];
queryFiles: massive.QueryFile[];

View File

@ -2,4 +2,4 @@ import * as Massive from 'massive';
Massive.connect({connectionString: 'foo'}, (err: Error, db: Massive.Massive) => {});
Massive.run('foo', 123, (err: Error, db: Massive.Massive) => {});
Massive.run('foo', 123, (err: Error, db: Massive.Massive) => {});

View File

@ -4,13 +4,12 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface NavigoHooks {
before?: ((done: (suppress?: boolean) => void) => void);
after?: () => void;
before?(done: (suppress?: boolean) => void): void;
after?(): void;
}
type RouteHandler = ((parametersObj: any, query: string) => void) | { as: string; uses: (parametersObj: any) => void };
type RouteHandler = ((parametersObj: any, query: string) => void) | { as: string; uses(parametersObj: any): void };
declare class Navigo {
/**
* Constructs the router
* @param root The main URL of your application.
@ -18,7 +17,6 @@ declare class Navigo {
*/
constructor(root?: string | null, useHash?: boolean);
on(location: string, handler: RouteHandler, hooks?: NavigoHooks): Navigo;
on(location: RegExp, handler: (...parameters: string[]) => void, hooks?: NavigoHooks): Navigo;
on(routes: { [key: string]: RouteHandler }): Navigo;
@ -46,4 +44,4 @@ declare class Navigo {
destroy(): void;
}
export = Navigo;
export as namespace Navigo;
export as namespace Navigo;

View File

@ -1,9 +1,9 @@
import Navigo = require("navigo");
var root = null;
var useHash = false;
const root = null;
const useHash = false;
var router = new Navigo(root, useHash);
let router = new Navigo(root, useHash);
router
.on('/products/list', () => {
@ -33,7 +33,7 @@ router
'products/:id': () => {
// do something
},
'products': () => {
products: () => {
// do something
},
'*': () => {
@ -42,7 +42,6 @@ router
})
.resolve();
router
.on('/user/:id/:action', (params: { id: string; action: string }) => {
// If we have http://site.com/user/42/save as a url then
@ -89,7 +88,7 @@ router.navigate('/products/list');
router.navigate('http://site.com/products/list', true);
router = new Navigo('http://site.com/', true);
var handler = () => {
const handler = () => {
// do something
};
router.on({
@ -97,7 +96,7 @@ router.on({
'/trip/save': { as: 'trip.save', uses: handler },
'/trip/:action/:tripId': { as: 'trip.action', uses: handler }
});
var a: string = (router.generate('trip.edit', { tripId: 42 })); // --> /trip/42/edit
let a: string = (router.generate('trip.edit', { tripId: 42 })); // --> /trip/42/edit
a = (router.generate('trip.action', { tripId: 42, action: 'save' })); // --> /trip/save/42
a = (router.generate('trip.save')); // --> /trip/save

View File

@ -1,13 +1,12 @@
import HID = require('node-hid');
var devices = HID.devices();
const devices = HID.devices();
let device = new HID.HID("path");
var device = new HID.HID("path");
var device = new HID.HID(12, 22);
device = new HID.HID(12, 22);
device.on("data", data => {});
device.on("error", err => {});
device.write([0x00, 0x01, 0x01, 0x05, 0xff, 0xff]);
device.write([0x00, 0x01, 0x01, 0x05, 0xff, 0xff]);

View File

@ -42,7 +42,6 @@ phonon.navigator().changePage('page-name', 'optional-parameter');
let page: string = phonon.navigator().currentPage;
page = phonon.navigator().previousPage;
let ev = document.createEvent('');
document.on('pagecreated', event => {
console.log('global state pagecreated: ' + event.detail.page);
@ -71,7 +70,7 @@ phonon.i18n().getPreference();
phonon.i18n().getLocale();
// Code examples from http://phonon.quarkdev.com/docs/ajax
var req = phonon.ajax({
const req = phonon.ajax({
method: 'GET',
url: 'http://mysite.com/api/',
crossDomain: true,
@ -127,7 +126,7 @@ phonon.sidePanel('#side-panel-id').close();
let pAlert = phonon.alert("text", "title", true, "textOk");
pAlert.on('confirm', () => {});
var pconfirm = phonon.confirm("text", "title", true, "textOk", "textCancel");
const pconfirm = phonon.confirm("text", "title", true, "textOk", "textCancel");
pconfirm.on('confirm', () => {});
pconfirm.on('cancel', () => {});
@ -166,8 +165,8 @@ popover.setList([
}
]);
popover.setList(['a', 'b', 'c'], item => {
var text = typeof item === 'string' ? item : item.text;
var value = typeof item === 'string' ? item : item.value;
const text = typeof item === 'string' ? item : item.text;
const value = typeof item === 'string' ? item : item.value;
return '<li><a class="padded-list" data-value="' + value + '">' + text + '</a></li>';
});
@ -196,7 +195,6 @@ popover = phonon.popover()
phonon.preloader('#my-preloader').show();
phonon.preloader('#my-preloader').hide();
// Code examples from http://phonon.quarkdev.com/docs/tabs
let tabNumber = 2;
phonon.tab().setCurrentTab('pageName', tabNumber);
@ -219,8 +217,8 @@ let app = phonon.navigator();
app.on({page: 'home', preventClose: false, content: null});
app.on({page: 'pagetwo', preventClose: true, content: 'pagetwo.html', readyDelay: 1}, activity => {
let action: string | null = null;
var onAction = (evt: any) => {
var target = evt.target;
const onAction = (evt: any) => {
const target = evt.target;
action = 'ok';
if (target.getAttribute('data-order') === 'order') {
phonon.alert('Thank you for your order!', 'Dear customer');
@ -272,7 +270,7 @@ phonon.options({
}
});
var app2 = phonon.navigator();
const app2 = phonon.navigator();
app2.on({page: 'home', content: 'home.html'});
app2.on({page: 'pagedialog', content: 'pagedialog.html'}, activity => {
activity.onCreate(() => {
@ -299,7 +297,7 @@ app2.on({page: 'pagedialog', content: 'pagedialog.html'}, activity => {
const showPrompt = document.querySelector('#show-prompt');
if (showPrompt) {
showPrompt.on('tap', () => {
var prompt = phonon.prompt('Example', 'Hello');
const prompt = phonon.prompt('Example', 'Hello');
prompt.on('confirm', value => {
phonon.alert(value, 'Inserted Value');
});
@ -417,7 +415,7 @@ phonon.navigator().on({ page: 'home' }, activity => {
const input = document.querySelector( '#searchJS' );
let list = '';
// external autocomplete
var req = phonon.ajax({
const req = phonon.ajax({
method: "GET",
url: 'https://restcountries.eu/rest/v1/lang/en',
dataType: "json",
@ -461,7 +459,7 @@ app3.on({page: 'home', content: null}, activity => {
element = document.querySelector('#show-confirm');
if (element) {
element.on('tap', () => {
var confirm = phonon.confirm('Example', 'Hello');
const confirm = phonon.confirm('Example', 'Hello');
confirm.on('confirm', () => {
phonon.alert('Confirmed!');
});
@ -474,7 +472,7 @@ app3.on({page: 'home', content: null}, activity => {
element = document.querySelector('#show-prompt');
if (element) {
element.on('tap', () => {
var prompt = phonon.prompt('Example', 'Hello');
const prompt = phonon.prompt('Example', 'Hello');
prompt.on('confirm', value => {
phonon.alert(value, 'Inserted Value');
});
@ -487,7 +485,7 @@ app3.on({page: 'home', content: null}, activity => {
element = document.querySelector('#show-indicator');
if (element) {
element.on('tap', () => {
var indicator = phonon.indicator('Please wait 3 seconds', false);
const indicator = phonon.indicator('Please wait 3 seconds', false);
window.setTimeout(() => {
indicator.close();
}, 3000);
@ -523,9 +521,9 @@ function setupHTML() {
phonon.i18n().bind();
}
var setPreference = (evt: any) => {
var target = evt.target;
var lang = target.getAttribute('data-l');
const setPreference = (evt: any) => {
const target = evt.target;
const lang = target.getAttribute('data-l');
if (lang) {
phonon.updateLocale(lang);
}

View File

@ -490,9 +490,11 @@ declare class SparkPost {
* @param options The create options. If true, directly overwrite the existing published template. If false, create a new draft
* @param callback The request callback with template id results
*/
update(id: string, template: SparkPost.UpdateTemplate, options: {
update_published?: boolean;
}, callback: SparkPost.ResultsCallback<{ id: string }>): void;
update(
id: string,
template: SparkPost.UpdateTemplate,
options: { update_published?: boolean },
callback: SparkPost.ResultsCallback<{ id: string }>): void;
/**
* Update an existing template
*
@ -500,7 +502,9 @@ declare class SparkPost {
* @param {SparkPost.UpdateTemplate} template an object of [template attributes]{@link https://developers.sparkpost.com/api/templates#header-template-attributes}
* @param {SparkPost.ResultsCallback<{ id: string }>} callback The request callback with template id results
*/
update(id: string, template: SparkPost.UpdateTemplate,
update(
id: string,
template: SparkPost.UpdateTemplate,
callback: SparkPost.ResultsCallback<{ id: string }>): void;
/**
* Update an existing template
@ -759,12 +763,12 @@ declare class SparkPost {
* @param options An optional limit that specifies the maximum number of results to return. Defaults to 1000
* @param callback The request callback with status results
*/
getBatchStatus(id: string, options: { limit?: number }, callback: SparkPost.ResultsCallback<{
getBatchStatus(id: string, options: { limit?: number }, callback: SparkPost.ResultsCallback<Array<{
batch_id: string;
ts: string;
attempts: number;
response_code: number;
}[]>): void;
}>>): void;
/**
* Gets recent status information about a webhook.
*
@ -776,12 +780,12 @@ declare class SparkPost {
* response_code: number;
* }[]>} callback The request callback with status results
*/
getBatchStatus(id: string, callback: SparkPost.ResultsCallback<{
getBatchStatus(id: string, callback: SparkPost.ResultsCallback<Array<{
batch_id: string;
ts: string;
attempts: number;
response_code: number;
}[]>): void;
}>>): void;
/**
* Gets recent status information about a webhook.
*
@ -794,12 +798,12 @@ declare class SparkPost {
* response_code: number;
* }[]>} The status results
*/
getBatchStatus(id: string, options: { limit?: number }): SparkPost.ResultsPromise<{
getBatchStatus(id: string, options: { limit?: number }): SparkPost.ResultsPromise<Array<{
batch_id: string;
ts: string;
attempts: number;
response_code: number;
}[]>;
}>>;
/**
* Lists descriptions of the events, event types, and event fields that could be included in a Webhooks post to your target URL.
* @param callback The request callback containing documentation results
@ -852,44 +856,41 @@ declare class SparkPost {
}
declare namespace SparkPost {
export interface ErrorWithDescription {
interface ErrorWithDescription {
message: string;
code: string;
description: string;
}
export interface ErrorWithParam {
interface ErrorWithParam {
message: string;
param: string;
value: string | null;
}
export interface SparkPostError extends Error {
interface SparkPostError extends Error {
name: "SparkPostError";
errors: ErrorWithDescription[] | ErrorWithParam[];
statusCode: number;
}
export interface ConstructorOptions {
interface ConstructorOptions {
origin?: string;
endpoint?: string;
apiVersion?: string;
headers?: any;
}
export interface Response<T> extends Http.IncomingMessage {
interface Response<T> extends Http.IncomingMessage {
body: T;
}
export interface Callback<T> {
(err: Error | SparkPostError | null, res: Response<T>): void;
}
export type ResultsCallback<T> = Callback<{ results: T }>;
export type ResultsPromise<T> = Promise<{ results: T }>;
type Callback<T> = (err: Error | SparkPostError | null, res: Response<T>) => void;
type ResultsCallback<T> = Callback<{ results: T }>;
type ResultsPromise<T> = Promise<{ results: T }>;
export interface Domain {
interface Domain {
domain: string;
}
export interface MessageEvent {
interface MessageEvent {
/** Type of event this record describes */
type: string;
/** Classification code for a given message (see [Bounce Classification Codes](https://support.sparkpost.com/customer/portal/articles/1929896)) */
@ -940,7 +941,7 @@ declare namespace SparkPost {
transmission_id: string;
}
export interface MessageEventParameters {
interface MessageEventParameters {
/** delimited list of bounce classification codes to search. (See Bounce Classification Codes.) */
bounce_classes?: Array<string | number> | string | number;
/** delimited list of campaign IDs to search (i.e. the campaign id used during creation of a transmission). */
@ -975,14 +976,14 @@ declare namespace SparkPost {
transmission_ids?: string[] | string;
}
export interface RecipientListMetadata {
interface RecipientListMetadata {
total_rejected_recipients: number;
total_accepted_recipients: number;
id: string;
name: string;
}
export interface RecipientList {
interface RecipientList {
/** Short, unique, recipient list identifier */
id: string;
/** Short, pretty/readable recipient list display name, not required to be unique */
@ -994,12 +995,12 @@ declare namespace SparkPost {
/** Number of accepted recipients */
total_accepted_recipients: number;
}
export interface RecipientListWithRecipients extends RecipientList {
interface RecipientListWithRecipients extends RecipientList {
/** Array of recipient objects */
recipients: Recipient[];
}
export interface CreateRecipientList {
interface CreateRecipientList {
/** Short, unique, recipient list identifier */
id?: string;
/** Short, pretty/readable recipient list display name, not required to be unique */
@ -1013,7 +1014,7 @@ declare namespace SparkPost {
/** Array of recipient objects */
recipients: Recipient[];
}
export interface UpdateRecipientList {
interface UpdateRecipientList {
/** Short, unique, recipient list identifier */
id?: string;
/** Short, pretty/readable recipient list display name, not required to be unique */
@ -1026,7 +1027,7 @@ declare namespace SparkPost {
recipients: Recipient[];
}
export interface BaseRecipient {
interface BaseRecipient {
/** SparkPost Enterprise API only. Email to use for envelope FROM. */
return_path?: string;
/** Array of text labels associated with a recipient. */
@ -1036,11 +1037,11 @@ declare namespace SparkPost {
/** Key/value pairs associated with a recipient that are provided to the substitution engine. */
substitution_data?: any;
}
export interface RecipientWithAddress {
interface RecipientWithAddress {
/** Address information for a recipient At a minimum, address or multichannel_addresses is required. */
address: Address | string;
}
export interface RecipientWithMultichannelAddresses {
interface RecipientWithMultichannelAddresses {
/**
* Address information for a recipient. At a minimum, address or multichannel_addresses is required.
* If both address and multichannel_addresses are specified only multichannel_addresses will be used.
@ -1058,9 +1059,9 @@ declare namespace SparkPost {
*/
multichannel_addresses: MultichannelAddress[];
}
export type Recipient = (RecipientWithAddress | RecipientWithMultichannelAddresses) & BaseRecipient;
type Recipient = (RecipientWithAddress | RecipientWithMultichannelAddresses) & BaseRecipient;
export interface Address {
interface Address {
/** Valid email address */
email: string;
/** User-friendly name for the email address */
@ -1069,7 +1070,7 @@ declare namespace SparkPost {
header_to?: string;
}
export interface MultichannelAddress {
interface MultichannelAddress {
/** The communication channel used to reach recipient. Valid values are “email”, “gcm”, “apns”. */
channel: string;
/** Valid email address. Required if channel is “email”. */
@ -1084,7 +1085,7 @@ declare namespace SparkPost {
app_id: string;
}
export interface RelayWebhook {
interface RelayWebhook {
/** User-friendly name no example: Inbound Customer Replies */
name?: string;
/** URL of the target to which to POST relay batches */
@ -1095,7 +1096,7 @@ declare namespace SparkPost {
match: Match;
}
export interface UpdateRelayWebhook {
interface UpdateRelayWebhook {
/** User-friendly name no example: Inbound Customer Replies */
name?: string;
/** URL of the target to which to POST relay batches */
@ -1106,7 +1107,7 @@ declare namespace SparkPost {
match?: Match;
}
export interface Match {
interface Match {
/** Inbound messaging protocol associated with this webhook. Defaults to “SMTP” */
protocol?: string;
/** Inbound domain associated with this webhook. Required when protocol is “SMTP”. */
@ -1115,7 +1116,7 @@ declare namespace SparkPost {
esme_address?: string;
}
export interface SendingDomain {
interface SendingDomain {
/** Name of the sending domain. */
domain: string;
/** Associated tracking domain. */
@ -1132,7 +1133,7 @@ declare namespace SparkPost {
shared_with_subaccounts: boolean;
}
export interface CreateSendingDomain {
interface CreateSendingDomain {
/** Name of the sending domain. */
domain: string;
/** Associated tracking domain. */
@ -1149,7 +1150,7 @@ declare namespace SparkPost {
shared_with_subaccounts?: boolean;
}
export interface UpdateSendingDomain {
interface UpdateSendingDomain {
/** Associated tracking domain. */
tracking_domain?: string;
/** JSON object in which DKIM key configuration is defined. */
@ -1162,7 +1163,7 @@ declare namespace SparkPost {
shared_with_subaccounts?: boolean;
}
export interface DKIM {
interface DKIM {
/** Signing Domain Identifier (SDID). SparkPost Enterprise API only. */
signing_domain?: string;
/** DKIM private key. */
@ -1175,7 +1176,7 @@ declare namespace SparkPost {
headers?: string;
}
export interface Status {
interface Status {
/** Whether domain ownership has been verified */
ownership_verified: boolean;
/** Verification status of SPF configuration */
@ -1190,7 +1191,7 @@ declare namespace SparkPost {
postmaster_at_status: "valid" | "invalid" | "unverified" | "pending";
}
export interface VerifyOptions {
interface VerifyOptions {
/**
* Request verification of DKIM record
*
@ -1236,14 +1237,14 @@ declare namespace SparkPost {
abuse_at_token?: string;
}
export interface VerifyResults extends Status {
interface VerifyResults extends Status {
dns?: {
dkim_record: string;
spf_record: string;
};
}
export interface CreateSubaccount {
interface CreateSubaccount {
/** user-friendly name */
name: string;
/** user-friendly identifier for subaccount API key */
@ -1256,14 +1257,14 @@ declare namespace SparkPost {
ip_pool?: string;
}
export interface CreateSubaccountResponse {
interface CreateSubaccountResponse {
subaccount_id: number;
key: string;
label: string;
short_key: string;
}
export interface UpdateSubaccount {
interface UpdateSubaccount {
/** user-friendly name */
name: string;
/** status of the subaccount */
@ -1272,7 +1273,7 @@ declare namespace SparkPost {
ip_pool?: string;
}
export interface SubaccountInformation {
interface SubaccountInformation {
/** ID of subaccount */
id: number;
/** User friendly identifier for a specific subaccount */
@ -1284,7 +1285,7 @@ declare namespace SparkPost {
compliance_status: string;
}
export interface CreateSupressionListEntry {
interface CreateSupressionListEntry {
/**
* Email address to be suppressed
*
@ -1329,7 +1330,7 @@ declare namespace SparkPost {
description?: string;
}
export interface SupressionListEntry {
interface SupressionListEntry {
/**
* Email address to be suppressed
*
@ -1372,7 +1373,7 @@ declare namespace SparkPost {
updated: string;
}
export interface SupressionSearchParameters {
interface SupressionSearchParameters {
/** Datetime the entries were last updated, in the format of YYYY-MM-DDTHH:mm:ssZ */
to?: string;
/** Datetime the entries were last updated, in the format YYYY-MM-DDTHH:mm:ssZ */
@ -1431,7 +1432,7 @@ declare namespace SparkPost {
limit?: number;
}
export interface TemplateContent {
interface TemplateContent {
/** HTML content for the emails text/html MIME part */
html: string;
/** Text content for the emails text/plain MIME part */
@ -1452,7 +1453,7 @@ declare namespace SparkPost {
headers?: any;
}
export interface CreateTemplateContent {
interface CreateTemplateContent {
/** HTML content for the emails text/html MIME part */
html?: string;
/** Text content for the emails text/plain MIME part */
@ -1473,7 +1474,7 @@ declare namespace SparkPost {
headers?: any;
}
export interface TemplateMeta {
interface TemplateMeta {
/** Unique template ID */
id: string;
/** Template name */
@ -1484,7 +1485,7 @@ declare namespace SparkPost {
description: string;
}
export interface Template {
interface Template {
/**
* Short, unique, alphanumeric ID used to reference the template.
* At a minimum, id or name is required upon creation.
@ -1511,7 +1512,7 @@ declare namespace SparkPost {
last_use?: string;
}
export interface CreateTemplate {
interface CreateTemplate {
/**
* Short, unique, alphanumeric ID used to reference the template.
* At a minimum, id or name is required upon creation.
@ -1534,7 +1535,7 @@ declare namespace SparkPost {
options?: CreateTemplateOptions;
}
export interface UpdateTemplate {
interface UpdateTemplate {
/** Content that will be used to construct a message yes For a full description, see the Content Attributes. Maximum length - 20 MBs */
content?: CreateTemplateContent | { email_rfc822: string };
/** Whether the template is published or is a draft version no - defaults to false A template cannot be changed from published to draft. */
@ -1547,7 +1548,7 @@ declare namespace SparkPost {
options?: CreateTemplateOptions;
}
export interface TemplateOptions {
interface TemplateOptions {
/** Enable or disable open tracking */
open_tracking: boolean;
/** Enable or disable click tracking */
@ -1556,7 +1557,7 @@ declare namespace SparkPost {
transactional: boolean;
}
export interface CreateTemplateOptions {
interface CreateTemplateOptions {
/** Enable or disable open tracking */
open_tracking?: boolean;
/** Enable or disable click tracking */
@ -1565,7 +1566,7 @@ declare namespace SparkPost {
transactional?: boolean;
}
export interface CreateTransmission {
interface CreateTransmission {
/** JSON object in which transmission options are defined */
options?: TransmissionOptions;
/**
@ -1598,7 +1599,7 @@ declare namespace SparkPost {
content: InlineContent | { template_id: string, use_draft_template?: boolean } | { email_rfc822: string };
}
export interface TransmissionSummary {
interface TransmissionSummary {
/** ID of the transmission */
id: string;
/** State of the transmission */
@ -1611,7 +1612,7 @@ declare namespace SparkPost {
content: { template_id: string };
}
export interface Transmission {
interface Transmission {
/** ID of the transmission */
id: string;
/** State of the transmission */
@ -1638,7 +1639,7 @@ declare namespace SparkPost {
rcpt_list_total_chunks: number;
}
export interface TransmissionOptions {
interface TransmissionOptions {
/** Delay generation of messages until this datetime. */
start_time?: string;
/** Whether open tracking is enabled for this transmission */
@ -1657,7 +1658,7 @@ declare namespace SparkPost {
inline_css?: boolean;
}
export interface InlineContent {
interface InlineContent {
/** HTML content for the emails text/html MIME part At a minimum, html, text, or push is required. */
html?: string;
/** Text content for the emails text/plain MIME part At a minimum, html, text, or push is required. */
@ -1678,14 +1679,14 @@ declare namespace SparkPost {
inline_images?: Attachment[];
}
export interface PushData {
interface PushData {
/** payload for APNs messages */
apns?: any;
/** payload for GCM messages */
gcm?: any;
}
export interface Attachment {
interface Attachment {
/**
* The MIME type of the attachment; e.g., text/plain, image/jpeg, audio/mp3, video/mp4, application/msword, application/pdf, etc.,
* including the charset parameter (text/html; charset=UTF-8) if needed.
@ -1708,7 +1709,7 @@ declare namespace SparkPost {
data: string;
}
export interface Webhook {
interface Webhook {
/** User-friendly name for webhook */
name: string;
/** URL of the target to which to POST event batches */
@ -1733,7 +1734,7 @@ declare namespace SparkPost {
auth_token?: string;
}
export interface UpdateWebhook {
interface UpdateWebhook {
/** User-friendly name for webhook */
name?: string;
/** URL of the target to which to POST event batches */
@ -1751,15 +1752,15 @@ declare namespace SparkPost {
auth_token?: string;
}
export interface WebhookLinks {
links: {
interface WebhookLinks {
links: Array<{
href: string;
rel: string;
method: string[];
}[];
}>;
}
export interface CreateOpts {
interface CreateOpts {
/**
* Domain (or subdomain) name for which SparkPost will receive inbound emails
*

View File

@ -6,7 +6,7 @@ let client = new SparkPost(key);
// Callback
client.get({
uri: "metrics/domains"
}, function(err, data) {
}, (err, data) => {
if (err) {
console.log(err);
return;
@ -27,7 +27,7 @@ client.get({
});
// Callback
client.inboundDomains.create({ domain: 'example1.com' }, function(err, res) {
client.inboundDomains.create({ domain: 'example1.com' }, (err, res) => {
if (err) {
console.log(err);
} else {
@ -48,7 +48,7 @@ client.inboundDomains.create({ domain: 'example1.com' })
});
// Callback
client.inboundDomains.delete("example1.com", function(err, res) {
client.inboundDomains.delete("example1.com", (err, res) => {
if (err) {
console.log(err);
} else {
@ -69,7 +69,7 @@ client.inboundDomains.delete('example1.com')
});
// Callback
client.inboundDomains.get("example1.com", function(err, res) {
client.inboundDomains.get("example1.com", (err, res) => {
if (err) {
console.log(err);
} else {
@ -90,7 +90,7 @@ client.inboundDomains.get('example1.com')
});
// Callback
client.inboundDomains.list(function(err, res) {
client.inboundDomains.list((err, res) => {
if (err) {
console.log(err);
} else {
@ -111,7 +111,7 @@ client.inboundDomains.list()
});
// Callback
client.messageEvents.search({}, function(err, res) {
client.messageEvents.search({}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -124,7 +124,7 @@ client.messageEvents.search({}, function(err, res) {
client.messageEvents.search({
events: "click",
campaign_ids: "monday_mailshot"
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -141,7 +141,7 @@ client.messageEvents.search({
per_page: 5,
events: ["bounce", "out_of_band"],
bounce_classes: [10]
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -212,7 +212,7 @@ client.recipientLists.create({
}
}
]
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -251,7 +251,7 @@ client.recipientLists.create({
});
// Callback
client.recipientLists.delete("UNIQUE_TEST_ID", function(err, res) {
client.recipientLists.delete("UNIQUE_TEST_ID", (err, res) => {
if (err) {
console.log(err);
} else {
@ -272,7 +272,7 @@ client.recipientLists.delete('UNIQUE_TEST_ID')
});
// Callback
client.recipientLists.list(function(err, res) {
client.recipientLists.list((err, res) => {
if (err) {
console.log(err);
} else {
@ -293,7 +293,7 @@ client.recipientLists.list()
});
// Callback
client.recipientLists.get('UNIQUE_TEST_ID', function(err, res) {
client.recipientLists.get('UNIQUE_TEST_ID', (err, res) => {
if (err) {
console.log(err);
} else {
@ -305,7 +305,7 @@ client.recipientLists.get('UNIQUE_TEST_ID', function(err, res) {
// Callback
client.recipientLists.get('UNIQUE_TEST_ID', {
show_recipients: true
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -356,7 +356,7 @@ client.recipientLists.update('EXISTING_TEST_ID', {
}
}
]
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -399,7 +399,7 @@ client.relayWebhooks.create({
match: {
domain: "inbound.example.com"
}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -426,7 +426,7 @@ client.relayWebhooks.create({
});
// Callback
client.relayWebhooks.delete("123456789", function(err, res) {
client.relayWebhooks.delete("123456789", (err, res) => {
if (err) {
console.log(err);
} else {
@ -447,7 +447,7 @@ client.relayWebhooks.delete('123456789')
});
// Callback
client.relayWebhooks.get('123456789', function(err, res) {
client.relayWebhooks.get('123456789', (err, res) => {
if (err) {
console.log(err);
} else {
@ -467,7 +467,7 @@ client.relayWebhooks.get('123456789')
console.log(err);
});
client.relayWebhooks.list(function(err, res) {
client.relayWebhooks.list((err, res) => {
if (err) {
console.log(err);
} else {
@ -490,7 +490,7 @@ client.relayWebhooks.list()
// Callback
client.relayWebhooks.update('123456789', {
target: "http://client.test.com/test-webhook"
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -516,12 +516,12 @@ client.relayWebhooks.update('123456789', {
client.sendingDomains.create({
domain: "example1.com",
dkim: {
"private": "MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/==",
"public": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==",
private: "MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/==",
public: "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==",
selector: "brisbane",
headers: "from:to:subject:date"
}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -534,8 +534,8 @@ client.sendingDomains.create({
client.sendingDomains.create({
domain: 'example1.com',
dkim: {
'private': 'MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/==',
'public': 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==',
private: 'MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/==',
public: 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==',
selector: 'brisbane',
headers: 'from:to:subject:date'
}
@ -550,7 +550,7 @@ client.sendingDomains.create({
});
// Callback
client.sendingDomains.delete("example1.com", function(err, data) {
client.sendingDomains.delete("example1.com", (err, data) => {
if (err) {
console.log(err);
} else {
@ -571,7 +571,7 @@ client.sendingDomains.delete('example1.com')
});
// Callback
client.sendingDomains.list(function(err, res) {
client.sendingDomains.list((err, res) => {
if (err) {
console.log(err);
} else {
@ -592,7 +592,7 @@ client.sendingDomains.list()
});
// Callback
client.sendingDomains.get('example1.com', function(err, res) {
client.sendingDomains.get('example1.com', (err, res) => {
if (err) {
console.log(err);
} else {
@ -615,12 +615,12 @@ client.sendingDomains.get('example1.com')
// Callback
client.sendingDomains.update('example1.com', {
dkim: {
"private": "MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/Y1g==",
"public": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==",
private: "MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/Y1g==",
public: "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==",
selector: "hello_selector",
headers: "from:to:subject:date"
}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -631,8 +631,8 @@ client.sendingDomains.update('example1.com', {
client.sendingDomains.update('example1.com', {
dkim: {
'private': 'MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/Y1g==',
'public': 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==',
private: 'MIICXgIBAAKBgQC+W6scd3XWwvC/hPRksfDYFi3ztgyS9OSqnnjtNQeDdTSD1DRx/Y1g==',
public: 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+W6scd3XWwvC/==',
selector: 'hello_selector',
headers: 'from:to:subject:date'
}
@ -652,7 +652,7 @@ client.sendingDomains.verify('example1.com', {
spf_verify: true,
abuse_at_verify: true,
postmaster_at_verify: true
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -664,7 +664,7 @@ client.sendingDomains.verify('example1.com', {
// Callback
client.sendingDomains.verify('example1.com', {
dkim_verify: false
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -697,7 +697,7 @@ client.subaccounts.create({
"smtp/inject",
"transmissions/modify"
]
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -725,7 +725,7 @@ client.subaccounts.create({
});
// Callback
client.subaccounts.list(function(err, res) {
client.subaccounts.list((err, res) => {
if (err) {
console.log(err);
} else {
@ -746,7 +746,7 @@ client.subaccounts.list()
});
// Callback
client.subaccounts.get(123, function(err, res) {
client.subaccounts.get(123, (err, res) => {
if (err) {
console.log(err);
} else {
@ -770,7 +770,7 @@ client.subaccounts.get('123')
client.subaccounts.update('123', {
name: "Test Subaccount",
status: "suspended"
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -794,7 +794,7 @@ client.subaccounts.update('123', {
});
// Callback
client.suppressionList.delete('test@test.com', function(err, data) {
client.suppressionList.delete('test@test.com', (err, data) => {
if (err) {
console.log('Whoops! Something went wrong');
console.log(err);
@ -827,7 +827,7 @@ client.suppressionList.get('test@test.com')
});
// Callback
client.suppressionList.get('test@test.com', function(err, data) {
client.suppressionList.get('test@test.com', (err, data) => {
if (err) {
console.log('Whoops! Something went wrong');
console.log(err);
@ -857,7 +857,7 @@ client.suppressionList.list({
from: '2015-05-07T00:00:00+0000',
to: '2015-05-07T23:59:59+0000',
limit: 5
}, function(err, data) {
}, (err, data) => {
if (err) {
console.log('Whoops! Something went wrong');
console.log(err);
@ -868,7 +868,7 @@ client.suppressionList.list({
});
// Callback
client.suppressionList.list(function(err, data) {
client.suppressionList.list((err, data) => {
if (err) {
console.log('Whoops! Something went wrong');
console.log(err);
@ -900,7 +900,7 @@ client.suppressionList.upsert({
transactional: false,
non_transactional: true,
description: 'Test description 1'
}, function(err, data) {
}, (err, data) => {
if (err) {
console.log('Whoops! Something went wrong');
console.log(err);
@ -960,7 +960,7 @@ client.suppressionList.upsert([
non_transactional: false,
description: 'Test description 3'
}
], function(err, data) {
], (err, data) => {
if (err) {
console.log('Whoops! Something went wrong');
console.log(err);
@ -979,7 +979,7 @@ client.templates.create({
subject: "Test email template!",
html: "<b>This is a test email template!</b>"
}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1008,7 +1008,7 @@ client.templates.create({
});
// Callback
client.templates.delete("TEST_ID", function(err, res) {
client.templates.delete("TEST_ID", (err, res) => {
if (err) {
console.log(err);
} else {
@ -1029,7 +1029,7 @@ client.templates.delete('TEST_ID')
});
// Callback
client.templates.list(function(err, res) {
client.templates.list((err, res) => {
if (err) {
console.log(err);
} else {
@ -1052,7 +1052,7 @@ client.templates.list()
// Callback
client.templates.get('TEST_ID', {
draft: true
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1062,7 +1062,7 @@ client.templates.get('TEST_ID', {
});
// Callback
client.templates.get('TEST_ID', function(err, res) {
client.templates.get('TEST_ID', (err, res) => {
if (err) {
console.log(err);
} else {
@ -1085,7 +1085,7 @@ client.templates.get('TEST_ID')
// Callback
client.templates.preview('TEST_ID', {
substitution_data: {}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1120,7 +1120,7 @@ client.templates.update('TEST_ID', {
html: "<b>This is a published test email template! Updated!</b>"
},
}, { update_published: true },
function(err, res) {
(err, res) => {
if (err) {
console.log(err);
} else {
@ -1136,7 +1136,7 @@ client.templates.update('TEST_ID', {
subject: "Updated Test email template!",
html: "<b>This is a test email template! Updated!</b>"
}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1163,7 +1163,7 @@ client.templates.update('TEST_ID', {
});
// Callback
client.transmissions.list(function(err, res) {
client.transmissions.list((err, res) => {
if (err) {
console.log(err);
} else {
@ -1184,7 +1184,7 @@ client.transmissions.list()
client.transmissions.list({
campaign_id: "my_campaign"
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1195,7 +1195,7 @@ client.transmissions.list({
client.transmissions.list({
template_id: "my_template"
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1205,7 +1205,7 @@ client.transmissions.list({
});
// Callback
client.transmissions.get("YOUR-TRANSMISSION-KEY", function(err, res) {
client.transmissions.get("YOUR-TRANSMISSION-KEY", (err, res) => {
if (err) {
console.log(err);
} else {
@ -1238,7 +1238,7 @@ client.transmissions.send({
open_tracking: true,
click_tracking: true
}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1253,7 +1253,7 @@ client.transmissions.send({
content: {
email_rfc822: "Content-Type: text/plain\nFrom: From Envelope <from@example.com>\nSubject: Example Email\n\nHello World"
}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1310,7 +1310,7 @@ client.transmissions.send({
text: "Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n Hurry, this offer is only to {{customer_type}}\n {{sender}}",
html: "<p>Hi {{address.name}} \nSave big this Christmas in your area {{place}}! \nClick http://www.mysite.com and get huge discount\n</p>"
}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1350,7 +1350,7 @@ client.transmissions.send({
text: "An example email using bcc with SparkPost to the {{recipient_type}} recipient.",
html: "<p>An example email using bcc with SparkPost to the {{recipient_type}} recipient.</p>"
}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1388,13 +1388,13 @@ client.transmissions.send({
email: "from@example.com"
},
headers: {
"CC": "\"Carbon Copy Recipient\" <cc.recipient@example.com>"
CC: "\"Carbon Copy Recipient\" <cc.recipient@example.com>"
},
subject: "Example email using cc",
text: "An example email using cc with SparkPost to the {{recipient_type}} recipient.",
html: "<p>An example email using cc with SparkPost to the {{recipient_type}} recipient.</p>"
}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1414,7 +1414,7 @@ client.transmissions.send({
html: "<html><body><p>Hello World</p></body></html>",
text: "Hello World!"
}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1433,7 +1433,7 @@ client.transmissions.send({
subject: "Example Email for Stored List and Template",
template_id: "my-template"
}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1451,7 +1451,7 @@ client.transmissions.send({
recipients: [{ address: { email: "rick.sanchez@rickandmorty100years.com", name: "Rick Sanchez" } }]
}, {
num_rcpt_errors: 3
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1460,7 +1460,6 @@ client.transmissions.send({
}
});
// Promise
client.transmissions.send({
options: {
@ -1548,7 +1547,7 @@ client.transmissions.send({
email: 'from@example.com'
},
headers: {
'CC': '"Carbon Copy Recipient" <cc.recipient@example.com>'
CC: '"Carbon Copy Recipient" <cc.recipient@example.com>'
},
subject: 'Example email using cc',
text: 'An example email using cc with SparkPost to the {{recipient_type}} recipient.',
@ -1575,7 +1574,7 @@ client.webhooks.create({
"open",
"click"
]
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1606,7 +1605,7 @@ client.webhooks.create({
});
// Callback
client.webhooks.delete("TEST_WEBHOOK_UUID", function(err, res) {
client.webhooks.delete("TEST_WEBHOOK_UUID", (err, res) => {
if (err) {
console.log(err);
} else {
@ -1629,7 +1628,7 @@ client.webhooks.delete('TEST_WEBHOOK_UUID')
// Callback
client.webhooks.get('TEST_WEBHOOK_UUID', {
timezone: 'America/New_York'
}, function(err, data) {
}, (err, data) => {
if (err) {
console.log('Whoops! Something went wrong');
console.log(err);
@ -1655,7 +1654,7 @@ client.webhooks.get('TEST_WEBHOOK_UUID', {
// Callback
client.webhooks.getBatchStatus('TEST_WEBHOOK_UUID', {
limit: 1000
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1678,7 +1677,7 @@ client.webhooks.getBatchStatus('TEST_WEBHOOK_UUID', {
});
// Callback
client.webhooks.getDocumentation(function(err, res) {
client.webhooks.getDocumentation((err, res) => {
if (err) {
console.log(err);
} else {
@ -1701,7 +1700,7 @@ client.webhooks.getDocumentation()
// Callback
client.webhooks.getSamples({
events: "bounce"
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1724,7 +1723,7 @@ client.webhooks.getSamples({
});
// Callback
client.webhooks.list(function(err, res) {
client.webhooks.list((err, res) => {
if (err) {
console.log(err);
} else {
@ -1751,7 +1750,7 @@ client.webhooks.update('TEST_WEBHOOK_UUID', {
"policy_rejection",
"delay"
]
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {
@ -1782,7 +1781,7 @@ client.webhooks.validate('TEST_WEBHOOK_UUID', {
message: {
msys: {}
}
}, function(err, res) {
}, (err, res) => {
if (err) {
console.log(err);
} else {

View File

@ -1,8 +1 @@
{
"extends": "../tslint.json",
"rules": {
"only-arrow-functions-2": [
false
]
}
}
{ "extends": "../tslint.json" }

View File

@ -18,4 +18,3 @@ import {
export class Database extends OriginalDatabase {
spatialite(cb: (err: Error) => void): void;
}

View File

@ -1,9 +1,8 @@
import spatialite = require("spatialite");
function applySpatialFunctions() {
console.log("");
var spatialDb: spatialite.Database = new spatialite.Database('spatialite', () => {
const spatialDb: spatialite.Database = new spatialite.Database('spatialite', () => {
spatialDb.spatialite((err) => {
if (err) {
console.error(err);
@ -12,14 +11,12 @@ function applySpatialFunctions() {
});
}
// Following tests taken from the sqlite3 typings
spatialite.verbose();
// This line is enhanced to fulfill the `strictNullChecks` option
var db: spatialite.Database = new spatialite.Database('chain.sqlite3', () => {});
// var db: spatialite.Database
let db: spatialite.Database = new spatialite.Database('chain.sqlite3', () => {});
function createDb() {
console.log("createDb chain");
@ -33,9 +30,9 @@ function createTable() {
function insertRows() {
console.log("insertRows Ipsum i");
var stmt = db.prepare("INSERT INTO lorem VALUES (?)");
const stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (var i = 0; i < 10; i++) {
for (let i = 0; i < 10; i++) {
stmt.run("Ipsum " + i);
}
@ -73,8 +70,8 @@ runChainExample();
db.serialize(() => {
db.run("CREATE TABLE lorem (info TEXT)");
var stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (var i = 0; i < 10; i++) {
const stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (let i = 0; i < 10; i++) {
stmt.run("Ipsum " + i);
}
stmt.finalize();

View File

@ -8,7 +8,7 @@ declare namespace stringifyObject { }
declare function stringifyObject(o: any, options?: {
indent?: string,
singleQuotes?: boolean,
filter?: (o: any, prop: string) => boolean,
filter?(o: any, prop: string): boolean,
inlineCharacterLimit?: number
}): string;

View File

@ -1,4 +1,4 @@
import stripAnsi = require('strip-ansi');
stripAnsi('\u001b[4mcake\u001b[0m');
// => 'cake'
// => 'cake'

View File

@ -4,7 +4,7 @@ import * as express from 'express';
declare function describe(desc: string, f: () => void): void;
declare function it(desc: string, f: () => void): void;
var app = express();
const app = express();
// chain your requests like you were promised:
request(app)
@ -20,7 +20,6 @@ request(app)
// ...
});
// Usage
request(app)
.get("/kittens")
@ -29,11 +28,10 @@ request(app)
// ...
});
request(app).get("/kittens").expect(200);
// Agents
var agent = request.agent(app);
const agent = request.agent(app);
agent
.get("/ugly-kitteh")
.expect(404)
@ -41,7 +39,6 @@ agent
// ...
});
// Promisey goodness
request(app)
.get("/kittens")

View File

@ -16,12 +16,10 @@ SwaggerExpress.create(config, (err, middleware) => {
app.listen(port);
});
const swaggerSecurityHandlerCb = (err: Error) => {
// do nothing
};
const configComplex: SwaggerExpress.Config = {
appRoot: __dirname,
configDir: "some/directory",

View File

@ -1,18 +1,18 @@
import * as SwaggerHapi from "swagger-hapi";
import * as Hapi from "hapi";
var app = new Hapi.Server();
const app = new Hapi.Server();
module.exports = app; // for testing
var config = {
const config = {
appRoot: __dirname // required config
} as SwaggerHapi.Config;
SwaggerHapi.create(config, (err, swaggerHapi) => {
if (err) { throw err; }
var port = process.env.PORT || 10010;
const port = process.env.PORT || 10010;
app.connection({ port });
// app.address = function() {
// return { port };
@ -28,12 +28,10 @@ SwaggerHapi.create(config, (err, swaggerHapi) => {
});
});
const swaggerSecurityHandlerCb = (err: Error) => {
// do nothing
};
const configComplex: SwaggerHapi.Config = {
appRoot: __dirname,
configDir: "some/directory",

View File

@ -45,19 +45,19 @@ export interface Config {
/** If `true` API is in mock mode
*
* default is `false`
*/
*/
mockMode?: boolean;
/** If `true` resonse is validated
*
* default is `true`
*/
*/
validateResponse?: boolean;
/** Sets `NODE_CONFIG_DIR` env if not set yet */
configDir?: string;
/** Swagger controller directories
*
* default is array with `/api/controllers` relative to `appRoot`
*/
*/
controllersDirs?: string[];
/** Swagger mock controller directories
*
@ -126,9 +126,9 @@ interface SwaggerSecurityHandlers {
export interface Runner extends EventEmitter {
/** Resolves path (relative to `config.appRoot`) */
resolveAppPath(...to: any[]): string;
defaultErrorHandler: () => any;
defaultErrorHandler(): any;
/** Fetch a _bagpipe_ pipe */
getPipe: (req: { swagger: { path: any } }) => any;
getPipe(req: { swagger: { path: any } }): any;
config: ConfigInternal;
/**
* Current OpenAPI Specification (formaly known as Swagger RESTful API Documentation Specification)
@ -148,7 +148,7 @@ export interface Runner extends EventEmitter {
*
* @see {@link https://github.com/apigee-127/swagger-tools/blob/master/middleware/swagger-metadata.js|Git Source}
*/
swaggerMetadata: (rlOrSO: any, apiDeclarations: any[]) => SwaggerToolsMiddleware
swaggerMetadata(rlOrSO: any, apiDeclarations: any[]): SwaggerToolsMiddleware
/**
* Middleware for using Swagger information to route requests to handlers.
* @param [{any}] options - The configuration options
@ -156,14 +156,14 @@ export interface Runner extends EventEmitter {
* @see {@link https://github.com/apigee-127/swagger-tools/blob/master/docs/Middleware.md#swaggerrouteroptions|Docs}
* @see {@link https://github.com/apigee-127/swagger-tools/blob/master/middleware/swagger-router.js|Github Source}
*/
swaggerRouter: (options?: any) => SwaggerToolsMiddleware
swaggerRouter(options?: any): SwaggerToolsMiddleware
/**
* Middleware for using Swagger security information to authenticate requests.
* @param [{any}] options - The configuration options
*
* @see {@link https://github.com/apigee-127/swagger-tools/blob/master/middleware/swagger-security.js|Github Source}
*/
swaggerSecurity: (options?: SwaggerSecurityHandlers) => SwaggerToolsMiddleware
swaggerSecurity(options?: SwaggerSecurityHandlers): SwaggerToolsMiddleware
/**
* Middleware for serving the Swagger documents and Swagger UI.
*
@ -173,14 +173,14 @@ export interface Runner extends EventEmitter {
*
* @see {@link https://github.com/apigee-127/swagger-tools/blob/master/middleware/swagger-ui.js|Github Source}
*/
swaggerUi: (rlOrSO: any, apiDeclarations: any[], options?: any) => SwaggerToolsMiddleware
swaggerUi(rlOrSO: any, apiDeclarations: any[], options?: any): SwaggerToolsMiddleware
/**
* Middleware for using Swagger information to validate API requests/responses.type
* @param [{any}] options - The configuration options
*
* @see {@link https://github.com/apigee-127/swagger-tools/blob/master/middleware/swagger-validator.js|Github Source}
*/
swaggerValidator: (options?: any) => SwaggerToolsMiddleware
swaggerValidator(options?: any): SwaggerToolsMiddleware
};
swaggerSecurityHandlers: SwaggerSecurityHandlers | undefined;
/**
@ -189,15 +189,15 @@ export interface Runner extends EventEmitter {
*/
bagpipes: { [name: string]: any };
/** Create new Connect middleware */
connectMiddleware: () => ConnectMiddleware;
connectMiddleware(): ConnectMiddleware;
/** Create new Express middleware */
expressMiddleware: () => ExpressMiddleware;
expressMiddleware(): ExpressMiddleware;
/** Create new Restify middleware */
restifyMiddleware: () => RestifyMiddleware;
restifyMiddleware(): RestifyMiddleware;
/** Create new Sails middleware */
sailsMiddleware: () => SailsMiddleware;
sailsMiddleware(): SailsMiddleware;
/** Create new Hapi middleware */
hapiMiddleware: () => HapiMiddleware;
hapiMiddleware(): HapiMiddleware;
}
/** base used by all middleware versions */
@ -208,9 +208,9 @@ interface Middleware {
/** Connect/Express specific Middleware */
export interface ConnectMiddleware extends Middleware {
middleware: () => (req: Express.Request, res: Express.Response, next: NextFunction) => void;
middleware(): (req: Express.Request, res: Express.Response, next: NextFunction) => void;
/** Register this Middleware with `app` */
register: (app: Express.Application) => void;
register(app: Express.Application): void;
}
/** Express specific Middleware
*
@ -222,7 +222,7 @@ export interface ExpressMiddleware extends ConnectMiddleware { }
/** Sails specific Middleware */
export interface SailsMiddleware extends Middleware {
/** Express style middleware */
chain: () => (req: Express.Request, res: Express.Response, next: NextFunction) => void;
chain(): (req: Express.Request, res: Express.Response, next: NextFunction) => void;
}
/** Hapi specific Middleware */
@ -249,7 +249,7 @@ export interface HapiMiddleware extends Middleware {
attributes: {
/** Name of Plugin (e.g. `swagger-node-runner`) */
name: string
/** Version of Plugin*/
/** Version of Plugin */
version: string
}
}
@ -259,10 +259,9 @@ export interface HapiMiddleware extends Middleware {
/** Restify specific Middleware */
export interface RestifyMiddleware extends Middleware {
/** Register this Middleware with `app` */
register: (app: Restify.Server) => void;
register(app: Restify.Server): void;
}
/**
* Create new SwaggerNodeRunner Instance
*

View File

@ -22,7 +22,6 @@ SwaggerNodeRunner.create(config, (err, runner) => {
expressApp.listen(port);
});
// Connect middleware
const connectApp = connect();
SwaggerNodeRunner.create(config, (err, runner) => {
@ -31,11 +30,10 @@ SwaggerNodeRunner.create(config, (err, runner) => {
const connectMiddleware = runner.connectMiddleware();
connectMiddleware.register(connectApp);
var port = process.env.PORT || 10010;
const port = process.env.PORT || 10010;
connectApp.listen(port);
});
// Sails Middleware (chain) test
SwaggerNodeRunner.create(config, (err, runner) => {
if (err) { throw err; }
@ -46,13 +44,12 @@ SwaggerNodeRunner.create(config, (err, runner) => {
}
});
// Hapi Middleware
var hapiapp = new Hapi.Server();
const hapiapp = new Hapi.Server();
SwaggerNodeRunner.create(config, (err, runner) => {
if (err) { throw err; }
var port = process.env.PORT || 10010;
const port = process.env.PORT || 10010;
hapiapp.connection({ port });
// hapiapp.address = function() {
// return { port };
@ -71,7 +68,6 @@ SwaggerNodeRunner.create(config, (err, runner) => {
});
});
// Restify Middelware
const app = restify.createServer();
SwaggerNodeRunner.create(config, (err, runner) => {
@ -85,12 +81,10 @@ SwaggerNodeRunner.create(config, (err, runner) => {
app.listen(port);
});
const swaggerSecurityHandlerCb = (err: Error) => {
// do nothing
};
const configComplex: SwaggerNodeRunner.Config = {
appRoot: __dirname,
configDir: "some/directory",

View File

@ -16,12 +16,10 @@ SwaggerRestify.create(config, (err, swaggerRestify) => {
app.listen(port);
});
const swaggerSecurityHandlerCb = (err: Error) => {
// do nothing
};
const configComplex: SwaggerRestify.Config = {
appRoot: __dirname,
configDir: "some/directory",

View File

@ -21,11 +21,11 @@ declare function SwaggerHook(sails: any): SwaggerHook.SailsHook;
declare namespace SwaggerHook {
/**
* `swagger-sails-hook` object implementing the Sails' hook specification.
*
* @see {@link http://sailsjs.com/documentation/concepts/extending-sails/hooks/hook-specification|Sails Hook Docs}
* @see {@link http://sailsjs.com/documentation/anatomy/api/hooks/my-hook/index-js|Sails Hook Example}
*/
* `swagger-sails-hook` object implementing the Sails' hook specification.
*
* @see {@link http://sailsjs.com/documentation/concepts/extending-sails/hooks/hook-specification|Sails Hook Docs}
* @see {@link http://sailsjs.com/documentation/anatomy/api/hooks/my-hook/index-js|Sails Hook Example}
*/
interface SailsHook {
/**
* Perform startup tasks.

View File

@ -3,7 +3,6 @@
// Definitions by: Evan Shortiss <http://github.com/evanshortiss>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export type borderType = 'honeywell' | 'norc' | 'ramac' | 'void';
export interface ColumnConfig {
@ -39,7 +38,7 @@ export interface TableUserConfig {
columns?: {
[index: number]: ColumnConfig
};
drawJoin?: (index: number, size: number) => boolean;
drawJoin?(index: number, size: number): boolean;
border?: JoinStruct;
columnDefault?: ColumnConfig;
}

View File

@ -178,8 +178,8 @@ export function dropWhile<TResult, TInput>(pred: (input: TInput) => boolean): Tr
export class PartitionBy<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(f: (input: TInput) => any, xf: Transformer<TResult, TInput[]>);
['@@transducer/init'](): TResult;
['@@transducer/step'](result: TResult, input: TInput): TResult
['@@transducer/result'](result: TResult): TResult
['@@transducer/step'](result: TResult, input: TInput): TResult;
['@@transducer/result'](result: TResult): TResult;
}
/**
@ -192,8 +192,8 @@ export function partitionBy<TResult, TInput>(f: (input: TInput) => any): Transdu
export class PartitionAll<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(n: number, xf: Transformer<TResult, TInput[]>);
['@@transducer/init'](): TResult;
['@@transducer/step'](result: TResult, input: TInput): TResult
['@@transducer/result'](result: TResult): TResult
['@@transducer/step'](result: TResult, input: TInput): TResult;
['@@transducer/result'](result: TResult): TResult;
}
/**
@ -205,8 +205,8 @@ export function partitionAll<TResult, TInput>(n: number): Transducer<TResult, TI
export class Completing<TResult, TCompleteResult, TInput> implements CompletingTransformer<TResult, TCompleteResult, TInput> {
constructor(cf: (result: TResult) => TCompleteResult, xf: Transformer<TResult, TInput>);
['@@transducer/init'](): TResult;
['@@transducer/step'](result: TResult, input: TInput): TResult
['@@transducer/result'](result: TResult): TCompleteResult
['@@transducer/step'](result: TResult, input: TInput): TResult;
['@@transducer/result'](result: TResult): TCompleteResult;
}
/**
@ -218,8 +218,8 @@ export function completing<TResult, TCompleteResult, TInput>(cf: (result: TResul
export class Wrap<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(stepFn: Reducer<TResult, TInput>, xf: Transformer<TResult, TInput>);
['@@transducer/init'](): TResult;
['@@transducer/step'](result: TResult, input: TInput): TResult
['@@transducer/result'](result: TResult): TResult
['@@transducer/step'](result: TResult, input: TInput): TResult;
['@@transducer/result'](result: TResult): TResult;
}
/**

View File

@ -2,15 +2,12 @@
import * as t from 'transducers-js';
const map = t.map,
filter = t.filter,
comp = t.comp,
into = t.into;
const { map, filter, comp, into } = t;
// basic usage
function inc(n: number) { return n + 1; };
function isEven(n: number) { return n % 2 === 0; };
function inc(n: number) { return n + 1; }
function isEven(n: number) { return n % 2 === 0; }
let xf = comp(map(inc), filter(isEven));
into([], xf, [0, 1, 2, 3, 4]); // [2, 4]

View File

@ -19,7 +19,7 @@ declare namespace UpdateNotifier {
interface Settings {
pkg?: Package;
callback?: (update?: UpdateInfo) => any;
callback?(update?: UpdateInfo): any;
packageName?: string;
packageVersion?: string;
updateCheckInterval?: number; // in milliseconds, default 1000 * 60 * 60 * 24 (1 day)

View File

@ -1,6 +1,6 @@
import UpdateNotifier = require("update-notifier");
var notifier = UpdateNotifier();
let notifier = UpdateNotifier();
if (notifier.update) {
notifier.notify();
@ -9,7 +9,7 @@ if (notifier.update) {
console.log(notifier.update);
// Also exposed as a class
var notifier = new UpdateNotifier.UpdateNotifier({
notifier = new UpdateNotifier.UpdateNotifier({
updateCheckInterval: 1000 * 60 * 60 * 24 * 7 // 1 week
});

View File

@ -1,4 +1,4 @@
import userHome = require('user-home');
console.log(userHome);
// => '/Users/sindresorhus'
// => '/Users/sindresorhus'

View File

@ -39,7 +39,7 @@ declare namespace VError {
cause?: Error | null | undefined;
name?: string;
strict?: boolean;
constructorOpt?: (...args: any[]) => void;
constructorOpt?(...args: any[]): void;
info?: Info;
}

View File

@ -1,14 +1,14 @@
import VError = require("verror");
import { VError as VError2, MultiError, SError, WError } from "verror";
var error = new Error("foo");
var verror1 = new VError(error, "bar");
var verror2 = new VError2(error, "bar");
var serror = new SError(error, "bar");
var multiError = new MultiError([verror1, verror2]);
var werror = new WError(verror1, "foobar");
const error = new Error("foo");
const verror1 = new VError(error, "bar");
const verror2 = new VError2(error, "bar");
const serror = new SError(error, "bar");
const multiError = new MultiError([verror1, verror2]);
const werror = new WError(verror1, "foobar");
var verror3 = new VError({
const verror3 = new VError({
name: "fooError",
cause: error,
info: {
@ -16,13 +16,12 @@ var verror3 = new VError({
}
}, "bar");
var verror4 = new VError({ cause: null }, "bar");
const verror4 = new VError({ cause: null }, "bar");
var cause1: Error | undefined = verror1.cause();
var cause2: Error | undefined = werror.cause();
const cause1: Error | undefined = verror1.cause();
const cause2: Error | undefined = werror.cause();
const info: { [k: string]: any } = VError.info(verror3);
const namedCause: Error | null = VError.findCauseByName(verror3, "fooError");
const stack: string = VError.fullStack(verror3);
const cause3: Error | null = VError.cause(verror3);

View File

@ -12,7 +12,6 @@ export = videojs;
export as namespace videojs;
declare namespace videojs {
interface PlayerOptions {
techOrder?: string[];
html5?: any;

View File

@ -8,8 +8,8 @@ videojs("example_video_1").ready(function() {
this.pause();
var isPaused: boolean = this.paused();
var isPlaying: boolean = !this.paused();
const isPaused: boolean = this.paused();
const isPlaying: boolean = !this.paused();
this.src("http://www.example.com/path/to/video.mp4");
@ -21,37 +21,37 @@ videojs("example_video_1").ready(function() {
{ type: "video/ogg", src: "http://www.example.com/path/to/video.ogv" }
]);
var whereYouAt: number = this.currentTime();
const whereYouAt: number = this.currentTime();
this.currentTime(120); // 2 minutes into the video
var howLongIsThis: number = this.duration();
const howLongIsThis: number = this.duration();
var bufferedTimeRange: TimeRanges = this.buffered();
const bufferedTimeRange: TimeRanges = this.buffered();
// Number of different ranges of time have been buffered. Usually 1.
var numberOfRanges: number = bufferedTimeRange.length;
const numberOfRanges: number = bufferedTimeRange.length;
// Time in seconds when the first range starts. Usually 0.
var firstRangeStart: number = bufferedTimeRange.start(0);
const firstRangeStart: number = bufferedTimeRange.start(0);
// Time in seconds when the first range ends
var firstRangeEnd: number = bufferedTimeRange.end(0);
const firstRangeEnd: number = bufferedTimeRange.end(0);
// Length in seconds of the first time range
var firstRangeLength: number = firstRangeEnd - firstRangeStart;
const firstRangeLength: number = firstRangeEnd - firstRangeStart;
var howMuchIsDownloaded: number = this.bufferedPercent();
const howMuchIsDownloaded: number = this.bufferedPercent();
var howLoudIsIt: number = this.volume();
const howLoudIsIt: number = this.volume();
this.volume(0.5); // Set volume to half
var howWideIsIt: number = this.width();
const howWideIsIt: number = this.width();
this.width(640);
var howTallIsIt: number = this.height();
const howTallIsIt: number = this.height();
this.height(480);
@ -70,7 +70,6 @@ function testEvents(myPlayer: videojs.Player) {
// Removes the specified listener only.
myPlayer.off("error", myFunc);
const myFuncWithArg = function(this: videojs.Player, e: Event) {
// Do something when the event is fired
};

View File

@ -42,4 +42,4 @@ export function cssmin(text: string, preserveComments?: boolean): string;
/**
* Minifiy an sql string
*/
export function sqlmin(text: string): string;
export function sqlmin(text: string): string;

View File

@ -68,7 +68,6 @@ function sqlWithStringPattern() {
VKBeautify.sql(exampleContent, ' ');
}
/*
* Minifying
*
@ -116,4 +115,4 @@ function cssminAndRemoveComments() {
// sql
function sqlmin() {
VKBeautify.sqlmin(exampleContent);
}
}

View File

@ -3,9 +3,9 @@
// Definitions by: Kristian Moerch <https://github.com/kritollm/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare type AnimationEffectTimingFillMode = "none" | "forwards" | "backwards" | "both" | "auto";
declare type AnimationEffectTimingPlaybackDirection = "normal" | "reverse" | "alternate" | "alternate-reverse";
declare type AnimationPlayState = "idle" | "pending" | "running" | "paused" | "finished";
type AnimationEffectTimingFillMode = "none" | "forwards" | "backwards" | "both" | "auto";
type AnimationEffectTimingPlaybackDirection = "normal" | "reverse" | "alternate" | "alternate-reverse";
type AnimationPlayState = "idle" | "pending" | "running" | "paused" | "finished";
declare class AnimationPlaybackEvent {
constructor(target: Animation, currentTime: number, timelineTime: number);
@ -53,9 +53,7 @@ declare class KeyframeEffect {
getFrames(): AnimationKeyFrame[];
remove(): void;
}
interface AnimationEventListener {
(evt: AnimationPlaybackEvent): void;
}
type AnimationEventListener = (evt: AnimationPlaybackEvent) => void;
declare class Animation {
constructor(effect: KeyframeEffect, timeline?: AnimationTimeline);

View File

@ -33,7 +33,7 @@ function test_AnimationsApiNext() {
'scale(0)';
const steps = [
{ visibility: 'visible', opacity: 1, transform: 'none' },
{ visibility: 'visible', opacity: 0, transform: transform }
{ visibility: 'visible', opacity: 0, transform }
];
return new KeyframeEffect(target, steps, {
duration: 1500,
@ -64,9 +64,9 @@ function test_AnimationsApiNext() {
// https://developer.mozilla.org/en-US/docs/Web/API/Animation/Animation
// http://codepen.io/rachelnabors/pen/eJyWzm/?editors=0010
function test_whiteRabbit() {
var whiteRabbit = document.getElementById("rabbit");
const whiteRabbit = document.getElementById("rabbit");
if (whiteRabbit) {
var rabbitDownKeyframes = new KeyframeEffect(
const rabbitDownKeyframes = new KeyframeEffect(
whiteRabbit,
[
{ transform: 'translateY(0%)' },
@ -74,30 +74,26 @@ function test_whiteRabbit() {
],
{ duration: 3000, fill: 'forwards' }
);
var rabbitDownAnimation = new Animation(rabbitDownKeyframes, document.timeline);
const rabbitDownAnimation = new Animation(rabbitDownKeyframes, document.timeline);
// On tap or click,
whiteRabbit.addEventListener("mousedown", downHeGoes, false);
whiteRabbit.addEventListener("touchstart", downHeGoes, false);
// Trigger a single-fire animation
function downHeGoes(event: Event) {
// Remove those event listeners
whiteRabbit!.removeEventListener("mousedown", downHeGoes, false);
whiteRabbit!.removeEventListener("touchstart", downHeGoes, false);
// Play rabbit animation
rabbitDownAnimation.play();
}
}
}
// Testing onsample
// https://github.com/web-animations/web-animations-js/releases
function test_onsample_And_addEventListener() {
var elem = document.createElement("div");
const elem = document.createElement("div");
if (elem) {
elem.style.width = '150px';
elem.style.color = 'black';
@ -113,9 +109,9 @@ function test_onsample_And_addEventListener() {
};
// onsample is write only
console.log(myEffect.onsample); // => undefined
var myAnimation = document.timeline.play(myEffect);
const myAnimation = document.timeline.play(myEffect);
myAnimation.addEventListener("finish", (e) => {
console.log("finished", e);
})
});
}
}

View File

@ -109,36 +109,36 @@ interface Body {
interface URLSearchParams {
/**
* Appends a specified key/value pair as a new search parameter.
*/
* Appends a specified key/value pair as a new search parameter.
*/
append(name: string, value: string): void;
/**
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
*/
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
*/
delete(name: string): void;
/**
* Returns the first value associated to the given search parameter.
*/
* Returns the first value associated to the given search parameter.
*/
get(name: string): string | null;
/**
* Returns all the values association with a given search parameter.
*/
* Returns all the values association with a given search parameter.
*/
getAll(name: string): string[];
/**
* Returns a Boolean indicating if such a search parameter exists.
*/
* Returns a Boolean indicating if such a search parameter exists.
*/
has(name: string): boolean;
/**
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
*/
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
*/
set(name: string, value: string): void;
}
declare var URLSearchParams: {
prototype: URLSearchParams;
/**
* Constructor returning a URLSearchParams object.
*/
* Constructor returning a URLSearchParams object.
*/
new (init?: string | URLSearchParams): URLSearchParams;
};

View File

@ -71,7 +71,7 @@ function passwordPostSignInConfirmation() {
e.preventDefault();
const formElem = (e.target as HTMLFormElement);
var c = new PasswordCredential(formElem);
const c = new PasswordCredential(formElem);
fetch(formElem.action, {method: 'POST', credentials: c}).then(r => {
if (r.status === 200) {
navigator.credentials!.store(c);
@ -89,13 +89,11 @@ function federationPostSignInConfirmation() {
}
}
// The change password example from Section 1.2.4 is essentially the same
// as in 1.2.4, but the form element has different autocomplete annotations.
// Therefore, we don't duplicate it here.
// https://www.w3.org/TR/credential-management-1/#examples-change-password
// layering on top of a legacy system examples, from Section 1.2.5
// https://www.w3.org/TR/credential-management-1/#examples-legacy
function existingFormPost(credential: PasswordCredential) {

View File

@ -2,8 +2,11 @@
"extends": "../tslint.json",
"rules": {
"dt-header": false,
"align": false,
"adjacent-overload-signatures": false,
"comment-format": false,
"unified-signatures": false,
"no-consecutive-blank-lines": false,
"no-empty-interface": false
}
}

View File

@ -262,7 +262,7 @@ declare namespace webpack {
*
* Defaults to `() => true`.
*/
cachePredicate?: (data: { path: string, request: string }) => boolean;
cachePredicate?(data: { path: string, request: string }): boolean;
}
interface OldResolve {
@ -933,7 +933,6 @@ declare namespace webpack {
}
namespace loader {
interface Loader extends Function {
(this: LoaderContext, source: string | Buffer, sourceMap: string | Buffer): string | Buffer | void | undefined;
@ -968,36 +967,30 @@ declare namespace webpack {
*/
version: string;
/**
* The directory of the module. Can be used as context for resolving other stuff.
* In the example: /abc because resource.js is in this directory
*/
context: string;
/**
* The resolved request string.
* In the example: "/abc/loader1.js?xyz!/abc/node_modules/loader2/index.js!/abc/resource.js?rrr"
*/
request: string;
/**
* A string or any object. The query of the request for the current loader.
*/
query: any;
/**
* A data object shared between the pitch and the normal phase.
*/
data?: any;
callback: loaderCallback;
/**
* Make this loader async.
*/
@ -1076,7 +1069,6 @@ declare namespace webpack {
*/
exec(code: string, filename: string): any;
/**
* Resolve a request like a require expression.
* @param context
@ -1092,7 +1084,6 @@ declare namespace webpack {
*/
resolveSync(context: string, request: string): string;
/**
* Adds a file as dependency of the loader result in order to make them watchable.
* For example, html-loader uses this technique as it finds src and src-set attributes.
@ -1120,7 +1111,6 @@ declare namespace webpack {
*/
clearDependencies(): void;
/**
* Pass values to the next loader.
* If you know what your result exports if executed as module, set this value here (as a only element array).
@ -1153,7 +1143,6 @@ declare namespace webpack {
*/
sourceMap: boolean;
/**
* Target of compilation. Passed from configuration options.
* Example values: "web", "node"
@ -1169,7 +1158,6 @@ declare namespace webpack {
*/
webpack: boolean;
/**
* Emit a file. This is webpack-specific.
* @param name
@ -1178,7 +1166,6 @@ declare namespace webpack {
*/
emitFile(name: string, content: Buffer|string, sourceMap: any): void;
/**
* Access to the compilation's inputFileSystem property.
*/
@ -1194,7 +1181,6 @@ declare namespace webpack {
*/
_compiler: Compiler;
/**
* Hacky access to the Module object being loaded.
*/

View File

@ -230,8 +230,8 @@ rule = {
loader: "babel-loader"
};
declare var require: any;
declare var path: any;
declare const require: any;
declare const path: any;
configuration = {
plugins: [
function(this: webpack.Compiler) {
@ -383,9 +383,9 @@ plugin = new CommonsChunkPlugin({
});
plugin = new webpack.DefinePlugin(definitions);
plugin = new webpack.DefinePlugin({
"VERSION": JSON.stringify("5fa3b9"),
"BROWSER_SUPPORTS_HTML5": true,
"TWO": "1+1",
VERSION: JSON.stringify("5fa3b9"),
BROWSER_SUPPORTS_HTML5: true,
TWO: "1+1",
"typeof window": JSON.stringify("object")
});
plugin = new webpack.ProvidePlugin(definitions);
@ -437,7 +437,7 @@ webpack({
});
// returns a Compiler instance
var compiler = webpack({
let compiler = webpack({
// configuration
});
@ -475,8 +475,8 @@ webpack({
}, (err, stats) => {
if (err)
return handleFatalError(err);
var jsonStats = stats.toJson();
var jsonStatsWithAllOptions = stats.toJson({
const jsonStats = stats.toJson();
const jsonStatsWithAllOptions = stats.toJson({
assets: true,
assetsSort: "field",
cached: true,
@ -505,13 +505,13 @@ webpack({
successfullyCompiled();
});
declare var fs: any;
declare const fs: any;
compiler = webpack({ });
compiler.outputFileSystem = fs;
compiler.run((err, stats) => {
// ...
var fileContent = fs.readFileSync("...");
const fileContent = fs.readFileSync("...");
});
//