Merge 'master' into @pr/redux-form-getFormState

This commit is contained in:
Maddi Joyce
2018-06-21 10:40:41 +10:00
667 changed files with 67504 additions and 8835 deletions
+2 -1
View File
@@ -1104,6 +1104,7 @@
/types/ffprobe-static/ @iamstevetran
/types/fhir-js-client/ @rmchndrng
/types/fibers/ @soywiz
/types/fibjs/ @richardo2016
/types/figures/ @BendingBender
/types/file-exists/ @BendingBender
/types/file-saver/ @cyrilschumacher @DaIgeb @chrismbarr
@@ -3383,7 +3384,7 @@
/types/react-json/ @spielc
/types/react-json-pretty/ @LKay
/types/react-json-tree/ @gnestor
/types/react-jsonschema-form/ @iamdanfox @sirreal @iplus26 @KurtPreston
/types/react-jsonschema-form/ @iamdanfox @iplus26 @KurtPreston
/types/react-lazyload/ @m0a
/types/react-leaflet/ @danzel @davschne @yuit
/types/react-list/ @buptyyf @tomshen
+1 -1
View File
@@ -54,7 +54,7 @@ Before you share your improvement with the world, use it yourself.
#### Test editing an existing package
To add new features you can use [module augmentation](http://www.typescriptlang.org/docs/handbook/declaration-merging.html).
To add new features you can use [module augmentation](http://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
You can also directly edit the types in `node_modules/@types/foo/index.d.ts`, or copy them from there and follow the steps below.
+2 -1
View File
@@ -832,8 +832,9 @@ declare namespace AceAjax {
/**
* [Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft}
* @param scrollLeft The new scroll left value
**/
setScrollLeft(): void;
setScrollLeft(scrollLeft: number): void;
/**
* [Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.getScrollLeft}
+38 -1
View File
@@ -18,6 +18,23 @@ function createFoldTestSession() {
return session;
}
function createScrollTestRenderer(): AceAjax.VirtualRenderer | null {
var el = document.createElement("div");
if (!el.getBoundingClientRect) {
console.log("Skipping test: This test only runs in the browser");
return null;
}
el.style.left = "20px";
el.style.top = "30px";
el.style.width = "300px";
el.style.height = "100px";
document.body.appendChild(el);
return new AceAjax.VirtualRenderer(el);
}
function assertArray(a, b) {
assert.equal(a + "", b + "");
assert.ok(a.length == b.length);
@@ -915,5 +932,25 @@ const aceEditSessionTests = {
session = new AceAjax.EditSession(new Array(30).join("\n"));
session.documentToScreenPosition(2, 0);
session.documentToScreenPosition(2, 0);
},
"test setScrollTop()": function() {
var renderer = createScrollTestRenderer();
var session = new AceAjax.EditSession(["1", "2", "3", "2", "3", "4"]);
renderer.setSession(session);
assert.equal(renderer.getScrollTop(), 0);
session.setScrollTop(40);
assert.equal(renderer.getScrollTop(), 40);
renderer.getScrollTop()
},
"test setScrollLeft()": function() {
var renderer = createScrollTestRenderer();
var session = new AceAjax.EditSession(["1", "2", "3", "2", "3", "4"]);
renderer.setSession(session);
assert.equal(renderer.getScrollLeft(), 0);
session.setScrollLeft(40);
assert.equal(renderer.getScrollLeft(), 40);
renderer.getScrollLeft()
}
};
};
+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;
}
}
+2 -2
View File
@@ -772,7 +772,7 @@ export interface VoidTypeAnnotation extends Node {
export interface JSXAttribute extends Node {
type: "JSXAttribute";
name: JSXIdentifier | JSXNamespacedName;
value: JSXElement | StringLiteral | JSXExpressionContainer;
value: JSXElement | StringLiteral | JSXExpressionContainer | null;
}
export interface JSXClosingElement extends Node {
@@ -1424,7 +1424,7 @@ export function objectTypeProperty(key?: Expression, value?: FlowTypeAnnotation)
export function qualifiedTypeIdentifier(id?: Identifier, qualification?: Identifier | QualifiedTypeIdentifier): QualifiedTypeIdentifier;
export function unionTypeAnnotation(types?: FlowTypeAnnotation[]): UnionTypeAnnotation;
export function voidTypeAnnotation(): VoidTypeAnnotation;
export function jSXAttribute(name?: JSXIdentifier | JSXNamespacedName, value?: JSXElement | StringLiteral | JSXExpressionContainer): JSXAttribute;
export function jSXAttribute(name?: JSXIdentifier | JSXNamespacedName, value?: JSXElement | StringLiteral | JSXExpressionContainer | null): JSXAttribute;
export function jSXClosingElement(name?: JSXIdentifier | JSXMemberExpression): JSXClosingElement;
export function jSXElement(openingElement?: JSXOpeningElement, closingElement?: JSXClosingElement, children?: Array<JSXElement | JSXExpressionContainer | JSXText>, selfClosing?: boolean): JSXElement;
export function jSXEmptyExpression(): JSXEmptyExpression;
+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" />
+6
View File
@@ -0,0 +1,6 @@
import * as bencode from "bencode";
bencode.byteLength("abcde"); // $ExpectType number
bencode.encodingLength("abcde"); // $ExpectType number
bencode.encode([1, 2, 3, 4], new Buffer([]), 1); // $ExpectType Buffer
bencode.decode(new Buffer("abcde"), 1, 3); // $ExpectType any
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for bencode 2.0
// Project: https://github.com/themasch/node-bencode#readme
// Definitions by: Tobenna <https://github.com/tobenna>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export function byteLength(value: any): number;
export function encodingLength(value: any): number;
export function encode(data: any, buffer?: Buffer, offset?: number): Buffer;
export function decode(
data: Buffer,
start?: number,
end?: number,
encoding?: string
): any;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bencode-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+3
View File
@@ -14,3 +14,6 @@ const b6 = b4.multiply(b5);
console.log(b6);
// => BigInteger { '0': 420, '1': 0, t: 1, s: 0 }
console.log(b1.compareTo(b2));
// => 70
+1 -1
View File
@@ -23,7 +23,7 @@ declare class bigi {
clamp(): void;
clearBit(n: number): bigi;
clone(): bigi;
compareTo(a: bigi): bigi;
compareTo(a: bigi): number;
copyTo(r: any): void;
dAddOffset(n: any, w: any): void;
dMultiply(n: number): void;
+12 -8
View File
@@ -3,12 +3,16 @@
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface BlockiesIcon {
toDataURL(): string;
}
interface BlockiesConfig {
seed: string;
}
declare function blockies(config: BlockiesConfig): BlockiesIcon;
declare function blockies(config?: blockies.BlockiesConfig): HTMLCanvasElement;
export = blockies;
declare namespace blockies {
interface BlockiesConfig {
size?: number;
scale?: number;
seed?: string;
color?: string;
bgcolor?: string;
spotcolor?: string;
}
}
+4 -1
View File
@@ -1,7 +1,10 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
+1 -1
View File
@@ -354,7 +354,7 @@ export type TooltipEvent = "show.bs.tooltip" | "shown.bs.tooltip" | "hide.bs.too
// --------------------------------------------------------------------------------------
declare global {
interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement> {
interface JQuery<TElement = HTMLElement> {
alert(action?: "close" | "dispose"): this;
button(action: "toggle" | "dispose"): this;
+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.
+1 -1
View File
@@ -182,7 +182,7 @@ export class ObjectID {
* @param {number} time optional parameter allowing to pass in a second based timestamp.
* @return {string} return the 12 byte id binary string.
*/
generate(time?: number): string;
generate(time?: number): Buffer;
/**
* Returns the generation date (accurate up to the second) that this ID was generated.
* @return {date} the generation date
+6
View File
@@ -0,0 +1,6 @@
import bufferFrom = require('buffer-from');
bufferFrom([1, 2, 3, 4]); // $ExpectType Buffer
bufferFrom(new Uint8Array([1, 2, 3, 4]).buffer, 1, 2); // $ExpectType Buffer
bufferFrom('test', 'utf8'); // $ExpectType Buffer
bufferFrom(bufferFrom('test')); // $ExpectType Buffer
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for buffer-from 1.1
// Project: https://github.com/LinusU/buffer-from#readme
// Definitions by: Nat Burns <https://github.com/burnnat>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare function bufferFrom(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
declare function bufferFrom(str: string, encoding?: string): Buffer;
declare function bufferFrom(data: ReadonlyArray<any> | Buffer): Buffer;
export = bufferFrom;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"buffer-from-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -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" }
+23 -2
View File
@@ -24,7 +24,12 @@ let array = [ 1, 2, 3 ];
chai.spy.on(array, 'push');
// or you can track multiple object's methods
chai.spy.on(array, 'push', 'pop');
chai.spy.on(array, ['push', 'pop']);
// or you can track multiple object's methods
chai.spy.on(array, 'push', function(item) {
array.push(item);
});
array.push(5);
@@ -149,4 +154,20 @@ spy.should.not.have.been.called.above(3);
expect(spy).to.have.been.called.below(3);
expect(spy).to.not.have.been.called.lt(3);
spy.should.have.been.called.lt(3);
spy.should.not.have.been.called.below(3);
spy.should.not.have.been.called.below(3);
// You can also create sandbox
let sb = chai.spy.sandbox();
sb.on(array, 'pop', () => {
return 1;
})
let one = array.pop();
expect(one).to.equal(1);
// Can restore methods in sandbox
sb.restore();
array.push(2);
let two = array.pop();
expect(two).to.equal(2);
+108 -54
View File
@@ -1,6 +1,8 @@
// Type definitions for chai-spies
// Type definitions for chai-spies 1.0.0
// Project: https://github.com/chaijs/chai-spies
// Definitions by: Ilya Kuznetsov <https://github.com/kuzn-ilya>
// Harm van der Werf <https://github.com/harm-less>
// Jouni Suorsa <https://github.com/jounisuo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="chai" />
@@ -21,7 +23,7 @@ declare namespace Chai {
* ```ts
* expect(spy).to.be.spy;
* spy.should.be.spy;
* ```
* ```
*/
spy: Assertion;
@@ -32,7 +34,7 @@ declare namespace Chai {
* expect(spy).to.have.been.called();
* spy.should.have.been.called();
* ```
* Note that ```called``` can be used as a chainable method.
* Note that ```called``` can be used as a chainable method.
*/
called: ChaiSpies.Called;
@@ -61,7 +63,32 @@ declare namespace Chai {
}
declare namespace ChaiSpies {
interface Sandbox {
/**
* #### chai.spy.on (function)
*
* Wraps an object method into spy. All calls will pass through to the original function.
*
* @param {Object} object
* @param {String} methodNames names to spy on
* @param {function} fn replacement function
* @returns function to actually call
*/
on(object: Object, methodNames: string | string[], fn?: (parameters: any[]|any) => any): any;
/**
* #### chai.spy.restore (function)
*
* Restores previously wrapped object's method.
* Restores all spied objects of a sandbox if called without parameters.
*
* @function
* @param {Object} [object]
* @param {String|String[]} [methods] name or names
* @return {Sandbox} Sandbox instance
*/
restore(object?: Object, methodNames?: string | string[]): void;
}
interface Spy {
/**
* #### chai.spy (function)
@@ -72,9 +99,9 @@ declare namespace ChaiSpies {
* var spy = chai.spy(original)
* , e_spy = chai.spy();
* ```
* @param fn function to spy on. @default ```function () {}```
* @param fn function to spy on. @default ```function () {}```
* @returns function to actually call
*/
*/
(): SpyFunc0Proxy<void>;
<R>(fn: SpyFunc0<R>): SpyFunc0Proxy<R>;
<A1, R>(fn: SpyFunc1<A1, R>): SpyFunc1Proxy<A1, R>;
@@ -107,10 +134,11 @@ declare namespace ChaiSpies {
* var spy = chai.spy.on(Array, 'isArray');
* ```
* @param {Object} object
* @param {String} method name to spy on
* @param {String} method names to spy on
* @param {function} fn replacement function
* @returns function to actually call
*/
on(object: Object, ...methodNames: string[]): any;
*/
on(object: Object, methodNames: string | string[], fn?: (parameters: any[]|any) => any): any;
/**
* #### chai.spy.object (function)
@@ -123,10 +151,24 @@ declare namespace ChaiSpies {
* @param {String[]|Object} method names or method definitions
* @returns object with spied methods
*/
object(name: string, methods: string[]): any;
object(methods: string[]): any;
object<T>(name: string, methods: T): T;
object<T>(methods: T): T;
object(name: string, methods: string[]): any;
object(methods: string[]): any;
object<T>(name: string, methods: T): T;
object<T>(methods: T): T;
/**
* #### chai.spy.restore (function)
*
* Restores spy assigned to DEFAULT sandbox
*
* Restores previously wrapped object's method.
* Restores all spied objects of a sandbox if called without parameters.
*
* @param {Object} [object]
* @param {String|String[]} [methods] name or names
* @return {Sandbox} Sandbox instance
*/
restore(object?: Object, methodNames?: string | string[]): void;
/**
* #### chai.spy.returns (function)
@@ -141,6 +183,18 @@ declare namespace ChaiSpies {
*/
returns<T>(value: T): SpyFunc0Proxy<T>;
/**
* ### chai.spy.sandbox
*
* Creates a sandbox.
*
* Sandbox is a set of spies.
* Sandbox allows to track methods on objects and restore original methods with on restore call.
*
* @returns {Sandbox}
*/
sandbox(): Sandbox;
}
interface Called {
@@ -158,12 +212,12 @@ declare namespace ChaiSpies {
* spy.should.not.have.been.called.once;
* ```
*/
once: Chai.Assertion;
once: Chai.Assertion;
/**
* ####.twice
* Assert that a spy has been called exactly twice.
* ```ts
* ```ts
* expect(spy).to.have.been.called.twice;
* expect(spy).to.not.have.been.called.twice;
* spy.should.have.been.called.twice;
@@ -215,7 +269,7 @@ declare namespace ChaiSpies {
* ```ts
* expect(spy).to.have.been.called.above(3);
* spy.should.not.have.been.called.above(3);
* ```
* ```
*/
above(n: number): Chai.Assertion;
@@ -225,7 +279,7 @@ declare namespace ChaiSpies {
* ```ts
* expect(spy).to.have.been.called.gt(3);
* spy.should.not.have.been.called.gt(3);
* ```
* ```
*/
gt(n: number): Chai.Assertion;
@@ -235,7 +289,7 @@ declare namespace ChaiSpies {
* ```ts
* expect(spy).to.have.been.called.below(3);
* spy.should.not.have.been.called.below(3);
* ```
* ```
*/
below(n: number): Chai.Assertion;
@@ -245,7 +299,7 @@ declare namespace ChaiSpies {
* ```ts
* expect(spy).to.have.been.called.lt(3);
* spy.should.not.have.been.called.lt(3);
* ```
* ```
*/
lt(n: number): Chai.Assertion;
}
@@ -301,7 +355,7 @@ declare namespace ChaiSpies {
* spy.should.have.been.called.with('foo');
* ```
* Will also pass for ```spy('foo', 'bar')``` and ```spy(); spy('foo')```.
* If used with multiple arguments, assert that a spy has been called with all the given arguments at least once.
* If used with multiple arguments, assert that a spy has been called with all the given arguments at least once.
* ```ts
* spy('foo', 'bar', 1);
* expect(spy).to.have.been.called.with('bar', 'foo');
@@ -389,7 +443,7 @@ declare namespace ChaiSpies {
*
* Resets __spy object parameters for instantiation and reuse
* @returns proxy spy object
*/
*/
reset(): this;
}
@@ -397,77 +451,77 @@ declare namespace ChaiSpies {
(): R;
}
interface SpyFunc1<A1, R> {
(a: A1): R;
interface SpyFunc1<A1, R> {
(a: A1): R;
}
interface SpyFunc2<A1, A2, R> {
(a: A1, b: A2): R;
interface SpyFunc2<A1, A2, R> {
(a: A1, b: A2): R;
}
interface SpyFunc3<A1, A2, A3, R> {
(a: A1, b: A2, c: A3): R;
interface SpyFunc3<A1, A2, A3, R> {
(a: A1, b: A2, c: A3): R;
}
interface SpyFunc4<A1, A2, A3, A4, R> {
(a: A1, b: A2, c: A3, d: A4): R;
interface SpyFunc4<A1, A2, A3, A4, R> {
(a: A1, b: A2, c: A3, d: A4): R;
}
interface SpyFunc5<A1, A2, A3, A4, A5, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5): R;
interface SpyFunc5<A1, A2, A3, A4, A5, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5): R;
}
interface SpyFunc6<A1, A2, A3, A4, A5, A6, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6): R;
interface SpyFunc6<A1, A2, A3, A4, A5, A6, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6): R;
}
interface SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7): R;
interface SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7): R;
}
interface SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8): R;
interface SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8): R;
}
interface SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9): R;
interface SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9): R;
}
interface SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9, j: A10): R;
interface SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9, j: A10): R;
}
interface SpyFunc0Proxy<R> extends SpyFunc0<R>, Resetable {
}
interface SpyFunc1Proxy<A1, R> extends SpyFunc1<A1, R>, Resetable {
interface SpyFunc1Proxy<A1, R> extends SpyFunc1<A1, R>, Resetable {
}
interface SpyFunc2Proxy<A1, A2, R> extends SpyFunc2<A1, A2, R>, Resetable {
interface SpyFunc2Proxy<A1, A2, R> extends SpyFunc2<A1, A2, R>, Resetable {
}
interface SpyFunc3Proxy<A1, A2, A3, R> extends SpyFunc3<A1, A2, A3, R>, Resetable {
interface SpyFunc3Proxy<A1, A2, A3, R> extends SpyFunc3<A1, A2, A3, R>, Resetable {
}
interface SpyFunc4Proxy<A1, A2, A3, A4, R> extends SpyFunc4<A1, A2, A3, A4, R>, Resetable {
interface SpyFunc4Proxy<A1, A2, A3, A4, R> extends SpyFunc4<A1, A2, A3, A4, R>, Resetable {
}
interface SpyFunc5Proxy<A1, A2, A3, A4, A5, R> extends SpyFunc5<A1, A2, A3, A4, A5, R>, Resetable {
interface SpyFunc5Proxy<A1, A2, A3, A4, A5, R> extends SpyFunc5<A1, A2, A3, A4, A5, R>, Resetable {
}
interface SpyFunc6Proxy<A1, A2, A3, A4, A5, A6, R> extends SpyFunc6<A1, A2, A3, A4, A5, A6, R>, Resetable {
interface SpyFunc6Proxy<A1, A2, A3, A4, A5, A6, R> extends SpyFunc6<A1, A2, A3, A4, A5, A6, R>, Resetable {
}
interface SpyFunc7Proxy<A1, A2, A3, A4, A5, A6, A7, R> extends SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R>, Resetable {
interface SpyFunc7Proxy<A1, A2, A3, A4, A5, A6, A7, R> extends SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R>, Resetable {
}
interface SpyFunc8Proxy<A1, A2, A3, A4, A5, A6, A7, A8, R> extends SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R>, Resetable {
interface SpyFunc8Proxy<A1, A2, A3, A4, A5, A6, A7, A8, R> extends SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R>, Resetable {
}
interface SpyFunc9Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> extends SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>, Resetable {
interface SpyFunc9Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> extends SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>, Resetable {
}
interface SpyFunc10Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> extends SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>, Resetable {
interface SpyFunc10Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> extends SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>, Resetable {
}
}
+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.
*
+15
View File
@@ -71,3 +71,18 @@ euro = chance.euro({opt: 'abc'});
let coin = chance.coin();
coin = chance.coin();
// Make sure date works with min and max parameters
let date: string|Date = chance.date();
let min = new Date();
let max = new Date();
date = chance.date({min, max});
min = new Date();
min.setFullYear(new Date().getFullYear() - 15);
max = new Date();
max.setFullYear(new Date().getFullYear() + 15);
date = chance.date({min, max});
date = chance.date({min});
date = chance.date({max});
+3 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for Chance 1.0.13
// Type definitions for Chance 1.0.16
// Project: http://chancejs.com
// Definitions by: Chris Bowdon <https://github.com/cbowdon>
// Brice BERNARD <https://github.com/brikou>
@@ -189,6 +189,8 @@ declare namespace Chance {
year?: number;
month?: number;
day?: number;
min?: Date;
max?: Date;
}
interface Month {
+4 -2
View File
@@ -12,6 +12,7 @@
// Simon Archer <https://github.com/archy-bold>
// Ken Elkabany <https://github.com/braincore>
// Slavik Nychkalo <https://github.com/gebeto>
// Francesco Benedetto <https://github.com/frabnt>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -483,7 +484,7 @@ declare namespace Chart {
pointHoverBackgroundColor?: ChartColor | ChartColor[];
pointHoverBorderColor?: ChartColor | ChartColor[];
pointHoverBorderWidth?: number | number[];
pointStyle?: PointStyle | HTMLImageElement | Array<PointStyle | HTMLImageElement>;
pointStyle?: PointStyle | HTMLImageElement | HTMLCanvasElement | Array<PointStyle | HTMLImageElement | HTMLCanvasElement>;
xAxisID?: string;
yAxisID?: string;
type?: string;
@@ -506,6 +507,7 @@ declare namespace Chart {
}
interface CommonAxe {
bounds?: string;
type?: ScaleType | string;
display?: boolean;
id?: string;
@@ -516,6 +518,7 @@ declare namespace Chart {
barThickness?: number;
maxBarThickness?: number;
scaleLabel?: ScaleTitleOptions;
time?: TimeScale;
offset?: boolean;
beforeUpdate?(scale?: any): void;
beforeSetDimension?(scale?: any): void;
@@ -537,7 +540,6 @@ declare namespace Chart {
categoryPercentage?: number;
barPercentage?: number;
distribution?: 'linear' | 'series';
time?: TimeScale;
}
// tslint:disable-next-line no-empty-interface
+1586 -591
View File
File diff suppressed because it is too large Load Diff
+38 -3
View File
@@ -1,7 +1,7 @@
import runtime = chrome.app.runtime;
import cwindow = chrome.app.window;
var createOptions: cwindow.CreateWindowOptions = {
const createOptions: cwindow.CreateWindowOptions = {
id: "My Window",
bounds: {
left: 0,
@@ -324,5 +324,40 @@ function testSystemNetwork() {
});
}
import webview = chrome.webview;
let element: webview.HTMLWebViewElement;
const gcmMessage = <chrome.gcm.OutgoingMessage>{};
gcmMessage.data = {
/*goog: 'any', should not be allowed, and it is not :) */
test: true
};
let wve: chrome.webview.HTMLWebViewElement = (<any>document.getElementById('webview'));
wve.name = 'test';
wve.src = 'https://github.com/DefinitelyTyped';
wve.allowtransparency = true;
wve.autosize = 'on';
wve.partition = 'persist:githubwebview';
wve.addEventListener('close', () => {
return;
});
wve.addEventListener('consolemessage', (ev) => {
if (ev.level === chrome.webview.ConsoleMessageLevel.LOG_ERROR) {
const msg = ev.message;
}
});
wve.addEventListener('dialog', (ev) => {
ev.dialog.ok('Hello World!');
});
wve.addEventListener('loadstart', (ev) => {
if (ev.isTopLevel) {
return ev.url;
}
return;
});
wve.addEventListener('zoomchange', (ev) => {
return ev.newZoomFactor || ev.oldZoomFactor;
});
wve.addEventListener('loadredirect', (ev) => {
return ev.newUrl || ev.oldUrl;
});
chrome.bluetoothLowEnergy.connect('1111111', () => { });
+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 => { });
@@ -0,0 +1,33 @@
const startupConfiguration: any = { camera_position: 'back' };
// Some code samples from the wikitude ionic starter
WikitudePlugin.loadARchitectWorld(
success => {
console.log('ARchitect World loaded successfully.');
},
fail => {
console.log('Failed to load ARchitect World!');
},
'www/assets/07_3dModels_6_3dModelAtGeoLocation/index.html',
['geo'],
<JSON> startupConfiguration
);
WikitudePlugin.setOnUrlInvokeCallback(url => {
if (url.indexOf('captureScreen') > -1) {
WikitudePlugin.captureScreen(
absoluteFilePath => {
WikitudePlugin.callJavaScript(
`World.testFunction('Screenshot saved at: ${absoluteFilePath}');`
);
},
errorMessage => {
console.log(errorMessage);
},
true,
null
);
} else {
alert(url + 'not handled');
}
});
+82
View File
@@ -0,0 +1,82 @@
// Type definitions for com.wikitude.phonegap.wikitudeplugin 7.2
// Project: https://github.com/Wikitude/wikitude-cordova-plugin
// Definitions by: zbarbuto <https://github.com/zbarbuto>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// The following types are taken directly (unmodified) from the wikitude-ionic-3-starter-app
// https://github.com/pbreuss/wikitude-ionic-3-starter-app
// Latest commit at time of writing was 647cd546f6d1805765c4cee725566e246ca6259d
/**
* Wrapper for the Wikitude SDK Phonegap Plugin - to use with IONIC2
* (c) 2016 Schneeweis.Technology
*/
interface WikitudePlugin {
isDeviceSupported(
successCallback: (success: string) => void,
errorCallback: (message: string) => void,
requiredFeatures: [string]
): void;
loadARchitectWorld(
successCallback: (success: string) => void,
errorCallback: (message: string) => void,
architectWorldPath: string,
requiredFeatures: [string],
startupConfiguration: JSON | object
): void;
close(): void;
hide(): void;
show(): void;
// test type ok?
callJavaScript(js: any): void;
setOnUrlInvokeCallback(onUrlInvokeCallback: (success: string) => void): void;
setLocation(latitude: any, longitude: any, altitude: any, accuracy: any): void;
captureScreen(
successCallback: (success: string) => void,
errorCallback: (message: string) => void,
includeWebView: boolean,
imagePathInBundleOrNullForPhotoLibrary: string | null
): void;
setErrorHandler(errorHandler: (message: string) => void): void;
setDeviceSensorsNeedCalibrationHandler(
startCalibrationHandler: (message: string) => void
): void;
setDeviceSensorsFinishedCalibrationHandler(
finishedCalibrationHandler: (message: string) => void
): void;
setBackButtonCallback(onBackButtonCallback: (message: string) => void): void;
/* Lifecycle updates */
onResume(): void;
onBackButton(): void;
onPause(): void;
onWikitudeOK(): void;
onWikitudeError(): void;
_sdkKey: string;
FeatureGeo: string;
Feature2DTracking: string;
CameraPositionUndefined: number;
CameraPositionFront: number;
CameraPositionBack: number;
CameraFocusRangeNone: number;
CameraFocusRangeNear: number;
CameraFocusRangeFar: number;
}
declare var WikitudePlugin: WikitudePlugin;
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"com.wikitude.phonegap.wikitudeplugin-tests.ts"
]
}
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+5
View File
@@ -0,0 +1,5 @@
import yaml = require('config-yaml');
yaml('./simple.yaml');
yaml('./simple.yaml', { encoding: 'gbk' });
yaml('./simple.yaml', { encoding: 'utf-8' });
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for config-yaml 1.1
// Project: https://github.com/neolao/config-yaml#readme
// Definitions by: My Self <https://github.com/me>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
/// <reference types="node" />
import * as fs from 'fs';
export = Yaml;
declare namespace Yaml {
interface Options {
encoding: string;
}
}
declare function Yaml(path: fs.PathLike, options?: Partial<Yaml.Options>): any;
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"config-yaml-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+5 -2
View File
@@ -7,7 +7,10 @@
"paths": {
"mongodb": [
"mongodb/v2"
]
],
"mongoose": [
"mongoose/v4"
]
},
"noImplicitAny": true,
"noImplicitThis": true,
@@ -25,4 +28,4 @@
"index.d.ts",
"connect-mongo-tests.ts"
]
}
}
+2 -1
View File
@@ -1,4 +1,5 @@
import cosmiconfig, { CosmiconfigResult } from "cosmiconfig";
import cosmiconfig = require("cosmiconfig");
import { CosmiconfigResult } from "cosmiconfig";
import * as path from "path";
const explorer = cosmiconfig("yourModuleName", {
+52 -47
View File
@@ -3,57 +3,62 @@
// Definitions by: ozum <https://github.com/ozum>
// szeck87 <https://github.com/szeck87>
// saadq <https://github.com/saadq>
// jinwoo <https://github.com/jinwoo>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
/// <reference types="node" />
export interface Config {
[key: string]: any;
declare function cosmiconfig(moduleName: string, options?: cosmiconfig.ExplorerOptions): cosmiconfig.Explorer;
declare namespace cosmiconfig {
interface Config {
[key: string]: any;
}
type CosmiconfigResult = {
config: Config;
filepath: string;
isEmpty?: boolean;
} | null;
interface LoaderResult {
config: Config | null;
filepath: string;
}
type SyncLoader = (filepath: string, content: string) => Config | null;
type AsyncLoader = (filepath: string, content: string) => Config | null | Promise<object | null>;
interface LoaderEntry {
sync?: SyncLoader;
async?: AsyncLoader;
}
interface Loaders {
[key: string]: LoaderEntry;
}
interface Explorer {
search(searchFrom?: string): Promise<null | CosmiconfigResult>;
searchSync(searchFrom?: string): null | CosmiconfigResult;
load(loadPath: string): Promise<CosmiconfigResult>;
loadSync(loadPath: string): CosmiconfigResult;
clearLoadCache(): void;
clearSearchCache(): void;
clearCaches(): void;
}
// These are the user options with defaults applied.
interface ExplorerOptions {
stopDir?: string;
cache?: boolean;
transform?: (result: CosmiconfigResult) => Promise<CosmiconfigResult> | CosmiconfigResult;
packageProp?: string;
loaders?: Loaders;
searchPlaces?: string[];
ignoreEmptySearchPlaces?: boolean;
}
}
export type CosmiconfigResult = {
config: Config;
filepath: string;
isEmpty?: boolean;
} | null;
export interface LoaderResult {
config: Config | null;
filepath: string;
}
export type SyncLoader = (filepath: string, content: string) => Config | null;
export type AsyncLoader = (filepath: string, content: string) => Config | null | Promise<object | null>;
export interface LoaderEntry {
sync?: SyncLoader;
async?: AsyncLoader;
}
export interface Loaders {
[key: string]: LoaderEntry;
}
export interface Explorer {
search(searchFrom?: string): Promise<null | CosmiconfigResult>;
searchSync(searchFrom?: string): null | CosmiconfigResult;
load(loadPath: string): Promise<CosmiconfigResult>;
loadSync(loadPath: string): CosmiconfigResult;
clearLoadCache(): void;
clearSearchCache(): void;
clearCaches(): void;
}
// These are the user options with defaults applied.
export interface ExplorerOptions {
stopDir?: string;
cache?: boolean;
transform?: (result: CosmiconfigResult) => Promise<CosmiconfigResult> | CosmiconfigResult;
packageProp?: string;
loaders?: Loaders;
searchPlaces?: string[];
ignoreEmptySearchPlaces?: boolean;
}
export default function cosmiconfig(moduleName: string, options?: ExplorerOptions): Explorer;
export = cosmiconfig;
+40
View File
@@ -0,0 +1,40 @@
import csso = require('csso');
csso.minify('.test { color: #ff0000; }').css;
csso.minify('.test { color: #ff0000; }').map;
csso.minify('.test { color: #ff0000; }', {
sourceMap: true,
filename: '',
debug: true,
beforeCompress: () => {},
afterCompress: () => {},
restructure: false,
forceMediaMerge: true,
clone: false,
comments: '',
logger: () => {}
});
csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000').css;
csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000').map;
csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000', {
sourceMap: true,
filename: '',
debug: true,
beforeCompress: () => {},
afterCompress: () => {},
restructure: false,
forceMediaMerge: true,
clone: false,
comments: '',
logger: () => {}
});
csso.compress({}).ast;
csso.compress({}, {
restructure: false,
forceMediaMerge: true,
clone: false,
comments: '',
logger: () => {}
}).ast;
+107
View File
@@ -0,0 +1,107 @@
// Type definitions for csso 3.5
// Project: https://github.com/css/csso
// Definitions by: Christian Rackerseder <https://github.com/screendriver>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
declare namespace csso {
interface Result {
/**
* Resulting CSS.
*/
css: string;
/**
* Instance of SourceMapGenerator or null.
*/
map: object | null;
}
interface CompressOptions {
/**
* Disable or enable a structure optimisations.
* @default true
*/
restructure?: boolean;
/**
* Enables merging of @media rules with the same media query by splitted by other rules.
* The optimisation is unsafe in general, but should work fine in most cases. Use it on your own risk.
* @default false
*/
forceMediaMerge?: boolean;
/**
* Transform a copy of input AST if true. Useful in case of AST reuse.
* @default false
*/
clone?: boolean;
/**
* Specify what comments to leave:
* - 'exclamation' or true – leave all exclamation comments
* - 'first-exclamation' – remove every comment except first one
* - false – remove all comments
* @default true
*/
comments?: string | boolean;
/**
* Usage data for advanced optimisations.
*/
usage?: object;
/**
* Function to track every step of transformation.
*/
logger?: () => void;
}
interface MinifyOptions {
/**
* Generate a source map when true.
* @default false
*/
sourceMap?: boolean;
/**
* Filename of input CSS, uses for source map generation.
* @default '<unknown>'
*/
filename?: string;
/**
* Output debug information to stderr.
* @default false
*/
debug?: boolean;
/**
* Called right after parse is run.
*/
beforeCompress?: BeforeCompressFn | BeforeCompressFn[];
/**
* Called right after compress() is run.
*/
afterCompress?: AfterCompressFn | AfterCompressFn[];
restructure?: boolean;
}
type BeforeCompressFn = (ast: object, options: CompressOptions) => void;
type AfterCompressFn = (compressResult: string, options: CompressOptions) => void;
}
interface Csso {
/**
* Minify source CSS passed as String
* @param source
* @param options
*/
minify(source: string, options?: csso.MinifyOptions & csso.CompressOptions): csso.Result;
/**
* The same as minify() but for list of declarations. Usually it's a style attribute value.
* @param source
* @param options
*/
minifyBlock(source: string, options?: csso.MinifyOptions & csso.CompressOptions): csso.Result;
/**
* Does the main task – compress an AST.
*/
compress(ast: object, options?: csso.CompressOptions): { ast: object };
}
declare const csso: Csso;
export = csso;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"csso-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+403 -3
View File
@@ -1,6 +1,20 @@
'use strict';
import cytoscape = require('cytoscape');
// TODO: document all aliases as aliases, not as duplicates!
const assert = (tag: boolean) => {};
const aliases = (...obj: Array<{}>) => {};
// 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 +83,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 +122,42 @@ cy.on('zoom', (event) => {
cy.nodes('$node > node').style('opacity', 0);
}
});
cy.off('zoom');
// events(cy); - TODO
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 +167,330 @@ 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.SingularElementReturnValue,
cytoscape.CollectionReturnValue,
cytoscape.NodeSingular,
cytoscape.NodeCollection,
cytoscape.EdgeSingular,
cytoscape.EdgeCollection
]).forEach((elemType) => {
aliases(elemType.clone, elemType.copy);
// events(elemType); - TODO
aliases(elemType.data, elemType.attr);
aliases(elemType.removeData, elemType.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/edges distinction)
// TODO: algorithms
// TODO: compound nodes (there aren't any in current test case)
+411 -142
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>;
+2 -2
View File
@@ -51,8 +51,7 @@ export class GUI {
__folders: GUI[];
domElement: HTMLElement;
add(target: Object, propName:string): GUIController;
add(target: Object, propName:string, min: number, max: number): GUIController;
add(target: Object, propName:string, min?: number, max?: number, step?: number): GUIController;
add(target: Object, propName:string, status: boolean): GUIController;
add(target: Object, propName:string, items:string[]): GUIController;
add(target: Object, propName:string, items:number[]): GUIController;
@@ -64,6 +63,7 @@ export class GUI {
destroy(): void;
addFolder(propName:string): GUI;
removeFolder(subFolder:GUI):void;
open(): void;
close(): void;
@@ -0,0 +1,13 @@
$(document).ready(() => {
const config: DataTables.Settings = {
// Scroller extension options
scroller: {
trace: true,
rowHeight: 30,
serverWait: 1000,
displayBuffer: 10,
boundaryScale: 0.6,
loadingIndicator: true
}
};
});
+106
View File
@@ -0,0 +1,106 @@
// Type definitions for datatables.net-scroller 1.4
// Project: https://datatables.net
// Definitions by: Konstantin Rohde <https://github.com/RohdeK>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="jquery" />
/// <reference types="datatables.net"/>
declare namespace DataTables {
interface Settings {
/*
* Select extension options
*/
scroller?: boolean | ScrollerSettings;
}
interface ScrollerSettings {
/*
* Indicate if Scroller show show trace information on the console or not.
*/
trace?: boolean;
/*
* Scroller will attempt to automatically calculate the height of rows for it's internal
* calculations. However the height that is used can be overridden using this parameter.
*/
rowHeight?: number | string;
/*
* When using server-side processing, Scroller will wait a small amount of time to allow
* the scrolling to finish before requesting more data from the server.
*/
serverWait?: number;
/*
* The display buffer is what Scroller uses to calculate how many rows it should pre-fetch
* for scrolling.
*/
displayBuffer?: number;
/*
* Scroller uses the boundary scaling factor to decide when to redraw the table - which it
* typically does before you reach the end of the currently loaded data set (in order to
* allow the data to look continuous to a user scrolling through the data).
*/
boundaryScale?: number;
/*
* Show (or not) the loading element in the background of the table. Note that you should
* include the dataTables.scroller.css file for this to be displayed correctly.
*/
loadingIndicator?: boolean;
}
interface Api {
scroller: ScrollerMethodsModel;
}
interface ScrollerMethodsModel {
/*
* Calculate and store information about how many rows are to be displayed
* in the scrolling viewport, based on current dimensions in the browser's
* rendering.
*/
measure(redraw?: boolean): Api;
/*
* Get information about current displayed record range.
*/
page(): PageInfo;
/*
* Get Scroller Api
*/
scroller(): ScrollerMethods;
}
interface ScrollerMethods extends Api {
/*
* Calculate the pixel position from the top of the scrolling container for
* a given row
*/
rowToPixels(rowIdx: number, intParse?: boolean, virtual?: boolean): number;
/*
* Calculate the row number that will be found at the given pixel position
* (y-scroll).
*/
pixelsToRow(pixels: number, intParse?: boolean, virtual?: boolean): number;
scrollToRow(rowIdx: number, animate?: boolean): Api;
}
/*
* start: {int}, // the 0-indexed record at the top of the viewport
* end: {int}, // the 0-indexed record at the bottom of the viewport
*/
interface PageInfo {
start: number;
end: number;
}
interface RowMethods {
/**
* Scroll to a row
*/
scrollTo(animate?: boolean): Api;
}
}
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"datatables.net-scroller-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+5
View File
@@ -1,3 +1,8 @@
import * as CrossFilter from 'crossfilter';
import * as d3 from "d3";
import * as dc from "dc";
interface IYelpData {
city: string;
review_count: number;
-4
View File
@@ -5,10 +5,6 @@
// matthias jobst <https://github.com/MatthiasJobst>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// this makes only sense together with d3 and crossfilter so you need the d3.d.ts and crossfilter.d.ts files
///<reference types="crossfilter" />
import * as d3 from "d3";
export = dc;
+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 {
+5
View File
@@ -21,6 +21,11 @@ declare namespace dygraphs {
* A per-series color definition. Used in conjunction with, and overrides, the colors option.
*/
color?: string;
/**
* A function which plot data for this series on the chart.
*/
plotter?: any;
/**
* Draw a small dot at each point, in addition to a line going through the point. This makes
+1 -1
View File
@@ -1173,7 +1173,7 @@ declare module 'ember' {
* key. You can pass an optional second argument with the target value. Otherwise
* this will match any property that evaluates to false.
*/
rejectBy(key: string, value?: string): NativeArray<T>;
rejectBy(key: string, value?: any): NativeArray<T>;
/**
* Returns the first item in the array for which the callback returns true.
* This method works similar to the `filter()` method defined in JavaScript 1.6
+3
View File
@@ -0,0 +1,3 @@
import emojiRegex from "emoji-regex";
emojiRegex(); // $ExpectType RegExp
+7
View File
@@ -0,0 +1,7 @@
// Type definitions for emoji-regex 7.0
// Project: https://github.com/mathiasbynens/emoji-regex
// Definitions by: iKBAHT <https://github.com/iKBAHT>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function createRegExp(): RegExp;
export = createRegExp;
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"emoji-regex-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,4 @@
import { CallData, BlockParamLiteral } from 'ethereum-protocol';
BlockParamLiteral.Earliest;
BlockParamLiteral.Latest;
BlockParamLiteral.Pending;
+293
View File
@@ -0,0 +1,293 @@
// Type definitions for ethereum-protocol 1.0
// Project: https://www.npmjs.com/package/ethereum-protocol
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
import BigNumber from 'bignumber.js';
export type JSONRPCErrorCallback = (err: Error | null, result?: JSONRPCResponsePayload) => void;
/**
* Do not create your own provider. Use an existing provider from a Web3 or ProviderEngine library
* Read more about Providers in the 0x wiki.
*/
export interface Provider {
sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): void;
}
export type ContractAbi = AbiDefinition[];
export type AbiDefinition = FunctionAbi | EventAbi;
export type FunctionAbi = MethodAbi | ConstructorAbi | FallbackAbi;
export type ConstructorStateMutability = 'nonpayable' | 'payable';
export type StateMutability = 'pure' | 'view' | ConstructorStateMutability;
export enum AbiType {
Function = 'function',
Constructor = 'constructor',
Event = 'event',
Fallback = 'fallback',
}
export interface MethodAbi {
type: AbiType.Function;
name: string;
inputs: DataItem[];
outputs: DataItem[];
constant: boolean;
stateMutability: StateMutability;
payable: boolean;
}
export interface ConstructorAbi {
type: AbiType.Constructor;
inputs: DataItem[];
payable: boolean;
stateMutability: ConstructorStateMutability;
}
export interface FallbackAbi {
type: AbiType.Fallback;
payable: boolean;
}
export interface EventParameter extends DataItem {
indexed: boolean;
}
export interface EventAbi {
type: AbiType.Event;
name: string;
inputs: EventParameter[];
anonymous: boolean;
}
export interface DataItem {
name: string;
type: string;
components?: DataItem[];
}
export enum OpCode {
DelegateCall = 'DELEGATECALL',
Revert = 'REVERT',
Create = 'CREATE',
Stop = 'STOP',
Invalid = 'INVALID',
CallCode = 'CALLCODE',
StaticCall = 'STATICCALL',
Return = 'RETURN',
Call = 'CALL',
SelfDestruct = 'SELFDESTRUCT',
}
export interface StructLog {
depth: number;
error: string;
gas: number;
gasCost: number;
memory: string[];
op: OpCode;
pc: number;
stack: string[];
storage: { [location: string]: string };
}
export interface TransactionTrace {
gas: number;
returnValue: any;
structLogs: StructLog[];
}
export type Unit =
| 'kwei'
| 'ada'
| 'mwei'
| 'babbage'
| 'gwei'
| 'shannon'
| 'szabo'
| 'finney'
| 'ether'
| 'kether'
| 'grand'
| 'einstein'
| 'mether'
| 'gether'
| 'tether';
export interface JSONRPCRequestPayload {
params: any[];
method: string;
id: number;
jsonrpc: string;
}
export interface JSONRPCResponsePayload {
result: any;
id: number;
jsonrpc: string;
}
export interface AbstractBlock {
number: number | null;
hash: string | null;
parentHash: string;
nonce: string | null;
sha3Uncles: string;
logsBloom: string | null;
transactionsRoot: string;
stateRoot: string;
miner: string;
difficulty: BigNumber;
totalDifficulty: BigNumber;
extraData: string;
size: number;
gasLimit: number;
gasUsed: number;
timestamp: number;
uncles: string[];
}
export interface BlockWithoutTransactionData extends AbstractBlock {
transactions: string[];
}
export interface BlockWithTransactionData extends AbstractBlock {
transactions: Transaction[];
}
export interface Transaction {
hash: string;
nonce: number;
blockHash: string | null;
blockNumber: number | null;
transactionIndex: number | null;
from: string;
to: string | null;
value: BigNumber;
gasPrice: BigNumber;
gas: number;
input: string;
}
export interface CallTxDataBase {
to?: string;
value?: number | string | BigNumber;
gas?: number | string | BigNumber;
gasPrice?: number | string | BigNumber;
data?: string;
nonce?: number;
}
export interface TxData extends CallTxDataBase {
from: string;
}
export interface CallData extends CallTxDataBase {
from?: string;
}
export interface FilterObject {
fromBlock?: number | string;
toBlock?: number | string;
address?: string;
topics?: LogTopic[];
}
export type LogTopic = null | string | string[];
export interface DecodedLogEntry<A> extends LogEntry {
event: string;
args: A;
}
export interface DecodedLogEntryEvent<A> extends DecodedLogEntry<A> {
removed: boolean;
}
export interface LogEntryEvent extends LogEntry {
removed: boolean;
}
export interface LogEntry {
logIndex: number | null;
transactionIndex: number | null;
transactionHash: string;
blockHash: string | null;
blockNumber: number | null;
address: string;
data: string;
topics: string[];
}
export interface TxDataPayable extends TxData {
value?: BigNumber;
}
export interface TransactionReceipt {
blockHash: string;
blockNumber: number;
transactionHash: string;
transactionIndex: number;
from: string;
to: string;
status: null | string | 0 | 1;
cumulativeGasUsed: number;
gasUsed: number;
contractAddress: string | null;
logs: LogEntry[];
}
export type ContractEventArg = string | BigNumber | number | boolean;
export interface DecodedLogArgs {
[argName: string]: ContractEventArg;
}
export interface LogWithDecodedArgs<ArgsType extends DecodedLogArgs> extends DecodedLogEntry<ArgsType> {}
export type RawLog = LogEntry;
export enum BlockParamLiteral {
Earliest = 'earliest',
Latest = 'latest',
Pending = 'pending',
}
export type BlockParam = BlockParamLiteral | number;
export interface RawLogEntry {
logIndex: string | null;
transactionIndex: string | null;
transactionHash: string;
blockHash: string | null;
blockNumber: string | null;
address: string;
data: string;
topics: string[];
}
export enum SolidityTypes {
Address = 'address',
Uint256 = 'uint256',
Uint8 = 'uint8',
Uint = 'uint',
}
/**
* Contains the logs returned by a TransactionReceipt. We attempt to decode the
* logs using AbiDecoder. If we have the logs corresponding ABI, we decode it,
* otherwise we don't.
*/
export interface TransactionReceiptWithDecodedLogs extends TransactionReceipt {
logs: Array<LogWithDecodedArgs<DecodedLogArgs> | LogEntry>;
}
export interface TraceParams {
disableMemory?: boolean;
disableStack?: boolean;
disableStorage?: boolean;
}
+4
View File
@@ -0,0 +1,4 @@
{
"private": true,
"dependencies": { "bignumber.js": "7.2.1" }
}
+16
View File
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "ethereum-protocol-tests.ts"]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+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;
@@ -0,0 +1,8 @@
import I18n from 'ex-react-native-i18n';
I18n.defaultLocale = 'en';
I18n.fallbacks = true;
I18n.translations = {};
I18n.locale = 'zh';
const deviceLocale: string = I18n.locale;
+11
View File
@@ -0,0 +1,11 @@
// Type definitions for ex-react-native-i18n 0.0
// Project: https://github.com/xcarpentier/ex-react-native-i18n/
// Definitions by: LikKee Richie <https://github.com/maplerichie>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// Actual version for ex-react-native-i18n is 0.0.4 but 'npm run lint' doesn't allow patch version to pass
import I18n = require("i18n-js");
// import I18n from 'ex-react-native-i18n';
export default I18n;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"ex-react-native-i18n-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+44 -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 }> { }
@@ -2188,6 +2222,7 @@ export interface VideoProps {
translateY?: number;
rotation?: number;
ref?: Ref<PlaybackObject>;
style?: StyleProp<ViewStyle>;
}
export interface VideoState {
+28 -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;
@@ -2181,6 +2202,7 @@ export interface VideoProps {
translateY?: number;
rotation?: number;
ref?: Ref<PlaybackObject>;
style?: StyleProp<ViewStyle>;
}
export interface VideoState {
@@ -0,0 +1,11 @@
import StatusBarHeight from '@expo/status-bar-height';
const onChangeHeight = (height: number) => console.log(`New height: ${height}`);
StatusBarHeight.addEventListener(onChangeHeight);
StatusBarHeight.getAsync()
.then((height: number) => console.log(`Current height: ${height}`))
.catch((error: Error) => console.error('Threw an error in StatusBarHeight.getAsync():', error));
StatusBarHeight.removeEventListener(onChangeHeight);
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for @expo/status-bar-height 0.0
// Project: https://github.com/expo/status-bar-height
// Definitions by: Janeene Beeforth <https://github.com/dawnmist>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export type StatusBarHeightHandler = (height: number) => void;
export class StatusBarHeight {
/**
* Get the current status bar height
*/
getAsync(): Promise<number>;
/**
* Add 'willChange' event listener
*/
addEventListener(handler: StatusBarHeightHandler): void;
/**
* Remove 'willChange' event listener
*/
removeEventListener(handler: StatusBarHeightHandler): void;
}
declare const StatusBarHeightStatic: StatusBarHeight;
export default StatusBarHeightStatic;
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"dom",
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"paths": {
"@expo/status-bar-height": [
"expo__status-bar-height"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"expo__status-bar-height-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+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;
@@ -0,0 +1,105 @@
import express = require('express');
import redis = require('redis');
import expressRedisCache = require('express-redis-cache');
const app = express();
const cache = expressRedisCache();
expressRedisCache({ host: 'localhsot', port: 6379, auth_pass: 'passw0rd' });
expressRedisCache({ client: redis.createClient() });
cache.on('error', (error) => {
throw new Error('Cache error!');
});
app.get('/',
cache.route(), // cache entry name is `cache.prefix + "/"`
(req, res, next) => { });
app.get('/',
cache.route('home'), // cache entry name is now `cache.prefix + "home"`
(req, res, next) => { });
app.get('/',
cache.route({ name: 'home' }), // cache entry name is `cache.prefix + "home"`
(req, res, next) => { });
app.get('/user/:userid',
// middleware to define cache name
(req, res, next) => {
// set cache name
res.express_redis_cache_name = 'user-' + req.params.userid;
next();
},
// cache middleware
cache.route(),
// content middleware
(req, res) => {
res.render('user');
}
);
app.get('/user',
// middleware to decide if using cache
(req, res, next) => {
// Use only cache if user not signed in
res.use_express_redis_cache = !req.signedCookies.user;
next();
},
cache.route(), // this will be skipped if user is signed in
(req, res) => {
res.render('user');
}
);
// Prefix
expressRedisCache({ prefix: 'test' });
// Expiration
expressRedisCache({ expire: 60 });
app.get('/index.html',
cache.route({ expire: 5000 }), // cache entry will live 5000 seconds
(req, res) => { }
);
// You can also use the number sugar syntax
cache.route(5000);
// Or
cache.route('index', 5000);
app.get('/index.html',
cache.route({
expire: {
200: 5000,
'4xx': 10,
403: 5000,
'5xx': 10,
xxx: 1
}
}),
(req, res) => { }
);
cache.get((error, entries) => {
if (error) throw error;
entries.forEach(console.log);
});
cache.get('home', (error, entries) => {});
cache.add(
'user:info',
JSON.stringify({ id: 1, email: 'john@doe.com' }),
{ expire: 60 * 60 * 24, type: 'json' },
(error, added) => {}
);
cache.add(
'user:info',
JSON.stringify({ id: 1, email: 'john@doe.com' }),
(error, added) => {}
);
cache.del('home', (error, deleted) => {});
cache.size((error, bytes) => {});
+77
View File
@@ -0,0 +1,77 @@
// Type definitions for express-redis-cache 1.1
// Project: https://github.com/rv-kip/express-redis-cache
// Definitions by: AJ Livingston <https://github.com/ajliv>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import events = require('events');
import express = require('express');
import redis = require('redis');
declare module 'express-serve-static-core' {
interface Response {
express_redis_cache_name?: string;
use_express_redis_cache?: boolean;
}
}
declare function expressRedisCache(options?: expressRedisCache.Options): expressRedisCache.ExpressRedisCache;
declare namespace expressRedisCache {
class ExpressRedisCache extends events.EventEmitter {
constructor(options?: Options);
static init(options?: Options): ExpressRedisCache;
readonly FOREVER: number;
options: Options;
host: string;
port: string | number;
prefix: string;
auth_pass: string;
connected: boolean;
expire: number;
client: redis.RedisClient;
add(name: string, body: string, options: AddOptions, callback: (error: any, added: Entry) => void): void;
add(name: string, body: string, callback: (error: any, added: Entry) => void): void;
del(name: string, callback: (error: any, deleted: number) => void): void;
get(name: string, callback: (error: any, entries: Entry[]) => void): void;
get(callback: (error: any, entries: Entry[]) => void): void;
route(nameOrOptions: string | RouteOptions, expire?: ExpireOption): express.RequestHandler;
route(expire?: number): express.RequestHandler;
size(callback: (error: any, bytes: number) => void): void;
}
interface AddOptions {
type?: string;
expire?: number;
}
interface Entry {
body: string;
touched: number;
expire: number;
type: string;
}
interface ExpirationConfig {
[statusCode: string]: number;
}
type ExpireOption = number | ExpirationConfig;
type ExpirationPolicy = (req: express.Request, res: express.Response) => number;
interface Options {
auth_pass?: string;
client?: redis.RedisClient;
expire?: number;
host?: string;
port?: string | number;
prefix?: string;
}
interface RouteOptions {
name?: string;
expire?: ExpireOption | ExpirationPolicy;
binary?: boolean;
}
}
export = expressRedisCache;

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