Merge branch 'master' of github.com:DefinitelyTyped/DefinitelyTyped into chrome-updates

This commit is contained in:
Nikolai Ommundsen
2018-08-28 16:54:42 +02:00
60 changed files with 1702 additions and 340 deletions
+5 -1
View File
@@ -1,10 +1,14 @@
import Agenda = require("agenda");
import { Db, Server } from "mongodb";
import { Db, Server, MongoClient } from "mongodb";
var mongoConnectionString = "mongodb://127.0.0.1/agenda";
(async () => {
var agenda = new Agenda({ db: { address: mongoConnectionString } });
var agenda = new Agenda({
mongo: (await MongoClient.connect(mongoConnectionString)).db(),
db: { collection: 'agenda-jobs' },
});
agenda.define<{ foo: Error }>('delete old users', (job, done) => {
done(job.attrs.data.foo)
+5 -12
View File
@@ -203,17 +203,7 @@ declare namespace Agenda {
/**
* Specifies that Agenda should be initialized using and existing MongoDB connection.
*/
mongo?: {
/**
* The MongoDB database connection to use.
*/
db: Db;
/**
* The name of the collection to use.
*/
collection?: string;
}
mongo?: Db;
/**
* Specifies that Agenda should connect to MongoDB.
@@ -221,8 +211,10 @@ declare namespace Agenda {
db?: {
/**
* The connection URL.
* Required when using `db` option to connect.
* Not required when an existing connection is passed as `mongo` property.
*/
address: string;
address?: string;
/**
* The name of the collection to use.
@@ -231,6 +223,7 @@ declare namespace Agenda {
/**
* Connection options to pass to MongoDB.
* Not required when an existing connection is passed as `mongo` property.
*/
options?: any;
}
+4 -5
View File
@@ -99,10 +99,9 @@ console.log(
const view = db._view("yolo")!;
view.properties({
locale: "C",
commit: {
consolidate: {
bytes: { segmentThreshold: 20 }
}
consolidationIntervalMsec: 123,
consolidationPolicy: {
type: "bytes",
segmentThreshold: 234
}
});
+18 -26
View File
@@ -848,10 +848,11 @@ declare namespace ArangoDB {
): ArangoSearchViewProperties;
}
interface ArangoSearchViewConsolidate {
threshold: number;
segmentThreshold: number;
}
type ArangoSearchViewConsolidationType =
| "bytes"
| "bytes_accum"
| "count"
| "fill";
interface ArangoSearchViewCollectionLink {
analyzers?: string[];
@@ -865,35 +866,26 @@ declare namespace ArangoDB {
id: string;
name: string;
type: "arangosearch";
commit: {
cleanupIntervalStep: number;
commitIntervalMsec: number;
consolidate: {
bytes?: ArangoSearchViewConsolidate;
bytes_accum?: ArangoSearchViewConsolidate;
count?: ArangoSearchViewConsolidate;
fill?: ArangoSearchViewConsolidate;
};
cleanupIntervalStep: number;
consolidationIntervalMsec: number;
consolidationPolicy: {
type: ArangoSearchViewConsolidationType;
segmentThreshold: number;
threshold: number;
};
locale: string;
links: {
[key: string]: ArangoSearchViewCollectionLink | undefined;
};
}
interface ArangoSearchViewPropertiesOptions {
locale?: string;
commit?: {
consolidate?:
| "none"
| {
count?: Partial<ArangoSearchViewConsolidate>;
bytes?: Partial<ArangoSearchViewConsolidate>;
bytes_accum?: Partial<ArangoSearchViewConsolidate>;
fill?: Partial<ArangoSearchViewConsolidate>;
};
commitIntervalMsec?: number;
cleanupIntervalStep?: number;
cleanupIntervalStep?: number;
consolidationIntervalMsec?: number;
consolidationPolicy?: {
type?: ArangoSearchViewConsolidationType;
segmentThreshold?: number;
threshold?: number;
};
links?: {
[key: string]: ArangoSearchViewCollectionLink | undefined;
@@ -44,3 +44,11 @@ function testPromiseRejection() {
function testGithubTicket28081Regression() {
Promise.resolve([3]).map((n: number) => true);
}
import Bluebird = require("bluebird");
function testTheWalkaroundForCastingGlobalPromiseToBluebirdPromise() {
const bluebirdString: Bluebird<string> = Bluebird.resolve(
new Promise<string>(() => 'Lorem ipsum')
);
}
+56 -19
View File
@@ -10,6 +10,25 @@
* If you want to leverage the fact, that bluebird polyfills the global Promise in the browser, then
* you need to tell TypeScript about this. The following declaration file does exactly that.
*
* 1.1. Why you might not want to use `bluebird-global` instead of `bluebird`.
*
* Because of how these typings tell TypeScript about bluebird's Promise methods, it is not
* possible to cast global Promises to Bluebird promises in your code. In other words, you won't
* be able to do the following (even though it's possible at the runtime):
*
* let bluebirdPromise: Bluebird<string> = new Promise<string>(() => { return 'Lorem ipsum'; });
*
* If you need to, you can walk-around this by constructing a new Bluebird promise over an instance
* of the global Promise, like so:
*
* let bluebirdPromise: Bluebird<string> = Bluebird.resolve(
* new Promise<string>(() => { return 'Lorem ipsum'; })
* );
*
* So the bottom line is: if you use these typings, then be mindful when you try to mix the global
* Promises with the Bluebird promises. You can avoid this problem by just settling on using either
* of them and not both of them at the same time.
*
* 2. How to use it?
*
* It should just work, but there are a couple of points to be wary about:
@@ -60,6 +79,17 @@
* d. target es6, latest "es20xx", e.g. "es2017"
*/
/*
* @todo When dropping TS 2.x support, uncomment the following triple-slash directives and
* remove the copy&paste from this file (marked with #std-lib-copy&paste-to-remove)
*
* TS 2.x support should be dropped once bluebird's typings stop compiling on 2.x (i.e.
* once bluebird's typings stop supporting TS 2.x)
*/
/* /// <reference lib="es5" /> */
/* /// <reference lib="es2015.promise" /> */
/* /// <reference lib="es2018.promise" /> */
import Bluebird = require("bluebird");
declare global {
@@ -73,7 +103,7 @@ declare global {
bind: Bluebird<T>["bind"];
call: Bluebird<T>["call"];
cancel: Bluebird<T>["cancel"];
// catch: Bluebird<T>["catch"];
// catch: Bluebird<T>["catch"]; // Provided by lib.es5.d.ts
caught: Bluebird<T>["caught"];
delay: Bluebird<T>["delay"];
disposer: Bluebird<T>["disposer"];
@@ -81,7 +111,7 @@ declare global {
each: Bluebird<T>["each"];
error: Bluebird<T>["error"];
filter: Bluebird<T>["filter"];
// finally: Bluebird<T>["finally"];
// finally: Bluebird<T>["finally"]; // Provided by lib.es2018.promise.d.ts
get: Bluebird<T>["get"];
isCancelled: Bluebird<T>["isCancelled"];
isFulfilled: Bluebird<T>["isFulfilled"];
@@ -103,7 +133,7 @@ declare global {
suppressUnhandledRejections: Bluebird<T>["suppressUnhandledRejections"];
tap: Bluebird<T>["tap"];
tapCatch: Bluebird<T>["tapCatch"];
// then: Bluebird<T>["then"];
// then: Bluebird<T>["then"]; // Provided by lib.es5.d.ts
thenReturn: Bluebird<T>["thenReturn"];
thenThrow: Bluebird<T>["thenThrow"];
catchReturn: Bluebird<T>["catchReturn"];
@@ -115,19 +145,18 @@ declare global {
value: Bluebird<T>["value"];
/*
* Copy&paste ::then and ::catch from lib.es2015.promise.d.ts, because Bluebird's typings are not
* Copy&paste ::then and ::catch from lib.es5.promise.d.ts, because Bluebird's typings are not
* in line with the standard lib.
*
* This is only needed for es5 target, which doesn't include the lib.es2015.promise.d.ts typings.
* #std-lib-copy&paste-to-remove
*
* @todo Make Bluebird's typings be in line with the standard lib.
* @todo See the comment near the top of the file about code marked with #std-lib-copy&paste-to-remove
*/
then(onfulfilled?: ((value: T) => T | PromiseLike<T>) | undefined | null, onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): Promise<T>;
then<TResult>(onfulfilled: ((value: T) => T | PromiseLike<T>) | undefined | null, onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
then<TResult>(onfulfilled: (value: T) => TResult | PromiseLike<TResult>, onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<TResult>;
then<TResult1, TResult2>(onfulfilled: (value: T) => TResult1 | PromiseLike<TResult1>, onrejected: (reason: any) => TResult2 | PromiseLike<TResult2>): Promise<TResult1 | TResult2>;
catch(onrejected?: ((reason: any) => T | PromiseLike<T>) | undefined | null): Promise<T>;
catch<TResult>(onrejected: (reason: any) => TResult | PromiseLike<TResult>): Promise<T | TResult>;
then<TResult1 = T, TResult2 = never>(
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null
): Promise<TResult1 | TResult2>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null): Promise<T | TResult>;
/*
* TypeScript disallows adding overrides via `catch: typeof Bluebird.prototype.catch`. Copy&paste them then.
@@ -142,7 +171,11 @@ declare global {
catch<U>(predicate: Object, onReject: (error: any) => U | PromiseLike<U>): Bluebird<U | T>;
/*
* See comments above `then` for the reason why this is needed. Taken from esnext.promise.d.ts.
* See comments above `then` for the reason why this is needed. Taken from es2018.promise.d.ts.
*
* #std-lib-copy&paste-to-remove
*
* @todo See the comment near the top of the file about code marked with #std-lib-copy&paste-to-remove
*/
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
}
@@ -153,7 +186,7 @@ declare global {
interface PromiseConstructor {
new <T>(callback: (resolve: (thenableOrResult?: T | PromiseLike<T>) => void, reject: (error?: any) => void, onCancel?: (callback: () => void) => void) => void): Promise<T>;
// all: typeof Bluebird.all;
// all: typeof Bluebird.all; // Provided by lib.es2015.d.ts
any: typeof Bluebird.any;
attempt: typeof Bluebird.attempt;
bind: typeof Bluebird.bind;
@@ -176,10 +209,10 @@ declare global {
promisify: typeof Bluebird.promisify;
promisifyAll: typeof Bluebird.promisifyAll;
props: typeof Bluebird.props;
// race: typeof Bluebird.race;
// race: typeof Bluebird.race; // Provided by lib.es2015.d.ts
reduce: typeof Bluebird.reduce;
// reject: typeof Bluebird.reject;
// resolve: typeof Bluebird.resolve;
// reject: typeof Bluebird.reject; // Provided by lib.es2015.d.ts
// resolve: typeof Bluebird.resolve; // Provided by lib.es2015.d.ts
some: typeof Bluebird.some;
try: typeof Bluebird.try;
using: typeof Bluebird.using;
@@ -187,9 +220,9 @@ declare global {
/*
* Copy&paste from lib.es2015.promise.d.ts, because Bluebird's typings are not in line with the standard lib.
*
* This is only needed for es5 target, which doesn't include the lib.es2015.promise.d.ts typings.
* #std-lib-copy&paste-to-remove
*
* @todo Make Bluebird's typings be in line with the standard lib.
* @todo See the comment near the top of the file about code marked with #std-lib-copy&paste-to-remove
*/
all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike <T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
@@ -219,6 +252,10 @@ declare global {
/*
* Declare the `Promise` variable. This is needed for es5 only and is a no-op for all other targets.
*
* #std-lib-copy&paste-to-remove
*
* @todo See the comment near the top of the file about code marked with #std-lib-copy&paste-to-remove
*/
var Promise: PromiseConstructor;
}
+1 -2
View File
@@ -70,8 +70,7 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
*
* Alias `.caught();` for compatibility with earlier ECMAScript version.
*/
catch(onReject: (error: any) => Resolvable<R>): Bluebird<R>;
catch<U>(onReject: ((error: any) => Resolvable<U>) | undefined | null): Bluebird<U | R>;
catch<U = R>(onReject: ((error: any) => Resolvable<U>) | undefined | null): Bluebird<U | R>;
/**
* This extends `.catch` to work more like catch-clauses in languages like Java or C#.
@@ -37,6 +37,21 @@ client.search({
}, (error) => {
});
client.search({
body: {
query: {
match_all: {
_name: 'test'
}
}
}
}
).then((body) => {
const hit = body.hits.hits[0];
const names = hit && hit.matched_queries;
}, (error) => {
});
client.indices.delete({
index: 'test_index',
ignore: [404]
+1
View File
@@ -645,6 +645,7 @@ export interface SearchResponse<T> {
fields?: any;
highlight?: any;
inner_hits?: any;
matched_queries?: string[];
sort?: string[];
}>;
};
@@ -0,0 +1,69 @@
import ExpiredStorage = require('expired-storage');
const expiredStorage = new ExpiredStorage();
const mjkModel = {
firstName: 'Maynard',
middleName: 'James',
familyName: 'Keenan',
};
expiredStorage.clear();
expiredStorage.setItem('tool', '46&2', 10);
if (expiredStorage.getItem('tool') !== '46&2') {
throw new Error('.setItem method is not working!');
}
expiredStorage.setJson('mjk', mjkModel, 1);
const mjkTest = expiredStorage.getJson('mjk');
if (typeof mjkTest === 'undefined' || mjkTest.firstName !== mjkModel.firstName || mjkTest.middleName !== mjkModel.middleName || mjkTest.familyName !== mjkModel.familyName) {
throw new Error('.setJson method is not working!');
}
const keyCheck = expiredStorage.keys(true);
if (keyCheck && keyCheck.length === 2) {
throw new Error('.keys method has failed.');
}
expiredStorage.setItem('apc', 'brena', 2);
const goBackToSleep = expiredStorage.peek('apc');
if (!goBackToSleep.isExpired && goBackToSleep.value !== 'brena') {
throw new Error('.peek -- we have expired early... or our value was incorrect...');
}
do {
// nothing here to see
} while (!expiredStorage.isExpired('apc'));
const expiredKeys = expiredStorage.clearExpired();
if (expiredKeys.indexOf('apc') !== -1) {
throw new Error('.clearExpired did not work..');
}
if (expiredStorage.getItem('apc') !== null) {
throw new Error('Expiration as a whole does not work.');
}
expiredStorage.setItem('puscifer', 'the humbling river', 10000);
expiredStorage.updateExpiration('puscifer', 5000);
const checkKeyTime = expiredStorage.getTimeLeft('puscifer');
if (checkKeyTime && checkKeyTime >= 10000) {
throw new Error('.updateExpiration method is broken -- or .getTimeLeft method is broken.');
}
if (!expiredStorage.isExpired('mjk')) {
throw new Error('.isExpired or Expiration as a whole is not working...');
}
expiredStorage.clear();
+105
View File
@@ -0,0 +1,105 @@
// Type definitions for extended-storage 1.0
// Project: https://github.com/RonenNess/ExpiredStorage/
// Definitions by: Allen Gammel <https://github.com/intolerance>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export = ExpiredStorage;
declare class ExpiredStorage {
constructor(localStorage?: any);
/**
* Clear the entire storage and all keys in it.
*/
clear(): void;
/**
* Get a json serializable value. This basically calls JSON.parse on the returned value.
* @param key Item key to get (string).
* @return Stored value (JSON.parsed), or undefined if not set / expired.
*/
getJson(key: string): any;
/**
* Get item.
* @param key: Item key to get (string).
* @return: Stored value, or undefined if not set / expired.
*/
getItem(key: string): string | null;
/**
* Remove an item.
* @param key Item key to remove (string).
* @return Storage.removeItem() return code.
*/
removeItem(key: string): any;
/**
* Set a json serializable value. This basically calls JSON.stringify on 'val' before setting it.
* @param key Item key to set (string).
* @param value Value to store (object, will be JSON.stringified).
* @param expiration Expiration time, in seconds. If not provided, will not set expiration time.
* @param return Storage.setItem() return code.
*/
setJson(key: string, value: object, expirationTime?: number): any;
/**
* Set item.
* @param key Item key to set (string).
* @param value Value to store (string).
* @param expiration Expiration time, in seconds. If not provided, will not set expiration time.
* @return Storage.setItem() return code.
*/
setItem(key: string, value: string, expiration?: number): any;
/**
* Get all keys in storage, not including internal keys used to store expiration.
* @param: includeExpired: if true, will also include expired keys.
* @return: Array with keys.
*/
keys(includeExpired: boolean): string[] | null;
/**
* Get item time left to live.
* @param key Item key to get (string).
* @return Time left to expire (in seconds), or null if don't have expiration date.
*/
getTimeLeft(key: string): number | null;
/**
* Clear expired keys.
* If you never call this function, expired keys will remain until you try to get them / reset a new value.
*
* @param return: List of removed keys due to expiration.
*/
clearExpired(): string[];
/**
* Return if an item is expired (don't remove it, even if expired).
* @param key Item key to check (string).
* @return True if expired, False otherwise.
*/
isExpired(key: string): boolean;
/**
* Get item + metadata such as time left and if expired.
* Even if item expired, will not remove it.
* @param key Item key to get (string).
* @return PeekInterface with: {value, timeLeft, isExpired}
*/
peek(key: string): ExpiredStorage.PeekInterface;
/**
* Update expiration time for an item (note: doesn't validate that the item is set).
* @param key: Item key to update expiration for (string).
* @param expiration: New expiration time in seconds to set.
* @return: Storage.setItem() return code for setting new expiration.
*/
updateExpiration(key: string, expiration: number): any;
}
declare namespace ExpiredStorage {
interface PeekInterface {
/**
* The value of a [key]
*/
value: string | null;
/**
* Time remaining until expiration
*/
timeLeft: number | null;
/**
* Has the [key] expired or not
*/
isExpired: boolean;
}
}
+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",
"expired-storage-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+174
View File
@@ -0,0 +1,174 @@
// Type definitions for jsgraph 0.7
// Project: https://github.com/Encapsule/jsgraph
// Definitions by: Joel Rosinbum <https://github.com/rosinbum>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace jsgraph {
interface jsGraphStatic {
directed: Directed;
}
export interface VertexRequest {
u: string;
p: any
}
export interface JsGraphResponse {
error?: any;
result?: any;
}
export interface Edge {
u: string;
v: string
}
export interface EdgeRequest {
e: Edge;
p: any;
}
export interface DirectedGraph {
new(): DirectedGraph;
setGraphName(name: string): JsGraphResponse;
getGraphName(): string;
setGraphDescription(description: string): JsGraphResponse;
getGraphDescription(): string;
verticesCount(): number;
getVertices(): string[];
getEdgeCount(): number;
getEdeges(): Edge[];
rootVerticesCount(): number;
getRootVertices(): string[];
leafVerticesCount(): number;
getLeafVertices(): string[];
toObject(): string;
toJSON(): string;
stringify(replacer: Function, space?: number): string;
fromObject(graph: any): JsGraphResponse;
//Vertex functions
addVertex(vertex: VertexRequest): JsGraphResponse;
removeVertex(vertex: string): boolean;
getVertexProperty(vertex: string): any;
setVertexProperty(vertex: VertexRequest): JsGraphResponse;
hasVertexProperty(vertex: string): boolean;
clearVertexProperty(vertex: string): boolean;
inDegree(vertex: string): number;
inEdges(vertex: string): Edge[];
outDegree(vertex: string): number;
outEdges(vertex: string): Edge[];
//Edge functions
addEdge(request: EdgeRequest): JsGraphResponse;
isEdge(edge: Edge): boolean;
removeEdge(edge: Edge): JsGraphResponse;
getEdgeProperty(edge: Edge): any;
setEdgeProperty(request: EdgeRequest): JsGraphResponse;
hasEdgeProperty(edge: Edge): boolean;
clearEdgeProperty(edge: Edge): boolean;
}
export interface Visitor {
initializeVertex(req: { u: string, g: DirectedGraph }): void;
startVertex(req: { u: string, g: DirectedGraph }): void;
discoverVertex(req: { u: string, g: DirectedGraph }): void;
examineVertex(req: { u: string, g: DirectedGraph }): void;
examineEdge(req: { e: Edge, g: DirectedGraph }): void;
nonTreeEdge(req: { e: Edge, g: DirectedGraph }): void;
grayTarget(req: { e: Edge, g: DirectedGraph }): void;
blackTarget(req: { e: Edge, g: DirectedGraph }): void;
finishVertex(req: { u: string, g: DirectedGraph }): void;
}
export interface TraversalContext {
searchStatus: string;
colorMap: any;
undiscoveredMap: any;
}
export interface TraversalOptions {
startVector: string | string[];
allowEmptyStartVector: boolean;
signalStart: boolean;
traverseContext: TraversalContext;
}
export interface TraversalParams {
digraph: DirectedGraph,
visitor: Visitor,
options?: TraversalOptions
}
export interface TraversalResult {
error?: any;
result?: TraversalContext
}
export type colors = { white: 0, gray: 1, black: 2 };
export interface Directed {
breadthFirstTraverse(params: TraversalParams): TraversalResult;
colors: colors;
create(): { result: DirectedGraph };
createTraversalContext(req: { dirgaph: DirectedGraph }): TraversalContext;
depthFirstTraverse(params: TraversalParams): TraversalResult;
transpose(graph: DirectedGraph): { error?: any, result?: DirectedGraph };
directedGraph: DirectedGraph;
}
}
declare var jsgraph: jsgraph.jsGraphStatic;
export = jsgraph;
+43
View File
@@ -0,0 +1,43 @@
import * as jsgraph from 'jsgraph';
import {Edge, JsGraphResponse} from 'jsgraph';
const mygraph = jsgraph.directed.create().result;
let name: string = 'my name';
mygraph.setGraphName(name);
name = mygraph.getGraphName();
let description: string = 'My desc';
mygraph.setGraphDescription(description);
description = mygraph.getGraphDescription();
let count: number = mygraph.verticesCount();
let verticies: string [] = mygraph.getVertices();
count = mygraph.getEdgeCount();
let edges: Edge[] = mygraph.getEdeges();
count = mygraph.rootVerticesCount();
verticies = mygraph.getRootVertices();
count = mygraph.leafVerticesCount();
verticies = mygraph.getLeafVertices();
let json: string = mygraph.toObject();
json = mygraph.toJSON();
json = mygraph.stringify( () => {return}, 2);
const graph2 = mygraph.fromObject(mygraph);
let response: JsGraphResponse = mygraph.addVertex({u: 'a', p: 'some data'});
let bool: boolean = mygraph.removeVertex('a');
let property: string = mygraph.getVertexProperty('a');
mygraph.setVertexProperty({u: 'a', p: property});
bool = mygraph.hasVertexProperty('a');
bool = mygraph.clearVertexProperty('a');
count = mygraph.inDegree('a');
edges = mygraph.inEdges('a');
count = mygraph.outDegree('a');
edges = mygraph.outEdges('a');
response = mygraph.addEdge({e: {u: 'a', v:'b'}, p: 'some data'});
bool = mygraph.isEdge({u: 'a', v:'b'});
response = mygraph.removeEdge({u: 'a', v: 'b'});
property = mygraph.getEdgeProperty({u: 'a', v: 'b'});
response = mygraph.setEdgeProperty({e: {u: 'a', v: 'b'}, p: 'some data'});
bool = mygraph.hasEdgeProperty({u: 'a', v: 'b'});
bool = mygraph.clearEdgeProperty({u:'a', v: 'b'});
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"jsgraph-tests.ts"
]
}
+79
View File
@@ -0,0 +1,79 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
}
+5
View File
@@ -124,6 +124,11 @@ declare module 'leaflet' {
* When you need to stop any ongoing drawing, without needing to know which editor is active.
*/
stopDrawing(): void;
/**
* When you need to commit any ongoing drawing, without needing to know which editor is active.
*/
commitDrawing(): void;
}
let Editable: EditableStatic;
@@ -31,6 +31,7 @@ const map: L.Map = L.map('div', {
const currentPoly: L.Polygon|L.Polyline| L.Marker = map.editTools.currentPolygon;
map.editTools.stopDrawing();
map.editTools.commitDrawing();
const marker: L.Marker = map.editTools.startMarker(L.latLng(0, 0), { draggable: true });
marker.disable();
+29
View File
@@ -0,0 +1,29 @@
# DefinitelyTyped for node-forge
## Current node-forge Version
`v0.7.6`
## Usage
```bash
npm install --save-dev @types/node-forge
npm install --save node-forge
```
example:
```ts
import * as forge from "node-forge";
Buffer.isBuffer(forge.pki.ed25519.generateKeyPair().publicKey) // true
```
## License
BSD-2-Clause
## dependencies
`@types/node`
## Author
[Seth Westphal](https://github.com/westy92)
[Kay Schecker](https://github.com/flynetworks)
[Aakash Goenka](https://github.com/a-k-g)
[Rafal2228](https://github.com/rafal2228)
[Beeno Tung](https://github.com/beenotung)
+32 -1
View File
@@ -1,10 +1,14 @@
// Type definitions for node-forge 0.7.5
// Type definitions for node-forge 0.7.6
// Project: https://github.com/digitalbazaar/forge
// Definitions by: Seth Westphal <https://github.com/westy92>
// Kay Schecker <https://github.com/flynetworks>
// Aakash Goenka <https://github.com/a-k-g>
// Rafal2228 <https://github.com/rafal2228>
// Beeno Tung <https://github.com/beenotung>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
/// <reference types="node" />
declare module "node-forge" {
type Byte = string;
@@ -73,6 +77,33 @@ declare module "node-forge" {
function generateKeyPair(options?: GenerateKeyPairOptions, callback?: (err: Error, keypair: KeyPair) => void): KeyPair;
}
namespace ed25519 {
type NativeBuffer = Buffer | Uint8Array;
namespace constants {
const PUBLIC_KEY_BYTE_LENGTH = 32;
const PRIVATE_KEY_BYTE_LENGTH = 64;
const SEED_BYTE_LENGTH = 32;
const SIGN_BYTE_LENGTH = 64;
const HASH_BYTE_LENGTH = 64;
}
function generateKeyPair(options?: { seed?: Buffer | Uint8Array | string }): {
publicKey: NativeBuffer;
privateKey: NativeBuffer;
};
function publicKeyFromPrivateKey(options: { privateKey: NativeBuffer }): NativeBuffer;
function sign(options: { privateKey: NativeBuffer }): NativeBuffer;
function verify(options: {
signature: Buffer | Uint8Array | util.ByteBuffer | string,
publicKey: NativeBuffer
}): boolean;
}
interface CertificateFieldOptions {
name?: string;
type?: string;
+109 -109
View File
@@ -8618,7 +8618,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Compose or read</td></tr></table>
*
* @param coercionType The format for the returned body.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* The body is provided in the requested format in the asyncResult.value property.
*/
getAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult<Office.Body>) => void): void;
@@ -8635,7 +8635,7 @@ declare namespace Office {
*
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* The content type is returned as one of the CoercionType values in the asyncResult.value property.
*/
getTypeAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<Office.CoercionType>) => void): void;
@@ -8669,7 +8669,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* coercionType: The desired format for the body. The string in the data parameter will be converted to this format.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* Any errors encountered will be provided in the asyncResult.error property.
*/
prependAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult<void>) => void): void;
@@ -8714,7 +8714,7 @@ declare namespace Office {
* <tr><td>Errors</td><td>DataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.</td></tr></table>
*
* @param data The string to be inserted at the beginning of the body. The string is limited to 1,000,000 characters.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* Any errors encountered will be provided in the asyncResult.error property.
*/
prependAsync(data: string, callback: (result: AsyncResult<void>) => void): void;
@@ -8768,7 +8768,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* coercionType: The desired format for the body. The string in the data parameter will be converted to this format.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* Any errors encountered will be provided in the asyncResult.error property.
*/
setAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult<void>) => void): void;
@@ -8817,7 +8817,7 @@ declare namespace Office {
* <tr><td>Errors</td><td>DataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.</td></tr><tr><td></td><td>InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text.</td></tr></table>
*
* @param data The string that will replace the existing body. The string is limited to 1,000,000 characters.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* Any errors encountered will be provided in the asyncResult.error property.
*/
setAsync(data: string, callback: (result: AsyncResult<void>) => void): void;
@@ -8875,7 +8875,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* coercionType: The desired format for the body. The string in the data parameter will be converted to this format.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* Any errors encountered will be provided in the asyncResult.error property.
*/
setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult<void>) => void): void;
@@ -8924,7 +8924,7 @@ declare namespace Office {
* <tr><td>Errors</td><td>DataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.</td></tr><tr><td></td><td>InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text.</td></tr></table>
*
* @param data The string that will replace the existing body. The string is limited to 1,000,000 characters.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* Any errors encountered will be provided in the asyncResult.error property.
*/
setSelectedDataAsync(data: string, callback: (result: AsyncResult<void>) => void): void;
@@ -9066,7 +9066,7 @@ declare namespace Office {
* Your callback method should handle this error accordingly.
*
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* @param asyncContext Optional. Any state data that is passed to the callback method.
*
* [Api set: Mailbox 1.0]
@@ -9286,7 +9286,7 @@ declare namespace Office {
*
* @param options An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an {@link Office.AsyncResult} object.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object.
* The `value` property of the result is message's from value, as an EmailAddressDetails object.
*/
getAsync(options: Office.AsyncContextOptions, callback: (result: AsyncResult<Office.EmailAddressDetails>) => void): void;
@@ -9305,7 +9305,7 @@ declare namespace Office {
*
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Compose</td></tr></table>
*
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an {@link Office.AsyncResult} object.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter, asyncResult, which is an Office.AsyncResult object.
* The `value` property of the result is message's from value, as an EmailAddressDetails object.
*/
getAsync(callback?: (result: AsyncResult<Office.EmailAddressDetails>) => void): void;
@@ -9727,7 +9727,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -9750,7 +9750,7 @@ declare namespace Office {
* @param handler The function to handle the event. The function must accept a single parameter, which is an object literal.
* The type property on the parameter will match the eventType parameter passed to addHandlerAsync.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -9789,7 +9789,7 @@ declare namespace Office {
* @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters.
* @param options An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* On success, the attachment identifier will be provided in the asyncResult.value property.
* If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error.
*/
@@ -9872,7 +9872,7 @@ declare namespace Office {
*
* @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters.
* @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* On success, the attachment identifier will be provided in the asyncResult.value property.
* If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of the error.
*/
@@ -9914,7 +9914,7 @@ declare namespace Office {
*
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* On success, the initialization data is provided in the asyncResult.value property as a string.
* If there is no initialization context, the asyncResult object will contain an Error object with its code property set to 9020 and its name property set to GenericResponseError.
*
@@ -9971,7 +9971,7 @@ declare namespace Office {
* @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present.
* If HTML, the method returns the selected text, whether it is plaintext or HTML.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
getSelectedDataAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult<string>) => void): void;
/**
@@ -9994,7 +9994,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Appointment Organizer</td></tr></table>
*
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* @param userContext Optional. Developers can provide any object they wish to access in the callback function.
* This object can be accessed by the asyncResult.asyncContext property in the callback function.
*/
@@ -10029,7 +10029,7 @@ declare namespace Office {
* @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters.
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure.
*/
removeAttachmentAsync(attachmentIndex: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
@@ -10101,7 +10101,7 @@ declare namespace Office {
*
* @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure.
*/
removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult<void>) => void): void;
@@ -10129,7 +10129,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -10151,7 +10151,7 @@ declare namespace Office {
* @param handler The function to handle the event. The function must accept a single parameter, which is an object literal.
* The type property on the parameter will match the eventType parameter passed to removeHandlerAsync.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -10197,7 +10197,7 @@ declare namespace Office {
*
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
*/
saveAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
/**
@@ -10298,7 +10298,7 @@ declare namespace Office {
*
* <tr><td>Errors</td><td>InvalidAttachmentId - The attachment identifier does not exist.</td></tr></table>
*
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
*/
saveAsync(callback: (result: AsyncResult<void>) => void): void;
/**
@@ -10338,7 +10338,7 @@ declare namespace Office {
* If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used;
* if the field is text, then plain text is used.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult<void>) => void): void;
/**
@@ -10411,7 +10411,7 @@ declare namespace Office {
* @param data The data to be inserted. Data is not to exceed 1,000,000 characters.
* If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
setSelectedDataAsync(data: string, callback: (result: AsyncResult<void>) => void): void;
}
@@ -10752,7 +10752,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -10776,7 +10776,7 @@ declare namespace Office {
* @param handler The function to handle the event. The function must accept a single parameter, which is an object literal.
* The type property on the parameter will match the eventType parameter passed to addHandlerAsync.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -10854,7 +10854,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
* On success, the initialization data is provided in the asyncResult.value property as a string.
* If there is no initialization context, the asyncResult object will contain an Error object with its code property
* set to 9020 and its name property set to GenericResponseError.
@@ -10876,7 +10876,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Appointment Attendee</td></tr></table>
*
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
* On success, the initialization data is provided in the asyncResult.value property as a string.
* If there is no initialization context, the asyncResult object will contain an Error object with its code property
* set to 9020 and its name property set to GenericResponseError.
@@ -11107,7 +11107,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Appointment Attendee</td></tr></table>
*
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* @param userContext Optional. Developers can provide any object they wish to access in the callback function.
* This object can be accessed by the asyncResult.asyncContext property in the callback function.
*/
@@ -11137,7 +11137,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -11160,7 +11160,7 @@ declare namespace Office {
* @param handler The function to handle the event. The function must accept a single parameter, which is an object literal.
* The type property on the parameter will match the eventType parameter passed to removeHandlerAsync.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -11319,7 +11319,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -11342,7 +11342,7 @@ declare namespace Office {
* @param handler The function to handle the event. The function must accept a single parameter, which is an object literal.
* The type property on the parameter will match the eventType parameter passed to addHandlerAsync.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -11368,7 +11368,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Compose or read</td></tr></table>
*
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* @param userContext Optional. Developers can provide any object they wish to access in the callback function.
* This object can be accessed by the asyncResult.asyncContext property in the callback function.
*/
@@ -11398,7 +11398,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -11422,7 +11422,7 @@ declare namespace Office {
* @param handler The function to handle the event. The function must accept a single parameter, which is an object literal.
* The type property on the parameter will match the eventType parameter passed to removeHandlerAsync.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -11550,7 +11550,7 @@ declare namespace Office {
* @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters.
* @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}. On success, the attachment identifier will be provided in the asyncResult.value property.
* type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property.
* If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of
* the error.
*/
@@ -11618,7 +11618,7 @@ declare namespace Office {
* @param options An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}. On success, the attachment identifier will be provided in the asyncResult.value property.
* type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property.
* If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of
* the error.
*/
@@ -11702,7 +11702,7 @@ declare namespace Office {
* @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters.
* @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}. On success, the attachment identifier will be provided in the asyncResult.value property.
* type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property.
* If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of
* the error.
*/
@@ -11746,7 +11746,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* On success, the initialization data is provided in the asyncResult.value property as a string.
* If there is no initialization context, the asyncResult object will contain an Error object with its code property
* set to 9020 and its name property set to GenericResponseError.
@@ -11777,7 +11777,7 @@ declare namespace Office {
* @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string , removing any HTML tags present.
* If HTML, the method returns the selected text, whether it is plaintext or HTML.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
getSelectedDataAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult<any>) => void): void;
/**
@@ -11805,7 +11805,7 @@ declare namespace Office {
* @param options An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
getSelectedDataAsync(coerciontype: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: AsyncResult<any>) => void): void;
/**
@@ -11839,7 +11839,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure.
*/
removeAttachmentAsync(attachmentIndex: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
@@ -11957,7 +11957,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure.
*/
saveAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
@@ -12061,7 +12061,7 @@ declare namespace Office {
* <tr><td>Errors</td><td>InvalidAttachmentId - The attachment identifier does not exist.</td></tr></table>
*
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure.
*/
saveAsync(callback: (result: AsyncResult<void>) => void): void;
@@ -12102,7 +12102,7 @@ declare namespace Office {
* If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used;
* if the field is text, then plain text is used.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult<void>) => void): void;
/**
@@ -12176,7 +12176,7 @@ declare namespace Office {
* @param data The data to be inserted. Data is not to exceed 1,000,000 characters.
* If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
setSelectedDataAsync(data: string, callback: (result: AsyncResult<void>) => void): void;
}
@@ -12365,7 +12365,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
* On success, the initialization data is provided in the asyncResult.value property as a string.
* If there is no initialization context, the asyncResult object will contain an Error object with its code property
* set to 9020 and its name property set to GenericResponseError.
@@ -12388,7 +12388,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Read</td></tr></table>
*
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
* On success, the initialization data is provided in the asyncResult.value property as a string.
* If there is no initialization context, the asyncResult object will contain an Error object with its code property
* set to 9020 and its name property set to GenericResponseError.
@@ -12877,7 +12877,7 @@ declare namespace Office {
* isInline: If true, indicates that the attachment will be shown inline in the message body, and should not be displayed in the
* attachment list.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.asyncResult}. On success, the attachment identifier will be provided in the asyncResult.value property.
* type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property.
* If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of
* the error.
*/
@@ -12944,7 +12944,7 @@ declare namespace Office {
* @param uri The URI that provides the location of the file to attach to the message or appointment. The maximum length is 2048 characters.
* @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}. On success, the attachment identifier will be provided in the asyncResult.value property.
* type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property.
* If uploading the attachment fails, the asyncResult object will contain an Error object that provides a description of
* the error.
*/
@@ -12998,7 +12998,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -13021,7 +13021,7 @@ declare namespace Office {
* @param handler The function to handle the event. The function must accept a single parameter, which is an object literal.
* The type property on the parameter will match the eventType parameter passed to addHandlerAsync.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -13145,7 +13145,7 @@ declare namespace Office {
* @param itemId The Exchange identifier of the item to attach. The maximum length is 100 characters.
* @param attachmentName The name of the attachment that is shown while the attachment is uploading. The maximum length is 255 characters.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}. On success, the attachment identifier will be provided in the asyncResult.value property.
* type Office.AsyncResult. On success, the attachment identifier will be provided in the asyncResult.value property.
* If adding the attachment fails, the asyncResult object will contain an Error object that provides a description of
* the error.
*/
@@ -13189,7 +13189,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* On success, the initialization data is provided in the asyncResult.value property as a string.
* If there is no initialization context, the asyncResult object will contain an Error object with its code property
* set to 9020 and its name property set to GenericResponseError.
@@ -13220,7 +13220,7 @@ declare namespace Office {
* @param coercionType Requests a format for the data. If Text, the method returns the plain text as a string, removing any HTML tags present.
* If HTML, the method returns the selected text, whether it is plaintext or HTML.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
getSelectedDataAsync(coerciontype: Office.CoercionType, callback: (result: AsyncResult<any>) => void): void;
/**
@@ -13248,7 +13248,7 @@ declare namespace Office {
* @param options An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
getSelectedDataAsync(coerciontype: Office.CoercionType, options: Office.AsyncContextOptions, callback: (result: AsyncResult<any>) => void): void;
/**
@@ -13271,7 +13271,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Message Compose</td></tr></table>
*
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* @param userContext Optional. Developers can provide any object they wish to access in the callback function.
* This object can be accessed by the asyncResult.asyncContext property in the callback function.
*/
@@ -13307,7 +13307,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure.
*/
removeAttachmentAsync(attachmentIndex: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
@@ -13378,7 +13378,7 @@ declare namespace Office {
*
* @param attachmentIndex The identifier of the attachment to remove. The maximum length of the string is 100 characters.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* If removing the attachment fails, the asyncResult.error property will contain an error code with the reason for the failure.
*/
removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult<void>) => void): void;
@@ -13406,7 +13406,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -13429,7 +13429,7 @@ declare namespace Office {
* @param handler The function to handle the event. The function must accept a single parameter, which is an object literal.
* The type property on the parameter will match the eventType parameter passed to removeHandlerAsync.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -13476,7 +13476,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
saveAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
/**
@@ -13578,7 +13578,7 @@ declare namespace Office {
* <tr><td>Errors</td><td>InvalidAttachmentId - The attachment identifier does not exist.</td></tr></table>
*
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
saveAsync(callback: (result: AsyncResult<void>) => void): void;
/**
@@ -13617,7 +13617,7 @@ declare namespace Office {
* If coercionType is not set, the result depends on the field: if the field is HTML then HTML is used;
* if the field is text, then plain text is used.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
setSelectedDataAsync(data: string, options?: Office.AsyncContextOptions & CoercionTypeOptions, callback?: (result: AsyncResult<void>) => void): void;
/**
@@ -13690,7 +13690,7 @@ declare namespace Office {
* @param data The data to be inserted. Data is not to exceed 1,000,000 characters.
* If more than 1,000,000 characters are passed in, an ArgumentOutOfRange exception is thrown.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type{@link Office.AsyncResult}.
* typeOffice.AsyncResult.
*/
setSelectedDataAsync(data: string, callback: (result: AsyncResult<void>) => void): void;
}
@@ -14046,7 +14046,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -14070,7 +14070,7 @@ declare namespace Office {
* @param handler The function to handle the event. The function must accept a single parameter, which is an object literal.
* The type property on the parameter will match the eventType parameter passed to addHandlerAsync.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -14149,7 +14149,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
* On success, the initialization data is provided in the asyncResult.value property as a string.
* If there is no initialization context, the asyncResult object will contain an Error object with its code property
* set to 9020 and its name property set to GenericResponseError.
@@ -14173,7 +14173,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Message Read</td></tr></table>
*
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
* On success, the initialization data is provided in the asyncResult.value property as a string.
* If there is no initialization context, the asyncResult object will contain an Error object with its code property
* set to 9020 and its name property set to GenericResponseError.
@@ -14406,7 +14406,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Message Read</td></tr></table>
*
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* @param userContext Optional. Developers can provide any object they wish to access in the callback function.
* This object can be accessed by the asyncResult.asyncContext property in the callback function.
*/
@@ -14435,7 +14435,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -14458,7 +14458,7 @@ declare namespace Office {
* @param handler The function to handle the event. The function must accept a single parameter, which is an object literal.
* The type property on the parameter will match the eventType parameter passed to removeHandlerAsync.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*
* @beta
*/
@@ -14530,7 +14530,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*
* [Api set: Mailbox 1.1]
*
@@ -14552,7 +14552,7 @@ declare namespace Office {
* The location of the appointment is provided as a string in the asyncResult.value property.
*
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*
* [Api set: Mailbox 1.1]
*
@@ -14572,7 +14572,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}. If setting the location fails, the asyncResult.error property will contain an error code.
* type Office.AsyncResult. If setting the location fails, the asyncResult.error property will contain an error code.
*
* [Api set: Mailbox 1.1]
*
@@ -14638,7 +14638,7 @@ declare namespace Office {
*
* @param location The location of the appointment. The string is limited to 255 characters.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}. If setting the location fails, the asyncResult.error property will contain an error code.
* type Office.AsyncResult. If setting the location fails, the asyncResult.error property will contain an error code.
*
* [Api set: Mailbox 1.1]
*
@@ -14770,7 +14770,7 @@ declare namespace Office {
* The type property on the parameter will match the eventType parameter passed to addHandlerAsync.
* @param options Optional. Provides an option for preserving context data of any type, unchanged, for use in a callback.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
addHandlerAsync(eventType: Office.EventType, handler: (type: EventType) => void, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
/**
@@ -15028,7 +15028,7 @@ declare namespace Office {
* isRest: Determines if the token provided will be used for the Outlook REST APIs or Exchange Web Services. Default value is false.
* asyncContext: Any state data that is passed to the asynchronous method.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}. The token is provided as a string in the asyncResult.value property.
* type Office.AsyncResult. The token is provided as a string in the asyncResult.value property.
*/
getCallbackTokenAsync(options: Office.AsyncContextOptions & { isRest?: boolean }, callback: (result: AsyncResult<string>) => void): void;
/**
@@ -15082,7 +15082,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Compose and read</td></tr></table>
*
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}. The token is provided as a string in the asyncResult.value property.
* type Office.AsyncResult. The token is provided as a string in the asyncResult.value property.
* @param userContext Optional. Any state data that is passed to the asynchronous method.
*/
getCallbackTokenAsync(callback: (result: AsyncResult<string>) => void, userContext?: any): void;
@@ -15103,7 +15103,7 @@ declare namespace Office {
* {@link https://msdn.microsoft.com/library/office/fp179828.aspx | authenticate the add-in and user with a third-party system}.
*
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* The token is provided as a string in the asyncResult.value property.
* @param userContext Optional. Any state data that is passed to the asynchronous method.|
*/
@@ -15155,7 +15155,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Compose and read</td></tr></table>
*
* @param data The EWS request.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* The `value` property of the result is the XML of the EWS request provided as a string.
* If the result exceeds 1 MB in size, an error message is returned instead.
* @param userContext Optional. Any state data that is passed to the asynchronous method.
@@ -15269,7 +15269,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*
* [Api set: Mailbox 1.3]
*
@@ -15336,7 +15336,7 @@ declare namespace Office {
* @param JSONmessage A JSON object that contains the notification message to be added to the item.
* It contains a NotificationMessageDetails object.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*
* [Api set: Mailbox 1.3]
*
@@ -15362,7 +15362,7 @@ declare namespace Office {
*
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* The `value` property of the result is an array of NotificationMessageDetails objects.
*/
getAllAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<Office.NotificationMessageDetails[]>) => void): void;
@@ -15376,7 +15376,7 @@ declare namespace Office {
*
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Compose or read</td></tr></table>
*
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type {@link Office.AsyncResult}.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type Office.AsyncResult.
* The `value` property of the result is an array of NotificationMessageDetails objects.
*/
getAllAsync(callback: (result: AsyncResult<Office.NotificationMessageDetails[]>) => void): void;
@@ -15402,7 +15402,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
removeAsync(key: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
/**
@@ -15445,7 +15445,7 @@ declare namespace Office {
*
* @param key The key for the notification message to remove.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
removeAsync(key: string, callback: (result: AsyncResult<void>) => void): void;
/**
@@ -15474,7 +15474,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
/**
@@ -15529,7 +15529,7 @@ declare namespace Office {
* @param JSONmessage A JSON object that contains the new notification message to replace the existing message.
* It contains a NotificationMessageDetails object.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: AsyncResult<void>) => void): void;
}
@@ -15601,7 +15601,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}. If adding the recipients fails, the asyncResult.error property will contain an error code.
* type Office.AsyncResult. If adding the recipients fails, the asyncResult.error property will contain an error code.
*/
addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
/**
@@ -15674,7 +15674,7 @@ declare namespace Office {
*
* @param recipients The recipients to add to the recipients list.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}. If adding the recipients fails, the asyncResult.error property will contain an error code.
* type Office.AsyncResult. If adding the recipients fails, the asyncResult.error property will contain an error code.
*/
addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: AsyncResult<void>) => void): void;
/**
@@ -15696,7 +15696,7 @@ declare namespace Office {
* @param options An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* The `value` property of the result is an array of EmailAddressDetails objects.
*/
getAsync(options: Office.AsyncContextOptions, callback: (result: AsyncResult<Office.EmailAddressDetails[]>) => void): void;
@@ -15713,7 +15713,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Compose</td></tr></table>
*
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* The `value` property of the result is an array of EmailAddressDetails objects.
*/
getAsync(callback: (result: AsyncResult<Office.EmailAddressDetails[]>) => void): void;
@@ -15751,7 +15751,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred
* while adding the data.
*/
@@ -15832,7 +15832,7 @@ declare namespace Office {
*
* @param recipients The recipients to add to the recipients list.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* If setting the recipients fails the asyncResult.error property will contain a code that indicates any error that occurred
* while adding the data.
*/
@@ -15969,7 +15969,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
* The `value` property of the result is a Recurrence object.
*/
getAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<Office.Recurrence>) => void): void;
@@ -15988,7 +15988,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Compose or read</td></tr></table>
*
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
* The `value` property of the result is a Recurrence object.
*/
getAsync(callback?: (result: AsyncResult<Office.Recurrence>) => void): void;
@@ -16016,7 +16016,7 @@ declare namespace Office {
* @param options Optional. An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*/
setAsync(recurrencePattern: Recurrence, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
@@ -16037,7 +16037,7 @@ declare namespace Office {
*
* @param recurrencePattern A recurrence object.
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*/
setAsync(recurrencePattern: Recurrence, callback?: (result: AsyncResult<void>) => void): void;
}
@@ -16128,7 +16128,7 @@ declare namespace Office {
attachments?: ReplyFormAttachment[];
/**
* When the reply display call completes, the function passed in the callback parameter is called with a single parameter,
* asyncResult, which is an {@link Office.AsyncResult} object.
* asyncResult, which is an Office.AsyncResult object.
*/
callback?: (result: AsyncResult<any>) => void;
}
@@ -16199,7 +16199,7 @@ declare namespace Office {
* <tr><td>{@link https://docs.microsoft.com/outlook/add-ins/#extension-points | Applicable Outlook mode}</td><td>Compose or read</td></tr></table>
*
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
*/
saveAsync(callback?: (result: AsyncResult<void>) => void): void;
/**
@@ -16461,7 +16461,7 @@ declare namespace Office {
* @param options An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* The `value` property of the result is the subject of the item.
*/
getAsync(options: Office.AsyncContextOptions, callback: (result: AsyncResult<string>) => void): void;
@@ -16508,7 +16508,7 @@ declare namespace Office {
* @param options An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}. If setting the subject fails, the asyncResult.error property will contain an error code.
* type Office.AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code.
*/
setAsync(subject: string, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
/**
@@ -16566,7 +16566,7 @@ declare namespace Office {
*
* @param subject The subject of the appointment or message. The string is limited to 255 characters.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}. If setting the subject fails, the asyncResult.error property will contain an error code.
* type Office.AsyncResult. If setting the subject fails, the asyncResult.error property will contain an error code.
*/
setAsync(data: string, callback: (result: AsyncResult<void>) => void): void;
@@ -16674,7 +16674,7 @@ declare namespace Office {
* @param options An object literal that contains one or more of the following properties.
* asyncContext: Developers can provide any object they wish to access in the callback method.
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* If setting the date and time fails, the asyncResult.error property will contain an error code.
*/
setAsync(dateTime: Date, options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
@@ -16739,7 +16739,7 @@ declare namespace Office {
*
* @param dateTime A date-time object in Coordinated Universal Time (UTC).
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of
* type {@link Office.AsyncResult}.
* type Office.AsyncResult.
* If setting the date and time fails, the asyncResult.error property will contain an error code.
*/
setAsync(dateTime: Date, callback: (result: AsyncResult<void>) => void): void;
+78 -24
View File
@@ -9,6 +9,7 @@
// Drew Diamantoukos <https://github.com/MercifulCode>
// Sooraj Pudiyadath <https://github.com/soorajpudiyadath>
// Jon Freedman <https://github.com/jonfreedman>
// Megan Riel-Mehan <https://github.com/meganrm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -29,7 +30,7 @@ export interface Point {
export interface PlotScatterDataPoint {
curveNumber: number;
data: ScatterData;
data: PlotData;
pointIndex: number;
pointNumber: number;
x: number;
@@ -49,8 +50,17 @@ export interface PlotCoordinate {
pointNumber: number;
}
export interface SelectionRange {
x: number[];
y: number[];
}
export type PlotSelectedData = Partial<PlotScatterDataPoint>;
export interface PlotSelectionEvent {
points: PlotCoordinate[];
points: PlotScatterDataPoint[];
range?: SelectionRange;
lassoPoints?: SelectionRange;
}
export type PlotRestyleEvent = [
@@ -141,10 +151,10 @@ export interface PlotlyHTMLElement extends HTMLElement {
on(event: 'plotly_sliderend', callback: (event: SliderEndEvent) => void): void;
on(event: 'plotly_sliderstart', callback: (event: SliderStartEvent) => void): void;
on(event: 'plotly_event', callback: (data: any) => void): void;
on(event: 'plotly_beforeplot' , callback: (event: BeforePlotEvent) => boolean): void;
on(event: 'plotly_beforeplot', callback: (event: BeforePlotEvent) => boolean): void;
on(event: 'plotly_afterexport' | 'plotly_afterplot' | 'plotly_animated' | 'plotly_animationinterrupted' | 'plotly_autosize' |
'plotly_beforeexport' | 'plotly_deselect' | 'plotly_doubleclick' | 'plotly_framework' | 'plotly_redraw' |
'plotly_transitioning' | 'plotly_transitioninterrupted' , callback: () => void): void;
'plotly_transitioning' | 'plotly_transitioninterrupted', callback: () => void): void;
}
export interface ToImgopts {
@@ -192,6 +202,14 @@ export interface Layout {
separators: string;
hidesources: boolean;
xaxis: Partial<LayoutAxis>;
xaxis2: Partial<LayoutAxis>;
xaxis3: Partial<LayoutAxis>;
xaxis4: Partial<LayoutAxis>;
xaxis5: Partial<LayoutAxis>;
xaxis6: Partial<LayoutAxis>;
xaxis7: Partial<LayoutAxis>;
xaxis8: Partial<LayoutAxis>;
xaxis9: Partial<LayoutAxis>;
yaxis: Partial<LayoutAxis>;
yaxis2: Partial<LayoutAxis>;
yaxis3: Partial<LayoutAxis>;
@@ -418,12 +436,13 @@ export type TypedArray = Int8Array | Uint8Array | Int16Array | Uint16Array | Int
export type Dash = 'solid' | 'dot' | 'dash' | 'longdash' | 'dashdot' | 'longdashdot';
export type Data = Partial<ScatterData>;
export type Data = Partial<PlotData>;
export type Color = string | Array<string | undefined | null> | Array<Array<string | undefined | null>>;
export type DataTransform = Partial<Transform>;
export type ScatterData = PlotData;
// Bar Scatter
export interface ScatterData {
type: 'bar' | 'pointcloud' | 'scatter' | 'scattergl' | 'scatter3d' |'surface';
export interface PlotData {
type: 'bar' | 'histogram' | 'pointcloud' | 'scatter' | 'scattergl' | 'scatter3d' | 'surface';
x: Datum[] | Datum[][] | TypedArray;
y: Datum[] | Datum[][] | TypedArray;
z: Datum[] | Datum[][] | Datum[][][] | TypedArray;
@@ -438,7 +457,7 @@ export interface ScatterData {
'line.shape': 'linear' | 'spline' | 'hv' | 'vh' | 'hvh' | 'vhv';
'line.smoothing': number;
'line.simplify': boolean;
marker: Partial<ScatterMarker>;
marker: Partial<PlotMarker>;
'marker.symbol': string | string[]; // Drawing.symbolList
'marker.color': Color;
'marker.opacity': number | number[];
@@ -454,15 +473,15 @@ export interface ScatterData {
mode: 'lines' | 'markers' | 'text' | 'lines+markers' | 'text+markers' | 'text+lines' | 'text+lines+markers' | 'none';
hoveron: 'points' | 'fills';
hoverinfo: 'all' | 'name' | 'none' | 'skip' | 'text' |
'x' | 'x+text' | 'x+name' |
'x+y' | 'x+y+text' | 'x+y+name' |
'x+y+z' | 'x+y+z+text' | 'x+y+z+name' |
'y+x' | 'y+x+text' | 'y+x+name' |
'y+z' | 'y+z+text' | 'y+z+name' |
'y+x+z' | 'y+x+z+text' | 'y+x+z+name' |
'z+x' | 'z+x+text' | 'z+x+name' |
'z+y+x' | 'z+y+x+text' | 'z+y+x+name' |
'z+x+y' | 'z+x+y+text' | 'z+x+y+name';
'x' | 'x+text' | 'x+name' |
'x+y' | 'x+y+text' | 'x+y+name' |
'x+y+z' | 'x+y+z+text' | 'x+y+z+name' |
'y+x' | 'y+x+text' | 'y+x+name' |
'y+z' | 'y+z+text' | 'y+z+name' |
'y+x+z' | 'y+x+z+text' | 'y+x+z+name' |
'z+x' | 'z+x+text' | 'z+x+name' |
'z+y+x' | 'z+y+x+text' | 'z+y+x+name' |
'z+x+y' | 'z+x+y+text' | 'z+x+y+name';
hoverlabel: Partial<Label>;
fill: 'none' | 'tozeroy' | 'tozerox' | 'tonexty' | 'tonextx' | 'toself' | 'tonext';
fillcolor: string;
@@ -470,16 +489,48 @@ export interface ScatterData {
name: string;
connectgaps: boolean;
visible: boolean | 'legendonly';
transforms: DataTransform[];
orientation: 'v' | 'h';
}
/**
* These interfaces are based on attribute descriptions in
* https://github.com/plotly/plotly.js/tree/9d6144304308fc3007f0facf2535d38ea3e9b26c/src/transforms
*/
export interface TransformStyle {
target: number | string | number[] | string[];
value: Partial<PlotData>;
}
export interface TransformAggregation {
target: string;
func?: 'count' | 'sum' | 'avg' | 'median' | 'mode' | 'rms' | 'stddev' | 'min' | 'max' | 'first' | 'last';
funcmode?: 'sample' | 'population';
enabled?: boolean;
}
export interface Transform {
type: 'aggregate' | 'filter' | 'groupby' | 'sort';
enabled: boolean;
target: number | string | number[] | string[];
operation: string;
aggregations: TransformAggregation[];
preservegaps: boolean;
groups: string | number[] | string[];
nameformat: string;
styles: TransformStyle[];
value: any;
order: 'ascending' | 'descending';
}
/**
* Any combination of "x", "y", "z", "text", "name" joined with a "+" OR "all" or "none" or "skip".
* examples: "x", "y", "x+y", "x+y+z", "all"
* default: "all"
*/
export interface ScatterMarker {
export interface PlotMarker {
symbol: string | string[]; // Drawing.symbolList
color: Color | number[];
color: Color | Color[];
colorscale: string | string[] | Array<Array<(string | number)>>;
cauto: boolean;
cmax: number;
@@ -495,6 +546,7 @@ export interface ScatterMarker {
sizemode: 'diameter' | 'area';
showscale: boolean;
line: Partial<ScatterMarkerLine>;
width: number;
colorbar: {
thicknessmode: 'fraction' | 'pixels',
thickness: number,
@@ -550,6 +602,8 @@ export interface ScatterMarker {
};
}
export type ScatterMarker = PlotMarker;
export interface ScatterMarkerLine {
width: number | number[];
color: Color;
@@ -1075,10 +1129,10 @@ export interface Transition {
* Sets the easing function of the slider transition
*/
easing: 'linear' | 'quad' | 'cubic' | 'sin' | 'exp' | 'circle' | 'elastic' | 'back' | 'bounce' | 'linear-in' |
'quad-in' | 'cubic-in' | 'sin-in' | 'exp-in' | 'circle-in' | 'elastic-in' | 'back-in' | 'bounce-in' |
'linear-out' | 'quad-out' | 'cubic-out' | 'sin-out' | 'exp-out' | 'circle-out' | 'elastic-out' | 'back-out' |
'bounce-out' | 'linear-in-out' | 'quad-in-out' | 'cubic-in-out' | 'sin-in-out' | 'exp-in-out' |
'circle-in-out' | 'elastic-in-out' | 'back-in-out' | 'bounce-in-out';
'quad-in' | 'cubic-in' | 'sin-in' | 'exp-in' | 'circle-in' | 'elastic-in' | 'back-in' | 'bounce-in' |
'linear-out' | 'quad-out' | 'cubic-out' | 'sin-out' | 'exp-out' | 'circle-out' | 'elastic-out' | 'back-out' |
'bounce-out' | 'linear-in-out' | 'quad-in-out' | 'cubic-in-out' | 'sin-in-out' | 'exp-in-out' |
'circle-in-out' | 'elastic-in-out' | 'back-in-out' | 'bounce-in-out';
}
export interface SliderStep {
+125 -15
View File
@@ -1,32 +1,142 @@
import * as Plotly from 'plotly.js';
import { ScatterData, Layout, PlotlyHTMLElement, newPlot } from 'plotly.js';
import { Layout, PlotData, PlotlyHTMLElement, newPlot } from 'plotly.js';
const graphDiv = '#test';
//////////////////////////////////////////////////////////////////////
// Plotly.newPlot
// combination of https://plot.ly/javascript/multiple-transforms/#all-transforms and
// https://plot.ly/javascript/2d-density-plots/
(() => {
const testrows = [
{
country: "Afghanistan",
year: 2002,
pop: 8425333,
continent: "Asia",
lifeExp: 28.801,
gdpPercap: 779.4453145
},
{
country: "Argentina",
year: 2002,
pop: 38331121,
continent: "Americas",
lifeExp: 74.34,
gdpPercap: 8797.640716
},
{
country: "Australia",
year: 2002,
pop: 13177000,
continent: "Oceania",
lifeExp: 71.93,
gdpPercap: 16788.62948
},
{
country: "Austria",
year: 2002,
pop: 7914969,
continent: "Europe",
lifeExp: 76.04,
gdpPercap: 27042.01868
},
{
country: "Austria",
year: 2001,
pop: 7914969,
continent: "Europe",
lifeExp: 76.04,
gdpPercap: 27042.01868
},
];
interface DataRow {
[key: string]: string | number;
}
function unpack(rows: DataRow[], key: string) {
return rows.map((row: DataRow) => row[key]);
}
const trace1 = {
x: [1999, 2000, 2001, 2002],
y: [10, 15, 13, 17],
type: 'scatter'
} as ScatterData;
mode: 'markers',
x: unpack(testrows, 'lifeExp'),
y: unpack(testrows, 'gdpPercap'),
text: unpack(testrows, 'continent'),
marker: {
size: unpack(testrows, 'pop'),
sizemode: "area",
sizeref: 200000
},
type: 'scatter',
transforms: [
{
type: 'filter',
target: unpack(testrows, 'year'),
operation: '=',
value: '2002'
}, {
type: 'groupby',
nameformat: `%{group}`,
groups: unpack(testrows, 'continent'),
styles: [
{ target: 'Asia', value: { marker: { color: 'red' } } },
{ target: 'Europe', value: { marker: { color: 'blue' } } },
{ target: 'Americas', value: { marker: { color: 'orange' } } },
{ target: 'Africa', value: { marker: { color: 'green' } } },
{ target: 'Oceania', value: { marker: { color: 'purple' } } }
]
}, {
type: 'aggregate',
groups: unpack(testrows, 'continent'),
aggregations: [
{ target: 'x', func: 'avg' },
{ target: 'y', func: 'avg' },
{ target: 'marker.size', func: 'sum' }
]
}]
} as PlotData;
const trace2 = {
x: [1999, 2000, 2001, 2002],
y: [16, 5, 11, 9],
type: 'scatter'
} as ScatterData;
const data = [trace1, trace2];
yaxis: 'y2',
x: unpack(testrows, 'lifeExp'),
name: 'x density',
marker: { color: 'rgb(102,0,0)' },
type: 'histogram'
} as PlotData;
const trace3 = {
xaxis: 'x2',
y: unpack(testrows, 'gdpPercap'),
name: 'y density',
marker: { color: 'rgb(102,0,0)' },
type: 'histogram'
} as PlotData;
const data = [trace1, trace2, trace3];
const layout = {
title: 'Sales Growth',
title: 'Gapminder',
xaxis: {
title: 'Year',
title: 'Life Expectancy',
domain: [0, 0.85],
showgrid: false,
zeroline: false
},
yaxis: {
title: 'Percent',
showline: false
title: 'GDP per Cap',
showline: false,
domain: [0, 0.85],
showgrid: false,
zeroline: false
},
xaxis2: {
domain: [0.85, 1],
showgrid: false,
zeroline: false
},
yaxis2: {
domain: [0.85, 1],
showgrid: false,
zeroline: false
}
};
Plotly.newPlot(graphDiv, data, layout);
@@ -38,7 +148,7 @@ const graphDiv = '#test';
x: [1999, 2000, 2001, 2002],
y: [10, 9, 8, 7],
type: 'scatter'
} as ScatterData];
} as PlotData];
const layout2 = { title: 'Revenue' };
Plotly.newPlot(graphDiv, data2, layout2);
})();
+28 -29
View File
@@ -3,37 +3,36 @@ import { ButtonGroup } from 'react-bootstrap';
import { Omit } from "../index";
declare namespace ToggleButtonGroup {
interface BaseProps {
/**
* You'll usually want to use string|number|string[]|number[] here,
* but you can technically use any|any[].
*/
defaultValue?: any;
/**
* You'll usually want to use string|number|string[]|number[] here,
* but you can technically use any|any[].
*/
value?: any;
}
interface BaseProps {
/**
* You'll usually want to use string|number|string[]|number[] here,
* but you can technically use any|any[].
*/
defaultValue?: any;
/**
* You'll usually want to use string|number|string[]|number[] here,
* but you can technically use any|any[].
*/
value?: any;
}
interface RadioProps {
/** Required if `type` is set to "radio" */
name: string;
type: "radio";
onChange?(value: any): void;
}
interface RadioProps {
/** Required if `type` is set to "radio" */
name: string;
type: "radio";
onChange?(value: any): void;
}
interface CheckboxProps {
name?: string;
type: "checkbox";
onChange?(values: any[]): void;
}
export type ToggleButtonGroupProps = BaseProps
& (RadioProps | CheckboxProps)
& Omit<React.HTMLProps<ToggleButtonGroup>, "defaultValue" | "type" | "value">
& Omit<React.HTMLProps<ToggleButtonGroup>, "defaultValue" | "type" | "value" | "onChange">;
interface CheckboxProps {
name?: string;
type: "checkbox";
onChange?(values: any[]): void;
}
export type ToggleButtonGroupProps = BaseProps
& (RadioProps | CheckboxProps)
& Omit<ButtonGroup.ButtonGroupProps, "onChange">
& Omit<React.HTMLProps<ToggleButtonGroup>, "defaultValue" | "type" | "value" | "onChange">;
}
declare class ToggleButtonGroup extends React.Component<ToggleButtonGroup.ToggleButtonGroupProps & ButtonGroup.ButtonGroupProps> { }
declare class ToggleButtonGroup extends React.Component<ToggleButtonGroup.ToggleButtonGroupProps> { }
export = ToggleButtonGroup;
@@ -210,8 +210,20 @@ export class ReactBootstrapIndividualComponentsTest extends React.Component {
<Tabs />
<Thumbnail />
<ToggleButton value="foo" bsSize="small" />
<ToggleButtonGroup type="checkbox" bsSize="small" />
<ToggleButtonGroup type="radio" name="foo" />
<ToggleButtonGroup
type="checkbox"
bsSize="small"
defaultValue={[1]}
value={[1, 2]}
onChange={(value: number[]) => { }}
/>
<ToggleButtonGroup
type="radio"
name="foo"
defaultValue={1}
value={1}
onChange={(value: number) => { }}
/>
<Tooltip />
<Well />
</div>
+3 -1
View File
@@ -1193,7 +1193,9 @@ export const HeaderBackButton: React.ComponentClass<HeaderBackButtonProps>;
/**
* Header Component
*/
export const Header: React.ComponentClass<HeaderProps>;
export class Header extends React.Component<HeaderProps> {
static HEIGHT: number;
}
export interface NavigationInjectedProps<P = NavigationParams> {
navigation: NavigationScreenProp<NavigationState, P>;
@@ -375,6 +375,8 @@ class CustomTransitioner extends React.Component<CustomTransitionerProps, null>
/**
* Header
*/
const height = Header.HEIGHT;
function renderHeaderBackButton(schema: string): JSX.Element {
switch (schema) {
case 'compact':
+26
View File
@@ -0,0 +1,26 @@
// Type definitions for react-vertical-timeline-component 2.1
// Project: https://github.com/stephane-monnot/react-vertical-timeline
// Definitions by: Stéphane Monnot <https://github.com/stephane-monnot>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from "react";
export interface VerticalTimelineProps {
animate?: boolean;
className?: string;
}
export interface VerticalTimelineElementProps {
id?: string;
className?: string;
date?: string;
iconOnClick?: () => void;
iconStyle?: React.CSSProperties;
icon?: React.ReactNode;
position?: string;
style?: React.CSSProperties;
}
export class VerticalTimeline extends React.Component<VerticalTimelineProps> { }
export class VerticalTimelineElement extends React.Component<VerticalTimelineElementProps> { }
@@ -0,0 +1,29 @@
import * as React from "react";
import { VerticalTimeline, VerticalTimelineElement } from "react-vertical-timeline-component";
export default class ReactVerticalTimelineComponentTests extends React.Component {
render() {
return (
<VerticalTimeline animate={false} className="vertical-timeline--red">
<VerticalTimelineElement
iconOnClick={() => console.info('icon has been clicked')}
className="vertical-timeline-element--work"
date="2012 - present"
>
<h3 className="vertical-timeline-element-title">Creative Director</h3>
<h4 className="vertical-timeline-element-subtitle">Miami, FL</h4>
<p>
Creative Direction, User Experience, Visual Design, Project Management, Team Leading
</p>
</VerticalTimelineElement>
<VerticalTimelineElement className="vertical-timeline-element--work" date="2011 - present">
<h3 className="vertical-timeline-element-title">Art Director</h3>
<h4 className="vertical-timeline-element-subtitle">San Francisco, CA</h4>
<p>
Creative Direction, User Experience, Visual Design, SEO, Online Marketing
</p>
</VerticalTimelineElement>
</VerticalTimeline>
);
}
}
@@ -0,0 +1,28 @@
{
"files": [
"index.d.ts"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"jsx": "react",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-vertical-timeline-component-tests.tsx"
]
}
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+3 -3
View File
@@ -15,9 +15,9 @@ declare namespace SequelizeCursorPagination {
}
interface BasicPaginateOptions<T> {
where?: Sequelize.WhereOptions<T> | Sequelize.where | Sequelize.fn | Array<Sequelize.col | Sequelize.and | Sequelize.or | string>;
attributes?: Sequelize.FindOptionsAttributesArray | { include?: Sequelize.FindOptionsAttributesArray, exclude?: string[] };
include?: Array<Sequelize.Model<any, any> | Sequelize.IncludeOptions>;
where?: Sequelize.FindOptions<T>['where'];
attributes?: Sequelize.FindOptions<T>['attributes'];
include?: Sequelize.FindOptions<T>['include'];
limit?: number; // limit the number of records returned
desc?: boolean; // [default: false]
before?: string; // the before cursor
+4 -2
View File
@@ -8,10 +8,12 @@
declare module "set-cookie-parser" {
import http = require("http");
function SetCookieParser(input: string | string[] | http.IncomingMessage): SetCookieParser.Cookie[];
function SetCookieParser(input: string | ReadonlyArray<string> | http.IncomingMessage): SetCookieParser.Cookie[];
namespace SetCookieParser {
function parse(input: string | string[] | http.IncomingMessage): Cookie[];
function parse(input: string | ReadonlyArray<string> | http.IncomingMessage): Cookie[];
function splitCookiesString(input: string | ReadonlyArray<string> | void): string[];
interface Cookie {
name: string;
@@ -65,3 +65,26 @@ var optionalIncludedCookie: setCookie.Cookie = {
httpOnly: true,
secure: true
};
var cookiesString = setCookie.splitCookiesString(null)
assert.deepStrictEqual(cookiesString, [])
cookiesString = setCookie.splitCookiesString([])
assert.deepStrictEqual(cookiesString, [])
cookiesString = setCookie.splitCookiesString([
'foo=bar; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure',
'baz=buz; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure',
])
assert.deepStrictEqual(cookiesString, [
'foo=bar; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure',
'baz=buz; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure',
])
cookiesString = setCookie.splitCookiesString(
'foo=bar; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure, baz=buz; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure',
)
assert.deepStrictEqual(cookiesString, [
'foo=bar; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure',
'baz=buz; Max-Age=1000; Domain=.example.com; Path=/; Expires=Tue, 01 Jul 2025 10:01:11 GMT; HttpOnly; Secure',
])
+1 -3
View File
@@ -1409,9 +1409,7 @@ declare namespace Sinon {
*
* @template TType Type being stubbed.
*/
interface StubbableType<TType> {
new(...args: any[]): TType;
}
type StubbableType<TType> = Function & { prototype: TType };
/**
* An instance of a stubbed object type with functions replaced by stubs.
+23 -11
View File
@@ -67,14 +67,26 @@ function testSandbox() {
sb.replaceSetter(replaceMe, 'setter', (v) => { });
const cls = class {
foo() {}
foo() { }
bar: number;
};
const PrivateFoo = class {
private constructor() { }
foo() { }
bar: number;
static create() {
return new PrivateFoo();
}
};
const stubInstance = sb.createStubInstance(cls);
const privateFooStubbedInstance = sb.createStubInstance(PrivateFoo);
stubInstance.foo.calledWith('foo');
privateFooStubbedInstance.foo.calledWith('foo');
const clsFoo: sinon.SinonStub = stubInstance.foo;
const privateFooFoo: sinon.SinonStub = privateFooStubbedInstance.foo;
const clsBar: number = stubInstance.bar;
const privateFooBar: number = privateFooStubbedInstance.bar;
}
function testFakeServer() {
@@ -106,7 +118,7 @@ function testXHR() {
sinon.FakeXMLHttpRequest.useFilters = true;
sinon.FakeXMLHttpRequest.addFilter((method, url, async, user, pass) => true);
sinon.FakeXMLHttpRequest.onCreate = (xhr) => {};
sinon.FakeXMLHttpRequest.onCreate = (xhr) => { };
sinon.FakeXMLHttpRequest.restore();
}
@@ -117,7 +129,7 @@ function testClock() {
let now = 0;
now = clock.now;
const fn = () => {};
const fn = () => { };
clock.setTimeout(fn, 0);
clock.setTimeout(fn, 0, 'a', 'b');
@@ -173,7 +185,7 @@ function testExpectation() {
function testMatch() {
const obj = {};
const fn = () => {};
const fn = () => { };
sinon.match(5).test(5);
sinon.match('str').test('foo');
@@ -216,7 +228,7 @@ function testMatch() {
}
function testFake() {
const fn = () => {};
const fn = () => { };
let fake = sinon.fake();
fake = sinon.fake(() => true);
@@ -277,9 +289,9 @@ function testAssert() {
}
function testSpy() {
const fn = () => {};
const fn = () => { };
const obj = class {
foo() {}
foo() { }
};
const instance = new obj();
@@ -369,14 +381,14 @@ function testSpy() {
function testStub() {
const obj = class {
foo() {}
foo() { }
};
const instance = new obj();
let stub = sinon.stub();
stub = sinon.stub(instance, 'foo');
const spy: sinon.SinonSpy = stub;
const spy: sinon.SinonSpy = stub;
sinon.stub(instance);
@@ -408,9 +420,9 @@ function testStub() {
stub.callsArgOnAsync(1, instance);
stub.callsArgWithAsync(1, 'a', 2);
stub.callsArgOnWithAsync(1, instance, 'a', 2);
stub.callsFake(() => {});
stub.callsFake(() => { });
stub.get(() => true);
stub.set((v) => {});
stub.set((v) => { });
stub.onCall(1).returns(true);
stub.onFirstCall().resolves('foo');
stub.onSecondCall().resolves('foo');
+26
View File
@@ -0,0 +1,26 @@
// Type definitions for string-format 2.0
// Project: https://github.com/davidchambers/string-format
// Definitions by: Luca Lindhorst <https://github.com/lal12>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function Format(template: string, ...args: Array<({ [k: string]: any } | string)>): string;
interface Transformers {
[k: string]: (s: any) => string;
}
declare namespace Format {
/**
* create a format function with given transformers
* @param transformers functions which convert a string, indexed by a name
*/
function create(transformers: Transformers): (typeof Format);
/**
* @param prototype prototype which should be extended by format (usually String.prototype)
* @param transformers functions which convert a string, indexed by a name
*/
function extend(prototype: any, transformers: Transformers): void;
}
export = Format;
@@ -0,0 +1,11 @@
import Format = require("string-format");
Format.extend(String.prototype, {});
const fmt = Format.create({
upper: (s: string) => s.toUpperCase()
});
fmt("Hallo {name!upper}, you are {age} years old!", { name: "Somebody", age: 10 });
Format("Hallo {name}, you are {age} years old!", { name: "Somebody", age: 10 });
+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",
"string-format-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+5 -1
View File
@@ -1,4 +1,8 @@
type Tag = (chunks: TemplateStringsArray, ...args: any[]) => string;
type Tag = {
(chunks: TemplateStringsArray, ...args: any[]): string;
global: (chunks: TemplateStringsArray, ...args: any[]) => string;
resolve: (chunks: TemplateStringsArray, ...args: any[]) => { className: string; styles: string };
};
declare let css: Tag;
export = css;
+23
View File
@@ -26,6 +26,29 @@ const withSeparatedCSS = (
</div>
);
const globalCSS = css.global`body { margin: 0; }`;
const withGlobalCSS = (
<div>
<style jsx global>{globalCSS}</style>
</div>
);
const resolvedCSS = css.resolve`a { color: green; }`;
const withResolvedCSS = (
<div>
<button className={resolvedCSS.className}>About</button>
{resolvedCSS.styles}
</div>
);
const dynamicResolvedCSS = css.resolve`a { color: ${buttonColor}; }`;
const withDynamicResolvedCSS = (
<div>
<button className={dynamicResolvedCSS.className}>About</button>
{dynamicResolvedCSS.styles}
</div>
);
const stylesChildren = flushToReact();
const jsxToRender = (
<head>{ stylesChildren }</head>
+18 -3
View File
@@ -2628,7 +2628,8 @@ declare namespace videojs {
* the listener function; otherwise, _all_ listeners bound to the
* event type(s) will be removed.
*/
off(targetOrType?: string | string[], typeOrListener?: (...args: any[]) => void, listener?: (...args: any[]) => void): void;
off(target?: Component | Element, type?: string | string[], listener?: (...args: any[]) => void): void;
off(type?: string | string[], listener?: (...args: any[]) => void): void;
/**
* Add a listener to an event (or events) on this object or another evented
@@ -2653,7 +2654,8 @@ declare namespace videojs {
* If the first argument was another evented object, this will be
* the listener function.
*/
on(targetOrType: string | string[], typeOrListener: (...args: any[]) => void, listener?: (...args: any[]) => void): void;
on(target?: Component | Element, type?: string | string[], listener?: (...args: any[]) => void): void;
on(type?: string | string[], listener?: (...args: any[]) => void): void;
/**
* Add a listener to an event (or events) on this object or another evented
@@ -2678,7 +2680,8 @@ declare namespace videojs {
* If the first argument was another evented object, this will be
* the listener function.
*/
one(targetOrType: string | string[], typeOrListener: (...args: any[]) => void, listener?: (...args: any[]) => void): void;
one(target?: Component | Element, type?: string | string[], listener?: (...args: any[]) => void): void;
one(type?: string | string[], listener?: (...args: any[]) => void): void;
/**
* Fire an event on this evented object, causing its listeners to be called.
@@ -3764,6 +3767,18 @@ declare namespace videojs {
autoplay(): boolean | string;
/**
* Get the remote {@link TextTrackList}
* @return The current remote text track list
*/
textTracks(): TextTrackList;
/**
* Get the remote {@link TextTrackList}
* @return The current remote text track list
*/
remoteTextTracks(): TextTrackList;
/**
* Create a remote {@link TextTrack} and an {@link HTMLTrackElement}. It will
* automatically removed from the video element whenever the source changes, unless
+60 -32
View File
@@ -2376,7 +2376,7 @@ declare namespace wx {
* (初始时,选择器仅选取页面范围的节点,不会选取任何自定义组件中的节点
* @version 1.6.0
*/
in(component: Component<object>): SelectorQuery;
in(component: Component<object, object>): SelectorQuery;
/**
* 在当前页面下选择第一个匹配选择器selector的节点,返回一个NodesRef对象实例,可以用于获取节点信息。
* selector类似于CSS的选择器,但仅支持下列语法。
@@ -3313,68 +3313,79 @@ declare function App<T extends AppOptions>(app: T & ThisType<T & App>): void;
declare function getApp(): App;
// #endregion
// #region Compontent组件
type DefaultData<V> = object | ((this: V) => object);
type DefaultProps = Record<string, any>;
type DefaultProps = object | Record<string, any>;
type ExtendedComponent<
Instance extends Component<Data>,
Instance extends Component<Data, Props>,
Data,
Methods,
Options,
Props
> = CombinedInstance<Instance, Data, Methods, Options, Props> & Component<Data>;
> = CombinedInstance<Instance, Data, Methods, Options, Props> &
Component<Data, Props>;
// CombinedInstance models the `this`, i.e. instance type for (user defined) component
type CombinedInstance<
Instance extends Component<Data>,
Instance extends Component<Data, Props>,
Data,
Methods,
Options,
Props
> = Data & Methods & Options & Props & Instance;
> = Methods & Options & Instance;
type Prop<T> = (() => T) | { new (...args: any[]): T & object };
type PropValidator<T> = PropOptions<T> | Prop<T> | Array<Prop<T>>;
interface DefaultMethods<V> {
[key: string]: (this: V, ...args: any[]) => any;
}
interface PropOptions<T = any> {
type?: Prop<T> | Array<Prop<T>>;
value?: T | null | (() => object);
observer?(value: T, old: T): void;
// bug : 对于 type 为 Object 或 Array 的属性,如果通过该组件自身的 this.setData
// 来改变属性值的一个子字段,则依旧会触发属性 observer ,且 observer 接收到的 newVal 是变化的那个子字段的值,
// oldVal 为空, changedPath 包含子字段的字段名相关信息。
observer?(value: T, old: T, changedPath: string): void;
}
type RecordPropsDefinition<T> = { [K in keyof T]: PropValidator<T[K]> };
type ArrayPropsDefinition<T> = Array<keyof T>;
type PropsDefinition<T> = ArrayPropsDefinition<T> | RecordPropsDefinition<T>;
type ThisTypedComponentOptionsWithRecordProps<
V extends Component<Data>,
V extends Component<Data, Props>,
Data,
Methods,
Options,
Props
> = object &
ComponentOptions<
V,
Data | ((this: Readonly<Props> & V) => Data),
Methods,
Options,
PropsDefinition<Props>
> &
ComponentOptions<V, Data | ((this: V) => Data), Methods, Options, Props> &
ThisType<CombinedInstance<V, Data, Methods, Options, Readonly<Props>>>;
interface ComponentRelation {
interface ComponentRelation<T = any> {
/** 目标组件的相对关系,可选的值为 parent 、 child 、 ancestor 、 descendant */
type: string;
type: "parent" | "child" | "ancestor" | "descendant";
/** 如果这一项被设置,则它表示关联的目标节点所应具有的behavior,所有拥有这一behavior的组件节点都会被关联 */
target?: string;
/** 关系生命周期函数,当关系被建立在页面节点树中时触发,触发时机在组件attached生命周期之后 */
linked?: (...args: any[]) => void;
linked?: (target: Component<T>) => void;
/** 关系生命周期函数,当关系在页面节点树中发生改变时触发,触发时机在组件moved生命周期之后 */
linkChanged?: (...args: any[]) => void;
linkChanged?: (target: Component<T>) => void;
/** 关系生命周期函数,当关系脱离页面节点树时触发,触发时机在组件detached生命周期之后 */
unlinked?: (...args: any[]) => void;
unlinked?: (target: Component<T>) => void;
}
/**
* Component组件参数
*/
interface ComponentOptions<
Instance extends Component<Data>,
Instance extends Component<Data, Props>,
Data = DefaultData<Instance>,
Methods = DefaultMethods<Instance>,
Options = object,
@@ -3404,7 +3415,7 @@ interface ComponentOptions<
* 类似于mixins和traits的组件间代码复用机制
* 参见 [behaviors](https://mp.weixin.qq.com/debug/wxadoc/dev/framework/custom-component/behaviors.html)
*/
behaviors?: Array<(ComponentOptions<Component<object>>) | string>;
behaviors?: Array<(ComponentOptions<Component<object, object>>) | string>;
/**
* 组件生命周期函数,在组件实例进入页面节点树时执行
* 注意此时不能调用 setData
@@ -3439,7 +3450,7 @@ interface ComponentOptions<
/**
* Component实例方法
*/
interface Component<T> {
interface Component<D, P> {
/**
* 组件的文件路径
*/
@@ -3455,7 +3466,12 @@ interface Component<T> {
/**
* 组件数据,包括内部数据和属性值
*/
data: T;
data: D & P;
/**
* 组件数据,包括内部数据和属性值(与 data 一致)
*/
properties: D & P;
/**
* 将数据从逻辑层发送到视图层,同时改变对应的 this.data 的值
* 1. 直接修改 this.data 而不调用 this.setData 是无法改变页面的状态的,还会造成数据不一致。
@@ -3466,7 +3482,7 @@ interface Component<T> {
*/
setData(
data: {
[key in keyof T]?:
[key in keyof D]?:
| string
| number
| boolean
@@ -3503,19 +3519,25 @@ interface Component<T> {
* 使用选择器选择组件实例节点
* 返回匹配到的第一个组件实例对象
*/
selectComponent(selector: string): Component<any>;
selectComponent(selector: string): Component<any, any>;
/**
* selector 使用选择器选择组件实例节点,返回匹配到的全部组件实例对象组成的数组
*/
selectAllComponents(selector: string): Array<Component<any>>;
selectAllComponents(selector: string): Array<Component<any, any>>;
/**
* 获取所有这个关系对应的所有关联节点,参见 [组件间关系](https://mp.weixin.qq.com/debug/wxadoc/dev/framework/custom-component/relations.html)
*/
getRelationNodes(relationKey: string): { [key: string]: ComponentRelation };
getRelationNodes(relationKey: string): ComponentRelation[];
}
declare function Component<D, M, O, P>(
options?: ThisTypedComponentOptionsWithRecordProps<Component<D>, D, M, O, P>
): ExtendedComponent<Component<D>, D, M, O, P>;
options?: ThisTypedComponentOptionsWithRecordProps<
Component<D, P>,
D,
M,
O,
P
>
): ExtendedComponent<Component<D, P>, D, M, O, P>;
/**
* behaviors 是用于组件间代码共享的特性
* 类似于一些编程语言中的“mixins”或“traits”
@@ -3525,8 +3547,14 @@ declare function Component<D, M, O, P>(
* behavior 也可以引用其他 behavior
*/
declare function Behavior<D, M, O, P>(
options?: ThisTypedComponentOptionsWithRecordProps<Component<D>, D, M, O, P>
): ExtendedComponent<Component<D>, D, M, O, P>;
options?: ThisTypedComponentOptionsWithRecordProps<
Component<D, P>,
D,
M,
O,
P
>
): ExtendedComponent<Component<D, P>, D, M, O, P>;
// #endregion
// #region Page
interface PageShareAppMessageOptions {
+20 -2
View File
@@ -21,7 +21,7 @@ let behavior = Behavior({
attached() {},
methods: {
myBehaviorMethod() {
this.myBehaviorData;
this.properties.myBehaviorData;
}
}
});
@@ -34,7 +34,12 @@ Component({
// 属性名
type: String, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
value: "", // 属性初始值(可选),如果未指定则会根据类型选择一个
observer(newVal: string, oldVal: string) {} // 属性被改变时执行的函数(可选),也可以写成在methods段中定义的方法名字符串, 如:'_propertyChange'
observer(newVal: string, oldVal: string, changedPath: string) {
const anotherKey = newVal + changedPath;
this.setData({
anotherKey
});
} // 属性被改变时执行的函数(可选),也可以写成在methods段中定义的方法名字符串, 如:'_propertyChange'
},
myProperty2: String // 简化的定义方式
},
@@ -50,6 +55,16 @@ Component({
moved() {},
detached() {},
methods: {
readMyDataAndMyProps() {
this.data.myProperty;
this.data.myProperty2;
this.data.key;
this.data.anotherKey;
this.properties.myProperty;
this.properties.myProperty2;
this.properties.key;
this.properties.anotherKey;
},
onMyButtonTap() {
// 更新属性和数据的方法与更新页面数据的方法类似
this.setData({
@@ -73,12 +88,15 @@ Component({
type: "parent", // 关联的目标节点应为父节点
linked(target) {
// 每次被插入到custom-ul时执行,target是custom-ul节点实例对象,触发在attached生命周期之后
target.data;
},
linkChanged(target) {
// 每次被移动后执行,target是custom-ul节点实例对象,触发在moved生命周期之后
target.data;
},
unlinked(target) {
// 每次被移除时执行,target是custom-ul节点实例对象,触发在detached生命周期之后
target.data;
}
}
}
+135
View File
@@ -0,0 +1,135 @@
// Type definitions for wink-tokenizer 4.0
// Project: http://winkjs.org/
// Definitions by: Luca Lindhorst <https://github.com/lal12>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Tokenizer {
/**
* create a tokenizer instance
*/
constructor();
/**
* Tokenize a string
* @param sentence to be tokenized
* @returns tokens
*/
tokenize(sentence: string): Tokenizer.Token[];
/**
* Defines the configuration in terms of the types of token that will be extracted by tokenize() method.
* Note by default, all types of tokens will be detected and tagged automatically.
* @param config configuration object
* @returns number of true parameters
*/
defineConfig(config: Tokenizer.Config): number;
/**
* Returns the finger print of the tokens generated by the last call to tokenize().
* A finger print is a string created by sequentially joining the unique code of each token's type.
*
* currency: 'r', email: 'e', emoji: 'j', emoticon: 'c',
* hashtag: 'h', number: 'n', ordinal: 'o',
* punctuation: token becomes fingerprint,
* quoted_phrase: 'q', symbol: token becomes fingerprint,
* time: 't', mention: 'm', url: 'u', word: 'w',
* @return string of token types
*/
getTokensFP(): string;
}
declare namespace Tokenizer {
type Tag = "word" | "email" | "emoji" | "punctuation"
| "number" | "time" | "hashtag" | "mention" | "emoticon" | "ordinal"
| "quoted_phrase" | "url" | "symbol" | "currency" | "alien";
interface Token {
value: string;
tag: Tag;
}
/**
* It defines 0 or more properties from the list of 14 properties.
* A true value for a property ensures tokenization for that type of text;
* whereas false value will mean that the tokenization of that type of text will not be attempted.
*
* An empty config object is equivalent to splitting on spaces.
* Whatever tokens are created like this are tagged as alien
* and z is the finger print code of this token type.
*/
interface Config {
/**
* such as $ or £ symbols
* @default true
*/
currency?: boolean;
/**
* @default true
*/
email?: boolean;
/**
* @default true
*/
emoji?: boolean;
/**
* @default true
*/
emoticon?: boolean;
/**
* @default true
*/
hashtag?: boolean;
/**
* @default true
*/
number?: boolean;
/**
* ordinals like 1st , 2nd , 3rd , 4th or 12th or 91st
* @default true
*/
ordinal?: boolean;
/**
* @default true
*/
punctuation?: boolean;
/**
* @default true
*/
quoted_phrase?: boolean;
/**
* @default true
*/
symbol?: boolean;
/**
* @default true
*/
time?: boolean;
/**
* @default true
*/
mention?: boolean;
/**
* @default true
*/
url?: boolean;
/**
* @default true
*/
word?: boolean;
}
}
export = Tokenizer;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"wink-tokenizer-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,11 @@
import * as Tokenizer from "wink-tokenizer";
const tokenizer = new Tokenizer();
tokenizer.defineConfig({
currency: false
});
tokenizer.tokenize("asd asd asd ads");
tokenizer.getTokensFP();
+28 -21
View File
@@ -1,25 +1,32 @@
// Type definitions for winston-syslog 1.0
// Project: https://github.com/indexzero/winston-syslog#readme
// Definitions by: Chris Barth <https://github.com/cjbarth>
// Type definitions for winston-syslog 2.0
// Project: https://github.com/winstonjs/winston-syslog
// Definitions by: Chris Barth <https://github.com/cjbarth>, Felix Hochgruber <https://github.com/felix-hoc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as winston from "winston";
export interface SyslogTransportOptions extends winston.GenericTextTransportOptions {
host?: string;
port?: number;
path?: string;
protocol?: string;
pid?: number;
facility?: string;
localhost?: string;
type?: string;
app_name?: string;
eol?: string;
import * as Transport from 'winston-transport';
import * as dgram from 'dgram';
import * as net from 'net';
export interface SyslogTransportOptions extends Transport.TransportStreamOptions {
host?: string;
port?: number;
path?: string;
protocol?: string;
pid?: number;
facility?: string;
localhost?: string;
type?: string;
app_name?: string;
eol?: string;
}
export class Syslog extends winston.Transport implements winston.TransportInstance {
}
declare module "winston" {
interface Transports {
Syslog: Syslog;
}
export interface SyslogTransportInstance extends Transport {
producer: any;
socket: dgram.Socket | net.Socket;
connect(callback: (err: (true | null)) => any): void;
new(options?: SyslogTransportOptions): SyslogTransportInstance;
}
export const Syslog: SyslogTransportInstance;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"private": true,
"dependencies": {
"@types/winston": "^2.3.9"
"winston": "^3.0.0"
}
}
+2 -2
View File
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
@@ -21,4 +21,4 @@
"index.d.ts",
"winston-syslog-tests.ts"
]
}
}
+6 -1
View File
@@ -1,3 +1,8 @@
{
"extends": "dtslint/dt.json"
"extends": "dtslint/dt.json",
"rules": {
// This allows to be in line with winston transport types.
// See https://github.com/winstonjs/winston-mongodb/blob/master/lib/winston-mongodb.d.ts and https://github.com/winstonjs/winston-daily-rotate-file/blob/master/index.d.ts
"no-misused-new": false
}
}
+26
View File
@@ -0,0 +1,26 @@
// Type definitions for winston-syslog 1.0
// Project: https://github.com/indexzero/winston-syslog#readme
// Definitions by: Chris Barth <https://github.com/cjbarth>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
import * as winston from "winston";
export interface SyslogTransportOptions extends winston.GenericTextTransportOptions {
host?: string;
port?: number;
path?: string;
protocol?: string;
pid?: number;
facility?: string;
localhost?: string;
type?: string;
app_name?: string;
eol?: string;
}
export class Syslog extends winston.Transport implements winston.TransportInstance {
}
declare module "winston" {
interface Transports {
Syslog: Syslog;
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"@types/winston": "2.3.9"
}
}
+32
View File
@@ -0,0 +1,32 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"types": [],
"paths": {
"winston-syslog": [
"winston-syslog/v1"
],
"winston-syslog/*": [
"winston-syslog/v1/*"
]
},
"noEmit": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"winston-syslog-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
@@ -0,0 +1,35 @@
import winston = require('winston');
import { SyslogTransportOptions } from 'winston-syslog';
const str = "";
const bool = true;
const num = 1;
const obj: any = {};
const syslogOptions: SyslogTransportOptions = {
host: str,
port: num,
path: str,
protocol: str,
pid: num,
facility: str,
localhost: str,
type: str,
app_name: str,
eol: str,
json: bool,
colorize: bool,
colors: str,
prettyPrint: bool,
showLevel: bool,
label: str,
depth: num,
};
winston.add(winston.transports.Syslog, syslogOptions);
const logger: winston.LoggerInstance = new (winston.Logger)({
transports: [
new (winston.transports.Syslog)(syslogOptions),
]
});
+7 -12
View File
@@ -1,5 +1,5 @@
import winston = require('winston');
import { SyslogTransportOptions } from 'winston-syslog';
import { Syslog, SyslogTransportOptions } from 'winston-syslog';
const str = "";
const bool = true;
@@ -16,20 +16,15 @@ const syslogOptions: SyslogTransportOptions = {
localhost: str,
type: str,
app_name: str,
eol: str,
json: bool,
colorize: bool,
colors: str,
prettyPrint: bool,
showLevel: bool,
label: str,
depth: num,
eol: str
};
winston.add(winston.transports.Syslog, syslogOptions);
const syslogTransport = new Syslog(syslogOptions);
const logger: winston.LoggerInstance = new (winston.Logger)({
winston.add(syslogTransport);
const logger: winston.Logger = winston.createLogger({
transports: [
new (winston.transports.Syslog)(syslogOptions),
syslogTransport
]
});