Merge branch 'master' into feature/jest_each

This commit is contained in:
Paweł Mikołajczyk
2018-06-16 15:25:07 +02:00
committed by GitHub
156 changed files with 12391 additions and 5091 deletions
+1
View File
@@ -9,6 +9,7 @@
import * as angular from 'angular';
export type gettextCatalog = angular.gettext.gettextCatalog;
declare module 'angular' {
export namespace gettext {
+4
View File
@@ -8,6 +8,10 @@
import * as angular from 'angular';
export type ILocalStorageServiceProvider = angular.local.storage.ILocalStorageServiceProvider;
export type ILocalStorageService = angular.local.storage.ILocalStorageService;
export type ICookie = angular.local.storage.ICookie;
declare module 'angular' {
export namespace local.storage {
interface ILocalStorageServiceProvider extends angular.IServiceProvider {
File diff suppressed because it is too large Load Diff
+419 -215
View File
@@ -1,10 +1,9 @@
// Type definitions for Angular JS (ngMock, ngMockE2E module) 1.5
// Type definitions for Angular JS (ngMock, ngMockE2E module) 1.6
// Project: http://angularjs.org
// Definitions by: Diego Vilar <https://github.com/diegovilar>, Tony Curtis <https://github.com/daltin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.4
/// <reference types="angular" />
/// <reference path="mocks.d.ts" />
import * as angular from 'angular';
@@ -13,7 +12,6 @@ import * as angular from 'angular';
// ngMock module (angular-mocks.js)
///////////////////////////////////////////////////////////////////////////////
declare module 'angular' {
///////////////////////////////////////////////////////////////////////////
// AngularStatic
// We reopen it to add the MockStatic definition
@@ -23,27 +21,27 @@ declare module 'angular' {
}
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.inject
// Depending on context, it might return a function, however having `void | (() => void)`
// as a return type seems to be not useful. E.g. it requires type assertions in `beforeEach(inject(...))`.
interface IInjectStatic {
(...fns: Function[]): any;
(...inlineAnnotatedConstructor: any[]): any; // this overload is undocumented, but works
strictDi(val?: boolean): void;
(...fns: Array<Injectable<(...args: any[]) => void>>): any; // void | (() => void);
strictDi(val?: boolean): any; // void | (() => void);
}
interface IMockStatic {
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.dump
dump(obj: any): string;
inject: IInjectStatic
inject: IInjectStatic;
// see https://docs.angularjs.org/api/ngMock/function/angular.mock.module
module: {
(...modules: any[]): any;
sharedInjector(): void;
}
};
// see https://docs.angularjs.org/api/ngMock/type/angular.mock.TzDate
TzDate(offset: number, timestamp: number): Date;
TzDate(offset: number, timestamp: string): Date;
TzDate(offset: number, timestamp: number | string): Date;
}
///////////////////////////////////////////////////////////////////////////
@@ -62,7 +60,6 @@ declare module 'angular' {
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
flush(delay?: number): void;
flushNext(expectedDelay?: number): void;
verifyNoPendingTasks(): void;
}
@@ -96,9 +93,11 @@ declare module 'angular' {
///////////////////////////////////////////////////////////////////////////
interface IControllerService {
// Although the documentation doesn't state this, locals are optional
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any, bindings?: any): T;
<T>(controllerConstructor: (...args: any[]) => T, locals?: any, bindings?: any): T;
<T>(controllerName: string, locals?: any, bindings?: any): T;
<T>(
controllerConstructor: (new (...args: any[]) => T) | ((...args: any[]) => T) | string,
locals?: any,
bindings?: any
): T;
}
///////////////////////////////////////////////////////////////////////////
@@ -108,268 +107,473 @@ declare module 'angular' {
interface IComponentControllerService {
// TBinding is an interface exposed by a component as per John Papa's style guide
// https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md#accessible-members-up-top
<T, TBinding>(componentName: string, locals: { $scope?: IScope, [key: string]: any }, bindings?: TBinding, ident?: string): T;
<T, TBinding>(
componentName: string,
locals: { $scope?: IScope; [key: string]: any },
bindings?: TBinding,
ident?: string
): T;
}
///////////////////////////////////////////////////////////////////////////
// HttpBackendService
// see https://docs.angularjs.org/api/ngMock/service/$httpBackend
///////////////////////////////////////////////////////////////////////////
interface IHttpBackendService {
/**
* Flushes pending requests using the trained responses. Requests are flushed in the order they were made, but it is also possible to skip one or more requests (for example to have them flushed later). This is useful for simulating scenarios where responses arrive from the server in any order.
*
* If there are no pending requests to flush when the method is called, an exception is thrown (as this is typically a sign of programming error).
* @param count Number of responses to flush. If undefined/null, all pending requests (starting after `skip`) will be flushed.
* @param skip Number of pending requests to skip. For example, a value of 5 would skip the first 5 pending requests and start flushing from the 6th onwards. _(default: 0)_
*/
* Flushes pending requests using the trained responses. Requests are flushed in the order they
* were made, but it is also possible to skip one or more requests (for example to have them
* flushed later). This is useful for simulating scenarios where responses arrive from the server
* in any order.
*
* If there are no pending requests to flush when the method is called, an exception is thrown (as
* this is typically a sign of programming error).
*
* @param count Number of responses to flush. If undefined/null, all pending requests (starting
* after `skip`) will be flushed.
* @param skip Number of pending requests to skip. For example, a value of 5 would skip the first 5 pending requests and start flushing from the 6th onwards. _(default: 0)_
*/
flush(count?: number, skip?: number): void;
/**
* Resets all request expectations, but preserves all backend definitions.
*/
* Resets all request expectations, but preserves all backend definitions.
*/
resetExpectations(): void;
/**
* Verifies that all of the requests defined via the expect api were made. If any of the requests were not made, verifyNoOutstandingExpectation throws an exception.
* @param digest Do digest before checking expectation. Pass anything except false to trigger digest. NOTE this flag is purposely undocumented by Angular, which means it's not to be used in normal client code.
*/
* Verifies that all of the requests defined via the `expect` api were made. If any of the
* requests were not made, verifyNoOutstandingExpectation throws an exception.
* @param digest Do digest before checking expectation. Pass anything except false to trigger digest.
* NOTE: this flag is purposely undocumented by Angular, which means it's not to be used in normal client code.
*/
verifyNoOutstandingExpectation(digest?: boolean): void;
/**
* Verifies that there are no outstanding requests that need to be flushed.
*/
* Verifies that there are no outstanding requests that need to be flushed.
*/
verifyNoOutstandingRequest(): void;
/**
* Creates a new request expectation.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param method HTTP method.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expect(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param method HTTP method.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expect(
method: string,
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for DELETE requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for DELETE requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url is as expected.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectDELETE(
url: string | RegExp | ((url: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for GET requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectGET(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for GET requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectGET(
url: string | RegExp | ((url: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for HEAD requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object to be compared with the HTTP headers in the request.
* @param keys Array of keys to assign to regex matches in the request url.
*/
/**
* Creates a new request expectation for HEAD requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
expectHEAD(
url: string | RegExp | ((url: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for JSONP requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for JSONP requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectJSONP(
url: string | RegExp | ((url: string) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for PATCH requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for PATCH requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectPATCH(
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for POST requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for POST requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectPOST(
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new request expectation for PUT requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object, keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation for PUT requests.
* Throws a preformatted error if expectation(s) don't match supplied string, regular expression, object, or if function returns false.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
expectPUT(
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition.
* Returns an object with respond method that controls how a matched request is handled.
* @param method HTTP method.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
when(method: string, url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new request expectation that compares only with the requested route.
* This method offers colon delimited matching of the url path, ignoring the query string.
* This allows declarations similar to how application routes are configured with `$routeProvider`.
* As this method converts the definition url to regex, declaration order is important.
* @param method HTTP method
* @param url HTTP url string that supports colon param matching
*/
expectRoute(method: string, url: string): mock.IRequestHandler;
/**
* Creates a new backend definition for DELETE requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenDELETE(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition.
* Returns an object with respond method that controls how a matched request is handled.
* @param method HTTP method.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
when(
method: string,
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for GET requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in request url described above
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenGET(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for DELETE requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenDELETE(
url: string | RegExp | ((url: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for HEAD requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenHEAD(url: string | RegExp | ((url: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for GET requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in request url described above
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenGET(
url: string | RegExp | ((url: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for JSONP requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenJSONP(url: string | RegExp | ((url: string) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for HEAD requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenHEAD(
url: string | RegExp | ((url: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for PATCH requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenPATCH(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for JSONP requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenJSONP(
url: string | RegExp | ((url: string) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for POST requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenPOST(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for PATCH requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenPATCH(
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for PUT requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true if the url matches the current expctation.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenPUT(url: string | RegExp | ((url: string) => boolean), data?: string | RegExp | Object | ((data: string) => boolean), headers?: Object | ((object: Object) => boolean), keys?: Object[]): mock.IRequestHandler;
/**
* Creates a new backend definition for POST requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true
* if the url matches the current definition.
* @param data HTTP request body string, json object, regular expression or function that receives the data and returns true if the data matches the current expectation.
* @param headers HTTP headers object or function that receives the headers and returns true if the headers match the current expectation.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenPOST(
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition for PUT requests.
* Returns an object with respond method that controls how a matched request is handled.
* @param url HTTP url string, regular expression or function that receives a url and returns true
* if the url matches the current definition.
* @param data HTTP request body or function that receives data string and returns true if the data
* is as expected.
* @param headers HTTP headers or function that receives http header object and returns true if the
* headers match the current definition.
* @param keys Array of keys to assign to regex matches in the request url.
*/
whenPUT(
url: string | RegExp | ((url: string) => boolean),
data?: string | RegExp | object | ((data: string) => boolean),
headers?: mock.IHttpHeaders | ((headers: mock.IHttpHeaders) => boolean),
keys?: string[]
): mock.IRequestHandler;
/**
* Creates a new backend definition that compares only with the requested route.
* This method offers colon delimited matching of the url path, ignoring the query string.
* This allows declarations similar to how application routes are configured with `$routeProvider`.
* As this method converts the definition url to regex, declaration order is important.
* @param method HTTP method.
* @param url HTTP url string that supports colon param matching.
*/
whenRoute(method: string, url: string): mock.IRequestHandler;
}
///////////////////////////////////////////////////////////////////////////
// AnimateService
// see https://docs.angularjs.org/api/ngMock/service/$animate
///////////////////////////////////////////////////////////////////////////
module animate {
namespace animate {
interface IAnimateService {
/**
* This method will close all pending animations (both Javascript and CSS) and it will also flush any remaining animation frames and/or callbacks.
* This method will close all pending animations (both Javascript and CSS) and it will also flush any remaining
* animation frames and/or callbacks.
*/
closeAndFlush(): void;
/**
* This method is used to flush the pending callbacks and animation frames to either start an animation or conclude an animation. Note that this will not actually close an actively running animation (see `closeAndFlush()` for that).
* This method is used to flush the pending callbacks and animation frames to either start
* an animation or conclude an animation. Note that this will not actually close an
* actively running animation (see `closeAndFlush()`} for that).
*/
flush(): void;
}
}
export module mock {
// returned interface by the the mocked HttpBackendService expect/when methods
namespace mock {
/** Object returned by the the mocked HttpBackendService expect/when methods */
interface IRequestHandler {
/**
* Controls the response for a matched request using a function to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param func Function that receives the request HTTP method, url, data, headers, and an array of keys to regex matches in the request url and returns an array containing response status (number), data, headers, and status text.
*/
respond(func: ((method: string, url: string, data: string | Object, headers: Object, params?: any) => [number, string | Object, Object, string])): IRequestHandler;
/**
* Controls the response for a matched request using supplied static data to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param status HTTP status code to add to the response.
* @param data Data to add to the response.
* @param headers Headers object to add to the response.
* @param responseText Response text to add to the response.
*/
respond(status: number, data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
/**
* Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param data Data to add to the response.
* @param headers Headers object to add to the response.
* @param responseText Response text to add to the response.
*/
respond(data: string | Object, headers?: Object, responseText?: string): IRequestHandler;
// Available when ngMockE2E is loaded
/**
* Any request matching a backend definition or expectation with passThrough handler will be passed through to the real backend (an XHR request will be made to the server.)
*/
* Controls the response for a matched request using a function to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param func Function that receives the request HTTP method, url, data, headers, and an array of keys
* to regex matches in the request url and returns an array containing response status (number), data,
* headers, and status text.
*/
respond(
func: ((
method: string,
url: string,
data: string | object,
headers: IHttpHeaders,
params: { [key: string]: string }
) => [number, string | object, IHttpHeaders, string])
): IRequestHandler;
/**
* Controls the response for a matched request using supplied static data to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param status HTTP status code to add to the response.
* @param data Data to add to the response.
* @param headers Headers object to add to the response.
* @param responseText Response text to add to the response.
*/
respond(
status: number,
data: string | object,
headers?: IHttpHeaders,
responseText?: string
): IRequestHandler;
/**
* Controls the response for a matched request using the HTTP status code 200 and supplied static data to construct the response.
* Returns the RequestHandler object for possible overrides.
* @param data Data to add to the response.
* @param headers Headers object to add to the response.
* @param responseText Response text to add to the response.
*/
respond(
data: string | object,
headers?: IHttpHeaders,
responseText?: string
): IRequestHandler;
/**
* Any request matching a backend definition or expectation with passThrough handler will be
* passed through to the real backend (an XHR request will be made to the server.)
* Available when ngMockE2E is loaded
*/
passThrough(): IRequestHandler;
}
interface IHttpHeaders {
[headerName: string]: any;
}
/**
* Contains additional event data used by the `browserTrigger` function when creating an event.
*/
interface IBrowserTriggerEventData {
/**
* [Event.bubbles](https://developer.mozilla.org/docs/Web/API/Event/bubbles).
* Not applicable to all events.
*/
bubbles?: boolean;
/**
* [Event.cancelable](https://developer.mozilla.org/docs/Web/API/Event/cancelable).
* Not applicable to all events.
*/
cancelable?: boolean;
/**
* [charCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/charcode)
* for keyboard events (keydown, keypress, and keyup).
*/
charcode?: number;
/**
* The elapsedTime for
* [TransitionEvent](https://developer.mozilla.org/docs/Web/API/TransitionEvent)
* and [AnimationEvent](https://developer.mozilla.org/docs/Web/API/AnimationEvent).
*/
elapsedTime?: number;
/**
* [keyCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/keycode)
* for keyboard events (keydown, keypress, and keyup).
*/
keycode?: number;
/**
* An array of possible modifier keys (ctrl, alt, shift, meta) for
* [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) and
* keyboard events (keydown, keypress, and keyup).
*/
keys?: Array<'ctrl' | 'alt' | 'shift' | 'meta'>;
/**
* The [relatedTarget](https://developer.mozilla.org/docs/Web/API/MouseEvent/relatedTarget)
* for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent).
*/
relatedTarget?: Node;
/**
* [which](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/which)
* for keyboard events (keydown, keypress, and keyup).
*/
which?: number;
/**
* x-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent)
* and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
*/
x?: number;
/**
* y-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent)
* and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
*/
y?: number;
}
}
}
///////////////////////////////////////////////////////////////////////////////
// functions attached to global object (window)
///////////////////////////////////////////////////////////////////////////////
//Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs.
//declare var module: (...modules: any[]) => any;
// Use `angular.mock.module` instead of `module`, as `module` conflicts with commonjs.
// declare var module: (...modules: any[]) => any;
declare global {
export var inject: angular.IInjectStatic;
const inject: angular.IInjectStatic;
/**
* This is a global (window) function that is only available when the `ngMock` module is included.
* It can be used to trigger a native browser event on an element, which is useful for unit testing.
*
* @param element Either a wrapped jQuery/jqLite node or a DOM element
* @param eventType Optional event type. If none is specified, the function tries to determine
* the right event type for the element, e.g. `change` for `input[text]`.
* @param eventData An optional object which contains additional event data used when creating the event.
*/
function browserTrigger(
element: JQuery | Element,
eventType?: string,
eventData?: angular.mock.IBrowserTriggerEventData
): void;
}
+4 -4
View File
@@ -1,14 +1,14 @@
declare module "angular-mocks/ngMock" {
var _: string;
const _: string;
export = _;
}
declare module "angular-mocks/ngMockE2E" {
var _: string;
const _: string;
export = _;
}
declare module "angular-mocks/ngAnimateMock" {
var _: string;
const _: string;
export = _;
}
}
+8 -77
View File
@@ -1,79 +1,10 @@
{
"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
}
"extends": "dtslint/dt.json",
"rules": {
"callable-types": false,
"interface-name": false,
"no-declare-current-package": false,
"no-unnecessary-generics": false,
"only-arrow-functions": false
}
}
+3 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for Angular Translate (pascalprecht.translate module) 2.15
// Type definitions for Angular Translate (pascalprecht.translate module) 2.16
// Project: https://github.com/PascalPrecht/angular-translate
// Definitions by: Michel Salib <https://github.com/michelsalib>, Gabriel Gil <https://github.com/GabrielGil>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -47,8 +47,8 @@ declare module 'angular' {
}
interface ITranslateService {
(translationId: string, interpolateParams?: any, interpolationId?: string, defaultTranslationText?: string, forceLanguage?: string): angular.IPromise<string>;
(translationId: string[], interpolateParams?: any, interpolationId?: string, defaultTranslationText?: string, forceLanguage?: string): angular.IPromise<{ [key: string]: string }>;
(translationId: string, interpolateParams?: any, interpolationId?: string, defaultTranslationText?: string, forceLanguage?: string, sanitizeStrategy?: string): angular.IPromise<string>;
(translationId: string[], interpolateParams?: any, interpolationId?: string, defaultTranslationText?: string, forceLanguage?: string, sanitizeStrategy?: string): angular.IPromise<{ [key: string]: string }>;
cloakClassName(): string;
cloakClassName(name: string): ITranslateProvider;
fallbackLanguage(langKey?: string): string;
+71
View File
@@ -4,6 +4,7 @@
// Georgii Dolzhykov <https://github.com/thorn0>
// Caleb St-Denis <https://github.com/calebstdenis>
// Leonard Thieu <https://github.com/leonard-thieu>
// Steffen Kowalski <https://github.com/scipper>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -484,6 +485,76 @@ declare namespace angular {
$broadcast(name: string, ...args: any[]): IAngularEvent;
$destroy(): void;
$digest(): void;
/**
* Suspend watchers of this scope subtree so that they will not be invoked during digest.
*
* This can be used to optimize your application when you know that running those watchers
* is redundant.
*
* **Warning**
*
* Suspending scopes from the digest cycle can have unwanted and difficult to debug results.
* Only use this approach if you are confident that you know what you are doing and have
* ample tests to ensure that bindings get updated as you expect.
*
* Some of the things to consider are:
*
* * Any external event on a directive/component will not trigger a digest while the hosting
* scope is suspended - even if the event handler calls `$apply()` or `$rootScope.$digest()`.
* * Transcluded content exists on a scope that inherits from outside a directive but exists
* as a child of the directive's containing scope. If the containing scope is suspended the
* transcluded scope will also be suspended, even if the scope from which the transcluded
* scope inherits is not suspended.
* * Multiple directives trying to manage the suspended status of a scope can confuse each other:
* * A call to `$suspend()` on an already suspended scope is a no-op.
* * A call to `$resume()` on a non-suspended scope is a no-op.
* * If two directives suspend a scope, then one of them resumes the scope, the scope will no
* longer be suspended. This could result in the other directive believing a scope to be
* suspended when it is not.
* * If a parent scope is suspended then all its descendants will be also excluded from future
* digests whether or not they have been suspended themselves. Note that this also applies to
* isolate child scopes.
* * Calling `$digest()` directly on a descendant of a suspended scope will still run the watchers
* for that scope and its descendants. When digesting we only check whether the current scope is
* locally suspended, rather than checking whether it has a suspended ancestor.
* * Calling `$resume()` on a scope that has a suspended ancestor will not cause the scope to be
* included in future digests until all its ancestors have been resumed.
* * Resolved promises, e.g. from explicit `$q` deferreds and `$http` calls, trigger `$apply()`
* against the `$rootScope` and so will still trigger a global digest even if the promise was
* initiated by a component that lives on a suspended scope.
*/
$suspend(): void;
/**
* Call this method to determine if this scope has been explicitly suspended. It will not
* tell you whether an ancestor has been suspended.
* To determine if this scope will be excluded from a digest triggered at the $rootScope,
* for example, you must check all its ancestors:
*
* ```
* function isExcludedFromDigest(scope) {
* while(scope) {
* if (scope.$isSuspended()) return true;
* scope = scope.$parent;
* }
* return false;
* ```
*
* Be aware that a scope may not be included in digests if it has a suspended ancestor,
* even if `$isSuspended()` returns false.
*
* @returns true if the current scope has been suspended.
*/
$isSuspended(): boolean;
/**
* Resume watchers of this scope subtree in case it was suspended.
*
* See {$rootScope.Scope#$suspend} for information about the dangers of using this approach.
*/
$resume(): void;
/**
* Dispatches an event name upwards through the scope hierarchy notifying the registered $rootScope.Scope listeners.
*
+4 -1
View File
@@ -39,7 +39,10 @@ const showOptions : Auth0LockShowOptions = {
type: "error",
text: "an error has occurred"
},
rememberLastLogin: false
rememberLastLogin: false,
languageDictionary: {
title: "test"
}
};
lock.show(showOptions);
+1
View File
@@ -161,6 +161,7 @@ interface Auth0LockShowOptions {
initialScreen?: "login" | "signUp" | "forgotPassword";
flashMessage?: Auth0LockFlashMessageOptions;
rememberLastLogin?: boolean;
languageDictionary?: any;
}
interface AuthResult {
+2 -1
View File
@@ -350,6 +350,7 @@ export interface Identity {
user_id: string;
provider: string;
isSocial: boolean;
access_token?: string;
profileData?: {
email?: string;
email_verified?: boolean;
@@ -882,4 +883,4 @@ export class UsersManager {
impersonate(userId: string, settings: ImpersonateSettingOptions): Promise<any>;
impersonate(userId: string, settings: ImpersonateSettingOptions, cb: (err: Error, data: any) => void): void;
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/wardbell/bardjs
// Definitions by: Andrew Archibald <https://github.com/TepigMC>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.4
/// <reference types="angular" />
/// <reference types="chai" />
+52
View File
@@ -1,4 +1,5 @@
import browserSync = require("browser-sync");
import { EventEmitter } from "events";
(() => {
//make sure that the interfaces are correctly exposed
@@ -391,6 +392,57 @@ bs.init({
bs.reload();
browserSync.use(
{
plugin: function(opts: object, bs: browserSync.BrowserSyncInstance) {
console.log(opts);
},
"plugin:name": "test"
},
{ files: "*.css" }
);
browserSync.use({
plugin: function(opts: object, bs: browserSync.BrowserSyncInstance) {
console.log(bs.name);
}
});
browserSync(
{
server: {
baseDir: "test/fixtures"
},
logLevel: "silent",
open: false
}
);
var instanceName = "TestInstance";
var namedInstance = browserSync.create(instanceName);
namedInstance.init({
server: { index: "./app" },
https: true
});
console.log(namedInstance.getOption("https")); // Should output true.
var existingInstance = browserSync.get(instanceName);
browserSync.create("InstanceWithEventEmitter", new EventEmitter());
// Should output something greater than 0.
console.log(browserSync.instances.length);
browserSync.reset();
// Should output 0.
console.log(browserSync.instances.length);
var cleanupTestInstance = browserSync.create("CleanupTest");
cleanupTestInstance.cleanup();
console.log(cleanupTestInstance.active); // Should output false.
function browserSyncInit(): browserSync.BrowserSyncInstance {
var browser = browserSync.create();
browser.init();
+44 -15
View File
@@ -456,11 +456,15 @@ declare namespace browserSync {
* depending on your use-case.
*/
(config?: Options, callback?: (err: Error, bs: object) => any): BrowserSyncInstance;
/**
*
*/
instances: Array<BrowserSyncInstance>;
/**
* Create a Browsersync instance
* @param name an identifier that can used for retrieval later
*/
create(name?: string): BrowserSyncInstance;
create(name?: string, emitter?: NodeJS.EventEmitter): BrowserSyncInstance;
/**
* Get a single instance by name. This is useful if you have your build scripts in separate files
* @param name the identifier used for retrieval
@@ -471,6 +475,11 @@ declare namespace browserSync {
* @param name the name of the instance
*/
has(name: string): boolean;
/**
* Reset the state of the module.
* (should only be needed for test environments)
*/
reset(): void;
}
interface BrowserSyncInstance {
@@ -481,6 +490,24 @@ declare namespace browserSync {
* depending on your use-case.
*/
init(config?: Options, callback?: (err: Error, bs: object) => any): BrowserSyncInstance;
/**
* This method will close any running server, stop file watching & exit the current process.
*/
exit(): void;
/**
* Helper method for browser notifications
* @param message Can be a simple message such as 'Connected' or HTML
* @param timeout How long the message will remain in the browser. @since 1.3.0
*/
notify(message: string, timeout?: number): void;
/**
* Method to pause file change events
*/
pause(): void;
/**
* Method to resume paused watchers
*/
resume(): void;
/**
* Reload the browser
* The reload method will inform all browsers about changed files and will either cause the browser
@@ -510,28 +537,30 @@ declare namespace browserSync {
*/
stream(opts?: StreamOptions): NodeJS.ReadWriteStream;
/**
* Helper method for browser notifications
* @param message Can be a simple message such as 'Connected' or HTML
* @param timeout How long the message will remain in the browser. @since 1.3.0
* Instance Cleanup.
*/
notify(message: string, timeout?: number): void;
cleanup(fn?: (error: NodeJS.ErrnoException, bs: BrowserSyncInstance) => void): void;
/**
* This method will close any running server, stop file watching & exit the current process.
* Register a plugin.
* Must implement at least a 'plugin' property that returns
* callable function.
*
* @method use
* @param {object} module The object to be `required`.
* @param {object} options The
* @param {any} cb A callback function that will return any errors.
*/
exit(): void;
use(module: { "plugin:name"?: string, plugin: (opts: object, bs: BrowserSyncInstance) => any }, options?: object, cb?: any): void;
/**
* Callback helper to examine what options have been set.
* @param {string} name The key to search options map for.
*/
getOption(name: string): any;
/**
* Stand alone file-watcher. Use this along with Browsersync to create your own, minimal build system
*/
watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any)
: NodeJS.EventEmitter;
/**
* Method to pause file change events
*/
pause(): void;
/**
* Method to resume paused watchers
*/
resume(): void;
/**
* The internal Event Emitter used by the running Browsersync instance (if there is one). You can use
* this to emit your own events, such as changed files, logging etc.
@@ -0,0 +1,28 @@
import BufferReader from 'buffer-reader';
const buffer = new Buffer(1000);
const reader = new BufferReader(buffer);
reader.append(new Buffer(1));
reader.tell();
reader.seek(1);
reader.move(2);
reader.restAll();
reader.nextBuffer(2);
reader.nextString(5);
reader.nextString(5, 'utf8');
reader.nextStringZero();
reader.nextStringZero('utf8');
reader.nextInt8();
reader.nextUInt8();
reader.nextInt16LE();
reader.nextUInt16LE();
reader.nextInt16BE();
reader.nextUInt16BE();
reader.nextInt32LE();
reader.nextUInt32LE();
reader.nextInt32BE();
reader.nextUInt32BE();
reader.nextFloatLE();
reader.nextFloatBE();
reader.nextDouble32LE();
reader.nextDouble32BE();
+111
View File
@@ -0,0 +1,111 @@
// Type definitions for buffer-reader 0.1
// Project: https://github.com/villadora/node-buffer-reader
// Definitions by: nrlquaker <https://github.com/nrlquaker>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
/// <reference types="node"/>
export = BufferReader;
declare class BufferReader {
/**
* Create a new reader, if no buffer provided, a empty buffer will be used.
*/
constructor(buffer?: Buffer)
/**
* Append new buffer to the end of current reader.
* @param buffer buffer to append
*/
append(buffer: Buffer): void;
/**
* Return current position of the reader.
*/
tell(): number;
/**
* Set new position of the reader, if the pos is invalid, an exception will be raised.
* @param position new position
*/
seek(position: number): void;
/**
* Move the position of reader by offset, offset can be negative; it can be used to skip some bytes.
* @param offset offset to move by
*/
move(offset: number): void;
/**
* Get all the remaining bytes as a Buffer.
*/
restAll(): Buffer;
/**
* Read a buffer with specified length.
* @param length specified length
*/
nextBuffer(length: number): Buffer;
/**
* Read next length of bytes as String, encoding default is 'utf8'.
* @param length length of the string to read
* @param encoding encoding of the string
*/
nextString(length: number, encoding?: string): string;
/**
* Read next bytes till the end of buffer as null-terminated string, encoding default is 'utf8'.
* @param encoding encoding of the string
*/
nextStringZero(encoding?: string): string;
/**
* Read next bytes as Int8, the value is just as the same format Buffer in nodejs doc.
*/
nextInt8(): number;
/**
* Read next bytes as UInt8, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt8(): number;
/**
* Read next bytes as Int16LE, the value is just as the same format Buffer in nodejs doc.
*/
nextInt16LE(): number;
/**
* Read next bytes as UInt16LE, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt16LE(): number;
/**
* Read next bytes as Int16BE, the value is just as the same format Buffer in nodejs doc.
*/
nextInt16BE(): number;
/**
* Read next bytes as UInt16BE, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt16BE(): number;
/**
* Read next bytes as Int32LE, the value is just as the same format Buffer in nodejs doc.
*/
nextInt32LE(): number;
/**
* Read next bytes as UInt32LE, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt32LE(): number;
/**
* Read next bytes as Int32BE, the value is just as the same format Buffer in nodejs doc.
*/
nextInt32BE(): number;
/**
* Read next bytes as UInt32BE, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt32BE(): number;
/**
* Read next bytes as FloatLE, the value is just as the same format Buffer in nodejs doc.
*/
nextFloatLE(): number;
/**
* Read next bytes as FloatBE, the value is just as the same format Buffer in nodejs doc.
*/
nextFloatBE(): number;
/**
* Read next bytes as Double32LE, the value is just as the same format Buffer in nodejs doc.
*/
nextDouble32LE(): number;
/**
* Read next bytes as Double32BE, the value is just as the same format Buffer in nodejs doc.
*/
nextDouble32BE(): number;
}
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"esModuleInterop": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"buffer-reader-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+33
View File
@@ -1361,6 +1361,39 @@ suite('assert', () => {
assert.notDeepEqual(circularObject, secondCircularObject);
});
test('deepStrictEqual', () => {
assert.deepStrictEqual({tea: 'chai'}, {tea: 'chai'});
assert.throws(() => assert.deepStrictEqual({tea: 'chai'}, {tea: 'black'}));
const obja = Object.create({tea: 'chai'});
const objb = Object.create({tea: 'chai'});
assert.deepStrictEqual(obja, objb);
const obj1 = Object.create({tea: 'chai'});
const obj2 = Object.create({tea: 'black'});
assert.throws(() => assert.deepStrictEqual(obj1, obj2));
});
test('deepStrictEqual (ordering)', () => {
const a = {a: 'b', c: 'd'};
const b = {c: 'd', a: 'b'};
assert.deepStrictEqual(a, b);
});
test('deepStrictEqual (circular)', () => {
const circularObject: any = {};
const secondCircularObject: any = {};
circularObject.field = circularObject;
secondCircularObject.field = secondCircularObject;
assert.deepStrictEqual(circularObject, secondCircularObject);
secondCircularObject.field2 = secondCircularObject;
assert.deepStrictEqual(circularObject, secondCircularObject);
});
test('isNull', () => {
assert.isNull(null);
assert.isNull(undefined);
+12 -2
View File
@@ -353,7 +353,7 @@ declare namespace Chai {
notStrictEqual<T>(actual: T, expected: T, message?: string): void;
/**
* Asserts that actual is deeply equal to expected.
* Asserts that actual is deeply equal (==) to expected.
*
* @type T Type of the objects.
* @param actual Actual value.
@@ -363,7 +363,7 @@ declare namespace Chai {
deepEqual<T>(actual: T, expected: T, message?: string): void;
/**
* Asserts that actual is not deeply equal to expected.
* Asserts that actual is not deeply equal (==) to expected.
*
* @type T Type of the objects.
* @param actual Actual value.
@@ -372,6 +372,16 @@ declare namespace Chai {
*/
notDeepEqual<T>(actual: T, expected: T, message?: string): void;
/**
* Asserts that actual is deeply strict equal (===) to expected.
*
* @type T Type of the objects.
* @param actual Actual value.
* @param expected Potential expected value.
* @param message Message to display on error.
*/
deepStrictEqual<T>(actual: T, expected: T, message?: string): void;
/**
* Asserts valueToCheck is strictly greater than (>) valueToBeAbove.
*
+1
View File
@@ -506,6 +506,7 @@ declare namespace Chart {
}
interface CommonAxe {
bounds?: string;
type?: ScaleType | string;
display?: boolean;
id?: string;
+7 -1
View File
@@ -367,9 +367,15 @@ declare namespace cast.framework.events {
total?: number,
whenSkippable?: number,
endedReason?: EndedReason,
breakClipId?: string
breakClipId?: string,
breakId?: string
);
/**
* The break's id. Refer to Break.id
*/
breakId?: string;
/**
* The break clip's id. Refer to BreakClip.id
*/
@@ -8,7 +8,8 @@ import {
} from "chromecast-caf-receiver/cast.framework.system";
import {
RequestEvent,
Event
Event,
BreaksEvent
} from "chromecast-caf-receiver/cast.framework.events";
import {
QueueBase,
@@ -29,12 +30,16 @@ import {
MediaMetadata
} from "chromecast-caf-receiver/cast.framework.messages";
const breaksEvent = new BreaksEvent('BREAK_STARTED');
breaksEvent.breakId = 'some-break-id';
breaksEvent.breakClipId = 'some-break-clip-id';
const track = new Track(1, "TEXT");
const breakClip = new BreakClip("id");
const adBreak = new Break("id", ["id"], 1);
const rEvent = new RequestEvent("BITRATE_CHANGED", { requestId: 2 });
const pManager = new PlayerManager();
pManager.addEventListener("STALLED", () => {});
pManager.addEventListener("STALLED", () => { });
const ttManager = new TextTracksManager();
const qManager = new QueueManager();
const qBase = new QueueBase();
@@ -47,10 +52,10 @@ const breakManager: BreakManager = {
getBreakClips: () => [breakClip],
getBreaks: () => [adBreak],
getPlayWatchedBreak: () => true,
setBreakClipLoadInterceptor: () => {},
setBreakSeekInterceptor: () => {},
setPlayWatchedBreak: () => {},
setVastTrackingInterceptor: () => {}
setBreakClipLoadInterceptor: () => { },
setBreakSeekInterceptor: () => { },
setPlayWatchedBreak: () => { },
setVastTrackingInterceptor: () => { }
};
const lrd: LoadRequestData = {
@@ -103,4 +108,4 @@ const pData: PlayerData = {
whenSkippable: 321
};
const binder = new PlayerDataBinder(pData);
binder.addEventListener("ANY_CHANGE", e => {});
binder.addEventListener("ANY_CHANGE", e => { });
+402 -3
View File
@@ -1,6 +1,26 @@
'use strict';
import cytoscape = require('cytoscape');
// TODO: document all aliases as aliases, not as duplicates!
const assert = (tag: boolean) => { if (!tag) throw new Error(); };
const aliases = (...obj: Array<{}>) => { if (obj.slice(1).some((alias) => alias !== obj[0])) throw new Error(); };
const events = (obj: any) => {
aliases(obj.on, obj.bind, obj.listen, obj.addListener);
aliases(obj.promiseOn, obj.pon);
aliases(obj.off, obj.unbind, obj.unlisten, obj.removeListener);
aliases(obj.emit, obj.trigger);
};
// definitions
function oneOf<A, B, C, D, E>(a: A, b: B, c: C, d: D, e: E): A | B | C | D | E;
function oneOf<A, B, C, D>(a: A, b: B, c: C, d: D): A | B | C | D;
function oneOf<A, B, C>(a: A, b: B, c: C): A | B | C;
function oneOf<A, B>(a: A, b: B): A | B;
function oneOf<T>(...array: T[]): T {
return array[0];
}
import cytoscape = require('cytoscape');
const parentCSS = {
'padding-top': '10px',
'padding-left': '10px',
@@ -69,6 +89,34 @@ const cy = cytoscape({
]
},
// initial viewport state:
zoom: 1,
pan: { x: 0, y: 0 },
// interaction options:
minZoom: 1e-50,
maxZoom: 1e50,
zoomingEnabled: true,
userZoomingEnabled: true,
panningEnabled: true,
userPanningEnabled: true,
selectionType: 'single',
touchTapThreshold: 8,
desktopTapThreshold: 4,
autolock: false,
autoungrabify: false,
// rendering options:
headless: false,
styleEnabled: true,
hideEdgesOnViewport: false,
hideLabelsOnViewport: false,
textureOnViewport: false,
motionBlur: false,
motionBlurOpacity: 0.2,
wheelSensitivity: 1,
pixelRatio: 'auto',
layout: {
name: 'preset',
padding: 5
@@ -80,6 +128,42 @@ cy.on('zoom', (event) => {
cy.nodes('$node > node').style('opacity', 0);
}
});
cy.off('zoom');
events(cy);
cy.add({ data: { id: 'g' }, position: {x: 200, y: 150} });
cy.add([
{ data: { id: 'h' }, position: {x: 250, y: 100} }
]);
const nodesBeforeDelete = cy.nodes();
const edgesBeforeDelete = cy.edges();
const removed = cy.remove('#g #h');
cy.add(removed);
const diffNodes = nodesBeforeDelete.diff(cy.nodes());
const diffEdges = edgesBeforeDelete.diff(cy.edges());
assert(diffNodes.left.size() === 0 && diffNodes.right.size() === 0 && diffNodes.both.size() === cy.nodes().size());
assert(nodesBeforeDelete.same(cy.nodes()));
assert(edgesBeforeDelete.same(cy.edges()));
const gh = cy.collection().add(cy.$id('g')).union(cy.getElementById('h'));
const gh2 = cy.$('#g #h');
const gh3 = cy.nodes('#g #h');
assert(gh2.same(gh));
assert(gh3.same(gh));
assert(gh.same(removed));
assert(cy.container() === null); // headless mode!
cy.center();
cy.center(gh);
aliases(cy.center, cy.centre);
cy.fit(cy.$('#a #b #h'));
const {x1, y1, x2, y2, w, h} = cy.extent();
aliases(cy.resize, cy.invalidateDimensions);
cy.animate({
fit: {
@@ -89,8 +173,323 @@ cy.animate({
duration: 500
});
const node = cy.nodes()[0];
cy.animate({
center: {eles: node},
center: {eles: cy.nodes()[0]},
duration: 500
});
const anim = cy.animation({
zoom: {
level: 1,
position: {x: 0, y: 0}
},
pan: {x: 100, y: 100},
duration: 100,
easing: 'ease'
});
cy.stop(true, true);
anim.play();
assert(anim.playing());
anim.progress(anim.progress() + 50);
anim.time(anim.time() - 50);
anim.stop();
aliases(cy.layout, cy.createLayout, cy.makeLayout);
// Preconfigured data for layouts (as it could be passed)
const boundingBox = oneOf({x1: 0, x2: 100, y1: 0, y2: 100}, {x1: 0, w: 100, y1: 0, h: 100});
const positions = oneOf({a: {x: 100, y: 100}}, (node: cytoscape.NodeCollection): cytoscape.Position => ({x: 100, y: 100}));
// TODO: uncomment after we have the way to add layout options properties from extensions
// const layouts = [
// cy.layout({
// name: 'null',
// ready: () => {},
// stop: () => {}
// }),
// cy.layout({
// name: 'random',
// fit: true,
// padding: 30,
// boundingBox,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-in',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'preset',
// positions,
// zoom: 1,
// pan: {x: 100, y: 100},
// fit: false,
// padding: 30,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-out',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'grid',
// fit: true,
// padding: 30,
// boundingBox,
// avoidOverlap: true,
// avoidOverlapPadding: 10,
// nodeDimensionsIncludeLabels: false,
// spacingFactor: oneOf(1, undefined),
// condense: false,
// rows: oneOf(10, undefined),
// cols: oneOf(10, undefined),
// position: (node) => ({ row: 1, col: 1 }),
// sort: (a, b) => 1,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-in-out',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'circle',
// fit: true,
// padding: 30,
// boundingBox,
// avoidOverlap: true,
// nodeDimensionsIncludeLabels: false,
// spacingFactor: oneOf(1, undefined),
// radius: oneOf(1, undefined),
// startAngle: 3 / 2 * Math.PI,
// sweep: oneOf(6, undefined),
// clockwise: true,
// sort: (a, b) => 1,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-in-sine',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'concentric',
// fit: true,
// padding: 30,
// startAngle: 3 / 2 * Math.PI,
// sweep: oneOf(6, undefined),
// clockwise: true,
// equidistant: false,
// minNodeSpacing: 10,
// boundingBox,
// avoidOverlap: true,
// nodeDimensionsIncludeLabels: false,
// height: oneOf(500, undefined),
// width: oneOf(500, undefined),
// spacingFactor: oneOf(1, undefined),
// concentric: (node) => 1,
// levelWidth: (nodes) => 1,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-out-sine',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'breadthfirst',
// fit: true,
// directed: false,
// padding: 30,
// circle: false,
// spacingFactor: 1.75,
// boundingBox,
// avoidOverlap: true,
// nodeDimensionsIncludeLabels: false,
// maximalAdjustments: 0,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-in-out-sine',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'cose',
// ready: () => {},
// stop: () => {},
// animate: oneOf(true, false, 'end'),
// animationEasing: oneOf('ease-in-quad', undefined),
// animationDuration: oneOf(500, undefined),
// animateFilter: function ( node, i ){ return true; },
// animationThreshold: 250,
// refresh: 20,
// fit: true,
// padding: 30,
// boundingBox: undefined,
// nodeDimensionsIncludeLabels: false,
// randomize: false,
// componentSpacing: 40,
// nodeRepulsion: (node) => 2048,
// nodeOverlap: 4,
// idealEdgeLength: (edge) => 32,
// edgeElasticity: (edge) => 32,
// nestingFactor: 1.2,
// gravity: 1,
// numIter: 1000,
// initialTemp: 1000,
// coolingFactor: 0.99,
// minTemp: 1.0,
// weaver: false
// })
// ];
// const lay = layouts[0];
// aliases(lay.run, lay.start);
// events(lay);
// layouts.map(layout => {
// layout.run();
// layout.stop();
// });
// TODO: cy.style
cy.png({
output: oneOf('base64uri', 'base64', 'blob', undefined),
bg: oneOf('#ffffff', undefined),
full: true,
scale: 2,
maxWidth: 100,
maxHeight: 100
});
aliases(cy.jpg, cy.jpeg);
cy.jpg({
output: oneOf('base64uri', 'base64', 'blob', undefined),
bg: oneOf('#ffffff', undefined),
full: true,
scale: 2,
maxWidth: 100,
maxHeight: 100,
quality: 0.5
});
cy.json(cy.json());
// Types possible to call methods
const ele = oneOf(cy.nodes()[0], cy.edges()[0]);
const eles = cy.elements();
const node = cy.nodes()[0];
const nodes = cy.nodes();
const edge = cy.edges()[0];
const edges = cy.edges();
assert(ele.cy() === cy);
eles.remove();
assert(eles.removed());
assert(!eles.inside());
eles.restore();
([ele, eles, node, nodes, edge, edges] as cytoscape.CollectionReturnValue[]).forEach((elem) => {
aliases(elem.clone, elem.copy);
events(elem);
aliases(elem.data, elem.attr);
aliases(elem.removeData, elem.removeAttr);
});
// TODO: tests for data flow
const loops = oneOf(true, false);
node.degree(loops); node.indegree(loops); node.outdegree(loops);
nodes.totalDegree(loops); nodes.minDegree(loops); nodes.maxDegree(loops);
nodes.minIndegree(loops); nodes.maxIndegree(loops); nodes.minOutdegree(loops); nodes.maxOutdegree(loops);
// tslint:disable-next-line:ban-types
const getsetPos = <T extends Function>(func: T): T => {
func('x', func('x'));
func(func());
func({x: 100, y: 100});
return func;
};
aliases(node.modelPosition, node.point, node.position);
getsetPos(node.position);
nodes.shift('x', 100);
nodes.shift({x: -100, y: 0});
aliases(nodes.modelPositions, nodes.positions, nodes.points);
nodes.positions((node, i) => Object.assign(node.position(), {x: node.position('x') + i}));
aliases(node.renderedPosition, node.renderedPoint);
getsetPos(node.renderedPoint);
// TODO: tests for compound nodes (relativePosition, in particular)
const sizes: number[] = [
ele.width(), ele.outerWidth(), ele.renderedWidth(), ele.renderedOuterWidth(),
ele.height(), ele.outerHeight(), ele.renderedHeight(), ele.renderedOuterHeight()
];
aliases(eles.boundingBox, eles.boundingbox);
aliases(eles.renderedBoundingBox, eles.renderedBoundingbox);
const flags: boolean[] = [
node.grabbed(), node.grabbable(), node.locked(), ele.active(),
];
const edgePoints: cytoscape.Position[] = [
...edge.controlPoints(), ...edge.segmentPoints(), edge.sourceEndpoint(), edge.targetEndpoint(), edge.midpoint()
];
aliases(eles.layout, eles.createLayout, eles.makeLayout);
const layout = eles.layout({name: 'random'}).run();
eles.select();
assert(ele.selected()); // as we selected all, and this too
aliases(eles.unselect, eles.deselect);
eles.selectify();
assert(ele.selectable());
eles.unselectify();
eles.addClass('test');
eles.toggleClass('test', oneOf(true, false, undefined));
eles.removeClass('test');
eles.classes(oneOf('test', undefined));
eles.flashClass('test flash', oneOf(1000, undefined));
assert(ele.hasClass('test'));
eles.style('background-color', 'green');
Object.keys(eles.style()).map(key => eles.style(key));
eles.style(eles.style());
aliases(eles.style, eles.css);
aliases(ele.renderedCss, ele.renderedStyle);
eles.anySame(nodes);
aliases(eles.contains, eles.has);
aliases(eles.allAreNeighbors, eles.allAreNeighbours);
eles.is('#g');
eles.allAre('#g');
eles.some((el, i, els) => true);
eles.every((el, i, els) => true);
aliases(eles.forEach, eles.each);
const selected: cytoscape.SingularElementArgument[] = [eles.eq(0), eles.first(), eles.last()];
const collSel = cy.collection(selected);
const selectedNodes: cytoscape.NodeSingular[] = [nodes.eq(0), nodes.first(), nodes.last()];
const collNodes = cy.collection(selectedNodes);
const selectedEdges: cytoscape.EdgeSingular[] = [edges.eq(0), edges.first(), edges.last()];
eles.slice(0, -1);
eles.toArray();
aliases(eles.getElementById, eles.$id);
aliases(eles.union, eles.add, eles.or, eles.u, eles['+'], eles['|']);
aliases(eles.difference, eles.not, eles.subtract, eles.relativeComplement, eles['\\'], eles['!'], eles['-']);
aliases(eles.absoluteComplement, eles.abscomp, eles.complement);
aliases(eles.intersection, eles.intersect, eles.and, eles.n, eles['&'], eles['.']);
aliases(eles.symmetricDifference, eles.symdiff, eles.xor, eles['^'], eles['(+)'], eles['(-)']);
cy.collection([nodes[0]]).union(nodes[1]).union(eles.$id('g'));
eles.difference(collNodes).abscomp().intersection(collSel).symdiff(collNodes);
const diff = collSel.diff(collNodes);
cy.collection().merge(diff.left).merge(diff.right).merge(diff.both).unmerge(collSel).filter((ele, i, eles) => true);
eles.sort((a, b) => 1).map((ele, i, eles) => [i, ele]);
eles.reduce<any[]>((prev, ele, i, eles) => [...prev, [ele, i]], []).concat(['finish']);
const min = eles.min((ele, i, eles) => ele.id.length + i); min.ele.scratch('min', min.value);
const max = eles.max((ele, i, eles) => ele.id.length + i); max.ele.scratch('max', max.value);
// TODO: traversing (need to actively check the nodes/edeges distinction)
// TODO: algorithms
// TODO: compound nodes (there aren't any in current test case)
+389 -135
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3277,7 +3277,7 @@ declare namespace d3 {
round(round: boolean): Treemap<T>;
sticky(): boolean;
sticky(sticky: boolean): boolean;
sticky(sticky: boolean): Treemap<T>;
mode(): string;
mode(mode: "squarify"): Treemap<T>;
+21
View File
@@ -19,3 +19,24 @@ decompress('unicorn.zip', 'dist', {
}).then((files: decompress.File[]) => {
console.log('done!');
});
// Test decompress with no output to filesystem
decompress('unicorn.zip')
.then(
(files: decompress.File[]) => {
console.log(`Decompressed ${files.length} files with no write to filesystem`);
}
);
// Test decompress with DecompressOptions as second argument
decompress(
'unicorn.zip',
{
filter: file => path.extname(file.path) !== '.exe'
}
)
.then(
(files: decompress.File[]) => {
console.log(`Decompressed ${files.length} files with filter options`);
}
);
+2 -1
View File
@@ -1,13 +1,14 @@
// Type definitions for decompress 4.2
// Project: https://github.com/kevva/decompress#readme
// Definitions by: York Yao <https://github.com/plantain-00>
// Jesse Bethke <https://github.com/jbethke>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export = decompress;
declare function decompress(input: string | Buffer, output: string, opts?: decompress.DecompressOptions): Promise<decompress.File[]>;
declare function decompress(input: string | Buffer, output?: string | decompress.DecompressOptions, opts?: decompress.DecompressOptions): Promise<decompress.File[]>;
declare namespace decompress {
interface File {
+19 -11
View File
@@ -1,15 +1,15 @@
// Type definitions for ethereumjs-util 5.1
// Type definitions for ethereumjs-util 5.2
// Project: https://github.com/ethereumjs/ethereumjs-util#readme
// Definitions by: Juan J. Jimenez-Anca <https://github.com/cortopy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
// TODO: import types for [`BN`](https://github.com/indutny/bn.js)
// TODO: MAX_INTEGER as type of BN
// TODO: import types for [`rlp`](https://github.com/ethereumjs/rlp)
// TODO: import types for [`secp256k1`](https://github.com/cryptocoinjs/secp256k1-node/)
import BN = require("bn.js");
export const SHA3_NULL_S: string;
export const SHA3_RLP_ARRAY_S: string;
@@ -18,13 +18,11 @@ export const SHA3_RLP_S: string;
export function addHexPrefix(str: string): string;
export function arrayContainsArray(superset: any, subset: any, some: any): any;
export function baToJSON(ba: Buffer | Uint8Array | string[]): Buffer | Uint8Array | string[];
export function baToJSON(ba: Buffer | Uint8Array | string[]): Buffer | Uint8Array | string[] | null;
export function bufferToHex(buf: Buffer | Uint8Array): string;
export function bufferToInt(buf: Buffer | Uint8Array): string;
export function bufferToInt(buf: Buffer | Uint8Array): number;
export function defineProperties(self: {[k: string]: any}, fields: string[], data: {[k: string]: any}): {[k: string]: any};
@@ -34,14 +32,16 @@ export function ecsign(msgHash: Buffer | Uint8Array, privateKey: Buffer | Uint8A
export function fromRpcSig(sig: string): {[k: string]: any};
export function fromSigned(num: Buffer | Uint8Array): any;
export function fromSigned(num: Buffer | Uint8Array): BN;
export function generateAddress(from: Buffer | Uint8Array, nonce: Buffer | Uint8Array): Buffer | Uint8Array;
export function hashPersonalMessage(message: string): Buffer | Uint8Array;
export function hashPersonalMessage(message: Buffer | Uint8Array | any[]): Buffer | Uint8Array;
export function importPublic(publicKey: Buffer | Uint8Array): Buffer | Uint8Array;
export function isPrecompiled(address: Buffer | Uint8Array): boolean;
export function isValidAddress(address: string): boolean;
export function isValidChecksumAddress(address: Buffer | Uint8Array): boolean;
@@ -52,11 +52,17 @@ export function isValidPublic(publicKey: Buffer | Uint8Array, sanitize?: boolean
export function isValidSignature(v: Buffer | Uint8Array, r: Buffer | Uint8Array, s: Buffer | Uint8Array, homestead?: boolean): boolean;
export function isZeroAddress(address: string): boolean;
export function keccak(a: Buffer | Uint8Array | any[] | string | number, bits?: number): Buffer | Uint8Array;
export function keccak256(a: Buffer | Uint8Array | any[] | string | number): Buffer | Uint8Array;
export function privateToAddress(privateKey: Buffer | Uint8Array): Buffer | Uint8Array;
export function privateToPublic(privateKey: Buffer | Uint8Array): Buffer | Uint8Array;
export function pubToAddress(pubKey: Buffer | Uint8Array, sanitize: boolean): Buffer | Uint8Array;
export function pubToAddress(pubKey: Buffer | Uint8Array, sanitize?: boolean): Buffer | Uint8Array;
export function ripemd160(a: Buffer | Uint8Array | any[] | string | number, padded: boolean): Buffer | Uint8Array;
@@ -76,8 +82,10 @@ export function toChecksumAddress(address: string): string;
export function toRpcSig(v: number, r: Buffer | Uint8Array, s: Buffer | Uint8Array): string;
export function toUnsigned(num: any): Buffer | Uint8Array;
export function toUnsigned(num: BN): Buffer | Uint8Array;
export function unpad<T extends Buffer | Uint8Array | any[] | string>(a: T): T;
export function zeros(bytes: number): Buffer | Uint8Array;
export function zeroAddress(): string;
+43 -9
View File
@@ -7,6 +7,8 @@
// Fernando Helwanger <https://github.com/fhelwanger>
// Umidbek Karimov <https://github.com/umidbekkarimov>
// Moshe Feuchtwanger <https://github.com/moshfeu>
// Michael Prokopchuk <https://github.com/prokopcm>
// Tina Roh <https://github.com/tinaroh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -788,11 +790,31 @@ export interface CameraProps extends ViewProps {
}
export interface CameraConstants {
readonly Type: string;
readonly FlashMode: string;
readonly AutoFocus: string;
readonly WhiteBalance: string;
readonly VideoQuality: string;
readonly Type: {
back: string;
front: string;
};
readonly FlashMode: {
on: string;
off: string;
auto: string;
torch: string;
};
readonly AutoFocus: {
on: string;
off: string;
};
readonly WhiteBalance: {
auto: string;
sunny: string;
cloudy: string;
shadow: string;
fluorescent: string;
incandescent: string;
};
readonly VideoQuality: {
[videoQuality: string]: number;
};
readonly BarCodeType: {
aztec: string;
codabar: string;
@@ -878,7 +900,7 @@ export namespace Constants {
};
appKey?: string;
androidStatusBar?: {
barStyle?: 'lignt-content' | 'dark-content',
barStyle?: 'light-content' | 'dark-content',
backgroundColor?: string
};
androidShowExponentNotificationInShellApp?: boolean;
@@ -1390,12 +1412,24 @@ export namespace Font {
}
// #region GLView
export interface ExpoWebGLRenderingContext extends WebGLRenderingContext {
endFrameEXP(): void;
}
/**
* GLView
* A View that acts as an OpenGL ES render target. On mounting, an OpenGL ES
* context is created. Its drawing buffer is presented as the contents of
* the View every frame.
*/
export interface GLViewProps extends ViewProps {
onContextCreate(): void;
msaaSamples: number;
/**
* A function that will be called when the OpenGL ES context is created.
* Passes an object with a WebGLRenderingContext interface as an argument.
*/
onContextCreate(gl: ExpoWebGLRenderingContext): void;
/** Number of MSAA samples to use on iOS. Defaults to 4. Ignored on Android. */
msaaSamples?: number;
}
export class GLView extends Component<GLViewProps, { msaaSamples: number }> { }
+27 -6
View File
@@ -6,6 +6,7 @@
// Sergio Sánchez <https://github.com/ssanchezmarc>
// Fernando Helwanger <https://github.com/fhelwanger>
// Umidbek Karimov <https://github.com/umidbekkarimov>
// Tina Roh <https://github.com/tinaroh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -787,11 +788,31 @@ export interface CameraProps extends ViewProps {
}
export interface CameraConstants {
readonly Type: string;
readonly FlashMode: string;
readonly AutoFocus: string;
readonly WhiteBalance: string;
readonly VideoQuality: string;
readonly Type: {
back: string;
front: string;
};
readonly FlashMode: {
on: string;
off: string;
auto: string;
torch: string;
};
readonly AutoFocus: {
on: string;
off: string;
};
readonly WhiteBalance: {
auto: string;
sunny: string;
cloudy: string;
shadow: string;
fluorescent: string;
incandescent: string;
};
readonly VideoQuality: {
[videoQuality: string]: number;
};
readonly BarCodeType: {
aztec: string;
codabar: string;
@@ -877,7 +898,7 @@ export namespace Constants {
};
appKey?: string;
androidStatusBar?: {
barStyle?: 'lignt-content' | 'dark-content',
barStyle?: 'light-content' | 'dark-content',
backgroundColor?: string
};
androidShowExponentNotificationInShellApp?: boolean;
+11 -3
View File
@@ -67,19 +67,19 @@ declare namespace ExpressBrute {
* @summary Allows you to override the value of failCallback for this middleware.
* @type {Function}
*/
failCallback: Function;
failCallback?: Function;
/**
* @summary Disregard IP address when matching requests if set to true. Defaults to false.
* @type {boolean}
*/
ignoreIP: boolean;
ignoreIP?: boolean;
/**
* @summary Key.
* @type {any}
*/
key: any;
key?: any;
}
/**
@@ -156,5 +156,13 @@ declare namespace ExpressBrute {
reset(key: string, callback: (error: any) => void): void;
}
}
declare module "express-serve-static-core" {
export interface Request {
brute?: {
reset?: (callback?: () => void) => void
};
}
}
export = ExpressBrute;
@@ -26,3 +26,19 @@ io.use(sharedsession(session));
io.use(sharedsession(session, { autoSave: true, saveUninitialized: true }));
io.use(sharedsession(session, cookieParser));
io.use(sharedsession(session, cookieParser, { autoSave: true, saveUninitialized: true }));
io.on('connection', (socket) => {
const sessionID = [
socket.handshake.sessionID,
socket.handshake.session!.id
];
const sessionData = [
socket.handshake.session!['sessionEntry'],
socket.handshake.session!.anotherSessionEntry
];
socket.handshake.session!.touch(() => {});
socket.handshake.session!.regenerate(() => {});
socket.handshake.session!.save(() => {});
socket.handshake.session!.reload(() => {});
socket.handshake.session!.destroy(() => {});
});
+7
View File
@@ -7,6 +7,13 @@
import socketio = require('socket.io');
import express = require('express');
declare module "socket.io" {
interface Handshake {
session?: Express.Session;
sessionID?: string;
}
}
declare function sharedsession(
expressSessionMiddleware: express.RequestHandler,
cookieParserMiddleware: express.RequestHandler,
+1 -1
View File
@@ -1387,7 +1387,7 @@ interface hasStartAndEndDateBuilder<B> {
}
interface hasStats {
getStatsFor(dateRange: DayOfWeekString): AdWordsStats;
getStatsFor(dateRange: DateRange): AdWordsStats;
getStatsFor(dateFrom: AdWordsDate | string, dateTo: AdWordsDate | string): AdWordsStats;
}
+4
View File
@@ -82,6 +82,10 @@ declare namespace GoogleAppsScript {
* Sets the URL to navigate to when the action is activated.
*/
setOpenLink(openLink: OpenLink): ActionResponseBuilder;
/**
* Sets a flag to indicate that this action changed the existing data state.
*/
setStateChanged(stateChanged: boolean): ActionResponseBuilder;
}
export interface AuthorizationAction {
+3
View File
@@ -4,8 +4,10 @@ const params: ReCaptchaV2.Parameters = {
type: "image",
size: "normal",
tabindex: 5,
isolated: false,
callback: (response: string) => { },
"expired-callback": () => { },
"error-callback": () => { },
};
const size1: ReCaptchaV2.Size = "compact";
@@ -25,6 +27,7 @@ const id1: number = grecaptcha.render("foo");
const id2: number = grecaptcha.render("foo", params);
const id3: number = grecaptcha.render(document.getElementById("foo"));
const id4: number = grecaptcha.render(document.getElementById("foo"), params);
const id5: number = grecaptcha.render(document.getElementById("foo"), params, true);
// response takes a number and returns a string
const response1: string = grecaptcha.getResponse(id1);
+28 -9
View File
@@ -1,19 +1,24 @@
// Type definitions for Google Recaptcha 2.0
// Project: https://www.google.com/recaptcha
// Definitions by: Kristof Mattei <http://kristofmattei.be>, Martin Costello <https://martincostello.com/>, Ruslan Arkhipau <https://github.com/DethAriel>
// Definitions by: Kristof Mattei <http://kristofmattei.be>
// Martin Costello <https://martincostello.com/>
// Ruslan Arkhipau <https://github.com/DethAriel>
// Rafael Tavares <https://github.com/rafaeltavares>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var grecaptcha: ReCaptchaV2.ReCaptcha;
declare namespace ReCaptchaV2 {
class ReCaptcha {
interface ReCaptcha {
/**
* Renders the container as a reCAPTCHA widget and returns the ID of the newly created widget.
* @param container The HTML element to render the reCAPTCHA widget. Specify either the ID of the container (string) or the DOM element itself.
* @param parameters An object containing parameters as key=value pairs, for example, {"sitekey": "your_site_key", "theme": "light"}. See @see render parameters.
* @param inherit Invisible reCAPTCHA only. Use existing data-* attributes on the element if the corresponding parameter is not specified.
* The values in parameters will take precedence over the attributes.
* @return the ID of the newly created widget.
*/
render(container: (string | HTMLElement), parameters?: Parameters): number;
render(container: (string | HTMLElement), parameters?: Parameters, inherit?: boolean): number;
/**
* Resets the reCAPTCHA widget.
* @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified.
@@ -65,11 +70,6 @@ declare namespace ReCaptchaV2 {
* If other elements in your page use tabindex, it should be set to make user navigation easier.
*/
tabindex?: number;
/**
* Optional. Your callback function that's executed when the user submits a successful CAPTCHA response.
* The user's response, g-recaptcha-response, will be the input for your callback function.
*/
callback?(response: string): void;
/**
* Optional. The badge location for g-recaptcha with size of "invisible".
*
@@ -77,10 +77,29 @@ declare namespace ReCaptchaV2 {
*/
badge?: Badge;
/**
* Optional. Your callback function that's executed when the recaptcha response expires and the user needs to solve a new CAPTCHA.
* Optional. Invisible reCAPTCHA only. For plugin owners to not interfere with existing reCAPTCHA installations on a page.
* If true, this reCAPTCHA instance will be part of a separate ID space.
*
* @default false
*/
isolated?: boolean;
/**
* Optional. Your callback function that's executed when the user submits a successful CAPTCHA response.
* The user's response, g-recaptcha-response, will be the input for your callback function.
*/
callback?(response: string): void;
/**
* Optional. Your callback function that's executed when the reCAPTCHA response expires and the user needs to solve a new CAPTCHA.
*/
// Notice to the reader
// I need to surround this object with quotes, this will however break intellisense in VS 2013.
"expired-callback"?(): void;
/**
* Optional. Your callback function that's executed when reCAPTCHA encounters an error (usually network connectivity) and cannot continue until connectivity is restored.
* If you specify this function, you are responsible for informing the user that they should retry.
*/
// Notice to the reader
// I need to surround this object with quotes, this will however break intellisense in VS 2013.
"error-callback"?(): void;
}
}
+5
View File
@@ -32,6 +32,11 @@ export interface IFrameOptions {
* CSS margin attribute, for example '8px 3em'. A number value is converted into px.
*/
bodyMargin?: number | string;
/**
* Override the default body padding style in the iFrame. A string can be any valid value for the
* CSS margin attribute, for example '8px 3em'. A number value is converted into px.
*/
bodyPadding?: number | string;
/**
* When set to true, only allow incoming messages from the domain listed in the src property of the iFrame tag.
* If your iFrame navigates between different domains, ports or protocols; then you will need to
+160 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for Jest 23.0
// Type definitions for Jest 23.1
// Project: http://facebook.github.io/jest/
// Definitions by: Asana <https://asana.com>
// Ivo Stratev <https://github.com/NoHomey>
@@ -12,10 +12,9 @@
// Douglas Duteil <https://github.com/douglasduteil>
// Ahn <https://github.com/ahnpnl>
// Josh Goldberg <https://github.com/joshuakgoldberg>
// Bradley Ayers <https://github.com/bradleyayers>
// Jeff Lau <https://github.com/UselessPickles>
// Andrew Makarov <https://github.com/r3nya>
// Paweł Mikołajczyk <https://github.com/Miklet>
// Martin Hochel <https://github.com/hotell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -884,6 +883,164 @@ declare namespace jest {
type SnapshotUpdateState = 'all' | 'new' | 'none';
interface DefaultOptions {
automock: boolean;
bail: boolean;
browser: boolean;
cache: boolean;
cacheDirectory: Path;
changedFilesWithAncestor: boolean;
clearMocks: boolean;
collectCoverage: boolean;
collectCoverageFrom: Maybe<string[]>;
coverageDirectory: Maybe<string>;
coveragePathIgnorePatterns: string[];
coverageReporters: string[];
coverageThreshold: Maybe<{global: {[key: string]: number}}>;
errorOnDeprecated: boolean;
expand: boolean;
filter: Maybe<Path>;
forceCoverageMatch: Glob[];
globals: ConfigGlobals;
globalSetup: Maybe<string>;
globalTeardown: Maybe<string>;
haste: HasteConfig;
detectLeaks: boolean;
detectOpenHandles: boolean;
moduleDirectories: string[];
moduleFileExtensions: string[];
moduleNameMapper: {[key: string]: string};
modulePathIgnorePatterns: string[];
noStackTrace: boolean;
notify: boolean;
notifyMode: string;
preset: Maybe<string>;
projects: Maybe<Array<string | ProjectConfig>>;
resetMocks: boolean;
resetModules: boolean;
resolver: Maybe<Path>;
restoreMocks: boolean;
rootDir: Maybe<Path>;
roots: Maybe<Path[]>;
runner: string;
runTestsByPath: boolean;
setupFiles: Path[];
setupTestFrameworkScriptFile: Maybe<Path>;
skipFilter: boolean;
snapshotSerializers: Path[];
testEnvironment: string;
testEnvironmentOptions: object;
testFailureExitCode: string | number;
testLocationInResults: boolean;
testMatch: Glob[];
testPathIgnorePatterns: string[];
testRegex: string;
testResultsProcessor: Maybe<string>;
testRunner: Maybe<string>;
testURL: string;
timers: 'real' | 'fake';
transform: Maybe<{[key: string]: string}>;
transformIgnorePatterns: Glob[];
watchPathIgnorePatterns: string[];
useStderr: boolean;
verbose: Maybe<boolean>;
watch: boolean;
watchman: boolean;
}
interface InitialOptions {
automock?: boolean;
bail?: boolean;
browser?: boolean;
cache?: boolean;
cacheDirectory?: Path;
clearMocks?: boolean;
changedFilesWithAncestor?: boolean;
changedSince?: string;
collectCoverage?: boolean;
collectCoverageFrom?: Glob[];
collectCoverageOnlyFrom?: {[key: string]: boolean};
coverageDirectory?: string;
coveragePathIgnorePatterns?: string[];
coverageReporters?: string[];
coverageThreshold?: {global: {[key: string]: number}};
detectLeaks?: boolean;
detectOpenHandles?: boolean;
displayName?: string;
expand?: boolean;
filter?: Path;
findRelatedTests?: boolean;
forceCoverageMatch?: Glob[];
forceExit?: boolean;
json?: boolean;
globals?: ConfigGlobals;
globalSetup?: Maybe<string>;
globalTeardown?: Maybe<string>;
haste?: HasteConfig;
reporters?: Array<ReporterConfig | string>;
logHeapUsage?: boolean;
lastCommit?: boolean;
listTests?: boolean;
mapCoverage?: boolean;
moduleDirectories?: string[];
moduleFileExtensions?: string[];
moduleLoader?: Path;
moduleNameMapper?: {[key: string]: string};
modulePathIgnorePatterns?: string[];
modulePaths?: string[];
name?: string;
noStackTrace?: boolean;
notify?: boolean;
notifyMode?: string;
onlyChanged?: boolean;
outputFile?: Path;
passWithNoTests?: boolean;
preprocessorIgnorePatterns?: Glob[];
preset?: Maybe<string>;
projects?: Glob[];
replname?: Maybe<string>;
resetMocks?: boolean;
resetModules?: boolean;
resolver?: Maybe<Path>;
restoreMocks?: boolean;
rootDir?: Path;
roots?: Path[];
runner?: string;
runTestsByPath?: boolean;
scriptPreprocessor?: string;
setupFiles?: Path[];
setupTestFrameworkScriptFile?: Path;
silent?: boolean;
skipFilter?: boolean;
skipNodeResolution?: boolean;
snapshotSerializers?: Path[];
errorOnDeprecated?: boolean;
testEnvironment?: string;
testEnvironmentOptions?: object;
testFailureExitCode?: string | number;
testLocationInResults?: boolean;
testMatch?: Glob[];
testNamePattern?: string;
testPathDirs?: Path[];
testPathIgnorePatterns?: string[];
testRegex?: string;
testResultsProcessor?: Maybe<string>;
testRunner?: string;
testURL?: string;
timers?: 'real' | 'fake';
transform?: {[key: string]: string};
transformIgnorePatterns?: Glob[];
watchPathIgnorePatterns?: string[];
unmockedModulePathPatterns?: string[];
updateSnapshot?: boolean;
useStderr?: boolean;
verbose?: Maybe<boolean>;
watch?: boolean;
watchAll?: boolean;
watchman?: boolean;
watchPlugins?: string[];
}
interface GlobalConfig {
bail: boolean;
collectCoverage: boolean;
+921 -724
View File
File diff suppressed because it is too large Load Diff
+28 -7
View File
@@ -1,4 +1,4 @@
// Type definitions for joi v13.0.1
// Type definitions for joi v13.3.0
// Project: https://github.com/hapijs/joi
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Laurence Dougal Myers <https://github.com/laurence-myers>
@@ -12,6 +12,7 @@
// Anjun Wang <https://github.com/wanganjun>
// Rafael Kallis <https://github.com/rafaelkallis>
// Conan Lai <https://github.com/aconanlai>
// Peter Thorson <https://github.com/zaphoyd>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
@@ -106,6 +107,13 @@ export interface EmailOptions {
minDomainAtoms?: number;
}
export interface HexOptions {
/**
* hex decoded representation must be byte aligned
*/
byteAligned: boolean;
}
export interface IpOptions {
/**
* One or more IP address versions to validate against. Valid values: ipv4, ipv6, ipvfuture
@@ -512,6 +520,11 @@ export interface NumberSchema extends AnySchema {
* Requires the number to be negative.
*/
negative(): this;
/**
* Requires the number to be a TCP port, so between 0 and 65535.
*/
port(): this;
}
export interface StringSchema extends AnySchema {
@@ -624,7 +637,7 @@ export interface StringSchema extends AnySchema {
/**
* Requires the string value to be a valid hexadecimal string.
*/
hex(): this;
hex(options?: HexOptions): this;
/**
* Requires the string value to be a valid hostname as per RFC1123.
@@ -714,10 +727,15 @@ export interface ArraySchema extends AnySchema {
export interface ObjectSchema extends AnySchema {
/**
* Sets the allowed object keys.
* Sets or extends the allowed object keys.
*/
keys(schema?: SchemaMap): this;
/**
* Appends the allowed object keys. If schema is null, undefined, or {}, no changes will be applied.
*/
append(schema?: SchemaMap): this;
/**
* Specifies the minimum number of keys in the object.
*/
@@ -966,7 +984,7 @@ export interface Rules<P extends object = any> {
name: string;
params?: ObjectSchema | {[key in keyof P]: SchemaLike; };
setup?(this: ExtensionBoundSchema, params: P): Schema | void;
validate?<R = any>(this: ExtensionBoundSchema, params: P, value: any, state: State, options: ValidationOptions): Err | R;
validate?(this: ExtensionBoundSchema, params: P, value: any, state: State, options: ValidationOptions): any;
description?: string | ((params: P) => string);
}
@@ -974,8 +992,8 @@ export interface Extension {
name: string;
base?: Schema;
language?: LanguageOptions;
coerce?<R = any>(this: ExtensionBoundSchema, value: any, state: State, options: ValidationOptions): Err | R;
pre?<R = any>(this: ExtensionBoundSchema, value: any, state: State, options: ValidationOptions): Err | R;
coerce?(this: ExtensionBoundSchema, value: any, state: State, options: ValidationOptions): any;
pre?(this: ExtensionBoundSchema, value: any, state: State, options: ValidationOptions): any;
describe?(this: Schema, description: Description): Description;
rules?: Rules[];
}
@@ -1101,10 +1119,13 @@ export function ref(key: string, options?: ReferenceOptions): Reference;
export function isRef(ref: any): ref is Reference;
/**
* Get a sub-schema of an existing schema based on a path. Path separator is a dot (.).
* Get a sub-schema of an existing schema based on a `path` that can be either a string or an array
* of strings For string values path separator is a dot (`.`)
*/
export function reach(schema: ObjectSchema, path: string): Schema;
export function reach<T extends Schema>(schema: ObjectSchema, path: string): T;
export function reach(schema: ObjectSchema, path: string[]): Schema;
export function reach<T extends Schema>(schema: ObjectSchema, path: string[]): T;
/**
* Creates a new Joi instance customized with the extension(s) you provide included.
+16 -4
View File
@@ -96,6 +96,12 @@ emailOpts = { minDomainAtoms: num };
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
let hexOpts: Joi.HexOptions = null;
hexOpts = { byteAligned: bool };
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
let ipOpts: Joi.IpOptions = null;
ipOpts = { version: str };
@@ -602,6 +608,7 @@ numSchema = numSchema.precision(num);
numSchema = numSchema.multiple(num);
numSchema = numSchema.positive();
numSchema = numSchema.negative();
numSchema = numSchema.port();
namespace common {
numSchema = numSchema.allow(x);
@@ -659,6 +666,9 @@ objSchema = Joi.object(schemaMap);
objSchema = objSchema.keys();
objSchema = objSchema.keys(schemaMap);
objSchema = objSchema.append();
objSchema = objSchema.append(schemaMap);
objSchema = objSchema.min(num);
objSchema = objSchema.max(num);
objSchema = objSchema.length(num);
@@ -801,6 +811,7 @@ strSchema = strSchema.guid();
strSchema = strSchema.guid({ version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5'] } as Joi.GuidOptions);
strSchema = strSchema.guid({ version: 'uuidv4' });
strSchema = strSchema.hex();
strSchema = strSchema.hex(hexOpts);
strSchema = strSchema.hostname();
strSchema = strSchema.isoDate();
strSchema = strSchema.lowercase();
@@ -969,6 +980,7 @@ description = Joi.describe(schema);
description = schema.describe();
schema = Joi.reach(objSchema, '');
schema = Joi.reach(objSchema, []);
const Joi2 = Joi.extend({ name: '', base: schema });
@@ -988,13 +1000,13 @@ const Joi3 = Joi.extend({
{
name: 'asd',
params: {
allowF: Joi.boolean().default(false),
allowFalse: Joi.boolean().default(false),
},
setup(params) {
const fIsAllowed = params.allowF;
const fIsAllowed = params.allowFalse;
},
validate(params, value, state, options) {
if (value === 'asd' || params.allowF && value === 'asdf') {
validate(params, value: boolean, state, options) {
if (value || params.allowFalse && !value) {
return value;
}
return this.createError('asd', { v: value }, state, options);
+26 -2
View File
@@ -1,11 +1,28 @@
// Type definitions for jQuery Mockjax 2.0.1
// Type definitions for jQuery Mockjax 2.3.0
// Project: https://github.com/jakerella/jquery-mockjax
// Definitions by: Laszlo Jakab <https://github.com/laszlojakab>, Vladimir Đokić <https://github.com/vladeck>
// Definitions by:
// Laszlo Jakab <https://github.com/laszlojakab>,
// Vladimir Đokić <https://github.com/vladeck>,
// James Johnson <https://github.com/hasaki>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="jquery" />
type MockJaxLoggingFunction = (message?: any, ...additionalParameters: any[]) => void;
interface MockJaxStandardLogger {
error?: MockJaxLoggingFunction;
warn?: MockJaxLoggingFunction;
info?: MockJaxLoggingFunction;
log?: MockJaxLoggingFunction;
debug?: MockJaxLoggingFunction;
}
interface MockJaxCustomLogger {
[key: string]: MockJaxLoggingFunction;
}
interface MockJaxSettingsHeaders {
[key: string]: string;
}
@@ -33,15 +50,22 @@ interface MockJaxSettings {
onAfterSuccess?: Function;
onAfterError?: Function;
onAfterComplete?: Function;
logger?: MockJaxStandardLogger | MockJaxCustomLogger;
logLevelMethods?: string[];
namespace?: string;
throwUnmocked?: boolean;
retainAjaxCalls?: boolean;
}
interface MockJaxStatic {
(options: MockJaxSettings): number;
(options: MockJaxSettings[]): number[];
handler(id?: number): any;
clear(id?: number): void;
mockedAjaxCalls(): any[];
unfiredHandlers(): any[];
unmockedAjaxCalls(): any[];
clearRetainedAjaxCalls(): void;
}
interface JQueryStatic {
@@ -192,6 +192,81 @@ class Tests {
}
});
});
t('Standard logger type gets called', (assert) => {
let done = assert.async();
let wasLoggerCalled = false;
let logFunction = () => wasLoggerCalled = true;
let settings: MockJaxSettings = {
url: '/custom-logging-function',
logging: true,
logger: {
error: logFunction,
warn: logFunction,
info: logFunction,
log: logFunction,
debug: logFunction
}
};
$.mockjax(settings);
$.ajax({
url: '/custom-logging-function',
error: self._noErrorCallbackExpected,
complete: (xhr) => {
assert.equal(wasLoggerCalled, true, 'Standard logger was called');
done();
}
});
});
t('Custom logger object gets called', (assert) => {
let done = assert.async();
let wasLoggerCalled = false;
let logFunction = () => wasLoggerCalled = true;
let settings: MockJaxSettings = {
url: '/custom-logging-function',
logging: true,
logger: {
customName: logFunction
},
logLevelMethods: ['customName', 'customName', 'customName', 'customName', 'customName']
};
$.mockjax(settings);
$.ajax({
url: '/custom-logging-function',
error: self._noErrorCallbackExpected,
complete: (xhr) => {
assert.equal(wasLoggerCalled, true, 'Custom logger was called');
done();
}
});
});
t('Throws when ajax call is not mocked', (assert) => {
let done = assert.async();
$.mockjaxSettings.throwUnmocked = true;
$.ajax({
url: '/unmocked-ajax-call',
error: (error) => {
assert.ok(error, 'Expected the call to fail because it was not mocked');
done();
},
complete: (xhr) => {
assert.ok(false, 'Expected a failure');
done();
}
});
});
}
}
+1 -1
View File
@@ -67,7 +67,7 @@ export declare class Element {
getText(): string;
getChildText(name: string, xmlns: any): string;
getChildText(name: string, xmlns?: any): string;
/**
* Return all direct descendents that are Elements.
+5
View File
@@ -2,6 +2,11 @@ import * as ltx from 'ltx';
ltx.parse('<document/>');
const getChildTextElement = ltx.parse('<test><child>body text</child></test>') as ltx.Element;
if (getChildTextElement.getChildText('child') !== 'body text') {
throw new Error("body does not match");
}
const p = new ltx.Parser();
p.on('tree', (ignored: any) => {});
+1
View File
@@ -208,6 +208,7 @@ declare module 'luxon' {
toLocaleParts(options?: DateTimeFormatOptions): any[];
toLocaleString(options?: DateTimeFormatOptions): string;
toObject(options?: { includeConfig?: boolean }): DateObject;
toMillis(): number;
toRFC2822(): string;
toSQL(options?: Object): string;
toSQLDate(): string;
+2
View File
@@ -54,6 +54,8 @@ DateTime.utc();
DateTime.local().toUTC();
DateTime.utc().toLocal();
DateTime.fromMillis(1527780819458).toMillis();
/* Duration */
const dur = Duration.fromObject({ hours: 2, minutes: 7 });
dt.plus(dur);
+49 -38
View File
@@ -1,7 +1,8 @@
// Type definitions for Marked 0.3
// Type definitions for Marked 0.4
// Project: https://github.com/chjj/marked
// Definitions by: William Orr <https://github.com/worr>
// BendingBender <https://github.com/BendingBender>
// CrossR <https://github.com/CrossR>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace marked;
@@ -202,21 +203,9 @@ declare namespace marked {
interface MarkedOptions {
/**
* Type: object Default: new Renderer()
*
* An object containing functions to render tokens to HTML.
* A prefix URL for any relative link.
*/
renderer?: Renderer;
/**
* Enable GitHub flavored markdown.
*/
gfm?: boolean;
/**
* Enable GFM tables. This option requires the gfm option to be true.
*/
tables?: boolean;
baseUrl?: string;
/**
* Enable GFM line breaks. This option requires the gfm option to be true.
@@ -224,34 +213,19 @@ declare namespace marked {
breaks?: boolean;
/**
* Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
* Enable GitHub flavored markdown.
*/
pedantic?: boolean;
gfm?: boolean;
/**
* Sanitize the output. Ignore any HTML that has been input.
* Include an id attribute when emitting headings.
*/
sanitize?: boolean;
headerIds?: boolean;
/**
* Optionally sanitize found HTML with a sanitizer function.
* Set the prefix for header tag ids.
*/
sanitizer?(html: string): string;
/**
* Mangle autolinks (<email@domain.com>).
*/
mangle?: boolean;
/**
* Use smarter list behavior than the original markdown. May eventually be default with the old behavior moved into pedantic.
*/
smartLists?: boolean;
/**
* Shows an HTML error message when rendering fails.
*/
silent?: boolean;
headerPrefix?: string;
/**
* A function to highlight code blocks. The function takes three arguments: code, lang, and callback.
@@ -263,15 +237,52 @@ declare namespace marked {
*/
langPrefix?: string;
/**
* Mangle autolinks (<email@domain.com>).
*/
mangle?: boolean;
/**
* Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
*/
pedantic?: boolean;
/**
* Type: object Default: new Renderer()
*
* An object containing functions to render tokens to HTML.
*/
renderer?: Renderer;
/**
* Sanitize the output. Ignore any HTML that has been input.
*/
sanitize?: boolean;
/**
* Optionally sanitize found HTML with a sanitizer function.
*/
sanitizer?(html: string): string;
/**
* Shows an HTML error message when rendering fails.
*/
silent?: boolean;
/**
* Use smarter list behavior than the original markdown. May eventually be default with the old behavior moved into pedantic.
*/
smartLists?: boolean;
/**
* Use "smart" typograhic punctuation for things like quotes and dashes.
*/
smartypants?: boolean;
/**
* Set the prefix for header tag ids.
* Enable GFM tables. This option requires the gfm option to be true.
*/
headerPrefix?: string;
tables?: boolean;
/**
* Generate closing slash for self-closing tags (<br/> instead of <br>)
+13 -11
View File
@@ -1,6 +1,7 @@
import * as marked from 'marked';
const options: marked.MarkedOptions = {
baseUrl: '',
gfm: true,
tables: true,
breaks: false,
@@ -16,23 +17,24 @@ const options: marked.MarkedOptions = {
renderer: new marked.Renderer()
};
function callback() {
console.log('callback called');
function callback(err: string, markdown: string) {
console.log("Callback called!");
return markdown;
}
const myOldMarked: typeof marked = marked.setOptions(options);
console.log(marked('i am using __markdown__.'));
console.log(marked('i am using __markdown__.', options));
console.log(marked('i am using __markdown__.', callback));
console.log(marked('i am using __markdown__.', options, callback));
console.log(marked('1) I am using __markdown__.'));
console.log(marked('2) I am using __markdown__.', options));
console.log(marked('3) I am using __markdown__.', callback));
console.log(marked('4) I am using __markdown__.', options, callback));
console.log(marked.parse('i am using __markdown__.'));
console.log(marked.parse('i am using __markdown__.', options));
console.log(marked.parse('i am using __markdown__.', callback));
console.log(marked.parse('i am using __markdown__.', options, callback));
console.log(marked.parse('5) I am using __markdown__.'));
console.log(marked.parse('6) I am using __markdown__.', options));
console.log(marked.parse('7) I am using __markdown__.', callback));
console.log(marked.parse('8) I am using __markdown__.', options, callback));
const text = 'something';
const text = 'Something';
const tokens: marked.TokensList = marked.lexer(text, options);
console.log(marked.parser(tokens));
+4467 -2173
View File
File diff suppressed because it is too large Load Diff
+30 -17
View File
@@ -33,7 +33,7 @@ Bignumbers examples
{
// configure the default type of numbers as BigNumbers
math.config({
number: 'bignumber',
number: 'BigNumber',
precision: 20,
});
@@ -108,16 +108,13 @@ Complex numbers examples
// create a complex number from polar coordinates
{
const p: math.PolarCoordinates = { r: math.sqrt(2), phi: math.pi / 4 };
const c: math.Complex = math
.complex(p);
const p: math.PolarCoordinates = { r: math.sqrt(2), phi: math.pi / 4 };
const c: math.Complex = math.complex(p);
}
// get polar coordinates of a complex number
{
const p: math.PolarCoordinates = math
.complex(3, 4)
.toPolar();
const p: math.PolarCoordinates = math.complex(3, 4).toPolar();
}
}
@@ -175,6 +172,11 @@ Expressions examples
// get and set variables and functions
{
parser.eval('x = 7 / 2'); // 3.5
parser.eval('x + 3'); // 6.5
parser.eval('f(x, y) = x^y'); // f(x, y)
parser.eval('f(2, 3)'); // 8
const x = parser.get('x');
const f = parser.get('f');
const g = f(3, 3);
@@ -193,7 +195,7 @@ Fractions examples
{
// configure the default type of numbers as Fractions
math.config({
number: 'fraction',
number: 'Fraction',
});
const x = math.fraction(0.125);
@@ -205,9 +207,6 @@ Fractions examples
// output formatting
const a = math.fraction('2/3');
console.log(math.format(a));
console.log(math.format(a, {fraction: 'ratio'}));
console.log(math.format(a, {fraction: 'decimal'}));
}
/*
@@ -237,7 +236,8 @@ Matrices examples
b.subset(math.index(1, [0, 1]), [[7, 8]]);
const c = math.multiply(a, b);
const d: math.Matrix = c.subset(math.index(1, 0));
const f: math.Matrix = math.matrix([1, 0]);
const d: math.Matrix = f.subset(math.index(1, 0));
}
// get a sub matrix
@@ -282,8 +282,9 @@ Sparse matrices examples
// do operations with a sparse matrix
const b = math.multiply(a, a);
const c = math.multiply(b, math.complex(2, 2));
const d = math.transpose(c);
const e = math.multiply(d, a);
const d = math.matrix([0, 1]);
const e = math.transpose(d);
const f = math.multiply(e, a);
}
/*
@@ -299,8 +300,8 @@ Units examples
math.createUnit('foo');
math.createUnit('furlong', '220 yards');
math.createUnit('furlong', '220 yards', {override: true});
math.createUnit('fahrenheit', {definition: '0.555556 kelvin', offset: 459.67});
math.createUnit('fahrenheit', {definition: '0.555556 kelvin', offset: 459.67}, {override: true});
math.createUnit('testunit', {definition: '0.555556 kelvin', offset: 459.67});
math.createUnit('testunit', {definition: '0.555556 kelvin', offset: 459.67}, {override: true});
math.createUnit('knot', {definition: '0.514444 m/s', aliases: ['knots', 'kt', 'kts']});
math.createUnit('knot', {definition: '0.514444 m/s', aliases: ['knots', 'kt', 'kts']}, {override: true});
math.createUnit('knot', {
@@ -309,7 +310,7 @@ Units examples
prefixes: 'long'
}, {override: true});
math.createUnit({
foo: {
foo_2: {
prefixes: 'long'
},
bar: '40 foo',
@@ -365,3 +366,15 @@ Expression tree examples
}
});
}
/*
JSON serialization/deserialization
*/
{
const data = {
bigNumber: math.bignumber('1.5')
};
const stringified = JSON.stringify(data);
const parsed = JSON.parse(stringified, math.json.reviver);
parsed.bigNumber === math.bignumber('1.5'); // true
}
+5
View File
@@ -68,6 +68,11 @@ export declare interface Response {
readonly names: Translations;
};
readonly postal?: { code: string };
readonly isp?: {
readonly isp: string;
readonly autonomous_system_number: number;
};
readonly connection?: { connection_type: string };
}
export declare interface Translations {
+5
View File
@@ -781,3 +781,8 @@ DDPRateLimiter.addRule({ userId: 'foo' }, 5, 1000);
DDPRateLimiter.addRule({ userId: userId => userId == 'foo' }, 5, 1000);
Template.instance().autorun(() => { }).stop();
// Mongo Collection without connection (local collection)
const collectionWithoutConnection = new Mongo.Collection<MonkeyDAO>("monkey", {
connection: null
});
+2 -2
View File
@@ -124,7 +124,7 @@ declare module Mongo {
var Collection: CollectionStatic;
interface CollectionStatic {
new <T>(name: string, options?: {
connection?: Object;
connection?: Object | null;
idGeneration?: string;
transform?: Function;
}): Collection<T>;
@@ -348,7 +348,7 @@ declare module "meteor/mongo" {
var Collection: CollectionStatic;
interface CollectionStatic {
new <T>(name: string, options?: {
connection?: Object;
connection?: Object | null;
idGeneration?: string;
transform?: Function;
}): Collection<T>;
+6 -6
View File
@@ -80,12 +80,12 @@ declare module "moment" {
}
interface LocaleSpecification {
durationLabelsLong: DurationLabelDef;
durationLabelsStandard: DurationLabelDef;
durationLabelsShort: DurationLabelDef;
durationTimeTemplates: DurationTimeDef;
durationLabelTypes: DurationLabelTypeDef[];
durationPluralKey: (token: string, integerValue: number, decimalValue: number) => string;
durationLabelsLong?: DurationLabelDef;
durationLabelsStandard?: DurationLabelDef;
durationLabelsShort?: DurationLabelDef;
durationTimeTemplates?: DurationTimeDef;
durationLabelTypes?: DurationLabelTypeDef[];
durationPluralKey?: (token: string, integerValue: number, decimalValue: number) => string;
}
type TemplateFunction = ((this: DurationFormatSettings) => string);
+1 -1
View File
@@ -1252,7 +1252,7 @@ export class Cursor<T = Default> extends Readable {
/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#limit */
limit(value: number): Cursor<T>;
/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#map */
map(transform: Function): Cursor<T>;
map<U>(transform: (T) => U): Cursor<U>;
/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#max */
max(max: number): Cursor<T>;
/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#maxAwaitTimeMS */
+7 -7
View File
@@ -103,7 +103,10 @@ declare module "mongoose" {
export function createConnection(): Connection;
export function createConnection(uri: string,
options?: ConnectionOptions
): Connection;
): Connection & {
then: Promise<Connection>["then"];
catch: Promise<Connection>["catch"];
};
/**
* Disconnects all connections.
@@ -201,7 +204,7 @@ declare module "mongoose" {
*/
open(connection_string: string, database?: string, port?: number,
options?: ConnectionOpenOptions, callback?: (err: any) => void): any;
/**
* Opens the connection to MongoDB.
* @param mongodb://uri or the host to which you are connecting
@@ -451,9 +454,6 @@ declare module "mongoose" {
/** Expose the possible connection states. */
static STATES: any;
then: Promise<Connection>["then"];
catch: Promise<Connection>["catch"];
}
/*
@@ -2727,9 +2727,9 @@ declare module "mongoose" {
* This function does not trigger save middleware.
* @param docs Documents to insert.
* @param options Optional settings.
* @param options.ordered if true, will fail fast on the first error encountered.
* @param options.ordered if true, will fail fast on the first error encountered.
* If false, will insert all the documents it can and report errors later.
* @param options.rawResult if false, the returned promise resolves to the documents that passed mongoose document validation.
* @param options.rawResult if false, the returned promise resolves to the documents that passed mongoose document validation.
* If `false`, will return the [raw result from the MongoDB driver](http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~insertWriteOpCallback)
* with a `mongoose` property that contains `validationErrors` if this is an unordered `insertMany`.
*/
+7
View File
@@ -161,6 +161,13 @@ mongoose.Connection.STATES.hasOwnProperty('');
conn1.on('data', cb);
conn1.addListener('close', cb);
// The connection returned by useDb is *not* thenable.
// From https://github.com/DefinitelyTyped/DefinitelyTyped/pull/26057#issuecomment-396150819
const getDB = async (tenant: string)=> {
return conn1.useDb(tenant);
};
/*
* section error/validation.js
* http://mongoosejs.com/docs/api.html#error-validation-js
+2
View File
@@ -71,6 +71,8 @@ declare namespace multer {
fields(fields: Field[]): express.RequestHandler;
/** Accepts all files that comes over the wire. An array of files will be stored in req.files. */
any(): express.RequestHandler;
/** Accept only text fields. If any file upload is made, error with code “LIMIT_UNEXPECTED_FILE” will be issued. This is the same as doing upload.fields([]). */
none(): express.RequestHandler;
}
}
+18
View File
@@ -0,0 +1,18 @@
import * as React from "react";
import { NextContext } from ".";
import { SingletonRouter } from "./router";
export interface AppComponentProps {
Component: React.ComponentType<any>;
pageProps: any;
}
export interface AppComponentContext {
Component: React.ComponentType<any>;
router: SingletonRouter;
ctx: NextContext;
}
export class Container extends React.Component {}
export default class App<TProps = {}> extends React.Component<TProps & AppComponentProps> {}
+14 -27
View File
@@ -1,30 +1,5 @@
import * as React from "react";
import * as http from "http";
export interface Context {
err?: Error;
req: http.IncomingMessage;
res: http.ServerResponse;
pathname: string;
query?: {
[key: string]:
| boolean
| boolean[]
| number
| number[]
| string
| string[];
};
asPath: string;
renderPage(
enhancer?: (page: React.Component) => React.ComponentType<any>
): {
html?: string;
head: Array<React.ReactElement<any>>;
errorHtml: string;
};
}
import { NextContext } from ".";
export interface DocumentProps {
__NEXT_DATA__?: any;
@@ -38,9 +13,21 @@ export interface DocumentProps {
[key: string]: any;
}
/**
* Context object used inside `Document`
*/
export interface NextDocumentContext extends NextContext {
/** A callback that executes the actual React rendering logic (synchronously) */
renderPage(
cb?: (enhancer: () => JSX.Element) => React.ComponentType<any>
): {
[key: string]: any
};
}
export class Head extends React.Component<any> {}
export class Main extends React.Component {}
export class NextScript extends React.Component {}
export default class extends React.Component<DocumentProps> {
static getInitialProps(ctx: Context): DocumentProps;
static getInitialProps(ctx: NextContext): DocumentProps;
}
+51 -12
View File
@@ -1,7 +1,9 @@
// Type definitions for next 2.4
// Type definitions for next 6.0
// Project: https://github.com/zeit/next.js
// Definitions by: Drew Hays <https://github.com/dru89>
// Brice BERNARD <https://github.com/brikou>
// James Hegedus <https://github.com/jthegedus>
// Resi Respati <https://github.com/resir014>
// Scott Jones <https://github.com/scottdj92>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -11,7 +13,44 @@
import * as http from "http";
import * as url from "url";
import { Response as NodeResponse } from "node-fetch";
declare namespace next {
/**
* Context object used in methods like `getInitialProps()`
* <<https://github.com/zeit/next.js/issues/1651>>
*/
interface NextContext {
/** path section of URL */
pathname: string;
/** query string section of URL parsed as an object */
query: {
[key: string]:
| boolean
| boolean[]
| number
| number[]
| string
| string[];
};
/** String of the actual path (including the query) shows in the browser */
asPath: string;
/** HTTP request object (server only) */
req?: http.IncomingMessage;
/** HTTP response object (server only) */
res?: http.ServerResponse;
/** Fetch Response object (client only) - from https://developer.mozilla.org/en-US/docs/Web/API/Response */
jsonPageRes?: NodeResponse;
/** Error object if any error is encountered during the rendering */
err?: Error;
}
type NextSFC<TProps = {}> = NextStatelessComponent<TProps>;
interface NextStatelessComponent<TProps = {}>
extends React.StatelessComponent<TProps> {
getInitialProps?: (ctx: NextContext) => Promise<TProps>;
}
type UrlLike = url.UrlObject | url.Url;
interface ServerConfig {
@@ -41,12 +80,12 @@ declare namespace next {
handleRequest(
req: http.IncomingMessage,
res: http.ServerResponse,
parsedUrl?: UrlLike,
parsedUrl?: UrlLike
): Promise<void>;
getRequestHandler(): (
req: http.IncomingMessage,
res: http.ServerResponse,
parsedUrl?: UrlLike,
parsedUrl?: UrlLike
) => Promise<void>;
prepare(): Promise<void>;
close(): Promise<void>;
@@ -55,7 +94,7 @@ declare namespace next {
run(
req: http.IncomingMessage,
res: http.ServerResponse,
parsedUrl: UrlLike,
parsedUrl: UrlLike
): Promise<void>;
render(
@@ -71,7 +110,7 @@ declare namespace next {
| string
| string[];
},
parsedUrl?: UrlLike,
parsedUrl?: UrlLike
): Promise<void>;
renderError(
err: any,
@@ -86,12 +125,12 @@ declare namespace next {
| number[]
| string
| string[];
},
}
): Promise<void>;
render404(
req: http.IncomingMessage,
res: http.ServerResponse,
parsedUrl: UrlLike,
parsedUrl: UrlLike
): Promise<void>;
renderToHTML(
req: http.IncomingMessage,
@@ -105,7 +144,7 @@ declare namespace next {
| number[]
| string
| string[];
},
}
): Promise<string>;
renderErrorToHTML(
err: any,
@@ -120,13 +159,13 @@ declare namespace next {
| number[]
| string
| string[];
},
}
): Promise<string>;
serveStatic(
req: http.IncomingMessage,
res: http.ServerResponse,
path: string,
path: string
): Promise<void>;
isServeableUrl(path: string): boolean;
isInternalUrl(req: http.IncomingMessage): boolean;
@@ -135,12 +174,12 @@ declare namespace next {
getCompilationError(
page: string,
req: http.IncomingMessage,
res: http.ServerResponse,
res: http.ServerResponse
): Promise<any>;
handleBuildHash(
filename: string,
hash: string,
res: http.ServerResponse,
res: http.ServerResponse
): void;
send404(res: http.ServerResponse): void;
}
+27
View File
@@ -0,0 +1,27 @@
import * as React from "react";
import App, { Container } from "next/app";
interface NextComponentProps {
example: string;
}
class TestApp extends App<NextComponentProps> {
static async getInitialProps({ Component, router, ctx }: any) {
let pageProps = {};
if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx);
}
return { pageProps };
}
render() {
const { Component, pageProps } = this.props;
return (
<Container>
<Component {...pageProps} />
</Container>
);
}
}
+28
View File
@@ -0,0 +1,28 @@
import * as React from "react";
import { NextStatelessComponent, NextContext } from "next";
interface NextComponentProps {
example: string;
}
class ClassNext extends React.Component<NextComponentProps> {
static async getInitialProps(ctx: NextContext) {
const { example } = ctx.query;
return { example };
}
render() {
return (
<div>I'm a class component! {this.props.example}</div>
);
}
}
const StatelessNext: NextStatelessComponent<NextComponentProps> = ({ example }) => (
<div>I'm a stateless component! {example}</div>
);
StatelessNext.getInitialProps = async ({ query }: NextContext) => {
const { example } = query;
return { example: example as string };
};
+33 -5
View File
@@ -1,12 +1,40 @@
import Document, * as document from "next/document";
import Document, { Head, Main, NextScript, NextDocumentContext } from 'next/document';
import * as React from "react";
const results = (
<Document any="property" should="work" here>
<document.Head some="more" properties>
<Head some="more" properties>
<meta name="description" content="Head can have children, too!" />
</document.Head>
<document.Main />
<document.NextScript />
</Head>
<Main />
<NextScript />
</Document>
);
const Wrapper: React.SFC = ({ children }) => <React.Fragment>{children}</React.Fragment>;
export default class MyDocument extends Document {
static async getInitialProps({ renderPage }: NextDocumentContext) {
// Without callback
const page = renderPage();
// With callback
const differentPage = renderPage(App => props => <Wrapper><App {...props} /></Wrapper>);
const style = {};
return { ...page, style };
}
render() {
return (
<html>
<Head>
<title>My page</title>
<style id='cxs-style' dangerouslySetInnerHTML={{ __html: this.props.style }} />
</Head>
<body>
<Main />
<NextScript />
</body>
</html>
);
}
}
+4 -1
View File
@@ -20,6 +20,7 @@
},
"files": [
"index.d.ts",
"app.d.ts",
"document.d.ts",
"dynamic.d.ts",
"error.d.ts",
@@ -28,11 +29,13 @@
"router.d.ts",
"config.d.ts",
"test/next-tests.ts",
"test/next-app-tests.tsx",
"test/next-error-tests.tsx",
"test/next-head-tests.tsx",
"test/next-document-tests.tsx",
"test/next-link-tests.tsx",
"test/next-dynamic-tests.tsx",
"test/next-router-tests.tsx"
"test/next-router-tests.tsx",
"test/next-component-tests.tsx"
]
}
+33 -23
View File
@@ -24,6 +24,7 @@
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Alexander T. <https://github.com/a-tarasyuk>
// Lishude <https://github.com/islishude>
// Andrew Makarov <https://github.com/r3nya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** inspector module types */
@@ -2540,6 +2541,12 @@ declare module "dns" {
export function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>;
}
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export namespace lookupService {
export function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
}
export interface ResolveOptions {
ttl: boolean;
}
@@ -6849,12 +6856,15 @@ declare module "http2" {
import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders } from "http";
export { OutgoingHttpHeaders } from "http";
export interface IncomingHttpStatusHeader {
":status"?: number;
}
export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders {
':path'?: string;
':method'?: string;
':status'?: string;
':authority'?: string;
':scheme'?: string;
":path"?: string;
":method"?: string;
":authority"?: string;
":scheme"?: string;
}
// Http2Stream
@@ -7001,34 +7011,34 @@ declare module "http2" {
export interface ClientHttp2Stream extends Http2Stream {
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "headers", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
addListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
addListener(event: "response", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
addListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "headers", headers: IncomingHttpHeaders, flags: number): boolean;
emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean;
emit(event: "response", headers: IncomingHttpHeaders, flags: number): boolean;
emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "headers", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
on(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
on(event: "response", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
on(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "headers", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
once(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
once(event: "response", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
once(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "headers", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependListener(event: "response", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "headers", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependOnceListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependOnceListener(event: "response", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependOnceListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
}
export interface ServerHttp2Stream extends Http2Stream {
@@ -7156,32 +7166,32 @@ declare module "http2" {
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
addListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
addListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
addListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "altsvc", alt: string, origin: string, stream: number): boolean;
emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
on(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
on(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
once(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
once(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
once(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
prependListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
prependListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
prependListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
prependOnceListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
prependOnceListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
prependOnceListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
}
export interface AlternativeServiceOptions {
+9 -1
View File
@@ -3114,6 +3114,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});
@@ -3561,7 +3567,9 @@ namespace http2_tests {
let clientHttp2Stream: http2.ClientHttp2Stream;
clientHttp2Stream.on('headers', (headers: http2.IncomingHttpHeaders, flags: number) => {});
clientHttp2Stream.on('push', (headers: http2.IncomingHttpHeaders, flags: number) => {});
clientHttp2Stream.on('response', (headers: http2.IncomingHttpHeaders, flags: number) => {});
clientHttp2Stream.on('response', (headers: http2.IncomingHttpHeaders & http2.IncomingHttpStatusHeader, flags: number) => {
const s: number = headers[':status'];
});
// ServerHttp2Stream
let serverHttp2Stream: http2.ServerHttp2Stream;
+8 -1
View File
@@ -3,6 +3,7 @@
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>
// DefinitelyTyped <https://github.com/DefinitelyTyped/DefinitelyTyped>
// Sebastian Silbermann <https://github.com/eps1lon>
// Sander Koenders <https://github.com/Archcry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/************************************************
@@ -407,6 +408,10 @@ declare namespace NodeJS {
isTTY?: true;
}
export interface ProcessEnv {
[key: string]: string | undefined;
}
export interface Process extends EventEmitter {
stdout: Socket;
stderr: Socket;
@@ -418,7 +423,7 @@ declare namespace NodeJS {
chdir(directory: string): void;
cwd(): string;
debugPort: number;
env: any;
env: ProcessEnv;
exit(code?: number): void;
exitCode: number;
getgid(): number;
@@ -1445,6 +1450,8 @@ declare module "dns" {
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export interface MxRecord {
priority: number;
exchange: string;
+7 -13
View File
@@ -734,19 +734,7 @@ namespace path_tests {
// returns
// ['foo', 'bar', 'baz']
console.log(process.env.PATH)
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
process.env.PATH.split(path.delimiter)
// returns
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
console.log(process.env.PATH)
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
process.env.PATH.split(path.delimiter)
// returns
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
process.env["PATH"]; // $ExpectType string
path.parse('/home/user/dir/file.txt')
// returns
@@ -1196,6 +1184,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});
+8 -1
View File
@@ -7,6 +7,7 @@
// Sebastian Silbermann <https://github.com/eps1lon>
// Alorel <https://github.com/Alorel>
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Sander Koenders <https://github.com/Archcry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/************************************************
@@ -460,6 +461,10 @@ declare namespace NodeJS {
isTTY?: true;
}
export interface ProcessEnv {
[key: string]: string | undefined;
}
export interface WriteStream extends Socket {
columns?: number;
rows?: number;
@@ -482,7 +487,7 @@ declare namespace NodeJS {
cwd(): string;
debugPort: number;
emitWarning(warning: string | Error, name?: string, ctor?: Function): void;
env: any;
env: ProcessEnv;
exit(code?: number): void;
exitCode: number;
getgid(): number;
@@ -2057,6 +2062,8 @@ declare module "dns" {
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export interface MxRecord {
priority: number;
exchange: string;
+7 -13
View File
@@ -1364,19 +1364,7 @@ namespace path_tests {
// returns
// ['foo', 'bar', 'baz']
console.log(process.env.PATH)
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
process.env.PATH.split(path.delimiter)
// returns
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
console.log(process.env.PATH)
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
process.env.PATH.split(path.delimiter)
// returns
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
process.env["PATH"]; // $ExpectType string
path.parse('/home/user/dir/file.txt')
// returns
@@ -2407,6 +2395,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});
+8 -1
View File
@@ -7,6 +7,7 @@
// Wilco Bakker <https://github.com/WilcoBakker>
// Sebastian Silbermann <https://github.com/eps1lon>
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Sander Koenders <https://github.com/Archcry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/************************************************
@@ -456,6 +457,10 @@ declare namespace NodeJS {
isTTY?: true;
}
export interface ProcessEnv {
[key: string]: string | undefined;
}
export interface WriteStream extends Socket {
columns?: number;
rows?: number;
@@ -479,7 +484,7 @@ declare namespace NodeJS {
cwd(): string;
debugPort: number;
emitWarning(warning: string | Error, name?: string, ctor?: Function): void;
env: any;
env: ProcessEnv;
exit(code?: number): never;
exitCode: number;
getgid(): number;
@@ -2100,6 +2105,8 @@ declare module "dns" {
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export interface ResolveOptions {
ttl: boolean;
}
+7 -13
View File
@@ -1346,19 +1346,7 @@ namespace path_tests {
// returns
// ['foo', 'bar', 'baz']
console.log(process.env.PATH)
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
process.env.PATH.split(path.delimiter)
// returns
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
console.log(process.env.PATH)
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
process.env.PATH.split(path.delimiter)
// returns
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
process.env["PATH"]; // $ExpectType string
path.parse('/home/user/dir/file.txt')
// returns
@@ -2398,6 +2386,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});
+7
View File
@@ -21,6 +21,7 @@
// Bruno Scheufler <https://github.com/brunoscheufler>
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Lishude <https://github.com/islishude>
// Andrew Makarov <https://github.com/r3nya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
@@ -2444,6 +2445,12 @@ declare module "dns" {
export function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>;
}
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export namespace lookupService {
export function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
}
export interface ResolveOptions {
ttl: boolean;
}
+6
View File
@@ -3075,6 +3075,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});
+7
View File
@@ -24,6 +24,7 @@
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Alexander T. <https://github.com/a-tarasyuk>
// Lishude <https://github.com/islishude>
// Andrew Makarov <https://github.com/r3nya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** inspector module types */
@@ -2525,6 +2526,12 @@ declare module "dns" {
export function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>;
}
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export namespace lookupService {
export function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
}
export interface ResolveOptions {
ttl: boolean;
}
+6
View File
@@ -3108,6 +3108,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});
+249 -87
View File
@@ -240,8 +240,20 @@ declare namespace Office {
*/
var context: Context;
/**
* This method is called after the Office API was loaded.
* @param reason Indicates how the app was initialized
* Occurs when the runtime environment is loaded and the add-in is ready to start interacting with the application and hosted document.
*
* The reason parameter of the initialize event listener function returns an `InitializationReason` enumeration value that specifies how initialization occurred. A task pane or content add-in can be initialized in two ways:
*
* - The user just inserted it from Recently Used Add-ins section of the Add-in drop-down list on the Insert tab of the ribbon in the Office host application, or from Insert add-in dialog box.
*
* - The user opened a document that already contains the add-in.
*
* *Note*: The reason parameter of the initialize event listener function only returns an `InitializationReason` enumeration value for task pane and content add-ins. It does not return a value for Outlook add-ins.
*
* @remarks
* Hosts: Access, Excel, Outlook, PowerPoint, Project, Word
*
* @param reason Indicates how the app was initialized.
*/
function initialize(reason: InitializationReason): void;
/**
@@ -252,8 +264,12 @@ declare namespace Office {
*/
function onReady(callback?: (info: { host: HostType, platform: PlatformType }) => any): Promise<{ host: HostType, platform: PlatformType }>;
/**
* Indicates if the large namespace for objects will be used or not.
* @param useShortNamespace Indicates if 'true' that the short namespace will be used
* Toggles on and off the `Office` alias for the full `Microsoft.Office.WebExtension` namespace.
*
* @remarks
* Hosts: Access, Excel, Outlook, PowerPoint, Project, Word
*
* @param useShortNamespace True to use the shortcut alias; otherwise false to disable it. The default is true.
*/
function useShortNamespace(useShortNamespace: boolean): void;
// Enumerations
@@ -523,7 +539,7 @@ declare namespace Office {
*/
name: string;
}
export namespace AddinCommands {
namespace AddinCommands {
/**
* The event object is passed as a parameter to add-in functions invoked by UI-less command buttons. The object allows the add-in to identify which button was clicked and to signal the host that it has completed its processing.
*
@@ -539,8 +555,13 @@ declare namespace Office {
*
* Applicable Outlook mode: Compose or Read
*/
export interface Event {
interface Event {
/**
* Information about the control that triggered calling this function
*/
source:Source;
/**
* Indicates that the add-in has completed processing that was triggered by an add-in command button or event handler.
*
@@ -561,6 +582,17 @@ declare namespace Office {
*/
completed(options?: any): void;
}
/**
* Encapsulates source data for add-in events.
*/
interface Source {
/**
* The id of the control that triggered calling this function. The id comes from the manifest and is the unique ID of your Office Add-in as a GUID.
*/
id: string;
}
}
/**
* Provides objects and methods that you can use to create and manipulate UI components, such as dialog boxes, in your Office Add-ins.
@@ -5851,7 +5883,7 @@ declare namespace Office {
*
* The prependAsync method inserts the specified string at the beginning of the item body. After insertion, the cursor is returned to its original place, relative to the inserted content.
*
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to LPNoLP.
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to "LPNoLP" (please see the Examples section for a sample).
*
* [Api set: Mailbox 1.1]
*
@@ -5859,6 +5891,11 @@ declare namespace Office {
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem
* Applicable Outlook mode: Compose
* Errors: DataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
*
* In addition to the main signature, this method also has these signatures:
* prependAsync(data: string, options: AsyncContextOptions & CoercionTypeOptions): void;
* prependAsync(data: string, callback: (result: AsyncResult) => void): void;
* prependAsync(data: string): void;
*
* @param data The string to be inserted at the beginning of the body. The string is limited to 1,000,000 characters.
* @param options Optional. An object literal that contains one or more of the following properties.
@@ -5872,7 +5909,7 @@ declare namespace Office {
*
* The prependAsync method inserts the specified string at the beginning of the item body. After insertion, the cursor is returned to its original place, relative to the inserted content.
*
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to LPNoLP.
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to "LPNoLP" (please see the Examples section for a sample).
*
* [Api set: Mailbox 1.1]
*
@@ -5892,7 +5929,7 @@ declare namespace Office {
*
* The prependAsync method inserts the specified string at the beginning of the item body. After insertion, the cursor is returned to its original place, relative to the inserted content.
*
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to LPNoLP.
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to "LPNoLP" (please see the Examples section for a sample).
*
* [Api set: Mailbox 1.1]
*
@@ -5910,7 +5947,7 @@ declare namespace Office {
*
* The prependAsync method inserts the specified string at the beginning of the item body. After insertion, the cursor is returned to its original place, relative to the inserted content.
*
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to LPNoLP.
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to "LPNoLP" (please see the Examples section for a sample).
*
* [Api set: Mailbox 1.1]
*
@@ -5927,7 +5964,7 @@ declare namespace Office {
*
* When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine.
*
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to LPNoLP.
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to "LPNoLP" (please see the Examples section for a sample).
*
* [Api set: Mailbox 1.3]
*
@@ -5939,6 +5976,11 @@ declare namespace Office {
* Errors: DataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
*
* InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text.
*
* In addition to the main signature, this method also has these signatures:
* setAsync(data: string, options: AsyncContextOptions & CoercionTypeOptions): void;
* setAsync(data: string, callback: (result: AsyncResult) => void): void;
* setAsync(data: string): void; *
*
* @param data The string that will replace the existing body. The string is limited to 1,000,000 characters.
* @param options Optional. An object literal that contains one or more of the following properties.
@@ -5952,7 +5994,7 @@ declare namespace Office {
*
* When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine.
*
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to LPNoLP.
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to "LPNoLP" (please see the Examples section for a sample).
*
* [Api set: Mailbox 1.3]
*
@@ -5976,7 +6018,7 @@ declare namespace Office {
*
* When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine.
*
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to LPNoLP.
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to "LPNoLP" (please see the Examples section for a sample).
*
* [Api set: Mailbox 1.3]
*
@@ -5998,7 +6040,7 @@ declare namespace Office {
*
* When working with HTML-formatted bodies, it is important to note that the Body.getAsync and Body.setAsync methods are not idempotent. The value returned from the getAsync method will not necessarily be exactly the same as the value that was passed in the setAsync method previously. The client may modify the value passed to setAsync in order to make it render efficiently with its rendering engine.
*
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to LPNoLP.
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to "LPNoLP" (please see the Examples section for a sample).
*
* [Api set: Mailbox 1.3]
*
@@ -6020,7 +6062,7 @@ declare namespace Office {
*
* The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content.
*
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to LPNoLP.
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to "LPNoLP" (please see the Examples section for a sample).
*
* [Api set: Mailbox 1.1]
*
@@ -6032,7 +6074,12 @@ declare namespace Office {
* Errors: DataExceedsMaximumSize - The data parameter is longer than 1,000,000 characters.
*
* InvalidFormatError - The options.coercionType parameter is set to Office.CoercionType.Html and the message body is in plain text.
*
*
* In addition to the main signature, this method also has these signatures:
* setSelectedDataAsync(data: string, options: AsyncContextOptions & CoercionTypeOptions): void;
* setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void;
* setSelectedDataAsync(data: string): void; *
* *
* @param data The string that will replace the existing body. The string is limited to 1,000,000 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.
@@ -6045,7 +6092,7 @@ declare namespace Office {
*
* The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content.
*
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to LPNoLP.
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to "LPNoLP" (please see the Examples section for a sample).
*
* [Api set: Mailbox 1.1]
*
@@ -6069,7 +6116,7 @@ declare namespace Office {
*
* The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content.
*
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to LPNoLP.
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to "LPNoLP" (please see the Examples section for a sample).
*
* [Api set: Mailbox 1.1]
*
@@ -6091,7 +6138,7 @@ declare namespace Office {
*
* The setSelectedDataAsync method inserts the specified string at the cursor location in the body of the item, or, if text is selected in the editor, it replaces the selected text. If the cursor was never in the body of the item, or if the body of the item lost focus in the UI, the string will be inserted at the top of the body content. After insertion, the cursor is placed at the end of the inserted content.
*
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to LPNoLP.
* When including links in HTML markup, you can disable online link preview by setting the id attribute on the anchor (<a>) to "LPNoLP" (please see the Examples section for a sample).
*
* [Api set: Mailbox 1.1]
*
@@ -6410,6 +6457,9 @@ declare namespace Office {
*
* Applicable Outlook mode: Compose
*
* In addition to this signature, the method also has the following signatures:
* getAsync(callback?: (result: AsyncResult) => void): void;
*
* @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 AsyncResult object.
@@ -6899,6 +6949,9 @@ declare namespace Office {
*
* Applicable Outlook mode: Compose or read
*
* In addition to this signature, the method also has the following signatures:
* addHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;
*
* @param eventType The event that should invoke the handler.
* @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 options Optional. An object literal that contains one or more of the following properties.
@@ -6959,6 +7012,9 @@ declare namespace Office {
*
* Applicable Outlook mode: Compose or read
*
* In addition to this signature, the method also has the following signatures:
* removeHandlerAsync(eventType:EventType, handler: any, callback?: (result: AsyncResult) => void): void;
*
* @param eventType The event that should invoke the handler.
* @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 options Optional. An object literal that contains one or more of the following properties.
@@ -7027,6 +7083,11 @@ declare namespace Office {
* FileTypeNotSupported - The attachment has an extension that is not allowed.
*
* NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
*
* In addition to this signature, the method also has the following signatures:
* addFileAttachmentAsync(uri: string, attachmentName: string): void;
* addFileAttachmentAsync(uri: string, attachmentName: string, options: AsyncContextOptions): void;
* addFileAttachmentAsync(uri: string, attachmentName: string, callback: (result: AsyncResult) => void): void;
*
* @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.
@@ -7138,6 +7199,11 @@ declare namespace Office {
* Errors:
*
* NumberOfAttachmentsExceeded - The message or appointment has too many attachments.
*
* In addition to the main signature, this method also has these signatures:
* addItemAttachmentAsync(itemId: any, attachmentName: string): void;
* addItemAttachmentAsync(itemId: any, attachmentName: string, options: AsyncContextOptions): void;
* addItemAttachmentAsync(itemId: any, attachmentName: string, callback: (result: AsyncResult) => void): void;
*
* @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.
@@ -7260,7 +7326,34 @@ declare namespace Office {
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type 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.
*/
getInitializationContextAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
/**
/**
* Asynchronously returns selected data from the subject or body of a message.
*
* If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error.
*
* To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject.
*
* [Api set: Mailbox 1.0]
*
* @returns
* The selected data as a string with format determined by coercionType.
*
* @remarks
*
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem
*
* Applicable Outlook mode: Compose
*
* In addition to this signature, the method also has these signatures:
* getSelectedDataAsync(coercionType: CoercionType, callback: (result: AsyncResult) => void): void;
*
* @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 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 AsyncResult.
*/
getSelectedDataAsync(coercionType: CoercionType, options: AsyncContextOptions, callback: (result: AsyncResult) => void): void;
/**
* Asynchronously returns selected data from the subject or body of a message.
*
* If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error.
@@ -7282,30 +7375,6 @@ declare namespace Office {
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult.
*/
getSelectedDataAsync(coercionType: CoercionType, callback: (result: AsyncResult) => void): void;
/**
* Asynchronously returns selected data from the subject or body of a message.
*
* If there is no selection but the cursor is in the body or subject, the method returns null for the selected data. If a field other than the body or subject is selected, the method returns the InvalidSelection error.
*
* To access the selected data from the callback method, call asyncResult.value.data. To access the source property that the selection comes from, call asyncResult.value.sourceProperty, which will be either body or subject.
*
* [Api set: Mailbox 1.0]
*
* @returns
* The selected data as a string with format determined by coercionType.
*
* @remarks
*
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadWriteItem
*
* Applicable Outlook mode: Compose
*
* @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 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 AsyncResult.
*/
getSelectedDataAsync(coercionType: CoercionType, options: AsyncContextOptions, callback: (result: AsyncResult) => void): void;
/**
* Removes an attachment from a message or appointment.
*
@@ -7320,6 +7389,11 @@ declare namespace Office {
* Applicable Outlook mode: Compose
*
* Errors: InvalidAttachmentId - The attachment identifier does not exist.
*
* In addition to this signature, the method also has the following signatures:
* removeAttachmentAsync(attachmentIndex: string): void;
* removeAttachmentAsync(attachmentIndex: string, options: AsyncContextOptions): void;
* removeAttachmentAsync(attachmentIndex: string, callback: (result: AsyncResult) => void): void;
*
* @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.
@@ -7409,6 +7483,11 @@ declare namespace Office {
* Applicable Outlook mode: Compose
*
* Errors: InvalidAttachmentId - The attachment identifier does not exist.
*
* In addition to this signature, the method also has the following signatures:
* saveAsync(): void;
* saveAsync(options: AsyncContextOptions): void;
* saveAsync(callback: (result: AsyncResult) => void): void;
*
* @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.
@@ -7513,8 +7592,13 @@ declare namespace Office {
* Applicable Outlook mode: Compose
*
* Errors: InvalidAttachmentId - The attachment identifier does not exist.
*
* In addition to this signature, the method also has the following signatures:
* setSelectedDataAsync(data: string): void;
* setSelectedDataAsync(data: string, options: AsyncContextOptions & CoercionTypeOptions): void;
* setSelectedDataAsync(data: string, callback: (result: AsyncResult) => void): void;
*
* @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 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 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: If text, the current style is applied in Outlook Web App and Outlook. If the field is an HTML editor, only the text data is inserted, even if the data is HTML. If html and the field supports HTML (the subject doesn't), the current style is applied in Outlook Web App and the default style is applied in Outlook. If the field is a text field, an InvalidDataFormat error is returned. 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.
@@ -7726,6 +7810,9 @@ declare namespace Office {
*
* Applicable Outlook mode: Read
*
* In addition to this signature, the method also has the following signatures:
* getInitializationContextAsync(callback?: (result: AsyncResult) => void): void;
*
* @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 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.
@@ -8129,6 +8216,10 @@ declare namespace Office {
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem
*
* Applicable Outlook mode: Compose
*
* In addition to this signature, the method also has the following signatures:
* getAsync(callback: (result: AsyncResult) => void): void;
*
*/
getAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
/**
@@ -8164,6 +8255,11 @@ declare namespace Office {
* Applicable Outlook mode: Compose
*
* Errors: DataExceedsMaximumSize - The location parameter is longer than 255 characters.
*
* In addition to this signature, the method also has the following signatures:
* setAsync(location: string): void;
* setAsync(location: string, options: AsyncContextOptions): void;
* setAsync(location: string, callback: (result: AsyncResult) => void): void;
*/
setAsync(location: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
/**
@@ -8220,7 +8316,6 @@ declare namespace Office {
* Errors: DataExceedsMaximumSize - The location parameter is longer than 255 characters.
*/
setAsync(location: string, callback: (result: AsyncResult) => void): void;
}
/**
* Provides access to the Outlook Add-in object model for Microsoft Outlook and Microsoft Outlook on the web.
@@ -8504,6 +8599,10 @@ declare namespace Office {
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem
*
* Applicable Outlook mode: Compose and read
*
* In addition to this signature, the method has the following signature:
* getCallbackTokenAsync(callback: (result: AsyncResult) => void): void;
* getCallbackTokenAsync(callback: (result: AsyncResult) => void, userContext?: any): void;
*
* @param options An object literal that contains one or more of the following properties.
* isRest: Determines if the token provided will be used for the Outlook REST APIs or Exchange Web Services. Default value is false.
@@ -8717,6 +8816,12 @@ declare namespace Office {
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem
*
* Applicable Outlook mode: Compose or read
*
* In addition to this signature, the method also has the following signatures:
* addAsync(key: string, JSONmessage: NotificationMessageDetails): void;
* addAsync(key: string, JSONmessage: NotificationMessageDetails, options: AsyncContextOptions): void;
* addAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: AsyncResult) => void): void;
*
*/
addAsync(key: string, JSONmessage: NotificationMessageDetails, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
/**
@@ -8779,6 +8884,9 @@ declare namespace Office {
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem
*
* Applicable Outlook mode: Compose or read
*
* In addition to the main signature, this method also has these signatures:
* getAllAsync(callback: (result: AsyncResult) => void): void;
*
* @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.
@@ -8807,6 +8915,11 @@ declare namespace Office {
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem
*
* Applicable Outlook mode: Compose or read
*
* In addition to the main signature, this method also has these signatures:
* removeAsync(key: string): void;
* removeAsync(key: string, options: AsyncContextOptions): void;
* removeAsync(key: string, callback: (result: AsyncResult) => void): void; *
*
* @param key The key for the notification message to remove.
* @param options Optional. An object literal that contains one or more of the following properties.
@@ -8867,6 +8980,11 @@ declare namespace Office {
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem
*
* Applicable Outlook mode: Compose or read
*
* In addition to the main signature, this method also has these signatures:
* replaceAsync(key: string, JSONmessage: NotificationMessageDetails): void;
* replaceAsync(key: string, JSONmessage: NotificationMessageDetails, options: AsyncContextOptions): void;
* replaceAsync(key: string, JSONmessage: NotificationMessageDetails, callback: (result: AsyncResult) => void): void;
*
* @param key The key for the notification message to replace. It can't be longer than 32 characters.
* @param JSONmessage A JSON object that contains the new notification message to replace the existing message. It contains a NotificationMessageDetails object.
@@ -8981,6 +9099,11 @@ declare namespace Office {
* Applicable Outlook mode: Compose
*
* Errors: NumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
*
* In addition to the main signature, this method also has these signatures:
* addAsync(recipients: (string | EmailUser | EmailAddressDetails)[]): void;
* addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options: AsyncContextOptions): void;
* addAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: AsyncResult) => void): void;
*
* @param recipients The recipients to add to the recipients list.
* @param options Optional. An object literal that contains one or more of the following properties.
@@ -9060,7 +9183,26 @@ declare namespace Office {
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type 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;
/**
* Gets a recipient list for an appointment or message.
*
* When the call completes, the asyncResult.value property will contain an array of EmailAddressDetails objects.
*
* [Api set: Mailbox 1.1]
*
* @remarks
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem
*
* Applicable Outlook mode: Compose
*
* In addition to the main signature, this method also has these signatures:
* getAsync(callback: (result: AsyncResult) => void): void;
*
* @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 AsyncResult.
*/
getAsync(options: AsyncContextOptions, callback: (result: AsyncResult) => void): void;
/**
* Gets a recipient list for an appointment or message.
*
@@ -9076,23 +9218,6 @@ declare namespace Office {
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult.
*/
getAsync(callback: (result: AsyncResult) => void): void;
/**
* Gets a recipient list for an appointment or message.
*
* When the call completes, the asyncResult.value property will contain an array of EmailAddressDetails objects.
*
* [Api set: Mailbox 1.1]
*
* @remarks
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem
*
* Applicable Outlook mode: Compose
*
* @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 AsyncResult.
*/
getAsync(options: AsyncContextOptions, callback: (result: AsyncResult) => void): void;
/**
* Sets a recipient list for an appointment or message.
*
@@ -9114,6 +9239,11 @@ declare namespace Office {
* Applicable Outlook mode: Compose
*
* Errors: NumberOfRecipientsExceeded - The number of recipients exceeded 100 entries.
*
* In addition to the main signature, this method also has these signatures:
* setAsync(recipients: (string | EmailUser | EmailAddressDetails)[]): void;
* setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], options: AsyncContextOptions): void;
* setAsync(recipients: (string | EmailUser | EmailAddressDetails)[], callback: (result: AsyncResult) => void): void;
*
* @param recipients The recipients to add to the recipients list.
* @param options Optional. An object literal that contains one or more of the following properties.
@@ -9288,6 +9418,9 @@ declare namespace Office {
*
* Applicable Outlook mode: Compose or read
*
* In addition to the main signature, this method also has these signatures:
* getAsync(callback?: (result: AsyncResult) => void): void;
*
* @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 AsyncResult object.
@@ -9326,6 +9459,9 @@ declare namespace Office {
*
* Errors: InvalidEndTime - The appointment end time is before its start time.
*
* In addition to the main signature, this method also has these signatures:
* setAsync(recurrencePattern: Recurrence, callback?: (result: AsyncResult) => void): void;
*
* @param recurrencePattern A recurrence object.
* @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.
@@ -9619,12 +9755,15 @@ declare namespace Office {
*
* Errors: Invalid date format - The date is not in an acceptable format.
*
* In addition to the main signature, this method also has these signatures:
* setEndDate(date: string): void;
* Where date is the end date of the recurring appointment series represented in the {@link https://www.iso.org/iso-8601-date-and-time-format.html | ISO 8601} date format: "YYYY-MM-DD".
*
* @param year The year value of the end date.
* @param month The month value of the end date. Valid range is 0-11 where 0 represents the 1st month and 11 represents the 12th month.
* @param day The day value of the end date.
*/
setEndDate(year: number, month: number, day: number): void;
/**
* Sets the end date of a recurring appointment series.
*
@@ -9640,7 +9779,6 @@ declare namespace Office {
* @param date End date of the recurring appointment series represented in the {@link https://www.iso.org/iso-8601-date-and-time-format.html | ISO 8601} date format: "YYYY-MM-DD".
*/
setEndDate(date: string): void;
/**
* Sets the start date of a recurring appointment series.
*
@@ -9653,6 +9791,10 @@ declare namespace Office {
*
* Errors: Invalid date format - The date is not in an acceptable format.
*
* In addition to the main signature, this method also has these signatures:
* setStartDate(date: string): void;
* Where date is the start date of the recurring appointment series represented in the {@link https://www.iso.org/iso-8601-date-and-time-format.html | ISO 8601} date format: "YYYY-MM-DD".
*
* @param year The year value of the start date.
* @param month The month value of the start date. Valid range is 0-11 where 0 represents the 1st month and 11 represents the 12th month.
* @param day The day value of the start date.
@@ -9687,6 +9829,10 @@ declare namespace Office {
*
* Errors: Invalid time format - The time is not in an acceptable format.
*
* In addition to the main signature, this method also has these signatures:
* setStartTime(time: string): void;
* Where time is the start time of all instances represented by standard datetime string format: "THH:mm:ss:mmm".
*
* @param hours The hour value of the start time. Valid range: 0-24.
* @param minutes The minute value of the start time. Valid range: 0-59.
*/
@@ -9720,6 +9866,26 @@ declare namespace Office {
* Applicable Outlook mode: Compose
*/
interface Subject {
/**
* Gets the subject of an appointment or message.
*
* The getAsync method starts an asynchronous call to the Exchange server to get the subject of an appointment or message.
*
* [Api set: Mailbox 1.1]
*
* @remarks
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem
*
* Applicable Outlook mode: Compose
*
* In addition to the main signature, this method also has these signatures:
* getAsync(callback: (result: AsyncResult) => void): void;
*
* @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 AsyncResult.
*/
getAsync(options: AsyncContextOptions, callback: (result: AsyncResult) => void): void;
/**
* Gets the subject of an appointment or message.
* The getAsync method starts an asynchronous call to the Exchange server to get the subject of an appointment or message.
@@ -9734,23 +9900,6 @@ declare namespace Office {
* @param callback When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult.
*/
getAsync(callback: (result: AsyncResult) => void): void;
/**
* Gets the subject of an appointment or message.
*
* The getAsync method starts an asynchronous call to the Exchange server to get the subject of an appointment or message.
*
* [Api set: Mailbox 1.1]
*
* @remarks
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem
*
* Applicable Outlook mode: Compose
*
* @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 AsyncResult.
*/
getAsync(options: AsyncContextOptions, callback: (result: AsyncResult) => void): void;
/**
* Sets the subject of an appointment or message.
*
@@ -9764,6 +9913,11 @@ declare namespace Office {
* Applicable Outlook mode: Compose
*
* Errors: DataExceedsMaximumSize - The subject parameter is longer than 255 characters.
*
* In addition to the main signature, this method also has these signatures:
* setAsync(subject: string): void;
* setAsync(subject: string, options: AsyncContextOptions): void;
* setAsync(subject: string, callback: (result: AsyncResult) => void): void;
*
* @param subject The subject of the appointment or message. The string is limited to 255 characters.
* @param options An object literal that contains one or more of the following properties.
@@ -9871,10 +10025,15 @@ declare namespace Office {
* {@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}: ReadItem
*
* Applicable Outlook mode: Compose
*
* In addition to the main signature, this method also has these signatures:
* getAsync(callback: (result: AsyncResult) => void): void;
*
* @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 AsyncResult.
*/
getAsync(callback: (result: AsyncResult) => void): void;
getAsync(options: AsyncContextOptions, callback: (result: AsyncResult) => void): void;
/**
* Gets the start or end time of an appointment.
*
@@ -9887,11 +10046,9 @@ declare namespace Office {
*
* Applicable Outlook mode: Compose
*
* @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 AsyncResult.
*/
getAsync(options: AsyncContextOptions, callback: (result: AsyncResult) => void): void;
getAsync(callback: (result: AsyncResult) => void): void;
/**
* Sets the start or end time of an appointment.
*
@@ -9907,6 +10064,11 @@ declare namespace Office {
* Applicable Outlook mode: Compose
*
* Errors: InvalidEndTime - The appointment end time is before the appointment start time.
*
* In addition to the main signature, this method also has these signatures:
* setAsync(dateTime: Date): void;
* setAsync(dateTime: Date, options: AsyncContextOptions): void;
* setAsync(dateTime: Date, callback: (result: AsyncResult) => void): void;
*
* @param dateTime A date-time object in Coordinated Universal Time (UTC).
* @param options An object literal that contains one or more of the following properties.
+5 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for owl.carousel 2.2
// Type definitions for owl.carousel 2.3
// Project: https://github.com/OwlCarousel2/OwlCarousel2
// Definitions by: Ismael Gorissen <https://github.com/igorissen>
// Kenneth Ceyer <https://github.com/KennethanCeyer>
@@ -31,9 +31,9 @@ declare namespace OwlCarousel {
slideBy?: number | string;
dots?: boolean;
dotsEach?: number | boolean;
dotData?: boolean;
dotsData?: boolean;
lazyLoad?: boolean;
lazyContent?: boolean;
lazyLoadEager?: number;
autoplay?: boolean;
autoplayTimeout?: number;
autoplayHoverPause?: boolean;
@@ -59,6 +59,8 @@ declare namespace OwlCarousel {
stageElement?: string;
navContainer?: string | boolean;
dotsContainer?: string | boolean;
checkVisible?: boolean;
slideTransition?: string;
// CLASSES
refreshClass?: string;
loadingClass?: string;
+1 -1
View File
@@ -5,7 +5,7 @@
declare namespace pDefer {
interface DeferredPromise<T> {
resolve<U>(value: U | PromiseLike<U>): Promise<U>;
resolve<U>(value?: U | PromiseLike<U>): Promise<U>;
reject(reason: any): Promise<never>;
promise: Promise<T>;
}
+4
View File
@@ -7,3 +7,7 @@ function delay(deferred: pDefer.DeferredPromise<string>, ms: number) {
let s: string;
async function f() { s = await delay(pDefer<string>(), 100); }
async function u() {
const u: Promise<any> = pDefer().resolve();
}
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for pem-jwk 1.5
// Project: https://github.com/dannycoates/pem-jwk
// Definitions by: Alessio Paccoia <https://github.com/alessiopcc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface RSA_JWK {
kty: string;
n: string;
e: string;
d?: string;
p?: string;
q?: string;
dp?: string;
dq?: string;
qi?: string;
}
export function pem2jwk(rsa_pem: string): RSA_JWK;
export function jwk2pem(rsa_jwk: RSA_JWK): string;
+17
View File
@@ -0,0 +1,17 @@
import { jwk2pem, pem2jwk, RSA_JWK } from "pem-jwk";
const rsa_pem = `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDh6RzHEsTFjD8NlB4echurwfV2
Zrlcg0k2JoP0Z3QAgXPMwJynvs2LeBHYaOFzGzjXRKsvaLwc5PjP3NcqcP3KkX5y
1VA31VrJLfFbXthi0a8c/UBwxJD8i4S35OKr6yui3bJatgYWrSQ4MT9ktaS1TP9l
XBW58V4VlkypTaQTSQIDAQAB
-----END PUBLIC KEY-----`;
const rsa_jwk: RSA_JWK = {
kty: 'RSA',
n: '4ekcxxLExYw_DZQeHnIbq8H1dma5XINJNiaD9Gd0AIFzzMCcp77Ni3gR2Gjhcxs410SrL2i8HOT4z9zXKnD9ypF-ctVQN9VayS3xW17YYtGvHP1AcMSQ_IuEt-Tiq-srot2yWrYGFq0kODE_ZLWktUz_ZVwVufFeFZZMqU2kE0k',
e: 'AQAB'
};
jwk2pem(rsa_jwk); // $ExpectType string
pem2jwk(rsa_pem); // $ExpectType RSA_JWK
+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",
"pem-jwk-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+16 -2
View File
@@ -160,15 +160,21 @@ export class Gpio extends NodeJS.EventEmitter {
disableInterrupt(): Gpio;
/**
* Enables alerts for the GPIO.
* Enables alerts for the GPIO. Returns this.
*/
enableAlert(): Gpio;
/**
* Disables aterts for the GPIO.
* Disables aterts for the GPIO. Returns this.
*/
disableAlert(): Gpio;
/**
* Sets a glitch filter on a GPIO. Returns this.
* @param steady Time, in microseconds, during which the level must be stable. Maximum value: 300000
*/
glitchFilter(steady: number): Gpio;
/*----------------------*
* mode
*----------------------*/
@@ -410,3 +416,11 @@ export function terminate(): void;
* @param peripheral an unsigned integer specifying the peripheral for timing (CLOCK_PWM or CLOCK_PCM)
*/
export function configureClock(microseconds: number, peripheral: number): void;
/**
* Configures pigpio to use the specified socket port.
* The default setting is to use port 8888.
* If configureSocketPort is called, it must be called before creating Gpio objects.
* @param port an unsigned integer specifying the pigpio socket port number
*/
export function configureSocketPort(port: number): void;
+35
View File
@@ -5,6 +5,7 @@ import * as assert from 'assert';
const Gpio = pigpio.Gpio;
pigpio.configureClock(1, pigpio.CLOCK_PWM);
pigpio.configureSocketPort(23456);
const led = new Gpio(18, {
mode: Gpio.OUTPUT,
@@ -878,3 +879,37 @@ import * as assert from 'assert';
clearInterval(iv);
}, 2000);
})();
(function gpio_glitch_filter(): void {
const Gpio = pigpio.Gpio;
const input = new Gpio(7, {
mode: Gpio.INPUT,
pullUpDown: Gpio.PUD_OFF,
alert: true
});
const output = new Gpio(8, {
mode: Gpio.OUTPUT
});
let count = 0;
output.digitalWrite(0);
input.glitchFilter(50);
input.on('alert', (level, tick) => {
if (level === 1) {
count++;
console.log(' rising edge, count=' + count);
}
});
output.trigger(30, 1); // alert function should not be executed (blocked by glitchFilter)
setTimeout(() => {
output.trigger(70, 1); // alert function should be executed
}, 500);
setTimeout(() => {
assert.strictEqual(count, 1, 'expected 1 alert function call instead of ' + count);
console.log(" success...");
process.exit(0);
}, 1000);
})();
+4 -4
View File
@@ -1,5 +1,5 @@
declare namespace pc {
type ComponentTypes = 'animation' | 'audiolistner' | 'camera' | 'collision' |
type ComponentTypes = 'animation' | 'audiolistener' | 'camera' | 'collision' |
'element' | 'light' | 'model' | 'particlesystem' |
'rigidbody' | 'screen' | 'script' | 'sound' | 'zone';
@@ -169,11 +169,11 @@ declare namespace pc {
* this.entity.parent.addChild(e); // Add it as a sibling to the original
*/
clone(): pc.Entity;
// Possible attached components
animation: pc.AnimationComponent;
audiolistner: pc.AudioListenerComponent;
audiolistener: pc.AudioListenerComponent;
camera: pc.CameraComponent;
collision: pc.CollisionComponent;
element: pc.ElementComponent;
@@ -187,4 +187,4 @@ declare namespace pc {
zone: pc.ZoneComponent;
}
}
}
+2
View File
@@ -1,10 +1,12 @@
// Type definitions for prismic-dom 2.0
// Project: https://github.com/prismicio/prismic-dom#readme
// Definitions by: Nick Whyte <https://github.com/nickw444>
// Siggy Bilstein <https://github.com/sbilstein>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface RichText {
asHtml(richText: any, linkResolver?: (doc: any) => string): string;
asText(richText: any, joinString?: string): string;
}
export const RichText: RichText;
+82
View File
@@ -169,6 +169,78 @@ export interface AreaPathProps extends AreaBaseProps {
export class AreaPath extends React.Component<AreaPathProps> { }
export interface AreaTextProps extends AreaBaseProps {
style?: {
/**
* The background color, specified as a CSS color string.
*/
backgroundColor?: string;
/**
* The text color, specified as a CSS color string.
*/
color?: string;
/**
* The font family (only if available on the system).
*/
fontFamily?: string;
/**
* The font size (in pt).
*/
fontSize?: number;
/**
* Whether an italic font should be used.
*/
fontStyle?: 'normal' | 'oblique' | 'italic';
/**
* Whether a bold font should be used (and the amount).
*/
fontWeight?: 'minimum' | 'thin' | 'ultraLight' | 'light' | 'book' | 'normal' | 'medium' | 'semiBold' | 'bold' | 'ultraBold' | 'heavy' | 'ultraHeavy' | 'maximum' | number;
/**
* Wheter the text should be aligned to the left, center or right.
*
* **Works only on a top level text component, not it's children!**
*/
textAlign?: 'left' | 'center' | 'right';
/**
* How wide or narrow the characters should be.
*/
textStretch?: 'ultraCondensed' | 'extraCondensed' | 'condensed' | 'semiCondensed' | 'normal' | 'semiExpanded' | 'expanded' | 'extraExpanded' | 'ultraExpanded';
/**
* The text underline style.
*/
textUnderline?: 'none' | 'single' | 'double' | 'suggestion';
/**
* The text underline color.
*
* A color string | 'spelling' | 'grammar' | 'auxiliary'
*/
textUnderlineColor?: 'spelling' | 'grammar' | 'auxiliary' | string;
};
/**
* The x coordinate of the text's top left corner. (Only in a top level text component.)
*/
x?: number | string;
/**
* The y coordinate of the text's top left corner. (Only in a top level text component.)
*/
y?: number | string;
}
export class AreaText extends React.Component<AreaTextProps> { }
export interface AreaGroupProps extends AreaBaseProps {
/**
* Specify `width` and `height` to be able to use percentage values in transforms.
*/
width?: number | string;
/**
* Specify `width` and `height` to be able to use percentage values in transforms.
*/
height?: number | string;
}
export class AreaGroup extends React.Component<AreaGroupProps> { }
export interface MouseEvent {
button: number;
height: number;
@@ -242,6 +314,12 @@ export class Area extends React.Component<AreaProps> {
* A circle to be displayed in an Area component.
*/
static Circle: typeof AreaCircle;
/**
* A component to apply props to all it's children in an Area component.
*
* To be able to use percentage values in transforms, the props `width` and `height` need to be specified (they have no graphical effect).
*/
static Group: typeof AreaGroup;
/**
* A straigt line to be displayed in an Area component.
*/
@@ -256,6 +334,10 @@ export class Area extends React.Component<AreaProps> {
* A rectangle to be displayed in an Area component.
*/
static Rectangle: typeof AreaRectangle;
/**
* A (possibly styled) text to be displayed in an Area component. Nested `Area.Text` components inheirit the parent's style.
*/
static Text: typeof AreaText;
}
export interface BoxProps extends GridChildrenProps, Label, Stretchy {
+26
View File
@@ -124,3 +124,29 @@ class GridTest extends React.Component {
);
}
}
class AreaTest extends React.Component {
render() {
return (
<Area>
<Area.Group width={30} height={20}>
<Area.Rectangle height={10} width={20} x={30} y={40} />
<Area.Path d="test" fillMode="nonzero" />
<Area.Text
style={{
fontSize: 30,
fontWeight: "maximum",
textAlign: "center",
textStretch: "ultraCondensed",
}}
>
Parent text
<Area.Text>
Nested Text
</Area.Text>
</Area.Text>
</Area.Group>
</Area>
);
}
}
+4
View File
@@ -188,6 +188,8 @@ export interface Cookie {
expires: number;
/** The cookie http only flag. */
httpOnly: boolean;
/** The session cookie flag. */
session: boolean;
/** The cookie secure flag. */
secure: boolean;
/** The cookie same site definition. */
@@ -218,6 +220,8 @@ export interface SetCookie {
expires?: number;
/** The cookie http only flag. */
httpOnly?: boolean;
/** The session cookie flag. */
session?: boolean;
/** The cookie secure flag. */
secure?: boolean;
/** The cookie same site definition. */
+204 -2
View File
@@ -420,12 +420,72 @@ declare namespace R {
fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T6;
/**
* TODO composeK
* Returns the right-to-left Kleisli composition of the provided functions, each of which must return a value of a type supported by chain.
* The typings only support arrays for now.
* All functions must be unary.
* R.composeK(h, g, f) is equivalent to R.compose(R.chain(h), R.chain(g), f).
*/
composeK<V0, T1>(
fn0: (x0: V0) => T1[]): (x0: V0) => T1[];
composeK<V0, T1, T2>(
fn1: (x: T1) => T2[],
fn0: (x0: V0) => T1[]): (x0: V0) => T2[];
composeK<V0, T1, T2, T3>(
fn2: (x: T2) => T3[],
fn1: (x: T1) => T2[],
fn0: (x: V0) => T1[]): (x: V0) => T3[];
composeK<V0, T1, T2, T3, T4>(
fn3: (x: T3) => T4[],
fn2: (x: T2) => T3[],
fn1: (x: T1) => T2[],
fn0: (x: V0) => T1[]): (x: V0) => T4[];
composeK<V0, T1, T2, T3, T4, T5>(
fn4: (x: T4) => T5[],
fn3: (x: T3) => T4[],
fn2: (x: T2) => T3[],
fn1: (x: T1) => T2[],
fn0: (x: V0) => T1[]): (x: V0) => T5[];
composeK<V0, T1, T2, T3, T4, T5, T6>(
fn5: (x: T5) => T6[],
fn4: (x: T4) => T5[],
fn3: (x: T3) => T4[],
fn2: (x: T2) => T3[],
fn1: (x: T1) => T2[],
fn0: (x: V0) => T1[]): (x: V0) => T6[];
/**
* TODO composeP
* Performs right-to-left composition of one or more Promise-returning functions.
* All functions must be unary.
*/
composeP<V0, T1>(
fn0: (x0: V0) => Promise<T1>): (x0: V0) => Promise<T1>;
composeP<V0, T1, T2>(
fn1: (x: T1) => Promise<T2>,
fn0: (x0: V0) => Promise<T1>): (x0: V0) => Promise<T2>;
composeP<V0, T1, T2, T3>(
fn2: (x: T2) => Promise<T3>,
fn1: (x: T1) => Promise<T2>,
fn0: (x: V0) => Promise<T1>): (x: V0) => Promise<T3>;
composeP<V0, T1, T2, T3, T4>(
fn3: (x: T3) => Promise<T4>,
fn2: (x: T2) => Promise<T3>,
fn1: (x: T1) => Promise<T2>,
fn0: (x: V0) => Promise<T1>): (x: V0) => Promise<T4>;
composeP<V0, T1, T2, T3, T4, T5>(
fn4: (x: T4) => Promise<T5>,
fn3: (x: T3) => Promise<T4>,
fn2: (x: T2) => Promise<T3>,
fn1: (x: T1) => Promise<T2>,
fn0: (x: V0) => Promise<T1>):
(x: V0) => Promise<T5>;
composeP<V0, T1, T2, T3, T4, T5, T6>(
fn5: (x: T5) => Promise<T6>,
fn4: (x: T4) => Promise<T5>,
fn3: (x: T3) => Promise<T4>,
fn2: (x: T2) => Promise<T3>,
fn1: (x: T1) => Promise<T2>,
fn0: (x: V0) => Promise<T1>):
(x: V0) => Promise<T6>;
/**
* Returns a new list consisting of the elements of the first list followed by the elements
@@ -1501,6 +1561,148 @@ declare namespace R {
fn8: (x: T8) => T9,
fn9: (x: T9) => T10): (x0: V0, x1: V1, x2: V2) => T10;
/*
* Returns the left-to-right Kleisli composition of the provided functions, each of which must return a value of a type supported by chain.
* The typings currently support arrays only as return values.
* All functions need to be unary.
* R.pipeK(f, g, h) is equivalent to R.pipe(f, R.chain(g), R.chain(h)).
*/
pipeK<V0, T1>(
fn0: (x0: V0) => T1[]): (x0: V0) => T1[];
pipeK<V0, T1, T2>(
fn0: (x0: V0) => T1[],
fn1: (x: T1) => T2[]): (x0: V0) => T2[];
pipeK<V0, T1, T2, T3>(
fn0: (x: V0) => T1[],
fn1: (x: T1) => T2[],
fn2: (x: T2) => T3[]): (x: V0) => T3[];
pipeK<V0, T1, T2, T3, T4>(
fn0: (x: V0) => T1[],
fn1: (x: T1) => T2[],
fn2: (x: T2) => T3[],
fn3: (x: T3) => T4[]): (x: V0) => T4[];
pipeK<V0, T1, T2, T3, T4, T5>(
fn0: (x: V0) => T1[],
fn1: (x: T1) => T2[],
fn2: (x: T2) => T3[],
fn3: (x: T3) => T4[],
fn4: (x: T4) => T5[]): (x: V0) => T5[];
pipeK<V0, T1, T2, T3, T4, T5, T6>(
fn0: (x: V0) => T1[],
fn1: (x: T1) => T2[],
fn2: (x: T2) => T3[],
fn3: (x: T3) => T4[],
fn4: (x: T4) => T5[],
fn5: (x: T5) => T6[]): (x: V0) => T6[];
pipeK<V0, T1, T2, T3, T4, T5, T6, T7>(
fn0: (x: V0) => T1[],
fn1: (x: T1) => T2[],
fn2: (x: T2) => T3[],
fn3: (x: T3) => T4[],
fn4: (x: T4) => T5[],
fn5: (x: T5) => T6[],
fn: (x: T6) => T7[]): (x: V0) => T7[];
pipeK<V0, T1, T2, T3, T4, T5, T6, T7, T8>(
fn0: (x: V0) => T1[],
fn1: (x: T1) => T2[],
fn2: (x: T2) => T3[],
fn3: (x: T3) => T4[],
fn4: (x: T4) => T5[],
fn5: (x: T5) => T6[],
fn6: (x: T6) => T7[],
fn: (x: T7) => T8[]): (x: V0) => T8[];
pipeK<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
fn0: (x0: V0) => T1[],
fn1: (x: T1) => T2[],
fn2: (x: T2) => T3[],
fn3: (x: T3) => T4[],
fn4: (x: T4) => T5[],
fn5: (x: T5) => T6[],
fn6: (x: T6) => T7[],
fn7: (x: T7) => T8[],
fn8: (x: T8) => T9[]): (x0: V0) => T9[];
pipeK<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
fn0: (x0: V0) => T1[],
fn1: (x: T1) => T2[],
fn2: (x: T2) => T3[],
fn3: (x: T3) => T4[],
fn4: (x: T4) => T5[],
fn5: (x: T5) => T6[],
fn6: (x: T6) => T7[],
fn7: (x: T7) => T8[],
fn8: (x: T8) => T9[],
fn9: (x: T9) => T10[]): (x0: V0) => T10[];
/*
* Performs left-to-right composition of one or more Promise-returning functions.
* All functions need to be unary.
*/
pipeP<V0, T1>(
fn0: (x0: V0) => Promise<T1>): (x0: V0) => Promise<T1>;
pipeP<V0, T1, T2>(
fn0: (x0: V0) => Promise<T1>,
fn1: (x: T1) => Promise<T2>): (x0: V0) => Promise<T2>;
pipeP<V0, T1, T2, T3>(
fn0: (x: V0) => Promise<T1>,
fn1: (x: T1) => Promise<T2>,
fn2: (x: T2) => Promise<T3>): (x: V0) => Promise<T3>;
pipeP<V0, T1, T2, T3, T4>(
fn0: (x: V0) => Promise<T1>,
fn1: (x: T1) => Promise<T2>,
fn2: (x: T2) => Promise<T3>,
fn3: (x: T3) => Promise<T4>): (x: V0) => Promise<T4>;
pipeP<V0, T1, T2, T3, T4, T5>(
fn0: (x: V0) => Promise<T1>,
fn1: (x: T1) => Promise<T2>,
fn2: (x: T2) => Promise<T3>,
fn3: (x: T3) => Promise<T4>,
fn4: (x: T4) => Promise<T5>): (x: V0) => Promise<T5>;
pipeP<V0, T1, T2, T3, T4, T5, T6>(
fn0: (x: V0) => Promise<T1>,
fn1: (x: T1) => Promise<T2>,
fn2: (x: T2) => Promise<T3>,
fn3: (x: T3) => Promise<T4>,
fn4: (x: T4) => Promise<T5>,
fn5: (x: T5) => Promise<T6>): (x: V0) => Promise<T6>;
pipeP<V0, T1, T2, T3, T4, T5, T6, T7>(
fn0: (x: V0) => Promise<T1>,
fn1: (x: T1) => Promise<T2>,
fn2: (x: T2) => Promise<T3>,
fn3: (x: T3) => Promise<T4>,
fn4: (x: T4) => Promise<T5>,
fn5: (x: T5) => Promise<T6>,
fn: (x: T6) => Promise<T7>): (x: V0) => Promise<T7>;
pipeP<V0, T1, T2, T3, T4, T5, T6, T7, T8>(
fn0: (x: V0) => Promise<T1>,
fn1: (x: T1) => Promise<T2>,
fn2: (x: T2) => Promise<T3>,
fn3: (x: T3) => Promise<T4>,
fn4: (x: T4) => Promise<T5>,
fn5: (x: T5) => Promise<T6>,
fn6: (x: T6) => Promise<T7>,
fn: (x: T7) => Promise<T8>): (x: V0) => Promise<T8>;
pipeP<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
fn0: (x0: V0) => Promise<T1>,
fn1: (x: T1) => Promise<T2>,
fn2: (x: T2) => Promise<T3>,
fn3: (x: T3) => Promise<T4>,
fn4: (x: T4) => Promise<T5>,
fn5: (x: T5) => Promise<T6>,
fn6: (x: T6) => Promise<T7>,
fn7: (x: T7) => Promise<T8>,
fn8: (x: T8) => Promise<T9>): (x0: V0) => Promise<T9>;
pipeP<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
fn0: (x0: V0) => Promise<T1>,
fn1: (x: T1) => Promise<T2>,
fn2: (x: T2) => Promise<T3>,
fn3: (x: T3) => Promise<T4>,
fn4: (x: T4) => Promise<T5>,
fn5: (x: T5) => Promise<T6>,
fn6: (x: T6) => Promise<T7>,
fn7: (x: T7) => Promise<T8>,
fn8: (x: T8) => Promise<T9>,
fn9: (x: T9) => Promise<T10>): (x0: V0) => Promise<T10>;
/**
* Returns a new list by plucking the same named property off all objects in the list supplied.
*/
+119
View File
@@ -186,6 +186,68 @@ class F2 {
const g_res: boolean = g([1, 2, 10, 13]);
};
/* composeK */
() => {
const get = (prop: string) => (obj: any): any[] => {
const propVal = obj[prop];
if (propVal) {
return [propVal];
} else {
return [];
}
};
const getStateCode: (input: any) => any[] = R.composeK(
R.compose((val) => [val], R.toUpper),
get('state'),
get('address'),
get('user'),
);
getStateCode({ user: { address: { state: "ny" } } }); // => []
getStateCode({}); // => []
const nextThree = (num: number): number[] => ([num, num + 1, num + 2]);
const onlyOverNine = (num: number): number[] => num > 9 ? [num] : [];
const toString = (input: any): string[] => [`${input}`];
const split = (input: string): string[] => input.split('');
const composed: (num: number) => string[] = R.composeK(
split,
toString,
onlyOverNine,
nextThree,
);
};
/* composeP */
() => {
interface User {
name: string;
followers: string[];
}
interface Db {
users: { [index: string]: User };
}
const db: Db = {
users: {
JOE: {
name: 'Joe',
followers: ['STEVE', 'SUZY']
}
}
};
// We'll pretend to do a db lookup which returns a promise
const lookupUser = (userId: string): Promise<User> => Promise.resolve(db.users[userId]);
const lookupFollowers = (user: User): Promise<string[]> => Promise.resolve(user.followers);
lookupUser('JOE').then(lookupFollowers);
// followersForUser :: String -> Promise [UserId]
const followersForUser: (input: string) => Promise<string[]> = R.composeP(lookupFollowers, lookupUser);
followersForUser('JOE').then(followers => console.log('Followers:', followers));
// Followers: ["STEVE","SUZY"]
};
/* pipe */
() => {
const func: (x: number) => string = R.pipe(double, double, shout);
@@ -201,6 +263,63 @@ class F2 {
const fr: number = f(3, 4); // -(3^4) + 1
};
/* pipeK */
() => {
const parseJson = (input: string): any[] => {
try {
return [JSON.parse(input)];
} catch (e) {
return [];
}
};
const get = (prop: string) => (obj: any): any[] => {
const propVal = obj[prop];
if (propVal) {
return [propVal];
} else {
return [];
}
};
const getStateCode: (input: string) => string[] = R.pipeK(
parseJson,
get('user'),
get('address'),
get('state'),
R.compose((val) => [val], R.toUpper)
);
getStateCode('{"user":{"address":{"state":"ny"}}}');
// => Just('NY')
getStateCode('[Invalid JSON]');
// => Nothing()
};
/* pipeP */
() => {
interface User {
followers: string[];
name: string;
}
const db = {
getUserById(userName: string): Promise<User> {
return Promise.resolve({
name: 'Jon',
followers: [
'Samwell',
'Edd',
'Grenn',
],
});
},
getFollowers(user: User): Promise<string[]> {
return Promise.resolve(user.followers);
},
};
const followersForUser: (userName: string) => Promise<string[]> = R.pipeP(db.getUserById, db.getFollowers);
};
() => {
R.invoker(1, "slice")(6, "abcdefghijklm");
R.invoker(2, "slice")(6)(8, "abcdefghijklm");
+13 -1
View File
@@ -144,4 +144,16 @@ declare namespace Autocomplete {
debug?: boolean;
}
}
declare class Autocomplete extends Component<Autocomplete.Props> {}
declare class Autocomplete extends Component<Autocomplete.Props> {
/**
* Autocomplete exposes a subset of `HTMLInputElement` properties to the parent component.
* They can be accessed through Autocomplete's `ref` prop.
*/
blur: HTMLInputElement['blur'];
checkValidity: HTMLInputElement['checkValidity'];
click: HTMLInputElement['click'];
focus: HTMLInputElement['focus'];
select: HTMLInputElement['select'];
setCustomValidity: HTMLInputElement['setCustomValidity'];
setSelectionRange: HTMLInputElement['setSelectionRange'];
}
+1
View File
@@ -88,6 +88,7 @@ export interface ReactDatePickerProps {
yearDropdownItemNumber?: number;
shouldCloseOnSelect?: boolean;
showTimeSelect?: boolean;
showTimeSelectOnly?: boolean;
timeFormat?: string;
timeIntervals?: number;
minTime?: moment.Moment;
+343 -224
View File
@@ -1,12 +1,14 @@
// Type definitions for react-dates v16.0.0
// Type definitions for react-dates v16.7.0
// Project: https://github.com/airbnb/react-dates
// Definitions by: Artur Ampilogov <https://github.com/Artur-A>
// Definitions by: Artur Ampilogov <https://github.com/ArturAmpilogov>
// Nathan Holland <https://github.com/NathanNZ>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import * as React from "react";
import * as moment from "moment";
// Required fields are made according to 'minimum REQUIRED setup' in https://github.com/airbnb/react-dates/blob/master/README.md
import * as React from 'react';
import * as moment from 'moment';
export = ReactDates;
@@ -18,42 +20,273 @@ declare namespace momentPropTypes {
declare namespace ReactDates {
// SHAPES
//
// shapes/AnchorDirectionShape.js
type AnchorDirectionShape = 'left' | 'right';
type FocusedInputShape = 'startDate' | 'endDate';
type OrientationShape = 'horizontal' | 'vertical';
type ScrollableOrientationShape = 'horizontal' | 'vertical' | 'verticalScrollable';
// shapes/CalendarInfoPositionShape.js
type CalendarInfoPositionShape = 'top' | 'bottom' | 'before' | 'after';
//https://github.com/airbnb/react-dates/blob/v16.0.1/src/defaultPhrases.js
type SingleDatePickerPhrases = {
closeDatePicker: string,
clearDate: string,
jumpToPrevMonth: string,
jumpToNextMonth: string,
keyboardShortcuts: string,
showKeyboardShortcutsPanel: string,
hideKeyboardShortcutsPanel: string,
openThisPanel: string,
enterKey: string,
leftArrowRightArrow: string,
upArrowDownArrow: string,
pageUpPageDown: string,
homeEnd: string,
escape: string,
questionMark: string,
selectFocusedDate: string,
moveFocusByOneDay: string,
moveFocusByOneWeek: string,
moveFocusByOneMonth: string,
moveFocustoStartAndEndOfWeek: string,
returnFocusToInput: string,
keyboardNavigationInstructions: string,
chooseAvailableDate: (date: string) => string,
dateIsUnavailable: (date: string) => string,
// shapes/DateRangePickerShape.js
interface DateRangePickerShape {
// required props for a functional interactive DateRangePicker
startDate: momentPropTypes.momentObj | null,
startDateId: string,
endDate: momentPropTypes.momentObj | null,
endDateId: string,
focusedInput: FocusedInputShape | null,
onDatesChange: (arg: {
startDate: momentPropTypes.momentObj | null,
endDate: momentPropTypes.momentObj | null
}) => void,
onFocusChange: (arg: FocusedInputShape | null) => void,
onClose?: (final: { startDate: momentPropTypes.momentObj, endDate: momentPropTypes.momentObj }) => void,
// input related props
startDatePlaceholderText?: string,
endDatePlaceholderText?: string,
disabled?: boolean,
required?: boolean,
readOnly?: boolean,
screenReaderInputMessage?: string,
showClearDates?: boolean,
showDefaultInputIcon?: boolean,
customInputIcon?: string | JSX.Element,
customArrowIcon?: string | JSX.Element,
customCloseIcon?: string | JSX.Element,
noBorder?: boolean,
block?: boolean,
small?: boolean,
regular?: boolean,
keepFocusOnInput?: boolean,
// calendar presentation and interaction related props
renderMonth?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
orientation?: OrientationShape,
anchorDirection?: AnchorDirectionShape,
openDirection?: OpenDirectionShape,
horizontalMargin?: number,
withPortal?: boolean,
withFullScreenPortal?: boolean,
appendToBody?: boolean,
disableScroll?: boolean,
daySize?: number,
isRTL?: boolean,
firstDayOfWeek?: DayOfWeekShape,
initialVisibleMonth?: () => momentPropTypes.momentObj,
numberOfMonths?: number,
keepOpenOnDateSelect?: boolean,
reopenPickerOnClearDates?: boolean,
renderCalendarInfo?: () => (string | JSX.Element),
calendarInfoPosition?: CalendarInfoPositionShape,
hideKeyboardShortcutsPanel?: boolean,
verticalHeight?: number,
transitionDuration?: number,
verticalSpacing?: number,
// navigation related props
navPrev?: string | JSX.Element,
navNext?: string | JSX.Element,
onPrevMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void,
onNextMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void,
// day presentation and interaction related props
renderCalendarDay?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
renderDayContents?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
minimumNights?: number,
enableOutsideDays?: boolean,
isDayBlocked?: (day: any) => boolean,
isOutsideRange?: (day: any) => boolean,
isDayHighlighted?: (day: any) => boolean,
// internationalization props
displayFormat?: (string | (() => string)),
monthFormat?: string,
weekDayFormat?: string,
phrases?: DateRangePickerPhrases,
dayAriaLabelFormat?: string
}
// shapes/DayOfWeekShape.js
type DayOfWeekShape = 0 | 1 | 2 | 3 | 4 | 5 | 6;
// shapes/DisabledShape.js
type DisabledShape = boolean | 'startDate' | 'endDate';
// shapes/FocusedInputShape.js
type FocusedInputShape = 'startDate' | 'endDate';
// shape/IconPositionShape.js
type IconPositionShape = 'before' | 'after';
// type/OpenDirectionShape.js
type OpenDirectionShape = 'down' | 'up';
// shpae/OrientationShape.js
type OrientationShape = 'horizontal' | 'vertical';
// shape/ScrollableOrientationShape.js
type ScrollableOrientationShape = 'horizontal' | 'vertical' | 'verticalScrollable';
// shapes/SingleDatePickerShape.js
interface SingleDatePickerShape {
id: string,
// required props for a functional interactive SingleDatePicker
date: momentPropTypes.momentObj | null,
focused: boolean,
onDateChange: (date: momentPropTypes.momentObj | null) => void,
onFocusChange: (arg: { focused: boolean | null }) => void,
// input related props
placeholder?: string,
disabled?: boolean,
required?: boolean,
readOnly?: boolean,
screenReaderInputMessage?: string,
showClearDate?: boolean,
customCloseIcon?: string | JSX.Element,
showDefaultInputIcon?: boolean,
inputIconPosition?: IconPositionShape,
customInputIcon?: string | JSX.Element,
noBorder?: boolean,
block?: boolean,
small?: boolean,
regular?: boolean,
verticalSpacing?: number,
keepFocusOnInput?: boolean,
// calendar presentation and interaction related props
renderMonth?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
orientation?: OrientationShape,
anchorDirection?: AnchorDirectionShape,
horizontalMargin?: number,
withPortal?: boolean,
withFullScreenPortal?: boolean,
appendToBody?: boolean,
disableScroll?: boolean,
initialVisibleMonth?: () => momentPropTypes.momentObj,
firstDayOfWeek?: DayOfWeekShape,
numberOfMonths?: number,
keepOpenOnDateSelect?: boolean,
reopenPickerOnClearDates?: boolean,
renderCalendarInfo?: () => (string | JSX.Element),
calendarInfoPosition?: CalendarInfoPositionShape,
hideKeyboardShortcutsPanel?: boolean,
daySize?: number,
isRTL?: boolean,
verticalHeight?: number | null,
transitionDuration?: number,
// navigation related props
navPrev?: string | JSX.Element,
navNext?: string | JSX.Element,
onPrevMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void,
onNextMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void,
onClose?: (final: { startDate: momentPropTypes.momentObj, endDate: momentPropTypes.momentObj }) => void,
// day presentation and interaction related props
renderCalendarDay?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
renderDayContents?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
enableOutsideDays?: boolean,
isDayBlocked?: (day: any) => boolean,
isOutsideRange?: (day: any) => boolean,
isDayHighlighted?: (day: any) => boolean,
// internationalization props
displayFormat?: (string | (() => string)),
monthFormat?: string,
weekDayFormat?: string,
phrases?: SingleDatePickerPhrases,
dayAriaLabelFormat?: string,
}
// PHRASES
//
// defaultPhrases.js
type DateRangePickerPhrases = {
calendarLabel?: string,
closeDatePicker?: string,
clearDates?: string,
focusStartDate?: string,
jumpToPrevMonth?: string,
jumpToNextMonth?: string,
keyboardShortcuts?: string,
showKeyboardShortcutsPanel?: string,
hideKeyboardShortcutsPanel?: string,
openThisPanel?: string,
enterKey?: string,
leftArrowRightArrow?: string,
upArrowDownArrow?: string,
pageUpPageDown?: string,
homeEnd?: string,
escape?: string,
questionMark?: string,
selectFocusedDate?: string,
moveFocusByOneDay?: string,
moveFocusByOneWeek?: string,
moveFocusByOneMonth?: string,
moveFocustoStartAndEndOfWeek?: string,
returnFocusToInput?: string,
keyboardNavigationInstructions?: string,
chooseAvailableStartDate?: (date: string) => string,
chooseAvailableEndDate?: (date: string) => string,
dateIsUnavailable?: (date: string) => string,
dateIsSelected?: (date: string) => string
};
//https://github.com/airbnb/react-dates/blob/v16.0.1/src/defaultPhrases.js
type DateRangePickerPhrases = {
// defaultPhrases.js
type DateRangePickerInputPhrases = {
focusStartDate?: string,
clearDates?: string,
keyboardNavigationInstructions?: string,
}
// defaultPhrases.js
type SingleDatePickerPhrases = {
calendarLabel?: string,
closeDatePicker?: string,
clearDate?: string,
jumpToPrevMonth?: string,
jumpToNextMonth?: string,
keyboardShortcuts?: string,
showKeyboardShortcutsPanel?: string,
hideKeyboardShortcutsPanel?: string,
openThisPanel?: string,
enterKey?: string,
leftArrowRightArrow?: string,
upArrowDownArrow?: string,
pageUpPageDown?: string,
homeEnd?: string,
escape?: string,
questionMark?: string,
selectFocusedDate?: string,
moveFocusByOneDay?: string,
moveFocusByOneWeek?: string,
moveFocusByOneMonth?: string,
moveFocustoStartAndEndOfWeek?: string,
returnFocusToInput?: string,
keyboardNavigationInstructions?: string,
chooseAvailableDate?: (date: string) => string,
dateIsUnavailable?: (date: string) => string,
dateIsSelected?: (date: string) => string,
};
// defaultPhrases.js
type SingleDatePickerInputPhrases = {
clearDate?: string,
keyboardNavigationInstructions?: string,
}
// defaultPhrases.js
type DayPickerPhrases = {
calendarLabel?: string,
jumpToPrevMonth?: string,
jumpToNextMonth?: string,
@@ -78,156 +311,52 @@ declare namespace ReactDates {
chooseAvailableEndDate?: (date: string) => string,
chooseAvailableDate?: (date: string) => string,
dateIsUnavailable?: (date: string) => string,
dateIsSelected?: (date: string) => string
dateIsSelected?: (date: string) => string,
};
//https://github.com/airbnb/react-dates/blob/v16.0.1/src/shapes/DateRangePickerShape.js
interface DateRangePickerShape {
// REQUIRED props
startDate: momentPropTypes.momentObj | null,
endDate: momentPropTypes.momentObj | null,
onDatesChange: (arg: {
startDate: momentPropTypes.momentObj | null,
endDate: momentPropTypes.momentObj | null
}
) => void,
focusedInput: FocusedInputShape | null,
onFocusChange: (arg: FocusedInputShape | null) => void,
// input related props
startDateId?: string,
startDatePlaceholderText?: string,
endDateId?: string,
endDatePlaceholderText?: string,
disabled?: boolean,
keepFocusOnInput?: boolean,
required?: boolean,
readOnly?: boolean,
screenReaderInputMessage?: string,
showClearDates?: boolean,
showDefaultInputIcon?: boolean,
customInputIcon?: string | JSX.Element,
customArrowIcon?: string | JSX.Element,
customCloseIcon?: string | JSX.Element,
noBorder?: boolean,
block?: boolean,
// defaultPhrases.js
type DayPickerKeyboardShortcutsPhrases = {
keyboardShortcuts?: string,
showKeyboardShortcutsPanel?: string,
hideKeyboardShortcutsPanel?: string,
openThisPanel?: string,
enterKey?: string,
leftArrowRightArrow?: string,
upArrowDownArrow?: string,
pageUpPageDown?: string,
homeEnd?: string,
escape?: string,
questionMark?: string,
selectFocusedDate?: string,
moveFocusByOneDay?: string,
moveFocusByOneWeek?: string,
moveFocusByOneMonth?: string,
moveFocustoStartAndEndOfWeek?: string,
returnFocusToInput?: string,
};
// calendar presentation and interaction related props
renderMonth?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
orientation?: OrientationShape,
anchorDirection?: AnchorDirectionShape,
horizontalMargin?: number,
withPortal?: boolean,
withFullScreenPortal?: boolean,
initialVisibleMonth?: () => momentPropTypes.momentObj,
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
numberOfMonths?: number,
keepOpenOnDateSelect?: boolean,
reopenPickerOnClearDates?: boolean,
renderCalendarInfo?: () => (string | JSX.Element),
hideKeyboardShortcutsPanel?: boolean,
daySize?: number,
isRTL?: boolean,
// defaultPhrases.js
type DayPickerNavigationPhrases = {
jumpToPrevMonth?: string,
jumpToNextMonth?: string,
};
// defaultPhrases.js
type CalendarDayPhrases = {
chooseAvailableDate: (date: string) => string,
dateIsUnavailable: (date: string) => string,
dateIsSelected: (date: string) => string,
};
// navigation related props
navPrev?: string | JSX.Element,
navNext?: string | JSX.Element,
onPrevMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void,
onNextMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void,
onClose?: (final: { startDate: momentPropTypes.momentObj, endDate: momentPropTypes.momentObj }) => void,
transitionDuration?: number,
// day presentation and interaction related props
renderCalendarDay?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
renderDayContents?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
minimumNights?: number,
enableOutsideDays?: boolean,
isDayBlocked?: (day: any) => boolean,
isOutsideRange?: (day: any) => boolean,
isDayHighlighted?: (day: any) => boolean,
// internationalization props
displayFormat?: (string | (() => string)),
monthFormat?: string,
weekDayFormat?: string,
phrases?: DateRangePickerPhrases
}
// COMPONENTS
//
// components/DateRangePicker.js
type DateRangePicker = React.ClassicComponentClass<DateRangePickerShape>;
var DateRangePicker: React.ClassicComponentClass<DateRangePickerShape>;
//https://github.com/airbnb/react-dates/blob/v16.0.1/src/shapes/SingleDatePickerShape.js
interface SingleDatePickerShape {
// REQUIRED props
date: momentPropTypes.momentObj | null,
onDateChange: (date: momentPropTypes.momentObj | null) => void,
focused: boolean,
onFocusChange: (arg: { focused: boolean | null }) => void,
id: string,
// input related props
placeholder?: string,
disabled?: boolean,
required?: boolean,
readOnly?: boolean,
screenReaderInputMessage?: string,
showClearDate?: boolean,
customCloseIcon?: string | JSX.Element,
showDefaultInputIcon?: boolean,
customInputIcon?: string | JSX.Element,
noBorder?: boolean,
block?: boolean,
small?: boolean,
regular?: boolean,
keepFocusOnInput?: boolean,
// calendar presentation and interaction related props
renderMonth?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
orientation?: OrientationShape,
anchorDirection?: AnchorDirectionShape,
horizontalMargin?: number,
withPortal?: boolean,
withFullScreenPortal?: boolean,
initialVisibleMonth?: () => momentPropTypes.momentObj,
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
numberOfMonths?: number,
keepOpenOnDateSelect?: boolean,
reopenPickerOnClearDates?: boolean,
renderCalendarInfo?: () => (string | JSX.Element),
hideKeyboardShortcutsPanel?: boolean,
daySize?: number,
isRTL?: boolean,
verticalSpacing?: number,
verticalHeight?: number | null,
// navigation related props
navPrev?: string | JSX.Element,
navNext?: string | JSX.Element,
onPrevMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void,
onNextMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void,
onClose?: (final: { startDate: momentPropTypes.momentObj, endDate: momentPropTypes.momentObj }) => void,
transitionDuration?: number,
// day presentation and interaction related props
renderCalendarDay?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
renderDayContents?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
enableOutsideDays?: boolean,
isDayBlocked?: (day: any) => boolean,
isOutsideRange?: (day: any) => boolean,
isDayHighlighted?: (day: any) => boolean,
// internationalization props
displayFormat?: (string | (() => string)),
monthFormat?: string,
phrases?: SingleDatePickerPhrases
}
type SingleDatePicker = React.ClassicComponentClass<SingleDatePickerShape>;
var SingleDatePicker: React.ClassicComponentClass<SingleDatePickerShape>;
//https://github.com/airbnb/react-dates/blob/v16.0.1/src/components/DayPickerRangeController.jsx
interface DayPickerRangeControllerShape {
// components/DayPickerRangeController.jsx
interface DayPickerRangeControllerShape extends DayPickerShape{
// REQUIRED props
startDate: momentPropTypes.momentObj | null,
endDate: momentPropTypes.momentObj | null,
@@ -236,62 +365,27 @@ declare namespace ReactDates {
endDate: momentPropTypes.momentObj | null
}
) => void,
focusedInput: FocusedInputShape | null,
focusedInput: FocusedInputShape,
onFocusChange: (arg: FocusedInputShape | null) => void,
// calendar presentation and interaction related props
enableOutsideDays?: boolean,
numberOfMonths?: number,
orientation?: ScrollableOrientationShape,
withPortal?: boolean,
initialVisibleMonth?: () => momentPropTypes.momentObj,
renderCalendarInfo?: () => (string | JSX.Element),
onOutsideClick?: (e: any) => void,
startDateOffset?: (day: any) => any,
endDateOffset?: (day: any) => any,
onClose?: (final: { startDate: momentPropTypes.momentObj, endDate: momentPropTypes.momentObj }) => void,
keepOpenOnDateSelect?: boolean,
hideKeyboardShortcutsPanel?: boolean;
noBorder?: boolean,
verticalBorderSpacing?: number,
firstDayOfWeek? : 0 | 1 | 2 | 3 | 4 | 5 | 6,
// navigation related props
navPrev?: string | JSX.Element,
navNext?: string | JSX.Element,
onPrevMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void,
onNextMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void,
transitionDuration?: number,
// day presentation and interaction related props
daySize?: number,
renderCalendarDay?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
renderDayContents?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
minimumNights?: number,
disabled?: DisabledShape,
isOutsideRange?: (day: any) => boolean,
isDayBlocked?: (day: any) => boolean,
isDayHighlighted?: (day: any) => boolean,
// internationalization props
monthFormat?: string,
phrases?: DateRangePickerPhrases
}
type DayPickerRangeController = React.ClassicComponentClass<DayPickerRangeControllerShape>;
var DayPickerRangeController: React.ClassicComponentClass<DayPickerRangeControllerShape>;
//https://github.com/airbnb/react-dates/blob/97bf16e72dbf5ce88f0181c49212080061a83f69/src/components/DayPickerSingleDateController.jsx
interface DayPickerSingleDateControllerShape {
date: momentPropTypes.momentObj | null,
onDateChange: (date: momentPropTypes.momentObj | null) => void,
focused: boolean,
onFocusChange: (arg: { focused: boolean | null }) => void,
onClose?: (final: { date: momentPropTypes.momentObj }) => void,
keepOpenOnDateSelect?: boolean,
isOutsideRange?: (day: any) => boolean,
isDayBlocked?: (day: any) => boolean,
isDayHighlighted?: (day: any) => boolean,
// DayPicker props
// components/DayPickerShape.jsx
interface DayPickerShape {
renderMonth?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
enableOutsideDays?: boolean,
numberOfMonths?: number,
@@ -327,20 +421,45 @@ declare namespace ReactDates {
phrases?: SingleDatePickerPhrases,
dayAriaLabelFormat?: string,
isRTL?: boolean,
isRTL?: boolean
}
// components/DayPickerSingleDateController.jsx
interface DayPickerSingleDateControllerShape extends DayPickerShape {
date: momentPropTypes.momentObj | null,
onDateChange: (date: momentPropTypes.momentObj | null) => void,
focused: boolean,
onFocusChange: (arg: { focused: boolean | null }) => void,
onClose?: (final: { date: momentPropTypes.momentObj }) => void,
keepOpenOnDateSelect?: boolean,
isOutsideRange?: (day: any) => boolean,
isDayBlocked?: (day: any) => boolean,
isDayHighlighted?: (day: any) => boolean,
}
type DayPickerSingleDateController = React.ClassicComponentClass<DayPickerSingleDateControllerShape>;
var DayPickerSingleDateController: React.ClassicComponentClass<DayPickerSingleDateControllerShape>;
// components/SingleDatePicker.js
type SingleDatePicker = React.ClassicComponentClass<SingleDatePickerShape>;
var SingleDatePicker: React.ClassicComponentClass<SingleDatePickerShape>;
// UTILS
//
// utils/isInclusivelyAfterDay.js
var isInclusivelyAfterDay: (a: moment.Moment, b: moment.Moment) => boolean;
// utils/isInclusivelyBeforeDay.js
var isInclusivelyBeforeDay: (a: moment.Moment, b: moment.Moment) => boolean;
// utils/isNextDay.js
var isNextDay: (a: moment.Moment, b: moment.Moment) => boolean;
// utils/isSameDay.js
var isSameDay: (a: moment.Moment, b: moment.Moment) => boolean;
// utils/toISODateString.js
var toISODateString: (date: moment.MomentInput, currentFormat: moment.MomentFormatSpecification) => string | null;
// utils/toLocalizedDateString.js
var toLocalizedDateString: (date: moment.MomentInput, currentFormat: moment.MomentFormatSpecification) => string | null;
// utils/toMomentObject.js
var toMomentObject: (dateString: moment.MomentInput, customFormat: moment.MomentFormatSpecification) => moment.Moment | null;
}

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