Merge remote-tracking branch 'upstream/master' into AlexJ-DialogObject

This commit is contained in:
Alex Jerabek
2018-06-13 13:24:54 -07:00
144 changed files with 7895 additions and 1994 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ declare module 'angular' {
* Note: This property is not currently supported in any browser.
* Ref: https://developer.mozilla.org/en-US/docs/Web/API/Notification/vibrate
*/
vibrate?: boolean;
vibrate?: any;
/**
* The onclick property of the Notification interface specifies an event listener to receive click events.
+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 {
+1 -1
View File
@@ -97,7 +97,7 @@ 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: Function, locals?: any, bindings?: any): T;
<T>(controllerConstructor: (...args: any[]) => T, locals?: any, bindings?: any): T;
<T>(controllerName: string, locals?: any, bindings?: any): T;
}
+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;
+74 -4
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.
*
@@ -1390,10 +1461,9 @@ declare namespace angular {
interface IControllerService {
// Although the documentation doesn't state this, locals are optional
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any, later?: boolean, ident?: string): T;
<T>(controllerConstructor: Function, locals?: IControllerLocals, later?: boolean, ident?: string): T;
<T>(controllerConstructor: Function, locals?: any, later?: boolean, ident?: string): T;
<T>(controllerName: string, locals?: any, later?: boolean, ident?: string): T;
<T>(controllerConstructor: new (...args: any[]) => T, locals?: any): T;
<T>(controllerConstructor: (...args: any[]) => T, locals?: any): T;
<T>(controllerName: string, locals?: any): T;
}
interface IControllerProvider extends IServiceProvider {
+4 -1
View File
@@ -39,7 +39,10 @@ const showOptions : Auth0LockShowOptions = {
type: "error",
text: "an error has occurred"
},
rememberLastLogin: false
rememberLastLogin: false,
languageDictionary: {
title: "test"
}
};
lock.show(showOptions);
+1
View File
@@ -161,6 +161,7 @@ interface Auth0LockShowOptions {
initialScreen?: "login" | "signUp" | "forgotPassword";
flashMessage?: Auth0LockFlashMessageOptions;
rememberLastLogin?: boolean;
languageDictionary?: any;
}
interface AuthResult {
+2 -1
View File
@@ -350,6 +350,7 @@ export interface Identity {
user_id: string;
provider: string;
isSocial: boolean;
access_token?: string;
profileData?: {
email?: string;
email_verified?: boolean;
@@ -882,4 +883,4 @@ export class UsersManager {
impersonate(userId: string, settings: ImpersonateSettingOptions): Promise<any>;
impersonate(userId: string, settings: ImpersonateSettingOptions, cb: (err: Error, data: any) => void): void;
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import * as t from 'babel-types';
export { t as types };
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Johnny Estilles <https://github.com/johnnyestilles>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import * as t from 'babel-types';
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import { BabylonOptions } from 'babylon';
import * as t from 'babel-types';
+23 -10
View File
@@ -2,15 +2,17 @@
// Project: https://github.com/babel/babel/tree/master/packages/babel-traverse
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Ryan Petrich <https://github.com/rpetrich>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import * as t from 'babel-types';
export type Node = t.Node;
export default function traverse(parent: Node | Node[], opts?: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void;
export default function traverse<S>(parent: Node | Node[], opts: TraverseOptions<S>, scope: Scope, state: S, parentPath?: NodePath): void;
export default function traverse(parent: Node | Node[], opts: TraverseOptions, scope?: Scope, state?: any, parentPath?: NodePath): void;
export interface TraverseOptions extends Visitor {
export interface TraverseOptions<S = Node> extends Visitor<S> {
scope?: Scope;
noScope?: boolean;
}
@@ -25,6 +27,7 @@ export class Scope {
bindings: { [name: string]: Binding; };
/** Traverse node with current scope and path. */
traverse<S>(node: Node | Node[], opts: TraverseOptions<S>, state: S): void;
traverse(node: Node | Node[], opts?: TraverseOptions, state?: any): void;
/** Generate a unique identifier and add it to the current scope. */
@@ -339,10 +342,10 @@ export class NodePath<T = Node> {
listKey: string;
inList: boolean;
parentKey: string;
key: string;
key: string | number;
node: T;
scope: Scope;
type: string;
type: T extends undefined | null ? string | null : string;
typeAnnotation: object;
getScope(scope: Scope): Scope;
@@ -353,7 +356,8 @@ export class NodePath<T = Node> {
buildCodeFrameError<TError extends Error>(msg: string, Error?: new (msg: string) => TError): TError;
traverse(visitor: Visitor, state?: any): void;
traverse<T>(visitor: Visitor<T>, state: T): void;
traverse(visitor: Visitor): void;
set(key: string, node: Node): void;
@@ -372,10 +376,10 @@ export class NodePath<T = Node> {
find(callback: (path: NodePath) => boolean): NodePath;
/** Get the parent function of the current path. */
getFunctionParent(): NodePath;
getFunctionParent(): NodePath<t.Function>;
/** Walk up the tree until we hit a parent node path in a list. */
getStatementParent(): NodePath;
getStatementParent(): NodePath<t.Statement>;
/**
* Get the deepest common ancestor and then from it, get the earliest relationship path
@@ -537,6 +541,9 @@ export class NodePath<T = Node> {
/** Get the source code associated with this node. */
getSource(): string;
/** Check if the current path will maybe execute before another path */
willIMaybeExecuteBefore(path: NodePath): boolean;
// ------------------------- context -------------------------
call(key: string): boolean;
@@ -582,9 +589,15 @@ export class NodePath<T = Node> {
getCompletionRecords(): NodePath[];
getSibling(key: string): NodePath;
getSibling(key: string | number): NodePath;
getAllPrevSiblings(): NodePath[];
getAllNextSiblings(): NodePath[];
get(key: string, context?: boolean | TraversalContext): NodePath;
get<K extends keyof T>(key: K, context?: boolean | TraversalContext):
T[K] extends Array<Node | null | undefined> ? Array<NodePath<T[K][number]>> :
T[K] extends Node | null | undefined ? NodePath<T[K]> :
never;
get(key: string, context?: boolean | TraversalContext): NodePath | NodePath[];
getBindingIdentifiers(duplicates?: boolean): Node[];
+1 -1
View File
@@ -5,7 +5,7 @@
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Boris Cherny <https://github.com/bcherny>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
export interface Comment {
value: string;
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/simlrh/babel-webpack-plugin
// Definitions by: Jed Fox <https://github.com/j-f1>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import { Plugin } from 'webpack';
import { TransformOptions } from 'babel-core';
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: TeamworkGuy2 <https://github.com/TeamworkGuy2>
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
/// <reference types="node" />
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/pugjs/babylon-walk
// Definitions by: Marek Buchar <https://github.com/czbuchi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import * as babelTypes from 'babel-types';
+1 -1
View File
@@ -3,7 +3,7 @@
// Definitions by: Troy Gerwien <https://github.com/yortus>
// Marvin Hagemeister <https://github.com/marvinhagemeister>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// TypeScript Version: 2.8
import { File, Expression } from 'babel-types';
+52
View File
@@ -1,4 +1,5 @@
import browserSync = require("browser-sync");
import { EventEmitter } from "events";
(() => {
//make sure that the interfaces are correctly exposed
@@ -391,6 +392,57 @@ bs.init({
bs.reload();
browserSync.use(
{
plugin: function(opts: object, bs: browserSync.BrowserSyncInstance) {
console.log(opts);
},
"plugin:name": "test"
},
{ files: "*.css" }
);
browserSync.use({
plugin: function(opts: object, bs: browserSync.BrowserSyncInstance) {
console.log(bs.name);
}
});
browserSync(
{
server: {
baseDir: "test/fixtures"
},
logLevel: "silent",
open: false
}
);
var instanceName = "TestInstance";
var namedInstance = browserSync.create(instanceName);
namedInstance.init({
server: { index: "./app" },
https: true
});
console.log(namedInstance.getOption("https")); // Should output true.
var existingInstance = browserSync.get(instanceName);
browserSync.create("InstanceWithEventEmitter", new EventEmitter());
// Should output something greater than 0.
console.log(browserSync.instances.length);
browserSync.reset();
// Should output 0.
console.log(browserSync.instances.length);
var cleanupTestInstance = browserSync.create("CleanupTest");
cleanupTestInstance.cleanup();
console.log(cleanupTestInstance.active); // Should output false.
function browserSyncInit(): browserSync.BrowserSyncInstance {
var browser = browserSync.create();
browser.init();
+44 -15
View File
@@ -456,11 +456,15 @@ declare namespace browserSync {
* depending on your use-case.
*/
(config?: Options, callback?: (err: Error, bs: object) => any): BrowserSyncInstance;
/**
*
*/
instances: Array<BrowserSyncInstance>;
/**
* Create a Browsersync instance
* @param name an identifier that can used for retrieval later
*/
create(name?: string): BrowserSyncInstance;
create(name?: string, emitter?: NodeJS.EventEmitter): BrowserSyncInstance;
/**
* Get a single instance by name. This is useful if you have your build scripts in separate files
* @param name the identifier used for retrieval
@@ -471,6 +475,11 @@ declare namespace browserSync {
* @param name the name of the instance
*/
has(name: string): boolean;
/**
* Reset the state of the module.
* (should only be needed for test environments)
*/
reset(): void;
}
interface BrowserSyncInstance {
@@ -481,6 +490,24 @@ declare namespace browserSync {
* depending on your use-case.
*/
init(config?: Options, callback?: (err: Error, bs: object) => any): BrowserSyncInstance;
/**
* This method will close any running server, stop file watching & exit the current process.
*/
exit(): void;
/**
* Helper method for browser notifications
* @param message Can be a simple message such as 'Connected' or HTML
* @param timeout How long the message will remain in the browser. @since 1.3.0
*/
notify(message: string, timeout?: number): void;
/**
* Method to pause file change events
*/
pause(): void;
/**
* Method to resume paused watchers
*/
resume(): void;
/**
* Reload the browser
* The reload method will inform all browsers about changed files and will either cause the browser
@@ -510,28 +537,30 @@ declare namespace browserSync {
*/
stream(opts?: StreamOptions): NodeJS.ReadWriteStream;
/**
* Helper method for browser notifications
* @param message Can be a simple message such as 'Connected' or HTML
* @param timeout How long the message will remain in the browser. @since 1.3.0
* Instance Cleanup.
*/
notify(message: string, timeout?: number): void;
cleanup(fn?: (error: NodeJS.ErrnoException, bs: BrowserSyncInstance) => void): void;
/**
* This method will close any running server, stop file watching & exit the current process.
* Register a plugin.
* Must implement at least a 'plugin' property that returns
* callable function.
*
* @method use
* @param {object} module The object to be `required`.
* @param {object} options The
* @param {any} cb A callback function that will return any errors.
*/
exit(): void;
use(module: { "plugin:name"?: string, plugin: (opts: object, bs: BrowserSyncInstance) => any }, options?: object, cb?: any): void;
/**
* Callback helper to examine what options have been set.
* @param {string} name The key to search options map for.
*/
getOption(name: string): any;
/**
* Stand alone file-watcher. Use this along with Browsersync to create your own, minimal build system
*/
watch(patterns: string, opts?: chokidar.WatchOptions, fn?: (event: string, file: fs.Stats) => any)
: NodeJS.EventEmitter;
/**
* Method to pause file change events
*/
pause(): void;
/**
* Method to resume paused watchers
*/
resume(): void;
/**
* The internal Event Emitter used by the running Browsersync instance (if there is one). You can use
* this to emit your own events, such as changed files, logging etc.
@@ -0,0 +1,28 @@
import BufferReader from 'buffer-reader';
const buffer = new Buffer(1000);
const reader = new BufferReader(buffer);
reader.append(new Buffer(1));
reader.tell();
reader.seek(1);
reader.move(2);
reader.restAll();
reader.nextBuffer(2);
reader.nextString(5);
reader.nextString(5, 'utf8');
reader.nextStringZero();
reader.nextStringZero('utf8');
reader.nextInt8();
reader.nextUInt8();
reader.nextInt16LE();
reader.nextUInt16LE();
reader.nextInt16BE();
reader.nextUInt16BE();
reader.nextInt32LE();
reader.nextUInt32LE();
reader.nextInt32BE();
reader.nextUInt32BE();
reader.nextFloatLE();
reader.nextFloatBE();
reader.nextDouble32LE();
reader.nextDouble32BE();
+111
View File
@@ -0,0 +1,111 @@
// Type definitions for buffer-reader 0.1
// Project: https://github.com/villadora/node-buffer-reader
// Definitions by: nrlquaker <https://github.com/nrlquaker>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
/// <reference types="node"/>
export = BufferReader;
declare class BufferReader {
/**
* Create a new reader, if no buffer provided, a empty buffer will be used.
*/
constructor(buffer?: Buffer)
/**
* Append new buffer to the end of current reader.
* @param buffer buffer to append
*/
append(buffer: Buffer): void;
/**
* Return current position of the reader.
*/
tell(): number;
/**
* Set new position of the reader, if the pos is invalid, an exception will be raised.
* @param position new position
*/
seek(position: number): void;
/**
* Move the position of reader by offset, offset can be negative; it can be used to skip some bytes.
* @param offset offset to move by
*/
move(offset: number): void;
/**
* Get all the remaining bytes as a Buffer.
*/
restAll(): Buffer;
/**
* Read a buffer with specified length.
* @param length specified length
*/
nextBuffer(length: number): Buffer;
/**
* Read next length of bytes as String, encoding default is 'utf8'.
* @param length length of the string to read
* @param encoding encoding of the string
*/
nextString(length: number, encoding?: string): string;
/**
* Read next bytes till the end of buffer as null-terminated string, encoding default is 'utf8'.
* @param encoding encoding of the string
*/
nextStringZero(encoding?: string): string;
/**
* Read next bytes as Int8, the value is just as the same format Buffer in nodejs doc.
*/
nextInt8(): number;
/**
* Read next bytes as UInt8, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt8(): number;
/**
* Read next bytes as Int16LE, the value is just as the same format Buffer in nodejs doc.
*/
nextInt16LE(): number;
/**
* Read next bytes as UInt16LE, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt16LE(): number;
/**
* Read next bytes as Int16BE, the value is just as the same format Buffer in nodejs doc.
*/
nextInt16BE(): number;
/**
* Read next bytes as UInt16BE, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt16BE(): number;
/**
* Read next bytes as Int32LE, the value is just as the same format Buffer in nodejs doc.
*/
nextInt32LE(): number;
/**
* Read next bytes as UInt32LE, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt32LE(): number;
/**
* Read next bytes as Int32BE, the value is just as the same format Buffer in nodejs doc.
*/
nextInt32BE(): number;
/**
* Read next bytes as UInt32BE, the value is just as the same format Buffer in nodejs doc.
*/
nextUInt32BE(): number;
/**
* Read next bytes as FloatLE, the value is just as the same format Buffer in nodejs doc.
*/
nextFloatLE(): number;
/**
* Read next bytes as FloatBE, the value is just as the same format Buffer in nodejs doc.
*/
nextFloatBE(): number;
/**
* Read next bytes as Double32LE, the value is just as the same format Buffer in nodejs doc.
*/
nextDouble32LE(): number;
/**
* Read next bytes as Double32BE, the value is just as the same format Buffer in nodejs doc.
*/
nextDouble32BE(): number;
}
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"esModuleInterop": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"buffer-reader-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+33
View File
@@ -1361,6 +1361,39 @@ suite('assert', () => {
assert.notDeepEqual(circularObject, secondCircularObject);
});
test('deepStrictEqual', () => {
assert.deepStrictEqual({tea: 'chai'}, {tea: 'chai'});
assert.throws(() => assert.deepStrictEqual({tea: 'chai'}, {tea: 'black'}));
const obja = Object.create({tea: 'chai'});
const objb = Object.create({tea: 'chai'});
assert.deepStrictEqual(obja, objb);
const obj1 = Object.create({tea: 'chai'});
const obj2 = Object.create({tea: 'black'});
assert.throws(() => assert.deepStrictEqual(obj1, obj2));
});
test('deepStrictEqual (ordering)', () => {
const a = {a: 'b', c: 'd'};
const b = {c: 'd', a: 'b'};
assert.deepStrictEqual(a, b);
});
test('deepStrictEqual (circular)', () => {
const circularObject: any = {};
const secondCircularObject: any = {};
circularObject.field = circularObject;
secondCircularObject.field = secondCircularObject;
assert.deepStrictEqual(circularObject, secondCircularObject);
secondCircularObject.field2 = secondCircularObject;
assert.deepStrictEqual(circularObject, secondCircularObject);
});
test('isNull', () => {
assert.isNull(null);
assert.isNull(undefined);
+12 -2
View File
@@ -353,7 +353,7 @@ declare namespace Chai {
notStrictEqual<T>(actual: T, expected: T, message?: string): void;
/**
* Asserts that actual is deeply equal to expected.
* Asserts that actual is deeply equal (==) to expected.
*
* @type T Type of the objects.
* @param actual Actual value.
@@ -363,7 +363,7 @@ declare namespace Chai {
deepEqual<T>(actual: T, expected: T, message?: string): void;
/**
* Asserts that actual is not deeply equal to expected.
* Asserts that actual is not deeply equal (==) to expected.
*
* @type T Type of the objects.
* @param actual Actual value.
@@ -372,6 +372,16 @@ declare namespace Chai {
*/
notDeepEqual<T>(actual: T, expected: T, message?: string): void;
/**
* Asserts that actual is deeply strict equal (===) to expected.
*
* @type T Type of the objects.
* @param actual Actual value.
* @param expected Potential expected value.
* @param message Message to display on error.
*/
deepStrictEqual<T>(actual: T, expected: T, message?: string): void;
/**
* Asserts valueToCheck is strictly greater than (>) valueToBeAbove.
*
+1
View File
@@ -506,6 +506,7 @@ declare namespace Chart {
}
interface CommonAxe {
bounds?: string;
type?: ScaleType | string;
display?: boolean;
id?: string;
+7 -1
View File
@@ -367,9 +367,15 @@ declare namespace cast.framework.events {
total?: number,
whenSkippable?: number,
endedReason?: EndedReason,
breakClipId?: string
breakClipId?: string,
breakId?: string
);
/**
* The break's id. Refer to Break.id
*/
breakId?: string;
/**
* The break clip's id. Refer to BreakClip.id
*/
@@ -8,7 +8,8 @@ import {
} from "chromecast-caf-receiver/cast.framework.system";
import {
RequestEvent,
Event
Event,
BreaksEvent
} from "chromecast-caf-receiver/cast.framework.events";
import {
QueueBase,
@@ -29,12 +30,16 @@ import {
MediaMetadata
} from "chromecast-caf-receiver/cast.framework.messages";
const breaksEvent = new BreaksEvent('BREAK_STARTED');
breaksEvent.breakId = 'some-break-id';
breaksEvent.breakClipId = 'some-break-clip-id';
const track = new Track(1, "TEXT");
const breakClip = new BreakClip("id");
const adBreak = new Break("id", ["id"], 1);
const rEvent = new RequestEvent("BITRATE_CHANGED", { requestId: 2 });
const pManager = new PlayerManager();
pManager.addEventListener("STALLED", () => {});
pManager.addEventListener("STALLED", () => { });
const ttManager = new TextTracksManager();
const qManager = new QueueManager();
const qBase = new QueueBase();
@@ -47,10 +52,10 @@ const breakManager: BreakManager = {
getBreakClips: () => [breakClip],
getBreaks: () => [adBreak],
getPlayWatchedBreak: () => true,
setBreakClipLoadInterceptor: () => {},
setBreakSeekInterceptor: () => {},
setPlayWatchedBreak: () => {},
setVastTrackingInterceptor: () => {}
setBreakClipLoadInterceptor: () => { },
setBreakSeekInterceptor: () => { },
setPlayWatchedBreak: () => { },
setVastTrackingInterceptor: () => { }
};
const lrd: LoadRequestData = {
@@ -103,4 +108,4 @@ const pData: PlayerData = {
whenSkippable: 321
};
const binder = new PlayerDataBinder(pData);
binder.addEventListener("ANY_CHANGE", e => {});
binder.addEventListener("ANY_CHANGE", e => { });
+7
View File
@@ -22,6 +22,13 @@ Promise.all([
explorer.loadSync(path.join(__dirname, "sample-config.json")),
]).then(result => result);
const result = explorer.searchSync();
if (result) {
const config = result.config;
const filepath = result.filepath;
const isEmpty = result.isEmpty;
}
explorer.clearLoadCache();
explorer.clearSearchCache();
explorer.clearCaches();
+1 -1
View File
@@ -14,7 +14,7 @@ export interface Config {
export type CosmiconfigResult = {
config: Config;
filePath: string;
filepath: string;
isEmpty?: boolean;
} | null;
+402 -3
View File
@@ -1,6 +1,26 @@
'use strict';
import cytoscape = require('cytoscape');
// TODO: document all aliases as aliases, not as duplicates!
const assert = (tag: boolean) => { if (!tag) throw new Error(); };
const aliases = (...obj: Array<{}>) => { if (obj.slice(1).some((alias) => alias !== obj[0])) throw new Error(); };
const events = (obj: any) => {
aliases(obj.on, obj.bind, obj.listen, obj.addListener);
aliases(obj.promiseOn, obj.pon);
aliases(obj.off, obj.unbind, obj.unlisten, obj.removeListener);
aliases(obj.emit, obj.trigger);
};
// definitions
function oneOf<A, B, C, D, E>(a: A, b: B, c: C, d: D, e: E): A | B | C | D | E;
function oneOf<A, B, C, D>(a: A, b: B, c: C, d: D): A | B | C | D;
function oneOf<A, B, C>(a: A, b: B, c: C): A | B | C;
function oneOf<A, B>(a: A, b: B): A | B;
function oneOf<T>(...array: T[]): T {
return array[0];
}
import cytoscape = require('cytoscape');
const parentCSS = {
'padding-top': '10px',
'padding-left': '10px',
@@ -69,6 +89,34 @@ const cy = cytoscape({
]
},
// initial viewport state:
zoom: 1,
pan: { x: 0, y: 0 },
// interaction options:
minZoom: 1e-50,
maxZoom: 1e50,
zoomingEnabled: true,
userZoomingEnabled: true,
panningEnabled: true,
userPanningEnabled: true,
selectionType: 'single',
touchTapThreshold: 8,
desktopTapThreshold: 4,
autolock: false,
autoungrabify: false,
// rendering options:
headless: false,
styleEnabled: true,
hideEdgesOnViewport: false,
hideLabelsOnViewport: false,
textureOnViewport: false,
motionBlur: false,
motionBlurOpacity: 0.2,
wheelSensitivity: 1,
pixelRatio: 'auto',
layout: {
name: 'preset',
padding: 5
@@ -80,6 +128,42 @@ cy.on('zoom', (event) => {
cy.nodes('$node > node').style('opacity', 0);
}
});
cy.off('zoom');
events(cy);
cy.add({ data: { id: 'g' }, position: {x: 200, y: 150} });
cy.add([
{ data: { id: 'h' }, position: {x: 250, y: 100} }
]);
const nodesBeforeDelete = cy.nodes();
const edgesBeforeDelete = cy.edges();
const removed = cy.remove('#g #h');
cy.add(removed);
const diffNodes = nodesBeforeDelete.diff(cy.nodes());
const diffEdges = edgesBeforeDelete.diff(cy.edges());
assert(diffNodes.left.size() === 0 && diffNodes.right.size() === 0 && diffNodes.both.size() === cy.nodes().size());
assert(nodesBeforeDelete.same(cy.nodes()));
assert(edgesBeforeDelete.same(cy.edges()));
const gh = cy.collection().add(cy.$id('g')).union(cy.getElementById('h'));
const gh2 = cy.$('#g #h');
const gh3 = cy.nodes('#g #h');
assert(gh2.same(gh));
assert(gh3.same(gh));
assert(gh.same(removed));
assert(cy.container() === null); // headless mode!
cy.center();
cy.center(gh);
aliases(cy.center, cy.centre);
cy.fit(cy.$('#a #b #h'));
const {x1, y1, x2, y2, w, h} = cy.extent();
aliases(cy.resize, cy.invalidateDimensions);
cy.animate({
fit: {
@@ -89,8 +173,323 @@ cy.animate({
duration: 500
});
const node = cy.nodes()[0];
cy.animate({
center: {eles: node},
center: {eles: cy.nodes()[0]},
duration: 500
});
const anim = cy.animation({
zoom: {
level: 1,
position: {x: 0, y: 0}
},
pan: {x: 100, y: 100},
duration: 100,
easing: 'ease'
});
cy.stop(true, true);
anim.play();
assert(anim.playing());
anim.progress(anim.progress() + 50);
anim.time(anim.time() - 50);
anim.stop();
aliases(cy.layout, cy.createLayout, cy.makeLayout);
// Preconfigured data for layouts (as it could be passed)
const boundingBox = oneOf({x1: 0, x2: 100, y1: 0, y2: 100}, {x1: 0, w: 100, y1: 0, h: 100});
const positions = oneOf({a: {x: 100, y: 100}}, (node: cytoscape.NodeCollection): cytoscape.Position => ({x: 100, y: 100}));
// TODO: uncomment after we have the way to add layout options properties from extensions
// const layouts = [
// cy.layout({
// name: 'null',
// ready: () => {},
// stop: () => {}
// }),
// cy.layout({
// name: 'random',
// fit: true,
// padding: 30,
// boundingBox,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-in',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'preset',
// positions,
// zoom: 1,
// pan: {x: 100, y: 100},
// fit: false,
// padding: 30,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-out',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'grid',
// fit: true,
// padding: 30,
// boundingBox,
// avoidOverlap: true,
// avoidOverlapPadding: 10,
// nodeDimensionsIncludeLabels: false,
// spacingFactor: oneOf(1, undefined),
// condense: false,
// rows: oneOf(10, undefined),
// cols: oneOf(10, undefined),
// position: (node) => ({ row: 1, col: 1 }),
// sort: (a, b) => 1,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-in-out',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'circle',
// fit: true,
// padding: 30,
// boundingBox,
// avoidOverlap: true,
// nodeDimensionsIncludeLabels: false,
// spacingFactor: oneOf(1, undefined),
// radius: oneOf(1, undefined),
// startAngle: 3 / 2 * Math.PI,
// sweep: oneOf(6, undefined),
// clockwise: true,
// sort: (a, b) => 1,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-in-sine',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'concentric',
// fit: true,
// padding: 30,
// startAngle: 3 / 2 * Math.PI,
// sweep: oneOf(6, undefined),
// clockwise: true,
// equidistant: false,
// minNodeSpacing: 10,
// boundingBox,
// avoidOverlap: true,
// nodeDimensionsIncludeLabels: false,
// height: oneOf(500, undefined),
// width: oneOf(500, undefined),
// spacingFactor: oneOf(1, undefined),
// concentric: (node) => 1,
// levelWidth: (nodes) => 1,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-out-sine',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'breadthfirst',
// fit: true,
// directed: false,
// padding: 30,
// circle: false,
// spacingFactor: 1.75,
// boundingBox,
// avoidOverlap: true,
// nodeDimensionsIncludeLabels: false,
// maximalAdjustments: 0,
// animate: false,
// animationDuration: 500,
// animationEasing: 'ease-in-out-sine',
// animateFilter: (node, i) => true,
// transform: (node, position) => position
// }),
// cy.layout({
// name: 'cose',
// ready: () => {},
// stop: () => {},
// animate: oneOf(true, false, 'end'),
// animationEasing: oneOf('ease-in-quad', undefined),
// animationDuration: oneOf(500, undefined),
// animateFilter: function ( node, i ){ return true; },
// animationThreshold: 250,
// refresh: 20,
// fit: true,
// padding: 30,
// boundingBox: undefined,
// nodeDimensionsIncludeLabels: false,
// randomize: false,
// componentSpacing: 40,
// nodeRepulsion: (node) => 2048,
// nodeOverlap: 4,
// idealEdgeLength: (edge) => 32,
// edgeElasticity: (edge) => 32,
// nestingFactor: 1.2,
// gravity: 1,
// numIter: 1000,
// initialTemp: 1000,
// coolingFactor: 0.99,
// minTemp: 1.0,
// weaver: false
// })
// ];
// const lay = layouts[0];
// aliases(lay.run, lay.start);
// events(lay);
// layouts.map(layout => {
// layout.run();
// layout.stop();
// });
// TODO: cy.style
cy.png({
output: oneOf('base64uri', 'base64', 'blob', undefined),
bg: oneOf('#ffffff', undefined),
full: true,
scale: 2,
maxWidth: 100,
maxHeight: 100
});
aliases(cy.jpg, cy.jpeg);
cy.jpg({
output: oneOf('base64uri', 'base64', 'blob', undefined),
bg: oneOf('#ffffff', undefined),
full: true,
scale: 2,
maxWidth: 100,
maxHeight: 100,
quality: 0.5
});
cy.json(cy.json());
// Types possible to call methods
const ele = oneOf(cy.nodes()[0], cy.edges()[0]);
const eles = cy.elements();
const node = cy.nodes()[0];
const nodes = cy.nodes();
const edge = cy.edges()[0];
const edges = cy.edges();
assert(ele.cy() === cy);
eles.remove();
assert(eles.removed());
assert(!eles.inside());
eles.restore();
([ele, eles, node, nodes, edge, edges] as cytoscape.CollectionReturnValue[]).forEach((elem) => {
aliases(elem.clone, elem.copy);
events(elem);
aliases(elem.data, elem.attr);
aliases(elem.removeData, elem.removeAttr);
});
// TODO: tests for data flow
const loops = oneOf(true, false);
node.degree(loops); node.indegree(loops); node.outdegree(loops);
nodes.totalDegree(loops); nodes.minDegree(loops); nodes.maxDegree(loops);
nodes.minIndegree(loops); nodes.maxIndegree(loops); nodes.minOutdegree(loops); nodes.maxOutdegree(loops);
// tslint:disable-next-line:ban-types
const getsetPos = <T extends Function>(func: T): T => {
func('x', func('x'));
func(func());
func({x: 100, y: 100});
return func;
};
aliases(node.modelPosition, node.point, node.position);
getsetPos(node.position);
nodes.shift('x', 100);
nodes.shift({x: -100, y: 0});
aliases(nodes.modelPositions, nodes.positions, nodes.points);
nodes.positions((node, i) => Object.assign(node.position(), {x: node.position('x') + i}));
aliases(node.renderedPosition, node.renderedPoint);
getsetPos(node.renderedPoint);
// TODO: tests for compound nodes (relativePosition, in particular)
const sizes: number[] = [
ele.width(), ele.outerWidth(), ele.renderedWidth(), ele.renderedOuterWidth(),
ele.height(), ele.outerHeight(), ele.renderedHeight(), ele.renderedOuterHeight()
];
aliases(eles.boundingBox, eles.boundingbox);
aliases(eles.renderedBoundingBox, eles.renderedBoundingbox);
const flags: boolean[] = [
node.grabbed(), node.grabbable(), node.locked(), ele.active(),
];
const edgePoints: cytoscape.Position[] = [
...edge.controlPoints(), ...edge.segmentPoints(), edge.sourceEndpoint(), edge.targetEndpoint(), edge.midpoint()
];
aliases(eles.layout, eles.createLayout, eles.makeLayout);
const layout = eles.layout({name: 'random'}).run();
eles.select();
assert(ele.selected()); // as we selected all, and this too
aliases(eles.unselect, eles.deselect);
eles.selectify();
assert(ele.selectable());
eles.unselectify();
eles.addClass('test');
eles.toggleClass('test', oneOf(true, false, undefined));
eles.removeClass('test');
eles.classes(oneOf('test', undefined));
eles.flashClass('test flash', oneOf(1000, undefined));
assert(ele.hasClass('test'));
eles.style('background-color', 'green');
Object.keys(eles.style()).map(key => eles.style(key));
eles.style(eles.style());
aliases(eles.style, eles.css);
aliases(ele.renderedCss, ele.renderedStyle);
eles.anySame(nodes);
aliases(eles.contains, eles.has);
aliases(eles.allAreNeighbors, eles.allAreNeighbours);
eles.is('#g');
eles.allAre('#g');
eles.some((el, i, els) => true);
eles.every((el, i, els) => true);
aliases(eles.forEach, eles.each);
const selected: cytoscape.SingularElementArgument[] = [eles.eq(0), eles.first(), eles.last()];
const collSel = cy.collection(selected);
const selectedNodes: cytoscape.NodeSingular[] = [nodes.eq(0), nodes.first(), nodes.last()];
const collNodes = cy.collection(selectedNodes);
const selectedEdges: cytoscape.EdgeSingular[] = [edges.eq(0), edges.first(), edges.last()];
eles.slice(0, -1);
eles.toArray();
aliases(eles.getElementById, eles.$id);
aliases(eles.union, eles.add, eles.or, eles.u, eles['+'], eles['|']);
aliases(eles.difference, eles.not, eles.subtract, eles.relativeComplement, eles['\\'], eles['!'], eles['-']);
aliases(eles.absoluteComplement, eles.abscomp, eles.complement);
aliases(eles.intersection, eles.intersect, eles.and, eles.n, eles['&'], eles['.']);
aliases(eles.symmetricDifference, eles.symdiff, eles.xor, eles['^'], eles['(+)'], eles['(-)']);
cy.collection([nodes[0]]).union(nodes[1]).union(eles.$id('g'));
eles.difference(collNodes).abscomp().intersection(collSel).symdiff(collNodes);
const diff = collSel.diff(collNodes);
cy.collection().merge(diff.left).merge(diff.right).merge(diff.both).unmerge(collSel).filter((ele, i, eles) => true);
eles.sort((a, b) => 1).map((ele, i, eles) => [i, ele]);
eles.reduce<any[]>((prev, ele, i, eles) => [...prev, [ele, i]], []).concat(['finish']);
const min = eles.min((ele, i, eles) => ele.id.length + i); min.ele.scratch('min', min.value);
const max = eles.max((ele, i, eles) => ele.id.length + i); max.ele.scratch('max', max.value);
// TODO: traversing (need to actively check the nodes/edeges distinction)
// TODO: algorithms
// TODO: compound nodes (there aren't any in current test case)
+389 -135
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -3277,7 +3277,7 @@ declare namespace d3 {
round(round: boolean): Treemap<T>;
sticky(): boolean;
sticky(sticky: boolean): boolean;
sticky(sticky: boolean): Treemap<T>;
mode(): string;
mode(mode: "squarify"): Treemap<T>;
+5
View File
@@ -1432,6 +1432,11 @@ declare namespace DataTables {
*/
tabIndex?: number;
/**
* Enable or disable datatables responsive. Since: 1.10
*/
responsive?: boolean | object;
//#endregion "Options"
//#region "Callbacks"
+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`);
}
);
Vendored Regular → Executable
+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 {
+1 -1
View File
@@ -3,7 +3,7 @@ import {
setResolver, setupAcceptanceTest, setupComponentTest,
setupModelTest, setupTest
} from 'ember-mocha';
import { context, describe, it, beforeEach, afterEach, before, after } from 'mocha';
import { describe, it, beforeEach, afterEach, before, after } from 'mocha';
import chai = require('chai');
import Ember from "ember";
import hbs from 'htmlbars-inline-precompile';
+1 -2
View File
@@ -60,6 +60,5 @@ declare module 'ember-mocha' {
declare module 'mocha' {
// augment test callback context
interface ITestCallbackContext extends TestContext {}
interface IHookCallbackContext extends TestContext {}
interface Context extends TestContext {}
}
+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;
+16 -3
View File
@@ -7,6 +7,7 @@
// Fernando Helwanger <https://github.com/fhelwanger>
// Umidbek Karimov <https://github.com/umidbekkarimov>
// Moshe Feuchtwanger <https://github.com/moshfeu>
// Michael Prokopchuk <https://github.com/prokopcm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -1390,12 +1391,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 }> { }
+4
View File
@@ -82,6 +82,10 @@ declare namespace GoogleAppsScript {
* Sets the URL to navigate to when the action is activated.
*/
setOpenLink(openLink: OpenLink): ActionResponseBuilder;
/**
* Sets a flag to indicate that this action changed the existing data state.
*/
setStateChanged(stateChanged: boolean): ActionResponseBuilder;
}
export interface AuthorizationAction {
+5
View File
@@ -32,6 +32,11 @@ export interface IFrameOptions {
* CSS margin attribute, for example '8px 3em'. A number value is converted into px.
*/
bodyMargin?: number | string;
/**
* Override the default body padding style in the iFrame. A string can be any valid value for the
* CSS margin attribute, for example '8px 3em'. A number value is converted into px.
*/
bodyPadding?: number | string;
/**
* When set to true, only allow incoming messages from the domain listed in the src property of the iFrame tag.
* If your iFrame navigates between different domains, ports or protocols; then you will need to
+81
View File
@@ -0,0 +1,81 @@
// Type definitions for ion-rangeslider 2.2
// Project: https://github.com/IonDen/ion.rangeSlider/
// Definitions by: Karel van de Plassche <https://github.com/Karel-van-de-Plassche>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// API documentation: http://ionden.com/a/plugins/ion.rangeSlider/en.html
// Parsed using https://github.com/Karel-van-de-Plassche/ion-rangeslider-parser.git
// Based on global-modifying module template file
declare global {
interface JQuery {
destroy(): void;
ionRangeSlider(options?: IonRangeSliderOptions): JQuery;
reset(): void;
update(option: IonRangeSliderOptions): void;
}
}
export interface IonRangeSliderOptions {
type?: string; // Choose slider type, could be `single` - for one handle, or `double` for two handles [Default: single]
min?: number; // Set slider minimum value [Default: 10]
max?: number; // Set slider maximum value [Default: 100]
from?: number; // Set start position for left handle (or for single handle) [Default: min]
to?: number; // Set start position for right handle [Default: max]
step?: number; // Set sliders step. Always > 0. Could be fractional [Default: 1]
min_interval?: number; // Set minimum diapason between sliders. Only for **double** type [Default: -]
max_interval?: number; // Set minimum maximum between sliders. Only for **double** type [Default: -]
drag_interval?: boolean; // Allow user to drag whole range. Only for **double** type [Default: false]
values?: any[]; // Set up your own array of possible slider values. They could be numbers or strings. If the values array is set up, min, max and step param, can no longer be changed [Default: []]
from_fixed?: boolean; // Fix position of left (or single) handle [Default: false]
from_min?: number; // Set minimum limit for left (or single) handle [Default: min]
from_max?: number; // Set maximum limit for left (or single) handle [Default: max]
from_shadow?: boolean; // Highlight the limits for left handle [Default: false]
to_fixed?: boolean; // Fix position of right handle [Default: false]
to_min?: number; // Set minimum limit for right handle [Default: min]
to_max?: number; // Set maximum limit for right handle [Default: max]
to_shadow?: boolean; // Highlight the right handle [Default: false]
prettify_enabled?: boolean; // Improve readability of long numbers: 10000000 &rarr; 10 000 000 [Default: true]
prettify_separator?: string; // Set up your own separator for long numbers: 10000000 &rarr; 10,000,000 etc. [Default: ]
prettify?: (num: number) => string; // Set up your own prettify function. Can be anything. For example, you can set up unix time as slider values and than transform them to cool looking dates [Default: null]
force_edges?: boolean; // Sliders handles and tooltips will be always inside it's container [Default: false]
keyboard?: boolean; // Activates keyboard controls. Move left: &larr;, &darr;, A, S. Move right: &rarr;, &uarr;, W, D. [Default: true]
grid?: boolean; // Enables grid of values above the slider [Default: true]
grid_margin?: boolean; // Set left and right grid gaps [Default: true]
grid_num?: number; // Number of grid units [Default: 4]
grid_snap?: boolean; // Snap grid to sliders step (step param). If activated, grid_num will not be used. Max steps = 50 [Default: false]
hide_min_max?: boolean; // Hides **min** and **max** labels [Default: false]
hide_from_to?: boolean; // Hides **from** and **to** labels [Default: false]
prefix?: string; // Set prefix for values. Will be set up right before the number: **$**100 [Default: ]
postfix?: string; // Set postfix for values. Will be set up right after the number: 100**k** [Default: ]
max_postfix?: string; // Special postfix, used only for maximum value. Will be showed after handle will reach maximum right position. For example **0 — 100+** [Default: ]
decorate_both?: boolean; // Used for **double** type and only if prefix or postfix was set up. Determine how to decorate close values. For example: **$10k — $100k** or **$10 — 100k** [Default: true]
values_separator?: string; // Set your own separator for close values. Used for **double** type. Default: **10 — 100**. Or you may set: **10 to 100, 10 + 100, 10 &rarr; 100** etc. [Default: - ]
input_values_separator?: string; // Separator for **double** values in input value property. `<input value="25;42"> [Default: ; ]
disable?: boolean; // Locks slider and makes it inactive. Input is disabled too. Invisible to forms [Default: false]
block?: boolean; // Locks slider and makes it inactive. Input is NOT disabled. Can be send with forms [Default: false]
extra_classes?: string; // Traverse extra CSS-classes to sliders container [Default: —]
scope?: any; // Scope for callbacks. Pass any object [Default: null]
onStart?: (obj: IonRangeSliderEvent) => void; // Callback. Is called on slider start. Gets all slider data as a 1st attribute [Default: null]
onChange?: (obj: IonRangeSliderEvent) => void; // Callback. IS called on each values change. Gets all slider data as a 1st attribute [Default: null]
onFinish?: (obj: IonRangeSliderEvent) => void; // Callback. Is called when user releases handle. Gets all slider data as a 1st attribute [Default: null]
onUpdate?: (obj: IonRangeSliderEvent) => void; // Callback. Is called when slider is modified by external methods `update` or `reset [Default: null]
}
export interface IonRangeSliderEvent {
input: JQuery; // jQuery-link to input
slider: JQuery; // jQuery-link to sliders container
min: number; // MIN value
max: number; // MAX values
from: number; // FROM value
from_percent: number; // FROM value in percents
from_value: number; // FROM index in values array (if used)
to: number; // TO value
to_percent: number; // TO value in percents
to_value: number; // TO index in values array (if used)
min_pretty: string; // MIN prettified (if used)
max_pretty: string; // MAX prettified (if used)
from_pretty: string; // FROM prettified (if used)
to_pretty: string; // TO prettified (if used)
}
@@ -1,6 +1,5 @@
/// <reference types="jquery"/>
var sliderInputElement = $('<input />');
let sliderInputElement = $('<input />');
sliderInputElement.ionRangeSlider({
decorate_both: true,
disable: false,
@@ -18,29 +17,18 @@ sliderInputElement.ionRangeSlider({
hide_from_to: false,
hide_min_max: false,
keyboard: true,
keyboard_step: 1,
max: 100,
max_interval: 5,
max_postfix: "+",
min: 10,
min_interval: 5,
onChange: function (obj) {
console.log(obj);
},
onFinish: function (obj) {
console.log(obj);
},
onStart: function (obj) {
console.log(obj);
},
onUpdate: function (obj) {
console.log(obj);
},
onChange: obj => console.log(obj),
onFinish: obj => console.log(obj),
onStart: obj => console.log(obj),
onUpdate: obj => console.log(obj),
postfix: ".00",
prefix: "$",
prettify: function(num) {
return String(num);
},
prettify: (num: number) => (String(num)),
prettify_enabled: true,
prettify_separator: ",",
step: 10,
@@ -48,8 +36,7 @@ sliderInputElement.ionRangeSlider({
to_fixed: false,
to_max: 100,
to_min: 60,
to_shadowed: false,
type: "double",
type: "double",
values: ["a", "b", "c"],
values_separator: ","
});
+28
View File
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"ion-rangeslider-tests.ts"
],
"exclude": [
"util/**/*",
".gitignore"
]
}
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "dtslint/dt.json",
"rules": {
"max-line-length": false
}
}
@@ -1,6 +1,7 @@
// Type definitions for for Ion.RangeSlider 1.9.1
// Type definitions for ion-rangeslider 1.9
// Project: https://github.com/IonDen/ion.rangeSlider/
// Definitions by: Douglas Eichelberger <https://github.com/dduugg>
// Karel van de Plassche <https://github.com/Karel-van-de-Plassche>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -15,8 +15,8 @@
],
"types": [],
"paths": {
"ion.rangeslider": [
"ion.rangeslider/v1"
"ion-rangeslider": [
"ion-rangeslider/v1"
]
},
"noEmit": true,
@@ -24,6 +24,6 @@
},
"files": [
"index.d.ts",
"ion.rangeslider-tests.ts"
"ion-rangeslider-tests.ts"
]
}
}
-71
View File
@@ -1,71 +0,0 @@
// Type definitions for for Ion.RangeSlider 2.0.2
// Project: https://github.com/IonDen/ion.rangeSlider/
// Definitions by: Sixin Li <https://github.com/sixinli>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// API documentation: http://ionden.com/a/plugins/ion.rangeSlider/en.html
interface JQuery {
destroy(): void;
ionRangeSlider(): JQuery;
ionRangeSlider(options: IonRangeSliderOptions): JQuery;
reset(): void;
update(option: IonRangeSliderOptions): void;
}
interface IonRangeSliderOptions {
decorate_both?: boolean;
disable?: boolean;
drag_interval?: boolean;
force_edges?: boolean;
from?: number;
from_fixed?: boolean;
from_max?: number;
from_min?: number;
from_shadow?: boolean;
grid?: boolean;
grid_margin?: boolean;
grid_num?: number;
grid_snap?: boolean;
hide_from_to?: boolean;
hide_min_max?: boolean;
keyboard?: boolean;
keyboard_step?: number;
max?: number;
max_interval?: number;
max_postfix?: string;
min?: number;
min_interval?: number;
onChange?: (obj: IonRangeSliderEvent) => void;
onFinish?: (obj: IonRangeSliderEvent) => void;
onStart?: (obj: IonRangeSliderEvent) => void;
onUpdate?: (obj: IonRangeSliderEvent) => void;
postfix?: string;
prefix?: string;
prettify?: (num: number) => string;
prettify_enabled?: boolean;
prettify_separator?: string;
step?: number;
to?: number;
to_fixed?: boolean;
to_max?: number;
to_min?: number;
to_shadowed?: boolean;
type?: string;
values?: any[];
values_separator?: string;
}
interface IonRangeSliderEvent {
from: number;
from_precent: number;
from_value: any;
input: JQuery;
max: number;
min: number;
slider: JQuery;
to: number;
to_precent: number;
to_value: any;
}
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/istanbuljs/istanbuljs
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
// TypeScript Version: 2.8
import { FileCoverage, FileCoverageData, Range } from 'istanbul-lib-coverage';
import { RawSourceMap } from 'source-map';
+237 -7
View File
@@ -1,4 +1,4 @@
// Type definitions for Jest 23.0
// Type definitions for Jest 23.1
// Project: http://facebook.github.io/jest/
// Definitions by: Asana <https://asana.com>
// Ivo Stratev <https://github.com/NoHomey>
@@ -10,10 +10,11 @@
// Waseem Dahman <https://github.com/wsmd>
// Jamie Mason <https://github.com/JamieMason>
// Douglas Duteil <https://github.com/douglasduteil>
// Ahn <https://github.com/AhnpGit>
// Ahn <https://github.com/ahnpnl>
// Josh Goldberg <https://github.com/joshuakgoldberg>
// Bradley Ayers <https://github.com/bradleyayers>
// Jeff Lau <https://github.com/UselessPickles>
// Andrew Makarov <https://github.com/r3nya>
// Martin Hochel <https://github.com/hotell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -358,10 +359,22 @@ declare namespace jest {
}
interface Matchers<R> {
/**
* Ensures the last call to a mock function was provided specific args.
*/
lastCalledWith(...args: any[]): R;
/**
* Ensure that the last call to a mock function has returned a specified value.
*/
lastReturnedWith(value: any): R;
/**
* If you know how to test something, `.not` lets you test its opposite.
*/
not: Matchers<R>;
/**
* Ensure that the nth call to a mock function has returned a specified value.
*/
nthReturnedWith(n: number, value: any): R;
/**
* Use resolves to unwrap the value of a fulfilled promise so any other
* matcher can be chained. If the promise is rejected the assertion fails.
@@ -372,7 +385,6 @@ declare namespace jest {
* If the promise is fulfilled the assertion fails.
*/
rejects: Matchers<Promise<R>>;
lastCalledWith(...args: any[]): R;
/**
* Checks that a value is what you expect. It uses `===` to check strict equality.
* Don't use `toBe` with floating-point numbers.
@@ -469,22 +481,46 @@ declare namespace jest {
* Ensure that a mock function is called with specific arguments.
*/
toHaveBeenCalledWith(...params: any[]): R;
/**
* Ensure that a mock function is called with specific arguments on an Nth call.
*/
toHaveBeenNthCalledWith(nthCall: number, ...params: any[]): R;
/**
* If you have a mock function, you can use `.toHaveBeenLastCalledWith`
* to test what arguments it was last called with.
*/
toHaveBeenLastCalledWith(...params: any[]): R;
/**
* If you have a mock function, you can use `.toHaveBeenNthCalledWith`
* to test what arguments it was nth called with.
* Use to test the specific value that a mock function last returned.
* If the last call to the mock function threw an error, then this matcher will fail
* no matter what value you provided as the expected return value.
*/
toHaveBeenNthCalledWith(nthCall: number, ...params: any[]): R;
toHaveLastReturnedWith(expected: any): R;
/**
* Used to check that an object has a `.length` property
* and it is set to a certain numeric value.
*/
toHaveLength(expected: number): R;
/**
* Use to test the specific value that a mock function returned for the nth call.
* If the nth call to the mock function threw an error, then this matcher will fail
* no matter what value you provided as the expected return value.
*/
toHaveNthReturnedWith(nthCall: number, expected: any): R;
toHaveProperty(propertyPath: string | any[], value?: any): R;
/**
* Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time
*/
toHaveReturned(): R;
/**
* Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times.
* Any calls to the mock function that throw an error are not counted toward the number of times the function returned.
*/
toHaveReturnedTimes(expected: number): R;
/**
* Use to ensure that a mock function returned a specific value.
*/
toHaveReturnedWith(expected: any): R;
/**
* Check that a string matches a regular expression.
*/
@@ -498,6 +534,22 @@ declare namespace jest {
* Check out [the Snapshot Testing guide](http://facebook.github.io/jest/docs/snapshot-testing.html) for more information.
*/
toMatchSnapshot(snapshotName?: string): R;
/**
* Ensure that a mock function has returned (as opposed to thrown) at least once.
*/
toReturn(): R;
/**
* Ensure that a mock function has returned (as opposed to thrown) a specified number of times.
*/
toReturnTimes(count: number): R;
/**
* Ensure that a mock function has returned a specified value at least once.
*/
toReturnWith(value: any): R;
/**
* Use to test that objects have the same types as well as structure.
*/
toStrictEqual(expected: {}): R;
/**
* Used to test that a function throws when it is called.
*/
@@ -556,9 +608,29 @@ declare namespace jest {
mockRejectedValueOnce(value: any): Mock<T>;
}
/**
* Represents the result of a single call to a mock function.
*/
interface MockResult {
/**
* True if the function threw.
* False if the function returned.
*/
isThrow: boolean;
/**
* The value that was either thrown or returned by the function.
*/
value: any;
}
interface MockContext<T> {
calls: any[][];
instances: T[];
invocationCallOrder: number[];
/**
* List of results of calls to the mock function.
*/
results: MockResult[];
}
}
@@ -801,6 +873,164 @@ declare namespace jest {
type SnapshotUpdateState = 'all' | 'new' | 'none';
interface DefaultOptions {
automock: boolean;
bail: boolean;
browser: boolean;
cache: boolean;
cacheDirectory: Path;
changedFilesWithAncestor: boolean;
clearMocks: boolean;
collectCoverage: boolean;
collectCoverageFrom: Maybe<string[]>;
coverageDirectory: Maybe<string>;
coveragePathIgnorePatterns: string[];
coverageReporters: string[];
coverageThreshold: Maybe<{global: {[key: string]: number}}>;
errorOnDeprecated: boolean;
expand: boolean;
filter: Maybe<Path>;
forceCoverageMatch: Glob[];
globals: ConfigGlobals;
globalSetup: Maybe<string>;
globalTeardown: Maybe<string>;
haste: HasteConfig;
detectLeaks: boolean;
detectOpenHandles: boolean;
moduleDirectories: string[];
moduleFileExtensions: string[];
moduleNameMapper: {[key: string]: string};
modulePathIgnorePatterns: string[];
noStackTrace: boolean;
notify: boolean;
notifyMode: string;
preset: Maybe<string>;
projects: Maybe<Array<string | ProjectConfig>>;
resetMocks: boolean;
resetModules: boolean;
resolver: Maybe<Path>;
restoreMocks: boolean;
rootDir: Maybe<Path>;
roots: Maybe<Path[]>;
runner: string;
runTestsByPath: boolean;
setupFiles: Path[];
setupTestFrameworkScriptFile: Maybe<Path>;
skipFilter: boolean;
snapshotSerializers: Path[];
testEnvironment: string;
testEnvironmentOptions: object;
testFailureExitCode: string | number;
testLocationInResults: boolean;
testMatch: Glob[];
testPathIgnorePatterns: string[];
testRegex: string;
testResultsProcessor: Maybe<string>;
testRunner: Maybe<string>;
testURL: string;
timers: 'real' | 'fake';
transform: Maybe<{[key: string]: string}>;
transformIgnorePatterns: Glob[];
watchPathIgnorePatterns: string[];
useStderr: boolean;
verbose: Maybe<boolean>;
watch: boolean;
watchman: boolean;
}
interface InitialOptions {
automock?: boolean;
bail?: boolean;
browser?: boolean;
cache?: boolean;
cacheDirectory?: Path;
clearMocks?: boolean;
changedFilesWithAncestor?: boolean;
changedSince?: string;
collectCoverage?: boolean;
collectCoverageFrom?: Glob[];
collectCoverageOnlyFrom?: {[key: string]: boolean};
coverageDirectory?: string;
coveragePathIgnorePatterns?: string[];
coverageReporters?: string[];
coverageThreshold?: {global: {[key: string]: number}};
detectLeaks?: boolean;
detectOpenHandles?: boolean;
displayName?: string;
expand?: boolean;
filter?: Path;
findRelatedTests?: boolean;
forceCoverageMatch?: Glob[];
forceExit?: boolean;
json?: boolean;
globals?: ConfigGlobals;
globalSetup?: Maybe<string>;
globalTeardown?: Maybe<string>;
haste?: HasteConfig;
reporters?: Array<ReporterConfig | string>;
logHeapUsage?: boolean;
lastCommit?: boolean;
listTests?: boolean;
mapCoverage?: boolean;
moduleDirectories?: string[];
moduleFileExtensions?: string[];
moduleLoader?: Path;
moduleNameMapper?: {[key: string]: string};
modulePathIgnorePatterns?: string[];
modulePaths?: string[];
name?: string;
noStackTrace?: boolean;
notify?: boolean;
notifyMode?: string;
onlyChanged?: boolean;
outputFile?: Path;
passWithNoTests?: boolean;
preprocessorIgnorePatterns?: Glob[];
preset?: Maybe<string>;
projects?: Glob[];
replname?: Maybe<string>;
resetMocks?: boolean;
resetModules?: boolean;
resolver?: Maybe<Path>;
restoreMocks?: boolean;
rootDir?: Path;
roots?: Path[];
runner?: string;
runTestsByPath?: boolean;
scriptPreprocessor?: string;
setupFiles?: Path[];
setupTestFrameworkScriptFile?: Path;
silent?: boolean;
skipFilter?: boolean;
skipNodeResolution?: boolean;
snapshotSerializers?: Path[];
errorOnDeprecated?: boolean;
testEnvironment?: string;
testEnvironmentOptions?: object;
testFailureExitCode?: string | number;
testLocationInResults?: boolean;
testMatch?: Glob[];
testNamePattern?: string;
testPathDirs?: Path[];
testPathIgnorePatterns?: string[];
testRegex?: string;
testResultsProcessor?: Maybe<string>;
testRunner?: string;
testURL?: string;
timers?: 'real' | 'fake';
transform?: {[key: string]: string};
transformIgnorePatterns?: Glob[];
watchPathIgnorePatterns?: string[];
unmockedModulePathPatterns?: string[];
updateSnapshot?: boolean;
useStderr?: boolean;
verbose?: Maybe<boolean>;
watch?: boolean;
watchAll?: boolean;
watchman?: boolean;
watchPlugins?: string[];
}
interface GlobalConfig {
bail: boolean;
collectCoverage: boolean;
+45
View File
@@ -213,6 +213,9 @@ describe('Assymetric matchers', () => {
greeting: expect.stringContaining('hello'),
});
expect("foo").toStrictEqual("foo");
expect({ a: "foo" }).toStrictEqual({ a: "foo" });
const callback = jest.fn();
expect(callback).toEqual(expect.any(Function));
callback(5, "test");
@@ -254,6 +257,26 @@ describe('setTimeout', () => {
});
});
describe("spy call matchers", () => {
const spy = jest.fn();
expect(spy).lastReturnedWith("foo");
expect(spy).nthReturnedWith(3, "foo");
expect(spy).toHaveBeenCalled();
expect(spy).toHaveBeenCalledTimes(7);
expect(spy).toHaveBeenCalledWith("foo");
expect(spy).toHaveBeenLastCalledWith("foo");
expect(spy).toHaveBeenNthCalledWith(3, "foo");
expect(spy).toHaveReturned();
expect(spy).toHaveReturnedTimes(7);
expect(spy).toHaveReturnedWith("foo");
expect(spy).toHaveLastReturnedWith("foo");
expect(spy).toHaveNthReturnedWith(3, "foo");
expect(spy).toReturn();
expect(spy).toReturnTimes(3);
expect(spy).toReturnWith("foo");
});
describe('Extending extend', () => {
it('works', () => {
expect.extend({
@@ -737,3 +760,25 @@ describe('toHaveBeenNthCalledWith', () => {
expect(fn).toHaveBeenNthCalledWith(3, "foo");
});
// Jest config
{
interface JestConfigModule {defaults: jest.DefaultOptions; }
// tslint:disable-next-line:no-var-requires
const {defaults} = require('jest-config') as JestConfigModule;
const config: jest.InitialOptions = {
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest'
},
testMatch: [
...defaults.testMatch,
'**/__tests__/**/*.ts?(x)',
'**/?(*.)+(spec|test).ts?(x)'
],
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'],
globals: {
'ts-jest': {}
}
};
}
+26 -2
View File
@@ -1,11 +1,28 @@
// Type definitions for jQuery Mockjax 2.0.1
// Type definitions for jQuery Mockjax 2.3.0
// Project: https://github.com/jakerella/jquery-mockjax
// Definitions by: Laszlo Jakab <https://github.com/laszlojakab>, Vladimir Đokić <https://github.com/vladeck>
// Definitions by:
// Laszlo Jakab <https://github.com/laszlojakab>,
// Vladimir Đokić <https://github.com/vladeck>,
// James Johnson <https://github.com/hasaki>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="jquery" />
type MockJaxLoggingFunction = (message?: any, ...additionalParameters: any[]) => void;
interface MockJaxStandardLogger {
error?: MockJaxLoggingFunction;
warn?: MockJaxLoggingFunction;
info?: MockJaxLoggingFunction;
log?: MockJaxLoggingFunction;
debug?: MockJaxLoggingFunction;
}
interface MockJaxCustomLogger {
[key: string]: MockJaxLoggingFunction;
}
interface MockJaxSettingsHeaders {
[key: string]: string;
}
@@ -33,15 +50,22 @@ interface MockJaxSettings {
onAfterSuccess?: Function;
onAfterError?: Function;
onAfterComplete?: Function;
logger?: MockJaxStandardLogger | MockJaxCustomLogger;
logLevelMethods?: string[];
namespace?: string;
throwUnmocked?: boolean;
retainAjaxCalls?: boolean;
}
interface MockJaxStatic {
(options: MockJaxSettings): number;
(options: MockJaxSettings[]): number[];
handler(id?: number): any;
clear(id?: number): void;
mockedAjaxCalls(): any[];
unfiredHandlers(): any[];
unmockedAjaxCalls(): any[];
clearRetainedAjaxCalls(): void;
}
interface JQueryStatic {
@@ -192,6 +192,81 @@ class Tests {
}
});
});
t('Standard logger type gets called', (assert) => {
let done = assert.async();
let wasLoggerCalled = false;
let logFunction = () => wasLoggerCalled = true;
let settings: MockJaxSettings = {
url: '/custom-logging-function',
logging: true,
logger: {
error: logFunction,
warn: logFunction,
info: logFunction,
log: logFunction,
debug: logFunction
}
};
$.mockjax(settings);
$.ajax({
url: '/custom-logging-function',
error: self._noErrorCallbackExpected,
complete: (xhr) => {
assert.equal(wasLoggerCalled, true, 'Standard logger was called');
done();
}
});
});
t('Custom logger object gets called', (assert) => {
let done = assert.async();
let wasLoggerCalled = false;
let logFunction = () => wasLoggerCalled = true;
let settings: MockJaxSettings = {
url: '/custom-logging-function',
logging: true,
logger: {
customName: logFunction
},
logLevelMethods: ['customName', 'customName', 'customName', 'customName', 'customName']
};
$.mockjax(settings);
$.ajax({
url: '/custom-logging-function',
error: self._noErrorCallbackExpected,
complete: (xhr) => {
assert.equal(wasLoggerCalled, true, 'Custom logger was called');
done();
}
});
});
t('Throws when ajax call is not mocked', (assert) => {
let done = assert.async();
$.mockjaxSettings.throwUnmocked = true;
$.ajax({
url: '/unmocked-ajax-call',
error: (error) => {
assert.ok(error, 'Expected the call to fail because it was not mocked');
done();
},
complete: (xhr) => {
assert.ok(false, 'Expected a failure');
done();
}
});
});
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for karma-chai 0.1
// Project: http://xdissent.github.io/karma-chai
// Definitions by: Jay Sherby <https://github.com/JayAndCatchFire>
// Definitions by: JayAndCatchFire <https://github.com/JayAndCatchFire>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import chai = require('chai');
+1
View File
@@ -208,6 +208,7 @@ declare module 'luxon' {
toLocaleParts(options?: DateTimeFormatOptions): any[];
toLocaleString(options?: DateTimeFormatOptions): string;
toObject(options?: { includeConfig?: boolean }): DateObject;
toMillis(): number;
toRFC2822(): string;
toSQL(options?: Object): string;
toSQLDate(): string;
+2
View File
@@ -54,6 +54,8 @@ DateTime.utc();
DateTime.local().toUTC();
DateTime.utc().toLocal();
DateTime.fromMillis(1527780819458).toMillis();
/* Duration */
const dur = Duration.fromObject({ hours: 2, minutes: 7 });
dt.plus(dur);
+9 -1
View File
@@ -36,6 +36,7 @@ declare namespace math { // tslint:disable-line strict-export-declare-modifiers
version: string;
expression: MathNode;
json: MathJsJson;
config: (options: any) => void;
@@ -543,7 +544,7 @@ declare namespace math { // tslint:disable-line strict-export-declare-modifiers
/**
* Create a number or convert a string, boolean, or unit to a number. When value is a matrix, all elements will be converted to number.
*/
number(value?: string|number|boolean|MathArray|Matrix|Unit|BigNumber): number|MathArray|Matrix;
number(value?: string|number|boolean|MathArray|Matrix|Unit|BigNumber|Fraction): number|MathArray|Matrix;
number(unit: Unit, valuelessUnit: Unit|string): number|MathArray|Matrix;
/**
@@ -2249,4 +2250,11 @@ declare namespace math { // tslint:disable-line strict-export-declare-modifiers
valueOf(): any;
toString(): string;
}
interface MathJsJson {
/**
* Returns reviver function that can be used as reviver in JSON.parse function.
*/
reviver(): (key: any, value: any) => any;
}
}
+12
View File
@@ -365,3 +365,15 @@ Expression tree examples
}
});
}
/*
JSON serialization/deserialization
*/
{
const data = {
bigNumber: math.bignumber('1.5')
};
const stringified = JSON.stringify(data);
const parsed = JSON.parse(stringified, math.json.reviver);
parsed.bigNumber === math.bignumber('1.5'); // true
}
+5
View File
@@ -781,3 +781,8 @@ DDPRateLimiter.addRule({ userId: 'foo' }, 5, 1000);
DDPRateLimiter.addRule({ userId: userId => userId == 'foo' }, 5, 1000);
Template.instance().autorun(() => { }).stop();
// Mongo Collection without connection (local collection)
const collectionWithoutConnection = new Mongo.Collection<MonkeyDAO>("monkey", {
connection: null
});
+2 -2
View File
@@ -124,7 +124,7 @@ declare module Mongo {
var Collection: CollectionStatic;
interface CollectionStatic {
new <T>(name: string, options?: {
connection?: Object;
connection?: Object | null;
idGeneration?: string;
transform?: Function;
}): Collection<T>;
@@ -348,7 +348,7 @@ declare module "meteor/mongo" {
var Collection: CollectionStatic;
interface CollectionStatic {
new <T>(name: string, options?: {
connection?: Object;
connection?: Object | null;
idGeneration?: string;
transform?: Function;
}): Collection<T>;
-2
View File
@@ -1,2 +0,0 @@
mocha-node.d.ts
mocha-node-tests.ts
+2750 -416
View File
File diff suppressed because it is too large Load Diff
+109
View File
@@ -0,0 +1,109 @@
import Mocha = require("../../");
export = common;
declare function common(suites: Mocha.Suite[], context: Mocha.MochaGlobals, mocha: Mocha): common.CommonFunctions;
declare namespace common {
interface CommonFunctions {
/**
* This is only present if flag --delay is passed into Mocha. It triggers
* root suite execution.
*/
runWithSuite(suite: Mocha.Suite): () => void;
/**
* Execute before running tests.
*/
before(fn?: Mocha.Func | Mocha.AsyncFunc): void;
/**
* Execute before running tests.
*/
before(name: string, fn?: Mocha.Func | Mocha.AsyncFunc): void;
/**
* Execute after running tests.
*/
after(fn?: Mocha.Func | Mocha.AsyncFunc): void;
/**
* Execute after running tests.
*/
after(name: string, fn?: Mocha.Func | Mocha.AsyncFunc): void;
/**
* Execute before each test case.
*/
beforeEach(fn?: Mocha.Func | Mocha.AsyncFunc): void;
/**
* Execute before each test case.
*/
beforeEach(name: string, fn?: Mocha.Func | Mocha.AsyncFunc): void;
/**
* Execute after each test case.
*/
afterEach(fn?: Mocha.Func | Mocha.AsyncFunc): void;
/**
* Execute after each test case.
*/
afterEach(name: string, fn?: Mocha.Func | Mocha.AsyncFunc): void;
suite: SuiteFunctions;
test: TestFunctions;
}
interface CreateOptions {
/** Title of suite */
title: string;
/** Suite function */
fn?: (this: Mocha.Suite) => void;
/** Is suite pending? */
pending?: boolean;
/** Filepath where this Suite resides */
file?: string;
/** Is suite exclusive? */
isOnly?: boolean;
}
interface SuiteFunctions {
/**
* Create an exclusive Suite; convenience function
*/
only(opts: CreateOptions): Mocha.Suite;
/**
* Create a Suite, but skip it; convenience function
*/
skip(opts: CreateOptions): Mocha.Suite;
/**
* Creates a suite.
*/
create(opts: CreateOptions): Mocha.Suite;
}
interface TestFunctions {
/**
* Exclusive test-case.
*/
only(mocha: Mocha, test: Mocha.Test): Mocha.Test;
/**
* Pending test case.
*/
skip(title: string): void;
/**
* Number of retry attempts
*/
retries(n: number): void;
}
}
+17
View File
@@ -0,0 +1,17 @@
export = milliseconds;
/**
* Parse the given `str` and return milliseconds.
*
* @see {@link https://mochajs.org/api/module-milliseconds.html}
* @see {@link https://mochajs.org/api/module-milliseconds.html#~parse}
*/
declare function milliseconds(val: string): number;
/**
* Format for `ms`.
*
* @see {@link https://mochajs.org/api/module-milliseconds.html}
* @see {@link https://mochajs.org/api/module-milliseconds.html#~format}
*/
declare function milliseconds(val: number): string;
-37
View File
@@ -1,37 +0,0 @@
import MochaDef = require('mocha');
class CustomSpecReporter extends MochaDef.reporters.Spec {
constructor(runner: Mocha.IRunner) {
super(runner);
runner.on('test', (test: Mocha.ITest) => {
console.log(test.parent.title + '/' + test.title);
});
}
}
class MyReporter extends MochaDef.reporters.Base {
passes: number = 0;
failures: number = 0;
constructor(runner: Mocha.IRunner) {
super(runner);
runner.on('pass', (test: Mocha.ITest) => {
this.passes++;
console.log('pass: %s', test.fullTitle());
});
runner.on('fail', (test: Mocha.ITest, err: Error) => {
this.failures++;
console.log('fail: %s -- error: %s', test.fullTitle(), err.message);
});
runner.on('end', () => {
console.log('end: %d/%d', this.passes, this.passes + this.failures);
process.exit(this.failures);
});
}
}
-16
View File
@@ -1,16 +0,0 @@
// Type definitions for mocha 2.2.5
// Project: http://mochajs.org/
// Definitions by: Vadim Macagon <https://github.com/enlight>, vvakame <https://github.com/vvakame>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare namespace Mocha {
interface IRunnable extends NodeJS.EventEmitter {
}
interface ISuite extends NodeJS.EventEmitter {
}
interface IRunner extends NodeJS.EventEmitter {
}
}
+1035 -405
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -19,6 +19,8 @@
},
"files": [
"index.d.ts",
"lib/ms.d.ts",
"lib/interfaces/common.d.ts",
"mocha-tests.ts"
]
}
+7 -7
View File
@@ -103,7 +103,10 @@ declare module "mongoose" {
export function createConnection(): Connection;
export function createConnection(uri: string,
options?: ConnectionOptions
): Connection;
): Connection & {
then: Promise<Connection>["then"];
catch: Promise<Connection>["catch"];
};
/**
* Disconnects all connections.
@@ -201,7 +204,7 @@ declare module "mongoose" {
*/
open(connection_string: string, database?: string, port?: number,
options?: ConnectionOpenOptions, callback?: (err: any) => void): any;
/**
* Opens the connection to MongoDB.
* @param mongodb://uri or the host to which you are connecting
@@ -451,9 +454,6 @@ declare module "mongoose" {
/** Expose the possible connection states. */
static STATES: any;
then: Promise<Connection>["then"];
catch: Promise<Connection>["catch"];
}
/*
@@ -2727,9 +2727,9 @@ declare module "mongoose" {
* This function does not trigger save middleware.
* @param docs Documents to insert.
* @param options Optional settings.
* @param options.ordered if true, will fail fast on the first error encountered.
* @param options.ordered if true, will fail fast on the first error encountered.
* If false, will insert all the documents it can and report errors later.
* @param options.rawResult if false, the returned promise resolves to the documents that passed mongoose document validation.
* @param options.rawResult if false, the returned promise resolves to the documents that passed mongoose document validation.
* If `false`, will return the [raw result from the MongoDB driver](http://mongodb.github.io/node-mongodb-native/2.2/api/Collection.html#~insertWriteOpCallback)
* with a `mongoose` property that contains `validationErrors` if this is an unordered `insertMany`.
*/
+7
View File
@@ -161,6 +161,13 @@ mongoose.Connection.STATES.hasOwnProperty('');
conn1.on('data', cb);
conn1.addListener('close', cb);
// The connection returned by useDb is *not* thenable.
// From https://github.com/DefinitelyTyped/DefinitelyTyped/pull/26057#issuecomment-396150819
const getDB = async (tenant: string)=> {
return conn1.useDb(tenant);
};
/*
* section error/validation.js
* http://mongoosejs.com/docs/api.html#error-validation-js
+2
View File
@@ -71,6 +71,8 @@ declare namespace multer {
fields(fields: Field[]): express.RequestHandler;
/** Accepts all files that comes over the wire. An array of files will be stored in req.files. */
any(): express.RequestHandler;
/** Accept only text fields. If any file upload is made, error with code “LIMIT_UNEXPECTED_FILE” will be issued. This is the same as doing upload.fields([]). */
none(): express.RequestHandler;
}
}
+18
View File
@@ -0,0 +1,18 @@
import * as React from "react";
import { NextContext } from ".";
import { SingletonRouter } from "./router";
export interface AppComponentProps {
Component: React.ComponentType<any>;
pageProps: any;
}
export interface AppComponentContext {
Component: React.ComponentType<any>;
router: SingletonRouter;
ctx: NextContext;
}
export class Container extends React.Component {}
export default class App<TProps = {}> extends React.Component<TProps & AppComponentProps> {}
+14 -27
View File
@@ -1,30 +1,5 @@
import * as React from "react";
import * as http from "http";
export interface Context {
err?: Error;
req: http.IncomingMessage;
res: http.ServerResponse;
pathname: string;
query?: {
[key: string]:
| boolean
| boolean[]
| number
| number[]
| string
| string[];
};
asPath: string;
renderPage(
enhancer?: (page: React.Component) => React.ComponentType<any>
): {
html?: string;
head: Array<React.ReactElement<any>>;
errorHtml: string;
};
}
import { NextContext } from ".";
export interface DocumentProps {
__NEXT_DATA__?: any;
@@ -38,9 +13,21 @@ export interface DocumentProps {
[key: string]: any;
}
/**
* Context object used inside `Document`
*/
export interface NextDocumentContext extends NextContext {
/** A callback that executes the actual React rendering logic (synchronously) */
renderPage(
cb?: (enhancer: () => JSX.Element) => React.ComponentType<any>
): {
[key: string]: any
};
}
export class Head extends React.Component<any> {}
export class Main extends React.Component {}
export class NextScript extends React.Component {}
export default class extends React.Component<DocumentProps> {
static getInitialProps(ctx: Context): DocumentProps;
static getInitialProps(ctx: NextContext): DocumentProps;
}
+51 -12
View File
@@ -1,7 +1,9 @@
// Type definitions for next 2.4
// Type definitions for next 6.0
// Project: https://github.com/zeit/next.js
// Definitions by: Drew Hays <https://github.com/dru89>
// Brice BERNARD <https://github.com/brikou>
// James Hegedus <https://github.com/jthegedus>
// Resi Respati <https://github.com/resir014>
// Scott Jones <https://github.com/scottdj92>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -11,7 +13,44 @@
import * as http from "http";
import * as url from "url";
import { Response as NodeResponse } from "node-fetch";
declare namespace next {
/**
* Context object used in methods like `getInitialProps()`
* <<https://github.com/zeit/next.js/issues/1651>>
*/
interface NextContext {
/** path section of URL */
pathname: string;
/** query string section of URL parsed as an object */
query: {
[key: string]:
| boolean
| boolean[]
| number
| number[]
| string
| string[];
};
/** String of the actual path (including the query) shows in the browser */
asPath: string;
/** HTTP request object (server only) */
req?: http.IncomingMessage;
/** HTTP response object (server only) */
res?: http.ServerResponse;
/** Fetch Response object (client only) - from https://developer.mozilla.org/en-US/docs/Web/API/Response */
jsonPageRes?: NodeResponse;
/** Error object if any error is encountered during the rendering */
err?: Error;
}
type NextSFC<TProps = {}> = NextStatelessComponent<TProps>;
interface NextStatelessComponent<TProps = {}>
extends React.StatelessComponent<TProps> {
getInitialProps?: (ctx: NextContext) => Promise<TProps>;
}
type UrlLike = url.UrlObject | url.Url;
interface ServerConfig {
@@ -41,12 +80,12 @@ declare namespace next {
handleRequest(
req: http.IncomingMessage,
res: http.ServerResponse,
parsedUrl?: UrlLike,
parsedUrl?: UrlLike
): Promise<void>;
getRequestHandler(): (
req: http.IncomingMessage,
res: http.ServerResponse,
parsedUrl?: UrlLike,
parsedUrl?: UrlLike
) => Promise<void>;
prepare(): Promise<void>;
close(): Promise<void>;
@@ -55,7 +94,7 @@ declare namespace next {
run(
req: http.IncomingMessage,
res: http.ServerResponse,
parsedUrl: UrlLike,
parsedUrl: UrlLike
): Promise<void>;
render(
@@ -71,7 +110,7 @@ declare namespace next {
| string
| string[];
},
parsedUrl?: UrlLike,
parsedUrl?: UrlLike
): Promise<void>;
renderError(
err: any,
@@ -86,12 +125,12 @@ declare namespace next {
| number[]
| string
| string[];
},
}
): Promise<void>;
render404(
req: http.IncomingMessage,
res: http.ServerResponse,
parsedUrl: UrlLike,
parsedUrl: UrlLike
): Promise<void>;
renderToHTML(
req: http.IncomingMessage,
@@ -105,7 +144,7 @@ declare namespace next {
| number[]
| string
| string[];
},
}
): Promise<string>;
renderErrorToHTML(
err: any,
@@ -120,13 +159,13 @@ declare namespace next {
| number[]
| string
| string[];
},
}
): Promise<string>;
serveStatic(
req: http.IncomingMessage,
res: http.ServerResponse,
path: string,
path: string
): Promise<void>;
isServeableUrl(path: string): boolean;
isInternalUrl(req: http.IncomingMessage): boolean;
@@ -135,12 +174,12 @@ declare namespace next {
getCompilationError(
page: string,
req: http.IncomingMessage,
res: http.ServerResponse,
res: http.ServerResponse
): Promise<any>;
handleBuildHash(
filename: string,
hash: string,
res: http.ServerResponse,
res: http.ServerResponse
): void;
send404(res: http.ServerResponse): void;
}
+27
View File
@@ -0,0 +1,27 @@
import * as React from "react";
import App, { Container } from "next/app";
interface NextComponentProps {
example: string;
}
class TestApp extends App<NextComponentProps> {
static async getInitialProps({ Component, router, ctx }: any) {
let pageProps = {};
if (Component.getInitialProps) {
pageProps = await Component.getInitialProps(ctx);
}
return { pageProps };
}
render() {
const { Component, pageProps } = this.props;
return (
<Container>
<Component {...pageProps} />
</Container>
);
}
}
+28
View File
@@ -0,0 +1,28 @@
import * as React from "react";
import { NextStatelessComponent, NextContext } from "next";
interface NextComponentProps {
example: string;
}
class ClassNext extends React.Component<NextComponentProps> {
static async getInitialProps(ctx: NextContext) {
const { example } = ctx.query;
return { example };
}
render() {
return (
<div>I'm a class component! {this.props.example}</div>
);
}
}
const StatelessNext: NextStatelessComponent<NextComponentProps> = ({ example }) => (
<div>I'm a stateless component! {example}</div>
);
StatelessNext.getInitialProps = async ({ query }: NextContext) => {
const { example } = query;
return { example: example as string };
};
+33 -5
View File
@@ -1,12 +1,40 @@
import Document, * as document from "next/document";
import Document, { Head, Main, NextScript, NextDocumentContext } from 'next/document';
import * as React from "react";
const results = (
<Document any="property" should="work" here>
<document.Head some="more" properties>
<Head some="more" properties>
<meta name="description" content="Head can have children, too!" />
</document.Head>
<document.Main />
<document.NextScript />
</Head>
<Main />
<NextScript />
</Document>
);
const Wrapper: React.SFC = ({ children }) => <React.Fragment>{children}</React.Fragment>;
export default class MyDocument extends Document {
static async getInitialProps({ renderPage }: NextDocumentContext) {
// Without callback
const page = renderPage();
// With callback
const differentPage = renderPage(App => props => <Wrapper><App {...props} /></Wrapper>);
const style = {};
return { ...page, style };
}
render() {
return (
<html>
<Head>
<title>My page</title>
<style id='cxs-style' dangerouslySetInnerHTML={{ __html: this.props.style }} />
</Head>
<body>
<Main />
<NextScript />
</body>
</html>
);
}
}
+4 -1
View File
@@ -20,6 +20,7 @@
},
"files": [
"index.d.ts",
"app.d.ts",
"document.d.ts",
"dynamic.d.ts",
"error.d.ts",
@@ -28,11 +29,13 @@
"router.d.ts",
"config.d.ts",
"test/next-tests.ts",
"test/next-app-tests.tsx",
"test/next-error-tests.tsx",
"test/next-head-tests.tsx",
"test/next-document-tests.tsx",
"test/next-link-tests.tsx",
"test/next-dynamic-tests.tsx",
"test/next-router-tests.tsx"
"test/next-router-tests.tsx",
"test/next-component-tests.tsx"
]
}
+33 -23
View File
@@ -24,6 +24,7 @@
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Alexander T. <https://github.com/a-tarasyuk>
// Lishude <https://github.com/islishude>
// Andrew Makarov <https://github.com/r3nya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** inspector module types */
@@ -2540,6 +2541,12 @@ declare module "dns" {
export function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>;
}
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export namespace lookupService {
export function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
}
export interface ResolveOptions {
ttl: boolean;
}
@@ -6849,12 +6856,15 @@ declare module "http2" {
import { IncomingHttpHeaders as Http1IncomingHttpHeaders, OutgoingHttpHeaders } from "http";
export { OutgoingHttpHeaders } from "http";
export interface IncomingHttpStatusHeader {
":status"?: number;
}
export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders {
':path'?: string;
':method'?: string;
':status'?: string;
':authority'?: string;
':scheme'?: string;
":path"?: string;
":method"?: string;
":authority"?: string;
":scheme"?: string;
}
// Http2Stream
@@ -7001,34 +7011,34 @@ declare module "http2" {
export interface ClientHttp2Stream extends Http2Stream {
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "headers", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
addListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
addListener(event: "response", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
addListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "headers", headers: IncomingHttpHeaders, flags: number): boolean;
emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean;
emit(event: "response", headers: IncomingHttpHeaders, flags: number): boolean;
emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "headers", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
on(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
on(event: "response", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
on(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "headers", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
once(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
once(event: "response", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
once(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "headers", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependListener(event: "response", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "headers", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependOnceListener(event: "headers", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependOnceListener(event: "response", listener: (headers: IncomingHttpHeaders, flags: number) => void): this;
prependOnceListener(event: "response", listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
}
export interface ServerHttp2Stream extends Http2Stream {
@@ -7156,32 +7166,32 @@ declare module "http2" {
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
addListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
addListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
addListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
emit(event: "altsvc", alt: string, origin: string, stream: number): boolean;
emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean;
emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean;
emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
on(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
on(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
once(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
once(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
once(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
prependListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
prependListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
prependListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this;
prependOnceListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this;
prependOnceListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this;
prependOnceListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void): this;
}
export interface AlternativeServiceOptions {
+9 -1
View File
@@ -3114,6 +3114,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});
@@ -3561,7 +3567,9 @@ namespace http2_tests {
let clientHttp2Stream: http2.ClientHttp2Stream;
clientHttp2Stream.on('headers', (headers: http2.IncomingHttpHeaders, flags: number) => {});
clientHttp2Stream.on('push', (headers: http2.IncomingHttpHeaders, flags: number) => {});
clientHttp2Stream.on('response', (headers: http2.IncomingHttpHeaders, flags: number) => {});
clientHttp2Stream.on('response', (headers: http2.IncomingHttpHeaders & http2.IncomingHttpStatusHeader, flags: number) => {
const s: number = headers[':status'];
});
// ServerHttp2Stream
let serverHttp2Stream: http2.ServerHttp2Stream;
+8 -1
View File
@@ -3,6 +3,7 @@
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>
// DefinitelyTyped <https://github.com/DefinitelyTyped/DefinitelyTyped>
// Sebastian Silbermann <https://github.com/eps1lon>
// Sander Koenders <https://github.com/Archcry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/************************************************
@@ -407,6 +408,10 @@ declare namespace NodeJS {
isTTY?: true;
}
export interface ProcessEnv {
[key: string]: string | undefined;
}
export interface Process extends EventEmitter {
stdout: Socket;
stderr: Socket;
@@ -418,7 +423,7 @@ declare namespace NodeJS {
chdir(directory: string): void;
cwd(): string;
debugPort: number;
env: any;
env: ProcessEnv;
exit(code?: number): void;
exitCode: number;
getgid(): number;
@@ -1445,6 +1450,8 @@ declare module "dns" {
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export interface MxRecord {
priority: number;
exchange: string;
+7 -13
View File
@@ -734,19 +734,7 @@ namespace path_tests {
// returns
// ['foo', 'bar', 'baz']
console.log(process.env.PATH)
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
process.env.PATH.split(path.delimiter)
// returns
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
console.log(process.env.PATH)
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
process.env.PATH.split(path.delimiter)
// returns
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
process.env["PATH"]; // $ExpectType string
path.parse('/home/user/dir/file.txt')
// returns
@@ -1196,6 +1184,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});
+8 -1
View File
@@ -7,6 +7,7 @@
// Sebastian Silbermann <https://github.com/eps1lon>
// Alorel <https://github.com/Alorel>
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Sander Koenders <https://github.com/Archcry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/************************************************
@@ -460,6 +461,10 @@ declare namespace NodeJS {
isTTY?: true;
}
export interface ProcessEnv {
[key: string]: string | undefined;
}
export interface WriteStream extends Socket {
columns?: number;
rows?: number;
@@ -482,7 +487,7 @@ declare namespace NodeJS {
cwd(): string;
debugPort: number;
emitWarning(warning: string | Error, name?: string, ctor?: Function): void;
env: any;
env: ProcessEnv;
exit(code?: number): void;
exitCode: number;
getgid(): number;
@@ -2057,6 +2062,8 @@ declare module "dns" {
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export interface MxRecord {
priority: number;
exchange: string;
+7 -13
View File
@@ -1364,19 +1364,7 @@ namespace path_tests {
// returns
// ['foo', 'bar', 'baz']
console.log(process.env.PATH)
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
process.env.PATH.split(path.delimiter)
// returns
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
console.log(process.env.PATH)
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
process.env.PATH.split(path.delimiter)
// returns
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
process.env["PATH"]; // $ExpectType string
path.parse('/home/user/dir/file.txt')
// returns
@@ -2407,6 +2395,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});
+8 -1
View File
@@ -7,6 +7,7 @@
// Wilco Bakker <https://github.com/WilcoBakker>
// Sebastian Silbermann <https://github.com/eps1lon>
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Sander Koenders <https://github.com/Archcry>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/************************************************
@@ -456,6 +457,10 @@ declare namespace NodeJS {
isTTY?: true;
}
export interface ProcessEnv {
[key: string]: string | undefined;
}
export interface WriteStream extends Socket {
columns?: number;
rows?: number;
@@ -479,7 +484,7 @@ declare namespace NodeJS {
cwd(): string;
debugPort: number;
emitWarning(warning: string | Error, name?: string, ctor?: Function): void;
env: any;
env: ProcessEnv;
exit(code?: number): never;
exitCode: number;
getgid(): number;
@@ -2100,6 +2105,8 @@ declare module "dns" {
export function lookup(hostname: string, options: LookupOptions, callback: (err: NodeJS.ErrnoException, address: string | LookupAddress[], family: number) => void): void;
export function lookup(hostname: string, callback: (err: NodeJS.ErrnoException, address: string, family: number) => void): void;
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export interface ResolveOptions {
ttl: boolean;
}
+7 -13
View File
@@ -1346,19 +1346,7 @@ namespace path_tests {
// returns
// ['foo', 'bar', 'baz']
console.log(process.env.PATH)
// '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
process.env.PATH.split(path.delimiter)
// returns
// ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin']
console.log(process.env.PATH)
// 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\'
process.env.PATH.split(path.delimiter)
// returns
// ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\']
process.env["PATH"]; // $ExpectType string
path.parse('/home/user/dir/file.txt')
// returns
@@ -2398,6 +2386,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});
+7
View File
@@ -21,6 +21,7 @@
// Bruno Scheufler <https://github.com/brunoscheufler>
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Lishude <https://github.com/islishude>
// Andrew Makarov <https://github.com/r3nya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
@@ -2444,6 +2445,12 @@ declare module "dns" {
export function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>;
}
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export namespace lookupService {
export function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
}
export interface ResolveOptions {
ttl: boolean;
}
+6
View File
@@ -3075,6 +3075,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});
+7
View File
@@ -24,6 +24,7 @@
// Hoàng Văn Khải <https://github.com/KSXGitHub>
// Alexander T. <https://github.com/a-tarasyuk>
// Lishude <https://github.com/islishude>
// Andrew Makarov <https://github.com/r3nya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** inspector module types */
@@ -2525,6 +2526,12 @@ declare module "dns" {
export function __promisify__(hostname: string, options?: LookupOptions | number): Promise<{ address: string | LookupAddress[], family?: number }>;
}
export function lookupService(address: string, port: number, callback: (err: NodeJS.ErrnoException, hostname: string, service: string) => void): void;
export namespace lookupService {
export function __promisify__(address: string, port: number): Promise<{ hostname: string, service: string }>;
}
export interface ResolveOptions {
ttl: boolean;
}
+6
View File
@@ -3108,6 +3108,12 @@ namespace dns_tests {
const _family: number | undefined = family;
});
dns.lookupService("127.0.0.1", 0, (err, hostname, service) => {
const _err: NodeJS.ErrnoException = err;
const _hostname: string = hostname;
const _service: string = service;
});
dns.resolve("nodejs.org", (err, addresses) => {
const _addresses: string[] = addresses;
});
+471 -335
View File
File diff suppressed because it is too large Load Diff
+5 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for owl.carousel 2.2
// Type definitions for owl.carousel 2.3
// Project: https://github.com/OwlCarousel2/OwlCarousel2
// Definitions by: Ismael Gorissen <https://github.com/igorissen>
// Kenneth Ceyer <https://github.com/KennethanCeyer>
@@ -31,9 +31,9 @@ declare namespace OwlCarousel {
slideBy?: number | string;
dots?: boolean;
dotsEach?: number | boolean;
dotData?: boolean;
dotsData?: boolean;
lazyLoad?: boolean;
lazyContent?: boolean;
lazyLoadEager?: number;
autoplay?: boolean;
autoplayTimeout?: number;
autoplayHoverPause?: boolean;
@@ -59,6 +59,8 @@ declare namespace OwlCarousel {
stageElement?: string;
navContainer?: string | boolean;
dotsContainer?: string | boolean;
checkVisible?: boolean;
slideTransition?: string;
// CLASSES
refreshClass?: string;
loadingClass?: string;
+1 -1
View File
@@ -5,7 +5,7 @@
declare namespace pDefer {
interface DeferredPromise<T> {
resolve<U>(value: U | PromiseLike<U>): Promise<U>;
resolve<U>(value?: U | PromiseLike<U>): Promise<U>;
reject(reason: any): Promise<never>;
promise: Promise<T>;
}
+4
View File
@@ -7,3 +7,7 @@ function delay(deferred: pDefer.DeferredPromise<string>, ms: number) {
let s: string;
async function f() { s = await delay(pDefer<string>(), 100); }
async function u() {
const u: Promise<any> = pDefer().resolve();
}
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for pem-jwk 1.5
// Project: https://github.com/dannycoates/pem-jwk
// Definitions by: Alessio Paccoia <https://github.com/alessiopcc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface RSA_JWK {
kty: string;
n: string;
e: string;
d?: string;
p?: string;
q?: string;
dp?: string;
dq?: string;
qi?: string;
}
export function pem2jwk(rsa_pem: string): RSA_JWK;
export function jwk2pem(rsa_jwk: RSA_JWK): string;
+17
View File
@@ -0,0 +1,17 @@
import { jwk2pem, pem2jwk, RSA_JWK } from "pem-jwk";
const rsa_pem = `-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDh6RzHEsTFjD8NlB4echurwfV2
Zrlcg0k2JoP0Z3QAgXPMwJynvs2LeBHYaOFzGzjXRKsvaLwc5PjP3NcqcP3KkX5y
1VA31VrJLfFbXthi0a8c/UBwxJD8i4S35OKr6yui3bJatgYWrSQ4MT9ktaS1TP9l
XBW58V4VlkypTaQTSQIDAQAB
-----END PUBLIC KEY-----`;
const rsa_jwk: RSA_JWK = {
kty: 'RSA',
n: '4ekcxxLExYw_DZQeHnIbq8H1dma5XINJNiaD9Gd0AIFzzMCcp77Ni3gR2Gjhcxs410SrL2i8HOT4z9zXKnD9ypF-ctVQN9VayS3xW17YYtGvHP1AcMSQ_IuEt-Tiq-srot2yWrYGFq0kODE_ZLWktUz_ZVwVufFeFZZMqU2kE0k',
e: 'AQAB'
};
jwk2pem(rsa_jwk); // $ExpectType string
pem2jwk(rsa_pem); // $ExpectType RSA_JWK

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