fix conflict

This commit is contained in:
DeepCold
2018-09-01 20:47:45 +08:00
594 changed files with 27786 additions and 7825 deletions
+351 -152
View File
File diff suppressed because it is too large Load Diff
+6
View File
@@ -390,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'));
+103
View File
@@ -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;
+23
View File
@@ -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"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+5 -1
View File
@@ -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)
+5 -12
View File
@@ -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;
}
@@ -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();
});
+7 -1
View File
@@ -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);
+42
View File
@@ -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;
}
}
+23
View File
@@ -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
}
}
+3
View File
@@ -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
View File
@@ -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;
}
+23
View File
@@ -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"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+3 -2
View File
@@ -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;
}
+4 -5
View File
@@ -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
}
});
+18 -26
View File
@@ -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;
+4
View File
@@ -0,0 +1,4 @@
export default function and(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;
+33
View File
@@ -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;
+4
View File
@@ -0,0 +1,4 @@
export default function nand(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;
+4
View File
@@ -0,0 +1,4 @@
export default function nor(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;
+4
View File
@@ -0,0 +1,4 @@
export default function not(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;
+4
View File
@@ -0,0 +1,4 @@
export default function or(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;
+1
View File
@@ -0,0 +1 @@
export default function reduceAnd(bits: ReadonlyArray<number>): number;
+1
View File
@@ -0,0 +1 @@
export default function reduceNand(bits: ReadonlyArray<number>): number;
+1
View File
@@ -0,0 +1 @@
export default function reduceNor(bits: ReadonlyArray<number>): number;
+1
View File
@@ -0,0 +1 @@
export default function reduceOr(bits: ReadonlyArray<number>): number;
+1
View File
@@ -0,0 +1 @@
export default function reduceXnor(bits: ReadonlyArray<number>): number;
+1
View File
@@ -0,0 +1 @@
export default function reduceXor(bits: ReadonlyArray<number>): number;
+3
View File
@@ -0,0 +1,3 @@
export default function toBoolean(
bits: ReadonlyArray<number>
): ReadonlyArray<boolean>;
+5
View File
@@ -0,0 +1,5 @@
export default function toString(
bit: ReadonlyArray<number>,
spacing?: number,
spacer?: string
): string;
+4
View File
@@ -0,0 +1,4 @@
export default function xnor(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;
+4
View File
@@ -0,0 +1,4 @@
export default function xor(
bits1: ReadonlyArray<number>,
bits2: ReadonlyArray<number>
): ReadonlyArray<number>;
+56
View File
@@ -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');
+7
View File
@@ -0,0 +1,7 @@
/// <reference types= "node" />
export default function and(
buffer1: Buffer,
buffer2: Buffer,
isLooping?: boolean
): Buffer;
+3
View File
@@ -0,0 +1,3 @@
/// <reference types= "node" />
export default function create(bits: ReadonlyArray<number>): Buffer;
+31
View File
@@ -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;
+7
View File
@@ -0,0 +1,7 @@
/// <reference types= "node" />
export default function modify(
buffer: Buffer,
newBits: ReadonlyArray<number>,
bitOffset?: number
): void;
+7
View File
@@ -0,0 +1,7 @@
/// <reference types= "node" />
export default function nand(
buffer1: Buffer,
buffer2: Buffer,
isLooping?: boolean
): Buffer;
+7
View File
@@ -0,0 +1,7 @@
/// <reference types= "node" />
export default function nor(
buffer1: Buffer,
buffer2: Buffer,
isLooping: boolean
): Buffer;
+3
View File
@@ -0,0 +1,3 @@
/// <reference types= "node" />
export default function not(buffer: Buffer): Buffer;
+7
View File
@@ -0,0 +1,7 @@
/// <reference types= "node" />
export default function or(
buffer1: Buffer,
buffer2: Buffer,
isLooping?: boolean
): Buffer;
+7
View File
@@ -0,0 +1,7 @@
/// <reference types= "node" />
export default function readCInt(
buffer: Buffer,
bitOffset?: number,
bitLength?: number
): number;
+7
View File
@@ -0,0 +1,7 @@
/// <reference types= "node" />
export default function readInt(
buffer: Buffer,
bitOffset?: number,
bitLength?: number
): number;
+7
View File
@@ -0,0 +1,7 @@
/// <reference types= "node" />
export default function readUInt(
buffer: Buffer,
bitOffset?: number,
bitLength?: number
): number;
+7
View File
@@ -0,0 +1,7 @@
/// <reference types= "node" />
export default function read(
buffer: Buffer,
bitOffset?: number,
bitLength?: number
): ReadonlyArray<number>;
+7
View File
@@ -0,0 +1,7 @@
/// <reference types= "node" />
export default function xnor(
buffer1: Buffer,
buffer2: Buffer,
isLooping?: boolean
): Buffer;
+7
View File
@@ -0,0 +1,7 @@
/// <reference types= "node" />
export default function xor(
buffer1: Buffer,
buffer2: Buffer,
isLooping?: boolean
): Buffer;
+9
View File
@@ -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;
+1
View File
@@ -0,0 +1 @@
export default function read(byte: number): ReadonlyArray<number>;
+1
View File
@@ -0,0 +1 @@
export default function write(bits: ReadonlyArray<number>): number;
+22
View File
@@ -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;
+1
View File
@@ -0,0 +1 @@
export default function getBit(number: number, position: number): number;
+11
View File
@@ -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;
+5
View File
@@ -0,0 +1,5 @@
export default function setBit(
number: number,
position: number,
value: number
): ReadonlyArray<number>;
+4
View File
@@ -0,0 +1,4 @@
export default function toggleBit(
number: number,
position: number
): ReadonlyArray<number>;
+9
View File
@@ -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;
+1
View File
@@ -0,0 +1 @@
export default function read(nibble: number): ReadonlyArray<number>;
+1
View File
@@ -0,0 +1 @@
export default function write(nibble: ReadonlyArray<number>): number;
+7
View File
@@ -0,0 +1,7 @@
import stringToBits from './to-bits';
declare namespace string {
const toBits: typeof stringToBits;
}
export default string;
+1
View File
@@ -0,0 +1 @@
export default function toBits(string: string): ReadonlyArray<number>;
+60
View File
@@ -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"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+15
View File
@@ -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);
+37
View File
@@ -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;
}
+23
View File
@@ -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"
]
}
+3
View File
@@ -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')
);
}
+76 -19
View File
@@ -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;
}
+1 -2
View File
@@ -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#.
+4
View File
@@ -0,0 +1,4 @@
import xor = require('buffer-xor');
// $ExpectType Buffer
xor(Buffer.from('a'), Buffer.from('b'));
+10
View File
@@ -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;
+19
View File
@@ -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"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+1
View File
@@ -334,6 +334,7 @@ function zoom_examples() {
data: {},
zoom: {
enabled: false,
type: 'scroll',
rescale: true,
extent: [1, 100], // enable more zooming
onzoom: (domain) => { /* code */ },
+4
View File
@@ -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.
*/
+6471 -2633
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -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
+1
View File
@@ -51,4 +51,5 @@ export interface CleaveOptions {
noImmediatePrefix?: boolean;
rawValueTrimPrefix?: boolean;
uppercase?: boolean;
onValueChanged?(event: any): void;
}
+19
View File
@@ -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);
+12
View File
@@ -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;
+23
View File
@@ -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"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+26 -5
View File
@@ -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.
+4
View File
@@ -21,12 +21,16 @@ declare namespace CometD {
}
interface CometD {
websocketEnabled?: boolean;
onListenerException: (exception: any, subscriptionHandle: any, isListener: boolean, message: string) => void;
init(options: CometD.ConfigurationOptions): void;
configure(config: CometD.ConfigurationOptions): void;
subscribe(channel: string, listener: (message: any) => void): void;
addListener(channel: string, listener: (message: any) => void): void;
removeListener(listener: (message: any) => void): void;
+1 -1
View File
@@ -64,7 +64,7 @@ export class Node {
/**
* either Bullet or Ordered (or undefined).
*/
listType: 'Bullet' | 'Ordered';
listType: 'bullet' | 'ordered';
/**
* true if list is tight
*/
@@ -0,0 +1,13 @@
import quantile = require('compute-quantile');
// $ExpectType number
quantile([1, 2, 3], 0.5);
// $ExpectType number
quantile([1, 2, 3], 0.5, undefined);
// $ExpectType number
quantile([1, 2, 3], 0.5, {});
// $ExpectType number
quantile([1, 2, 3], 0.5, { sorted: true });
+23
View File
@@ -0,0 +1,23 @@
// Type definitions for compute-quantile 1.0
// Project: https://github.com/compute-io/quantile
// Definitions by: mrmlnc <https://github.com/mrmlnc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Computes a quantile for a numeric array.
*/
declare function quantile(array: ArrayLike<number>, quantile: number, options?: quantile.Options): number;
declare namespace quantile {
interface Options {
/**
* If the input `array` is already sorted in `__ascending__` order, you can set the `sorted` option to `true`.
*
* @default
* false
*/
sorted?: boolean;
}
}
export = quantile;
+23
View File
@@ -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",
"compute-quantile-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -1,4 +1,4 @@
import * as crossfilter from 'crossfilter';
interface Payment {
-1
View File
@@ -110,7 +110,6 @@ declare namespace CrossFilter {
}
}
declare var crossfilter: CrossFilter.CrossFilterStatic;
declare module "crossfilter" {
var crossfilter: CrossFilter.CrossFilterStatic;
export = crossfilter;
+1 -1
View File
@@ -1,4 +1,4 @@
import * as CrossFilter from 'crossfilter';
import * as crossfilter from 'crossfilter';
import * as d3 from "d3";
import * as dc from "dc";
-47
View File
@@ -1,47 +0,0 @@
import delay = require('delay');
delay(200)
.then(() => {
});
let str: string;
let num: number;
Promise.resolve(delay(100))
.then(() => {
});
Promise.resolve("foo")
.then(delay<string>(100))
.then(result => {
str = result;
});
Promise.resolve('foo')
.then(delay(100, 10))
.then(result => {
num = result;
});
Promise.resolve('foo')
.then(delay.reject(100))
.then(x => 10)
.catch(err => {
});
Promise.resolve('foo')
.then(delay.reject(100, 'bar'))
.then(x => 10)
.catch(err => {
});
(async () => {
const delaying = delay(1000);
delaying.cancel();
try {
await delaying;
} catch (err) {
// `err` is an instance of `delay.CancelError`
}
})();
throw new delay.CancelError('bar');
-30
View File
@@ -1,30 +0,0 @@
// Type definitions for delay 2.0
// Project: https://github.com/sindresorhus/delay#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export = delay;
declare function delay<T>(ms: number): delay.PDelayedPassThroughThunk<T>;
declare function delay<T>(ms: number, value: T): delay.PDelayedThunk<T>;
declare namespace delay {
function reject(ms: number, rejectionValue?: any): PDelayedThunk<never>;
class CancelError extends Error {
readonly name: 'CancelError';
constructor(message?: string);
}
type PDelayedThunk<T> = ((value: any) => DelayedPromiseLike<T>) & DelayedPromiseLike<T>;
type PDelayedPassThroughThunk<TValue> = ((value: TValue) => DelayedPromiseLike<TValue>) & DelayedPromiseLike<void>;
interface DelayedPromiseLike<T> {
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
cancel(): void;
}
}

Some files were not shown because too many files have changed in this diff Show More