mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
Merge branch 'master' into pg
This commit is contained in:
13
README.md
13
README.md
@@ -144,6 +144,10 @@ For a good example package, see [base64-js](https://github.com/DefinitelyTyped/D
|
||||
Example where a type parameter is acceptable: `function id<T>(value: T): T;`.
|
||||
Example where it is not acceptable: `function parseJson<T>(json: string): T;`.
|
||||
Exception: `new Map<string, number>()` is OK.
|
||||
* Using the types `Function` and `Object` is almost never a good idea. In 99% of cases it's possible to specify a more specific type. Examples are `(x: number) => number` for [functions](http://www.typescriptlang.org/docs/handbook/functions.html#function-types) and `{ x: number, y: number }` for objects. If there is no certainty at all about the type, [`any`](http://www.typescriptlang.org/docs/handbook/basic-types.html#any) is the right choice, not `Object`. If the only known fact about the type is that it's some object, use the type [`object`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#object-type), not `Object` or `{ [key: string]: any }`.
|
||||
* `var foo: string | any`:
|
||||
When `any` is used in a union type, the resulting type is still `any`. So while the `string` portion of this type annotation may _look_ useful, it in fact offers no additional typechecking over simply using `any`.
|
||||
Depending on the intention, acceptable alternatives could be `any`, `string`, or `string | object`.
|
||||
|
||||
|
||||
#### Removing a package
|
||||
@@ -199,7 +203,14 @@ This script uses [dtslint](https://github.com/Microsoft/dtslint).
|
||||
#### What exactly is the relationship between this repository and the `@types` packages on NPM?
|
||||
|
||||
The `master` branch is automatically published to the `@types` scope on NPM thanks to [types-publisher](https://github.com/Microsoft/types-publisher).
|
||||
This usually happens within an hour of changes being merged.
|
||||
|
||||
#### I've submitted a pull request. How long until it is merged?
|
||||
|
||||
It depends, but most pull requests will be merged within a week. PRs that have been approved by an author listed in the definition's header are usually merged more quickly; PRs for new definitions will take more time as they require more review from maintainers. Each PR is reviewed by a TypeScript or DefinitelyTyped team member before being merged, so please be patient as human factors may cause delays. Check the [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) to see progress as maintainers work through the open PRs.
|
||||
|
||||
#### My PR is merged; when will the `@types` NPM package be updated?
|
||||
|
||||
NPM packages should update within a few hours. If it's been more than 24 hours, ping @RyanCavanaugh and @andy-ms on the PR to investigate.
|
||||
|
||||
#### I'm writing a definition that depends on another definition. Should I use `<reference types="" />` or an import?
|
||||
|
||||
|
||||
@@ -558,6 +558,12 @@
|
||||
"sourceRepoURL": "https://github.com/tildeio/route-recognizer",
|
||||
"asOfVersion": "0.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "router5",
|
||||
"typingsPackageName": "router5",
|
||||
"sourceRepoURL": "https://github.com/router5/router5",
|
||||
"asOfVersion": "5.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "samchon",
|
||||
"typingsPackageName": "samchon",
|
||||
|
||||
@@ -23,8 +23,5 @@
|
||||
"devDependencies": {
|
||||
"dtslint": "github:Microsoft/dtslint#production",
|
||||
"types-publisher": "Microsoft/types-publisher#production"
|
||||
},
|
||||
"dependencies": {
|
||||
"@egjs/axes": "^2.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,16 @@ function fix(config: any): any {
|
||||
const out: any = {};
|
||||
for (const key in config) {
|
||||
let value = config[key];
|
||||
out[key] = value;
|
||||
out[key] = key === "rules" ? fixRules(value) : value;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function fixRules(rules: any): any {
|
||||
const out: any = {};
|
||||
for (const key in rules) {
|
||||
out[key] = rules[key];
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-any-union": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "dependencies": { "activex-helpers": "*"}}
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"activex-helpers": "*"
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strict": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "dependencies": { "activex-helpers": "*"}}
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"activex-helpers": "*"
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strict": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "dependencies": { "activex-helpers": "*"}}
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"activex-helpers": "*"
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strict": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
@@ -5,9 +5,11 @@
|
||||
"align": false,
|
||||
"no-namespace": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"unified-signatures": false,
|
||||
"space-before-function-paren": false
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "..",
|
||||
"lib": [
|
||||
"es5",
|
||||
"dom",
|
||||
"es2015.iterable",
|
||||
"es2015.promise"
|
||||
],
|
||||
"module": "commonjs",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"removeComments": false,
|
||||
"sourceMap": true,
|
||||
"strictNullChecks": true,
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"typeRoots": [ "../" ],
|
||||
"types": [ ]
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es5",
|
||||
"dom",
|
||||
"es2015.iterable",
|
||||
"es2015.promise"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"aframe-tests.ts"
|
||||
"index.d.ts",
|
||||
"aframe-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"moment": ">=2.14.0"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"localforage": "^1.5.0"
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"no-object-literal-type-assertion": false,
|
||||
"ban-types": false,
|
||||
"space-before-function-paren": false,
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
15
types/angular/jqlite.d.ts
vendored
15
types/angular/jqlite.d.ts
vendored
@@ -661,8 +661,21 @@ interface JQuery {
|
||||
|
||||
controller(name?: string): any;
|
||||
injector(): ng.auto.IInjectorService;
|
||||
/** It's declared generic for custom scope interfaces */
|
||||
/**
|
||||
* Returns the `$scope` of the element.
|
||||
*
|
||||
* **IMPORTANT**: Requires `debugInfoEnabled` to be true.
|
||||
*
|
||||
* See https://docs.angularjs.org/guide/production#disabling-debug-data for more information.
|
||||
*/
|
||||
scope<T extends ng.IScope>(): T;
|
||||
/**
|
||||
* Returns the `$scope` of the element.
|
||||
*
|
||||
* **IMPORTANT**: Requires `debugInfoEnabled` to be true.
|
||||
*
|
||||
* See https://docs.angularjs.org/guide/production#disabling-debug-data for more information.
|
||||
*/
|
||||
isolateScope<T extends ng.IScope>(): T;
|
||||
|
||||
inheritedData(key: string, value: any): this;
|
||||
|
||||
2
types/anydb-sql-migrations/index.d.ts
vendored
2
types/anydb-sql-migrations/index.d.ts
vendored
@@ -20,7 +20,7 @@ export interface MigrationTask {
|
||||
down: MigFn;
|
||||
name: string;
|
||||
}
|
||||
export declare function create(db: AnydbSql, tasks: any): {
|
||||
export declare function create(db: AnydbSql, tasks: string | MigrationTask[]): {
|
||||
run: () => Promise<any>;
|
||||
migrateTo: (target?: string) => Promise<any>;
|
||||
check: (f: (m: {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"anydb-sql": "^0.6.53"
|
||||
}
|
||||
}
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"anydb-sql": "^0.6.53"
|
||||
}
|
||||
}
|
||||
@@ -1 +1,6 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,24 @@
|
||||
|
||||
// near copy of each of the tests from https://github.com/nodeca/argparse/tree/master/examples
|
||||
|
||||
import { ArgumentParser, RawDescriptionHelpFormatter } from 'argparse';
|
||||
var args: any;
|
||||
let args: any;
|
||||
|
||||
var simpleExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse example',
|
||||
const simpleExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse example',
|
||||
});
|
||||
simpleExample.addArgument(
|
||||
['-f', '--foo'],
|
||||
{
|
||||
help: 'foo bar',
|
||||
}
|
||||
['-f', '--foo'],
|
||||
{
|
||||
help: 'foo bar',
|
||||
}
|
||||
);
|
||||
simpleExample.addArgument(
|
||||
['-b', '--bar'],
|
||||
{
|
||||
help: 'bar foo',
|
||||
}
|
||||
['-b', '--bar'],
|
||||
{
|
||||
help: 'bar foo',
|
||||
}
|
||||
);
|
||||
|
||||
simpleExample.printHelp();
|
||||
@@ -35,13 +34,10 @@ args = simpleExample.parseArgs('--foo 5 --bar 6'.split(' '));
|
||||
console.dir(args);
|
||||
console.log('-----------');
|
||||
|
||||
|
||||
|
||||
|
||||
var choicesExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: choice'
|
||||
const choicesExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: choice'
|
||||
});
|
||||
|
||||
choicesExample.addArgument(['foo'], { choices: 'abc' });
|
||||
@@ -55,56 +51,53 @@ console.log('-----------');
|
||||
// choicesExample.parseArgs(['X']);
|
||||
// console.dir(args);
|
||||
|
||||
|
||||
|
||||
|
||||
var constantExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: constant'
|
||||
const constantExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: constant'
|
||||
});
|
||||
|
||||
constantExample.addArgument(
|
||||
['-a'],
|
||||
{
|
||||
action: 'storeConst',
|
||||
dest: 'answer',
|
||||
help: 'store constant',
|
||||
constant: 42
|
||||
}
|
||||
['-a'],
|
||||
{
|
||||
action: 'storeConst',
|
||||
dest: 'answer',
|
||||
help: 'store constant',
|
||||
constant: 42
|
||||
}
|
||||
);
|
||||
constantExample.addArgument(
|
||||
['--str'],
|
||||
{
|
||||
action: 'appendConst',
|
||||
dest: 'types',
|
||||
help: 'append constant "str" to types',
|
||||
constant: 'str'
|
||||
}
|
||||
['--str'],
|
||||
{
|
||||
action: 'appendConst',
|
||||
dest: 'types',
|
||||
help: 'append constant "str" to types',
|
||||
constant: 'str'
|
||||
}
|
||||
);
|
||||
constantExample.addArgument(
|
||||
['--int'],
|
||||
{
|
||||
action: 'appendConst',
|
||||
dest: 'types',
|
||||
help: 'append constant "int" to types',
|
||||
constant: 'int'
|
||||
}
|
||||
['--int'],
|
||||
{
|
||||
action: 'appendConst',
|
||||
dest: 'types',
|
||||
help: 'append constant "int" to types',
|
||||
constant: 'int'
|
||||
}
|
||||
);
|
||||
|
||||
constantExample.addArgument(
|
||||
['--true'],
|
||||
{
|
||||
action: 'storeTrue',
|
||||
help: 'store true constant'
|
||||
}
|
||||
['--true'],
|
||||
{
|
||||
action: 'storeTrue',
|
||||
help: 'store true constant'
|
||||
}
|
||||
);
|
||||
constantExample.addArgument(
|
||||
['--false'],
|
||||
{
|
||||
action: 'storeFalse',
|
||||
help: 'store false constant'
|
||||
}
|
||||
['--false'],
|
||||
{
|
||||
action: 'storeFalse',
|
||||
help: 'store false constant'
|
||||
}
|
||||
);
|
||||
|
||||
constantExample.printHelp();
|
||||
@@ -113,27 +106,24 @@ console.log('-----------');
|
||||
args = constantExample.parseArgs('-a --str --int --true'.split(' '));
|
||||
console.dir(args);
|
||||
|
||||
|
||||
|
||||
|
||||
var nargsExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: nargs'
|
||||
const nargsExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: nargs'
|
||||
});
|
||||
nargsExample.addArgument(
|
||||
['-f', '--foo'],
|
||||
{
|
||||
help: 'foo bar',
|
||||
nargs: 1
|
||||
}
|
||||
['-f', '--foo'],
|
||||
{
|
||||
help: 'foo bar',
|
||||
nargs: 1
|
||||
}
|
||||
);
|
||||
nargsExample.addArgument(
|
||||
['-b', '--bar'],
|
||||
{
|
||||
help: 'bar foo',
|
||||
nargs: '*'
|
||||
}
|
||||
['-b', '--bar'],
|
||||
{
|
||||
help: 'bar foo',
|
||||
nargs: '*'
|
||||
}
|
||||
);
|
||||
|
||||
nargsExample.printHelp();
|
||||
@@ -145,40 +135,34 @@ console.log('-----------');
|
||||
args = nargsExample.parseArgs('--bar b c f --foo a'.split(' '));
|
||||
console.dir(args);
|
||||
|
||||
|
||||
|
||||
|
||||
var parent_parser = new ArgumentParser({ addHelp: false });
|
||||
const parent_parser = new ArgumentParser({ addHelp: false });
|
||||
// note addHelp:false to prevent duplication of the -h option
|
||||
parent_parser.addArgument(
|
||||
['--parent'],
|
||||
{ type: 'int', help: 'parent' }
|
||||
['--parent'],
|
||||
{ type: 'int', help: 'parent' }
|
||||
);
|
||||
|
||||
var foo_parser = new ArgumentParser({
|
||||
parents: [parent_parser],
|
||||
description: 'child1'
|
||||
const foo_parser = new ArgumentParser({
|
||||
parents: [parent_parser],
|
||||
description: 'child1'
|
||||
});
|
||||
foo_parser.addArgument(['foo']);
|
||||
args = foo_parser.parseArgs(['--parent', '2', 'XXX']);
|
||||
console.log(args);
|
||||
|
||||
var bar_parser = new ArgumentParser({
|
||||
parents: [parent_parser],
|
||||
description: 'child2'
|
||||
const bar_parser = new ArgumentParser({
|
||||
parents: [parent_parser],
|
||||
description: 'child2'
|
||||
});
|
||||
bar_parser.addArgument(['--bar']);
|
||||
args = bar_parser.parseArgs(['--bar', 'YYY']);
|
||||
console.log(args);
|
||||
|
||||
|
||||
|
||||
|
||||
var prefixCharsExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: prefix_chars',
|
||||
prefixChars: '-+'
|
||||
const prefixCharsExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: prefix_chars',
|
||||
prefixChars: '-+'
|
||||
});
|
||||
prefixCharsExample.addArgument(['+f', '++foo']);
|
||||
prefixCharsExample.addArgument(['++bar'], { action: 'storeTrue' });
|
||||
@@ -193,39 +177,36 @@ console.dir(args);
|
||||
args = prefixCharsExample.parseArgs(['++foo', '2', '++bar']);
|
||||
console.dir(args);
|
||||
|
||||
|
||||
|
||||
|
||||
var subparserExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: sub-commands'
|
||||
const subparserExample = new ArgumentParser({
|
||||
version: '0.0.1',
|
||||
addHelp: true,
|
||||
description: 'Argparse examples: sub-commands'
|
||||
});
|
||||
|
||||
var subparsers = subparserExample.addSubparsers({
|
||||
title: 'subcommands',
|
||||
dest: "subcommand_name"
|
||||
const subparsers = subparserExample.addSubparsers({
|
||||
title: 'subcommands',
|
||||
dest: "subcommand_name"
|
||||
});
|
||||
|
||||
var bar = subparsers.addParser('c1', { addHelp: true, help: 'c1 help' });
|
||||
let bar = subparsers.addParser('c1', { addHelp: true, help: 'c1 help' });
|
||||
bar.addArgument(
|
||||
['-f', '--foo'],
|
||||
{
|
||||
action: 'store',
|
||||
help: 'foo3 bar3'
|
||||
}
|
||||
['-f', '--foo'],
|
||||
{
|
||||
action: 'store',
|
||||
help: 'foo3 bar3'
|
||||
}
|
||||
);
|
||||
var bar = subparsers.addParser(
|
||||
'c2',
|
||||
{ aliases: ['co'], addHelp: true, help: 'c2 help' }
|
||||
bar = subparsers.addParser(
|
||||
'c2',
|
||||
{ aliases: ['co'], addHelp: true, help: 'c2 help' }
|
||||
);
|
||||
bar.addArgument(
|
||||
['-b', '--bar'],
|
||||
{
|
||||
action: 'store',
|
||||
type: 'int',
|
||||
help: 'foo3 bar3'
|
||||
}
|
||||
['-b', '--bar'],
|
||||
{
|
||||
action: 'store',
|
||||
type: 'int',
|
||||
help: 'foo3 bar3'
|
||||
}
|
||||
);
|
||||
subparserExample.printHelp();
|
||||
console.log('-----------');
|
||||
@@ -241,66 +222,51 @@ console.dir(args);
|
||||
console.log('-----------');
|
||||
subparserExample.parseArgs(['c1', '-h']);
|
||||
|
||||
|
||||
|
||||
|
||||
var functionExample = new ArgumentParser({ description: 'Process some integers.' });
|
||||
const functionExample = new ArgumentParser({ description: 'Process some integers.' });
|
||||
function sum(arr: number[]) {
|
||||
return arr.reduce(function(a, b) {
|
||||
return a + b;
|
||||
}, 0);
|
||||
return arr.reduce((a, b) => a + b, 0);
|
||||
}
|
||||
function max(arr: number[]) {
|
||||
return Math.max.apply(Math, arr);
|
||||
return Math.max.apply(Math, arr);
|
||||
}
|
||||
|
||||
|
||||
functionExample.addArgument(['integers'], {
|
||||
metavar: 'N',
|
||||
type: 'int',
|
||||
nargs: '+',
|
||||
help: 'an integer for the accumulator'
|
||||
metavar: 'N',
|
||||
type: 'int',
|
||||
nargs: '+',
|
||||
help: 'an integer for the accumulator'
|
||||
});
|
||||
functionExample.addArgument(['--sum'], {
|
||||
dest: 'accumulate',
|
||||
action: 'storeConst',
|
||||
constant: sum,
|
||||
defaultValue: max,
|
||||
help: 'sum the integers (default: find the max)'
|
||||
dest: 'accumulate',
|
||||
action: 'storeConst',
|
||||
constant: sum,
|
||||
defaultValue: max,
|
||||
help: 'sum the integers (default: find the max)'
|
||||
});
|
||||
|
||||
args = functionExample.parseArgs('--sum 1 2 -1'.split(' '));
|
||||
console.log(args.accumulate(args.integers));
|
||||
|
||||
|
||||
|
||||
|
||||
var formatterExample = new ArgumentParser({
|
||||
prog: 'PROG',
|
||||
formatterClass: RawDescriptionHelpFormatter,
|
||||
description: 'Keep the formatting\n' +
|
||||
' exactly as it is written\n' +
|
||||
'\n' +
|
||||
'here\n'
|
||||
const formatterExample = new ArgumentParser({
|
||||
prog: 'PROG',
|
||||
formatterClass: RawDescriptionHelpFormatter,
|
||||
description: `Keep the formatting\nexactly as it is written\n\nhere\n`,
|
||||
});
|
||||
|
||||
formatterExample.addArgument(['--foo'], {
|
||||
help: ' foo help should not\n' +
|
||||
' retain this odd formatting'
|
||||
help: `foo help should not\nretain this odd formatting`,
|
||||
});
|
||||
|
||||
formatterExample.addArgument(['spam'], {
|
||||
'help': 'spam help'
|
||||
help: 'spam help',
|
||||
});
|
||||
|
||||
var group = formatterExample.addArgumentGroup({
|
||||
title: 'title',
|
||||
description: ' This text\n' +
|
||||
' should be indented\n' +
|
||||
' exactly like it is here\n'
|
||||
const group = formatterExample.addArgumentGroup({
|
||||
title: 'title',
|
||||
description: `This text\nshould be indented\nexactly like it is here\n`,
|
||||
});
|
||||
|
||||
group.addArgument(['--bar'], {
|
||||
help: 'bar help'
|
||||
help: 'bar help'
|
||||
});
|
||||
formatterExample.printHelp();
|
||||
|
||||
47
types/argparse/index.d.ts
vendored
47
types/argparse/index.d.ts
vendored
@@ -1,31 +1,39 @@
|
||||
// Type definitions for argparse v1.0.3
|
||||
// Type definitions for argparse 1.0
|
||||
// Project: https://github.com/nodeca/argparse
|
||||
// Definitions by: Andrew Schurman <https://github.com/arcticwaters>
|
||||
// Tomasz Łaziuk <https://github.com/tlaziuk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
|
||||
export declare class ArgumentParser extends ArgumentGroup {
|
||||
export class ArgumentParser extends ArgumentGroup {
|
||||
constructor(options?: ArgumentParserOptions);
|
||||
|
||||
addSubparsers(options?: SubparserOptions): SubParser;
|
||||
parseArgs(args?: string[], ns?: Namespace | Object): any;
|
||||
parseArgs(args?: string[], ns?: Namespace | object): any;
|
||||
printUsage(): void;
|
||||
printHelp(): void;
|
||||
formatUsage(): string;
|
||||
formatHelp(): string;
|
||||
parseKnownArgs(args?: string[], ns?: Namespace | Object): any[];
|
||||
parseKnownArgs(args?: string[], ns?: Namespace | object): any[];
|
||||
convertArgLineToArg(argLine: string): string[];
|
||||
exit(status: number, message: string): void;
|
||||
error(err: string | Error): void;
|
||||
}
|
||||
|
||||
interface Namespace { }
|
||||
export class Namespace {
|
||||
constructor(options: object);
|
||||
get<K extends keyof this, D extends any>(key: K, defaultValue?: D): this[K] | D;
|
||||
isset<K extends keyof this>(key: K): boolean;
|
||||
set<K extends keyof this, V extends this[K]>(key: K, value: V): this;
|
||||
set<K extends string, V extends any>(key: K, value: V): this & Record<K, V>;
|
||||
set<K extends object>(obj: K): this & K;
|
||||
unset<K extends keyof this, D extends any>(key: K, defaultValue?: D): this[K] | D;
|
||||
}
|
||||
|
||||
declare class SubParser {
|
||||
export class SubParser {
|
||||
addParser(name: string, options?: SubArgumentParserOptions): ArgumentParser;
|
||||
}
|
||||
|
||||
declare class ArgumentGroup {
|
||||
export class ArgumentGroup {
|
||||
addArgument(args: string[], options?: ArgumentOptions): void;
|
||||
addArgumentGroup(options?: ArgumentGroupOptions): ArgumentGroup;
|
||||
addMutuallyExclusiveGroup(options?: { required: boolean }): ArgumentGroup;
|
||||
@@ -33,7 +41,7 @@ declare class ArgumentGroup {
|
||||
getDefault(dest: string): any;
|
||||
}
|
||||
|
||||
interface SubparserOptions {
|
||||
export interface SubparserOptions {
|
||||
title?: string;
|
||||
description?: string;
|
||||
prog?: string;
|
||||
@@ -44,12 +52,12 @@ interface SubparserOptions {
|
||||
metavar?: string;
|
||||
}
|
||||
|
||||
interface SubArgumentParserOptions extends ArgumentParserOptions {
|
||||
export interface SubArgumentParserOptions extends ArgumentParserOptions {
|
||||
aliases?: string[];
|
||||
help?: string;
|
||||
}
|
||||
|
||||
interface ArgumentParserOptions {
|
||||
export interface ArgumentParserOptions {
|
||||
description?: string;
|
||||
epilog?: string;
|
||||
addHelp?: boolean;
|
||||
@@ -62,26 +70,27 @@ interface ArgumentParserOptions {
|
||||
version?: string;
|
||||
}
|
||||
|
||||
interface ArgumentGroupOptions {
|
||||
export interface ArgumentGroupOptions {
|
||||
prefixChars?: string;
|
||||
argumentDefault?: any;
|
||||
title?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export declare class HelpFormatter { }
|
||||
export declare class ArgumentDefaultsHelpFormatter { }
|
||||
export declare class RawDescriptionHelpFormatter { }
|
||||
export declare class RawTextHelpFormatter { }
|
||||
export class HelpFormatter { }
|
||||
export class ArgumentDefaultsHelpFormatter { }
|
||||
export class RawDescriptionHelpFormatter { }
|
||||
export class RawTextHelpFormatter { }
|
||||
|
||||
interface ArgumentOptions {
|
||||
export interface ArgumentOptions {
|
||||
action?: string;
|
||||
optionStrings?: string[];
|
||||
dest?: string;
|
||||
nargs?: string | number;
|
||||
constant?: any;
|
||||
defaultValue?: any;
|
||||
type?: string | Function;
|
||||
// type may be a string (primitive) or a Function (constructor)
|
||||
type?: string | Function; // tslint:disable-line:ban-types
|
||||
choices?: string | string[];
|
||||
required?: boolean;
|
||||
help?: string;
|
||||
|
||||
3
types/argparse/tslint.json
Normal file
3
types/argparse/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
2
types/autobahn/index.d.ts
vendored
2
types/autobahn/index.d.ts
vendored
@@ -205,7 +205,7 @@ declare namespace autobahn {
|
||||
|
||||
type DeferFactory = () => When.Promise<any>;
|
||||
|
||||
type OnChallengeHandler = (session: Session, method: string, extra: any) => When.Promise<string>;
|
||||
type OnChallengeHandler = (session: Session, method: string, extra: any) => string;
|
||||
|
||||
interface IConnectionOptions {
|
||||
use_es6_promises?: boolean;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"postcss": "^5.2.15"
|
||||
}
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"postcss": "^5.2.15"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-any-union": false
|
||||
}
|
||||
}
|
||||
|
||||
351
types/backoff/backoff-tests.ts
Normal file
351
types/backoff/backoff-tests.ts
Normal file
@@ -0,0 +1,351 @@
|
||||
import * as backoff from 'backoff';
|
||||
|
||||
const fibonacciBackoff = backoff.fibonacci();
|
||||
fibonacciBackoff; // $ExpectType Backoff
|
||||
backoff.fibonacci({
|
||||
randomisationFactor: 0,
|
||||
initialDelay: 10,
|
||||
maxDelay: 300
|
||||
});
|
||||
backoff.fibonacci({randomisationFactor: 0});
|
||||
backoff.fibonacci({initialDelay: 10});
|
||||
backoff.fibonacci({maxDelay: 300});
|
||||
|
||||
backoff.exponential(); // $ExpectType Backoff
|
||||
backoff.exponential({
|
||||
factor: 1,
|
||||
randomisationFactor: 0,
|
||||
initialDelay: 10,
|
||||
maxDelay: 300
|
||||
});
|
||||
backoff.exponential({factor: 1});
|
||||
backoff.exponential({randomisationFactor: 0});
|
||||
backoff.exponential({initialDelay: 10});
|
||||
backoff.exponential({maxDelay: 300});
|
||||
|
||||
const fibonacciStrategy = new backoff.FibonacciStrategy();
|
||||
new backoff.FibonacciStrategy({
|
||||
randomisationFactor: 0,
|
||||
initialDelay: 10,
|
||||
maxDelay: 300
|
||||
});
|
||||
new backoff.FibonacciStrategy({randomisationFactor: 0});
|
||||
new backoff.FibonacciStrategy({initialDelay: 10});
|
||||
new backoff.FibonacciStrategy({maxDelay: 300});
|
||||
|
||||
fibonacciStrategy.next(); // $ExpectType number
|
||||
fibonacciStrategy.reset();
|
||||
|
||||
const exponentialStrategy = new backoff.ExponentialStrategy();
|
||||
new backoff.ExponentialStrategy({
|
||||
factor: 1,
|
||||
randomisationFactor: 0,
|
||||
initialDelay: 10,
|
||||
maxDelay: 300
|
||||
});
|
||||
new backoff.ExponentialStrategy({factor: 1});
|
||||
new backoff.ExponentialStrategy({randomisationFactor: 0});
|
||||
new backoff.ExponentialStrategy({initialDelay: 10});
|
||||
new backoff.ExponentialStrategy({maxDelay: 300});
|
||||
|
||||
exponentialStrategy.next(); // $ExpectType number
|
||||
exponentialStrategy.reset();
|
||||
|
||||
class MyStrategy extends backoff.BackoffStrategy {
|
||||
constructor() {
|
||||
super({
|
||||
randomisationFactor: 0,
|
||||
initialDelay: 10,
|
||||
maxDelay: 300
|
||||
});
|
||||
}
|
||||
|
||||
protected next_() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
protected reset_() {
|
||||
}
|
||||
}
|
||||
|
||||
const myStrategy = new MyStrategy();
|
||||
exponentialStrategy.next(); // $ExpectType number
|
||||
exponentialStrategy.reset();
|
||||
|
||||
// $ExpectType TypedFunctionCall<undefined[], Error, undefined, undefined, undefined>
|
||||
backoff.call((cb: (err: Error) => void) => {}, (err) => {
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// $ExpectType TypedFunctionCall<undefined[], Error, string, undefined, undefined>
|
||||
backoff.call((cb: (err: Error, r1: string) => void) => {}, (err, r1) => {
|
||||
r1; // $ExpectType string
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<undefined[], Error, string, number, undefined>
|
||||
backoff.call((cb: (err: Error, r1: string, r2: number) => void) => {}, (err, r1, r2) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<undefined[], Error, string, number, boolean>
|
||||
backoff.call((cb: (err: Error, r1: string, r2: number, r3: boolean) => void) => {}, (err, r1, r2, r3) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
r3; // $ExpectType boolean
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number], Error, string, undefined, undefined>
|
||||
backoff.call(
|
||||
(t1: number, cb: (err: Error, r1: string) => void) => {
|
||||
},
|
||||
1,
|
||||
(err, r1) => {
|
||||
r1; // $ExpectType string
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number], Error, string, number, undefined>
|
||||
backoff.call(
|
||||
(t1: number, cb: (err: Error, r1: string, r2: number) => void) => {
|
||||
},
|
||||
1,
|
||||
(err, r1, r2) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number], Error, string, number, boolean>
|
||||
backoff.call(
|
||||
(t1: number, cb: (err: Error, r1: string, r2: number, r3: boolean) => void) => {
|
||||
},
|
||||
1,
|
||||
(err, r1, r2, r3) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
r3; // $ExpectType boolean
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number, string], Error, string, undefined, undefined>
|
||||
backoff.call(
|
||||
(t1: number, t2: string, cb: (err: Error, r1: string) => void) => {
|
||||
},
|
||||
1, 'foo',
|
||||
(err, r1) => {
|
||||
r1; // $ExpectType string
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number, string], Error, string, number, undefined>
|
||||
backoff.call(
|
||||
(t1: number, t2: string, cb: (err: Error, r1: string, r2: number) => void) => {
|
||||
},
|
||||
1, 'foo',
|
||||
(err, r1, r2) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number, string], Error, string, number, boolean>
|
||||
backoff.call(
|
||||
(t1: number, t2: string, cb: (err: Error, r1: string, r2: number, r3: boolean) => void) => {
|
||||
},
|
||||
1, 'foo',
|
||||
(err, r1, r2, r3) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
r3; // $ExpectType boolean
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number, string, boolean], Error, string, undefined, undefined>
|
||||
backoff.call(
|
||||
(t1: number, t2: string, t3: boolean, cb: (err: Error, r1: string) => void) => {
|
||||
},
|
||||
1, 'foo', true,
|
||||
(err, r1) => {
|
||||
r1; // $ExpectType string
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number, string, boolean], Error, string, number, undefined>
|
||||
backoff.call(
|
||||
(t1: number, t2: string, t3: boolean, cb: (err: Error, r1: string, r2: number) => void) => {
|
||||
},
|
||||
1, 'foo', true,
|
||||
(err, r1, r2) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number, string, boolean], Error, string, number, boolean>
|
||||
backoff.call(
|
||||
(t1: number, t2: string, t3: boolean, cb: (err: Error, r1: string, r2: number, r3: boolean) => void) => {
|
||||
},
|
||||
1, 'foo', true,
|
||||
(err, r1, r2, r3) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
r3; // $ExpectType boolean
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// $ExpectType FunctionCallAny
|
||||
backoff.call(
|
||||
(t1: number, t2: string, t3: boolean, t4: string, cb: (err: Error, r1: string, r2: number, r3: boolean) => void) => {
|
||||
},
|
||||
1, 'foo', true, 'bar',
|
||||
(err: Error, r1: string, r2: number, r3: boolean) => {});
|
||||
|
||||
fibonacciBackoff.failAfter(10);
|
||||
fibonacciBackoff.backoff(new Error('foo'));
|
||||
fibonacciBackoff.reset();
|
||||
|
||||
fibonacciBackoff.on('backoff', (number, delay) => {
|
||||
number; // $ExpectType number
|
||||
delay; // $ExpectType number
|
||||
});
|
||||
fibonacciBackoff.on('ready', (number, delay) => {
|
||||
number; // $ExpectType number
|
||||
delay; // $ExpectType number
|
||||
});
|
||||
fibonacciBackoff.on('fail', (err) => {
|
||||
err; // $ExpectType any
|
||||
});
|
||||
|
||||
// TypedFunctionCall<undefined[], Error, undefined, undefined, undefined>
|
||||
new backoff.FunctionCall((cb: (err: Error) => void) => {}, [], (err) => {
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<undefined[], Error, string, undefined, undefined>
|
||||
new backoff.FunctionCall((cb: (err: Error, r1: string) => void) => {}, [], (err, r1) => {
|
||||
r1; // $ExpectType string
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<undefined[], Error, string, number, undefined>
|
||||
new backoff.FunctionCall((cb: (err: Error, r1: string, r2: number) => void) => {}, [], (err, r1, r2) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<undefined[], Error, string, number, boolean>
|
||||
new backoff.FunctionCall((cb: (err: Error, r1: string, r2: number, r3: boolean) => void) => {}, [], (err, r1, r2, r3) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
r3; // $ExpectType boolean
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number], Error, string, undefined, undefined>
|
||||
new backoff.FunctionCall(
|
||||
(t1: number, cb: (err: Error, r1: string) => void) => {
|
||||
},
|
||||
[1],
|
||||
(err, r1) => {
|
||||
r1; // $ExpectType string
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number], Error, string, number, undefined>
|
||||
new backoff.FunctionCall(
|
||||
(t1: number, cb: (err: Error, r1: string, r2: number) => void) => {
|
||||
},
|
||||
[1],
|
||||
(err, r1, r2) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number], Error, string, number, boolean>
|
||||
new backoff.FunctionCall(
|
||||
(t1: number, cb: (err: Error, r1: string, r2: number, r3: boolean) => void) => {
|
||||
},
|
||||
[1],
|
||||
(err, r1, r2, r3) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
r3; // $ExpectType boolean
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number, string], Error, string, undefined, undefined>
|
||||
new backoff.FunctionCall(
|
||||
(t1: number, t2: string, cb: (err: Error, r1: string) => void) => {
|
||||
},
|
||||
[1, 'foo'],
|
||||
(err, r1) => {
|
||||
r1; // $ExpectType string
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number, string], Error, string, number, undefined>
|
||||
new backoff.FunctionCall(
|
||||
(t1: number, t2: string, cb: (err: Error, r1: string, r2: number) => void) => {
|
||||
},
|
||||
[1, 'foo'],
|
||||
(err, r1, r2) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number, string], Error, string, number, boolean>
|
||||
new backoff.FunctionCall(
|
||||
(t1: number, t2: string, cb: (err: Error, r1: string, r2: number, r3: boolean) => void) => {
|
||||
},
|
||||
[1, 'foo'],
|
||||
(err, r1, r2, r3) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
r3; // $ExpectType boolean
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number, string, boolean], Error, string, undefined, undefined>
|
||||
new backoff.FunctionCall(
|
||||
(t1: number, t2: string, t3: boolean, cb: (err: Error, r1: string) => void) => {
|
||||
},
|
||||
[1, 'foo', true],
|
||||
(err, r1) => {
|
||||
r1; // $ExpectType string
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
// TypedFunctionCall<[number, string, boolean], Error, string, number, undefined>
|
||||
new backoff.FunctionCall(
|
||||
(t1: number, t2: string, t3: boolean, cb: (err: Error, r1: string, r2: number) => void) => {
|
||||
},
|
||||
[1, 'foo', true],
|
||||
(err, r1, r2) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
const functionCall = new backoff.FunctionCall(
|
||||
(t1: number, t2: string, t3: boolean, cb: (err: Error, r1: string, r2: number, r3: boolean) => void) => {
|
||||
},
|
||||
[1, 'foo', true],
|
||||
(err, r1, r2, r3) => {
|
||||
r1; // $ExpectType string
|
||||
r2; // $ExpectType number
|
||||
r3; // $ExpectType boolean
|
||||
err; // $ExpectType Error
|
||||
});
|
||||
functionCall; // TypedFunctionCall<[number, string, boolean], Error, string, number, boolean>
|
||||
// $ExpectType FunctionCallAny
|
||||
new backoff.FunctionCall(
|
||||
(t1: number, t2: string, t3: boolean, t4: string, cb: (err: Error, r1: string, r2: number, r3: boolean) => void) => {
|
||||
},
|
||||
[1, 'foo', true, 'bar'],
|
||||
(err: Error, r1: string, r2: number, r3: boolean) => {});
|
||||
|
||||
functionCall.isPending(); // $ExpectType boolean
|
||||
functionCall.isRunning(); // $ExpectType boolean
|
||||
functionCall.isCompleted(); // $ExpectType boolean
|
||||
functionCall.isAborted(); // $ExpectType boolean
|
||||
functionCall.setStrategy(myStrategy); // $ExpectType TypedFunctionCall<[number, string, boolean], Error, string, number, boolean>
|
||||
functionCall.retryIf(err => err.status === 503); // $ExpectType TypedFunctionCall<[number, string, boolean], Error, string, number, boolean>
|
||||
functionCall.failAfter(10); // $ExpectType TypedFunctionCall<[number, string, boolean], Error, string, number, boolean>
|
||||
functionCall.getLastResult(); // $ExpectType [Error, string, number, boolean]
|
||||
functionCall.getNumRetries(); // $ExpectType number
|
||||
functionCall.start();
|
||||
functionCall.abort();
|
||||
functionCall.on('call', args => {
|
||||
args; // $ExpectType [number, string, boolean]
|
||||
});
|
||||
functionCall.on('callback', args => {
|
||||
args; // $ExpectType [Error, string, number, boolean]
|
||||
});
|
||||
functionCall.on('backoff', (number, delay, err) => {
|
||||
number; // $ExpectType number
|
||||
delay; // $ExpectType number
|
||||
err; // $ExpectType any
|
||||
});
|
||||
functionCall.on('abort', () => {});
|
||||
525
types/backoff/index.d.ts
vendored
Normal file
525
types/backoff/index.d.ts
vendored
Normal file
@@ -0,0 +1,525 @@
|
||||
// Type definitions for backoff 2.5
|
||||
// Project: https://github.com/MathieuTurcotte/node-backoff#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
/// <reference types="node" />
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
/**
|
||||
* Constructs a Fibonacci backoff (10, 10, 20, 30, 50, etc.).
|
||||
*
|
||||
* @param options.randomisationFactor: defaults to 0, must be between 0 and 1
|
||||
* @param options.initialDelay: defaults to 100 ms
|
||||
* @param options.maxDelay: defaults to 10000 ms
|
||||
*
|
||||
* With these values, the backoff delay will increase from 100 ms to 10000 ms. The
|
||||
* randomisation factor controls the range of randomness and must be between 0
|
||||
* and 1. By default, no randomisation is applied on the backoff delay.
|
||||
*/
|
||||
export function fibonacci(options?: Options): Backoff;
|
||||
|
||||
/**
|
||||
* Constructs an exponential backoff (10, 20, 40, 80, etc.).
|
||||
*
|
||||
* @param options.randomisationFactor: defaults to 0, must be between 0 and 1
|
||||
* @param options.initialDelay: defaults to 100 ms
|
||||
* @param options.maxDelay: defaults to 10000 ms
|
||||
* @param options.factor: defaults to 2, must be greater than 1
|
||||
*
|
||||
* With these values, the backoff delay will increase from 100 ms to 10000 ms. The
|
||||
* randomisation factor controls the range of randomness and must be between 0
|
||||
* and 1. By default, no randomisation is applied on the backoff delay.
|
||||
*/
|
||||
export function exponential(options?: ExponentialOptions): Backoff;
|
||||
|
||||
export interface Options {
|
||||
randomisationFactor?: number;
|
||||
initialDelay?: number;
|
||||
maxDelay?: number;
|
||||
}
|
||||
|
||||
export interface ExponentialOptions extends Options {
|
||||
factor?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a `FunctionCall` instance for the given function. The wrapped
|
||||
* function will get retried until it succeds or reaches the maximum number
|
||||
* of backoffs. In both cases, the callback function will be invoked with the
|
||||
* last result returned by the wrapped function.
|
||||
*
|
||||
* It is the caller's responsability to initiate the call by invoking the
|
||||
* `start` method on the returned `FunctionCall` instance.
|
||||
*
|
||||
* @param wrappedFunction: function to call in a backoff handler, i.e. the wrapped function
|
||||
* @param args: function's arguments
|
||||
* @param callback: function's callback accepting an error as its first argument
|
||||
*
|
||||
*/
|
||||
export function call<R1, R2, R3, E>(wrappedFunction: (cb: (err: E, r1: R1, r2: R2, r3: R3) => void) => void,
|
||||
callback: (error: E, r1: R1, r2: R2, r3: R3) => void): TypedFunctionCall<undefined[], E, R1, R2, R3>;
|
||||
export function call<R1, R2, E>(wrappedFunction: (cb: (err: E, r1: R1, r2: R2) => void) => void,
|
||||
callback: (error: E, r1: R1, r2: R2) => void): TypedFunctionCall<undefined[], E, R1, R2>;
|
||||
export function call<R1, E>(wrappedFunction: (cb: (err: E, r1: R1) => void) => void,
|
||||
callback: (error: E, r1: R1) => void): TypedFunctionCall<undefined[], E, R1>;
|
||||
export function call<E>(wrappedFunction: (cb: (err: E) => void) => void,
|
||||
callback: (err: E) => void): TypedFunctionCall<undefined[], E>;
|
||||
export function call<T1, R1, R2, R3, E>(wrappedFunction: (t1: T1, cb: (err: E, r1: R1, r2: R2, r3: R3) => void) => void,
|
||||
t1: T1,
|
||||
callback: (error: E, r1: R1, r2: R2, r3: R3) => void): TypedFunctionCall<[T1], E, R1, R2, R3>;
|
||||
export function call<T1, R1, R2, E>(wrappedFunction: (t1: T1, cb: (err: E, r1: R1, r2: R2) => void) => void,
|
||||
t1: T1,
|
||||
callback: (error: E, r1: R1, r2: R2) => void): TypedFunctionCall<[T1], E, R1, R2>;
|
||||
export function call<T1, R1, E>(wrappedFunction: (t1: T1, cb: (err: E, r1: R1) => void) => void,
|
||||
t1: T1,
|
||||
callback: (error: E, r1: R1) => void): TypedFunctionCall<[T1], E, R1>;
|
||||
export function call<T1, E>(wrappedFunction: (t1: T1, cb: (err: E) => void) => void,
|
||||
t1: T1,
|
||||
callback: (err: E) => void): TypedFunctionCall<[T1], E>;
|
||||
export function call<T1, T2, R1, R2, R3, E>(wrappedFunction: (t1: T1, t2: T2, cb: (err: E, r1: R1, r2: R2, r3: R3) => void) => void,
|
||||
t1: T1, t2: T2,
|
||||
callback: (error: E, r1: R1, r2: R2, r3: R3) => void): TypedFunctionCall<[T1, T2], E, R1, R2, R3>;
|
||||
export function call<T1, T2, R1, R2, E>(wrappedFunction: (t1: T1, t2: T2, cb: (err: E, r1: R1, r2: R2) => void) => void,
|
||||
t1: T1, t2: T2,
|
||||
callback: (error: E, r1: R1, r2: R2) => void): TypedFunctionCall<[T1, T2], E, R1, R2>;
|
||||
export function call<T1, T2, R1, E>(wrappedFunction: (t1: T1, t2: T2, cb: (err: E, r1: R1) => void) => void,
|
||||
t1: T1, t2: T2,
|
||||
callback: (error: E, r1: R1) => void): TypedFunctionCall<[T1, T2], E, R1>;
|
||||
export function call<T1, T2, E>(wrappedFunction: (t1: T1, t2: T2, cb: (err: E) => void) => void,
|
||||
t1: T1, t2: T2,
|
||||
callback: (err: E) => void): TypedFunctionCall<[T1, T2], E>;
|
||||
export function call<T1, T2, T3, R1, R2, R3, E>(wrappedFunction: (t1: T1, t2: T2, t3: T3, cb: (err: E, r1: R1, r2: R2, r3: R3) => void) => void,
|
||||
t1: T1, t2: T2, t3: T3,
|
||||
callback: (error: E, r1: R1, r2: R2, r3: R3) => void): TypedFunctionCall<[T1, T2, T3], E, R1, R2, R3>;
|
||||
export function call<T1, T2, T3, R1, R2, E>(wrappedFunction: (t1: T1, t2: T2, t3: T3, cb: (err: E, r1: R1, r2: R2) => void) => void,
|
||||
t1: T1, t2: T2, t3: T3,
|
||||
callback: (error: E, r1: R1, r2: R2) => void): TypedFunctionCall<[T1, T2, T3], E, R1, R2>;
|
||||
export function call<T1, T2, T3, R1, E>(wrappedFunction: (t1: T1, t2: T2, t3: T3, cb: (err: E, r1: R1) => void) => void,
|
||||
t1: T1, t2: T2, t3: T3,
|
||||
callback: (error: E, r1: R1) => void): TypedFunctionCall<[T1, T2, T3], E, R1>;
|
||||
export function call<T1, T2, T3, E>(wrappedFunction: (t1: T1, t2: T2, t3: T3, cb: (err: E) => void) => void,
|
||||
t1: T1, t2: T2, t3: T3,
|
||||
callback: (err: E) => void): TypedFunctionCall<[T1, T2, T3], E>;
|
||||
export function call<R>(wrappedFunction: (...args: any[]) => void, ...args: any[]): FunctionCallAny;
|
||||
|
||||
export class Backoff extends EventEmitter {
|
||||
/**
|
||||
* Constructs a new backoff object from a specific backoff strategy. The backoff
|
||||
* strategy must implement the `BackoffStrategy`interface defined bellow.
|
||||
*
|
||||
* @param strategy: the backoff strategy to use
|
||||
*/
|
||||
constructor(strategy: BackoffStrategy);
|
||||
|
||||
/**
|
||||
* Sets a limit on the maximum number of backoffs that can be performed before
|
||||
* a fail event gets emitted and the backoff instance is reset. By default, there
|
||||
* is no limit on the number of backoffs that can be performed.
|
||||
*
|
||||
* @param numberOfBackoffs: maximum number of backoffs before the fail event gets
|
||||
* emitted, must be greater than 0
|
||||
*/
|
||||
failAfter(numberOfBackoffs: number): void;
|
||||
|
||||
/**
|
||||
* Starts a backoff operation. If provided, the error parameter will be emitted
|
||||
* as the last argument of the `backoff` and `fail` events to let the listeners
|
||||
* know why the backoff operation was attempted.
|
||||
*
|
||||
* An error will be thrown if a backoff operation is already in progress.
|
||||
*
|
||||
* In practice, this method should be called after a failed attempt to perform a
|
||||
* sensitive operation (connecting to a database, downloading a resource over the
|
||||
* network, etc.).
|
||||
*/
|
||||
backoff(error?: any): void;
|
||||
|
||||
/**
|
||||
* Resets the backoff delay to the initial backoff delay and stop any backoff
|
||||
* operation in progress. After reset, a backoff instance can and should be
|
||||
* reused.
|
||||
*
|
||||
* In practice, this method should be called after having successfully completed
|
||||
* the sensitive operation guarded by the backoff instance or if the client code
|
||||
* request to stop any reconnection attempt.
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
/**
|
||||
* Emitted when a backoff operation is started. Signals to the client how long
|
||||
* the next backoff delay will be.
|
||||
* @param number: number of backoffs since last reset, starting at 0
|
||||
* @param delay: backoff delay in milliseconds
|
||||
* @param err: optional error parameter passed to `backoff.backoff([err])`
|
||||
*/
|
||||
addListener(event: 'backoff', listener: (number: number, delay: number, error?: any) => void): this;
|
||||
/**
|
||||
* Emitted when a backoff operation is done. Signals that the failing operation
|
||||
* should be retried.
|
||||
*
|
||||
* @param number: number of backoffs since last reset, starting at 0
|
||||
* @param delay: backoff delay in milliseconds
|
||||
*/
|
||||
addListener(event: 'ready', listener: (number: number, delay: number) => void): this;
|
||||
/**
|
||||
* Emitted when the maximum number of backoffs is reached. This event will only
|
||||
* be emitted if the client has set a limit on the number of backoffs by calling
|
||||
* `backoff.failAfter(numberOfBackoffs)`. The backoff instance is automatically
|
||||
* reset after this event is emitted.
|
||||
*
|
||||
* @param err: optional error parameter passed to `backoff.backoff([err])`
|
||||
*/
|
||||
addListener(event: 'fail', listener: (error?: any) => void): this;
|
||||
on(event: 'backoff', listener: (number: number, delay: number, error?: any) => void): this;
|
||||
on(event: 'ready', listener: (number: number, delay: number) => void): this;
|
||||
on(event: 'fail', listener: (error?: any) => void): this;
|
||||
once(event: 'backoff', listener: (number: number, delay: number, error?: any) => void): this;
|
||||
once(event: 'ready', listener: (number: number, delay: number) => void): this;
|
||||
once(event: 'fail', listener: (error?: any) => void): this;
|
||||
prependListener(event: 'backoff', listener: (number: number, delay: number, error?: any) => void): this;
|
||||
prependListener(event: 'ready', listener: (number: number, delay: number) => void): this;
|
||||
prependListener(event: 'fail', listener: (error?: any) => void): this;
|
||||
prependOnceListener(event: 'backoff', listener: (number: number, delay: number, error?: any) => void): this;
|
||||
prependOnceListener(event: 'ready', listener: (number: number, delay: number) => void): this;
|
||||
prependOnceListener(event: 'fail', listener: (error?: any) => void): this;
|
||||
removeListener(event: 'backoff', listener: (number: number, delay: number, error?: any) => void): this;
|
||||
removeListener(event: 'ready', listener: (number: number, delay: number) => void): this;
|
||||
removeListener(event: 'fail', listener: (error?: any) => void): this;
|
||||
removeAllListeners(event?: 'backoff' | 'ready' | 'fail'): this;
|
||||
listeners(event: 'backoff'): Array<(number: number, delay: number, error?: any) => void>;
|
||||
listeners(event: 'ready'): Array<(number: number, delay: number) => void>;
|
||||
listeners(event: 'fail'): Array<(error?: any) => void>;
|
||||
emit(event: 'backoff', number: number, delay: number, error?: any): boolean;
|
||||
emit(event: 'ready', number: number, delay: number): boolean;
|
||||
emit(event: 'fail', error?: any): boolean;
|
||||
eventNames(): Array<'backoff' | 'ready' | 'fail'>;
|
||||
listenerCount(type: 'backoff' | 'ready' | 'fail'): number;
|
||||
}
|
||||
|
||||
export abstract class BackoffStrategy {
|
||||
/**
|
||||
* The options are the following.
|
||||
*
|
||||
* @param options.randomisationFactor: defaults to 0, must be between 0 and 1
|
||||
* @param options.initialDelay: defaults to 100 ms
|
||||
* @param options.maxDelay: defaults to 10000 ms
|
||||
*/
|
||||
constructor(options?: Options);
|
||||
getMaxDelay(): number;
|
||||
getInitialDelay(): number;
|
||||
|
||||
/**
|
||||
* Computes and returns the next backoff delay.
|
||||
*/
|
||||
next(): number;
|
||||
|
||||
/**
|
||||
* Resets the backoff delay to its initial value.
|
||||
*/
|
||||
reset(): void;
|
||||
protected abstract next_(): number;
|
||||
protected abstract reset_(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Exponential (10, 20, 40, 80, etc.) backoff strategy implementation.
|
||||
*/
|
||||
export class ExponentialStrategy extends BackoffStrategy {
|
||||
/**
|
||||
* The options are the following.
|
||||
*
|
||||
* @param options.randomisationFactor: defaults to 0, must be between 0 and 1
|
||||
* @param options.initialDelay: defaults to 100 ms
|
||||
* @param options.maxDelay: defaults to 10000 ms
|
||||
* @param options.factor: defaults to 2, must be greater than 1
|
||||
*/
|
||||
constructor(options?: ExponentialOptions);
|
||||
/**
|
||||
* Computes and returns the next backoff delay.
|
||||
*/
|
||||
next(): number;
|
||||
/**
|
||||
* Resets the backoff delay to its initial value.
|
||||
*/
|
||||
reset(): void;
|
||||
protected next_(): number;
|
||||
protected reset_(): number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fibonacci (10, 10, 20, 30, 50, etc.) backoff strategy implementation.
|
||||
*/
|
||||
export class FibonacciStrategy extends BackoffStrategy {
|
||||
/**
|
||||
* The options are the following.
|
||||
*
|
||||
* @param options.randomisationFactor: defaults to 0, must be between 0 and 1
|
||||
* @param options.initialDelay: defaults to 100 ms
|
||||
* @param options.maxDelay: defaults to 10000 ms
|
||||
*/
|
||||
constructor(options?: Options);
|
||||
next(): number;
|
||||
reset(): void;
|
||||
protected next_(): number;
|
||||
protected reset_(): number;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class manages the calling of an asynchronous function within a backoff
|
||||
* loop.
|
||||
*
|
||||
* This class should rarely be instantiated directly since the factory method
|
||||
* `backoff.call(fn, [args, ...], callback)` offers a more convenient and safer
|
||||
* way to create `FunctionCall` instances.
|
||||
*/
|
||||
export const FunctionCall: FunctionCallConstructor;
|
||||
|
||||
/**
|
||||
* Constructs a function handler for the given asynchronous function.
|
||||
*
|
||||
* @param fn: asynchronous function to call
|
||||
* @param args: an array containing fn's args
|
||||
* @param callback: fn's callback
|
||||
*/
|
||||
export interface FunctionCallConstructor {
|
||||
new <R1, R2, R3, E>(wrappedFunction: (cb: (err: E, r1: R1, r2: R2, r3: R3) => void) => void,
|
||||
args: undefined[],
|
||||
callback: (error: E, r1: R1, r2: R2, r3: R3) => void): TypedFunctionCall<undefined[], E, R1, R2, R3>;
|
||||
new <R1, R2, E>(wrappedFunction: (cb: (err: E, r1: R1, r2: R2) => void) => void,
|
||||
args: undefined[],
|
||||
callback: (error: E, r1: R1, r2: R2) => void): TypedFunctionCall<undefined[], E, R1, R2>;
|
||||
new <R1, E>(wrappedFunction: (cb: (err: E, r1: R1) => void) => void,
|
||||
args: undefined[],
|
||||
callback: (error: E, r1: R1) => void): TypedFunctionCall<undefined[], E, R1>;
|
||||
new <E>(wrappedFunction: (cb: (err: E) => void) => void,
|
||||
args: undefined[],
|
||||
callback: (err: E) => void): TypedFunctionCall<undefined[], E>;
|
||||
|
||||
new <T1, R1, R2, R3, E>(wrappedFunction: (t1: T1, cb: (err: E, r1: R1, r2: R2, r3: R3) => void) => void,
|
||||
args: [T1],
|
||||
callback: (error: E, r1: R1, r2: R2, r3: R3) => void): TypedFunctionCall<[T1], E, R1, R2, R3>;
|
||||
new <T1, R1, R2, E>(wrappedFunction: (t1: T1, cb: (err: E, r1: R1, r2: R2) => void) => void,
|
||||
args: [T1],
|
||||
callback: (error: E, r1: R1, r2: R2) => void): TypedFunctionCall<[T1], E, R1, R2>;
|
||||
new <T1, R1, E>(wrappedFunction: (t1: T1, cb: (err: E, r1: R1) => void) => void,
|
||||
args: [T1],
|
||||
callback: (error: E, r1: R1) => void): TypedFunctionCall<[T1], E, R1>;
|
||||
new <T1, E>(wrappedFunction: (t1: T1, cb: (err: E) => void) => void,
|
||||
args: [T1],
|
||||
callback: (err: E) => void): TypedFunctionCall<[T1], E>;
|
||||
|
||||
new <T1, T2, R1, R2, R3, E>(wrappedFunction: (t1: T1, t2: T2, cb: (err: E, r1: R1, r2: R2, r3: R3) => void) => void,
|
||||
args: [T1, T2],
|
||||
callback: (error: E, r1: R1, r2: R2, r3: R3) => void): TypedFunctionCall<[T1, T2], E, R1, R2, R3>;
|
||||
new <T1, T2, R1, R2, E>(wrappedFunction: (t1: T1, t2: T2, cb: (err: E, r1: R1, r2: R2) => void) => void,
|
||||
args: [T1, T2],
|
||||
callback: (error: E, r1: R1, r2: R2) => void): TypedFunctionCall<[T1, T2], E, R1, R2>;
|
||||
new <T1, T2, R1, E>(wrappedFunction: (t1: T1, t2: T2, cb: (err: E, r1: R1) => void) => void,
|
||||
args: [T1, T2],
|
||||
callback: (error: E, r1: R1) => void): TypedFunctionCall<[T1, T2], E, R1>;
|
||||
new <T1, T2, E>(wrappedFunction: (t1: T1, t2: T2, cb: (err: E) => void) => void,
|
||||
args: [T1, T2],
|
||||
callback: (err: E) => void): TypedFunctionCall<[T1, T2], E>;
|
||||
|
||||
new <T1, T2, T3, R1, R2, R3, E>(wrappedFunction: (t1: T1, t2: T2, t3: T3, cb: (err: E, r1: R1, r2: R2, r3: R3) => void) => void,
|
||||
args: [T1, T2, T3],
|
||||
callback: (error: E, r1: R1, r2: R2, r3: R3) => void): TypedFunctionCall<[T1, T2, T3], E, R1, R2, R3>;
|
||||
new <T1, T2, T3, R1, R2, E>(wrappedFunction: (t1: T1, t2: T2, t3: T3, cb: (err: E, r1: R1, r2: R2) => void) => void,
|
||||
args: [T1, T2, T3],
|
||||
callback: (error: E, r1: R1, r2: R2) => void): TypedFunctionCall<[T1, T2, T3], E, R1, R2>;
|
||||
new <T1, T2, T3, R1, E>(wrappedFunction: (t1: T1, t2: T2, t3: T3, cb: (err: E, r1: R1) => void) => void,
|
||||
args: [T1, T2, T3],
|
||||
callback: (error: E, r1: R1) => void): TypedFunctionCall<[T1, T2, T3], E, R1>;
|
||||
new <T1, T2, T3, E>(wrappedFunction: (t1: T1, t2: T2, t3: T3, cb: (err: E) => void) => void,
|
||||
args: [T1, T2, T3],
|
||||
callback: (err: E) => void): TypedFunctionCall<[T1, T2, T3], E>;
|
||||
|
||||
new (wrappedFunction: (...args: any[]) => void,
|
||||
args: any[],
|
||||
callback: (error: any, ...resArgs: any[]) => void): FunctionCallAny;
|
||||
}
|
||||
|
||||
export type TypedFunctionCall<T, E, R1 = undefined, R2 = undefined, R3 = undefined> = FunctionCall<T> & FunctionCallArgs<E, R1, R2, R3>;
|
||||
export type FunctionCallAny = FunctionCall<any[]> & FunctionCallArgsAny;
|
||||
|
||||
export interface FunctionCall<T> extends EventEmitter {
|
||||
/**
|
||||
* Returns whether the call is pending, i.e. hasn't been started.
|
||||
*/
|
||||
isPending(): boolean;
|
||||
|
||||
/**
|
||||
* Returns whether the call is in progress.
|
||||
*/
|
||||
isRunning(): boolean;
|
||||
|
||||
/**
|
||||
* Returns whether the call is completed.
|
||||
*/
|
||||
isCompleted(): boolean;
|
||||
|
||||
/**
|
||||
* Returns whether the call is aborted.
|
||||
*/
|
||||
isAborted(): boolean;
|
||||
|
||||
/**
|
||||
* Sets the backoff strategy to use. This method should be called before
|
||||
* `call.start()` otherwise an exception will be thrown.
|
||||
*
|
||||
* @param strategy: strategy instance to use, defaults to `FibonacciStrategy`.
|
||||
*/
|
||||
setStrategy(strategy: BackoffStrategy): this;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of backoffs before the call is aborted. By default,
|
||||
* there is no limit on the number of backoffs that can be performed.
|
||||
*
|
||||
* This method should be called before `call.start()` otherwise an exception will
|
||||
* be thrown.
|
||||
*
|
||||
* @param maxNumberOfBackoffs: maximum number of backoffs before the call is aborted
|
||||
*/
|
||||
failAfter(maxNumberOfBackoffs: number): this;
|
||||
|
||||
/**
|
||||
* Sets the predicate which will be invoked to determine whether a given error
|
||||
* should be retried or not, e.g. a network error would be retriable while a type
|
||||
* error would stop the function call. By default, all errors are considered to be
|
||||
* retriable.
|
||||
*
|
||||
* This method should be called before `call.start()` otherwise an exception will
|
||||
* be thrown.
|
||||
*
|
||||
* @param predicate: a function which takes in as its argument the error returned
|
||||
* by the wrapped function and determines whether it is retriable.
|
||||
*/
|
||||
retryIf(predicate: (error: any) => boolean): this;
|
||||
|
||||
/**
|
||||
* Returns the number of times the wrapped function call was retried. For a
|
||||
* wrapped function that succeeded immediately, this would return 0. This
|
||||
* method can be called at any point in time during the call life cycle, i.e.
|
||||
* before, during and after the wrapped function invocation.
|
||||
*/
|
||||
getNumRetries(): number;
|
||||
|
||||
/**
|
||||
* Initiates the call the wrapped function. This method should only be called
|
||||
* once otherwise an exception will be thrown.
|
||||
*/
|
||||
start(): void;
|
||||
|
||||
/**
|
||||
* Aborts the call and causes the completion callback to be invoked with an abort
|
||||
* error if the call was pending or running; does nothing otherwise. This method
|
||||
* can safely be called multiple times.
|
||||
*/
|
||||
abort(): void;
|
||||
|
||||
/**
|
||||
* Emitted each time the wrapped function is called.
|
||||
* @param args: wrapped function's arguments
|
||||
*/
|
||||
addListener(event: 'call', listener: (args: T) => void): this;
|
||||
|
||||
/**
|
||||
* Emitted each time a backoff operation is started.
|
||||
*
|
||||
* @param number: backoff number, starts at 0
|
||||
* @param delay: backoff delay in milliseconds
|
||||
* @param err: the error that triggered the backoff operation
|
||||
*/
|
||||
addListener(event: 'backoff', listener: (number: number, delay: number, error?: any) => void): this;
|
||||
|
||||
/**
|
||||
* Emitted when a call is aborted.
|
||||
*/
|
||||
addListener(event: 'abort', listener: () => void): this;
|
||||
on(event: 'call', listener: (args: T) => void): this;
|
||||
on(event: 'backoff', listener: (number: number, delay: number, error?: any) => void): this;
|
||||
on(event: 'abort', listener: () => void): this;
|
||||
once(event: 'call', listener: (args: T) => void): this;
|
||||
once(event: 'backoff', listener: (number: number, delay: number, error?: any) => void): this;
|
||||
once(event: 'abort', listener: () => void): this;
|
||||
prependListener(event: 'call', listener: (args: T) => void): this;
|
||||
prependListener(event: 'backoff', listener: (number: number, delay: number, error?: any) => void): this;
|
||||
prependListener(event: 'abort', listener: () => void): this;
|
||||
prependOnceListener(event: 'call', listener: (args: T) => void): this;
|
||||
prependOnceListener(event: 'backoff', listener: (number: number, delay: number, error?: any) => void): this;
|
||||
prependOnceListener(event: 'abort', listener: () => void): this;
|
||||
removeListener(event: 'call', listener: (args: T) => void): this;
|
||||
removeListener(event: 'backoff', listener: (number: number, delay: number, error?: any) => void): this;
|
||||
removeListener(event: 'abort', listener: () => void): this;
|
||||
removeAllListeners(event?: 'call' | 'callback' | 'backoff' | 'abort'): this;
|
||||
listeners(event: 'call'): Array<(args: T) => void>;
|
||||
listeners(event: 'backoff'): Array<(number: number, delay: number, error?: any) => void>;
|
||||
listeners(event: 'abort'): Array<() => void>;
|
||||
emit(event: 'call', args: T): boolean;
|
||||
emit(event: 'backoff', number: number, delay: number, error?: any): boolean;
|
||||
emit(event: 'abort'): boolean;
|
||||
eventNames(): Array<'call' | 'callback' | 'backoff' | 'abort'>;
|
||||
listenerCount(type: 'call' | 'callback' | 'backoff' | 'abort'): number;
|
||||
}
|
||||
|
||||
// Waiting for https://github.com/Microsoft/TypeScript/pull/17884
|
||||
export interface FunctionCallArgs<E, R1 = undefined, R2 = undefined, R3 = undefined> {
|
||||
/**
|
||||
* Returns an array containing the last arguments passed to the completion callback
|
||||
* of the wrapped function. For example, to get the error code returned by the last
|
||||
* call, one would do the following.
|
||||
*
|
||||
* ``` js
|
||||
* var results = call.getLastResult();
|
||||
* // The error code is the first parameter of the callback.
|
||||
* var error = results[0];
|
||||
* ```
|
||||
*
|
||||
* Note that if the call was aborted, it will contain the abort error and not the
|
||||
* last error returned by the wrapped function.
|
||||
*/
|
||||
getLastResult(): [E, R1, R2, R3];
|
||||
/**
|
||||
* Emitted each time the wrapped function invokes its callback
|
||||
* @param results: wrapped function's return values
|
||||
*/
|
||||
addListener(event: 'callback', listener: (results: [E, R1, R2, R3]) => void): this;
|
||||
on(event: 'callback', listener: (results: [E, R1, R2, R3]) => void): this;
|
||||
once(event: 'callback', listener: (results: [E, R1, R2, R3]) => void): this;
|
||||
prependListener(event: 'callback', listener: (results: [E, R1, R2, R3]) => void): this;
|
||||
prependOnceListener(event: 'callback', listener: (results: [E, R1, R2, R3]) => void): this;
|
||||
removeListener(event: 'callback', listener: (results: [E, R1, R2, R3]) => void): this;
|
||||
listeners(event: 'callback'): Array<(results: [E, R1, R2, R3]) => void>;
|
||||
emit(event: 'callback', results: [E, R1, R2, R3]): boolean;
|
||||
}
|
||||
|
||||
export interface FunctionCallArgsAny {
|
||||
/**
|
||||
* Returns an array containing the last arguments passed to the completion callback
|
||||
* of the wrapped function. For example, to get the error code returned by the last
|
||||
* call, one would do the following.
|
||||
*
|
||||
* ``` js
|
||||
* var results = call.getLastResult();
|
||||
* // The error code is the first parameter of the callback.
|
||||
* var error = results[0];
|
||||
* ```
|
||||
*
|
||||
* Note that if the call was aborted, it will contain the abort error and not the
|
||||
* last error returned by the wrapped function.
|
||||
*/
|
||||
getLastResult(): any[];
|
||||
/**
|
||||
* Emitted each time the wrapped function invokes its callback
|
||||
* @param results: wrapped function's return values
|
||||
*/
|
||||
addListener(event: 'callback', listener: (results: any[]) => void): this;
|
||||
on(event: 'callback', listener: (results: any[]) => void): this;
|
||||
once(event: 'callback', listener: (results: any[]) => void): this;
|
||||
prependListener(event: 'callback', listener: (results: any[]) => void): this;
|
||||
prependOnceListener(event: 'callback', listener: (results: any[]) => void): this;
|
||||
removeListener(event: 'callback', listener: (results: any[]) => void): this;
|
||||
listeners(event: 'callback'): Array<(results: any[]) => void>;
|
||||
emit(event: 'callback', results: any[]): boolean;
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -17,6 +17,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"router5-tests.ts"
|
||||
"backoff-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
1
types/backoff/tslint.json
Normal file
1
types/backoff/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
33
types/baidumap-web-sdk/baidumap.overlay.d.ts
vendored
33
types/baidumap-web-sdk/baidumap.overlay.d.ts
vendored
@@ -43,7 +43,8 @@ declare namespace BMap {
|
||||
displayOnMinLevel?: number
|
||||
displayOnMaxLevel?: number
|
||||
}
|
||||
class Marker implements Overlay {
|
||||
interface Marker extends Overlay {}
|
||||
class Marker {
|
||||
constructor(point: Point, opts?: MarkerOptions)
|
||||
openInfoWindow(infoWnd: InfoWindow): void
|
||||
closeInfoWindow(): void
|
||||
@@ -100,7 +101,8 @@ declare namespace BMap {
|
||||
class IconSequence {
|
||||
constructor(symbol: Symbol, offset?: string, repeat?: string, fixedRotation?: boolean)
|
||||
}
|
||||
class PointCollection implements Overlay {
|
||||
interface PointCollection extends Overlay {}
|
||||
class PointCollection {
|
||||
constructor(points: Point[], opts?: PointCollectionOption)
|
||||
setPoints(points: Point[]): void
|
||||
setStyles(styles: PointCollectionOption): void
|
||||
@@ -121,7 +123,8 @@ declare namespace BMap {
|
||||
shadow?: Icon
|
||||
title?: string
|
||||
}
|
||||
class InfoWindow implements Overlay {
|
||||
interface InfoWindow extends Overlay {}
|
||||
class InfoWindow {
|
||||
constructor(content: string | HTMLElement, opts?: InfoWindowOptions)
|
||||
setWidth(width: number): void
|
||||
setHeight(height: number): void
|
||||
@@ -149,7 +152,8 @@ declare namespace BMap {
|
||||
onrestore: (event: { type: string, target: any }) => void
|
||||
onclickclose: (event: { type: string, target: any }) => void
|
||||
}
|
||||
class Polygon implements Overlay {
|
||||
interface Polygon extends Overlay {}
|
||||
class Polygon {
|
||||
constructor(points: Array<Point>, opts?: PolygonOptions)
|
||||
setPath(path: Point[]): void
|
||||
getPath(): Point[]
|
||||
@@ -213,7 +217,8 @@ declare namespace BMap {
|
||||
enableClicking?: boolean
|
||||
}
|
||||
type ShapeType = number
|
||||
class Icon implements Overlay {
|
||||
interface Icon extends Overlay {}
|
||||
class Icon {
|
||||
constructor(url: string, size: Size, opts?: IconOptions)
|
||||
anchor: Size
|
||||
size: Size
|
||||
@@ -230,7 +235,8 @@ declare namespace BMap {
|
||||
setInfoWindowAnchor(anchor: Size): void
|
||||
setPrintImageUrl(url: string): void
|
||||
}
|
||||
class Label implements Overlay {
|
||||
interface Label extends Overlay {}
|
||||
class Label {
|
||||
constructor(content: string, opts?: LabelOptions)
|
||||
setStyle(styles: Object): void
|
||||
setContent(content: string): void
|
||||
@@ -256,7 +262,8 @@ declare namespace BMap {
|
||||
onremove: (event: { type: string, target: any }) => void
|
||||
onrightclick: (event: { type: string, target: any }) => void
|
||||
}
|
||||
class Circle implements Overlay {
|
||||
interface Circle extends Overlay {}
|
||||
class Circle {
|
||||
constructor(center: Point, radius: number, opts?: CircleOptions)
|
||||
setCenter(center: Point): void
|
||||
getCenter(): Point
|
||||
@@ -315,7 +322,8 @@ declare namespace BMap {
|
||||
enableEditing?: boolean
|
||||
enableClicking?: boolean
|
||||
}
|
||||
class Hotspot implements Overlay {
|
||||
interface Hotspot extends Overlay {}
|
||||
class Hotspot {
|
||||
constructor(position: Point, opts?: HotspotOptions)
|
||||
setPosition(position: Point): void
|
||||
getPosition(): Point
|
||||
@@ -324,7 +332,8 @@ declare namespace BMap {
|
||||
setUserData(data: any): void
|
||||
getUserData(): any
|
||||
}
|
||||
class Symbol implements Overlay {
|
||||
interface Symbol extends Overlay {}
|
||||
class Symbol {
|
||||
constructor(path: string | SymbolShapeType, opts?: SymbolOptions)
|
||||
setPath(path: string | SymbolShapeType): void
|
||||
setAnchor(anchor: Size): void
|
||||
@@ -336,7 +345,8 @@ declare namespace BMap {
|
||||
setFillOpacity(opacity: number): void
|
||||
setFillColor(color: string): void
|
||||
}
|
||||
class Polyline implements Overlay {
|
||||
interface Polyline extends Overlay {}
|
||||
class Polyline {
|
||||
constructor(points: Point[], opts?: PolylineOptions)
|
||||
setPath(path: Point[]): void
|
||||
getPath(): Point[]
|
||||
@@ -371,7 +381,8 @@ declare namespace BMap {
|
||||
onremove: (event: { type: string, target: any }) => void
|
||||
onlineupdate: (event: { type: string, target: any }) => void
|
||||
}
|
||||
class GroundOverlay implements Overlay {
|
||||
interface GroundOverlay extends Overlay {}
|
||||
class GroundOverlay {
|
||||
constructor(bounds: Bounds, opts?: GroundOverlayOptions)
|
||||
setBounds(bounds: Bounds): void
|
||||
getBounds(): Bounds
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-misused-new": false
|
||||
// TODOs
|
||||
"no-misused-new": false,
|
||||
"no-any-union": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"no-empty-interface": false,
|
||||
"array-type": false,
|
||||
"unified-signatures": false,
|
||||
"ban-types": false
|
||||
"ban-types": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"moment": ">=2.14.0"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-any-union": false, // TODO
|
||||
"quotemark": [true, "double", "avoid-escape"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"moment": ">=2.14.0"
|
||||
}
|
||||
|
||||
7
types/botvs/botvs-tests.ts
Normal file
7
types/botvs/botvs-tests.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
_N(0, 1);
|
||||
_C(() => void 0);
|
||||
Sleep(1e3);
|
||||
const data: botvs.Record | undefined = void 0;
|
||||
console.log(data);
|
||||
TA.Alligator([]);
|
||||
talib.help('XML');
|
||||
4106
types/botvs/index.d.ts
vendored
Normal file
4106
types/botvs/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
22
types/botvs/tsconfig.json
Normal file
22
types/botvs/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"botvs-tests.ts"
|
||||
]
|
||||
}
|
||||
6
types/botvs/tslint.json
Normal file
6
types/botvs/tslint.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
2
types/bufferstream/postbuffer.d.ts
vendored
2
types/bufferstream/postbuffer.d.ts
vendored
@@ -7,6 +7,4 @@ declare class PostBuffer extends BufferStream {
|
||||
constructor(req: http.IncomingMessage);
|
||||
/** set a callback to get all post data from a http server request */
|
||||
onEnd(callback: (data: any) => void): void;
|
||||
/** pumps data into another stream to allow incoming streams given options will be passed to Stream.pipe */
|
||||
pipe(stream: NodeJS.WritableStream, options?: { end?: boolean }): NodeJS.ReadableStream;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"moment": ">=2.14.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,6 +41,16 @@ chai.request(app)
|
||||
.get('/search')
|
||||
.query({ name: 'foo', limit: 10 });
|
||||
|
||||
chai.request(app)
|
||||
.get('/download')
|
||||
.buffer()
|
||||
.parse((res, cb) => {
|
||||
let data = '';
|
||||
res.setEncoding('binary');
|
||||
res.on('data', (chunk: any) => { data += chunk; });
|
||||
res.on('end', () => { cb(undefined, new Buffer(data, 'binary')); });
|
||||
});
|
||||
|
||||
chai.request(app)
|
||||
.put('/user/me')
|
||||
.send({ passsword: '123', confirmPassword: '123' })
|
||||
|
||||
3
types/chai-http/index.d.ts
vendored
3
types/chai-http/index.d.ts
vendored
@@ -49,6 +49,8 @@ declare global {
|
||||
type: string;
|
||||
status: number;
|
||||
text: string;
|
||||
setEncoding(encoding: string): void;
|
||||
on(event: string, fn: (...args: any[]) => void): void;
|
||||
}
|
||||
|
||||
interface Request extends FinishedRequest {
|
||||
@@ -59,6 +61,7 @@ declare global {
|
||||
auth(user: string, name: string): Request;
|
||||
field(name: string, val: string): Request;
|
||||
buffer(): Request;
|
||||
parse(fn: (res: Response, cb: (e?: Error, r?: any) => void) => void): Request;
|
||||
end(callback?: (err: any, res: Response) => void): FinishedRequest;
|
||||
}
|
||||
|
||||
|
||||
32
types/chart.js/index.d.ts
vendored
32
types/chart.js/index.d.ts
vendored
@@ -4,15 +4,14 @@
|
||||
// Fabien Lavocat <https://github.com/FabienLavocat>
|
||||
// KentarouTakeda <https://github.com/KentarouTakeda>
|
||||
// Larry Bahr <https://github.com/larrybahr>
|
||||
// Daniel Luz <https://github.com/mernen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
declare class Chart {
|
||||
static readonly Chart: typeof Chart;
|
||||
constructor(
|
||||
context: string | JQuery | CanvasRenderingContext2D | HTMLCanvasElement | string[] | CanvasRenderingContext2D[] | HTMLCanvasElement[],
|
||||
context: string | CanvasRenderingContext2D | HTMLCanvasElement | ArrayLike<CanvasRenderingContext2D | HTMLCanvasElement>,
|
||||
options: Chart.ChartConfiguration
|
||||
);
|
||||
config: Chart.ChartConfiguration;
|
||||
@@ -83,6 +82,8 @@ declare namespace Chart {
|
||||
|
||||
type ScaleType = 'category' | 'linear' | 'logarithmic' | 'time' | 'radialLinear';
|
||||
|
||||
type PointStyle = 'circle' | 'cross' | 'crossRot' | 'dash' | 'line' | 'rect' | 'rectRounded' | 'rectRot' | 'star' | 'triangle';
|
||||
|
||||
type PositionType = 'left' | 'right' | 'top' | 'bottom';
|
||||
|
||||
interface ChartArea {
|
||||
@@ -175,7 +176,7 @@ declare namespace Chart {
|
||||
|
||||
interface ChartTitleOptions {
|
||||
display?: boolean;
|
||||
position?: string;
|
||||
position?: PositionType;
|
||||
fullWdith?: boolean;
|
||||
fontSize?: number;
|
||||
fontFamily?: string;
|
||||
@@ -187,10 +188,12 @@ declare namespace Chart {
|
||||
|
||||
interface ChartLegendOptions {
|
||||
display?: boolean;
|
||||
position?: string;
|
||||
position?: PositionType;
|
||||
fullWidth?: boolean;
|
||||
onClick?(event: any, legendItem: any): void;
|
||||
onClick?(event: MouseEvent, legendItem: ChartLegendItem): void;
|
||||
onHover?(event: MouseEvent, legendItem: ChartLegendItem): void;
|
||||
labels?: ChartLegendLabelOptions;
|
||||
reverse?: boolean;
|
||||
}
|
||||
|
||||
interface ChartLegendLabelOptions {
|
||||
@@ -293,7 +296,7 @@ declare namespace Chart {
|
||||
|
||||
interface ChartPointOptions {
|
||||
radius?: number;
|
||||
pointStyle?: string;
|
||||
pointStyle?: PointStyle;
|
||||
backgroundColor?: ChartColor;
|
||||
borderWidth?: number;
|
||||
borderColor?: ChartColor;
|
||||
@@ -332,6 +335,7 @@ declare namespace Chart {
|
||||
|
||||
interface TickOptions {
|
||||
autoSkip?: boolean;
|
||||
autoSkipPadding?: boolean;
|
||||
callback?(value: any, index: any, values: any): string|number;
|
||||
display?: boolean;
|
||||
fontColor?: ChartColor;
|
||||
@@ -386,7 +390,7 @@ declare namespace Chart {
|
||||
type ChartColor = string | CanvasGradient | CanvasPattern | string[];
|
||||
|
||||
interface ChartDataSets {
|
||||
cubicInterpolationMode?: string;
|
||||
cubicInterpolationMode?: 'default' | 'monotone';
|
||||
backgroundColor?: ChartColor | ChartColor[];
|
||||
borderWidth?: number;
|
||||
borderColor?: ChartColor;
|
||||
@@ -394,10 +398,15 @@ declare namespace Chart {
|
||||
borderDash?: number[];
|
||||
borderDashOffset?: number;
|
||||
borderJoinStyle?: string;
|
||||
borderSkipped?: PositionType;
|
||||
data?: number[] | ChartPoint[];
|
||||
fill?: boolean;
|
||||
fill?: boolean | number | string;
|
||||
hoverBackgroundColor?: string | string[];
|
||||
hoverBorderColor?: string | string[];
|
||||
hoverBorderWidth?: number | number[];
|
||||
label?: string;
|
||||
lineTension?: number;
|
||||
steppedLine?: 'before' | 'after' | boolean;
|
||||
pointBorderColor?: ChartColor | ChartColor[];
|
||||
pointBackgroundColor?: ChartColor | ChartColor[];
|
||||
pointBorderWidth?: number | number[];
|
||||
@@ -407,14 +416,15 @@ declare namespace Chart {
|
||||
pointHoverBackgroundColor?: ChartColor | ChartColor[];
|
||||
pointHoverBorderColor?: ChartColor | ChartColor[];
|
||||
pointHoverBorderWidth?: number | number[];
|
||||
pointStyle?: string | string[] | HTMLImageElement | HTMLImageElement[];
|
||||
pointStyle?: PointStyle | HTMLImageElement | Array<PointStyle | HTMLImageElement>;
|
||||
xAxisID?: string;
|
||||
yAxisID?: string;
|
||||
type?: string;
|
||||
hidden?: boolean;
|
||||
hideInLegendAndTooltip?: boolean;
|
||||
showLine?: boolean;
|
||||
stack?: string;
|
||||
spanGaps?: string;
|
||||
spanGaps?: boolean;
|
||||
}
|
||||
|
||||
interface ChartScales {
|
||||
|
||||
@@ -1 +1,6 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-any-union": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
"adjacent-overload-signatures": false,
|
||||
"ban-types": false,
|
||||
"dt-header": false,
|
||||
"unified-signatures": false
|
||||
"no-any-union": false,
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,3 +407,85 @@ function test_sharedSpace() {
|
||||
function test_specifying_editor_path() {
|
||||
window.CKEDITOR_BASEPATH = '/ckeditor/';
|
||||
}
|
||||
|
||||
function test_editor_instance_event() {
|
||||
var textarea = document.createElement('textarea');
|
||||
var instance = CKEDITOR.replace(textarea, {
|
||||
on: {
|
||||
activeEnterModeChange: function() {},
|
||||
activeFilterChange: function() {},
|
||||
afterCommandExec: function() {},
|
||||
afterInsertHtml: function() {},
|
||||
afterPaste: function() {},
|
||||
afterPasteFromWord: function() {},
|
||||
afterSetData: function() {},
|
||||
afterUndoImage: function() {},
|
||||
ariaEditorHelpLabel: function() {},
|
||||
ariaWidget: function() {},
|
||||
autogrow: function() {},
|
||||
beforeCommandExec: function() {},
|
||||
beforeDestroy: function() {},
|
||||
beforeModeUnload: function() {},
|
||||
beforeSetMode: function() {},
|
||||
beforeUndoImage: function() {},
|
||||
blur: function() {},
|
||||
change: function() {},
|
||||
configLoaded: function() {},
|
||||
contentDirChanged: function() {},
|
||||
contentDom: function() {},
|
||||
contentDomInvalidated: function() {},
|
||||
contentDomUnload: function() {},
|
||||
customConfigLoaded: function() {},
|
||||
dataFiltered: function() {},
|
||||
dataReady: function() {},
|
||||
destroy: function() {},
|
||||
dialogHide: function() {},
|
||||
dialogShow: function() {},
|
||||
dirChanged: function() {},
|
||||
doubleclick: function() {},
|
||||
dragend: function() {},
|
||||
dragstart: function() {},
|
||||
drop: function() {},
|
||||
elementsPathUpdate: function() {},
|
||||
fileUploadRequest: function() {},
|
||||
fileUploadResponse: function() {},
|
||||
floatingSpaceLayout: function() {},
|
||||
focus: function() {},
|
||||
getData: function() {},
|
||||
getSnapshot: function() {},
|
||||
insertElement: function() {},
|
||||
insertHtml: function() {},
|
||||
insertText: function() {},
|
||||
instanceReady: function() {},
|
||||
key: function() {},
|
||||
langLoaded: function() {},
|
||||
loadSnapshot: function() {},
|
||||
loaded: function() {},
|
||||
lockSnapshot: function() {},
|
||||
maximize: function() {},
|
||||
menuShow: function() {},
|
||||
mode: function() {},
|
||||
notificationHide: function() {},
|
||||
notificationShow: function() {},
|
||||
notificationUpdate: function() {},
|
||||
paste: function() {},
|
||||
pasteFromWord: function() {},
|
||||
pluginsLoaded: function() {},
|
||||
readOnly: function() {},
|
||||
removeFormatCleanup: function() {},
|
||||
required: function() {},
|
||||
resize: function() {},
|
||||
save: function() {},
|
||||
saveSnapshot: function() {},
|
||||
selectionChange: function() {},
|
||||
setData: function() {},
|
||||
stylesSet: function() {},
|
||||
template: function() {},
|
||||
toDataFormat: function() {},
|
||||
toHtml: function() {},
|
||||
unlockSnapshot: function() {},
|
||||
updateSnapshot: function() {},
|
||||
widgetDefinition: function() {}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
11
types/ckeditor/index.d.ts
vendored
11
types/ckeditor/index.d.ts
vendored
@@ -1163,6 +1163,7 @@ declare namespace CKEDITOR {
|
||||
afterCommandExec?: (evt: CKEDITOR.eventInfo) => void;
|
||||
afterInsertHtml?: (evt: CKEDITOR.eventInfo) => void;
|
||||
afterPaste?: (evt: CKEDITOR.eventInfo) => void;
|
||||
afterPasteFromWord?: (evt: CKEDITOR.eventInfo) => void;
|
||||
afterSetData?: (evt: CKEDITOR.eventInfo) => void;
|
||||
afterUndoImage?: (evt: CKEDITOR.eventInfo) => void;
|
||||
ariaEditorHelpLabel?: (evt: CKEDITOR.eventInfo) => void;
|
||||
@@ -1170,9 +1171,11 @@ declare namespace CKEDITOR {
|
||||
autogrow?: (evt: CKEDITOR.eventInfo) => void;
|
||||
|
||||
beforeCommandExec?: (evt: CKEDITOR.eventInfo) => void;
|
||||
beforeDestroy?: (evt: CKEDITOR.eventInfo) => void;
|
||||
beforeGetData?: (evt: CKEDITOR.eventInfo) => void;
|
||||
beforeModuleUnload?: (evt: CKEDITOR.eventInfo) => void;
|
||||
beforeModeUnload?: (evt: CKEDITOR.eventInfo) => void;
|
||||
beforeSetMode?: (evt: CKEDITOR.eventInfo) => void;
|
||||
beforeUndoImage?: (evt: CKEDITOR.eventInfo) => void;
|
||||
blur?: (evt: CKEDITOR.eventInfo) => void;
|
||||
|
||||
change?: (evt: CKEDITOR.eventInfo) => void;
|
||||
@@ -1189,7 +1192,7 @@ declare namespace CKEDITOR {
|
||||
dialogHide?: (evt: CKEDITOR.eventInfo) => void;
|
||||
dialogShow?: (evt: CKEDITOR.eventInfo) => void;
|
||||
dirChanged?: (evt: CKEDITOR.eventInfo) => void;
|
||||
doubleckick?: (evt: CKEDITOR.eventInfo) => void;
|
||||
doubleclick?: (evt: CKEDITOR.eventInfo) => void;
|
||||
dragend?: (evt: CKEDITOR.eventInfo) => void;
|
||||
dragstart?: (evt: CKEDITOR.eventInfo) => void;
|
||||
drop?: (evt: CKEDITOR.eventInfo) => void;
|
||||
@@ -1207,7 +1210,7 @@ declare namespace CKEDITOR {
|
||||
insertElement?: (evt: CKEDITOR.eventInfo) => void;
|
||||
insertHtml?: (evt: CKEDITOR.eventInfo) => void;
|
||||
insertText?: (evt: CKEDITOR.eventInfo) => void;
|
||||
insanceReady?: (evt: CKEDITOR.eventInfo) => void;
|
||||
instanceReady?: (evt: CKEDITOR.eventInfo) => void;
|
||||
|
||||
key?: (evt: CKEDITOR.eventInfo) => void;
|
||||
|
||||
@@ -1224,6 +1227,7 @@ declare namespace CKEDITOR {
|
||||
notificationUpdate?: (evt: CKEDITOR.eventInfo) => void;
|
||||
|
||||
paste?: (evt: CKEDITOR.eventInfo) => void;
|
||||
pasteFromWord?: (evt: CKEDITOR.eventInfo) => void;
|
||||
pluginsLoaded?: (evt: CKEDITOR.eventInfo) => void;
|
||||
|
||||
readOnly?: (evt: CKEDITOR.eventInfo) => void;
|
||||
@@ -1851,4 +1855,3 @@ declare namespace CKEDITOR {
|
||||
function detect(defaultLanguage: string, probeLanguage: string): string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"moment": ">=2.8.3"
|
||||
}
|
||||
|
||||
@@ -1,16 +1,22 @@
|
||||
{
|
||||
"files": [
|
||||
"collections-tests.ts",
|
||||
"index.d.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"lib": ["es6"],
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"noEmit": true
|
||||
}
|
||||
}
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"collections-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -13,4 +13,5 @@ app.use(flash({
|
||||
app.use(function(req: Express.Request, res: Express.Response, next: Function) {
|
||||
req.flash('Message');
|
||||
req.flash('info', 'Message');
|
||||
req.flash();
|
||||
});
|
||||
|
||||
1
types/connect-flash/index.d.ts
vendored
1
types/connect-flash/index.d.ts
vendored
@@ -7,6 +7,7 @@
|
||||
|
||||
declare namespace Express {
|
||||
export interface Request {
|
||||
flash(): { [key: string]: string[] };
|
||||
flash(message: string): any;
|
||||
flash(event: string, message: string): any;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"one-variable-per-declaration": false,
|
||||
"space-before-function-paren": false,
|
||||
"no-var": false,
|
||||
"interface-over-type-literal": false
|
||||
"interface-over-type-literal": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -5,9 +5,14 @@
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false
|
||||
"ban-types": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"eventemitter2": "^4.1.0"
|
||||
}
|
||||
}
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"eventemitter2": "^4.1.0"
|
||||
}
|
||||
}
|
||||
@@ -1 +1,6 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-any-union": false,
|
||||
"prefer-method-signature": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,8 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"no-any-union": false,
|
||||
"rules": {
|
||||
"no-any-union": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-any-union": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-any-union": false
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
}
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"rules": {
|
||||
// TODO
|
||||
"no-this-assignment": false,
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"rules": {
|
||||
// TODO
|
||||
"no-this-assignment": false,
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,10 @@
|
||||
// TODO
|
||||
"no-this-assignment": false,
|
||||
"unified-signatures": false,
|
||||
"max-line-length": [false, 200]
|
||||
"max-line-length": [
|
||||
false,
|
||||
200
|
||||
],
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false,
|
||||
"no-empty-interface": false
|
||||
"no-empty-interface": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODO
|
||||
"no-any-union": false,
|
||||
"no-this-assignment": false,
|
||||
"unified-signatures": false
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODO
|
||||
// TODOs
|
||||
"no-any-union": false,
|
||||
"no-this-assignment": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"unified-signatures": false,
|
||||
"max-line-length": [false, 145]
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false,
|
||||
"callable-types": false
|
||||
"callable-types": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"rules": {
|
||||
// TODO
|
||||
"no-this-assignment": false,
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
// TODO
|
||||
"no-this-assignment": false,
|
||||
"unified-signatures": false,
|
||||
"callable-types": false
|
||||
"callable-types": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"rules": {
|
||||
// TODO
|
||||
"no-this-assignment": false,
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"rules": {
|
||||
// TODO
|
||||
"no-this-assignment": false,
|
||||
"unified-signatures": false
|
||||
"unified-signatures": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"moment": ">=2.14.0"
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user