mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-29 09:41:45 +00:00
Merge branch 'master' into patch-1
This commit is contained in:
+351
-152
File diff suppressed because it is too large
Load Diff
@@ -156,12 +156,6 @@
|
||||
"sourceRepoURL": "https://github.com/brianloveswords/base64url",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "better-scroll",
|
||||
"typingsPackageName": "better-scroll",
|
||||
"sourceRepoURL": "https://github.com/ustbhuangyi/better-scroll",
|
||||
"asOfVersion": "1.5.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "BigInteger.js",
|
||||
"typingsPackageName": "big-integer",
|
||||
@@ -396,6 +390,12 @@
|
||||
"sourceRepoURL": "https://github.com/MikeMcl/decimal.js",
|
||||
"asOfVersion": "7.4.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "delay",
|
||||
"typingsPackageName": "delay",
|
||||
"sourceRepoURL": "https://github.com/sindresorhus/delay",
|
||||
"asOfVersion": "3.1.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "DevExtreme",
|
||||
"typingsPackageName": "devextreme",
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { AbstractLevelDOWN } from 'abstract-leveldown';
|
||||
|
||||
const test = (levelDown: AbstractLevelDOWN<any, string>) => {
|
||||
levelDown.put("key", "value", (err?) => { });
|
||||
levelDown.put(1, "value", { something: true }, (err?) => { });
|
||||
|
||||
levelDown.get("key", (err?) => { });
|
||||
levelDown.get(1, { something: true }, (err?) => { });
|
||||
};
|
||||
// $ExpectType void
|
||||
test(new AbstractLevelDOWN('here'));
|
||||
// $ExpectType void
|
||||
test(AbstractLevelDOWN('there'));
|
||||
Vendored
+103
@@ -0,0 +1,103 @@
|
||||
// Type definitions for abstract-leveldown 5.0
|
||||
// Project: https://github.com/Level/abstract-leveldown
|
||||
// Definitions by: Meirion Hughes <https://github.com/MeirionHughes>
|
||||
// Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface AbstractOptions {
|
||||
readonly [k: string]: any;
|
||||
}
|
||||
|
||||
export type ErrorCallback = (err: Error | undefined) => void;
|
||||
export type ErrorValueCallback<V> = (err: Error | undefined, value: V) => void;
|
||||
export type ErrorKeyValueCallback<K, V> = (err: Error | undefined, key: K, value: V) => void;
|
||||
|
||||
export interface AbstractOpenOptions extends AbstractOptions {
|
||||
createIfMissing?: boolean;
|
||||
errorIfExists?: boolean;
|
||||
}
|
||||
|
||||
export interface AbstractGetOptions extends AbstractOptions {
|
||||
asBuffer?: boolean;
|
||||
}
|
||||
|
||||
export interface AbstractLevelDOWN<K, V> extends AbstractOptions {
|
||||
open(cb: ErrorCallback): void;
|
||||
open(options: AbstractOpenOptions, cb: ErrorCallback): void;
|
||||
|
||||
close(cb: ErrorCallback): void;
|
||||
|
||||
get(key: K, cb: ErrorValueCallback<V>): void;
|
||||
get(key: K, options: AbstractGetOptions, cb: ErrorValueCallback<V>): void;
|
||||
|
||||
put(key: K, value: V, cb: ErrorCallback): void;
|
||||
put(key: K, value: V, options: AbstractOptions, cb: ErrorCallback): void;
|
||||
|
||||
del(key: K, cb: ErrorCallback): void;
|
||||
del(key: K, options: AbstractOptions, cb: ErrorCallback): void;
|
||||
|
||||
batch(): AbstractChainedBatch<K, V>;
|
||||
batch(array: ReadonlyArray<AbstractBatch<K, V>>, cb: ErrorCallback): AbstractChainedBatch<K, V>;
|
||||
batch(array: ReadonlyArray<AbstractBatch<K, V>>, options: AbstractOptions, cb: ErrorCallback): AbstractChainedBatch<K, V>;
|
||||
|
||||
iterator(options?: AbstractIteratorOptions<K>): AbstractIterator<K, V>;
|
||||
}
|
||||
|
||||
export interface AbstractLevelDOWNConstructor {
|
||||
new (location: string): AbstractLevelDOWN<any, any>;
|
||||
(location: string): AbstractLevelDOWN<any, any>;
|
||||
}
|
||||
|
||||
export interface AbstractIteratorOptions<K> extends AbstractOptions {
|
||||
gt?: K;
|
||||
gte?: K;
|
||||
lt?: K;
|
||||
lte?: K;
|
||||
reverse?: boolean;
|
||||
limit?: number;
|
||||
keys?: boolean;
|
||||
values?: boolean;
|
||||
keyAsBuffer?: boolean;
|
||||
valueAsBuffer?: boolean;
|
||||
}
|
||||
|
||||
export type AbstractBatch<K, V> = PutBatch<K, V> | DelBatch<K, V>;
|
||||
|
||||
export interface PutBatch<K, V> {
|
||||
readonly type: 'put';
|
||||
readonly key: K;
|
||||
readonly value: V;
|
||||
}
|
||||
|
||||
export interface DelBatch<K, V> {
|
||||
readonly type: 'del';
|
||||
readonly key: K;
|
||||
}
|
||||
|
||||
export interface AbstractChainedBatch<K, V> extends AbstractChainedBatchConstructor, AbstractOptions {
|
||||
put: (key: K, value: V) => this;
|
||||
del: (key: K) => this;
|
||||
clear: () => this;
|
||||
write(cb: ErrorCallback): any;
|
||||
write(options: any, cb: ErrorCallback): any;
|
||||
}
|
||||
|
||||
export interface AbstractChainedBatchConstructor {
|
||||
new(db: any): AbstractChainedBatch<any, any>;
|
||||
(db: any): AbstractChainedBatch<any, any>;
|
||||
}
|
||||
|
||||
export interface AbstractIterator<K, V> extends AbstractChainedBatchConstructor {
|
||||
db: AbstractLevelDOWN<K, V>;
|
||||
next(cb: ErrorKeyValueCallback<K, V>): this;
|
||||
end(cb: ErrorCallback): void;
|
||||
}
|
||||
|
||||
export interface AbstractIteratorConstructor {
|
||||
new(db: any): AbstractIterator<any, any>;
|
||||
(db: any): AbstractIterator<any, any>;
|
||||
}
|
||||
|
||||
export const AbstractLevelDOWN: AbstractLevelDOWNConstructor;
|
||||
export const AbstractIterator: AbstractIteratorConstructor;
|
||||
export const AbstractChainedBatch: AbstractChainedBatchConstructor;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"abstract-leveldown-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
import Agenda = require("agenda");
|
||||
import { Db, Server } from "mongodb";
|
||||
import { Db, Server, MongoClient } from "mongodb";
|
||||
|
||||
var mongoConnectionString = "mongodb://127.0.0.1/agenda";
|
||||
|
||||
(async () => {
|
||||
var agenda = new Agenda({ db: { address: mongoConnectionString } });
|
||||
var agenda = new Agenda({
|
||||
mongo: (await MongoClient.connect(mongoConnectionString)).db(),
|
||||
db: { collection: 'agenda-jobs' },
|
||||
});
|
||||
|
||||
agenda.define<{ foo: Error }>('delete old users', (job, done) => {
|
||||
done(job.attrs.data.foo)
|
||||
|
||||
Vendored
+5
-12
@@ -203,17 +203,7 @@ declare namespace Agenda {
|
||||
/**
|
||||
* Specifies that Agenda should be initialized using and existing MongoDB connection.
|
||||
*/
|
||||
mongo?: {
|
||||
/**
|
||||
* The MongoDB database connection to use.
|
||||
*/
|
||||
db: Db;
|
||||
|
||||
/**
|
||||
* The name of the collection to use.
|
||||
*/
|
||||
collection?: string;
|
||||
}
|
||||
mongo?: Db;
|
||||
|
||||
/**
|
||||
* Specifies that Agenda should connect to MongoDB.
|
||||
@@ -221,8 +211,10 @@ declare namespace Agenda {
|
||||
db?: {
|
||||
/**
|
||||
* The connection URL.
|
||||
* Required when using `db` option to connect.
|
||||
* Not required when an existing connection is passed as `mongo` property.
|
||||
*/
|
||||
address: string;
|
||||
address?: string;
|
||||
|
||||
/**
|
||||
* The name of the collection to use.
|
||||
@@ -231,6 +223,7 @@ declare namespace Agenda {
|
||||
|
||||
/**
|
||||
* Connection options to pass to MongoDB.
|
||||
* Not required when an existing connection is passed as `mongo` property.
|
||||
*/
|
||||
options?: any;
|
||||
}
|
||||
|
||||
Vendored
+8
@@ -1776,6 +1776,14 @@ declare namespace algoliasearch {
|
||||
facets?: {
|
||||
[facetName: string]: { [facetValue: string]: number };
|
||||
};
|
||||
facets_stats?: {
|
||||
[facetName: string]: {
|
||||
avg: number,
|
||||
max: number,
|
||||
min: number,
|
||||
sum: number,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
interface MultiResponse {
|
||||
|
||||
Vendored
+9
@@ -4,6 +4,7 @@
|
||||
// Haroen Viaene <https://github.com/haroenv>
|
||||
// Aurélien Hervé <https://github.com/aherve>
|
||||
// Samuel Vaillant <https://github.com/samouss>
|
||||
// Claas Brüggemann <https://github.com/ClaasBrueggemann>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -570,6 +571,14 @@ declare namespace algoliasearch {
|
||||
facets?: {
|
||||
[facetName: string]: { [facetValue: string]: number };
|
||||
};
|
||||
facets_stats?: {
|
||||
[facetName: string]: {
|
||||
avg: number,
|
||||
max: number,
|
||||
min: number,
|
||||
sum: number,
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
interface MultiResponse {
|
||||
|
||||
@@ -38,4 +38,9 @@ app.controller('Ctrl', ($scope: ng.IScope, blockUI: angular.blockUI.BlockUIServi
|
||||
blockUI.message("Hello Types");
|
||||
blockUI.done();
|
||||
const b: boolean = blockUI.isBlocking();
|
||||
|
||||
const myBlockUI = blockUI.instances.get("myBlockUI");
|
||||
myBlockUI.start();
|
||||
myBlockUI.reset();
|
||||
myBlockUI.stop();
|
||||
});
|
||||
|
||||
Vendored
+7
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for angular-block-ui 0.2
|
||||
// Project: https://github.com/McNull/angular-block-ui
|
||||
// Definitions by: Lasse Nørregaard <https://github.com/lassebn>, Stephan Classen <https://github.com/sclassen>
|
||||
// Definitions by: Lasse Nørregaard <https://github.com/lassebn>, Stephan Classen <https://github.com/sclassen>, Soner Köksal <https://github.com/renjfk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -164,6 +164,12 @@ declare module 'angular' {
|
||||
* Returns whether currently a block is shown for the instance or not.
|
||||
*/
|
||||
isBlocking(): boolean;
|
||||
|
||||
instances: BlockUIInstances;
|
||||
}
|
||||
|
||||
interface BlockUIInstances {
|
||||
get(id: string): BlockUIService;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
interface MyService {
|
||||
getFirstname(): ng.IPromise<string>;
|
||||
getLastname(): ng.IPromise<string>;
|
||||
}
|
||||
|
||||
function TestCtrl($q: ng.IQService, MyService: MyService) {
|
||||
function arrayCallback(result: [ng.PromiseValue<string>, ng.PromiseValue<string>]) {
|
||||
const firstnameOk: boolean = $q.isFulfilledState(result[0]);
|
||||
const lastnameOk: boolean = $q.isFulfilledState(result[1]);
|
||||
}
|
||||
|
||||
function objectCallback(result: {firstname: ng.PromiseValue<string>, lastname: ng.PromiseValue<string>}) {
|
||||
const firstnameOk: boolean = $q.isFulfilledState(result.firstname);
|
||||
const lastnameOk: boolean = $q.isFulfilledState(result.lastname);
|
||||
}
|
||||
|
||||
$q
|
||||
.allSettled([
|
||||
MyService.getFirstname(),
|
||||
MyService.getLastname()
|
||||
])
|
||||
.then(arrayCallback);
|
||||
|
||||
$q
|
||||
.allSettled({
|
||||
firstname: MyService.getFirstname(),
|
||||
lastname: MyService.getLastname()
|
||||
})
|
||||
.then(objectCallback);
|
||||
}
|
||||
|
||||
TestCtrl.$inject = ['$q', 'MyService'];
|
||||
|
||||
angular.module('test').controller('TestCtrl', TestCtrl);
|
||||
Vendored
+42
@@ -0,0 +1,42 @@
|
||||
// Type definitions for angular-q-extras 1.1
|
||||
// Project: https://github.com/niqdev/angular-q-extras
|
||||
// Definitions by: Damien Sorel <https://github.com/mistic100>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
declare var _: string;
|
||||
export = _;
|
||||
|
||||
import * as angular from 'angular';
|
||||
|
||||
declare module 'angular' {
|
||||
type PromiseState = 'fulfilled' | 'rejected';
|
||||
|
||||
interface PromiseValue<T> {
|
||||
state: PromiseState;
|
||||
value?: T;
|
||||
reason?: any;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line interface-name
|
||||
interface IQService {
|
||||
// tslint:disable:max-line-length
|
||||
allSettled<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>, T5 | IPromise<T5>, T6 | IPromise<T6>, T7 | IPromise<T7>, T8 | IPromise<T8>, T9 | IPromise<T9>, T10 | IPromise<T10>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>, PromiseValue<T5>, PromiseValue<T6>, PromiseValue<T7>, PromiseValue<T8>, PromiseValue<T9>, PromiseValue<T10>]>;
|
||||
allSettled<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>, T5 | IPromise<T5>, T6 | IPromise<T6>, T7 | IPromise<T7>, T8 | IPromise<T8>, T9 | IPromise<T9>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>, PromiseValue<T5>, PromiseValue<T6>, PromiseValue<T7>, PromiseValue<T8>, PromiseValue<T9>]>;
|
||||
allSettled<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>, T5 | IPromise<T5>, T6 | IPromise<T6>, T7 | IPromise<T7>, T8 | IPromise<T8>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>, PromiseValue<T5>, PromiseValue<T6>, PromiseValue<T7>, PromiseValue<T8>]>;
|
||||
allSettled<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>, T5 | IPromise<T5>, T6 | IPromise<T6>, T7 | IPromise<T7>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>, PromiseValue<T5>, PromiseValue<T6>, PromiseValue<T7>]>;
|
||||
allSettled<T1, T2, T3, T4, T5, T6>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>, T5 | IPromise<T5>, T6 | IPromise<T6>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>, PromiseValue<T5>, PromiseValue<T6>]>;
|
||||
allSettled<T1, T2, T3, T4, T5>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>, T5 | IPromise<T5>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>, PromiseValue<T5>]>;
|
||||
allSettled<T1, T2, T3, T4>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>, T4 | IPromise<T4>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>, PromiseValue<T4>]>;
|
||||
allSettled<T1, T2, T3>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>, T3 | IPromise<T3>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>, PromiseValue<T3>]>;
|
||||
allSettled<T1, T2>(values: [T1 | IPromise<T1>, T2 | IPromise<T2>]): IPromise<[PromiseValue<T1>, PromiseValue<T2>]>;
|
||||
// tslint:enable:max-line-length
|
||||
|
||||
allSettled<TAll>(promises: Array<TAll | IPromise<TAll>>): IPromise<Array<PromiseValue<TAll>>>;
|
||||
|
||||
allSettled<T>(promises: { [K in keyof T]: (T[K] | IPromise<T[K]>); }): IPromise<{ [K in keyof T]: PromiseValue<T[K]>; }>;
|
||||
|
||||
isFulfilledState(promise: PromiseValue<any>): boolean;
|
||||
isRejectedState(promise: PromiseValue<any>): boolean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-q-extras-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
import * as ansi from 'ansi-escape-sequences';
|
||||
|
||||
// $ExpectType string
|
||||
ansi.style.red;
|
||||
// $ExpectError
|
||||
ansi.style.invalidStyle;
|
||||
|
||||
// $ExpectType string
|
||||
ansi.styles('green');
|
||||
// $ExpectType string
|
||||
ansi.styles(['green', 'underline']);
|
||||
// $ExpectError
|
||||
ansi.styles('invalidStyle');
|
||||
// $ExpectError
|
||||
ansi.styles(['invalidStyle']);
|
||||
|
||||
// $ExpectType string
|
||||
ansi.format('what?', 'green');
|
||||
// $ExpectType string
|
||||
ansi.format('what?', ['green', 'bold']);
|
||||
// $ExpectType string
|
||||
ansi.format('[green bold]{what?}');
|
||||
// $ExpectError
|
||||
ansi.styles('what?', 'invalidStyle');
|
||||
// $ExpectError
|
||||
ansi.styles('what?', ['invalidStyle']);
|
||||
|
||||
// $ExpectType string
|
||||
ansi.cursor.up();
|
||||
// $ExpectType string
|
||||
ansi.cursor.up(1);
|
||||
|
||||
// $ExpectType string
|
||||
ansi.cursor.hide;
|
||||
// $ExpectType string
|
||||
ansi.cursor.show;
|
||||
|
||||
// $ExpectType string
|
||||
ansi.erase.display();
|
||||
// $ExpectType string
|
||||
ansi.erase.display(3);
|
||||
// $ExpectError
|
||||
ansi.erase.display(4);
|
||||
|
||||
// $ExpectType string
|
||||
ansi.erase.inLine();
|
||||
// $ExpectType string
|
||||
ansi.erase.inLine(2);
|
||||
// $ExpectError
|
||||
ansi.erase.inLine(3);
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
// Type definitions for ansi-escape-sequences 4.0
|
||||
// Project: https://github.com/75lb/ansi-escape-sequences#readme
|
||||
// Definitions by: Alexander Marks <https://github.com/aomarks>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export type Style = 'reset'|'bold'|'italic'|'underline'|'fontDefault'|'font2'|
|
||||
'font3'|'font4'|'font5'|'font6'|'imageNegative'|'imagePositive'|'black'|
|
||||
'red'|'green'|'yellow'|'blue'|'magenta'|'cyan'|'white'|'grey'|'gray'|
|
||||
'bg-black'|'bg-red'|'bg-green'|'bg-yellow'|'bg-blue'|'bg-magenta'|'bg-cyan'|
|
||||
'bg-white'|'bg-grey'|'bg-gray';
|
||||
|
||||
/**
|
||||
* Various formatting styles (aka Select Graphic Rendition codes).
|
||||
*
|
||||
* @example
|
||||
* console.log(ansi.style.red + 'this is red' + ansi.style.reset)
|
||||
*/
|
||||
export const style: {[K in Style]: string};
|
||||
|
||||
/**
|
||||
* Returns an ansi sequence setting one or more effects.
|
||||
*
|
||||
* @param styles a style, or list or styles
|
||||
*
|
||||
* @example
|
||||
* > ansi.styles('green')
|
||||
* '\u001b[32m'
|
||||
*
|
||||
* > ansi.styles([ 'green', 'underline' ])
|
||||
* '\u001b[32;4m'
|
||||
*/
|
||||
export function styles(styles: Style|ReadonlyArray<Style>): string;
|
||||
|
||||
/**
|
||||
* A convenience function, applying the provided styles to the input string and
|
||||
* then resetting.
|
||||
*
|
||||
* Inline styling can be applied using the syntax `[style-list]{text to
|
||||
* format}`, where `style-list` is a space-separated list of styles from {@link
|
||||
* module:ansi-escape-sequences.style ansi.style}. For example `[bold white
|
||||
* bg-red]{bold white text on a red background}`.
|
||||
*
|
||||
* @param str the string to format
|
||||
* @param styles a style or list of styles to add to the input string
|
||||
*
|
||||
* @example
|
||||
* > ansi.format('what?', 'green')
|
||||
* '\u001b[32mwhat?\u001b[0m'
|
||||
*
|
||||
* > ansi.format('what?', ['green', 'bold'])
|
||||
* '\u001b[32;1mwhat?\u001b[0m'
|
||||
*
|
||||
* > ansi.format('[green bold]{what?}')
|
||||
* '\u001b[32;1mwhat?\u001b[0m'
|
||||
*/
|
||||
export function format(
|
||||
str: string, styles?: Style|ReadonlyArray<Style>): string;
|
||||
|
||||
/**
|
||||
* cursor-related sequences
|
||||
*/
|
||||
export namespace cursor {
|
||||
/**
|
||||
* Moves the cursor `lines` cells up. If the cursor is already at the edge
|
||||
* of the screen, this has no effect.
|
||||
* @param lines default=1
|
||||
*/
|
||||
function up(lines?: number): string;
|
||||
|
||||
/**
|
||||
* Moves the cursor `lines` cells down. If the cursor is already at the edge
|
||||
* of the screen, this has no effect.
|
||||
* @param lines default=1
|
||||
*/
|
||||
function down(lines?: number): string;
|
||||
|
||||
/**
|
||||
* Moves the cursor `lines` cells forward. If the cursor is already at the
|
||||
* edge of the screen, this has no effect.
|
||||
* @param lines default=1
|
||||
*/
|
||||
function forward(lines?: number): string;
|
||||
|
||||
/**
|
||||
* Moves the cursor `lines` cells back. If the cursor is already at the edge
|
||||
* of the screen, this has no effect.
|
||||
* @param lines default=1
|
||||
*/
|
||||
function back(lines?: number): string;
|
||||
|
||||
/**
|
||||
* Moves cursor to beginning of the line n lines down.
|
||||
* @param lines default=1
|
||||
*/
|
||||
function nextLine(lines?: number): string;
|
||||
|
||||
/**
|
||||
* Moves cursor to beginning of the line n lines up.
|
||||
* @param lines default=1
|
||||
*/
|
||||
function previousLine(lines?: number): string;
|
||||
|
||||
/**
|
||||
* Moves the cursor to column n.
|
||||
* @param n column number
|
||||
*/
|
||||
function horizontalAbsolute(n: number): string;
|
||||
|
||||
/**
|
||||
* Moves the cursor to row n, column m. The values are 1-based, and default
|
||||
* to 1 (top left corner) if omitted.
|
||||
*
|
||||
* @param n row number, default=1
|
||||
* @param m column number, default=1
|
||||
*/
|
||||
function position(n?: number, m?: number): string;
|
||||
|
||||
/**
|
||||
* Hides the cursor
|
||||
*/
|
||||
const hide: string;
|
||||
|
||||
/**
|
||||
* Shows the cursor
|
||||
*/
|
||||
const show: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* erase sequences
|
||||
*/
|
||||
export namespace erase {
|
||||
/**
|
||||
* Clears part of the screen. If n is 0 (or missing), clear from cursor to
|
||||
* end of screen. If n is 1, clear from cursor to beginning of the screen.
|
||||
* If n is 2, clear entire screen. If n is 3, clear entire screen and delete
|
||||
* all lines saved in the scrollback buffer (some terminals only).
|
||||
*/
|
||||
function display(n?: 0|1|2|3): string;
|
||||
|
||||
/**
|
||||
* Erases part of the line. If n is zero (or missing), clear from cursor to
|
||||
* the end of the line. If n is one, clear from cursor to beginning of the
|
||||
* line. If n is two, clear entire line. Cursor position does not change.
|
||||
*/
|
||||
function inLine(n?: 0|1|2): string;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ansi-escape-sequences-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+3
-2
@@ -14,12 +14,13 @@ type FontFamily =
|
||||
|
||||
type Omit<T, K extends keyof T> = Pick<T, ({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never, [x: number]: never })[keyof T]>;
|
||||
|
||||
type CSSProperties = Omit<BaseCSSProperties, 'fontFamily'> & {
|
||||
type CSSProperties = Omit<BaseCSSProperties, 'fontFamily' | 'transition' | 'animationName' > & {
|
||||
fontFamily?: FontFamily | FontFamily[];
|
||||
animationName?: string | OpenCSSProperties | OpenCSSProperties[];
|
||||
};
|
||||
|
||||
// For pseudo selectors and media queries
|
||||
interface OpenCSSProperties extends CSSProperties {
|
||||
interface OpenCSSProperties extends CSSProperties {
|
||||
[k: string]: CSSProperties[keyof CSSProperties] | CSSProperties;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,17 +17,24 @@ const config: Microsoft.ApplicationInsights.IConfig = {
|
||||
autoTrackPageVisitTime: true,
|
||||
disableExceptionTracking: false,
|
||||
disableAjaxTracking: false,
|
||||
disableFetchTracking: true,
|
||||
overridePageViewDuration: false,
|
||||
maxAjaxCallsPerView: -1,
|
||||
disableDataLossAnalysis: true,
|
||||
disableCorrelationHeaders: true,
|
||||
correlationHeaderExcludedDomains: [],
|
||||
disableFlushOnBeforeUnload: false,
|
||||
enableSessionStorageBuffer: false,
|
||||
cookieDomain: "",
|
||||
isCookieUseDisabled: true,
|
||||
isRetryDisabled: true,
|
||||
isPerfAnalyzerEnabled: true,
|
||||
isStorageUseDisabled: true
|
||||
url: "url",
|
||||
isStorageUseDisabled: true,
|
||||
isBeaconApiDisabled: false,
|
||||
sdkExtension: "sdkExtension",
|
||||
isBrowserLinkTrackingEnabled: false,
|
||||
appId: "appId",
|
||||
enableCorsCorrelation: false
|
||||
};
|
||||
|
||||
appInsights = {
|
||||
@@ -175,3 +182,8 @@ const traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", nu
|
||||
const traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Trace>(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj);
|
||||
const traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType);
|
||||
context.track(traceEnvelope);
|
||||
|
||||
// UtilHelpers
|
||||
let Util: typeof Microsoft.ApplicationInsights.UtilHelpers;
|
||||
|
||||
Util.newId();
|
||||
|
||||
+15
-1
@@ -1,6 +1,7 @@
|
||||
// Type definitions for ApplicationInsights-JS 1.0
|
||||
// Project: https://github.com/Microsoft/ApplicationInsights-JS
|
||||
// Definitions by: Kamil Szostak <https://github.com/kamilszostak>
|
||||
// Mark Wolff <https://github.com/markwolff>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module AI {
|
||||
@@ -560,19 +561,24 @@ declare module Microsoft.ApplicationInsights {
|
||||
samplingPercentage?: number;
|
||||
autoTrackPageVisitTime?: boolean;
|
||||
disableAjaxTracking?: boolean;
|
||||
disableFetchTracking?: boolean;
|
||||
overridePageViewDuration?: boolean;
|
||||
maxAjaxCallsPerView?: number;
|
||||
disableDataLossAnalysis?: boolean;
|
||||
disableCorrelationHeaders?: boolean;
|
||||
correlationHeaderExcludedDomains?: string[];
|
||||
disableFlushOnBeforeUnload?: boolean;
|
||||
enableSessionStorageBuffer?: boolean;
|
||||
isCookieUseDisabled?: boolean;
|
||||
cookieDomain?: string;
|
||||
isRetryDisabled?: boolean;
|
||||
isPerfAnalyzerEnabled?: boolean;
|
||||
url?: string;
|
||||
isStorageUseDisabled?: boolean;
|
||||
isBeaconApiDisabled?: boolean;
|
||||
sdkExtension?: string;
|
||||
isBrowserLinkTrackingEnabled?: boolean;
|
||||
appId?: string;
|
||||
enableCorsCorrelation?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -793,10 +799,18 @@ declare module Microsoft.ApplicationInsights {
|
||||
*/
|
||||
_onerror(message: string, url: string, lineNumber: number, columnNumber: number, error: Error): any;
|
||||
}
|
||||
|
||||
class UtilHelpers {
|
||||
/**
|
||||
* Generate a random ID string
|
||||
*/
|
||||
static newId(): string;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'applicationinsights-js' {
|
||||
const AppInsights: Microsoft.ApplicationInsights.IAppInsights;
|
||||
const Util: typeof Microsoft.ApplicationInsights.UtilHelpers;
|
||||
}
|
||||
|
||||
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
|
||||
|
||||
@@ -99,10 +99,9 @@ console.log(
|
||||
|
||||
const view = db._view("yolo")!;
|
||||
view.properties({
|
||||
locale: "C",
|
||||
commit: {
|
||||
consolidate: {
|
||||
bytes: { segmentThreshold: 20 }
|
||||
}
|
||||
consolidationIntervalMsec: 123,
|
||||
consolidationPolicy: {
|
||||
type: "bytes",
|
||||
segmentThreshold: 234
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+18
-26
@@ -848,10 +848,11 @@ declare namespace ArangoDB {
|
||||
): ArangoSearchViewProperties;
|
||||
}
|
||||
|
||||
interface ArangoSearchViewConsolidate {
|
||||
threshold: number;
|
||||
segmentThreshold: number;
|
||||
}
|
||||
type ArangoSearchViewConsolidationType =
|
||||
| "bytes"
|
||||
| "bytes_accum"
|
||||
| "count"
|
||||
| "fill";
|
||||
|
||||
interface ArangoSearchViewCollectionLink {
|
||||
analyzers?: string[];
|
||||
@@ -865,35 +866,26 @@ declare namespace ArangoDB {
|
||||
id: string;
|
||||
name: string;
|
||||
type: "arangosearch";
|
||||
commit: {
|
||||
cleanupIntervalStep: number;
|
||||
commitIntervalMsec: number;
|
||||
consolidate: {
|
||||
bytes?: ArangoSearchViewConsolidate;
|
||||
bytes_accum?: ArangoSearchViewConsolidate;
|
||||
count?: ArangoSearchViewConsolidate;
|
||||
fill?: ArangoSearchViewConsolidate;
|
||||
};
|
||||
|
||||
cleanupIntervalStep: number;
|
||||
consolidationIntervalMsec: number;
|
||||
consolidationPolicy: {
|
||||
type: ArangoSearchViewConsolidationType;
|
||||
segmentThreshold: number;
|
||||
threshold: number;
|
||||
};
|
||||
locale: string;
|
||||
links: {
|
||||
[key: string]: ArangoSearchViewCollectionLink | undefined;
|
||||
};
|
||||
}
|
||||
|
||||
interface ArangoSearchViewPropertiesOptions {
|
||||
locale?: string;
|
||||
commit?: {
|
||||
consolidate?:
|
||||
| "none"
|
||||
| {
|
||||
count?: Partial<ArangoSearchViewConsolidate>;
|
||||
bytes?: Partial<ArangoSearchViewConsolidate>;
|
||||
bytes_accum?: Partial<ArangoSearchViewConsolidate>;
|
||||
fill?: Partial<ArangoSearchViewConsolidate>;
|
||||
};
|
||||
commitIntervalMsec?: number;
|
||||
cleanupIntervalStep?: number;
|
||||
cleanupIntervalStep?: number;
|
||||
consolidationIntervalMsec?: number;
|
||||
consolidationPolicy?: {
|
||||
type?: ArangoSearchViewConsolidationType;
|
||||
segmentThreshold?: number;
|
||||
threshold?: number;
|
||||
};
|
||||
links?: {
|
||||
[key: string]: ArangoSearchViewCollectionLink | undefined;
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import BScroll from 'better-scroll';
|
||||
|
||||
const BScroll1 = new BScroll('#wrapper');
|
||||
const BScroll2 = new BScroll('#wrapper', { scrollX: false, scrollY: false });
|
||||
const BScroll3 = new BScroll('#wrapper', {
|
||||
snap: true,
|
||||
wheel: false,
|
||||
scrollbar: false,
|
||||
pullDownRefresh: false,
|
||||
});
|
||||
const BScroll4 = new BScroll('#wrapper', {
|
||||
wheel: {
|
||||
selectedIndex: 0,
|
||||
},
|
||||
});
|
||||
const BScroll6 = new BScroll('#wrapper', {
|
||||
snap: {
|
||||
loop: false,
|
||||
el: document.querySelector('div-test') as Element,
|
||||
threshold: 0.1,
|
||||
stepX: 100,
|
||||
stepY: 100,
|
||||
listenFlick: true,
|
||||
},
|
||||
});
|
||||
const BScroll7 = new BScroll('#wrapper', {
|
||||
scrollbar: {
|
||||
fade: true,
|
||||
},
|
||||
});
|
||||
|
||||
const BScroll8 = new BScroll('#wrapper', {
|
||||
pullDownRefresh: {
|
||||
threshold: 50,
|
||||
stop: 20,
|
||||
},
|
||||
});
|
||||
|
||||
BScroll1.refresh();
|
||||
BScroll1.scrollTo(0, 100);
|
||||
BScroll1.scrollTo(0, 100, 200);
|
||||
|
||||
BScroll1.scrollToElement('selectedElement');
|
||||
BScroll1.scrollToElement('selectedElement', 250);
|
||||
|
||||
BScroll1.scrollToElement(document.getElementById('selectedElement') as HTMLElement);
|
||||
BScroll1.scrollToElement(document.getElementById('selectedElement') as HTMLElement, 250);
|
||||
|
||||
BScroll2.on('scrollStart', () => { console.log('scroll started'); });
|
||||
|
||||
const BScroll9 = new BScroll(document.getElementById('wrapper') as HTMLElement);
|
||||
const BScroll10 = new BScroll(document.getElementById('wrapper') as HTMLElement, { freeScroll: true });
|
||||
const BScroll11 = new BScroll(document.getElementById('wrapper') as HTMLElement, {
|
||||
preventDefaultException: {
|
||||
tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/,
|
||||
},
|
||||
});
|
||||
const BScroll12 = new BScroll(document.getElementById('wrapper') as HTMLElement, {
|
||||
preventDefaultException: {
|
||||
className: /(^|\s)test(\s|$)/,
|
||||
},
|
||||
});
|
||||
|
||||
const BScroll13 = new BScroll(document.getElementById('wrapper') as HTMLElement, {
|
||||
swipeBounceTime: 1000,
|
||||
});
|
||||
|
||||
const BScroll14 = new BScroll('#wrapper', { disableMouse: true, disableTouch: false });
|
||||
Vendored
+238
@@ -0,0 +1,238 @@
|
||||
// Type definitions for better-scroll 1.12
|
||||
// Project: https://github.com/ustbhuangyi/better-scroll
|
||||
// Definitions by: cloudstone <https://github.com/stoneChen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.2
|
||||
export interface WheelOption {
|
||||
selectedIndex: number;
|
||||
rotate: number;
|
||||
adjustTime: number;
|
||||
wheelWrapperClass: string;
|
||||
wheelItemClass: string;
|
||||
}
|
||||
|
||||
export interface PageOption {
|
||||
x: number;
|
||||
y: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
}
|
||||
|
||||
export interface SlideOption {
|
||||
loop: boolean;
|
||||
el: Element;
|
||||
threshold: number;
|
||||
stepX: number;
|
||||
stepY: number;
|
||||
speed: number;
|
||||
listenFlick: boolean;
|
||||
}
|
||||
|
||||
export interface ScrollBarOption {
|
||||
fade: boolean;
|
||||
}
|
||||
|
||||
export interface PullDownOption {
|
||||
threshold: number;
|
||||
stop: number;
|
||||
}
|
||||
|
||||
export interface PullUpOption {
|
||||
threshold: number;
|
||||
}
|
||||
|
||||
export interface BounceObjectOption {
|
||||
top?: boolean;
|
||||
bottom?: boolean;
|
||||
left?: boolean;
|
||||
right?: boolean;
|
||||
}
|
||||
|
||||
export interface EaseOption {
|
||||
swipe?: {
|
||||
style: string;
|
||||
fn: (t: number) => number;
|
||||
};
|
||||
swipeBounce?: {
|
||||
style: string;
|
||||
fn: (t: number) => number;
|
||||
};
|
||||
bounce?: {
|
||||
style: string;
|
||||
fn: (t: number) => number;
|
||||
};
|
||||
}
|
||||
|
||||
export interface BsOption {
|
||||
startX: number;
|
||||
startY: number;
|
||||
scrollX: boolean;
|
||||
scrollY: boolean;
|
||||
freeScroll: boolean;
|
||||
directionLockThreshold: number;
|
||||
eventPassthrough: string | boolean;
|
||||
click: boolean;
|
||||
tap: boolean;
|
||||
bounce: boolean | BounceObjectOption;
|
||||
bounceTime: number;
|
||||
momentum: boolean;
|
||||
momentumLimitTime: number;
|
||||
momentumLimitDistance: number;
|
||||
swipeTime: number;
|
||||
swipeBounceTime: number;
|
||||
deceleration: number;
|
||||
flickLimitTime: number;
|
||||
flickLimitDistance: number;
|
||||
resizePolling: number;
|
||||
probeType: number;
|
||||
preventDefault: boolean;
|
||||
preventDefaultException: object;
|
||||
HWCompositing: boolean;
|
||||
useTransition: boolean;
|
||||
useTransform: boolean;
|
||||
bindToWrapper: boolean;
|
||||
disableMouse: boolean;
|
||||
disableTouch: boolean;
|
||||
observeDOM: boolean;
|
||||
autoBlur: boolean;
|
||||
stopPropagation: boolean;
|
||||
/**
|
||||
* for picker
|
||||
* wheel: {
|
||||
* selectedIndex: 0,
|
||||
* rotate: 25,
|
||||
* adjustTime: 400
|
||||
* }
|
||||
*/
|
||||
wheel: Partial<WheelOption> | boolean;
|
||||
/**
|
||||
* for slide
|
||||
* snap: {
|
||||
* loop: boolean,
|
||||
* el: domEl,
|
||||
* threshold: 0.1,
|
||||
* stepX: 100,
|
||||
* stepY: 100,
|
||||
* listenFlick: true
|
||||
* }
|
||||
*/
|
||||
snap: Partial<SlideOption> | boolean;
|
||||
/**
|
||||
* for scrollbar
|
||||
* scrollbar: {
|
||||
* fade: true
|
||||
* }
|
||||
*/
|
||||
scrollbar: Partial<ScrollBarOption> | boolean;
|
||||
/**
|
||||
* for pull down and refresh
|
||||
* pullDownRefresh: {
|
||||
* threshold: 50,
|
||||
* stop: 20
|
||||
* }
|
||||
*/
|
||||
pullDownRefresh: Partial<PullDownOption> | boolean;
|
||||
/**
|
||||
* for pull up and load
|
||||
* pullUpLoad: {
|
||||
* threshold: 50
|
||||
* }
|
||||
*/
|
||||
pullUpLoad: Partial<PullUpOption> | boolean;
|
||||
}
|
||||
|
||||
export interface Position {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export default class BScroll {
|
||||
constructor(element: Element | string, options?: Partial<BsOption>);
|
||||
|
||||
x: number;
|
||||
y: number;
|
||||
maxScrollX: number;
|
||||
maxScrollY: number;
|
||||
movingDirectionX: number;
|
||||
movingDirectionY: number;
|
||||
directionX: number;
|
||||
directionY: number;
|
||||
enabled: boolean;
|
||||
isInTransition: boolean;
|
||||
isAnimating: boolean;
|
||||
options: BsOption;
|
||||
|
||||
refresh(): void;
|
||||
|
||||
enable(): void;
|
||||
|
||||
disable(): void;
|
||||
|
||||
scrollBy(x: number, y: number, time?: number, easing?: object): void;
|
||||
|
||||
scrollTo(x: number, y: number, time?: number, easing?: object): void;
|
||||
|
||||
scrollToElement(el: HTMLElement | string, time?: number, offsetX?: number | boolean, offsetY?: number | boolean, easing?: object): void;
|
||||
|
||||
stop(): void;
|
||||
|
||||
destroy(): void;
|
||||
|
||||
goToPage(x: number, y: number, time?: number, easing?: object): void;
|
||||
|
||||
next(time?: number, easing?: object): void;
|
||||
|
||||
prev(time?: number, easing?: object): void;
|
||||
|
||||
getCurrentPage(): PageOption;
|
||||
|
||||
wheelTo(index: number): void;
|
||||
|
||||
getSelectedIndex(): number;
|
||||
|
||||
finishPullDown(): void;
|
||||
|
||||
finishPullUp(): void;
|
||||
|
||||
on(
|
||||
type:
|
||||
'beforeScrollStart' |
|
||||
'scrollStart' |
|
||||
'scrollCancel' |
|
||||
'beforeScrollStart' |
|
||||
'flick' |
|
||||
'refresh' |
|
||||
'destroy' |
|
||||
'pullingDown' |
|
||||
'pullingUp',
|
||||
fn: () => any
|
||||
): void;
|
||||
|
||||
on(
|
||||
type:
|
||||
'scroll' |
|
||||
'scrollEnd' |
|
||||
'touchEnd',
|
||||
fn: (pos: Position) => any
|
||||
): void;
|
||||
|
||||
off(
|
||||
type:
|
||||
'beforeScrollStart' |
|
||||
'scrollStart' |
|
||||
'scroll' |
|
||||
'scrollCancel' |
|
||||
'beforeScrollStart' |
|
||||
'scrollEnd' |
|
||||
'touchEnd' |
|
||||
'flick' |
|
||||
'refresh' |
|
||||
'destroy' |
|
||||
'pullingDown' |
|
||||
'pullingUp',
|
||||
fn: (...args: any[]) => void
|
||||
): void;
|
||||
|
||||
trigger(type: string): void;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"better-scroll-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function and(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
import bitsAnd from './and';
|
||||
import bitsNor from './nor';
|
||||
import bitsNot from './not';
|
||||
import bitsOr from './or';
|
||||
import bitsReduceAnd from './reduce-and';
|
||||
import bitsReduceNand from './reduce-nand';
|
||||
import bitsReduceNor from './reduce-nor';
|
||||
import bitsReduceOr from './reduce-or';
|
||||
import bitsReduceXnor from './reduce-xnor';
|
||||
import bitsReduceXor from './reduce-xor';
|
||||
import bitsToBoolean from './to-boolean';
|
||||
import bitsToString from './to-string';
|
||||
import bitsXnor from './xnor';
|
||||
import bitsXor from './xor';
|
||||
|
||||
declare namespace bits {
|
||||
const and: typeof bitsAnd;
|
||||
const nor: typeof bitsNor;
|
||||
const not: typeof bitsNot;
|
||||
const or: typeof bitsOr;
|
||||
const reduceAnd: typeof bitsReduceAnd;
|
||||
const reduceNand: typeof bitsReduceNand;
|
||||
const reduceNor: typeof bitsReduceNor;
|
||||
const reduceOr: typeof bitsReduceOr;
|
||||
const reduceXnor: typeof bitsReduceXnor;
|
||||
const reduceXor: typeof bitsReduceXor;
|
||||
const toBoolean: typeof bitsToBoolean;
|
||||
const toString: typeof bitsToString;
|
||||
const xnor: typeof bitsXnor;
|
||||
const xor: typeof bitsXor;
|
||||
}
|
||||
|
||||
export default bits;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function nand(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function nor(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function not(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function or(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function reduceAnd(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function reduceNand(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function reduceNor(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function reduceOr(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function reduceXnor(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function reduceXor(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export default function toBoolean(
|
||||
bits: ReadonlyArray<number>
|
||||
): ReadonlyArray<boolean>;
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export default function toString(
|
||||
bit: ReadonlyArray<number>,
|
||||
spacing?: number,
|
||||
spacer?: string
|
||||
): string;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function xnor(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export default function xor(
|
||||
bits1: ReadonlyArray<number>,
|
||||
bits2: ReadonlyArray<number>
|
||||
): ReadonlyArray<number>;
|
||||
@@ -0,0 +1,56 @@
|
||||
// Demonstrating cherry-picking
|
||||
import bitwise from 'bitwise';
|
||||
|
||||
import bits from 'bitwise/bits';
|
||||
import toBoolean from 'bitwise/bits/to-boolean';
|
||||
|
||||
import buffer from 'bitwise/buffer';
|
||||
import create from 'bitwise/buffer/create';
|
||||
|
||||
import byte from 'bitwise/byte';
|
||||
import read from 'bitwise/byte/read';
|
||||
|
||||
import integer from 'bitwise/integer';
|
||||
import setBit from 'bitwise/integer/set-bit';
|
||||
|
||||
import nibble from 'bitwise/nibble';
|
||||
import nibbleRead from 'bitwise/nibble/read';
|
||||
|
||||
import string from 'bitwise/string';
|
||||
import toBits from 'bitwise/string/to-bits';
|
||||
|
||||
// Testing basic functions
|
||||
const testBits = [0, 1, 1, 0, 1];
|
||||
|
||||
// $ExpectType string
|
||||
bitwise.bits.toString(testBits);
|
||||
|
||||
// $ExpectType ReadonlyArray<boolean>
|
||||
bits.toBoolean(testBits);
|
||||
// $ExpectType ReadonlyArray<boolean>
|
||||
toBoolean(testBits);
|
||||
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
byte.read(12);
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
read(12);
|
||||
|
||||
// $ExpectType Buffer
|
||||
buffer.create(testBits);
|
||||
// $ExpectType Buffer
|
||||
create(testBits);
|
||||
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
integer.setBit(12, 1, 0);
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
setBit(12, 1, 0);
|
||||
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
nibble.read(15);
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
nibbleRead(15);
|
||||
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
string.toBits('10 10 12$%_.0');
|
||||
// $ExpectType ReadonlyArray<number>
|
||||
toBits('10 10 12$%_.0');
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function and(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function create(bits: ReadonlyArray<number>): Buffer;
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
import bufferAnd from './and';
|
||||
import bufferCreate from './create';
|
||||
import bufferModify from './modify';
|
||||
import bufferNand from './nand';
|
||||
import bufferNor from './nor';
|
||||
import bufferNot from './not';
|
||||
import bufferOr from './or';
|
||||
import bufferRead from './read';
|
||||
import bufferReadCInt from './read-c-int';
|
||||
import bufferReadInt from './read-int';
|
||||
import bufferReadUInt from './read-u-int';
|
||||
import bufferXnor from './xnor';
|
||||
import bufferXor from './xor';
|
||||
|
||||
declare namespace buffer {
|
||||
const and: typeof bufferAnd;
|
||||
const create: typeof bufferCreate;
|
||||
const modify: typeof bufferModify;
|
||||
const nand: typeof bufferNand;
|
||||
const nor: typeof bufferNor;
|
||||
const not: typeof bufferNot;
|
||||
const or: typeof bufferOr;
|
||||
const read: typeof bufferRead;
|
||||
const readCInt: typeof bufferReadCInt;
|
||||
const readInt: typeof bufferReadInt;
|
||||
const readUInt: typeof bufferReadUInt;
|
||||
const xnor: typeof bufferXnor;
|
||||
const xor: typeof bufferXor;
|
||||
}
|
||||
|
||||
export default buffer;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function modify(
|
||||
buffer: Buffer,
|
||||
newBits: ReadonlyArray<number>,
|
||||
bitOffset?: number
|
||||
): void;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function nand(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function nor(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping: boolean
|
||||
): Buffer;
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function not(buffer: Buffer): Buffer;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function or(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function readCInt(
|
||||
buffer: Buffer,
|
||||
bitOffset?: number,
|
||||
bitLength?: number
|
||||
): number;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function readInt(
|
||||
buffer: Buffer,
|
||||
bitOffset?: number,
|
||||
bitLength?: number
|
||||
): number;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function readUInt(
|
||||
buffer: Buffer,
|
||||
bitOffset?: number,
|
||||
bitLength?: number
|
||||
): number;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function read(
|
||||
buffer: Buffer,
|
||||
bitOffset?: number,
|
||||
bitLength?: number
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function xnor(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
/// <reference types= "node" />
|
||||
|
||||
export default function xor(
|
||||
buffer1: Buffer,
|
||||
buffer2: Buffer,
|
||||
isLooping?: boolean
|
||||
): Buffer;
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
import byteRead from './read';
|
||||
import byteWrite from './write';
|
||||
|
||||
declare namespace byte {
|
||||
const read: typeof byteRead;
|
||||
const write: typeof byteWrite;
|
||||
}
|
||||
|
||||
export default byte;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function read(byte: number): ReadonlyArray<number>;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function write(bits: ReadonlyArray<number>): number;
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for bitwise 1.5
|
||||
// Project: https://github.com/dodekeract/bitwise
|
||||
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import bitwiseBits from './bits';
|
||||
import bitwiseBuffer from './buffer';
|
||||
import bitwiseByte from './byte';
|
||||
import bitwiseInteger from './integer';
|
||||
import bitwiseNibble from './nibble';
|
||||
import bitwiseString from './string';
|
||||
|
||||
declare namespace bitwise {
|
||||
const bits: typeof bitwiseBits;
|
||||
const buffer: typeof bitwiseBuffer;
|
||||
const byte: typeof bitwiseByte;
|
||||
const integer: typeof bitwiseInteger;
|
||||
const nibble: typeof bitwiseNibble;
|
||||
const string: typeof bitwiseString;
|
||||
}
|
||||
|
||||
export default bitwise;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function getBit(number: number, position: number): number;
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
import integerGetBit from './get-bit';
|
||||
import integerSetBit from './set-bit';
|
||||
import integerToggleBit from './toggle-bit';
|
||||
|
||||
declare namespace integer {
|
||||
const getBit: typeof integerGetBit;
|
||||
const setBit: typeof integerSetBit;
|
||||
const toggleBit: typeof integerToggleBit;
|
||||
}
|
||||
|
||||
export default integer;
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export default function setBit(
|
||||
number: number,
|
||||
position: number,
|
||||
value: number
|
||||
): ReadonlyArray<number>;
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
export default function toggleBit(
|
||||
number: number,
|
||||
position: number
|
||||
): ReadonlyArray<number>;
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
import nibbleRead from './read';
|
||||
import nibbleWrite from './write';
|
||||
|
||||
declare namespace nibble {
|
||||
const read: typeof nibbleRead;
|
||||
const write: typeof nibbleWrite;
|
||||
}
|
||||
|
||||
export default nibble;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function read(nibble: number): ReadonlyArray<number>;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function write(nibble: ReadonlyArray<number>): number;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
import stringToBits from './to-bits';
|
||||
|
||||
declare namespace string {
|
||||
const toBits: typeof stringToBits;
|
||||
}
|
||||
|
||||
export default string;
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
export default function toBits(string: string): ReadonlyArray<number>;
|
||||
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bitwise-tests.ts",
|
||||
"bits/and.d.ts",
|
||||
"bits/index.d.ts",
|
||||
"bits/nand.d.ts",
|
||||
"bits/nor.d.ts",
|
||||
"bits/not.d.ts",
|
||||
"bits/or.d.ts",
|
||||
"bits/reduce-and.d.ts",
|
||||
"bits/reduce-nand.d.ts",
|
||||
"bits/reduce-nor.d.ts",
|
||||
"bits/reduce-or.d.ts",
|
||||
"bits/reduce-xnor.d.ts",
|
||||
"bits/reduce-xor.d.ts",
|
||||
"bits/to-boolean.d.ts",
|
||||
"bits/to-string.d.ts",
|
||||
"bits/xnor.d.ts",
|
||||
"bits/xor.d.ts",
|
||||
"buffer/and.d.ts",
|
||||
"buffer/create.d.ts",
|
||||
"buffer/modify.d.ts",
|
||||
"buffer/nand.d.ts",
|
||||
"buffer/nor.d.ts",
|
||||
"buffer/not.d.ts",
|
||||
"buffer/or.d.ts",
|
||||
"buffer/read-c-int.d.ts",
|
||||
"buffer/read-int.d.ts",
|
||||
"buffer/read-u-int.d.ts",
|
||||
"buffer/read.d.ts",
|
||||
"buffer/xnor.d.ts",
|
||||
"buffer/xor.d.ts",
|
||||
"byte/index.d.ts",
|
||||
"byte/read.d.ts",
|
||||
"byte/write.d.ts",
|
||||
"integer/get-bit.d.ts",
|
||||
"integer/index.d.ts",
|
||||
"integer/set-bit.d.ts",
|
||||
"integer/toggle-bit.d.ts",
|
||||
"nibble/index.d.ts",
|
||||
"nibble/read.d.ts",
|
||||
"nibble/write.d.ts",
|
||||
"string/index.d.ts",
|
||||
"string/to-bits.d.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import bloem = require('bloem');
|
||||
|
||||
const base = new bloem.Bloem(1, 2, Buffer.from('1', 'hex'));
|
||||
const safe = new bloem.SafeBloem(1, 2, Buffer.from('2', 'hex'));
|
||||
const scaling = new bloem.ScalingBloem(1,
|
||||
{ratio: 1, initial_capacity: 2, scaling: 3}
|
||||
);
|
||||
|
||||
// options are optional
|
||||
const scaling2 = new bloem.ScalingBloem(1);
|
||||
|
||||
// $ExpectType number
|
||||
bloem.calculateSize(1, 2);
|
||||
// $ExpectType number
|
||||
bloem.calculateSlices(1, 2);
|
||||
Vendored
+37
@@ -0,0 +1,37 @@
|
||||
// Type definitions for bloem 0.2
|
||||
// Project: https://github.com/wiedi/node-bloem
|
||||
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types= "node" />
|
||||
|
||||
export function calculateSize(capacity: number, error_rate: number): number;
|
||||
export function calculateSlices(size: number, capacity: number): number;
|
||||
|
||||
export class Bloem {
|
||||
constructor(size: number, slices: number, buffer: Buffer);
|
||||
|
||||
has(key: Buffer): boolean;
|
||||
add(key: Buffer): void;
|
||||
}
|
||||
|
||||
export class SafeBloem {
|
||||
constructor(capacity: number, error_rate: number, buffer: Buffer);
|
||||
|
||||
has(key: Buffer): boolean;
|
||||
add(key: Buffer): boolean;
|
||||
}
|
||||
|
||||
export class ScalingBloem {
|
||||
constructor(
|
||||
error_rate: number,
|
||||
options?: {
|
||||
ratio?: number;
|
||||
initial_capacity?: number;
|
||||
scaling?: number;
|
||||
}
|
||||
);
|
||||
|
||||
has(key: Buffer): boolean;
|
||||
add(key: Buffer): void;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bloem-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -44,3 +44,11 @@ function testPromiseRejection() {
|
||||
function testGithubTicket28081Regression() {
|
||||
Promise.resolve([3]).map((n: number) => true);
|
||||
}
|
||||
|
||||
import Bluebird = require("bluebird");
|
||||
|
||||
function testTheWalkaroundForCastingGlobalPromiseToBluebirdPromise() {
|
||||
const bluebirdString: Bluebird<string> = Bluebird.resolve(
|
||||
new Promise<string>(() => 'Lorem ipsum')
|
||||
);
|
||||
}
|
||||
|
||||
Vendored
+76
-19
@@ -10,6 +10,45 @@
|
||||
* If you want to leverage the fact, that bluebird polyfills the global Promise in the browser, then
|
||||
* you need to tell TypeScript about this. The following declaration file does exactly that.
|
||||
*
|
||||
* 1.1. Why you might not want to use `bluebird-global` instead of `bluebird`.
|
||||
*
|
||||
* Because of how these typings tell TypeScript about bluebird's Promise methods, it is not
|
||||
* possible to cast global Promises to Bluebird promises in your code. In other words, you won't
|
||||
* be able to do the following (even though it's possible at the runtime):
|
||||
*
|
||||
* let bluebirdPromise: Bluebird<string> = new Promise<string>(() => { return 'Lorem ipsum'; });
|
||||
*
|
||||
* If you need to, you can walk-around this by constructing a new Bluebird promise over an instance
|
||||
* of the global Promise, like so:
|
||||
*
|
||||
* let bluebirdPromise: Bluebird<string> = Bluebird.resolve(
|
||||
* new Promise<string>(() => { return 'Lorem ipsum'; })
|
||||
* );
|
||||
*
|
||||
* So the bottom line is: if you use these typings, then be mindful when you try to mix the global
|
||||
* Promises with the Bluebird promises. You can avoid this problem by just settling on using either
|
||||
* of them and not both of them at the same time.
|
||||
*
|
||||
* 1.2. Further limitations of `bluebird-global` typings: the return type of Bluebird's methods.
|
||||
*
|
||||
* Due to the fact of how bluebird-specific methods are exposed on the global Promise, the
|
||||
* return type of those methods is Bluebird<T> instead of Promise<T>. This is relevant in the
|
||||
* following case:
|
||||
*
|
||||
* function createDelayedPromise(): Promise<void> {
|
||||
* return Promise.delay(250);
|
||||
* }
|
||||
*
|
||||
* Since Promise.delay() returns a Bluebird<void> and the function is typed to return a Promise<void>,
|
||||
* an implicit cast is performed from Bluebird<void> to Promise<void>. And since an instance
|
||||
* of Bluebird isn't and instance of Promise (due to how `bluebird-global` works), this implicit
|
||||
* cast fails to compile. In order to walk-around this problem, the following explicit cast should
|
||||
* be used:
|
||||
*
|
||||
* function createDelayedPromise(): Promise<void> {
|
||||
* return <Promise<void>> Promise.delay(250);
|
||||
* }
|
||||
*
|
||||
* 2. How to use it?
|
||||
*
|
||||
* It should just work, but there are a couple of points to be wary about:
|
||||
@@ -60,6 +99,17 @@
|
||||
* d. target es6, latest "es20xx", e.g. "es2017"
|
||||
*/
|
||||
|
||||
/*
|
||||
* @todo When dropping TS 2.x support, uncomment the following triple-slash directives and
|
||||
* remove the copy&paste from this file (marked with #std-lib-copy&paste-to-remove)
|
||||
*
|
||||
* TS 2.x support should be dropped once bluebird's typings stop compiling on 2.x (i.e.
|
||||
* once bluebird's typings stop supporting TS 2.x)
|
||||
*/
|
||||
/* /// <reference lib="es5" /> */
|
||||
/* /// <reference lib="es2015.promise" /> */
|
||||
/* /// <reference lib="es2018.promise" /> */
|
||||
|
||||
import Bluebird = require("bluebird");
|
||||
|
||||
declare global {
|
||||
@@ -73,7 +123,7 @@ declare global {
|
||||
bind: Bluebird<T>["bind"];
|
||||
call: Bluebird<T>["call"];
|
||||
cancel: Bluebird<T>["cancel"];
|
||||
// catch: Bluebird<T>["catch"];
|
||||
// catch: Bluebird<T>["catch"]; // Provided by lib.es5.d.ts
|
||||
caught: Bluebird<T>["caught"];
|
||||
delay: Bluebird<T>["delay"];
|
||||
disposer: Bluebird<T>["disposer"];
|
||||
@@ -81,7 +131,7 @@ declare global {
|
||||
each: Bluebird<T>["each"];
|
||||
error: Bluebird<T>["error"];
|
||||
filter: Bluebird<T>["filter"];
|
||||
// finally: Bluebird<T>["finally"];
|
||||
// finally: Bluebird<T>["finally"]; // Provided by lib.es2018.promise.d.ts
|
||||
get: Bluebird<T>["get"];
|
||||
isCancelled: Bluebird<T>["isCancelled"];
|
||||
isFulfilled: Bluebird<T>["isFulfilled"];
|
||||
@@ -103,7 +153,7 @@ declare global {
|
||||
suppressUnhandledRejections: Bluebird<T>["suppressUnhandledRejections"];
|
||||
tap: Bluebird<T>["tap"];
|
||||
tapCatch: Bluebird<T>["tapCatch"];
|
||||
// then: Bluebird<T>["then"];
|
||||
// then: Bluebird<T>["then"]; // Provided by lib.es5.d.ts
|
||||
thenReturn: Bluebird<T>["thenReturn"];
|
||||
thenThrow: Bluebird<T>["thenThrow"];
|
||||
catchReturn: Bluebird<T>["catchReturn"];
|
||||
@@ -115,19 +165,18 @@ declare global {
|
||||
value: Bluebird<T>["value"];
|
||||
|
||||
/*
|
||||
* Copy&paste ::then and ::catch from lib.es2015.promise.d.ts, because Bluebird's typings are not
|
||||
* Copy&paste ::then and ::catch from lib.es5.promise.d.ts, because Bluebird's typings are not
|
||||
* in line with the standard lib.
|
||||
*
|
||||
* This is only needed for es5 target, which doesn't include the lib.es2015.promise.d.ts typings.
|
||||
* #std-lib-copy&paste-to-remove
|
||||
*
|
||||
* @todo Make Bluebird's typings be in line with the standard lib.
|
||||
* @todo See the comment near the top of the file about code marked with #std-lib-copy&paste-to-remove
|
||||
*/
|
||||
then(onfulfilled?: ((value: T) => T | PromiseLike<T>) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): Promise<T>;
|
||||
then<TResult>(onfulfilled: ((value: T) => T | PromiseLike<T>) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
|
||||
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>, onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<TResult>;
|
||||
then<TResult1, TResult2>(onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
|
||||
catch(onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): Promise<T>;
|
||||
catch<TResult>(onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
|
||||
then<TResult1 = T, TResult2 = never>(
|
||||
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,
|
||||
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null
|
||||
): Promise<TResult1 | TResult2>;
|
||||
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
|
||||
|
||||
/*
|
||||
* TypeScript disallows adding overrides via `catch: typeof Bluebird.prototype.catch`. Copy&paste them then.
|
||||
@@ -142,7 +191,11 @@ declare global {
|
||||
catch<U>(predicate: Object, onReject: (error: any) => U | PromiseLike<U>): Bluebird<U | T>;
|
||||
|
||||
/*
|
||||
* See comments above `then` for the reason why this is needed. Taken from esnext.promise.d.ts.
|
||||
* See comments above `then` for the reason why this is needed. Taken from es2018.promise.d.ts.
|
||||
*
|
||||
* #std-lib-copy&paste-to-remove
|
||||
*
|
||||
* @todo See the comment near the top of the file about code marked with #std-lib-copy&paste-to-remove
|
||||
*/
|
||||
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
|
||||
}
|
||||
@@ -153,7 +206,7 @@ declare global {
|
||||
interface PromiseConstructor {
|
||||
new <T>(callback: (resolve: (thenableOrResult?: T | PromiseLike<T>) => void, reject: (error?: any) => void, onCancel?: (callback: () => void) => void) => void): Promise<T>;
|
||||
|
||||
// all: typeof Bluebird.all;
|
||||
// all: typeof Bluebird.all; // Provided by lib.es2015.d.ts
|
||||
any: typeof Bluebird.any;
|
||||
attempt: typeof Bluebird.attempt;
|
||||
bind: typeof Bluebird.bind;
|
||||
@@ -176,10 +229,10 @@ declare global {
|
||||
promisify: typeof Bluebird.promisify;
|
||||
promisifyAll: typeof Bluebird.promisifyAll;
|
||||
props: typeof Bluebird.props;
|
||||
// race: typeof Bluebird.race;
|
||||
// race: typeof Bluebird.race; // Provided by lib.es2015.d.ts
|
||||
reduce: typeof Bluebird.reduce;
|
||||
// reject: typeof Bluebird.reject;
|
||||
// resolve: typeof Bluebird.resolve;
|
||||
// reject: typeof Bluebird.reject; // Provided by lib.es2015.d.ts
|
||||
// resolve: typeof Bluebird.resolve; // Provided by lib.es2015.d.ts
|
||||
some: typeof Bluebird.some;
|
||||
try: typeof Bluebird.try;
|
||||
using: typeof Bluebird.using;
|
||||
@@ -187,9 +240,9 @@ declare global {
|
||||
/*
|
||||
* Copy&paste from lib.es2015.promise.d.ts, because Bluebird's typings are not in line with the standard lib.
|
||||
*
|
||||
* This is only needed for es5 target, which doesn't include the lib.es2015.promise.d.ts typings.
|
||||
* #std-lib-copy&paste-to-remove
|
||||
*
|
||||
* @todo Make Bluebird's typings be in line with the standard lib.
|
||||
* @todo See the comment near the top of the file about code marked with #std-lib-copy&paste-to-remove
|
||||
*/
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
||||
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
@@ -219,6 +272,10 @@ declare global {
|
||||
|
||||
/*
|
||||
* Declare the `Promise` variable. This is needed for es5 only and is a no-op for all other targets.
|
||||
*
|
||||
* #std-lib-copy&paste-to-remove
|
||||
*
|
||||
* @todo See the comment near the top of the file about code marked with #std-lib-copy&paste-to-remove
|
||||
*/
|
||||
var Promise: PromiseConstructor;
|
||||
}
|
||||
|
||||
Vendored
+1
-2
@@ -70,8 +70,7 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
*
|
||||
* Alias `.caught();` for compatibility with earlier ECMAScript version.
|
||||
*/
|
||||
catch(onReject: (error: any) => Resolvable<R>): Bluebird<R>;
|
||||
catch<U>(onReject: ((error: any) => Resolvable<U>) | undefined | null): Bluebird<U | R>;
|
||||
catch<U = R>(onReject: ((error: any) => Resolvable<U>) | undefined | null): Bluebird<U | R>;
|
||||
|
||||
/**
|
||||
* This extends `.catch` to work more like catch-clauses in languages like Java or C#.
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import xor = require('buffer-xor');
|
||||
|
||||
// $ExpectType Buffer
|
||||
xor(Buffer.from('a'), Buffer.from('b'));
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// Type definitions for buffer-xor 2.0
|
||||
// Project: https://github.com/crypto-browserify/buffer-xor
|
||||
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types = "node" />
|
||||
|
||||
declare function xor(a: Buffer, b: Buffer): Buffer;
|
||||
|
||||
export = xor;
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"buffer-xor-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+1
@@ -9,6 +9,7 @@
|
||||
// David Koblas <https://github.com/koblas>
|
||||
// Bond Akinmade <https://github.com/bondz>
|
||||
// Wuha Team <https://github.com/wuha-team>
|
||||
// Alec Brunelle <https://github.com/aleccool213>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
|
||||
Vendored
+31
-1
@@ -54,6 +54,24 @@ declare module "bull" {
|
||||
* since pubsub does not give any guarantees.
|
||||
*/
|
||||
finished(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Moves a job to the `completed` queue. Pulls a job from 'waiting' to
|
||||
* 'active' and returns a tuple containing the next jobs data and id. If no
|
||||
* job is in the `waiting` queue, returns null.
|
||||
* @param returnValue The jobs success message.
|
||||
* @param ignoreLock True when wanting to ignore the redis lock on this job.
|
||||
* @returns Contains the next jobs data and id or null if job left in 'waiting' queue.
|
||||
*/
|
||||
moveToCompleted(returnValue: string, ignoreLock: boolean): Promise<string[] | null>;
|
||||
|
||||
/**
|
||||
* Moves a job to the failed queue.
|
||||
* @param errorInfo The jobs error message.
|
||||
* @param ignoreLock True when wanting to ignore the redis lock on this job.
|
||||
* @returns void
|
||||
*/
|
||||
moveToFailed(errorInfo: ErrorMessage, ignoreLock: boolean): Promise<void>;
|
||||
}
|
||||
|
||||
export interface Backoff {
|
||||
@@ -204,7 +222,7 @@ declare module "bull" {
|
||||
* Returns a promise that will return the job instance associated with the jobId parameter.
|
||||
* If the specified job cannot be located, the promise callback parameter will be set to null.
|
||||
*/
|
||||
getJob(jobId: string): Promise<Job>;
|
||||
getJob(jobId: string): Promise<Job | null>;
|
||||
|
||||
/**
|
||||
* Tells the queue remove all jobs created outside of a grace period in milliseconds.
|
||||
@@ -217,6 +235,18 @@ declare module "bull" {
|
||||
* 'ready', 'error', 'activ', 'progress', 'completed', 'failed', 'paused', 'resumed', 'cleaned'
|
||||
*/
|
||||
on(eventName: string, callback: EventCallback): void;
|
||||
|
||||
/**
|
||||
* Moves the next job from 'waiting' to 'active'.
|
||||
* Sets the processedOn timestamp to the current datetime.
|
||||
* @param jobId If specified, will move a specific job from 'waiting' to 'active',
|
||||
* @returns Returns the job moved from waiting to active queue.
|
||||
*/
|
||||
getNextJob:(jobId?: string) => Promise<Job | null>;
|
||||
}
|
||||
|
||||
interface ErrorMessage {
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface EventCallback {
|
||||
|
||||
@@ -334,6 +334,7 @@ function zoom_examples() {
|
||||
data: {},
|
||||
zoom: {
|
||||
enabled: false,
|
||||
type: 'scroll',
|
||||
rescale: true,
|
||||
extent: [1, 100], // enable more zooming
|
||||
onzoom: (domain) => { /* code */ },
|
||||
|
||||
Vendored
+4
@@ -806,6 +806,10 @@ export interface ZoomOptions {
|
||||
* Enable zooming.
|
||||
*/
|
||||
enabled?: boolean;
|
||||
/**
|
||||
* Set interaction type for zooming
|
||||
*/
|
||||
type?: 'scroll' | 'drag';
|
||||
/**
|
||||
* Enable to rescale after zooming. If true set, y domain will be updated according to the zoomed region.
|
||||
*/
|
||||
|
||||
Vendored
+1
@@ -214,6 +214,7 @@ interface CheerioOptionsInterface {
|
||||
recognizeCDATA?: boolean;
|
||||
recognizeSelfClosing?: boolean;
|
||||
normalizeWhitespace?: boolean;
|
||||
ignoreWhitespace?: boolean;
|
||||
}
|
||||
|
||||
interface CheerioSelector {
|
||||
|
||||
Vendored
+6471
-2633
File diff suppressed because it is too large
Load Diff
+1841
-375
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
@@ -13,6 +9,10 @@
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
|
||||
Vendored
+1
@@ -51,4 +51,5 @@ export interface CleaveOptions {
|
||||
noImmediatePrefix?: boolean;
|
||||
rawValueTrimPrefix?: boolean;
|
||||
uppercase?: boolean;
|
||||
onValueChanged?(event: any): void;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import cliTruncate = require('cli-truncate');
|
||||
|
||||
// Truncate at different positions
|
||||
// $ExpectType string
|
||||
cliTruncate('unicorn', 4); // default position: 'end'
|
||||
|
||||
// $ExpectType string
|
||||
cliTruncate('unicorn', 4, {position: 'start'});
|
||||
|
||||
// $ExpectType string
|
||||
cliTruncate('unicorn', 4, {position: 'middle'});
|
||||
|
||||
// Truncate Unicode surrogate pairs
|
||||
// $ExpectType string
|
||||
cliTruncate('uni\uD83C\uDE00corn', 5);
|
||||
|
||||
// Truncate full-width characters
|
||||
// $ExpectType string
|
||||
cliTruncate('안녕하세요', 3);
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for cli-truncate 1.1
|
||||
// Project: https://github.com/sindresorhus/cli-truncate
|
||||
// Definitions by: Daniel Byrne <https://github.com/danwbyrne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = cliTruncate;
|
||||
|
||||
declare function cliTruncate(
|
||||
input: string,
|
||||
columns: number,
|
||||
options?: {position?: 'start' | 'middle' | 'end'},
|
||||
): string;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cli-truncate-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+26
-5
@@ -17,9 +17,17 @@ declare namespace CodeMirror {
|
||||
export var Pos: CodeMirror.PositionConstructor;
|
||||
export var Pass: {toString(): "CodeMirror.PASS"};
|
||||
|
||||
/** Find the column position at a given string index using a given tabsize. */
|
||||
function countColumn(line: string, index: number | null, tabSize: number): number;
|
||||
function fromTextArea(host: HTMLTextAreaElement, options?: EditorConfiguration): CodeMirror.EditorFromTextArea;
|
||||
|
||||
/** Compare two positions, return 0 if they are the same, a negative number when a is less, and a positive number otherwise. */
|
||||
function cmpPos(a: Position, b: Position): number;
|
||||
|
||||
/** Utility function that computes an end position from a change (an object with from, to, and text properties, as passed to various event handlers).
|
||||
The returned position will be the end of the changed range, after the change is applied. */
|
||||
function changeEnd(change: EditorChange): Position;
|
||||
|
||||
/** It contains a string that indicates the version of the library. This is a triple of integers "major.minor.patch",
|
||||
where patch is zero for releases, and something else (usually one) for dev snapshots. */
|
||||
var version: string;
|
||||
@@ -51,6 +59,14 @@ declare namespace CodeMirror {
|
||||
CodeMirror.registerHelper("hint", "foo", myFoo), the value CodeMirror.hint.foo will point to myFoo. */
|
||||
function registerHelper(namespace: string, name: string, helper: any): void;
|
||||
|
||||
/** Given a state object, returns a {state, mode} object with the inner mode and its state for the current position. */
|
||||
function innerMode(mode: Mode<any>, state: any): { state: any, mode: Mode<any> };
|
||||
|
||||
/** Sometimes, it is useful to add or override mode object properties from external code.
|
||||
The CodeMirror.extendMode function can be used to add properties to mode objects produced for a specific mode.
|
||||
Its first argument is the name of the mode, its second an object that specifies the properties that should be added.
|
||||
This is mostly useful to add utilities that can later be looked up through getMode. */
|
||||
function extendMode(name: string, properties: Mode<any>): void;
|
||||
|
||||
function on(element: any, eventName: string, handler: Function): void;
|
||||
function off(element: any, eventName: string, handler: Function): void;
|
||||
@@ -324,6 +340,9 @@ declare namespace CodeMirror {
|
||||
you should probably follow up by calling this method to ensure CodeMirror is still looking as intended. */
|
||||
refresh(): void;
|
||||
|
||||
/** Gets the inner mode at a given position. This will return the same as getMode for simple modes, but will return an inner mode for nesting modes (such as htmlmixed). */
|
||||
getModeAt(pos: Position): any;
|
||||
|
||||
/** Retrieves information about the token the current mode found before the given position (a {line, ch} object). */
|
||||
getTokenAt(pos: CodeMirror.Position, precise?: boolean): Token;
|
||||
|
||||
@@ -555,8 +574,10 @@ declare namespace CodeMirror {
|
||||
/** Return true if any text is selected. */
|
||||
somethingSelected(): boolean;
|
||||
|
||||
/** Set the cursor position.You can either pass a single { line , ch } object , or the line and the character as two separate parameters. */
|
||||
setCursor(pos: CodeMirror.Position): void;
|
||||
/** Set the cursor position. You can either pass a single {line, ch} object, or the line and the character as two separate parameters.
|
||||
Will replace all selections with a single, empty selection at the given position.
|
||||
The supported options are the same as for setSelection */
|
||||
setCursor(pos: CodeMirror.Position | number, ch?: number, options?: { bias?: number, origin?: string, scroll?: boolean }): void;
|
||||
|
||||
/** Set a single selection range. anchor and head should be {line, ch} objects. head defaults to anchor when not given. */
|
||||
setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position, options?: { bias?: number, origin?: string, scroll?: boolean }): void;
|
||||
@@ -709,9 +730,9 @@ declare namespace CodeMirror {
|
||||
/** Array of strings representing the text that replaced the changed range (split by line). */
|
||||
text: string[];
|
||||
/** Text that used to be between from and to, which is overwritten by this change. */
|
||||
removed: string[];
|
||||
removed?: string[];
|
||||
/** String representing the origin of the change event and wether it can be merged with history */
|
||||
origin: string;
|
||||
origin?: string;
|
||||
}
|
||||
|
||||
interface EditorChangeLinkedList extends CodeMirror.EditorChange {
|
||||
@@ -1083,7 +1104,7 @@ declare namespace CodeMirror {
|
||||
* This function should read one token from the stream it is given as an argument, optionally update its state,
|
||||
* and return a style string, or null for tokens that do not have to be styled. Multiple styles can be returned, separated by spaces.
|
||||
*/
|
||||
token(stream: StringStream, state: T): string | null;
|
||||
token?: (stream: StringStream, state: T) => string | null;
|
||||
|
||||
/**
|
||||
* A function that produces a state object to be used at the start of a document.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user