Merge remote-tracking branch 'dt/master'

This commit is contained in:
taoqf
2018-11-29 13:50:18 +08:00
159 changed files with 4923 additions and 4295 deletions
+3 -3
View File
@@ -644,7 +644,7 @@
/types/connect-mongo/ @Syati
/types/connect-mongodb-session/ @NattapongSiri
/types/connect-pg-simple/ @pasieronen
/types/connect-redis/ @xstoudi @morcerf
/types/connect-redis/ @xstoudi
/types/connect-slashes/ @samherrmann
/types/connect-timeout/ @cyrilschumacher
/types/consola/ @Jungwoo-An
@@ -3691,8 +3691,8 @@
/types/rdflib/ @cenotelie
/types/re-base/ @jordandrako
/types/reach__router/ @kingdaro
/types/react/v15/ @bbenezech @pzavolinsky @digiguru @ericanderson @morcerf @tkrotoff @DovydasNavickas @onigoetz
/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @morcerf @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei
/types/react/v15/ @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz
/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei
/types/react-adal/ @dkorolev1
/types/react-albus/ @sseppola @conradreuter @kuirak
/types/react-alert/v2/ @ssyrell
+3
View File
@@ -336,3 +336,6 @@ This project is licensed under the MIT license.
Copyrights on the definition files are respective of each contributor listed at the beginning of each definition file.
[![Analytics](https://ga-beacon.appspot.com/UA-47495295-4/borisyankov/DefinitelyTyped)](https://github.com/igrigorik/ga-beacon)
[![Build Status](https://typescript.visualstudio.com/TypeScript/_apis/build/status/sandersn.types-publisher-watchdog)](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=13) Are packages being published to npm in less than 10,000 seconds on average?
[![Build Status](https://typescript.visualstudio.com/TypeScript/_apis/build/status/sandersn.typescript-bot-watchdog)](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=14) Has typescript-bot been active on DefinitelyTyped in the last two hours?
+6
View File
@@ -1656,6 +1656,12 @@
"sourceRepoURL": "https://github.com/ansman/validate.js",
"asOfVersion": "0.11.0"
},
{
"libraryName": "vega",
"typingsPackageName": "vega",
"sourceRepoURL": "https://github.com/vega/vega",
"asOfVersion": "3.2.0"
},
{
"libraryName": "vso-node-api",
"typingsPackageName": "vso-node-api",
+12 -8
View File
@@ -22,8 +22,8 @@ declare namespace AnalyticsNode {
},
timestamp?: Date;
messageId?: string;
anonymousId: string | number;
userId: string | number;
anonymousId?: string | number;
userId?: string | number;
}
interface Data {
@@ -47,7 +47,8 @@ declare namespace AnalyticsNode {
/* The identify method lets you tie a user to their actions and record
traits about them. */
identify(message: {
userId: string | number;
userId?: string | number;
anonymousId?: string | number;
traits?: Object;
timestamp?: Date;
context?: Object;
@@ -56,7 +57,8 @@ declare namespace AnalyticsNode {
/* The track method lets you record the actions your users perform. */
track(message: {
userId: string | number;
userId?: string | number;
anonymousId?: string | number;
event: string;
properties?: Object;
timestamp?: Date;
@@ -67,7 +69,8 @@ declare namespace AnalyticsNode {
/* The page method lets you record page views on your website, along with
optional extra information about the page being viewed. */
page(message: {
userId: string | number;
userId?: string | number;
anonymousId?: string | number;
category?: string;
name?: string;
properties?: Object;
@@ -79,19 +82,20 @@ declare namespace AnalyticsNode {
/* alias is how you associate one identity with another. */
alias(message: {
previousId: string | number;
userId: string | number;
userId?: string | number;
anonymousId?: string | number;
integrations?: Integrations;
}, callback?: (err: Error, data: Data) => void): Analytics;
/* Group calls can be used to associate individual users with shared
accounts or companies. */
group(message: {
userId: string | number;
userId?: string | number;
anonymousId?: string | number;
groupId: string | number;
traits?: Object;
context?: Object;
timestamp?: Date;
anonymous_id?: string | number;
integrations?: Integrations;
}, callback?: (err: Error, data: Data) => void): Analytics;
+4
View File
@@ -29,3 +29,7 @@ babel.transformFromAst(parsedAst!, sourceCode, options, (err, result) => {
const transformFromAstSyncResult = babel.transformFromAstSync(parsedAst!, sourceCode, options);
const { code, map, ast } = transformFromAstSyncResult!;
babel.transformFromAstAsync(parsedAst!, sourceCode, options).then(transformFromAstAsyncResult => {
const { code, map, ast } = transformFromAstAsyncResult!;
});
+1 -1
View File
@@ -349,7 +349,7 @@ export function transformFromAstSync(ast: Node, code?: string, opts?: TransformO
/**
* Given an AST, transform it.
*/
export function transformFromAstSync(ast: Node, code?: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
export function transformFromAstAsync(ast: Node, code?: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
// A babel plugin is a simple function which must return an object matching
// the following interface. Babel will throw if it finds unknown properties.
@@ -89,7 +89,8 @@ const v1: Visitor = {
const id = path.scope.generateUidIdentifierBasedOnNode(path.node.id!);
path.remove();
path.scope.parent.push({ id, init: path.node });
path.scope.parent.push({ id });
path.scope.parent.push({ id, init: t.stringLiteral('foo'), kind: "const" });
path.scope.rename("n", "x");
path.scope.rename("n");
@@ -104,7 +105,7 @@ const BindingKindTest: Visitor = {
kind === 'const';
kind === 'let';
kind === 'var';
// The following should fail when uncommented
// kind === 'anythingElse';
// $ExpectError
kind === 'anythingElse';
},
};
+6 -1
View File
@@ -90,7 +90,12 @@ export class Scope {
removeData(key: string): void;
push(opts: any): void;
push(opts: {
id: t.LVal,
init?: t.Expression,
unique?: boolean,
kind?: "var" | "let" | "const",
}): void;
getProgramParent(): Scope;
+14 -6
View File
@@ -2,24 +2,32 @@ import Database = require('better-sqlite3');
const integer = Database.Integer(1);
const err = new Database.SqliteError('ok', 'ok');
const result: Database.RunResult = { changes: 1, lastInsertRowid: 1 };
const options: Database.Options = { fileMustExist: true, memory: true, readonly: true };
const registrationOptions: Database.RegistrationOptions = {
deterministic: true,
name: '',
safeIntegers: true,
varargs: true
};
let db = Database('.');
db = new Database('.', {memory: true});
db = new Database('.', { memory: true });
db.exec('CREATE TABLE test (id INTEGER PRIMARY KEY NOT NULL, name TEXT NOT NULL);');
db.exec('INSERT INTO test(name) VALUES("name");');
db.pragma('data_version', true);
db.checkpoint();
db.checkpoint('main');
db.register(() => {});
db.register({name: 'noop', deterministic: true, varargs: true}, () => {});
db.register(() => { });
db.register({ name: 'noop', deterministic: true, varargs: true }, () => { });
db.defaultSafeIntegers();
db.defaultSafeIntegers(true);
const stmt = db.prepare('SELECT * FROM test WHERE name == ?;');
stmt.get(['name']);
stmt.all({name: 'name'});
stmt.each('name', (row: {name: string}) => {});
stmt.each((row: {name: string}) => {});
stmt.all({ name: 'name' });
stmt.each('name', (row: { name: string }) => { });
stmt.each((row: { name: string }) => { });
stmt.pluck();
stmt.pluck(true);
stmt.bind('name');
+68 -62
View File
@@ -1,88 +1,94 @@
// Type definitions for better-sqlite3 3.1
// Type definitions for better-sqlite3 5.0
// Project: http://github.com/JoshuaWise/better-sqlite3
// Definitions by: Ben Davies <https://github.com/Morfent>
// Mathew Rumsey <https://github.com/matrumz>
// Santiago Aguilar <https://github.com/sant123>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import Integer = require('integer');
interface RunResult {
changes: number;
lastInsertROWID: Integer.IntLike;
}
import Integer = require("integer");
declare class Statement {
database: Database;
source: string;
returnsData: boolean;
constructor(db: Database, sources: string[]);
database: Database;
source: string;
returnsData: boolean;
constructor(db: Database, sources: string[]);
run(...params: any[]): RunResult;
get(...params: any[]): any;
all(...params: any[]): any[];
each(params: any, cb: (row: any) => void): void;
each(cb: (row: any) => void): void;
each(...params: any[]): void;
pluck(toggleState?: boolean): this;
bind(...params: any[]): this;
safeIntegers(toggleState?: boolean): this;
run(...params: any[]): Database.RunResult;
get(...params: any[]): any;
all(...params: any[]): any[];
each(params: any, cb: (row: any) => void): void;
each(cb: (row: any) => void): void;
each(...params: any[]): void;
pluck(toggleState?: boolean): this;
bind(...params: any[]): this;
safeIntegers(toggleState?: boolean): this;
}
declare class Transaction {
database: Database;
source: string;
constructor(db: Database, sources: string[]);
database: Database;
source: string;
constructor(db: Database, sources: string[]);
run(...params: any[]): RunResult;
bind(...params: any[]): this;
safeIntegers(toggleState?: boolean): this;
}
interface DatabaseOptions {
memory?: boolean;
readonly?: boolean;
fileMustExist?: boolean;
}
interface RegistrationOptions {
name?: string;
varargs?: boolean;
deterministic?: boolean;
safeIntegers?: boolean;
run(...params: any[]): Database.RunResult;
bind(...params: any[]): this;
safeIntegers(toggleState?: boolean): this;
}
interface Database {
memory: boolean;
readonly: boolean;
name: string;
open: boolean;
inTransaction: boolean;
memory: boolean;
readonly: boolean;
name: string;
open: boolean;
inTransaction: boolean;
prepare(source: string): Statement;
transaction(sources: string[]): Transaction;
exec(source: string): this;
pragma(source: string, simplify?: boolean): any;
checkpoint(databaseName?: string): this;
register(cb: (...params: any[]) => any): this;
register(options: RegistrationOptions, cb: (...params: any[]) => any): this;
close(): this;
defaultSafeIntegers(toggleState?: boolean): this;
prepare(source: string): Statement;
transaction(sources: string[]): Transaction;
exec(source: string): this;
pragma(source: string, simplify?: boolean): any;
checkpoint(databaseName?: string): this;
register(cb: (...params: any[]) => any): this;
register(
options: Database.RegistrationOptions,
cb: (...params: any[]) => any
): this;
close(): this;
defaultSafeIntegers(toggleState?: boolean): this;
}
declare class SqliteError implements Error {
name: string;
message: string;
code: string;
constructor(message: string, code: string);
name: string;
message: string;
code: string;
constructor(message: string, code: string);
}
interface DatabaseConstructor {
new(filename: string, options?: DatabaseOptions): Database;
(filename: string, options?: DatabaseOptions): Database;
prototype: Database;
new (filename: string, options?: Database.Options): Database;
(filename: string, options?: Database.Options): Database;
prototype: Database;
Integer: typeof Integer;
SqliteError: typeof SqliteError;
Integer: typeof Integer;
SqliteError: typeof SqliteError;
}
declare namespace Database {
interface RunResult {
changes: number;
lastInsertRowid: Integer.IntLike;
}
interface Options {
memory?: boolean;
readonly?: boolean;
fileMustExist?: boolean;
}
interface RegistrationOptions {
name?: string;
varargs?: boolean;
deterministic?: boolean;
safeIntegers?: boolean;
}
}
declare const Database: DatabaseConstructor;
+1 -1
View File
@@ -92,7 +92,7 @@ declare namespace Bull {
* Define a custom backoff strategy
*/
backoffStrategies?: {
[key: string]: (attemptsMade: number, err: typeof Error) => number;
[key: string]: (attemptsMade: number, err: Error) => number;
};
/**
+3 -4
View File
@@ -1,6 +1,6 @@
// Type definitions for Cheerio v0.22.0
// Project: https://github.com/cheeriojs/cheerio
// Definitions by: Bret Little <https://github.com/blittle>, VILIC VANE <http://vilic.info>, Wayne Maurer <https://github.com/wmaurer>, Umar Nizamani <https://github.com/umarniz>, LiJinyao <https://github.com/LiJinyao>, Chennakrishna <https://github.com/chennakrishna8>
// Definitions by: Bret Little <https://github.com/blittle>, VILIC VANE <http://vilic.info>, Wayne Maurer <https://github.com/wmaurer>, Umar Nizamani <https://github.com/umarniz>, LiJinyao <https://github.com/LiJinyao>, Chennakrishna <https://github.com/chennakrishna8>, AzSiAz <https://github.com/AzSiAz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Cheerio {
@@ -111,9 +111,8 @@ interface Cheerio {
eq(index: number): Cheerio;
get(): string[];
get(): CheerioElement[];
get(index: number): CheerioElement;
get(): any[];
get(index: number): any;
index(): number;
index(selector: string): number;
-4
View File
@@ -41,7 +41,3 @@ declare module "codemirror" {
fullLines?: boolean;
}
}
declare module "codemirror/addon/comment/comment" {
export = CodeMirror;
}
-4
View File
@@ -45,7 +45,3 @@ declare module "codemirror" {
}
}
declare module "codemirror/addon/display/panel" {
export = CodeMirror;
}
-4
View File
@@ -76,7 +76,3 @@ declare module "codemirror" {
hintOptions?: ShowHintOptions;
}
}
declare module "codemirror/addon/hint/show-hint" {
export = CodeMirror;
}
+26 -9
View File
@@ -1,17 +1,17 @@
import CombinedStream = require("combined-stream");
import { createReadStream, createWriteStream } from "fs";
import CombinedStream = require('combined-stream');
import { createReadStream, createWriteStream } from 'fs';
const stream1 = new CombinedStream();
stream1.append(createReadStream("tsconfig.json"));
stream1.append(createReadStream("tslint.json"));
stream1.append(createReadStream("index.d.ts"));
stream1.append(createReadStream('tsconfig.json'));
stream1.append(createReadStream('tslint.json'));
stream1.append(createReadStream('index.d.ts'));
stream1.pipe(createWriteStream("combined.txt"));
stream1.pipe(createWriteStream('combined.txt'));
const stream2 = CombinedStream.create({
maxDataSize: 1 << 32,
pauseStreams: false,
pauseStreams: false
});
stream1.destroy();
@@ -19,12 +19,29 @@ stream1.destroy();
// should log true
console.log(CombinedStream.isStreamLike(stream2));
stream2.on("data", (data) => {
stream2.on('data', data => {
console.log(data);
});
stream2.pipe(createWriteStream("combined.txt"));
stream2.pipe(createWriteStream('combined.txt'));
stream2.write(CombinedStream.name);
stream2.destroy();
const arrowFunction = (): CombinedStream => {
const stream3 = new CombinedStream();
// test next function
stream3.append(next => {
stream3.append('hello world');
next(createReadStream(''));
});
// next function with no next
stream3.append(() => {
stream3.append('hello again');
});
return stream3;
};
+20 -20
View File
@@ -1,19 +1,27 @@
// Type definitions for combined-stream 1.0
// Project: https://github.com/felixge/node-combined-stream
// Definitions by: Felix Geisendörfer <https://github.com/felixge>, Tomek Łaziuk <https://github.com/tlaziuk>
// Definitions by: Felix Geisendörfer <https://github.com/felixge>, Tomek Łaziuk <https://github.com/tlaziuk>, Kon Pik <https://github.com/konpikwastaken>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Stream } from "stream";
import { Stream } from 'stream';
declare class CombinedStream extends Stream implements CombinedStream.Options {
type Appendable = NodeJS.ReadableStream | NodeJS.WritableStream | Buffer | string | NextFunction;
type NextFunction = (next: (stream: Appendable) => any) => any;
interface Options {
maxDataSize?: number;
pauseStreams?: boolean;
}
declare class CombinedStream extends Stream implements Options {
readonly writable: boolean;
readonly readable: boolean;
readonly dataSize: number;
maxDataSize: number;
pauseStreams: boolean;
append(stream: NodeJS.ReadableStream | NodeJS.WritableStream | Buffer | string): this;
append(stream: Appendable): this;
write(data: any): void;
pause(): void;
resume(): void;
@@ -34,23 +42,15 @@ declare class CombinedStream extends Stream implements CombinedStream.Options {
_emitError(error: Error): void;
// events
on(event: "close" | "end" | "resume" | "pause", cb: () => void): this;
on(event: "error", cb: (err: Error) => void): this;
on(event: "data", cb: (data: any) => void): this;
once(event: "close" | "end" | "resume" | "pause", cb: () => void): this;
once(event: "error", cb: (err: Error) => void): this;
once(event: "data", cb: (data: any) => void): this;
}
on(event: 'close' | 'end' | 'resume' | 'pause', cb: () => void): this;
on(event: 'error', cb: (err: Error) => void): this;
on(event: 'data', cb: (data: any) => void): this;
once(event: 'close' | 'end' | 'resume' | 'pause', cb: () => void): this;
once(event: 'error', cb: (err: Error) => void): this;
once(event: 'data', cb: (data: any) => void): this;
declare namespace CombinedStream {
interface Options {
maxDataSize?: number;
pauseStreams?: boolean;
}
function create(options?: Options): CombinedStream;
function isStreamLike(stream: any): stream is Stream;
static create(options?: Options): CombinedStream;
static isStreamLike(stream: any): stream is Stream;
}
export = CombinedStream;
-1
View File
@@ -1,7 +1,6 @@
// Type definitions for connect-redis
// Project: https://npmjs.com/package/connect-redis
// Definitions by: Xavier Stouder <https://github.com/xstoudi>
// Albert Kurniawan <https://github.com/morcerf>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
+32 -11
View File
@@ -209,7 +209,7 @@ client.get({
id: '1',
routing: '1'
}, (error, response) => {
const routing = response._routing;
const routing = response._routing;
});
client.mget({
@@ -338,22 +338,43 @@ client.indices.updateAliases({
// ...
});
client.reindex({
body: {
source: {
index: "twitter"
},
dest: {
index: "new_twitter"
client.indices.updateAliases({
body: {
actions: [
{
add: {
index: 'logstash-2018.11', alias: 'logstash-filtered', filter: {
query: {
exists: { field: 'id' }
}
},
routing: 'id'
}
}
]
}
}).then((response) => {
// ...
}, (error) => {
// ...
});
client.reindex({
body: {
source: {
index: "twitter"
},
dest: {
index: "new_twitter"
}
}
})
.then(response => {
.then(response => {
const { took, timed_out } = response;
// ...
});
});
// Errors
function testErrors() {
throw new elasticsearch.errors.AuthenticationException();
throw new elasticsearch.errors.AuthenticationException();
}
+2
View File
@@ -1400,6 +1400,8 @@ export interface IndicesUpdateAliasesParamsAction {
index?: string;
indices?: string[];
alias: string;
routing?: string;
filter?: object;
};
remove?: {
index?: string;
+1 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for emoji-mart 2.8
// Project: https://github.com/missive/emoji-mart
// Definitions by: Diogo Franco <https://github.com/Kovensky>
// Definitions by: Jessica Franco <https://github.com/Kovensky>
// Nick Winans <https://github.com/Nicell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
+2 -1
View File
@@ -145,7 +145,8 @@ Audio.setAudioModeAsync({
playsInSilentModeIOS: true,
interruptionModeIOS: 2,
interruptionModeAndroid: 1,
allowsRecordingIOS: true
allowsRecordingIOS: true,
playThroughEarpieceAndroid: false
});
Audio.setIsEnabledAsync(true);
+7 -3
View File
@@ -12,6 +12,7 @@
// Nathan Phillip Brink <https://github.com/binki>
// Martin Olsson <https://github.com/mo>
// Levan Basharuli <https://github.com/levansuper>
// Pavel Ihm <https://github.com/ihmpavel>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -405,6 +406,9 @@ export namespace Audio {
/** an enum selecting how your experience’s audio should interact with the audio from other apps on Android: */
interruptionModeAndroid: InterruptionModeAndroid;
/** Boolean selecting if audio should go to earpiece (only on Android). */
playThroughEarpieceAndroid: boolean;
}
function setIsEnabledAsync(value: boolean): Promise<void>;
@@ -566,7 +570,7 @@ export interface PlaybackStatusToSet {
volume?: number;
}
export type PlaybackSource = RequireSource | { uri: string } | Asset;
export type PlaybackSource = RequireSource | { uri: string, headers?: { [header: string]: string }, overrideFileExtensionAndroid?: string } | Asset;
export class PlaybackObject {
/**
@@ -2355,7 +2359,7 @@ export namespace Calendar {
/** Name for the account that owns this calendar */
ownerAccount?: string; // Android
/** Time zone for the calendar */
/** Time zone for the calendar */
timeZone?: string; // Android
/** Alarm methods that this calendar supports */
@@ -2398,7 +2402,7 @@ export namespace Calendar {
/** Visible name of the event */
title?: string;
/** Location field of the event */
/** Location field of the event */
location?: string;
/** Date when the event record was created */
+1 -1
View File
@@ -3467,7 +3467,7 @@ export class IText extends Object {
* @param [endIndex] End index to get styles at
* @return styles Style object at a specified (or current) index
*/
getSelectionStyles(startIndex: number, endIndex: number): any;
getSelectionStyles(startIndex: number, endIndex: number, complete?: boolean): any;
/**
* Sets style of a current selection
* @param [styles] Styles object
+2
View File
@@ -2,3 +2,5 @@ import fileType = require("file-type");
fileType(new Buffer([0xFF, 0xD8, 0xFF]));
fileType(new Uint8Array([0xFF, 0xD8, 0xFF]));
const minimumBytes: number = fileType.minimumBytes;
+2
View File
@@ -15,4 +15,6 @@ declare namespace FileType {
ext: string;
mime: string;
}
const minimumBytes: number;
}
+3
View File
@@ -131,6 +131,9 @@ export interface Props {
onChildClick?(hoverKey: any, childProps: any): void;
onChildMouseEnter?(hoverKey: any, childProps: any): void;
onChildMouseLeave?(hoverKey: any, childProps: any): void;
onChildMouseDown?(childKey: any, childProps: any, mouse: any): void;
onChildMouseUp?(childKey: any, childProps: any, mouse: any): void;
onChildMouseMove?(childKey: any, childProps: any, mouse: any): void;
onDrag?(args: any): void;
onZoomAnimationStart?(args: any): void;
onZoomAnimationEnd?(args: any): void;
+1
View File
@@ -269,3 +269,4 @@ got('http://todomvc.com', { retry: 2 });
got('http://todomvc.com', { retry: { retries: 2, methods: ['GET'], statusCodes: [408, 504], maxRetryAfter: 1 } });
got('http://todomvc.com', { throwHttpErrors: false });
got('http://todomvc.com', { hooks: { beforeRequest: [ () => 'foo']} });
got('http://todomvc.com', { timeout: 1 }).catch((e) => e instanceof got.TimeoutError);
+6 -1
View File
@@ -53,6 +53,10 @@ declare class CancelError extends StdError {
name: 'CancelError';
}
declare class TimeoutError extends StdError {
name: 'TimeoutError';
}
declare class StdError extends Error {
code?: string;
host?: string;
@@ -75,6 +79,7 @@ declare const got: got.GotFn &
MaxRedirectsError: typeof MaxRedirectsError;
UnsupportedProtocolError: typeof UnsupportedProtocolError;
CancelError: typeof CancelError;
TimeoutError: typeof TimeoutError;
};
interface InternalRequestOptions extends https.RequestOptions {
@@ -215,7 +220,7 @@ declare namespace got {
removeListener(event: 'uploadProgress', listener: (progress: Progress) => void): this;
}
type GotError = RequestError | ReadError | ParseError | HTTPError | MaxRedirectsError | UnsupportedProtocolError | CancelError;
type GotError = RequestError | ReadError | ParseError | HTTPError | MaxRedirectsError | UnsupportedProtocolError | CancelError | TimeoutError;
interface Progress {
percent: number;
+5 -1
View File
@@ -18,11 +18,15 @@ const badge1: ReCaptchaV2.Badge = "bottomleft";
const badge2: ReCaptchaV2.Badge = "bottomright";
const badge3: ReCaptchaV2.Badge = "inline";
const invisibleParams: ReCaptchaV2.Parameters = {
const invisibleParams1: ReCaptchaV2.Parameters = {
sitekey: "siteKey",
badge: badge1,
};
const invisibleParams2: ReCaptchaV2.Parameters = {
badge: badge2,
};
const id1: number = grecaptcha.render("foo");
const id2: number = grecaptcha.render("foo", params);
const id3: number = grecaptcha.render(document.getElementById("foo"));
+1 -1
View File
@@ -46,7 +46,7 @@ declare namespace ReCaptchaV2 {
/**
* Your sitekey.
*/
sitekey: string;
sitekey?: string;
/**
* Optional. The color theme of the widget.
* Accepted values: "light", "dark"
-5
View File
@@ -1,8 +1,3 @@
// Type definitions for Highcharts 4.2.6
// Project: http://www.highcharts.com/
// Definitions by: Maciej Suchecki <https://github.com/mc-suchecki>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as Highcharts from "highcharts";
declare function HighchartsMore(H: Highcharts.Static): Highcharts.Static;
+3 -20
View File
@@ -1,11 +1,3 @@
// Type definitions for Highstock 2.1.6
// Project: http://www.highcharts.com/
// Definitions by: David Deutsch <http://github.com/DavidKDeutsch>
// Dave Baumann <https://github.com/route2Dev>
// Richard Ison <https://github.com/richardison>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as Highcharts from "highcharts";
declare namespace Highstock {
@@ -129,8 +121,7 @@ declare namespace Highstock {
}
interface Chart {
new (options: Options): ChartObject;
new (options: Options, callback: (chart: ChartObject) => void): ChartObject;
new (options: Options, callback?: (chart: ChartObject) => void): ChartObject;
}
interface Static extends Highcharts.Static {
@@ -142,13 +133,6 @@ declare namespace Highstock {
declare global {
interface JQuery {
highcharts(type: "StockChart"): Highstock.ChartObject;
/**
* Creates a new Highcharts.Chart for the current JQuery selector; usually
* a div selected by $('#container')
* @param options Options for this chart
* @return current selector the current JQuery selector
*/
highcharts(type: "StockChart", options: Highstock.Options): JQuery;
/**
* Creates a new Highcharts.Chart for the current JQuery selector; usually
* a div selected by $('#container')
@@ -156,11 +140,10 @@ declare global {
* @param callback Callback function used to manipulate the constructed chart instance
* @return current selector the current JQuery selector
*/
highcharts(type: "StockChart", options: Highstock.Options, callback: (chart: Highstock.ChartObject) => void): JQuery;
highcharts(type: "StockChart", options: Highstock.Options, callback?: (chart: Highstock.ChartObject) => void): JQuery;
highcharts(type: string): Highcharts.ChartObject;
highcharts(type: string, options: Highcharts.Options): JQuery;
highcharts(type: string, options: Highcharts.Options, callback: (chart: Highcharts.ChartObject) => void): JQuery;
highcharts(type: string, options: Highcharts.Options, callback?: (chart: Highcharts.ChartObject) => void): JQuery;
}
}
+116 -64
View File
@@ -1,4 +1,4 @@
// Type definitions for Highcharts 5.0.13
// Type definitions for Highcharts 5.0
// Project: http://www.highcharts.com/
// Definitions by: Damiano Gambarotto <https://github.com/damianog>
// Dan Lewi Harkestad <https://github.com/baltie>
@@ -4659,6 +4659,14 @@ declare namespace Highcharts {
* allows setting a separate color for the line without altering the fillColor.
*/
lineColor?: string | Gradient;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
maxFontSize?: number | null;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
minFontSize?: number | null;
/**
* A separate color for the negative part of the area.
* @since 3.0
@@ -4757,6 +4765,10 @@ declare namespace Highcharts {
* @since 2.3.0
*/
grouping?: boolean;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
maxFontSize?: number | null;
/**
* The maximum allowed pixel width for a column, translated to the height of a bar in a bar chart. This prevents the
* columns from becoming too wide when there is a small number of points in the chart.
@@ -4764,6 +4776,10 @@ declare namespace Highcharts {
* @since 4.1.8
*/
maxPointWidth?: number | null;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
minFontSize?: number | null;
/**
* The minimal height for a column or width for a bar. By default, 0 values are not shown. To visualize a 0 (or
* close to zero) point, set the minimal point length to a pixel value like 3. In stacked column charts,
@@ -4858,6 +4874,10 @@ declare namespace Highcharts {
* @since 3.0
*/
displayNegative?: boolean;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
maxFontSize?: number | null;
/**
* Maximum bubble size. Bubbles will automatically size between the minSize and maxSize to reflect the z value of
* each bubble. Can be either pixels (when no unit is given), or a percentage of the smallest one of the plot width
@@ -4866,6 +4886,10 @@ declare namespace Highcharts {
* @since 3.0
*/
maxSize?: string | number;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
minFontSize?: number | null;
/**
* Minimum bubble size. Bubbles will automatically size between the minSize and maxSize to reflect the z value of
* each bubble. Can be either pixels (when no unit is given), or a percentage of the smallest one of the plot width
@@ -5151,6 +5175,14 @@ declare namespace Highcharts {
* Options for the dial or arrow pointer of the gauge.
*/
dial?: Dial;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
maxFontSize?: number | null;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
minFontSize?: number | null;
/**
* Allow the dial to overshoot the end of the perimeter axis by this many degrees. Say if the gauge axis goes from 0
* to 60, a value of 100, or 1000, will show 5 degrees beyond the end of the axis. Defaults to 0.
@@ -5219,6 +5251,10 @@ declare namespace Highcharts {
* @default 50
*/
cropTreshold?: number;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
maxFontSize?: number | null;
/**
* The maximum allowed pixel width for a column, translated to the height of a bar in a bar chart. This prevents the
* columns from becoming too wide when there is a small number of points in the chart.
@@ -5226,6 +5262,10 @@ declare namespace Highcharts {
* @since 4.1.8
*/
maxPointWidth?: number | null;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
minFontSize?: number | null;
/**
* The row size - how many Y axis units each heatmap row should span.
* @default 1
@@ -5244,6 +5284,14 @@ declare namespace Highcharts {
}
interface LineChart extends SeriesChart {
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
maxFontSize?: number | null;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
minFontSize?: number | null;
/**
* Whether to apply steps to the line. Possible values are left, center and right. Prior to 2.3.5, only left was
* supported.
@@ -5314,6 +5362,14 @@ declare namespace Highcharts {
* @since 2.0
*/
innerSize?: number | string;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
maxFontSize?: number | null;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
minFontSize?: number | null;
/**
* The minimum size for a pie in response to auto margins. The pie will try to shrink to make room for data labels
* in side the plot area, but only to this size.
@@ -5361,6 +5417,14 @@ declare namespace Highcharts {
* @default 0
*/
lineWidth?: number;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
maxFontSize?: number | null;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
minFontSize?: number | null;
}
interface PyramidChart extends SeriesChart {
@@ -5435,7 +5499,16 @@ declare namespace Highcharts {
width?: number | string;
}
interface ScatterChart extends SeriesChart { }
interface ScatterChart extends SeriesChart {
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
maxFontSize?: number | null;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
minFontSize?: number | null;
}
/**
* A gauge showing values using a filled arc with colors indicating the value. The solid gauge plots values against the
@@ -5471,7 +5544,16 @@ declare namespace Highcharts {
wrap?: boolean;
}
interface SplineChart extends SeriesChart { }
interface SplineChart extends SeriesChart {
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
maxFontSize?: number | null;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
minFontSize?: number | null;
}
/**
* The size of the point shape is determined by its value relative to its siblings values. Requires the module
@@ -5543,6 +5625,10 @@ declare namespace Highcharts {
* Set options on specific levels. Takes precedence over series options, but not point options.
*/
levels?: TreeMapLevel[];
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
maxFontSize?: number | null;
/**
* The maximum allowed pixel width for a column, translated to the height of a bar in a bar chart. This prevents the
* columns from becoming too wide when there is a small number of points in the chart.
@@ -5550,6 +5636,10 @@ declare namespace Highcharts {
* @since 4.1.8
*/
maxPointWidth?: number | null;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
minFontSize?: number | null;
/**
* The sort index of the point inside the treemap level.
* @since 4.1.10
@@ -5614,6 +5704,14 @@ declare namespace Highcharts {
* @since 5.0.12
*/
exposeElementToA11y?: boolean;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
maxFontSize?: number | null;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
minFontSize?: number | null;
/**
* This option decides which algorithm is used for placement, and rotation of a word. The choice of algorith is
* therefore a crucial part of the resulting layout of the wordcloud. It is possible for users to add their own
@@ -5814,6 +5912,14 @@ declare namespace Highcharts {
* The sequential index of the series in the legend.
*/
legendIndex?: number;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
maxFontSize?: number | null;
/**
* For area-like series, allow the font size to vary so that small areas get a smaller font size. The default applies this effect to area-like series but not line-like series.
*/
minFontSize?: number | null;
/**
* The name of the series as shown in the legend, tooltip etc.
*/
@@ -6638,16 +6744,10 @@ declare namespace Highcharts {
/**
* Set new categories for the axis. Redraws.
* @param categories The new category names.
* @param redraw Whether to redraw the axis or wait for an explicit call to chart.redraw().
* @since 1.2.0
*/
setCategories(categories: string[]): void;
/**
* Set new categories for the axis.
* @param categories The new category names.
* @param redraw Whether to redraw the axis or wait for an explicit call to chart.redraw().
* @since 1.2.0
*/
setCategories(categories: string[], redraw: boolean): void;
setCategories(categories: string[], redraw?: boolean): void;
/**
* Set the minimum and maximum of the axes after render time. If the startOnTick and endOnTick options are true, the
* minimum and maximum values are rounded off to the nearest tick. To prevent this, these options can be set to
@@ -6757,22 +6857,6 @@ declare namespace Highcharts {
* @since 3.0.8
*/
drillUp(): void;
/**
* Exporting module required. Submit an SVG version of the chart to a server along with some parameters for
* conversion.
* @since 2.0
*/
exportChart(): void;
/**
* Exporting module required. Submit an SVG version of the chart to a server along with some parameters for
* conversion.
* @param options Exporting options. Out of the exporting options, the following options can be given as parameters to the exportChart method.
* All options default to the values given in the exporting config options. filename: the filename for the export without extension,
* url: the URL for the server module to do the conversion, width: the width of the PNG or JPEG image generated on the server,
* type: the MIME type of the converted image, sourceWidth: the width of the source (in-page) chart, sourceHeight: the height of the source chart.
* @since 2.0
*/
exportChart(options: ExportingOptions): void;
/**
* Exporting module required. Submit an SVG version of the chart to a server along with some parameters for
* conversion.
@@ -6783,31 +6867,17 @@ declare namespace Highcharts {
* @param chartOptions Additional chart options for the exported chart. For example a different background color can be added here.
* @since 2.0
*/
exportChart(options: ExportingOptions, chartOptions: Options): void;
exportChart(options?: ExportingOptions, chartOptions?: Options): void;
/**
* Export the chart to a PNG or SVG without sending it to a server. Requires
* modules/exporting.js and modules/offline-exporting.js.
* @since 2.0
*/
exportChartLocal(): void;
/**
* Export the chart to a PNG or SVG without sending it to a server. Requires
* modules/exporting.js and modules/offline-exporting.js.
* @param options Exporting options. Same as
* the exportChart params.
* @since 2.0
*/
exportChartLocal(options: ExportingOptions): void;
/**
* Export the chart to a PNG or SVG without sending it to a server.
* Requires modules/exporting.js and modules/offline-exporting.js.
* @param options Exporting options. Same as
* the exportChart params.
* @param chartOptions Additional chart options for the
* exported chart. Same as the exportChart params.
* @since 2.0
*/
exportChartLocal(options: ExportingOptions, chartOptions: Options): void;
exportChartLocal(options?: ExportingOptions, chartOptions?: Options): void;
/**
* Get an axis, series or point by its id as given in the configuration options.
* @param id The id of the axis, series or point to get.
@@ -6951,23 +7021,12 @@ declare namespace Highcharts {
/**
* This is the constructor for creating a new chart object.
* @param options The chart options
*/
new (options: Options): ChartObject;
/**
* This is the constructor for creating a new chart object.
* @param options The chart options
* @param callback A function to execute when the chart object is finished loading and rendering. In most cases the chart is built in one thread,
* but in Internet Explorer version 8 or less the chart is sometimes initiated before the document is ready,
* and in these cases the chart object will not be finished directly after callingnew Highcharts.Chart().
* s a consequence, code that relies on the newly built Chart object should always run in the callback. Defining a chart.event.load handler is equivalent.
*/
new (options: Options, callback: (chart: ChartObject) => void): ChartObject;
/**
* This is the constructor for creating a new chart object.
* @param renderTo The id or a reference to a DOM element where the chart should be rendered (since v4.2.0).
* @param options The chart options
*/
new (renderTo: string | HTMLElement, options: Options): ChartObject;
new (options: Options, callback?: (chart: ChartObject) => void): ChartObject;
/**
* This is the constructor for creating a new chart object.
* @param renderTo The id or a reference to a DOM element where the chart should be rendered (since v4.2.0).
@@ -6977,7 +7036,7 @@ declare namespace Highcharts {
* and in these cases the chart object will not be finished directly after callingnew Highcharts.Chart().
* As a consequence, code that relies on the newly built Chart object should always run in the callback. Defining a chart.event.load handler is equivalent.
*/
new (renderTo: string | HTMLElement, options: Options, callback: (chart: ChartObject) => void): ChartObject;
new (renderTo: string | HTMLElement, options: Options, callback?: (chart: ChartObject) => void): ChartObject;
}
/**
@@ -7551,13 +7610,6 @@ declare namespace Highcharts {
declare global {
interface JQuery {
highcharts(): Highcharts.ChartObject;
/**
* Creates a new Highcharts.Chart for the current JQuery selector; usually
* a div selected by $('#container')
* @param options Options for this chart
* @return current {JQuery} selector the current JQuery selector
*/
highcharts(options: Highcharts.Options): JQuery;
/**
* Creates a new Highcharts.Chart for the current JQuery selector; usually
* a div selected by $('#container')
@@ -7565,7 +7617,7 @@ declare global {
* @param callback Callback function used to manipulate the constructed chart instance
* @return current {JQuery} selector the current JQuery selector
*/
highcharts(options: Highcharts.Options, callback: (chart: Highcharts.ChartObject) => void): JQuery;
highcharts(options: Highcharts.Options, callback?: (chart: Highcharts.ChartObject) => void): JQuery;
}
}
-5
View File
@@ -1,8 +1,3 @@
// Type definitions for Highcharts 4.2.6 (boost module)
// Project: http://www.highcharts.com/
// Definitions by: Daniel Martin <https://github.com/inad9300>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Static } from "highcharts";
declare function HighchartsBoost(H: Static): Static;
-5
View File
@@ -1,8 +1,3 @@
// Type definitions for Highcharts Drilldown 4.2.7
// Project: http://www.highcharts.com/
// Definitions by: Konstantin Rohde <https://github.com/RohdeK>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Static } from "highcharts";
declare function HighchartsDrilldown(H: Static): Static;
-5
View File
@@ -1,8 +1,3 @@
// Type definitions for Highcharts 4.2.6 (exporting module)
// Project: http://www.highcharts.com/
// Definitions by: Maciej Suchecki <https://github.com/mc-suchecki>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Static } from "highcharts";
declare function HighchartsExporting(H: Static): Static;
-5
View File
@@ -1,8 +1,3 @@
// Type definitions for Highmaps 4.2.7
// Project: http://www.highcharts.com/products/highmaps
// Definitions by: Albert Ozimek <https://github.com/AlbertOzimek>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as highcharts from 'highcharts';
import * as geojson from 'geojson';
-5
View File
@@ -1,8 +1,3 @@
// Type definitions for Highcharts No Data to Display 4.2.7
// Project: http://www.highcharts.com/
// Definitions by: Andrey Zolotin <https://github.com/nitoloz>, Rowell Heria <https://github.com/rowellx68>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Static } from "highcharts";
declare module "highcharts" {
-5
View File
@@ -1,8 +1,3 @@
// Type definitions for Highcharts 4.2.6 (offline exporting module)
// Project: http://www.highcharts.com/
// Definitions by: Daniel Martin <https://github.com/inad9300>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { Static } from "highcharts";
declare function HighchartsOfflineExporting(H: Static): Static;
+2 -2
View File
@@ -66,10 +66,10 @@ $(() => {
}
},
series: [<Highcharts.AreaRangeChartSeriesOptions> {
series: [{
name: 'USD to EUR',
data: someData,
lineColor: "blue"
}]
} as Highcharts.AreaRangeChartSeriesOptions]
});
});
+122 -122
View File
@@ -40,15 +40,15 @@ function originalTests() {
renderTo: "container"
},
xAxis: {},
series: [<Highcharts.LineChartSeriesOptions> {
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
description: "foo",
type: "line",
allowPointSelect: true
}]
} as Highcharts.LineChartSeriesOptions]
});
chart1.addSeries<Highcharts.BarChartSeriesOptions>({
chart1.addSeries({
enableMouseTracking: true,
data: [1, 2, 3, 4, 5],
description: "some description"
@@ -61,7 +61,7 @@ function originalTests() {
height: 400,
spacingRight: 20
},
xAxis: [<Highcharts.AxisOptions> {
xAxis: [{
description: 'x-foo',
min: 1,
max: 1000,
@@ -71,7 +71,7 @@ function originalTests() {
gridLineWidth: 1,
type: 'logarithmic'
}],
yAxis: [<Highcharts.AxisOptions> {
yAxis: [{
description: 'y-foo',
min: 1,
max: 1000,
@@ -85,7 +85,7 @@ function originalTests() {
legend: {
enabled: false
},
series: [<Highcharts.ScatterChartSeriesOptions> {
series: [{
data: [
[550, 870], [738, 362], [719, 711], [547, 665], [595, 197], [332, 144],
[581, 555], [196, 862], [6, 837], [400, 924], [888, 148], [785, 730],
@@ -114,12 +114,12 @@ function originalTests() {
renderTo: "container"
},
xAxis: {},
series: [<Highcharts.ColumnRangeChartSeriesOptions> {
series: [{
data: [[1, 1, 2], [2, 2, 3], [3, 2, 3]],
description: "foo",
type: "columnrange",
allowPointSelect: true
}]
} as Highcharts.ColumnRangeChartSeriesOptions]
});
const chart4 = new Highcharts.Chart({
@@ -127,12 +127,12 @@ function originalTests() {
renderTo: "container"
},
xAxis: {},
series: [<Highcharts.ColumnRangeChartSeriesOptions> {
series: [{
data: [["01-01-2018", 1, 2], ["02-01-2018", 2, 3], ["03-01-2018", 2, 3]],
description: "column range data",
type: "columnrange",
allowPointSelect: true
}]
} as Highcharts.ColumnRangeChartSeriesOptions]
});
const div: HTMLDivElement = null as any;
@@ -146,7 +146,7 @@ function originalTests() {
},
xAxis: [{
}],
series: [<Highcharts.PieChartSeriesOptions> {
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
};
@@ -164,47 +164,47 @@ function originalTests() {
const renderToIdChart = new Highcharts.Chart("container", {
xAxis: {},
series: [<Highcharts.LineChartSeriesOptions> {
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
type: "line",
allowPointSelect: true
}]
} as Highcharts.LineChartSeriesOptions]
});
const renderToElementChart = new Highcharts.Chart(div, {
xAxis: {},
series: [<Highcharts.LineChartSeriesOptions> {
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
type: "line",
allowPointSelect: true
}]
} as Highcharts.LineChartSeriesOptions]
});
const createWithFunction = Highcharts.chart({
xAxis: {},
series: [<Highcharts.LineChartSeriesOptions> {
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
type: "line",
allowPointSelect: true
}]
} as Highcharts.LineChartSeriesOptions]
});
const createWithFunctionRenderToId = Highcharts.chart("container", {
xAxis: {},
series: [<Highcharts.LineChartSeriesOptions> {
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
type: "line",
allowPointSelect: true
}]
} as Highcharts.LineChartSeriesOptions]
});
const createWithFunctionRenderToElement = Highcharts.chart(div, {
xAxis: {},
series: [<Highcharts.LineChartSeriesOptions> {
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
type: "line",
allowPointSelect: true
}]
} as Highcharts.LineChartSeriesOptions]
});
}
@@ -245,7 +245,7 @@ function test_ChartOptions() {
duration: 500,
easing: "linear"
},
backgroundColor: <Highcharts.Gradient> {
backgroundColor: {
linearGradient: {
x1: 0,
y1: 0,
@@ -261,7 +261,7 @@ function test_ChartOptions() {
colorCount: 42,
defaultSeriesType: "deprecated",
description: "an arbitrary description",
events: <Highcharts.ChartEvents> {
events: {
addSeries: () => { },
afterPrint: () => { },
beforePrint: () => { },
@@ -281,21 +281,21 @@ function test_ChartOptions() {
marginLeft: 10,
marginRight: 10,
marginTop: 10,
options3d: <Highcharts.ChartOptions3d> {
options3d: {
alpha: 20,
beta: 20,
depth: 50,
enabled: true,
frame: {
back: <Highcharts.ChartOptions3dFrame> {
back: {
color: "black",
size: 2
},
bottom: <Highcharts.ChartOptions3dFrame> {
bottom: {
color: "black",
size: 2
},
side: <Highcharts.ChartOptions3dFrame> {
side: {
color: "black",
size: 2
}
@@ -309,7 +309,7 @@ function test_ChartOptions() {
plotBackgroundImage: "http://image.url/image.jpg",
plotBorderColor: "grey",
plotBorderWidth: 5,
plotShadow: <Highcharts.Shadow> {
plotShadow: {
color: "magenta",
offsetX: 10,
offsetY: 10,
@@ -319,15 +319,15 @@ function test_ChartOptions() {
polar: true,
reflow: false,
renderTo: "elementId",
resetZoomButton: <Highcharts.ChartResetZoomButton> {
position: <Highcharts.Position> {
resetZoomButton: {
position: {
align: "left",
verticalAlign: "top",
x: 5,
y: 5
},
relativeTo: "chart",
theme: <Highcharts.ButtonTheme> {
theme: {
display: "hidden",
fill: "black",
stroke: "white",
@@ -394,7 +394,7 @@ function test_ChartOptions() {
});
// animation example
$('#container').highcharts(<Highcharts.Options> {
$('#container').highcharts({
chart: {
animation: {
duration: 1500,
@@ -479,7 +479,7 @@ function test_ChartOptions() {
chart: {
events: {
addSeries() {
const label = (<Highcharts.ChartObject> this).renderer.label('A series was added, about to redraw chart', 100, 120)
const label = (this as Highcharts.ChartObject).renderer.label('A series was added, about to redraw chart', 100, 120)
.attr({
fill: Highcharts.getOptions().colors[0],
padding: 10,
@@ -729,21 +729,21 @@ function test_Data() {
}
},
series: [
<Highcharts.LineChartSeriesOptions> {
{
lineWidth: 1
},
<Highcharts.AreaSplineChartSeriesOptions> {
{
type: 'areaspline',
color: '#c4392d',
negativeColor: '#5679c4',
fillOpacity: 0.5
}
} as Highcharts.AreaSplineChartSeriesOptions
]
});
// limited data example
$('#container').highcharts({
data: <Highcharts.DataOptions> {
data: {
csv: document.getElementById('csv').innerHTML,
startRow: 114,
endRow: 134,
@@ -753,7 +753,7 @@ function test_Data() {
xAxis: {
allowDecimals: false
},
series: [<Highcharts.LineChartSeriesOptions> {
series: [{
name: 'Annual mean'
}]
});
@@ -784,14 +784,14 @@ function test_Drilldown() {
type: 'category'
},
plotOptions: {
series: <Highcharts.ColumnChart> {
series: {
borderWidth: 0,
dataLabels: {
enabled: true
}
}
} as Highcharts.ColumnChart
},
series: [<Highcharts.ColumnChartSeriesOptions> {
series: [{
name: '2010',
data: [{
name: 'Republican',
@@ -806,7 +806,7 @@ function test_Drilldown() {
y: 4,
drilldown: 'other-2010'
}]
}, <Highcharts.ColumnChartSeriesOptions> {
}, {
name: '2014',
data: [{
name: 'Republican',
@@ -823,7 +823,7 @@ function test_Drilldown() {
}]
}],
drilldown: {
series: [<Highcharts.ColumnChartSeriesOptions> {
series: [{
id: 'republican-2010',
data: [
['East', 4],
@@ -831,7 +831,7 @@ function test_Drilldown() {
['North', 1],
['South', 4]
]
}, <Highcharts.ColumnChartSeriesOptions> {
}, {
id: 'democrats-2010',
data: [
['East', 6],
@@ -839,7 +839,7 @@ function test_Drilldown() {
['North', 2],
['South', 4]
]
}, <Highcharts.ColumnChartSeriesOptions> {
}, {
id: 'other-2010',
data: [
['East', 2],
@@ -847,7 +847,7 @@ function test_Drilldown() {
['North', 3],
['South', 2]
]
}, <Highcharts.ColumnChartSeriesOptions> {
}, {
id: 'republican-2014',
data: [
['East', 2],
@@ -855,7 +855,7 @@ function test_Drilldown() {
['North', 1],
['South', 7]
]
}, <Highcharts.ColumnChartSeriesOptions> {
}, {
id: 'democrats-2014',
data: [
['East', 4],
@@ -863,7 +863,7 @@ function test_Drilldown() {
['North', 5],
['South', 3]
]
}, <Highcharts.ColumnChartSeriesOptions> {
}, {
id: 'other-2014',
data: [
['East', 7],
@@ -881,14 +881,14 @@ function test_Drilldown() {
type: 'column'
},
plotOptions: {
series: <Highcharts.ColumnChart> {
series: {
borderWidth: 0,
dataLabels: {
enabled: true
}
}
} as Highcharts.ColumnChart
},
series: [<Highcharts.ColumnChartSeriesOptions> {
series: [{
name: 'Things',
colorByPoint: true,
data: [{
@@ -903,7 +903,7 @@ function test_Drilldown() {
name: 'Cars',
y: 4
}]
}],
} as Highcharts.ColumnChartSeriesOptions],
drilldown: {
activeAxisLabelStyle: {
textDecoration: 'none',
@@ -976,7 +976,7 @@ function test_Exporting() {
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}],
exporting: <Highcharts.ExportingOptions> {
exporting: {
error: () => {
console.log('succesfully asserted exporting.error');
},
@@ -987,7 +987,7 @@ function test_Exporting() {
chartOptions: {
subtitle: null
}
}
} as Highcharts.ExportingOptions
});
}
@@ -1113,12 +1113,12 @@ function test_AreaOptions() {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: <Highcharts.AreaChartSeriesOptions> {
series: {
fillColor: {
linearGradient: [0, 0, 0, 300],
stops: [
[0, Highcharts.getOptions().colors[0]],
[1, (<Highcharts.Gradient> Highcharts.Color(Highcharts.getOptions().colors[0])).setOpacity(0).get('rgba')]
[1, ((Highcharts.Color(Highcharts.getOptions().colors[0])) as Highcharts.Gradient).setOpacity(0).get('rgba')]
]
},
fillOpacity: 0.1,
@@ -1129,7 +1129,7 @@ function test_AreaOptions() {
threshold: 100,
trackByArea: true,
stickyTracking: false // to show the difference in tracking
}
} as Highcharts.AreaChartSeriesOptions
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
@@ -1146,7 +1146,7 @@ function test_AreaRange() {
type: "arearange",
zoomType: 'x'
},
series: [<Highcharts.AreaRangeChartSeriesOptions> {
series: [{
data: (((arr: number[], len: number) => {
for (let i = 0; i < len; i = i + 1) {
arr.push(i);
@@ -1191,7 +1191,7 @@ function test_AreaRange() {
legend: {
enabled: false
},
series: [<Highcharts.AreaRangeChartSeriesOptions> {
series: [{
name: 'Temperatures',
data,
dataLabels: {
@@ -1199,7 +1199,7 @@ function test_AreaRange() {
yHigh: 20,
yLow: -20
}
}]
} as Highcharts.AreaRangeChartSeriesOptions]
});
});
}
@@ -1215,7 +1215,7 @@ function test_Bar() {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: <Highcharts.BarChartSeriesOptions> {
series: {
borderColor: '#303030',
borderRadius: 5,
borderWidth: 2,
@@ -1240,7 +1240,7 @@ function test_Bar() {
}
}
}
}
} as Highcharts.BarChartSeriesOptions
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
@@ -1274,7 +1274,7 @@ function test_Bar() {
// grouping example
Highcharts.getOptions().colors = Highcharts.map(Highcharts.getOptions().colors, (color: string) => {
return (<Highcharts.Gradient> Highcharts.Color(color))
return (Highcharts.Color(color) as Highcharts.Gradient)
.setOpacity(0.5)
.get('rgba');
});
@@ -1309,19 +1309,19 @@ function test_Bar() {
shadow: false
}
},
series: [<Highcharts.BarChartSeriesOptions> {
series: [{
name: 'Tokyo',
data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
pointPadding: 0
}, <Highcharts.BarChartSeriesOptions> {
} as Highcharts.BarChartSeriesOptions, {
name: 'New York',
data: [83.6, 78.8, 98.5, 93.4, 106.0, 84.5, 105.0, 104.3, 91.2, 83.5, 106.6, 92.3],
pointPadding: 0.1
}, <Highcharts.BarChartSeriesOptions> {
}, {
name: 'London',
data: [48.9, 38.8, 39.3, 41.4, 47.0, 48.3, 59.0, 59.6, 52.4, 65.2, 59.3, 51.2],
pointPadding: 0.2
}, <Highcharts.BarChartSeriesOptions> {
}, {
name: 'Berlin',
data: [42.4, 33.2, 34.5, 39.7, 52.6, 75.5, 57.4, 60.4, 47.6, 39.1, 46.8, 51.1],
pointPadding: 0.3
@@ -1407,7 +1407,7 @@ function test_Bubble() {
maxSize: 50
}
},
series: [<Highcharts.BubbleChartSeriesOptions> {
series: [{
data: [
[9, 81, 13],
[98, 5, 39],
@@ -1430,7 +1430,7 @@ function test_Bubble() {
zMin: 0,
zMax: 100,
zThreshold: 0
}]
} as Highcharts.BubbleChartSeriesOptions]
});
// size by absolute value example
@@ -1444,7 +1444,7 @@ function test_Bubble() {
subtitle: {
text: 'Size is computed by absolute value on negative bubbles'
},
series: [<Highcharts.BubbleChartSeriesOptions> {
series: [{
data: [
[-5, 0, -5],
[-4, 0, -4],
@@ -1460,7 +1460,7 @@ function test_Bubble() {
],
sizeByAbsoluteValues: true,
negativeColor: '#FF0000'
}]
} as Highcharts.BubbleChartSeriesOptions]
});
}
@@ -1479,7 +1479,7 @@ function test_ColumnCrispFalse() {
}
return arr;
};
const chart = new Highcharts.Chart(<Highcharts.Options> {
const chart = new Highcharts.Chart({
title: {
text: 'Crisp columns are disabled'
},
@@ -1527,7 +1527,7 @@ function test_ErrorBar() {
tooltip: {
shared: true
},
series: [<Highcharts.SplineChartSeriesOptions> {
series: [{
name: 'Temperature',
type: 'spline',
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],
@@ -1537,7 +1537,7 @@ function test_ErrorBar() {
tooltip: {
pointFormat: '<span style="font-weight: bold; color: {series.color}"> {series.name}</span> : <b> {point.y:.1f}°C</b> <br/> '
}
}, <Highcharts.ErrorBarChartSeriesOptions> {
} as Highcharts.SplineChartSeriesOptions, {
color: '#FF0000',
name: 'Temperature error',
type: 'errorbar',
@@ -1549,7 +1549,7 @@ function test_ErrorBar() {
stemDashStyle: "Solid",
stemWidth: 3,
whiskerLength: 0
}]
} as Highcharts.ErrorBarChartSeriesOptions]
});
}
@@ -1568,7 +1568,7 @@ function test_FindNearestPointBy() {
}
},
series: [<Highcharts.IndividualSeriesOptions> {
series: [{
findNearestPointBy: 'x',
// Hover at [3.5, 6] to demo x-dimension search
// Compare to Series 2 behavior at [5.5, 3]
@@ -1584,7 +1584,7 @@ function test_FindNearestPointBy() {
[6, 6],
[7, 6]
]
}, <Highcharts.IndividualSeriesOptions> {
} as Highcharts.IndividualSeriesOptions, {
findNearestPointBy: 'xy',
// Hover at [1, 4] to demo xy-dimension search.
// Useful when having multiple points on the same x-value.
@@ -1600,7 +1600,7 @@ function test_FindNearestPointBy() {
[6, 3],
[7, 3]
]
}]
} as Highcharts.IndividualSeriesOptions]
});
}
@@ -1618,7 +1618,7 @@ function test_Funnel() {
x: -50
},
plotOptions: {
series: <Highcharts.FunnelChartSeriesOptions> {
series: {
dataLabels: {
enabled: true,
format: '<b> {point.name}</b> ({point.y:,.0f})',
@@ -1630,7 +1630,7 @@ function test_Funnel() {
reversed: false,
height: "10%",
width: 100
}
} as Highcharts.FunnelChartSeriesOptions
},
legend: {
enabled: false
@@ -1701,10 +1701,10 @@ function test_Gauge() {
}
}
},
series: [<Highcharts.GaugeChartSeriesOptions> {
series: [{
data: [80],
overshoot: 5
}]
} as Highcharts.GaugeChartSeriesOptions]
});
}
@@ -1757,14 +1757,14 @@ function test_HeatMap() {
],
min: -5
},
series: [<Highcharts.HeatMapSeriesOptions> {
series: [{
borderWidth: 0,
colsize: 24 * 36e5, // one day
tooltip: {
headerFormat: 'Temperature<br/> ',
pointFormat: '{point.x:%e %b, %Y} {point.y}:00: <b> {point.value} ℃</b> '
}
}]
} as Highcharts.HeatMapSeriesOptions]
});
}
@@ -1779,17 +1779,17 @@ function test_Line() {
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
series: [<Highcharts.LineChartSeriesOptions> {
series: [{
data: [1, 2, 3, 4, null, 6, 7, null, 9],
step: 'right',
name: 'Right',
linecap: 'round'
}, <Highcharts.LineChartSeriesOptions> {
} as Highcharts.LineChartSeriesOptions, {
data: [5, 6, 7, 8, null, 10, 11, null, 13],
step: 'center',
name: 'Center',
linecap: 'round'
}, <Highcharts.LineChartSeriesOptions> {
}, {
data: [9, 10, 11, 12, null, 14, 15, null, 17],
step: 'left',
name: 'Left',
@@ -1829,7 +1829,7 @@ function test_Pie() {
}
}
},
series: [<Highcharts.PieChartSeriesOptions> {
series: [{
name: "Brands",
colorByPoint: true,
data: [{
@@ -1853,7 +1853,7 @@ function test_Pie() {
name: "Proprietary or Undetectable",
y: 0.2
}]
}]
} as Highcharts.PieChartSeriesOptions]
});
// semi circle
@@ -1888,7 +1888,7 @@ function test_Pie() {
center: ['50%', '75%']
}
},
series: [<Highcharts.PieChartSeriesOptions> {
series: [{
type: 'pie',
name: 'Browser share',
innerSize: '50%',
@@ -2161,10 +2161,10 @@ function test_Waterfall() {
}
function test_AccessibilityOptions() {
const accessibilityOptions: Highcharts.AccessibilityOptions = <Highcharts.AccessibilityOptions> {
const accessibilityOptions: Highcharts.AccessibilityOptions = {
describeSingleSeries: true,
enabled: true,
keyboardNavigation: <Highcharts.KeyboardNavigationOptions> {
keyboardNavigation: {
enabled: true,
skipNullPoints: true
},
@@ -2177,7 +2177,7 @@ function test_AccessibilityOptions() {
seriesDescriptionFormatter: () => { }
};
const chart = new Highcharts.Chart(<Highcharts.Options> {
const chart = new Highcharts.Chart({
accessibility: accessibilityOptions
});
}
@@ -2435,31 +2435,31 @@ function test_AxisObject() {
axis.toPixels(10, true);
axis.toValue(10);
axis.toValue(10, true);
axis.update(<Highcharts.AxisOptions> {});
axis.update(<Highcharts.AxisOptions> {}, true);
axis.update({});
axis.update({}, true);
}
function test_ChartObject() {
const chart = $("#container").highcharts();
chart.addAxis(<Highcharts.AxisOptions> {});
chart.addAxis(<Highcharts.AxisOptions> {}, true);
chart.addAxis(<Highcharts.AxisOptions> {}, true, false);
chart.addAxis(<Highcharts.AxisOptions> {}, true, true, false);
chart.addAxis(<Highcharts.AxisOptions> {}, true, true, { duration: 50 });
chart.addSeries(<Highcharts.IndividualSeriesOptions> {});
chart.addSeries(<Highcharts.IndividualSeriesOptions> {}, false);
chart.addSeries(<Highcharts.IndividualSeriesOptions> {}, false, false);
chart.addSeries(<Highcharts.IndividualSeriesOptions> {}, false, { duration: 50 });
chart.addSeriesAsDrilldown(<Highcharts.PointObject> {}, <Highcharts.IndividualSeriesOptions> {});
chart.addAxis({});
chart.addAxis({}, true);
chart.addAxis({}, true, false);
chart.addAxis({}, true, true, false);
chart.addAxis({}, true, true, { duration: 50 });
chart.addSeries({});
chart.addSeries({}, false);
chart.addSeries({}, false, false);
chart.addSeries({}, false, { duration: 50 });
chart.addSeriesAsDrilldown({} as Highcharts.PointObject, {});
const container = chart.container;
console.log(container.id);
chart.destroy();
chart.drillUp();
chart.exportChart(<Highcharts.ExportingOptions> {}, <Highcharts.Options> {});
chart.exportChartLocal(<Highcharts.ExportingOptions> {}, <Highcharts.Options> {});
chart.exportChart({}, {});
chart.exportChartLocal({}, {});
const object = chart.get('axisIdOrSeriesIdOrPointId');
const svg1 = chart.getSVG();
const svg2 = chart.getSVG(<Highcharts.Options> {});
const svg2 = chart.getSVG({});
const selectedPoints = chart.getSelectedPoints();
const selectedSeries = chart.getSelectedSeries();
chart.hideLoading();
@@ -2480,11 +2480,11 @@ function test_ChartObject() {
const firstXAxis = chart.xAxis[0];
const firstYAxis = chart.yAxis[0];
const legend = chart.legend;
chart.update(<Highcharts.Options> {});
chart.update(<Highcharts.Options> {}, true);
chart.update(<Highcharts.Options> {}, true, true);
chart.update(<Highcharts.Options> {}, true, true, true);
chart.update(<Highcharts.Options> {}, true, true, {
chart.update({});
chart.update({}, true);
chart.update({}, true, true);
chart.update({}, true, true, true);
chart.update({}, true, true, {
duration: 3000,
});
}
@@ -2564,7 +2564,7 @@ function test_NumericSymbolMagnitude() {
}
function test_PaneBackground() {
const pane = <Highcharts.PaneBackground> {
const pane = {
backgroundColor: 'blue',
borderColor: 'white',
borderWidth: 5,
@@ -2576,7 +2576,7 @@ function test_PaneBackground() {
}
function test_PointObject() {
const point = <Highcharts.PointObject> $('#container').highcharts().get('point1');
const point = $('#container').highcharts().get('point1') as Highcharts.PointObject;
const category = point.category;
const percentage = point.percentage;
point.index;
@@ -2608,7 +2608,7 @@ function test_RendererObject() {
const renderer = $('#container').highcharts().renderer;
renderer.arc(0, 0, 20, 10, 0, Math.PI);
renderer.circle(0, 0, 100);
renderer.definition(<object> {});
renderer.definition({});
renderer.g('groupName');
renderer.image('http://source', 20, 20, 100, 100);
renderer.label('Label', 200, 100, 'rect', 0, 0, false, false, 'class');
@@ -2618,15 +2618,15 @@ function test_RendererObject() {
}
function test_ResponsiveOptions() {
const responsiveOptions: Highcharts.ResponsiveOptions = <Highcharts.ResponsiveOptions> {
const responsiveOptions: Highcharts.ResponsiveOptions = {
rules: [
<Highcharts.RulesOptions> {
chartOptions: <Highcharts.Options> {
{
chartOptions: {
chart: {
description: 'just a test'
}
},
condition: <Highcharts.ConditionOptions> {
condition: {
callback: () => { },
maxHeight: 420,
maxWidth: 420,
@@ -2637,13 +2637,13 @@ function test_ResponsiveOptions() {
]
};
const chart = new Highcharts.Chart(<Highcharts.Options> {
const chart = new Highcharts.Chart({
responsive: responsiveOptions
});
}
function test_SeriesObject() {
const series = <Highcharts.SeriesObject> $('#container').highcharts().get('series1');
const series = $('#container').highcharts().get('series1') as Highcharts.SeriesObject;
series.addPoint(0);
series.addPoint([0, 0]);
series.addPoint({});
-2
View File
@@ -3,9 +3,7 @@
"rules": {
// TODOs
"ban-types": false,
"unified-signatures": false,
"no-empty-interface": false,
"dt-header": false,
"no-declare-current-package": false,
"no-object-literal-type-assertion": false,
"no-self-import": false,
+7 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for i18next 11.9
// Type definitions for i18next 12.1
// Project: http://i18next.com
// Definitions by: Michael Ledin <https://github.com/mxl>
// Budi Irawan <https://github.com/deerawan>
@@ -160,6 +160,12 @@ declare namespace i18next {
*/
resources?: Resource;
/**
* Allow initializing with bundled resources while using a backend to load non bundled ones.
* @default false
*/
partialBundledLanguages?: boolean;
/**
* language to use (overrides language detection)
* @default undefined
+9 -4
View File
@@ -1,6 +1,7 @@
// Type definitions for ini v1.3.3
// Project: https://github.com/isaacs/ini
// Definitions by: Marcin Porębski <https://github.com/marcinporebski>
// Chris Arnesen <https://github.com/carnesen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface EncodeOptions {
@@ -8,9 +9,13 @@ interface EncodeOptions {
whitespace: boolean
}
export function decode(inistring: string): any;
export function parse(initstring: string): any;
export function encode(object: any, options?: EncodeOptions): string;
export function stringify(object: any, options?: EncodeOptions): string;
export function decode(str: string): {
[key: string]: any;
};
export function parse(str: string): {
[key: string]: any;
};
export function encode(object: any, options?: EncodeOptions | string): string;
export function stringify(object: any, options?: EncodeOptions | string): string;
export function safe(val: string): string;
export function unsafe(val: string): string;
+1443
View File
File diff suppressed because it is too large Load Diff
+199
View File
@@ -0,0 +1,199 @@
// For now, this "utils" module is necessary, as it is included in every adapter
// Once this PR is merged and @types/iobroker is available, it will become part of
// `iobroker.adapter-core`, which brings typings for it
declare const utils: {
readonly controllerDir: string;
getConfig(): string;
// tslint:disable:unified-signatures
adapter(adapterName: string): ioBroker.Adapter;
adapter(adapterOptions: ioBroker.AdapterOptions): ioBroker.Adapter;
// tslint:enable:unified-signatures
};
declare function assertNever(val: never): never;
// Let the tests begin
let adapter: ioBroker.Adapter;
// Test constructors
adapter = utils.adapter("my-adapter-name");
adapter = utils.adapter({
name: "my-adapter-name"
});
adapter = utils.adapter({
name: "my-adapter-name",
ready: readyHandler,
stateChange: stateChangeHandler,
objectChange: objectChangeHandler,
message: messageHandler,
unload: unloadHandler,
});
// Test EventEmitter definitions
adapter
.on("ready", readyHandler)
.on("stateChange", stateChangeHandler)
.on("objectChange", objectChangeHandler)
.on("message", messageHandler)
.on("unload", unloadHandler)
;
adapter
.removeListener("ready", readyHandler)
.removeListener("stateChange", stateChangeHandler)
.removeListener("objectChange", objectChangeHandler)
.removeListener("message", messageHandler)
.removeListener("unload", unloadHandler)
;
adapter.removeAllListeners();
function readyHandler() { }
function stateChangeHandler(id: string, state: ioBroker.State | null | undefined) {
// Test State properties
if (state) {
state.ack;
state.c && state.c.toLowerCase();
state.expire && state.expire.toFixed();
state.from.toLowerCase();
state.lc.toFixed();
state.q && state.q.toFixed();
state.ts.toFixed();
state.val;
}
}
function objectChangeHandler(id: string, object: ioBroker.Object | null | undefined) {
// Test properties of all objects
if (object) {
object._id.toLowerCase();
object.common.name.toLowerCase();
object.common.role && object.common.role.toLowerCase();
object.common.icon && object.common.icon.toLowerCase();
object.native.toString();
object.enums && object.enums.toString();
if (object.acl) {
object.acl.object.toFixed();
object.acl.owner.toLowerCase();
object.acl.ownerGroup.toLowerCase();
}
// Test different object kinds
switch (object.type) {
case "adapter":
case "config":
case "enum":
case "group":
case "host":
case "info":
case "instance":
case "meta":
case "script":
case "user":
// nothing special here, update these tests when we have specialized definitions
break;
case "state":
if (object.acl) object.acl.state.toFixed();
object.common.def;
object.common.desc && object.common.desc.toLowerCase();
object.common.history;
object.common.max && object.common.max.toFixed();
object.common.min && object.common.min.toFixed();
object.common.read.valueOf();
object.common.states && object.common.states.toString();
object.common.type && object.common.type.toLowerCase();
object.common.unit && object.common.unit.toLowerCase();
object.common.workingID && object.common.workingID.toLowerCase();
object.common.write.valueOf();
break;
case "channel":
object.common.desc && object.common.desc.toLowerCase();
break;
case "device":
// nothing special here, update these tests when we have specialized definitions
break;
}
}
}
function messageHandler(msg: ioBroker.Message) {
msg._id.toFixed();
msg.callback.ack.valueOf();
msg.callback.id.toFixed();
msg.callback.message.toString();
msg.callback.time.toFixed();
msg.command.toLowerCase();
msg.from.toLowerCase();
msg.message.toString();
}
function unloadHandler(callback: ioBroker.EmptyCallback) {
adapter.log.info("shutting down");
callback();
}
// Test the most important methods
adapter.setState("state.name", "value");
adapter.setState("state.name", "value", true);
adapter.setState("state.name", "value", (err, id) => { });
adapter.setState("state.name", { val: "value", ack: true });
adapter.setState("state.name", { val: "value", ack: true }, (err, id) => { });
adapter.setStateChanged("state.name", "value");
adapter.setStateChanged("state.name", "value", true);
adapter.setStateChanged("state.name", "value", (err, id) => { });
adapter.setStateChanged("state.name", { val: "value", ack: true });
adapter.setStateChanged("state.name", { val: "value", ack: true }, (err, id) => { });
adapter.setForeignState("state.name", "value");
adapter.setForeignState("state.name", "value", true);
adapter.setForeignState("state.name", "value", (err, id) => { });
adapter.setForeignState("state.name", { val: "value", ack: true });
adapter.setForeignState("state.name", { val: "value", ack: true }, (err, id) => { });
adapter.setForeignStateChanged("state.name", "value");
adapter.setForeignStateChanged("state.name", "value", true);
adapter.setForeignStateChanged("state.name", "value", (err, id) => { });
adapter.setForeignStateChanged("state.name", { val: "value", ack: true });
adapter.setForeignStateChanged("state.name", { val: "value", ack: true }, (err, id) => { });
adapter.setObject("obj.id", { type: "state", common: { name: "foo" }, native: {} });
adapter.setObject("obj.id", { type: "state", common: { name: "foo" }, native: {} }, (err, id) => { });
adapter.setForeignObject("obj.id", { type: "state", common: { name: "foo" }, native: {} });
adapter.setForeignObject("obj.id", { type: "state", common: { name: "foo" }, native: {} }, (err, id) => { });
adapter.setObjectNotExists("obj.id", { type: "state", common: { name: "foo" }, native: {} });
adapter.setObjectNotExists("obj.id", { type: "state", common: { name: "foo" }, native: {} }, (err, id) => { });
adapter.setForeignObjectNotExists("obj.id", { type: "state", common: { name: "foo" }, native: {} });
adapter.setForeignObjectNotExists("obj.id", { type: "state", common: { name: "foo" }, native: {} }, (err, id) => { });
adapter.getObject("obj.id", (err, obj) => { });
adapter.getForeignObject("obj.id", (err, obj) => { });
adapter.subscribeObjects("*");
adapter.subscribeStates("*");
adapter.subscribeForeignObjects("*");
adapter.subscribeForeignStates("*");
adapter.unsubscribeObjects("*");
adapter.unsubscribeStates("*");
adapter.unsubscribeForeignObjects("*");
adapter.unsubscribeForeignStates("*");
adapter.log.info("msg");
adapter.log.debug("msg");
adapter.log.warn("msg");
adapter.log.error("msg");
adapter.log.silly("msg");
switch (adapter.log.level) {
case "debug":
case "error":
case "info":
case "silly":
case "warn":
break;
default:
assertNever(adapter.log.level);
}
+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",
"iobroker-tests.ts"
]
}
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "dtslint/dt.json",
"rules": {
// This package has its own type `Object` which is not equal to the global `Object` type
// To avoid any confusion, it is referenced as `ioBroker.Object` instead of just `Object`
"no-unnecessary-qualifier": false
}
}
+1 -1
View File
@@ -251,7 +251,7 @@ declare namespace jest {
* @param fn The function for your test
* @param timeout The timeout for an async function test
*/
(name: string, fn: ProvidesCallback, timeout?: number): void;
(name: string, fn?: ProvidesCallback, timeout?: number): void;
/**
* Only runs this test in the current file.
*/
+16 -16
View File
@@ -365,22 +365,22 @@ export declare class LCD {
rows: number;
cols: number;
print(message: string): void;
useChar(char: string): void;
clear(): void;
cursor(row: number, col: number): void;
home(): void;
on(): void;
off(): void;
display(): void;
noDisplay(): void;
blink(): void;
noBlink(): void;
autoscroll(): void;
noAutoscroll(): void;
bgColor(color: any): void;
noBacklight(): void;
backlight(): void;
print(message: string): this;
useChar(char: string): this;
clear(): this;
cursor(row: number, col: number): this;
home(): this;
on(): this;
off(): this;
display(): this;
noDisplay(): this;
blink(): this;
noBlink(): this;
autoscroll(): this;
noAutoscroll(): this;
bgColor(color: any): this;
noBacklight(): this;
backlight(): this;
}
export interface LedOption {
+577
View File
@@ -0,0 +1,577 @@
// Type definitions for kdbxweb 1.2
// Project: https://github.com/keeweb/kdbxweb#readme
// Definitions by: Roang-zero1 <https://github.com/Roang-zero1>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export type KdbxObject = Entry | Group;
export type StringProtected = ProtectedValue | string;
export interface Settings {
binaries?: boolean;
customIcons?: boolean;
historyRules?: boolean;
}
export interface ObjectMap {
objects: KdbxObject[];
remote: KdbxObject[];
deleted: KdbxObject[];
}
export interface BinaryInforamtion {
ref: string;
value: ProtectedValue | ArrayBuffer;
}
export interface editingState {
added: [Date];
deleted: [Date];
}
export interface editingStateDict {
meta: editingState;
[uuid: string]: editingState;
}
export class Credentials {
constructor(
password: ProtectedValue,
keyFile: string | ArrayBuffer | Uint8Array
);
getHash(): Promise<ArrayBuffer>;
setKeyFile(keyFile: ArrayBuffer | Uint8Array | null): Promise<void>;
setPassword(password: ProtectedValue | null): Promise<void>;
static createKeyFileWithHash(hash: string): Uint8Array;
static createRandomKeyFile(): Uint8Array;
}
export class Int64 {
constructor(lo: number, hi: number);
lo: number;
hi: number;
valueOf(): number;
static from(value: number): Int64;
}
export class Kdbx {
constructor();
header: Header;
credentials: Credentials;
meta: Meta;
xml: Document;
binaries: Binaries;
groups: Group[];
deletedObjects: KdbxObject[];
addDeletedObject(uuid: KdbxUuid, dt: Date): void;
cleanup(settings: Settings): void;
createBinary(
value: ProtectedValue | ArrayBuffer
): Promise<ProtectedValue | ArrayBuffer>;
createDefaultGroup(): void;
createEntry(group: Group): Entry;
createGroup(group: Group, name: StringProtected): Group;
createRecycleBin(): void;
getDefaultGroup(): Group;
getGroup(uuid: KdbxUuid | string, parentGroup?: Group): Group | undefined;
getLocalEditState(): editingStateDict;
merge(remote: Kdbx): void;
move(object: KdbxObject, toGroup: Group, atIndex?: number): void;
remove(object: KdbxObject): void;
removeLocalEditState(): void;
save(): Promise<ArrayBuffer>;
saveXml(): Promise<string>;
setLocalEditState(editingState: editingStateDict): void;
upgrade(): void;
static create(credentials: Credentials, name: string): Kdbx;
static load(data: ArrayBuffer, credentials: Credentials): Promise<Kdbx>;
static loadXml(data: string, credentials: Credentials): Promise<Kdbx>;
}
export class KdbxError {
constructor(code: number, message: string);
name: "KdbxError";
code: number;
message: string;
// Native method; no parameter or return type inference available
toString(): string;
}
export class KdbxUuid {
constructor(ab: string | ArrayBuffer);
id: string | undefined;
empty: boolean;
equals(other: KdbxUuid): boolean;
toBytes(): Uint8Array | undefined;
toString(): string;
valueOf(): string | undefined;
static random(): KdbxUuid;
}
export class ProtectedValue {
constructor(value: ArrayBuffer, salt: ArrayBuffer);
clone(): ProtectedValue;
getBinary(): Uint8Array;
getHash(): Promise<ArrayBuffer>;
getText(): string;
includes(str: string): boolean;
setSalt(newSalt: ArrayBuffer): void;
toString(): string;
static fromBinary(binary: ArrayBuffer): ProtectedValue;
static fromString(str: string): ProtectedValue;
}
export class VarDictionary {
constructor();
get(key: string): object;
keys(): string[];
remove(key: string): void;
set(key: string, type: number, value: object): void;
write(stm: BinaryStream): void;
static ValueType: {
Bool: number;
Bytes: number;
Int32: number;
Int64: number;
String: number;
UInt32: number;
UInt64: number;
};
static read(stm: BinaryStream): VarDictionary;
}
export const Consts: {
AutoTypeObfuscationOptions: {
None: number;
UseClipboard: number;
};
CipherId: {
Aes: string;
ChaCha20: string;
};
CompressionAlgorithm: {
GZip: number;
None: number;
};
CrsAlgorithm: {
ArcFourVariant: number;
ChaCha20: number;
Null: number;
Salsa20: number;
};
Defaults: {
HistoryMaxItems: number;
HistoryMaxSize: number;
KeyEncryptionRounds: number;
MntncHistoryDays: number;
RecycleBinName: string;
};
ErrorCodes: {
BadSignature: string;
FileCorrupt: string;
InvalidArg: string;
InvalidKey: string;
InvalidVersion: string;
MergeError: string;
NotImplemented: string;
Unsupported: string;
};
Icons: {
Apple: number;
Archive: number;
BlackBerry: number;
Book: number;
CDRom: number;
Certificate: number;
Checked: number;
ClipboardReady: number;
Clock: number;
Configuration: number;
Console: number;
Digicam: number;
Disk: number;
Drive: number;
DriveWindows: number;
EMail: number;
EMailBox: number;
EMailSearch: number;
Energy: number;
EnergyCareful: number;
Expired: number;
Feather: number;
Folder: number;
FolderOpen: number;
FolderPackage: number;
Home: number;
Homebanking: number;
IRCommunication: number;
Identity: number;
Info: number;
Key: number;
List: number;
LockOpen: number;
MarkedDirectory: number;
Memory: number;
Money: number;
Monitor: number;
MultiKeys: number;
NetworkServer: number;
Note: number;
Notepad: number;
Package: number;
PaperFlag: number;
PaperLocked: number;
PaperNew: number;
PaperQ: number;
PaperReady: number;
Parts: number;
Pen: number;
Printer: number;
ProgramIcons: number;
Run: number;
Scanner: number;
Screen: number;
Settings: number;
Star: number;
TerminalEncrypted: number;
Thumbnail: number;
Tool: number;
TrashBin: number;
Tux: number;
UserCommunication: number;
UserKey: number;
Warning: number;
Wiki: number;
World: number;
WorldComputer: number;
WorldSocket: number;
WorldStar: number;
};
KdfId: {
Aes: string;
Argon2: string;
};
Signatures: {
FileMagic: number;
Sig2Kdb: number;
Sig2Kdbx: number;
};
};
export namespace ByteUtils {
function arrayBufferEquals(ab1: ArrayBuffer, ab2: ArrayBuffer): boolean;
function arrayToBuffer(arr: Uint8Array | ArrayBuffer): ArrayBuffer;
function base64ToBytes(str: string): Uint8Array;
function bytesToBase64(arr: Uint8Array | ArrayBuffer): string;
function bytesToHex(arr: Uint8Array | ArrayBuffer): string;
function bytesToString(arr: Uint8Array | ArrayBuffer): string;
function hexToBytes(hex: string): Uint8Array;
function stringToBytes(str: string): Uint8Array;
function zeroBuffer(buffer: Uint8Array | ArrayBuffer): void;
}
export namespace CryptoEngine {
const subtle: SubtleCrypto | null;
const webCrypto: Crypto | null;
const NodeCrypto: Crypto | null;
function argon2(
password: ArrayBuffer,
salt: ArrayBuffer,
memory: number,
iterations: number,
length: number,
parallelism: number,
type: number,
version: number
): Promise<ArrayBuffer>;
function chacha20(
data: ArrayBuffer,
key: ArrayBuffer,
iv: ArrayBuffer
): Promise<ArrayBuffer>;
function configure(
newSubtle: SubtleCrypto | null,
newWebCrypto: Crypto | null,
newNodeCrypto: Crypto | null
): void;
function createAesCbc(): any;
function hmacSha256(
key: ArrayBuffer,
data: ArrayBuffer
): Promise<ArrayBuffer>;
function random(len: number): Uint8Array;
function sha256(data: ArrayBuffer): Promise<ArrayBuffer>;
function sha512(data: ArrayBuffer): Promise<ArrayBuffer>;
}
export namespace Random {
function getBytes(len: number): Uint8Array;
}
export class BinaryStream {
constructor(arrayBuffer: ArrayBuffer);
getByteLength(): number;
getFloat32(littleEdian?: boolean): number;
getFloat64(littleEdian?: boolean): number;
getInt16(littleEdian?: boolean): number;
getInt32(littleEdian?: boolean): number;
getInt8(littleEdian?: boolean): number;
getPos(): number;
getUint16(littleEdian?: boolean): number;
getUint32(littleEdian?: boolean): number;
getUint64(littleEdian?: boolean): number;
getUint8(littleEdian?: boolean): number;
getWrittenBytes(): ArrayBuffer;
readBytes(size: number): ArrayBuffer;
readBytesNoAdvance(startPos: number, endPos: number): ArrayBuffer;
readBytesToEnd(): ArrayBuffer;
setFloat32(value: number, littleEdian?: boolean): void;
setFloat64(value: number, littleEdian?: boolean): void;
setInt16(value: number, littleEdian?: boolean): void;
setInt32(value: number, littleEdian?: boolean): void;
setInt8(value: number, littleEdian?: boolean): void;
setUint16(value: number, littleEdian?: boolean): void;
setUint32(value: number, littleEdian?: boolean): void;
setUint64(value: number, littleEdian?: boolean): void;
setUint8(value: number, littleEdian?: boolean): void;
writeBytes(bytes: ArrayBuffer | Uint8Array): void;
}
export class Binaries {
constructor();
hash(): Promise<any[]>;
getBinaryHash(
binary: ProtectedValue | ArrayBuffer | Uint8Array
): Promise<string>;
assignIds(): void;
add(value: ProtectedValue | ArrayBuffer): Promise<BinaryInforamtion>;
}
export class Context {
constructor(opts: Kdbx);
setXmlDate(node: Node, dt: Date): void;
}
export class Group {
constructor();
uuid: KdbxUuid;
name: StringProtected;
notes: StringProtected;
icon: number;
customIcon: KdbxUuid;
times: Times;
expanded: boolean;
defaultAutoTypeSeq: StringProtected;
enableAutoType: boolean;
enableSearching: boolean;
lastTopVisibleEntry: KdbxUuid;
groups: Group[];
entries: Entry[];
parentGroup: Group;
customData: {};
static create(name: StringProtected, parentGroup: Group): Group;
static read(xmlNode: Node, ctx: Context, parentGroup: Group): Group;
write(parentNode: Node, ctx: Context): void;
forEach(
callback: (
thisArg: (value: any) => void,
entry: Entry | undefined
) => void,
thisArg: (value: any) => void
): void;
merge(objectMap: ObjectMap): void;
copyFrom(group: Group): void;
}
export class Entry {
constructor();
uuid: KdbxUuid;
icon: number;
customIcon: KdbxUuid;
fgColor: StringProtected;
bgColor: StringProtected;
overrideUrl: StringProtected;
tags: string[];
times: Times;
fields: { [key: string]: StringProtected };
binaries: {};
autoType: {
enabled: boolean;
obfuscation: number;
defaultSequence: string;
items: {
windows: string;
keystrokeSequence: string;
};
};
history: Entry[];
parentGroup: Group;
customData: {};
static create(meta: Meta, parentGroup: Group): Entry;
static read(xmlNode: Node, ctx: Context, parentGroup: Group): Entry;
write(parentNode: Node, ctx: Context): void;
pushHistory(): void;
removeHistory(index: number, count: number): void;
copyFrom(entry: Entry): void;
merge(objectMap: ObjectMap): void;
}
export class Meta {
constructor();
static create(): Meta;
static read(xmlNode: Node, ctx: Context): Meta;
write(parentNode: Node, ctx: Context): void;
merge(remote: Meta, objectMap: ObjectMap): void;
}
export class Header {
constructor();
compression: number;
crsAlgorithm: number;
dataCipherUuid: KdbxUuid;
encryptionIV: any;
endPos: number;
kdfParameters: VarDictionary;
keyEncryptionRounds: number;
masterSeed: Uint8Array;
protectedStreamKey: any;
publicCustomData: any;
streamStartBytes: any;
transformSeed: any;
versionMajor: number;
versionMinor: number;
static read(stm: BinaryStream, ctx: Context): Header;
static create(): Header;
generateSalts(): void;
readInnerHeader(stm: BinaryStream, ctx: Context): void;
upgrade(): void;
write(stm: BinaryStream): void;
writeInnerHeader(stm: BinaryStream, ctx: Context): void;
}
export class Times {
constructor();
creationTime: Date;
lastModTime: Date;
lastAccessTime: Date;
expiryTime: Date;
expires: boolean;
usageCount: number;
locationChanged: Date;
static create(): Times;
static read(xmlNode: Node): Times;
clone(): Times;
update(): void;
write(parentNode: Node, ctx: Context): void;
}
+34
View File
@@ -0,0 +1,34 @@
import * as kdbxweb from "kdbxweb";
const dataarr = new ArrayBuffer(0);
const credentials = new kdbxweb.Credentials(
kdbxweb.ProtectedValue.fromString("demo"),
"nFWx&e5SzT"
);
kdbxweb.Kdbx.load(dataarr, credentials).then(db => db);
kdbxweb.Kdbx.loadXml("data", credentials).then(db => db);
const newDb = kdbxweb.Kdbx.create(credentials, "My new db");
const defaultGroup = newDb.getDefaultGroup();
const group = newDb.createGroup(defaultGroup, "subgroup");
const anotherGroup = newDb.createGroup(group, "subgroup-2");
const yetAnotherGroup = newDb.createGroup(group, "subgroup-3");
const deepGroup = defaultGroup.groups[0].groups[0];
if (newDb.getGroup(yetAnotherGroup.uuid)) {
newDb.remove(yetAnotherGroup);
}
const entry = newDb.createEntry(group);
newDb.move(entry, anotherGroup);
newDb.remove(entry);
newDb.save().then(dataAsArrayBuffer => dataAsArrayBuffer);
newDb.saveXml().then(xmlAsString => xmlAsString);
newDb.cleanup({
customIcons: true
});
newDb.upgrade();
@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
@@ -19,6 +19,6 @@
},
"files": [
"index.d.ts",
"vega-tests.ts"
"kdbxweb-tests.ts"
]
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+6 -4
View File
@@ -1,6 +1,8 @@
// Type definitions for koa-bodyparser 5.0
// Type definitions for koa-bodyparser 4.2
// Project: https://github.com/koajs/bodyparser
// Definitions by: Jerry Chin <https://github.com/hellopao>, Anup Kishore <https://github.com/anup-2s>
// Definitions by: Jerry Chin <https://github.com/hellopao>
// Anup Kishore <https://github.com/anup-2s>
// Hiroshi Ioka <https://github.com/hirochachacha>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -18,8 +20,8 @@ import * as Koa from "koa";
declare module "koa" {
interface Request {
body: {} | null | undefined;
rawBody: {} | null | undefined;
body: any;
rawBody: string;
}
}
@@ -7,6 +7,7 @@ app.use(bodyParser({ strict: false }));
app.use((ctx) => {
console.log(ctx.request.body);
console.log(ctx.request.body.ok);
console.log(ctx.request.rawBody);
});
+15
View File
@@ -1,6 +1,7 @@
// Type definitions for Mapbox 1.6
// Project: https://www.mapbox.com/mapbox.js/
// Definitions by: Maxime Fabre <https://github.com/anahkiasen>
// Florian Luccioni <https://github.com/Fluccioni>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -153,6 +154,20 @@ declare global {
getGeoJSON(): any;
}
// StyleLayer
//////////////////////////////////////////////////////////////////////
/**
* L.mapbox.styleLayer provides a way to integrate styles created with Mapbox Studio into your map.
*/
function styleLayer(url: string, options?: StyleLayerOptions): StyleLayer;
interface StyleLayerOptions extends Leaflet.TileLayerOptions {
sanitizer?(template: string): string;
}
type StyleLayer = Leaflet.TileLayer;
//////////////////////////////////////////////////////////////////////
////////////////////////////// GEOCODING /////////////////////////////
//////////////////////////////////////////////////////////////////////
+2
View File
@@ -4,6 +4,8 @@ const mapboxTiles = L.tileLayer('https://{s}.tiles.mapbox.com/v3/examples.map-i8
const map = L.map('map').addLayer(mapboxTiles).setView(new L.LatLng([42.3610, -71.0587]), 15);
const lightTiles = L.mapbox.styleLayer('mapbox://styles/mapbox/light-v9').addTo(map);
const coordinates = document.getElementById('coordinates');
const marker = L.marker(new L.LatLng([0, 0]), {
+8 -8
View File
@@ -371,19 +371,19 @@ Comments.find({ viewNumber: { $gt: 100 } });
Comments.find({ viewNumber: { $not: { $lt: 100, $gt: 1000 } } });
Comments.find({ tags: { $in: [ "tag-1", "tag-2", "tag-3" ] } });
Comments.find({ $or: [ { text: "hello" }, { text: "world" } ] });
Comments.find({ $or: [
{ text: "hello" },
{ text: "world", viewNumber: { $gt: 0 } }
Comments.find({ $or: [
{ text: "hello" },
{ text: "world", viewNumber: { $gt: 0 } }
], authorId: "test-author-id" });
Comments.find({ $and: [
{ $or: [{ authorId: "author-id-1" }, { authorId: "author-id-2" }] },
Comments.find({ $and: [
{ $or: [{ authorId: "author-id-1" }, { authorId: "author-id-2" }] },
{ $or: [{ tags: "tag-1" }, { tags: "tag-2" }] }
]});
Comments.find({ $query: {inlineLinks: { $exists: true, $type: "array" } } });
Comments.find({ inlineLinks: { $elemMatch: {
objectType: InlineObjectType.Image,
objectUrl: { $regex: "https://(www\.?)youtube\.com" }
Comments.find({ inlineLinks: { $elemMatch: {
objectType: InlineObjectType.Image,
objectUrl: { $regex: "https://(www\.?)youtube\.com" }
} } });
Comments.find({ "inlineLinks.objectType": InlineObjectType.Person });
Comments.find({ tags: "tag-1" });
+8 -8
View File
@@ -383,19 +383,19 @@ Comments.find({ viewNumber: { $gt: 100 } });
Comments.find({ viewNumber: { $not: { $lt: 100, $gt: 1000 } } });
Comments.find({ tags: { $in: [ "tag-1", "tag-2", "tag-3" ] } });
Comments.find({ $or: [ { text: "hello" }, { text: "world" } ] });
Comments.find({ $or: [
{ text: "hello" },
{ text: "world", viewNumber: { $gt: 0 } }
Comments.find({ $or: [
{ text: "hello" },
{ text: "world", viewNumber: { $gt: 0 } }
], authorId: "test-author-id" });
Comments.find({ $and: [
{ $or: [{ authorId: "author-id-1" }, { authorId: "author-id-2" }] },
Comments.find({ $and: [
{ $or: [{ authorId: "author-id-1" }, { authorId: "author-id-2" }] },
{ $or: [{ tags: "tag-1" }, { tags: "tag-2" }] }
]});
Comments.find({ $query: { inlineLinks: { $exists: true, $type: "array" } } });
Comments.find({ inlineLinks: { $elemMatch: {
objectType: InlineObjectType.Image,
objectUrl: { $regex: "https://(www\.?)youtube\.com" }
Comments.find({ inlineLinks: { $elemMatch: {
objectType: InlineObjectType.Image,
objectUrl: { $regex: "https://(www\.?)youtube\.com" }
} } });
Comments.find({ "inlineLinks.objectType": InlineObjectType.Person });
Comments.find({ tags: "tag-1" });
+435 -144
View File
@@ -79,7 +79,7 @@ export interface ClientSession extends EventEmitter {
/** The server id associated with this session */
id: any;
/**
* Aborts the currently active transaction in this session.
* Aborts the currently active transaction in this session.
* @param {MongoCallback<void>} [cb] Optional callback for completion of this operation
*/
abortTransaction(cb?: MongoCallback<void>): Promise<void>;
@@ -89,7 +89,7 @@ export interface ClientSession extends EventEmitter {
*/
advanceOperationTime(operamtionTime: Timestamp): void;
/**
* Commits the currently active transaction in this session.
* Commits the currently active transaction in this session.
* @param {MongoCallback<void>} [cb] Optional callback for completion of this operation
*/
commitTransaction(cb?: MongoCallback<void>): Promise<void>;
@@ -110,7 +110,7 @@ export interface ClientSession extends EventEmitter {
* Used to determine if this session equals another
*
* @param {ClientSession} session A class representing a client session on the server
* @returns {boolean} if the sessions are equal
* @returns {boolean} if the sessions are equal
*/
equals(session: ClientSession): boolean;
@@ -118,13 +118,13 @@ export interface ClientSession extends EventEmitter {
incrementTransactionNumber(): void;
/**
* @returns {boolean} this session is currently in a transaction or not
* @returns {boolean} this session is currently in a transaction or not
*/
inTransaction(): boolean;
/**
* Starts a new transaction with the given options.
* @param {TransactionOptions} options
* @param {TransactionOptions} options
* @memberof ClientSession
*/
startTransaction(options?: TransactionOptions): void;
@@ -219,10 +219,10 @@ export class MongoError extends Error {
* client/user (eg. "Email address must be unique" instead of "Both email
* address and username must be unique") - which caters for a better (app)
* user experience.
*
*
* Details: https://github.com/Automattic/mongoose/issues/2129 (issue for
* mongoose, but the same applies for the native mongodb driver)
*
*
* Note that in mongoose (the link above) the prop in question is called
* 'message' while in mongodb it is called 'errmsg'. This can be seen in
* multiple places in the source code, for example here:
@@ -231,6 +231,7 @@ export class MongoError extends Error {
errmsg?: string;
}
/** http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#.connect */
export interface MongoClientOptions extends
DbCreateOptions,
@@ -240,57 +241,120 @@ export interface MongoClientOptions extends
SocketOptions,
SSLOptions,
HighAvailabilityOptions {
// The logging level (error/warn/info/debug)
/**
* The logging level (error/warn/info/debug)
*/
loggerLevel?: string;
// Custom logger object
logger?: Object;
// Default: false;
/**
* Custom logger object
*/
logger?: Object | log;
/**
* Validate MongoClient passed in options for correctness.
* Default: false
*/
validateOptions?: Object;
// The name of the application that created this MongoClient instance.
/**
* The name of the application that created this MongoClient instance.
*/
appname?: string;
/**
* Authentifikation credentials
*/
auth?: {
/**
* The username for auth
*/
user: string;
/**
* The password for auth
*/
password: string;
},
// Determines whether or not to use the new url parser
useNewUrlParser?: boolean
};
/**
* Determines whether or not to use the new url parser
*/
useNewUrlParser?: boolean;
/**
* Mechanism for authentication: DEFAULT, GSSAPI, PLAIN, MONGODB-X509, 'MONGODB-CR', SCRAM-SHA-1 or SCRAM-SHA-256
*/
authMechanism?: 'DEFAULT' | 'GSSAPI' | 'PLAIN' | 'MONGODB-X509' | 'MONGODB-CR' | 'SCRAM-SHA-1' | 'SCRAM-SHA-256' | string;
}
export interface SSLOptions {
// Passed directly through to tls.createSecureContext. See https://nodejs.org/dist/latest-v9.x/docs/api/tls.html#tls_tls_createsecurecontext_options for more info.
/**
* Passed directly through to tls.createSecureContext. See https://nodejs.org/dist/latest-v9.x/docs/api/tls.html#tls_tls_createsecurecontext_options for more info.
*/
ciphers?: string;
// Passed directly through to tls.createSecureContext. See https://nodejs.org/dist/latest-v9.x/docs/api/tls.html#tls_tls_createsecurecontext_options for more info.
/**
* Passed directly through to tls.createSecureContext. See https://nodejs.org/dist/latest-v9.x/docs/api/tls.html#tls_tls_createsecurecontext_options for more info.
*/
ecdhCurve?: string;
// Default:5; Number of connections for each server instance
/**
* Default:5; Number of connections for each server instance
*/
poolSize?: number;
// If present, the connection pool will be initialized with minSize connections, and will never dip below minSize connections
/**
* If present, the connection pool will be initialized with minSize connections, and will never dip below minSize connections
*/
minSize?: number;
// Use ssl connection (needs to have a mongod server with ssl support)
/**
* Use ssl connection (needs to have a mongod server with ssl support)
*/
ssl?: boolean;
// Default: true; Validate mongod server certificate against ca (mongod server >=2.4 with ssl support required)
/**
* Default: true; Validate mongod server certificate against ca (mongod server >=2.4 with ssl support required)
*/
sslValidate?: boolean;
// Default: true; Server identity checking during SSL
/**
* Default: true; Server identity checking during SSL
*/
checkServerIdentity?: boolean | Function;
// Array of valid certificates either as Buffers or Strings
/**
* Array of valid certificates either as Buffers or Strings
*/
sslCA?: Array<Buffer | string>;
// SSL Certificate revocation list binary buffer
/**
* SSL Certificate revocation list binary buffer
*/
sslCRL?: Array<Buffer | string>;
// SSL Certificate binary buffer
/**
* SSL Certificate binary buffer
*/
sslCert?: Buffer | string;
// SSL Key file binary buffer
/**
* SSL Key file binary buffer
*/
sslKey?: Buffer | string;
// SSL Certificate pass phrase
/**
* SSL Certificate pass phrase
*/
sslPass?: Buffer | string;
// String containing the server name requested via TLS SNI.
/**
* String containing the server name requested via TLS SNI.
*/
servername?: string;
}
export interface HighAvailabilityOptions {
// Default: true; Turn on high availability monitoring.
/**
* Default: true; Turn on high availability monitoring.
*/
ha?: boolean;
// Default: 10000; The High availability period for replicaset inquiry
/**
* Default: 10000; The High availability period for replicaset inquiry
*/
haInterval?: number;
// Default: false;
/**
* Default: false;
*/
domainsEnabled?: boolean;
}
@@ -299,7 +363,12 @@ export class ReadPreference {
constructor(mode: string, tags: Object);
mode: string;
tags: any;
options: { maxStalenessSeconds?: number }; // Max Secondary Read Stalleness in Seconds
options: {
/**
* Max Secondary Read Stalleness in Seconds
*/
maxStalenessSeconds?: number
};
static PRIMARY: string;
static PRIMARY_PREFERRED: string;
static SECONDARY: string;
@@ -311,86 +380,156 @@ export class ReadPreference {
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html */
export interface DbCreateOptions extends CommonOptions {
// If the database authentication is dependent on another databaseName.
/**
* If the database authentication is dependent on another databaseName.
*/
authSource?: string;
// Default: false; Force server to create _id fields instead of client.
/**
* Default: false; Force server to create _id fields instead of client.
*/
forceServerObjectId?: boolean;
// Default: false; Use c++ bson parser.
/**
* Default: false; Use c++ bson parser.
*/
native_parser?: boolean;
// Serialize functions on any object.
/**
* Serialize functions on any object.
*/
serializeFunctions?: boolean;
// Specify if the BSON serializer should ignore undefined fields.
/**
* Specify if the BSON serializer should ignore undefined fields.
*/
ignoreUndefined?: boolean;
// Return document results as raw BSON buffers.
/**
* Return document results as raw BSON buffers.
*/
raw?: boolean;
// Default: true; Promotes Long values to number if they fit inside the 53 bits resolution.
/**
* Default: true; Promotes Long values to number if they fit inside the 53 bits resolution.
*/
promoteLongs?: boolean;
// Default: false; Promotes Binary BSON values to native Node Buffers
/**
* Default: false; Promotes Binary BSON values to native Node Buffers
*/
promoteBuffers?: boolean;
// the prefered read preference. use 'ReadPreference' class.
/**
* the prefered read preference. use 'ReadPreference' class.
*/
readPreference?: ReadPreference | string;
// Default: true; Promotes BSON values to native types where possible, set to false to only receive wrapper types.
/**
* Default: true; Promotes BSON values to native types where possible, set to false to only receive wrapper types.
*/
promoteValues?: Object;
// Custom primary key factory to generate _id values (see Custom primary keys).
/**
* Custom primary key factory to generate _id values (see Custom primary keys).
*/
pkFactory?: Object;
// ES6 compatible promise constructor
/**
* ES6 compatible promise constructor
*/
promiseLibrary?: Object;
/** https://docs.mongodb.com/manual/reference/read-concern/#read-concern */
/**
* https://docs.mongodb.com/manual/reference/read-concern/#read-concern
**/
readConcern?: ReadConcern;
// Sets a cap on how many operations the driver will buffer up before giving up on getting a
// working connection, default is -1 which is unlimited.
/**
* Sets a cap on how many operations the driver will buffer up before giving up on getting a
* working connection, default is -1 which is unlimited.
*/
bufferMaxEntries?: number;
}
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Server.html */
export interface SocketOptions {
// Reconnect on error. default:false
/**
* Reconnect on error. default:false
*/
autoReconnect?: boolean;
// TCP Socket NoDelay option. default:true
/**
* TCP Socket NoDelay option. default:true
*/
noDelay?: boolean;
// TCP KeepAlive enabled on the socket. default:true
/**
* TCP KeepAlive enabled on the socket. default:true
*/
keepAlive?: boolean;
// TCP KeepAlive initial delay before sending first keep-alive packet when idle. default:300000
/**
* TCP KeepAlive initial delay before sending first keep-alive packet when idle. default:300000
*/
keepAliveInitialDelay?: number;
// TCP Connection timeout setting. default 0
/**
* TCP Connection timeout setting. default 0
*/
connectTimeoutMS?: number;
// Version of IP stack. Can be 4, 6 or null. default: null.
// If null, will attempt to connect with IPv6, and will fall back to IPv4 on failure
// refer to http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html
/**
* Version of IP stack. Can be 4, 6 or null. default: null.
*
* If null, will attempt to connect with IPv6, and will fall back to IPv4 on failure
* refer to http://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html
*/
family?: 4 | 6 | null;
// TCP Socket timeout setting. default 0
/**
* TCP Socket timeout setting. default 0
*/
socketTimeoutMS?: number;
}
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Server.html */
export interface ServerOptions extends SSLOptions {
// Default: 30;
/**
* Default: 30;
*/
reconnectTries?: number;
// Default: 1000;
/**
* Default: 1000;
*/
reconnectInterval?: number;
// Default: true;
/**
* Default: true;
*/
monitoring?: boolean
/**
* Socket Options
*/
socketOptions?: SocketOptions;
// Default: 10000; The High availability period for replicaset inquiry
/**
* Default: 10000; The High availability period for replicaset inquiry
*/
haInterval?: number;
// Default: false;
/**
* Default: false;
*/
domainsEnabled?: boolean;
}
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Mongos.html */
export interface MongosOptions extends SSLOptions, HighAvailabilityOptions {
// Default: 15; Cutoff latency point in MS for MongoS proxy selection
/**
* Default: 15; Cutoff latency point in MS for MongoS proxy selection
*/
acceptableLatencyMS?: number;
/**
* Socket Options
*/
socketOptions?: SocketOptions;
}
/** http://mongodb.github.io/node-mongodb-native/3.1/api/ReplSet.html */
export interface ReplSetOptions extends SSLOptions, HighAvailabilityOptions {
// The max staleness to secondary reads (values under 10 seconds cannot be guaranteed);
/**
* The max staleness to secondary reads (values under 10 seconds cannot be guaranteed);
*/
maxStalenessSeconds?: number;
// The name of the replicaset to connect to.
/**
* The name of the replicaset to connect to.
*/
replicaSet?: string;
// Default: 15 ; Range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms)
/**
* Default: 15 ; Range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms)
*/
secondaryAcceptableLatencyMS?: number;
connectWithNoPrimary?: boolean;
socketOptions?: SocketOptions;
@@ -482,28 +621,40 @@ export interface CommonOptions extends WriteConcern {
session?: ClientSession;
}
// Deprecated http://mongodb.github.io/node-mongodb-native/3.1/api/Server.html
/**
* @deprecated
* @see http://mongodb.github.io/node-mongodb-native/3.1/api/Server.html
*/
export class Server extends EventEmitter {
constructor(host: string, port: number, options?: ServerOptions);
connections(): Array<any>;
}
// Deprecated http://mongodb.github.io/node-mongodb-native/3.1/api/ReplSet.html
/**
* @deprecated
* @see http://mongodb.github.io/node-mongodb-native/3.1/api/ReplSet.html
*/
export class ReplSet extends EventEmitter {
constructor(servers: Array<Server>, options?: ReplSetOptions);
connections(): Array<any>;
}
// Deprecated http://mongodb.github.io/node-mongodb-native/3.1/api/ReplSet.html
/**
* @deprecated
* @see http://mongodb.github.io/node-mongodb-native/3.1/api/Mongos.html
*/
export class Mongos extends EventEmitter {
constructor(servers: Array<Server>, options?: MongosOptions);
connections(): Array<any>;
}
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#addUser */
/**
* @deprecated
* @see http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#addUser
*/
export interface DbAddUserOptions extends CommonOptions {
customData?: Object;
roles?: Object[];
@@ -543,27 +694,48 @@ export interface DbCollectionOptions extends CommonOptions {
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Db.html#createIndex */
export interface IndexOptions extends CommonOptions {
// Creates an unique index.
/**
* Creates an unique index.
*/
unique?: boolean;
// Creates a sparse index.
/**
* Creates a sparse index.
*/
sparse?: boolean;
// Creates the index in the background, yielding whenever possible.
/**
* Creates the index in the background, yielding whenever possible.
*/
background?: boolean;
// A unique index cannot be created on a key that has pre-existing duplicate values.
// If you would like to create the index anyway, keeping the first document the database indexes and
// deleting all subsequent documents that have duplicate value
/**
* A unique index cannot be created on a key that has pre-existing duplicate values.
*
* If you would like to create the index anyway, keeping the first document the database indexes and
* deleting all subsequent documents that have duplicate value
*/
dropDups?: boolean;
// For geo spatial indexes set the lower bound for the co-ordinates.
/**
* For geo spatial indexes set the lower bound for the co-ordinates.
*/
min?: number;
// For geo spatial indexes set the high bound for the co-ordinates.
/**
* For geo spatial indexes set the high bound for the co-ordinates.
*/
max?: number;
// Specify the format version of the indexes.
/**
* Specify the format version of the indexes.
*/
v?: number;
// Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher)
/**
* Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher)
*/
expireAfterSeconds?: number;
// Override the auto generated index name (useful if the resulting name is larger than 128 bytes)
/**
* Override the auto generated index name (useful if the resulting name is larger than 128 bytes)
*/
name?: string;
// Creates a partial index based on the given filter object (MongoDB 3.2 or higher)
/**
* Creates a partial index based on the given filter object (MongoDB 3.2 or higher)
*/
partialFilterExpression?: any;
collation?: Object;
default_language?: string
@@ -619,17 +791,27 @@ export interface FSyncOptions extends CommonOptions {
fsync?: boolean
}
// Documentation : http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html */
export interface Collection<TSchema = Default> {
// Get the collection name.
/**
* Get the collection name.
*/
collectionName: string;
// Get the full collection namespace.
/**
* Get the full collection namespace.
*/
namespace: string;
// The current write concern values.
/**
* The current write concern values.
*/
writeConcern: any;
// The current read concern values.
/**
* The current read concern values.
*/
readConcern: ReadConcern;
// Get current index hint for collection.
/**
* Get current index hint for collection.
*/
hint: any;
/** http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#aggregate */
aggregate<T = TSchema>(callback: MongoCallback<AggregationCursor<T>>): AggregationCursor<T>;
@@ -880,40 +1062,70 @@ export type FilterQuery<T> = {
[P in keyof T]?: T[P] | Condition<T, P>;
} | { [key: string]: any };
// Documentation: http://docs.mongodb.org/manual/reference/command/collStats/
/** http://docs.mongodb.org/manual/reference/command/collStats/ */
export interface CollStats {
// Namespace.
/**
* Namespace.
*/
ns: string;
// Number of documents.
/**
* Number of documents.
*/
count: number;
// Collection size in bytes.
/**
* Collection size in bytes.
*/
size: number;
// Average object size in bytes.
/**
* Average object size in bytes.
*/
avgObjSize: number;
// (Pre)allocated space for the collection in bytes.
/**
* (Pre)allocated space for the collection in bytes.
*/
storageSize: number;
// Number of extents (contiguously allocated chunks of datafile space).
/**
* Number of extents (contiguously allocated chunks of datafile space).
*/
numExtents: number;
// Number of indexes.
/**
* Number of indexes.
*/
nindexes: number;
// Size of the most recently created extent in bytes.
/**
* Size of the most recently created extent in bytes.
*/
lastExtentSize: number;
// Padding can speed up updates if documents grow.
/**
* Padding can speed up updates if documents grow.
*/
paddingFactor: number;
// A number that indicates the user-set flags on the collection. userFlags only appears when using the mmapv1 storage engine.
/**
* A number that indicates the user-set flags on the collection. userFlags only appears when using the mmapv1 storage engine.
*/
userFlags?: number;
// Total index size in bytes.
/**
* Total index size in bytes.
*/
totalIndexSize: number;
// Size of specific indexes in bytes.
/**
* Size of specific indexes in bytes.
*/
indexSizes: {
_id_: number;
[index: string]: number;
};
// `true` if the collection is capped.
/**
* `true` if the collection is capped.
*/
capped: boolean;
// The maximum number of documents that may be present in a capped collection.
/**
* The maximum number of documents that may be present in a capped collection.
*/
max: number;
// The maximum size of a capped collection.
/**
* The maximum size of a capped collection.
*/
maxSize: number;
wiredTiger?: WiredTigerData;
indexDetails?: any;
@@ -1059,18 +1271,28 @@ export interface WiredTigerData {
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#aggregate */
export interface CollectionAggregationOptions {
readPreference?: ReadPreference | string;
// Return the query as cursor, on 2.6 > it returns as a real cursor
// on pre 2.6 it returns as an emulated cursor.
/**
* Return the query as cursor, on 2.6 > it returns as a real cursor
* on pre 2.6 it returns as an emulated cursor.
*/
cursor?: { batchSize?: number };
// Explain returns the aggregation execution plan (requires mongodb 2.6 >).
/**
* Explain returns the aggregation execution plan (requires mongodb 2.6 >).
*/
explain?: boolean;
// lets the server know if it can use disk to store
// temporary results for the aggregation (requires mongodb 2.6 >).
/**
* Lets the server know if it can use disk to store
* temporary results for the aggregation (requires mongodb 2.6 >).
*/
allowDiskUse?: boolean;
// specifies a cumulative time limit in milliseconds for processing operations
// on the cursor. MongoDB interrupts the operation at the earliest following interrupt point.
/**
* specifies a cumulative time limit in milliseconds for processing operations
* on the cursor. MongoDB interrupts the operation at the earliest following interrupt point.
*/
maxTimeMS?: number;
// Allow driver to bypass schema validation in MongoDB 3.2 or higher.
/**
* Allow driver to bypass schema validation in MongoDB 3.2 or higher.
*/
bypassDocumentValidation?: boolean;
raw?: boolean;
promoteLongs?: boolean;
@@ -1084,23 +1306,37 @@ export interface CollectionAggregationOptions {
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#insertMany */
export interface CollectionInsertManyOptions extends CommonOptions {
// Serialize functions on any object.
/**
* Serialize functions on any object.
*/
serializeFunctions?: boolean;
//Force server to assign _id values instead of driver.
/**
* Force server to assign _id values instead of driver.
*/
forceServerObjectId?: boolean;
// Allow driver to bypass schema validation in MongoDB 3.2 or higher.
/**
* Allow driver to bypass schema validation in MongoDB 3.2 or higher.
*/
bypassDocumentValidation?: boolean;
// If true, when an insert fails, don't execute the remaining writes. If false, continue with remaining inserts when one fails.
/**
* If true, when an insert fails, don't execute the remaining writes. If false, continue with remaining inserts when one fails.
*/
ordered?: boolean;
}
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#bulkWrite */
export interface CollectionBulkWriteOptions extends CommonOptions {
// Serialize functions on any object.
/**
* Serialize functions on any object.
*/
serializeFunctions?: boolean;
// Execute write operation in ordered or unordered fashion.
/**
* Execute write operation in ordered or unordered fashion.
*/
ordered?: boolean;
// Allow driver to bypass schema validation in MongoDB 3.2 or higher.
/**
* Allow driver to bypass schema validation in MongoDB 3.2 or higher.
*/
bypassDocumentValidation?: boolean;
//Force server to assign _id values instead of driver.
forceServerObjectId?: boolean;
@@ -1120,13 +1356,21 @@ export interface BulkWriteOpResultObject {
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#count */
export interface MongoCountPreferences {
// The limit of documents to count.
/**
* The limit of documents to count.
*/
limit?: number;
// The number of documents to skip for the count.
/**
* The number of documents to skip for the count.
*/
skip?: boolean;
// An index name hint for the query.
/**
* An index name hint for the query.
*/
hint?: string;
// The preferred read preference
/**
* The preferred read preference
*/
readPreference?: ReadPreference | string;
maxTimeMS?: number;
session?: ClientSession;
@@ -1292,7 +1536,10 @@ export interface FindOneOptions {
limit?: number;
sort?: Array<any> | Object;
projection?: Object;
fields?: Object; // Deprecated Use options.projection instead
/**
* @deprecated Use options.projection instead
*/
fields?: Object;
skip?: number;
hint?: Object;
explain?: boolean;
@@ -1328,7 +1575,9 @@ export interface InsertWriteOpResult {
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#insertOne */
export interface CollectionInsertOneOptions extends CommonOptions {
// Serialize functions on any object.
/**
* Serialize functions on any object.
*/
serializeFunctions?: boolean;
//Force server to assign _id values instead of driver.
forceServerObjectId?: boolean;
@@ -1683,17 +1932,29 @@ export class GridFSBucketWriteStream extends Writable {
/** https://mongodb.github.io/node-mongodb-native/3.1/api/GridFSBucketWriteStream.html */
export interface GridFSBucketWriteStreamOptions {
/** Custom file id for the GridFS file. */
/**
* Custom file id for the GridFS file.
**/
id?: GridFSBucketWriteStreamId,
/** The chunk size to use, in bytes */
/**
* The chunk size to use, in bytes
*/
chunkSizeBytes?: number,
/** The write concern */
/**
* The write concern
*/
w?: number,
/** The write concern timeout */
/**
* The write concern timeout
*/
wtimeout?: number,
/** The journal write concern */
/**
* The journal write concern
*/
j?: number
/** Default false; If true, disables adding an md5 field to file data */
/**
* Default false; If true, disables adding an md5 field to file data
*/
disableMD5?: boolean
}
@@ -1732,8 +1993,14 @@ export interface ChangeStreamOptions {
type GridFSBucketWriteStreamId = string | number | Object | ObjectID;
export interface LoggerOptions {
loggerLevel?: string // Custom logger function
logger?: log // Override default global log level.
/**
* Custom logger function
*/
loggerLevel?: string
/**
* Override default global log level.
*/
logger?: log
}
export type log = (message?: string, state?: LoggerState) => void
@@ -1749,30 +2016,54 @@ export interface LoggerState {
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Logger.html */
export class Logger {
constructor(className: string, options?: LoggerOptions)
// Log a message at the debug level
/**
* Log a message at the debug level
*/
debug(message: string, state: LoggerState): void
// Log a message at the warn level
/**
* Log a message at the warn level
*/
warn(message: string, state: LoggerState): void
// Log a message at the info level
/**
* Log a message at the info level
*/
info(message: string, state: LoggerState): void
// Log a message at the error level
/**
* Log a message at the error level
*/
error(message: string, state: LoggerState): void
// Is the logger set at info level
/**
* Is the logger set at info level
*/
isInfo(): boolean
// Is the logger set at error level
/**
* Is the logger set at error level
*/
isError(): boolean
// Is the logger set at error level
/**
* Is the logger set at error level
*/
isWarn(): boolean
// Is the logger set at debug level
/**
* Is the logger set at debug level
*/
isDebug(): boolean
// Resets the logger to default settings, error and no filtered classes
/**
* Resets the logger to default settings, error and no filtered classes
*/
static reset(): void
// Get the current logger function
/**
* Get the current logger function
*/
static currentLogger(): log
//Set the current logger function
static setCurrentLogger(log: log): void
// Set what classes to log.
/**
* Set what classes to log.
*/
static filter(type: string, values: string[]): void
// Set the current log level
/**
* Set the current log level
*/
static setLevel(level: string): void
}
+8 -5
View File
@@ -7,6 +7,7 @@ const connectionString = 'mongodb://127.0.0.1:27017/test';
var format = require('util').format;
let options: mongodb.MongoClientOptions = {
authSource: ' ',
loggerLevel: 'debug',
w: 1,
wtimeout: 300,
j: true,
@@ -21,7 +22,6 @@ let options: mongodb.MongoClientOptions = {
reconnectTries: 123456,
reconnectInterval: 123456,
ssl: true,
sslValidate: false,
checkServerIdentity: function () { },
@@ -31,12 +31,14 @@ let options: mongodb.MongoClientOptions = {
sslKey: new Buffer(999),
sslPass: new Buffer(999),
promoteBuffers: false,
useNewUrlParser: false
useNewUrlParser: false,
authMechanism: 'SCRAM-SHA-1',
forceServerObjectId: false
}
MongoClient.connect(connectionString, options, function (err: mongodb.MongoError, client: mongodb.MongoClient) {
if (err) throw err;
const db = client.db('test');
var collection = db.collection('test_insert');
collection.insertOne({ a: 2 }, function (err: mongodb.MongoError, docs: any) {
@@ -263,11 +265,11 @@ async function transfer(client: mongodb.MongoClient, from: any, to: any, amount:
// `session.abortTransaction()` will undo the above `findOneAndUpdate()`
throw new Error('Insufficient funds: ' + (A.balance + amount));
}
const B = await db.collection('Account').
findOneAndUpdate({ name: to }, { $inc: { balance: amount } }, opts).
then(res => res.value);
await session.commitTransaction();
session.endSession();
return { from: A, to: B };
@@ -287,3 +289,4 @@ mongodb.connect(connectionString).then((client) => {
);
});
+2 -2
View File
@@ -811,11 +811,11 @@ declare module "mongoose" {
* @param fn callback
*/
post<T extends Document>(method: string, fn: (
error: mongodb.MongoError, doc: T, next: (err?: NativeError) => void
doc: T, next: (err?: NativeError) => void
) => void): this;
post<T extends Document>(method: string, fn: (
doc: T, next: (err?: NativeError) => void
error: mongodb.MongoError, doc: T, next: (err?: NativeError) => void
) => void): this;
/**
+2 -2
View File
@@ -491,12 +491,12 @@ preHookTestSchemaArr.push(
);
schema
.post('save', function (error, doc, next) {
.post('save', function (error: mongoose.Error, doc: mongoose.Document, next: (err?: mongoose.NativeError) => void) {
error.stack;
doc.model;
next.apply;
})
.post('save', function (doc: mongoose.Document, next: Function) {
.post('save', function (doc: mongoose.Document, next: (err?: mongoose.NativeError) => void) {
doc.model;
next(new Error());
})
+1
View File
@@ -316,6 +316,7 @@ export declare class PreparedStatement extends events.EventEmitter {
public parameters: IRequestParameters;
public stream: any;
public constructor(connection?: ConnectionPool);
public constructor(transaction: Transaction);
public input(name: string, type: (() => ISqlType) | ISqlType): PreparedStatement;
public output(name: string, type: (() => ISqlType) | ISqlType): PreparedStatement;
public prepare(statement?: string): Promise<void>;
+10
View File
@@ -189,6 +189,16 @@ function test_request_constructor() {
var request4 = new sql.Request();
}
function test_prepared_statement_constructor() {
// Request can be constructed with a connection, preparedStatment, transaction or no arguments
var connection: sql.ConnectionPool = new sql.ConnectionPool(config);
var preparedStatment = new sql.PreparedStatement(connection);
var transaction = new sql.Transaction(connection);
var preparedSatement1 = new sql.PreparedStatement(connection);
var preparedSatement2 = new sql.PreparedStatement(transaction);
}
function test_classes_extend_eventemitter() {
var connection: sql.ConnectionPool = new sql.ConnectionPool(config);
var transaction = new sql.Transaction();
+6 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for newman 3.10
// Type definitions for newman 3.11
// Project: https://github.com/postmanlabs/newman
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
// Graham McGregor <https://github.com/Graham42>
@@ -168,9 +168,12 @@ export interface NewmanRunExecutionAssertion {
error: NewmanRunExecutionAssertionError;
}
export interface NewmanRunExecutionAssertionError {
name: string;
index: number;
test: string;
message: string;
}
export interface NewmanRunFailure {
stack: string;
}export interface NewmanRunFailure {
error: NewmanRunExecutionAssertionError;
/** The event where the failure occurred */
at: string;
+1 -1
View File
@@ -12,7 +12,7 @@ declare namespace ngeohash {
type GeographicBoundingBox = [number, number, number, number];
type NSEW = [number, number];
function encode(latitude: number, longitude: number, precision?: number): string;
function encode(latitude: number | string, longitude: number | string, precision?: number): string;
function decode(hashstring: string): GeographicPoint;
function decode_bbox(hashstring: string): GeographicBoundingBox;
function bboxes(minlat: number, minlon: number, maxlat: number, maxlon: number, precision?: number): Array<string>;
+1
View File
@@ -1,6 +1,7 @@
import geohash = require('ngeohash');
console.log(geohash.encode(37.8324, 112.5584));
console.log(geohash.encode('37.8324', '112.5584'));
// prints ww8p1r4t8
var latlon = geohash.decode('ww8p1r4t8');
+2
View File
@@ -30,6 +30,8 @@ export declare function removeListener(event: "scanStop", listener: () => void):
export declare function removeListener(event: "discover", listener: (peripheral: Peripheral) => void): events.EventEmitter;
export declare function removeListener(event: string, listener: Function): events.EventEmitter;
export declare function removeAllListeners(event?: string): events.EventEmitter;
export declare var state:string;
export declare class Peripheral extends events.EventEmitter {
+6
View File
@@ -35,6 +35,12 @@ noble.removeListener("discover", (peripheral: noble.Peripheral): void => {
peripheral.disconnect((): void => {});
});
noble.removeAllListeners("stateChange");
noble.removeAllListeners("scanStart");
noble.removeAllListeners("scanStop");
noble.removeAllListeners("discover");
noble.removeAllListeners();
var peripheral: noble.Peripheral = new noble.Peripheral();
peripheral.uuid = "12ad4e81";
peripheral.advertisement = {
+86 -44
View File
@@ -7,6 +7,7 @@
// Beeno Tung <https://github.com/beenotung>
// Joe Flateau <https://github.com/joeflateau>
// Nikita Koryabkin <https://github.com/Apologiz>
// timhwang21 <https://github.com/timhwang21>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -20,6 +21,15 @@ declare module "node-forge" {
type Utf8 = string;
type OID = string;
namespace jsbn {
class BigInteger {
data: number[];
t: number;
s: number;
toString(): string;
}
}
namespace pem {
interface EncodeOptions {
@@ -40,28 +50,18 @@ declare module "node-forge" {
}
namespace pki {
type PEM = string;
type Key = any;
type PublicKey = rsa.PublicKey | ed25519.Key;
type PrivateKey = rsa.PrivateKey | ed25519.Key;
interface KeyPair {
publicKey: PublicKey;
privateKey: PrivateKey;
}
interface PublicKey {
encrypt(data: string, scheme?: string, schemeOptions?: number): Bytes
verify(digest: string, signature: string, scheme?: string): boolean
}
interface PrivateKey {
decrypt(data: string, scheme?: string, schemeOptions?: number): string
sign(md: string, scheme?: string): Bytes
}
function pemToDer(pem: PEM): util.ByteStringBuffer;
function privateKeyToPem(key: PrivateKey, maxline?: number): PEM;
function privateKeyInfoToPem(key: PrivateKey, maxline?: number): PEM;
function privateKeyInfoToPem(key: Bytes, maxline?: number): PEM;
function publicKeyToPem(key: PublicKey, maxline?: number): PEM;
function publicKeyFromPem(pem: PEM): PublicKey;
function privateKeyFromPem(pem: PEM): PrivateKey;
@@ -73,7 +73,38 @@ declare module "node-forge" {
}
var oids: oids;
namespace ed25519 {
type Key = ArrayBuffer;
}
namespace rsa {
type EncryptionScheme = 'RSAES-PKCS1-V1_5' | 'RSA-OAEP' | 'RAW' | 'NONE' | null;
type SignatureScheme = 'RSASSA-PKCS1-V1_5' | pss.PSS | 'NONE' | null;
interface PublicKey {
n: jsbn.BigInteger;
e: jsbn.BigInteger;
encrypt(data: Bytes, scheme?: EncryptionScheme, schemeOptions?: any): Bytes;
verify(digest: Bytes, signature: Bytes, scheme?: SignatureScheme): boolean;
}
interface PrivateKey {
n: jsbn.BigInteger;
e: jsbn.BigInteger;
d: jsbn.BigInteger;
p: jsbn.BigInteger;
q: jsbn.BigInteger;
dP: jsbn.BigInteger;
dQ: jsbn.BigInteger;
qInv: jsbn.BigInteger;
decrypt(data: Bytes, scheme?: EncryptionScheme, schemeOptions?: any): Bytes;
sign(md: md.MessageDigest, scheme?: SignatureScheme): Bytes;
}
interface KeyPair {
publicKey: PublicKey;
privateKey: PrivateKey;
}
interface GenerateKeyPairOptions {
bits?: number;
@@ -84,9 +115,9 @@ declare module "node-forge" {
prng?: any;
algorithm?: string;
}
function setPublicKey(n: any, e: any): any;
function generateKeyPair(bits?: number, e?: number, callback?: (err: Error, keypair: KeyPair) => void): KeyPair;
function generateKeyPair(options?: GenerateKeyPairOptions, callback?: (err: Error, keypair: KeyPair) => void): KeyPair;
}
@@ -160,8 +191,8 @@ declare module "node-forge" {
hash: any;
};
extensions: any[];
privateKey: Key;
publicKey: Key;
privateKey: PrivateKey;
publicKey: PublicKey;
md: any;
/**
* Sets the subject of this certificate.
@@ -200,7 +231,7 @@ declare module "node-forge" {
* @param key the private key to sign with.
* @param md the message digest object to use (defaults to forge.md.sha1).
*/
sign(key: pki.Key, md: md.MessageDigest): void;
sign(key: pki.PrivateKey, md?: md.MessageDigest): void;
/**
* Attempts verify the signature on the passed certificate using this
* certificate's public key.
@@ -215,19 +246,30 @@ declare module "node-forge" {
function certificateFromAsn1(obj: asn1.Asn1, computeHash?: boolean): Certificate;
function decryptRsaPrivateKey(pem: PEM, passphrase?: string): Key;
function decryptRsaPrivateKey(pem: PEM, passphrase?: string): PrivateKey;
function createCertificate(): Certificate;
function certificationRequestToPem(cert: Certificate, maxline?: number): PEM;
function certificationRequestFromPem(pem: PEM, computeHash?: boolean, strict?: boolean): Certificate;
function createCertificationRequest(): Certificate;
function publicKeyToAsn1(publicKey: Key): any;
function publicKeyToRSAPublicKey(publicKey: Key): any;
function publicKeyToAsn1(publicKey: PublicKey): any;
function publicKeyToRSAPublicKey(publicKey: PublicKey): any;
}
namespace random {
function getBytes(count: number, callback?: (bytes: Bytes) => any): Bytes;
function getBytesSync(count: number): Bytes;
type CB = (_: any, seed: string) => void;
interface Random {
seedFileSync: (needed: number) => string;
seedFile: (needed: number, cb: CB) => void;
}
function createInstance(): Random;
}
namespace ssh {
@@ -249,22 +291,22 @@ declare module "node-forge" {
/**
* @description Encodes a private RSA key as an OpenSSH file
*/
function privateKeyToOpenSSH(privateKey: pki.Key, passphrase?: string): string;
function privateKeyToOpenSSH(privateKey: pki.PrivateKey, passphrase?: string): string;
/**
* @description Encodes (and optionally encrypts) a private RSA key as a Putty PPK file
*/
function privateKeyToPutty(privateKey: pki.Key, passphrase?: string, comment?: string): string;
function privateKeyToPutty(privateKey: pki.PrivateKey, passphrase?: string, comment?: string): string;
/**
* @description Encodes a public RSA key as an OpenSSH file
*/
function publicKeyToOpenSSH(publicKey: pki.Key, comment?: string): string | pki.PEM;
function publicKeyToOpenSSH(publicKey: pki.PublicKey, comment?: string): string | pki.PEM;
/**
* @description Gets the SSH fingerprint for the given public key
*/
function getPublicKeyFingerprint(publicKey: pki.Key, options?: FingerprintOptions): util.ByteStringBuffer | Hex | string;
function getPublicKeyFingerprint(publicKey: pki.PublicKey, options?: FingerprintOptions): util.ByteStringBuffer | Hex | string;
}
namespace asn1 {
@@ -377,7 +419,7 @@ declare module "node-forge" {
function decodeUtf8(encoded: Utf8): string;
function createBuffer(): ByteBuffer;
function createBuffer(input: string, encode: string): ByteBuffer;
function createBuffer(input: Bytes | ArrayBuffer | ArrayBufferView | ByteStringBuffer, encode: string): ByteBuffer;
namespace binary {
namespace raw {
@@ -418,7 +460,7 @@ declare module "node-forge" {
interface Bag {
type: string;
attributes: any;
key?: pki.Key;
key?: pki.PrivateKey;
cert?: pki.Certificate;
asn1: asn1.Asn1
}
@@ -441,12 +483,12 @@ declare module "node-forge" {
function pkcs12FromAsn1(obj: any, strict?: boolean, password?: string): Pkcs12Pfx;
function pkcs12FromAsn1(obj: any, password?: string): Pkcs12Pfx;
}
namespace pkcs7 {
interface PkcsSignedData {
content?: string | util.ByteBuffer;
contentInfo?: { value: any[] };
addCertificate(certificate: pki.Certificate): void;
addSigner(options: {
key: string;
@@ -459,14 +501,16 @@ declare module "node-forge" {
}): void;
toAsn1(): asn1.Asn1;
}
function createSignedData(): PkcsSignedData;
}
namespace md {
type Encoding = "raw" | "utf8"
interface MessageDigest {
update(msg: string, encoding?: string): MessageDigest;
update(msg: string, encoding?: Encoding): MessageDigest;
digest(): util.ByteStringBuffer;
}
@@ -477,7 +521,7 @@ declare module "node-forge" {
namespace sha256 {
function create(): MessageDigest;
}
namespace sha512 {
function create(): MessageDigest;
}
@@ -513,18 +557,16 @@ declare module "node-forge" {
tag: util.ByteStringBuffer;
}
}
namespace pss {
function create(any: any): any;
type PSS = any;
function create(any: any): PSS;
}
namespace mgf {
namespace mgf1 {
function create(any: any): any;
}
}
namespace random {
function getBytesSync(length: number): Bytes;
}
}
+17 -3
View File
@@ -8,9 +8,7 @@ let x: string = forge.ssh.privateKeyToOpenSSH(key);
let pemKey: forge.pki.PEM = publicKeyPem;
let publicKeyRsa = forge.pki.publicKeyFromPem(pemKey);
let privateKeyRsa = forge.pki.privateKeyFromPem(privateKeyPem);
let privateKeyRsa2 = forge.pki.privateKeyInfoToPem(privateKeyRsa);
let byteBufferString = forge.pki.pemToDer(privateKeyPem);
let certPem = forge.pki.certificateFromPem(pemKey);
let cert = forge.pki.createCertificate();
{
@@ -118,6 +116,7 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin
}
{
let key = forge.random.getBytesSync(24)
let payload = { asd: 'asd' };
let cipher = forge.cipher.createCipher('3DES-ECB', forge.util.createBuffer(key, 'raw'));
cipher.start();
@@ -133,7 +132,7 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin
let decrypted = decipher.output as forge.util.ByteStringBuffer;
let content = JSON.parse(forge.util.encodeUtf8(decrypted.getBytes()));
if (content.asd == payload.asd) throw Error('forge.cipher.createCipher failed');
if (content.asd !== payload.asd) throw Error('forge.cipher.createCipher failed');
}
{
@@ -189,3 +188,18 @@ if (forge.util.fillString('1', 5) !== '11111') throw Error('forge.util.fillStrin
// self-sign certificate
cert.sign(keypair.privateKey, forge.md.sha256.create());
}
{
let md: forge.md.MessageDigest;
let hex: string;
let signature: forge.Bytes
md = forge.md.sha256.create();
md = md.update('Test');
hex = md.digest().toHex();
signature = keypair.privateKey.sign(md)
if (!keypair.publicKey.verify(md.digest().bytes(), signature)) {
throw Error("rsa signature verification fail");
}
}
+3 -1
View File
@@ -2501,7 +2501,9 @@ declare module "readline" {
}
declare module "vm" {
interface Context { }
interface Context {
[key: string]: any;
}
interface BaseOptions {
/**
* Specifies the filename used in stack traces produced by this script.
+6
View File
@@ -3677,6 +3677,12 @@ import * as p from "process";
function test() {
throw new repl.Recoverable(new Error("test"));
}
_server.context['key0'] = 1;
_server.context['key1'] = "";
_server.context['key2'] = true;
_server.context['key3'] = [];
_server.context['key4'] = {};
}
}
+3 -1
View File
@@ -2390,7 +2390,9 @@ declare module "readline" {
}
declare module "vm" {
export interface Context { }
export interface Context {
[key: string]: any;
}
export interface ScriptOptions {
filename?: string;
lineOffset?: number;
+57 -1
View File
@@ -2,7 +2,8 @@
// Project: https://github.com/oauthjs/node-oauth2-server
// Definitions by: Robbie Van Gorkom <https://github.com/vangorra>,
// Charles Irick <https://github.com/cirick>,
// Daniel Fischer <https://github.com/d-fischer>
// Daniel Fischer <https://github.com/d-fischer>,
// Vitor Santos <https://github.com/rvitorsantos>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -112,6 +113,56 @@ declare namespace OAuth2Server {
redirect(url: string): void;
}
abstract class AbstractGrantType {
/**
* Instantiates AbstractGrantType using the supplied options.
*
*/
constructor(options: TokenOptions)
/**
* Generate access token. Calls Model#generateAccessToken() if implemented.
*
*/
generateAccessToken(client: Client, user: User, scope: string | string[]): Promise<string>;
/**
* Generate refresh token. Calls Model#generateRefreshToken() if implemented.
*
*/
generateRefreshToken(client: Client, user: User, scope: string | string[]): Promise<string>;
/**
* Get access token expiration date.
*
*/
getAccessTokenExpiresAt(): Date;
/**
* Get refresh token expiration date.
*
*/
getRefreshTokenExpiresAt(): Date;
/**
* Get scope from the request body.
*
*/
getScope(request: Request): string;
/**
* Validate requested scope. Calls Model#validateScope() if implemented.
*
*/
validateScope(user: User, client: Client, scope: string | string[]): Promise<string | string[] | Falsey>;
/**
* Retrieve info from the request and client and return token
*
*/
abstract handle(request: Request, client: Client): Promise<Token | Falsey>;
}
interface ServerOptions extends AuthenticateOptions, AuthorizeOptions, TokenOptions {
/**
* Model object
@@ -183,6 +234,11 @@ declare namespace OAuth2Server {
* Always revoke the used refresh token and issue a new one for the refresh_token grant.
*/
alwaysIssueNewRefreshToken?: boolean;
/**
* Additional supported grant types.
*/
extendedGrantTypes?: { [key: string]: typeof AbstractGrantType };
}
/**
+41 -40
View File
@@ -21758,18 +21758,19 @@ declare namespace Excel {
interface BasicDataValidation {
/**
*
* Gets or sets the Formula1, i.e. minimum value or value depending of the operator.
When setting the value, it can be passed in as a number, a range object, or a string formula (where the string is either a stringified number, a cell reference like "=A1", or a formula like "=MIN(A1, B1)").
When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc.
* Specifies the right-hand operand when the operator property is set to a binary operator such as GreaterThan (the left-hand operand is the value the user tries to enter in the cell). With the ternary operators Between and NotBetween, specifies the lower bound operand.
* For example, setting formula1 to 10 and operator to GreaterThan means that valid data for the range must be greater than 10.
* When setting the value, it can be passed in as a number, a range object, or a string formula (where the string is either a stringified number, a cell reference like "=A1", or a formula like "=MIN(A1, B1)").
* When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc.
*
* [Api set: ExcelApi 1.8]
*/
formula1: string | number | Range;
/**
*
* Gets or sets the Formula2, i.e. maximum value or value depending of the operator.
When setting the value, it can be passed in as a number, a range object, or a string formula (where the string is either a stringified number, a cell reference like "=A1", or a formula like "=MIN(A1, B1)").
When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc.
* With the ternary operators Between and NotBetween, specifies the upper bound operand. Is not used with the binary operators, such as GreaterThan.
* When setting the value, it can be passed in as a number, a range object, or a string formula (where the string is either a stringified number, a cell reference like "=A1", or a formula like "=MIN(A1, B1)").
* When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc.
*
* [Api set: ExcelApi 1.8]
*/
@@ -21791,18 +21792,18 @@ declare namespace Excel {
interface DateTimeDataValidation {
/**
*
* Gets or sets the Formula1, i.e. minimum value or value depending of the operator.
When setting the value, it can be passed in as a Date, a Range object, or a string formula (where the string is either a stringified date/time in ISO8601 format, a cell reference like "=A1", or a formula like "=MIN(A1, B1)").
When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc.
* Specifies the right-hand operand when the operator property is set to a binary operator such as GreaterThan (the left-hand operand is the value the user tries to enter in the cell). With the ternary operators Between and NotBetween, specifies the lower bound operand.
* When setting the value, it can be passed in as a Date, a Range object, or a string formula (where the string is either a stringified date/time in ISO8601 format, a cell reference like "=A1", or a formula like "=MIN(A1, B1)").
* When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc.
*
* [Api set: ExcelApi 1.8]
*/
formula1: string | Date | Range;
/**
*
* Gets or sets the Formula2, i.e. maximum value or value depending of the operator.
When setting the value, it can be passed in as a Date, a Range object, or a string (where the string is either a stringified date/time in ISO8601 format, a cell reference like "=A1", or a formula like "=MIN(A1, B1)").
When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc.
* With the ternary operators Between and NotBetween, specifies the upper bound operand. Is not used with the binary operators, such as GreaterThan.
* When setting the value, it can be passed in as a Date, a Range object, or a string (where the string is either a stringified date/time in ISO8601 format, a cell reference like "=A1", or a formula like "=MIN(A1, B1)").
* When retrieving the value, it will always be returned as a string formula, for example: "=10", "=A1", "=SUM(A1:B5)", etc.
*
* [Api set: ExcelApi 1.8]
*/
@@ -50829,7 +50830,7 @@ declare namespace Word {
getRange(rangeLocation?: "Whole" | "Start" | "End" | "Before" | "After" | "Content"): Word.Range;
/**
*
* Inserts a break at the specified location in the main document. The insertLocation value can be 'Before' or 'After'.
* Inserts a break at the specified location in the main document.
*
* [Api set: WordApi 1.2]
*
@@ -50839,7 +50840,7 @@ declare namespace Word {
insertBreak(breakType: Word.BreakType, insertLocation: Word.InsertLocation): void;
/**
*
* Inserts a break at the specified location in the main document. The insertLocation value can be 'Before' or 'After'.
* Inserts a break at the specified location in the main document.
*
* [Api set: WordApi 1.2]
*
@@ -50856,7 +50857,7 @@ declare namespace Word {
insertContentControl(): Word.ContentControl;
/**
*
* Inserts a document at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts a document at the specified location.
*
* [Api set: WordApi 1.2]
*
@@ -50866,7 +50867,7 @@ declare namespace Word {
insertFileFromBase64(base64File: string, insertLocation: Word.InsertLocation): Word.Range;
/**
*
* Inserts a document at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts a document at the specified location.
*
* [Api set: WordApi 1.2]
*
@@ -50876,7 +50877,7 @@ declare namespace Word {
insertFileFromBase64(base64File: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range;
/**
*
* Inserts HTML at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts HTML at the specified location.
*
* [Api set: WordApi 1.2]
*
@@ -50886,7 +50887,7 @@ declare namespace Word {
insertHtml(html: string, insertLocation: Word.InsertLocation): Word.Range;
/**
*
* Inserts HTML at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts HTML at the specified location.
*
* [Api set: WordApi 1.2]
*
@@ -50916,7 +50917,7 @@ declare namespace Word {
insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.InlinePicture;
/**
*
* Inserts OOXML at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts OOXML at the specified location.
*
* [Api set: WordApi 1.2]
*
@@ -50926,7 +50927,7 @@ declare namespace Word {
insertOoxml(ooxml: string, insertLocation: Word.InsertLocation): Word.Range;
/**
*
* Inserts OOXML at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts OOXML at the specified location.
*
* [Api set: WordApi 1.2]
*
@@ -50936,7 +50937,7 @@ declare namespace Word {
insertOoxml(ooxml: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range;
/**
*
* Inserts a paragraph at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts a paragraph at the specified location.
*
* [Api set: WordApi 1.2]
*
@@ -50946,7 +50947,7 @@ declare namespace Word {
insertParagraph(paragraphText: string, insertLocation: Word.InsertLocation): Word.Paragraph;
/**
*
* Inserts a paragraph at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts a paragraph at the specified location.
*
* [Api set: WordApi 1.2]
*
@@ -50956,7 +50957,7 @@ declare namespace Word {
insertParagraph(paragraphText: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Paragraph;
/**
*
* Inserts text at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts text at the specified location.
*
* [Api set: WordApi 1.2]
*
@@ -50966,7 +50967,7 @@ declare namespace Word {
insertText(text: string, insertLocation: Word.InsertLocation): Word.Range;
/**
*
* Inserts text at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts text at the specified location.
*
* [Api set: WordApi 1.2]
*
@@ -51777,7 +51778,7 @@ declare namespace Word {
getTextRanges(endingMarks: string[], trimSpacing?: boolean): Word.RangeCollection;
/**
*
* Inserts a break at the specified location in the main document. The insertLocation value can be 'Before' or 'After'.
* Inserts a break at the specified location in the main document.
*
* [Api set: WordApi 1.1]
*
@@ -51787,7 +51788,7 @@ declare namespace Word {
insertBreak(breakType: Word.BreakType, insertLocation: Word.InsertLocation): void;
/**
*
* Inserts a break at the specified location in the main document. The insertLocation value can be 'Before' or 'After'.
* Inserts a break at the specified location in the main document.
*
* [Api set: WordApi 1.1]
*
@@ -51884,7 +51885,7 @@ declare namespace Word {
insertOoxml(ooxml: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range;
/**
*
* Inserts a paragraph at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts a paragraph at the specified location.
*
* [Api set: WordApi 1.1]
*
@@ -51894,7 +51895,7 @@ declare namespace Word {
insertParagraph(paragraphText: string, insertLocation: Word.InsertLocation): Word.Paragraph;
/**
*
* Inserts a paragraph at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts a paragraph at the specified location.
*
* [Api set: WordApi 1.1]
*
@@ -51904,7 +51905,7 @@ declare namespace Word {
insertParagraph(paragraphText: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Paragraph;
/**
*
* Inserts a table with the specified number of rows and columns. The insertLocation value can be 'Before' or 'After'.
* Inserts a table with the specified number of rows and columns.
*
* [Api set: WordApi 1.3]
*
@@ -51916,7 +51917,7 @@ declare namespace Word {
insertTable(rowCount: number, columnCount: number, insertLocation: Word.InsertLocation, values?: string[][]): Word.Table;
/**
*
* Inserts a table with the specified number of rows and columns. The insertLocation value can be 'Before' or 'After'.
* Inserts a table with the specified number of rows and columns.
*
* [Api set: WordApi 1.3]
*
@@ -52355,7 +52356,7 @@ declare namespace Word {
getTextRanges(endingMarks: string[], trimSpacing?: boolean): Word.RangeCollection;
/**
*
* Inserts a break at the specified location in the main document. The insertLocation value can be 'Before' or 'After'.
* Inserts a break at the specified location in the main document.
*
* [Api set: WordApi 1.1]
*
@@ -52365,7 +52366,7 @@ declare namespace Word {
insertBreak(breakType: Word.BreakType, insertLocation: Word.InsertLocation): void;
/**
*
* Inserts a break at the specified location in the main document. The insertLocation value can be 'Before' or 'After'.
* Inserts a break at the specified location in the main document.
*
* [Api set: WordApi 1.1]
*
@@ -52462,7 +52463,7 @@ declare namespace Word {
insertOoxml(ooxml: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range;
/**
*
* Inserts a paragraph at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts a paragraph at the specified location.
*
* [Api set: WordApi 1.1]
*
@@ -52472,7 +52473,7 @@ declare namespace Word {
insertParagraph(paragraphText: string, insertLocation: Word.InsertLocation): Word.Paragraph;
/**
*
* Inserts a paragraph at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts a paragraph at the specified location.
*
* [Api set: WordApi 1.1]
*
@@ -52482,7 +52483,7 @@ declare namespace Word {
insertParagraph(paragraphText: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Paragraph;
/**
*
* Inserts a table with the specified number of rows and columns. The insertLocation value can be 'Before' or 'After'.
* Inserts a table with the specified number of rows and columns.
*
* [Api set: WordApi 1.3]
*
@@ -52494,7 +52495,7 @@ declare namespace Word {
insertTable(rowCount: number, columnCount: number, insertLocation: Word.InsertLocation, values?: string[][]): Word.Table;
/**
*
* Inserts a table with the specified number of rows and columns. The insertLocation value can be 'Before' or 'After'.
* Inserts a table with the specified number of rows and columns.
*
* [Api set: WordApi 1.3]
*
@@ -53357,7 +53358,7 @@ declare namespace Word {
insertContentControl(): Word.ContentControl;
/**
*
* Inserts a paragraph at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts a paragraph at the specified location.
*
* [Api set: WordApi 1.3]
*
@@ -53367,7 +53368,7 @@ declare namespace Word {
insertParagraph(paragraphText: string, insertLocation: Word.InsertLocation): Word.Paragraph;
/**
*
* Inserts a paragraph at the specified location. The insertLocation value can be 'Before' or 'After'.
* Inserts a paragraph at the specified location.
*
* [Api set: WordApi 1.3]
*
@@ -53377,7 +53378,7 @@ declare namespace Word {
insertParagraph(paragraphText: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Paragraph;
/**
*
* Inserts a table with the specified number of rows and columns. The insertLocation value can be 'Before' or 'After'.
* Inserts a table with the specified number of rows and columns.
*
* [Api set: WordApi 1.3]
*
@@ -53389,7 +53390,7 @@ declare namespace Word {
insertTable(rowCount: number, columnCount: number, insertLocation: Word.InsertLocation, values?: string[][]): Word.Table;
/**
*
* Inserts a table with the specified number of rows and columns. The insertLocation value can be 'Before' or 'After'.
* Inserts a table with the specified number of rows and columns.
*
* [Api set: WordApi 1.3]
*
+3 -3
View File
@@ -303,7 +303,7 @@ import VectorTile from 'ol/vectortile';
import View from 'ol/view';
// Map
const map: ol.Map = new Map(<any> {});
const map: ol.Map = new Map({} as any);
declare const mapView: View;
declare const layerBase: LayerBase;
declare const control: ControlControl;
@@ -320,6 +320,6 @@ declare const size: ol.Size;
declare const position: ol.Pixel;
view = map.getView();
view.getProjection();
view.animate(<any> {});
view.calculateExtent(<any> 'size');
view.animate({} as any);
view.calculateExtent('size' as any);
view.centerOn(coordinate, size, position);
+1
View File
@@ -12494,6 +12494,7 @@ export namespace olx {
renderer?: (ol.RendererType | Array<(ol.RendererType | string)> | string);
target?: (Element | string);
view?: ol.View;
moveTolerance?: number;
}
/**
+1 -1
View File
@@ -175,7 +175,7 @@ loadingStrategy = ol.loadingstrategy.tile(tilegrid);
// ol.geom.Circle
//
booleanValue = circle.intersectsExtent(extent);
circle = <ol.geom.Circle> circle.transform(projectionLike, projectionLike);
circle = circle.transform(projectionLike, projectionLike) as ol.geom.Circle;
//
//
+3 -3
View File
@@ -1491,7 +1491,7 @@ declare module paper {
/**
* The color of the stroke.
*/
strokeColor: Color | string;
strokeColor: Color | string | null;
/**
* The width of the stroke.
@@ -1539,7 +1539,7 @@ declare module paper {
/**
* The fill color of the item.
*/
fillColor: Color | string;
fillColor: Color | string | null;
/**
* The fill-rule with which the shape gets filled. Please note that only modern browsers support fill-rules other than 'nonzero'.
@@ -1551,7 +1551,7 @@ declare module paper {
/**
* The shadow color.
*/
shadowColor: Color | string;
shadowColor: Color | string | null;
/**
* The shadow’s blur radius.
+24 -7
View File
@@ -5,6 +5,7 @@
// Christian Rackerseder <https://github.com/screendriver>
// GP <https://github.com/paambaati>
// Alex Ferrando <https://github.com/alferpal>
// Oleksandr Sidko <https://github.com/mortiy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -243,13 +244,12 @@ declare namespace P {
interface PrettyOptions {
/**
* If set to true, it will only covert the unix timestamp to ISO 8601 date format, and reserialize the JSON (equivalent to pino -t).
* Translate the epoch time value into a human readable date and time string.
* This flag also can set the format string to apply when translating the date to human readable format.
* The default format is yyyy-mm-dd HH:MM:ss.l o in UTC.
* For a list of available pattern letters see the {@link https://www.npmjs.com/package/dateformat|dateformat documentation}.
*/
timeTransOnly?: boolean;
/**
* A custom function to format the line, is passed the JSON object as an argument and should return a string value.
*/
formatter?(log: LogDescriptor): string;
translateTime?: boolean | string;
/**
* If set to true, it will print the name of the log level as the first field in the log line. Default: `false`.
*/
@@ -261,7 +261,24 @@ declare namespace P {
/**
* If set to true, will add color information to the formatted output message. Default: `false`.
*/
forceColor?: boolean;
colorize?: boolean;
/**
* Appends carriage return and line feed, instead of just a line feed, to the formatted log line.
*/
crlf?: boolean;
/**
* Define the log keys that are associated with error like objects. Default: ["err", "error"]
*/
errorLikeObjectKeys?: string[];
/**
* When formatting an error object, display this list of properties.
* The list should be a comma separated list of properties. Default: ''
*/
errorProps?: string;
/**
* Specify a search pattern according to {@link http://jmespath.org|jmespath}
*/
search?: string;
}
type Level = 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
+13
View File
@@ -123,3 +123,16 @@ anotherRedacted.info({
msg: 'another logged with redacted properties',
anotherPath: 'Not shown'
});
const pretty = pino({
prettyPrint: {
colorize: true,
crlf: false,
errorLikeObjectKeys: ['err', 'error'],
errorProps: '',
levelFirst: false,
messageKey: 'msg',
translateTime: 'UTC:h:MM:ss TT Z',
search: 'foo == `bar`'
}
});
+1 -1
View File
@@ -256,7 +256,7 @@ export function clearConfigCache(): void;
export interface SupportLanguage {
name: string;
since?: string;
parsers: string[];
parsers: BuiltInParserName[] | string[];
group?: string;
tmScope: string;
aceMode: string;
+1 -1
View File
@@ -1715,7 +1715,7 @@ export interface Page extends EventEmitter, FrameBase {
}
export interface TargetAwaiter {
waitForTarget(predicate: (target: Target) => boolean, options: Timeoutable): Promise<void>;
waitForTarget(predicate: (target: Target) => boolean, options?: Timeoutable): Promise<Target>;
}
/** A Browser is created when Puppeteer connects to a Chromium instance, either through puppeteer.launch or puppeteer.connect. */
+1 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for qhistory 1.0
// Project: https://github.com/pshrmn/qhistory#readme
// Definitions by: Diogo Franco <https://github.com/Kovensky>
// Definitions by: Jessica Franco <https://github.com/Kovensky>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
+2 -2
View File
@@ -160,11 +160,11 @@ declare namespace TestUtils {
root: Component<any>,
tagName: string): Element;
export function scryRenderedComponentsWithType<T extends Component<{}>, C extends ComponentClass<{}>>(
export function scryRenderedComponentsWithType<T extends Component<any>, C extends ComponentClass<any>>(
root: Component<any>,
type: ClassType<any, T, C>): T[];
export function findRenderedComponentWithType<T extends Component<{}>, C extends ComponentClass<{}>>(
export function findRenderedComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
root: Component<any>,
type: ClassType<any, T, C>): T;
+2 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for react-datepicker 1.1
// Type definitions for react-datepicker 1.8
// Project: https://github.com/Hacker0x01/react-datepicker
// Definitions by: Rajab Shakirov <https://github.com/radziksh>,
// Andrey Balokha <https://github.com/andrewBalekha>,
@@ -7,6 +7,7 @@
// Roy Xue <https://github.com/royxue>
// Koala Human <https://github.com/KoalaHuman>
// Sean Kelley <https://github.com/seansfkelley>
// Justin Grant <https://github.com/justingrant>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
+1 -1
View File
@@ -7,7 +7,7 @@ import * as ReactTestUtils from 'react-dom/test-utils';
declare function describe(desc: string, f: () => void): void;
declare function it(desc: string, f: () => void): void;
class TestComponent extends React.Component { }
class TestComponent extends React.Component<{x: string}> { }
describe('ReactDOM', () => {
it('render', () => {
+7 -1
View File
@@ -1,4 +1,10 @@
/// <reference types="node" />
// forward declarations
declare global {
namespace NodeJS {
// tslint:disable-next-line:no-empty-interface
interface ReadableStream {}
}
}
import { ReactElement } from 'react';
+9 -5
View File
@@ -59,7 +59,7 @@ export interface SyntheticEventData extends OptionalEventProperties {
export type EventSimulator = (element: Element | Component<any>, eventData?: SyntheticEventData) => void;
export interface MockedComponentClass {
new (props: {}): any;
new (props: any): any;
}
export interface ShallowRenderer {
@@ -160,8 +160,12 @@ export function renderIntoDocument<T extends Element>(
element: DOMElement<any, T>): T;
export function renderIntoDocument(
element: SFCElement<any>): void;
export function renderIntoDocument<T extends Component<any>>(
element: CElement<any, T>): T;
// If we replace `P` with `any` in this overload, then some tests fail because
// calls to `renderIntoDocument` choose the last overload on the
// subtype-relation pass and get an undesirably broad return type. Using `P`
// allows this overload to match on the subtype-relation pass.
export function renderIntoDocument<P, T extends Component<P>>(
element: CElement<P, T>): T;
export function renderIntoDocument<P>(
element: ReactElement<P>): Component<P> | Element | void;
@@ -257,7 +261,7 @@ export function findRenderedDOMComponentWithTag(
/**
* Finds all instances of components with type equal to `componentClass`.
*/
export function scryRenderedComponentsWithType<T extends Component, C extends ComponentClass>(
export function scryRenderedComponentsWithType<T extends Component<any>, C extends ComponentClass<any>>(
root: Component<any>,
type: ClassType<any, T, C>): T[];
@@ -266,7 +270,7 @@ export function scryRenderedComponentsWithType<T extends Component, C extends Co
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
*/
export function findRenderedComponentWithType<T extends Component, C extends ComponentClass>(
export function findRenderedComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
root: Component<any>,
type: ClassType<any, T, C>): T;
+1 -1
View File
@@ -15,7 +15,7 @@
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
+4
View File
@@ -9,6 +9,7 @@
// Krister Kari <https://github.com/kristerkari>
// Martin Raedlinger <https://github.com/formatlos>
// Kanitkorn Sujautra <https://github.com/lukyth>
// obedm503 <https://github.com/obedm503>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -46,6 +47,7 @@ declare namespace ReactIntl {
messages: React.Requireable<any>;
defaultLocale: React.Requireable<any>;
defaultFormats: React.Requireable<any>;
onError: React.Requireable<any>;
}
interface IntlFormat {
@@ -78,6 +80,7 @@ declare namespace ReactIntl {
defaultLocale: string;
defaultFormats: any;
now(): number;
onError(error: string): void;
}
interface InjectedIntlProps {
@@ -197,6 +200,7 @@ declare namespace ReactIntl {
defaultFormats?: any;
textComponent?: any;
initialNow?: any;
onError?: (error: string) => void;
}
}
+9 -1
View File
@@ -401,7 +401,15 @@ class TestApp extends React.Component {
hello: "Hello, {name}!"
};
return (
<IntlProvider locale="en" formats={{}} messages={messages} defaultLocale="en" defaultFormats={messages} timeZone="UTC">
<IntlProvider
locale="en"
formats={{}}
messages={messages}
defaultLocale="en"
defaultFormats={messages}
timeZone="UTC"
onError={(error: string) => console.error(error)}
>
<SomeComponentWithIntl className="just-for-test" />
<SomeFunctionalComponentWithIntl className="another-one" />
</IntlProvider>
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for react-leaflet-markercluster 2.0
// Project: https://github.com/YUzhva/react-leaflet-markercluster
// Definitions by: Adam Binford <https://github.com/Kimahriman>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
/// <reference types="leaflet.markercluster" />
import * as Leaflet from 'leaflet';
import * as ReactLeaflet from 'react-leaflet';
export type MarkerClusterGroupProps = ReactLeaflet.MapLayerProps & Leaflet.MarkerClusterGroupOptions;
export default class MarkerClusterGroup<P extends MarkerClusterGroupProps = MarkerClusterGroupProps> extends ReactLeaflet.MapLayer<P> { }
@@ -0,0 +1,30 @@
import * as React from 'react';
import * as Leaflet from 'leaflet';
import MarkerClusterGroup from 'react-leaflet-markercluster';
const MarkerCluster = (
<MarkerClusterGroup
showCoverageOnHover
zoomToBoundsOnClick
spiderfyOnMaxZoom
removeOutsideVisibleBounds
animate
animateAddingMarkers
singleMarkerMode
chunkedLoading
chunkDelay={ 500 }
disableClusteringAtZoom={ 4 }
maxClusterRadius={ 0 }
spiderfyDistanceMultiplier={ 2 }
polygonOptions={ {
stroke: true,
color: 'blue',
opacity: 0.5
} }
spiderLegPolylineOptions={ {
stroke: true,
color: 'blue',
opacity: 0.5
} }
iconCreateFunction={ cluster => Leaflet.divIcon({ html: `<b>${cluster.getChildCount()}</b>` }) }/>
);
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"jsx": "react",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-leaflet-markercluster-tests.tsx"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

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