Merge branch 'types-2.0' into mergeMaster_11/08

This commit is contained in:
Kanchalai Tanglertsampan
2016-11-10 16:33:23 -08:00
114 changed files with 2593 additions and 589 deletions
@@ -0,0 +1,14 @@
/// <reference path="./index.d.ts" />
/// <reference path="../angular/index.d.ts" />
import * as angular from "angular";
import {ClipboardService} from "angular-clipboard";
const app = angular.module('testModule', ['angular-clipboard']);
app.controller('TestController', ($scope: ng.IScope, clipboard: ClipboardService) => {
$scope['testCopy'] = () => {
if (clipboard.supported) {
clipboard.copyText('hiiiiiii');
}
};
});
+20
View File
@@ -0,0 +1,20 @@
// Type definitions for angular-clipboard v1.5
// Project: https://github.com/omichelsen/angular-clipboard
// Definitions by: Bradford Wagner <https://github.com/bradfordwagner/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Definition of the Clipboard Service
*/
export interface ClipboardService {
/**
* tells us whether or not angular-clipboard is supported
*/
supported: boolean;
/**
* copies text to a clipboard
* @param text the text to be copied to the clipboard
*/
copyText(text: string): void;
}
+19
View File
@@ -0,0 +1,19 @@
{
"files": [
"index.d.ts",
"angular-clipboard-tests.ts"
],
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}
@@ -66,7 +66,7 @@ angular
PermissionStore.removePermissionDefinition('user');
let permissions: Array<permissionNamespace.Permission> = PermissionStore.getStore();
let permissions = PermissionStore.getStore();
});
@@ -90,5 +90,5 @@ angular
RoleStore.removeRoleDefinition('user');
let roles: Array<permissionNamespace.Role> = RoleStore.getStore();
let roles = RoleStore.getStore();
});
+38 -19
View File
@@ -30,8 +30,8 @@ declare module 'angular' {
* @param validationFunction {Function} Function used to validate if permission is valid
*/
definePermission(
name: string,
validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise<any>
permissionName: string,
validationFunction: PermissionValidationFunction
): void;
/**
@@ -43,10 +43,14 @@ declare module 'angular' {
* @param validationFunction {Function} Function used to validate if permission is valid
*/
defineManyPermissions(
permissions: string[],
validationFunction: (permission?: string, transitionProperties?: TransitionProperties) => boolean | angular.IPromise<any>
permissionNames: string[],
validationFunction: PermissionValidationFunction
): void;
/**
* Removes all permissions
* @method
*/
clearStore(): void;
/**
@@ -55,7 +59,7 @@ declare module 'angular' {
*
* @param permissionName {String} Name of defined permission
*/
removePermissionDefinition(permission: string): void;
removePermissionDefinition(permissionName: string): void;
/**
* Checks if permission exists
@@ -66,13 +70,21 @@ declare module 'angular' {
*/
hasPermissionDefinition(permissionName: string): boolean;
/**
* Returns permission by it's name
* @method
*
* @returns {permission.Permission} Permissions definition object
*/
getPermissionDefinition(permissionName: string): Permission;
/**
* Returns all permissions
* @method
*
* @returns {Object} Permissions collection
*/
getStore(): Permission[];
getStore(): { [permissionName: string]: Permission };
}
export interface RoleStore {
@@ -85,8 +97,8 @@ declare module 'angular' {
* @param [validationFunction] {Function} Function used to validate if permissions in role are valid
*/
defineRole(
role: string,
permissions: Array<string>,
roleName: string,
permissions: string[],
validationFunction: RoleValidationFunction
): void;
@@ -97,7 +109,10 @@ declare module 'angular' {
* @param roleName {String} Name of defined role
* @param permissions {Array} Set of permission names
*/
defineRole(role: string, permissions: Array<string>): void;
defineRole(
roleName: string,
permissions: string[]
): void;
/**
* Checks if role is defined in store
@@ -106,7 +121,7 @@ declare module 'angular' {
* @param roleName {String} Name of role
* @returns {Boolean}
*/
hasRoleDefinition(role: string): boolean;
hasRoleDefinition(roleName: string): boolean;
/**
* Returns role definition object by it's name
@@ -136,27 +151,31 @@ declare module 'angular' {
*
* @returns {Object} Defined roles collection
*/
getStore(): Role[];
getStore(): { [roleName: string]: Role };
}
export interface Role {
roleName: string;
permissionNames: string[];
validationFunction?: RoleValidationFunction;
validateRole: () => angular.IPromise<any>;
}
export interface Permission {
permissionName: string;
validationFunction?: PermissionValidationFunction;
validatePermission: () => angular.IPromise<any>;
}
interface RoleValidationFunction {
(permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise<any>;
}
export type RoleValidationFunction = (
roleName?: string,
transitionProperties?: TransitionProperties
) => boolean | angular.IPromise<any>;
interface PermissionValidationFunction {
(permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise<any>;
}
export type PermissionValidationFunction = (
permissionName?: string,
transitionProperties?: TransitionProperties
) => boolean | angular.IPromise<any>;
export interface IPermissionState extends angular.ui.IState {
data?: any | DataWithPermissions;
@@ -164,8 +183,8 @@ declare module 'angular' {
export interface DataWithPermissions {
permissions?: {
only?: (() => void) | Array<string> | angular.IPromise<any>;
except?: (() => void) | Array<string> | angular.IPromise<any>;
only?: (() => void) | string | string[] | angular.IPromise<any>;
except?: (() => void) | string | string[] | angular.IPromise<any>;
redirectTo: string | (() => string) | (() => PermissionRedirectConfigation) | { [index: string]: PermissionRedirectConfigation }
};
}
@@ -1,5 +1,3 @@
/// <reference path="./angular-ui-router-uib-modal.d.ts" />
angular.module("test", [
"ui.bootstrap",
"ui.router",
@@ -3,10 +3,12 @@
// Definitions by: Stepan Riha <https://github.com/nonplus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../angular-ui-router/angular-ui-router.d.ts" />
import * as auir from "angular-ui-router";
declare namespace angular.ui {
interface IState {
modal?: boolean | string[];
declare module "angular" {
namespace ui {
interface IState {
modal?: boolean | string[];
}
}
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"angular-ui-router-uib-modal-tests.ts"
]
}
+39
View File
@@ -381,3 +381,42 @@ dynamoDBDocClient.query(
else console.log(data); // successful response
}
);
var kinesis = new AWS.Kinesis();
var putRecordParam = {
Data: new Buffer('...') || 'STRING_VALUE', /* required */
PartitionKey: 'STRING_VALUE', /* required */
StreamName: 'STRING_VALUE', /* required */
ExplicitHashKey: 'STRING_VALUE',
SequenceNumberForOrdering: 'STRING_VALUE'
};
kinesis.putRecord(putRecordParam, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
var putRecordParams = {
Records: [ /* required */
{
Data: new Buffer('...') || 'STRING_VALUE', /* required */
PartitionKey: 'STRING_VALUE', /* required */
ExplicitHashKey: 'STRING_VALUE'
},
/* more items */
],
StreamName: 'STRING_VALUE' /* required */
};
kinesis.putRecords(putRecordParams, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
var increaseStreamRetentionPeriodParams = {
RetentionPeriodHours: 0, /* required */
StreamName: 'STRING_VALUE' /* required */
};
kinesis.increaseStreamRetentionPeriod(increaseStreamRetentionPeriodParams, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
+51 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for aws-sdk
// Project: https://github.com/aws/aws-sdk-js
// Definitions by: midknight41 <https://github.com/midknight41>
// Definitions by: midknight41 <https://github.com/midknight41>, Casper Skydt <https://github.com/CasperSkydt>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Imported from: https://github.com/soywiz/typescript-node-definitions/aws-sdk.d.ts
@@ -335,6 +335,56 @@ export declare class SNS {
publish(request: Sns.PublishRequest, callback: (err: any, data: any) => void): void;
}
export class Kinesis {
constructor(options?: any);
endpoint: Endpoint;
putRecord(params: KINESIS.PutRecordParams, callback: (error: Error, data: KINESIS.PutRecordResult) => void): void;
putRecords(params: KINESIS.PutRecordsParams, callback: (error: Error, data: KINESIS.PutRecordsResult) => void): void;
increaseStreamRetentionPeriod(params: KINESIS.IncreaseStreamRetentionPeriodParams, callback: (error: Error, data: any) => void): void;
}
export module KINESIS {
export interface Record {
Data: Buffer | string | Blob;
PartitionKey: string;
ExplicitHashKey?: string;
}
export interface RecordResult {
SequenceNumber: string;
ShardId: string;
ErrorCode: string;
ErrorMessage: string;
}
export interface PutRecordParams extends Record {
StreamName: string;
SequenceNumberForOrdering?: string;
}
export interface PutRecordResult {
ShardId: string;
SequenceNumber: string;
}
export interface PutRecordsParams {
StreamName: string;
Records: Record[];
}
export interface PutRecordsResult {
FailedRecordCount: number;
Records: RecordResult[]
}
export interface IncreaseStreamRetentionPeriodParams {
RetentionPeriodHours: number;
StreamName: string;
}
}
export declare class SWF {
constructor(options?: any);
endpoint: Endpoint;
+8
View File
@@ -0,0 +1,8 @@
import ponyBind = require('bind-ponyfill');
let boundFn: Function;
boundFn = ponyBind(() => { console.log(this); }, 'Hello world!');
boundFn = ponyBind((...args: Array<string>) => { console.log(this, ...args); }, 'Hello world!', 'arg1');
boundFn = ponyBind((...args: Array<string>) => { console.log(this, ...args); }, 'Hello world!', 'arg1', 'arg2');
boundFn = ponyBind((arg1: string, arg2: number) => { console.log(this, arg1, arg2); }, 'Hello world!', 'arg1', 2);
+7
View File
@@ -0,0 +1,7 @@
// Type definitions for bind-ponyfill 0.1.0
// Project: https://www.npmjs.com/package/bind-ponyfill
// Definitions by: Steve Jenkins <https://github.com/skysteve>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function ponyBind(fn: Function, that: any, ...args: Array<any>): Function;
export = ponyBind;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bind-ponyfill-tests.ts"
]
}
+1 -1
View File
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
+2 -2
View File
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
@@ -14,6 +14,6 @@
},
"files": [
"index.d.ts",
"cassandra-driver.tests.ts"
"cassandra-driver-tests.ts"
]
}
+135
View File
@@ -0,0 +1,135 @@
/// <reference types="chai" />
/// <reference types="mocha" />
import * as chai from 'chai';
import * as spies from 'chai-spies';
import * as Mocha from 'mocha';
function original(): void {
// do something cool
}
let ee = {
on(name: string, fn: () => void) {
}
};
let spiedFn = chai.spy(original);
// then use in place of original
ee.on('some event', spiedFn);
// or use without original
let spy_again = chai.spy();
ee.on('some other event', spy_again);
// or you can track an object's method
let array = [ 1, 2, 3 ];
chai.spy.on(array, 'push');
// or you can track multiple object's methods
chai.spy.on(array, 'push', 'pop');
array.push(5);
// and you can reset the object calls
// array.push.reset();
// or you can create spy object
let object = chai.spy.object([ 'push', 'pop' ]);
object.push(5);
// or you create spy which returns static value
spiedFn = chai.spy.returns(true);
spiedFn(); // true
let should = chai.should()
, expect = chai.expect;
const spy = chai.spy();
// .spy
expect(spy).to.be.spy;
spy.should.be.spy;
// .called
expect(spy).to.have.been.called();
spy.should.have.been.called();
// .with
const spyStringArg = chai.spy((arg: string) => arg);
spyStringArg('foo');
expect(spyStringArg).to.have.been.called.with('foo');
spyStringArg.should.have.been.called.with('foo');
const spyTwoStringArgsAndOneNumber = chai.spy((arg1: string, arg2: string, arg3: number) => arg3);
spyTwoStringArgsAndOneNumber('foo', 'bar', 1);
expect(spyTwoStringArgsAndOneNumber).to.have.been.called.with('bar', 'foo');
spyTwoStringArgsAndOneNumber.should.have.been.called.with('bar', 'foo');
// .with.exactly
const spyTwoStringArgs = chai.spy((arg1: string, arg2: string) => arg1);
spyTwoStringArgs('', '');
spyTwoStringArgs('foo', 'bar');
expect(spyTwoStringArgs).to.have.been.called.with.exactly('foo', 'bar');
spyTwoStringArgs.should.have.been.called.with.exactly('foo', 'bar');
// .always.with
const spyThreeAnyArgs = chai.spy((arg1: any, arg2: any, arg3: any) => arg1);
spyThreeAnyArgs('foo', null, null);
spyThreeAnyArgs('foo', 'bar', null);
spyThreeAnyArgs(1, 2, 'foo');
expect(spy).to.have.been.called.always.with('foo');
spy.should.have.been.called.always.with('foo');
// .always.with.exactly
spyStringArg('foo');
spyStringArg('foo');
expect(spyStringArg).to.have.been.called.always.with.exactly('foo');
spyStringArg.should.have.been.called.always.with.exactly('foo');
// .once
expect(spy).to.have.been.called.once;
expect(spy).to.not.have.been.called.once;
spy.should.have.been.called.once;
spy.should.not.have.been.called.once;
// .twice
expect(spy).to.have.been.called.twice;
expect(spy).to.not.have.been.called.twice;
spy.should.have.been.called.twice;
spy.should.not.have.been.called.twice;
// .exactly(n)
expect(spy).to.have.been.called.exactly(3);
expect(spy).to.not.have.been.called.exactly(3);
spy.should.have.been.called.exactly(3);
spy.should.not.have.been.called.exactly(3);
// .min(n) / .at.least(n)
expect(spy).to.have.been.called.min(3);
expect(spy).to.not.have.been.called.at.least(3);
spy.should.have.been.called.at.least(3);
spy.should.not.have.been.called.min(3);
// .max(n) / .at.most(n)
expect(spy).to.have.been.called.max(3);
expect(spy).to.not.have.been.called.at.most(3);
spy.should.have.been.called.at.most(3);
spy.should.not.have.been.called.max(3);
// .above(n) / .gt(n)
expect(spy).to.have.been.called.above(3);
expect(spy).to.not.have.been.called.gt(3);
spy.should.have.been.called.gt(3);
spy.should.not.have.been.called.above(3);
// .below(n) / .lt(n)
expect(spy).to.have.been.called.below(3);
expect(spy).to.not.have.been.called.lt(3);
spy.should.have.been.called.lt(3);
spy.should.not.have.been.called.below(3);
+411
View File
@@ -0,0 +1,411 @@
// Type definitions for chai-spies
// Project: https://github.com/chaijs/chai-spies
// Definitions by: Ilya Kuznetsov <https://github.com/kuzn-ilya>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="chai" />
declare namespace Chai {
interface ChaiStatic {
spy: ChaiSpies.Spy;
}
interface Assertion {
/**
* ####.spy
* Asserts that object is a spy.
* ```ts
* expect(spy).to.be.spy;
* spy.should.be.spy;
* ```
*/
spy: Assertion;
/**
* ####.called
* Assert that a spy has been called. Negation passes through.
* ```ts
* expect(spy).to.have.been.called();
* spy.should.have.been.called();
* ```
* Note that ```called``` can be used as a chainable method.
*/
called: ChaiSpies.Called;
}
}
declare namespace ChaiSpies {
interface Spy {
/**
* #### chai.spy (function)
*
* Wraps a function in a proxy function. All calls will pass through to the original function.
* ```ts
* function original() {}
* var spy = chai.spy(original)
* , e_spy = chai.spy();
* ```
* @param fn function to spy on. @default ```function () {}```
* @returns function to actually call
*/
(): SpyFunc0Proxy<void>;
<R>(fn: SpyFunc0<R>): SpyFunc0Proxy<R>;
<A1, R>(fn: SpyFunc1<A1, R>): SpyFunc1Proxy<A1, R>;
<A1, A2, R>(fn: SpyFunc2<A1, A2, R>): SpyFunc2Proxy<A1, A2, R>;
<A1, A2, A3, R>(fn: SpyFunc3<A1, A2, A3, R>): SpyFunc3Proxy<A1, A2, A3, R>;
<A1, A2, A3, A4, R>(fn: SpyFunc4<A1, A2, A3, A4, R>): SpyFunc4Proxy<A1, A2, A3, A4, R>;
<A1, A2, A3, A4, A5, R>(fn: SpyFunc5<A1, A2, A3, A4, A5, R>): SpyFunc5Proxy<A1, A2, A3, A4, A5, R>;
<A1, A2, A3, A4, A5, A6, R>(fn: SpyFunc6<A1, A2, A3, A4, A5, A6, R>): SpyFunc6Proxy<A1, A2, A3, A4, A5, A6, R>;
<A1, A2, A3, A4, A5, A6, A7, R>(fn: SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R>): SpyFunc7Proxy<A1, A2, A3, A4, A5, A6, A7, R>;
<A1, A2, A3, A4, A5, A6, A7, A8, R>(fn: SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R>): SpyFunc8Proxy<A1, A2, A3, A4, A5, A6, A7, A8, R>;
<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>(fn: SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>): SpyFunc9Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>;
<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>(fn: SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>): SpyFunc10Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>;
<R>(name: string, fn: SpyFunc0<R>): SpyFunc0Proxy<R>;
<A1, R>(name: string, fn: SpyFunc1<A1, R>): SpyFunc1Proxy<A1, R>;
<A1, A2, R>(name: string, fn: SpyFunc2<A1, A2, R>): SpyFunc2Proxy<A1, A2, R>;
<A1, A2, A3, R>(name: string, fn: SpyFunc3<A1, A2, A3, R>): SpyFunc3Proxy<A1, A2, A3, R>;
<A1, A2, A3, A4, R>(name: string, fn: SpyFunc4<A1, A2, A3, A4, R>): SpyFunc4Proxy<A1, A2, A3, A4, R>;
<A1, A2, A3, A4, A5, R>(name: string, fn: SpyFunc5<A1, A2, A3, A4, A5, R>): SpyFunc5Proxy<A1, A2, A3, A4, A5, R>;
<A1, A2, A3, A4, A5, A6, R>(name: string, fn: SpyFunc6<A1, A2, A3, A4, A5, A6, R>): SpyFunc6Proxy<A1, A2, A3, A4, A5, A6, R>;
<A1, A2, A3, A4, A5, A6, A7, R>(name: string, fn: SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R>): SpyFunc7Proxy<A1, A2, A3, A4, A5, A6, A7, R>;
<A1, A2, A3, A4, A5, A6, A7, A8, R>(name: string, fn: SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R>): SpyFunc8Proxy<A1, A2, A3, A4, A5, A6, A7, A8, R>;
<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>(name: string, fn: SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>): SpyFunc9Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>;
<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>(name: string, fn: SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>): SpyFunc10Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>;
/**
* #### chai.spy.on (function)
*
* Wraps an object method into spy. All calls will pass through to the original function.
* ```ts
* var spy = chai.spy.on(Array, 'isArray');
* ```
* @param {Object} object
* @param {String} method name to spy on
* @returns function to actually call
*/
on(object: Object, ...methodNames: string[]): any;
/**
* #### chai.spy.object (function)
*
* Creates an object with spied methods.
* ```ts
* var object = chai.spy.object('Array', [ 'push', 'pop' ]);
* ```
* @param {String} [name] object name
* @param {String[]|Object} method names or method definitions
* @returns object with spied methods
*/
object(name: string, methods: string[]): any;
object(methods: string[]): any;
object<T>(name: string, methods: T): T;
object<T>(methods: T): T;
/**
* #### chai.spy.returns (function)
*
* Creates a spy which returns static value.
*```ts
* var method = chai.spy.returns(true);
*```
* @param {*} value static value which is returned by spy
* @returns new spy function which returns static value
* @api public
*/
returns<T>(value: T): SpyFunc0Proxy<T>;
}
interface Called {
(): Chai.Assertion;
with: With;
always: Always;
/**
* ####.once
* Assert that a spy has been called exactly once.
* ```ts
* expect(spy).to.have.been.called.once;
* expect(spy).to.not.have.been.called.once;
* spy.should.have.been.called.once;
* spy.should.not.have.been.called.once;
* ```
*/
once: Chai.Assertion;
/**
* ####.twice
* Assert that a spy has been called exactly twice.
* ```ts
* expect(spy).to.have.been.called.twice;
* expect(spy).to.not.have.been.called.twice;
* spy.should.have.been.called.twice;
* spy.should.not.have.been.called.twice;
* ```
*/
twice: Chai.Assertion;
/**
* ####.exactly(n)
* Assert that a spy has been called exactly ```n``` times.
* ```ts
* expect(spy).to.have.been.called.exactly(3);
* expect(spy).to.not.have.been.called.exactly(3);
* spy.should.have.been.called.exactly(3);
* spy.should.not.have.been.called.exactly(3);
* ```
*/
exactly(n: number): Chai.Assertion;
/**
* ####.min(n) / .at.least(n)
* Assert that a spy has been called minimum of ```n``` times.
* ```ts
* expect(spy).to.have.been.called.min(3);
* expect(spy).to.not.have.been.called.at.least(3);
* spy.should.have.been.called.at.least(3);
* spy.should.not.have.been.called.min(3);
* ```
*/
min(n: number): Chai.Assertion;
/**
* ####.max(n) / .at.most(n)
* Assert that a spy has been called maximum of ```n``` times.
* ```ts
* expect(spy).to.have.been.called.max(3);
* expect(spy).to.not.have.been.called.at.most(3);
* spy.should.have.been.called.at.most(3);
* spy.should.not.have.been.called.max(3);
* ```
*/
max(n: number): Chai.Assertion;
at: At;
/**
* ####.above(n) / .gt(n)
* Assert that a spy has been called more than ```n``` times.
* ```ts
* expect(spy).to.have.been.called.above(3);
* spy.should.not.have.been.called.above(3);
* ```
*/
above(n: number): Chai.Assertion;
/**
* ####.above(n) / .gt(n)
* Assert that a spy has been called more than ```n``` times.
* ```ts
* expect(spy).to.have.been.called.gt(3);
* spy.should.not.have.been.called.gt(3);
* ```
*/
gt(n: number): Chai.Assertion;
/**
* ####.below(n) / .lt(n)
* Assert that a spy has been called fewer than ```n``` times.
* ```ts
* expect(spy).to.have.been.called.below(3);
* spy.should.not.have.been.called.below(3);
* ```
*/
below(n: number): Chai.Assertion;
/**
* ####.below(n) / .lt(n)
* Assert that a spy has been called fewer than ```n``` times.
* ```ts
* expect(spy).to.have.been.called.lt(3);
* spy.should.not.have.been.called.lt(3);
* ```
*/
lt(n: number): Chai.Assertion;
}
interface With {
/**
* ####.with
* Assert that a spy has been called with a given argument at least once, even if more arguments were provided.
* ```ts
* spy('foo');
* expect(spy).to.have.been.called.with('foo');
* spy.should.have.been.called.with('foo');
* ```
* Will also pass for ```spy('foo', 'bar')``` and ```spy(); spy('foo')```.
* If used with multiple arguments, assert that a spy has been called with all the given arguments at least once.
* ```ts
* spy('foo', 'bar', 1);
* expect(spy).to.have.been.called.with('bar', 'foo');
* spy.should.have.been.called.with('bar', 'foo');
* ```
*/
(a: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion;
/**
* ####.with.exactly
* Similar to .with, but will pass only if the list of arguments is exactly the same as the one provided.
* ```ts
* spy();
* spy('foo', 'bar');
* expect(spy).to.have.been.called.with.exactly('foo', 'bar');
* spy.should.have.been.called.with.exactly('foo', 'bar');
* ```
* Will not pass for ```spy('foo')```, ```spy('bar')```, ```spy('bar'); spy('foo')```, ```spy('foo'); spy('bar')```, ```spy('bar', 'foo')``` or ```spy('foo', 'bar', 1)```.
* Can be used for calls with a single argument too.
*/
exactly(a?: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion;
}
interface Always {
with: AlwaysWith;
}
interface AlwaysWith {
/**
* ####.always.with
* Assert that every time the spy has been called the argument list contained the given arguments.
* ```ts
* spy('foo');
* spy('foo', 'bar');
* spy(1, 2, 'foo');
* expect(spy).to.have.been.called.always.with('foo');
* spy.should.have.been.called.always.with('foo');
* ```
*/
(a: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion;
/**
* ####.always.with.exactly
* Assert that the spy has never been called with a different list of arguments than the one provided.
* ```ts
* spy('foo');
* spy('foo');
* expect(spy).to.have.been.called.always.with.exactly('foo');
* spy.should.have.been.called.always.with.exactly('foo');
* ```
*/
exactly(a?: any, b?: any, c?: any, d?: any, e?: any, f?: any, g?: any, h?: any, i?: any, j?: any): Chai.Assertion;
}
interface At {
/**
* ####.min(n) / .at.least(n)
* Assert that a spy has been called minimum of ```n``` times.
* ```ts
* expect(spy).to.have.been.called.min(3);
* expect(spy).to.not.have.been.called.at.least(3);
* spy.should.have.been.called.at.least(3);
* spy.should.not.have.been.called.min(3);
* ```
*/
least(n: number): Chai.Assertion;
/**
* ####.max(n) / .at.most(n)
* Assert that a spy has been called maximum of ```n``` times.
* ```ts
* expect(spy).to.have.been.called.max(3);
* expect(spy).to.not.have.been.called.at.most(3);
* spy.should.have.been.called.at.most(3);
* spy.should.not.have.been.called.max(3);
* ```
*/
most(n: number): Chai.Assertion;
}
interface Resetable {
/**
* #### proxy.reset (function)
*
* Resets __spy object parameters for instantiation and reuse
* @returns proxy spy object
*/
reset(): this;
}
interface SpyFunc0<R> {
(): R;
}
interface SpyFunc1<A1, R> {
(a: A1): R;
}
interface SpyFunc2<A1, A2, R> {
(a: A1, b: A2): R;
}
interface SpyFunc3<A1, A2, A3, R> {
(a: A1, b: A2, c: A3): R;
}
interface SpyFunc4<A1, A2, A3, A4, R> {
(a: A1, b: A2, c: A3, d: A4): R;
}
interface SpyFunc5<A1, A2, A3, A4, A5, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5): R;
}
interface SpyFunc6<A1, A2, A3, A4, A5, A6, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6): R;
}
interface SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7): R;
}
interface SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8): R;
}
interface SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9): R;
}
interface SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> {
(a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9, j: A10): R;
}
interface SpyFunc0Proxy<R> extends SpyFunc0<R>, Resetable {
}
interface SpyFunc1Proxy<A1, R> extends SpyFunc1<A1, R>, Resetable {
}
interface SpyFunc2Proxy<A1, A2, R> extends SpyFunc2<A1, A2, R>, Resetable {
}
interface SpyFunc3Proxy<A1, A2, A3, R> extends SpyFunc3<A1, A2, A3, R>, Resetable {
}
interface SpyFunc4Proxy<A1, A2, A3, A4, R> extends SpyFunc4<A1, A2, A3, A4, R>, Resetable {
}
interface SpyFunc5Proxy<A1, A2, A3, A4, A5, R> extends SpyFunc5<A1, A2, A3, A4, A5, R>, Resetable {
}
interface SpyFunc6Proxy<A1, A2, A3, A4, A5, A6, R> extends SpyFunc6<A1, A2, A3, A4, A5, A6, R>, Resetable {
}
interface SpyFunc7Proxy<A1, A2, A3, A4, A5, A6, A7, R> extends SpyFunc7<A1, A2, A3, A4, A5, A6, A7, R>, Resetable {
}
interface SpyFunc8Proxy<A1, A2, A3, A4, A5, A6, A7, A8, R> extends SpyFunc8<A1, A2, A3, A4, A5, A6, A7, A8, R>, Resetable {
}
interface SpyFunc9Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, R> extends SpyFunc9<A1, A2, A3, A4, A5, A6, A7, A8, A9, R>, Resetable {
}
interface SpyFunc10Proxy<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R> extends SpyFunc10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, R>, Resetable {
}
}
declare var spies: ChaiSpies.Spy;
declare module "chai-spies" {
export = spies;
}
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"chai-spies-tests.ts"
]
}
+1 -1
View File
@@ -392,7 +392,7 @@ interface RadialLinearScale {
}
declare class Chart {
constructor (context: CanvasRenderingContext2D, options: ChartConfiguration);
constructor (context: CanvasRenderingContext2D | HTMLCanvasElement, options: ChartConfiguration);
config: ChartConfiguration;
destroy: () => {};
update: (duration?: any, lazy?: any) => {};
+1 -1
View File
@@ -1,4 +1,4 @@
import * as Clipboard from 'clipboard';
var cb1 = new Clipboard('.btn');
var cb2 = new Clipboard(document.getElementById('id'), {
+50 -48
View File
@@ -3,54 +3,56 @@
// Definitions by: Andrei Kurosh <https://github.com/impworks>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Clipboard {
constructor(selector: (string | Element | NodeListOf<Element>), options?: ClipboardOptions);
/**
* Subscribes to events that indicate the result of a copy/cut operation.
* @param type {String} Event type ('success' or 'error').
* @param handler Callback function.
*/
on(type: "success", handler: (e: ClipboardEvent) => void): this;
on(type: "error", handler: (e: ClipboardEvent) => void): this;
on(type: string, handler: (e: ClipboardEvent) => void): this;
/**
* Clears all event bindings.
*/
destroy(): void;
}
interface ClipboardOptions {
/**
* Overwrites default command ('cut' or 'copy').
* @param {Element} elem Current element
* @returns {String} Only 'cut' or 'copy'.
*/
action?: (elem: Element) => string;
/**
* Overwrites default target input element.
* @param {Element} elem Current element
* @returns {Element} <input> element to use.
*/
target?: (elem: Element) => Element;
/**
* Returns the explicit text to copy.
* @param {Element} elem Current element
* @returns {String} Text to be copied.
*/
text?: (elem: Element) => string;
}
interface ClipboardEvent {
action: string;
text: string;
trigger: Element;
clearSelection(): void;
}
declare module 'clipboard' {
class Clipboard {
constructor(selector: (string | Element | NodeListOf<Element>), options?: Clipboard.Options);
/**
* Subscribes to events that indicate the result of a copy/cut operation.
* @param type {String} Event type ('success' or 'error').
* @param handler Callback function.
*/
on(type: "success", handler: (e: Clipboard.Event) => void): this;
on(type: "error", handler: (e: Clipboard.Event) => void): this;
on(type: string, handler: (e: Clipboard.Event) => void): this;
/**
* Clears all event bindings.
*/
destroy(): void;
}
namespace Clipboard {
interface Options {
/**
* Overwrites default command ('cut' or 'copy').
* @param {Element} elem Current element
* @returns {String} Only 'cut' or 'copy'.
*/
action?: (elem: Element) => string;
/**
* Overwrites default target input element.
* @param {Element} elem Current element
* @returns {Element} <input> element to use.
*/
target?: (elem: Element) => Element;
/**
* Returns the explicit text to copy.
* @param {Element} elem Current element
* @returns {String} Text to be copied.
*/
text?: (elem: Element) => string;
}
interface Event {
action: string;
text: string;
trigger: Element;
clearSelection(): void;
}
}
export = Clipboard;
}
+2 -3
View File
@@ -393,8 +393,8 @@ declare namespace CodeMirror {
/** Fired whenever a line is (re-)rendered to the DOM. Fired right after the DOM element is built, before it is added to the document.
The handler may mess with the style of the resulting element, or add event handlers, but should not try to change the state of the editor. */
on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void;
off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: number, element: HTMLElement) => void ): void;
on(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: CodeMirror.LineHandle, element: HTMLElement) => void ): void;
off(eventName: 'renderLine', handler: (instance: CodeMirror.Editor, line: CodeMirror.LineHandle, element: HTMLElement) => void ): void;
/** Expose the state object, so that the Editor.state.completionActive property is reachable*/
state: any;
@@ -1240,4 +1240,3 @@ declare namespace CodeMirror {
}
}
}
+2 -2
View File
@@ -5,11 +5,11 @@
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typesSearchPaths": [
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"forceConsistentCasingInFileNames": true
},
"files": [
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -9,7 +9,8 @@
"../"
],
"types": [],
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -4,7 +4,8 @@
"target": "es6",
"noImplicitAny": false,
"strictNullChecks": false,
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -9,7 +9,8 @@
"../"
],
"types": [],
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+54 -14
View File
@@ -1,7 +1,7 @@
// Type definitions for dat.GUI v0.5
// Type definitions for dat.GUI v0.6.1
// Project: https://github.com/dataarts/dat.gui
// Definitions by: Satoru Kimura <https://github.com/gyohk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Definitions by: Satoru Kimura <https://github.com/gyohk>, ZongJing Lu <https://github.com/sonic3d>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace dat {
export class GUI {
@@ -23,11 +23,40 @@ declare namespace dat {
addColor(target: Object, propName:string, rgba: number[]): GUIController; // rgb or rgba
addColor(target: Object, propName:string, hsv:{h:number; s:number; v:number}): GUIController;
remove(controller: GUIController): void;
destroy(): void;
addFolder(propName:string): GUI;
close(): void;
open(): void;
remember(target: Object): void;
close(): void;
remember(target: Object, ...additionalTargets: Object[]): void;
getRoot(): GUI;
getSaveObject(): Object;
save(): void;
saveAs(presetName:string): void;
revert(gui:GUI): void;
listen(controller: GUIController): void;
updateDisplay(): void;
// gui properties in dat/gui/GUI.js
parent(): GUI;
scrollable(): boolean;
autoPlace(): boolean;
preset(): string;
preset(s: string): void;
width(): number;
width(n: number): void;
name(): string;
name(s: string): void;
closed(): boolean;
closed(b: boolean): void;
load(): Object;
useLocalStorage(): boolean;
useLocalStorage(b: boolean): void;
}
export interface GUIParams{
@@ -41,17 +70,28 @@ declare namespace dat {
export class GUIController {
destroy(): void;
fire(): GUIController;
getValue(): any;
isModified(): boolean;
listen(): GUIController;
min(n: number): GUIController;
remove(target: GUIController): void;
setValue(value: any): GUIController;
step(n: number): GUIController;
updateDisplay(): void;
// Controller
onChange: (value?: any) => void;
onFinishChange: (value?: any) => void;
setValue(value: any): GUIController;
getValue(): any;
updateDisplay(): void;
isModified(): boolean;
// NumberController
min(n: number): GUIController;
max(n: number): GUIController;
step(n: number): GUIController;
// FunctionController
fire(): GUIController;
// augmentController in dat/gui/GUI.js
options(option:any):GUIController;
name(s: string): GUIController;
listen(): GUIController;
remove(): GUIController;
}
}
+208
View File
@@ -0,0 +1,208 @@
// Example from deku/examples/basic
(function (){
const {h, createApp} = deku
function view(state = { count: 0 }, dispatch: Function){
return (
h('div', {}, [
h('div', {}, 'Counter: ' + state.count),
h('button', {onClick: increment(dispatch)}, 'Increment'),
h('button', {onClick: decrement(dispatch)}, 'Decrement')
])
)
}
function increment(dispatch: Function){
return () => dispatch({
type: 'INCREMENT'
})
}
function decrement(dispatch: Function){
return () => dispatch({
type: 'DECREMENT'
})
}
let render = createApp(document.body)
function main(state: any){
let vnode = view(state, (action: any) => main({ count: 0 }))
render(vnode)
}
main({ count: 0 })
})();
// Example from deku/docs/api/create-app
(function (){
const {createApp, element} = deku
const App = ({ props = { size: 'medium' } }) => {
return element('div', { class: `size-${ props.size }` })
}
const render = createApp(document.body)
render(element(App, { size: 'small' }))
render(element(App, { size: 'large' }))
})();
// Example from deku/docs/api/string
(function (){
const { h } = deku
const html = deku.string.render(h('div', {}, [
h('header'),
h('sidebar'),
h('app'),
]))
})();
// Example from deku/docs/api/element
(function (){
const { element } = deku
// Native elements
element('div', { class: 'greeting' }, [
element('span', {}, ['Hello'])
])
// Components
let App = {
render: ({ props = { name: '' } }) => element('div', {}, `Hello ${ props.name }!`)
}
element(App, { name: 'Tom' })
})();
// deku.createApp
(function (){
const { createApp, element } = deku
let render: Function = createApp(document.body)
render(element('div'))
render = createApp(document.body, (action: any) => {
render(element('div'))
})
render(element('div'))
})();
// deku.dom
(function (){
const { dom, element } = deku
let el: HTMLElement = dom.create(element('div'), '0.0', ()=>{}, {})
const update: (DOMElement: HTMLElement, action: any) => HTMLElement = dom.update(()=>{}, {})
el = update(el, {})
})();
// deku.string
(function (){
const { element } = deku
let html: string = deku.string.render(element('div'))
html = deku.string.render(element('div'), {})
})();
// deku.element
(function (){
const { element } = deku
let v: deku.VirtualElement = element('div')
v = element('div', {})
v = element('div', {}, [])
v = element('div', {}, ['foo', 0, 'bar'])
v = element('div', {}, 'foo')
v = element('div', {}, 0)
v = element('div', {}, 'foo', 'bar')
let Component = {
render({}){
return element('div')
}
}
v = element(Component)
v = element(Component, {})
v = element(Component, {}, [])
})();
// deku.diff
(function (){
const { diff, element } = deku
const { Actions } = diff
let diffs: any[] = diff.diffNode(element('div'), element('span'))
let actions: deku.diff.Actions[] = [
Actions.setAttribute('class', 'foo', 'bar'),
Actions.removeAttribute('foo', {}),
Actions.insertChild({}, 0, '0.0'),
Actions.removeChild(0),
Actions.updateChild(0, []),
Actions.updateChildren([]),
Actions.insertBefore(0),
Actions.replaceNode({}, {}, '0.0'),
Actions.removeNode({}),
Actions.sameNode(),
Actions.updateThunk({}, {}, '0.0')
]
actions.forEach(action => {
Actions.case({
setAttribute: (name: string, value: any, previousValue: any) => {
},
_: () => {
}
}, action)
})
})();
// deku.vnode
(function (){
const { vnode, element } = deku
let v: deku.VirtualElement = vnode.create('div')
v = vnode.createTextElement('foo')
const Component = {
render({}){
return element('div')
}
}
v = vnode.createThunkElement(Component.render, '', Component, [], {})
v = vnode.createEmptyElement()
let b: boolean = vnode.isThunk(v)
b = vnode.isText(v)
b = vnode.isEmpty(v)
b = vnode.isSameThunk(v, v)
let path: string = vnode.createPath('0', '1', '2', '3')
path = vnode.createPath(0, 1, 2, 3)
})();
+136
View File
@@ -0,0 +1,136 @@
// Type definitions for deku v2.0
// Project: https://github.com/anthonyshort/deku
// Definitions by: Sho Fuji <https://github.com/pocka/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = deku;
export as namespace deku;
declare namespace deku {
interface VirtualElement {
type: string;
}
/**
* Create a DOM renderer using a container element.
* Everything will be rendered inside of that container.
* Returns a function that accepts new state that can replace what is currently rendered.
*/
function createApp(el: HTMLElement, dispatch?: Dispatch): Render;
namespace dom {
/**
* Create a real DOM element from a virtual element, recursively looping down.
* When it finds custom elements it will render them, cache them, and keep going,
* so they are treated like any other native element.
*/
function create<C>(vnode: VirtualElement, path: string, dispatch: Dispatch, context: C): HTMLElement;
/**
* Modify a DOM element given an array of actions.
*/
function update<C, A>(dispatch: Dispatch, context: C): (DOMElement: HTMLElement, action: A) => HTMLElement;
}
namespace string {
/**
* Render a virtual element to a string. You can pass in an option state context object that will be given to all components.
*/
function render(vnode: VirtualElement): string;
function render<C>(vnode: VirtualElement, context: C): string;
}
/**
* This function lets us create virtual nodes using a simple syntax.
* It is compatible with JSX transforms so you can use JSX to write nodes that will compile to this function.
*/
function element(type: string): VirtualElement;
function element<A>(type: string, attributes: A, ...children: any[]): VirtualElement;
function element(type: Thunk): VirtualElement;
function element<A>(type: Thunk, attributes: A, ...children: any[]): VirtualElement;
var h: typeof element;
namespace diff {
/**
* Compare two virtual nodes and return an array of changes to turn the left into the right.
*/
function diffNode(prevNode: VirtualElement, nextNode: VirtualElement): any[];
class Actions {
private _keys: string[];
private _name: string;
static setAttribute(a: string, b: any, c: any): Actions;
static removeAttribute(a: string, b: any): Actions;
static insertChild(a: any, b: number, c: string): Actions;
static removeChild(a: number): Actions;
static updateChild(a: number, b: any[]): Actions;
static updateChildren(a: any[]): Actions;
static insertBefore(a: number): Actions;
static replaceNode(a: any, b: any, c: string): Actions;
static removeNode(a: any): Actions;
static sameNode(): Actions;
static updateThunk(a: any, b: any, c: string): Actions;
static case(pat: any, action: Actions): any;
}
}
namespace vnode {
var create: typeof element;
/**
* Text nodes are stored as objects to keep things simple
*/
function createTextElement(text: string): VirtualElement;
/**
* Lazily-rendered virtual nodes
*/
function createThunkElement<P, T, O>(fn: (model: Model) => VirtualElement, key: string, props: P, children: T[], options: O): VirtualElement;
function createEmptyElement(): VirtualElement;
function isThunk(vnode: VirtualElement): boolean;
function isText(vnode: VirtualElement): boolean;
function isEmpty(vnode: VirtualElement): boolean;
function isSameThunk(prevNode: VirtualElement, nextNode: VirtualElement): boolean;
// function isValidAttribute<A>(value: A): boolean;
/**
* Create a node path, eg. (23,5,2,4) => '23.5.2.4'
*/
function createPath(...paths: (number|string)[]): string;
}
}
interface Model {
props?: any,
children?: any[],
path?: string,
dispatch?: Dispatch,
context?: any
}
interface Component {
render: (model: Model) => deku.VirtualElement;
onCreate?: (model: Model) => any;
onUpdate?: (model: Model) => any;
onRemove?: (model: Model) => any;
}
/**
* Thunk object passed to `element`
*/
type Thunk = Component | ((model: Model) => deku.VirtualElement);
type Render = (vnode: deku.VirtualElement, context?: any) => void;
type Dispatch = (action: any) => any;
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"deku-tests.ts"
]
}
+1
View File
@@ -623,6 +623,7 @@ declare namespace createjs {
primary: boolean;
rawX: number;
rawY: number;
relatedTarget: DisplayObject;
stageX: number;
stageY: number;
mouseMoveOutside: boolean;
+1 -1
View File
@@ -2850,7 +2850,7 @@ declare namespace Electron {
interface StringProtocolCallback extends ProtocolCallback {
(str: string): void;
(obj: {
data: Buffer,
data: string,
mimeType: string,
charset?: string
}): void;
+2 -1
View File
@@ -20,10 +20,11 @@ declare namespace libphonenumber {
parse(number: string, region: string): PhoneNumber;
isValidNumber(phoneNumber: PhoneNumber): boolean;
isPossibleNumber(phoneNumber: PhoneNumber): boolean;
isValidNumberForRegion(phoneNumber: PhoneNumber): boolean;
isValidNumberForRegion(phoneNumber: PhoneNumber, region: string): boolean;
getRegionCodeForNumber(phoneNumber: PhoneNumber): string;
isNANPACountry(regionCode: string): boolean;
format(phoneNumber: PhoneNumber, format: PhoneNumberFormat): string;
parseAndKeepRawInput(number: string, regionCode: string): PhoneNumber;
}
export class AsYouTypeFormatter {
@@ -156,10 +156,17 @@ function test_areaChart() {
['2016', 1030, 540]
]);
var options = {
var options:google.visualization.AreaChartOptions = {
title: 'Company Performance',
hAxis: {title: 'Year', titleTextStyle: {color: '#333'}},
vAxis: {minValue: 0}
vAxis: {minValue: 0},
annotations: {
textStyle: {
bold: true,
italic: true,
color: "black"
}
}
};
var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
@@ -510,3 +517,107 @@ function test_ChartsLoad() {
google.charts.setOnLoadCallback(drawChart);
}
function test_ChartAnnotations() {
var annotations:google.visualization.ChartAnnotations = {
boxStyle: {
// Color of the box outline.
stroke: '#888',
// Thickness of the box outline.
strokeWidth: 1,
// x-radius of the corner curvature.
rx: 10,
// y-radius of the corner curvature.
ry: 10,
// Attributes for linear gradient fill.
gradient: {
// Start color for gradient.
color1: '#fbf6a7',
// Finish color for gradient.
color2: '#33b679',
// Where on the boundary to start and
// end the color1/color2 gradient,
// relative to the upper left corner
// of the boundary.
x1: '0%', y1: '0%',
x2: '100%', y2: '100%',
// If true, the boundary for x1,
// y1, x2, and y2 is the box. If
// false, it's the entire chart.
useObjectBoundingBoxUnits: true
}
},
datum: {
stem: {
color: 'black',
length: 12
},
style: 'point'
},
domain: {
stem: {
color: 'black',
length: 5
},
style: 'point'
},
highContrast: true,
stem: {
color: 'black',
length: 5
},
style: 'line',
textStyle: {
fontName: 'Times-Roman',
fontSize: 18,
bold: true,
italic: true,
// The color of the text.
color: '#871b47',
// The color of the text outline.
auraColor: '#d799ae',
// The transparency of the text.
opacity: 0.8
}
};
var barAnnotations:google.visualization.ChartBarColumnAnnotations = {
alwaysOutside: true,
textStyle: {
fontName: 'Times-Roman',
fontSize: 18,
bold: true
}
};
}
function test_OrgChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Name');
data.addColumn('string', 'Manager');
data.addColumn('string', 'ToolTip');
// For each orgchart box, provide the name, manager, and tooltip to show.
data.addRows([
[{v:'Mike', f:'Mike<div style="color:red; font-style:italic">President</div>'}, '', 'The President'],
[{v:'Jim', f:'Jim<div style="color:red; font-style:italic">Vice President</div>'}, 'Mike', 'VP'],
['Alice', 'Mike', ''],
['Bob', 'Jim', 'Bob Sponge'],
['Carol', 'Bob', '']
]);
var chart = new google.visualization.OrgChart(document.getElementById('chart_div'));
chart.draw(data, {
allowCollapse: true,
allowHtml: true,
nodeClass: 'node',
selectedNodeClass: 'selected',
size: 'small'
});
chart.collapse(1, true);
var children = chart.getChildrenIndexes(0);
var collapsed = chart.getCollapsedNodes();
}
+51 -3
View File
@@ -1,6 +1,6 @@
// Type definitions for Google Visualisation Apis
// Project: https://developers.google.com/chart/
// Definitions by: Dan Ludwig <https://github.com/danludwig>, Gregory Moore <https://github.com/gmoore-sjcorg>
// Definitions by: Dan Ludwig <https://github.com/danludwig>, Gregory Moore <https://github.com/gmoore-sjcorg>, Dan Manastireanu <https://github.com/danmana>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace google {
@@ -331,6 +331,25 @@ declare namespace google {
export interface ChartAnnotations {
boxStyle?: ChartBoxStyle;
textStyle?: ChartTextStyle;
datum?: ChartStemAndStyle;
domain?: ChartStemAndStyle;
highContrast?: boolean;
stem?: ChartStem;
style?: string; // 'line' or 'point'
}
export interface ChartBarColumnAnnotations extends ChartAnnotations {
alwaysOutside?: boolean;
}
export interface ChartStemAndStyle {
stem?: ChartStem;
style?: string;
}
export interface ChartStem {
color?: string;
length?: number;
}
export interface ChartBoxStyle {
@@ -565,7 +584,7 @@ declare namespace google {
export interface ColumnChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
annotations?: ChartAnnotations;
annotations?: ChartBarColumnAnnotations;
axisTitlesPosition?: string; // in, out, none
backgroundColor?: any;
bar?: GroupWidth;
@@ -645,7 +664,7 @@ declare namespace google {
export interface BarChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
annotations?: ChartAnnotations;
annotations?: ChartBarColumnAnnotations;
axisTitlesPosition?: string; // in, out, none
backgroundColor?: any;
bar?: GroupWidth;
@@ -739,6 +758,7 @@ declare namespace google {
export interface AreaChartOptions {
aggregationTarget?: string;
animation?: TransitionAnimation;
annotations?: ChartAnnotations;
areaOpacity?: number;
axisTitlesPosition?: string;
backgroundColor?: any;
@@ -1357,6 +1377,34 @@ declare namespace google {
format(dataTable: DataTable, srcColumnIndices: number[], opt_dstColumnIndex?: number): void;
}
//#endregion
//#region OrgChart
// https://google-developers.appspot.com/chart/interactive/docs/gallery/orgchart
export class OrgChart extends CoreChartBase {
draw(data: DataTable, options: OrgChartOptions): void;
draw(data: DataView, options: OrgChartOptions): void;
collapse(row: number, collapsed: boolean): void;
getChildrenIndexes(row: number): number[];
getCollapsedNodes(): number[];
}
// https://google-developers.appspot.com/chart/interactive/docs/gallery/orgchart#Configuration_Options
export interface OrgChartOptions {
allowCollapse?: boolean;
allowHtml?: boolean;
color?: string;
nodeClass?: string;
selectedNodeClass?: string;
selectionColor?: string;
/**
* Chart size
* @type {('small'|'medium'|'large')}
* @default 'medium'
*/
size?: string;
}
//#endregion
}
}
+1 -1
View File
@@ -14,6 +14,6 @@
},
"files": [
"index.d.ts",
"Headroom-tests.ts"
"headroom-tests.ts"
]
}
+1 -1
View File
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
+4 -3
View File
@@ -125,10 +125,10 @@ export interface IPOptions {
}
export interface ValidationError extends Error {
message: string;
isJoi: boolean;
details: ValidationErrorItem[];
simple(): string;
annotated(): string;
annotate(): string;
_object: any;
}
export interface ValidationErrorItem {
@@ -136,6 +136,7 @@ export interface ValidationErrorItem {
type: string;
path: string;
options?: ValidationOptions;
context?: any;
}
export interface ValidationResult<T> {
+2 -1
View File
@@ -126,7 +126,8 @@ validErrItem = {
message: str,
type: str,
path: str,
options: validOpts
options: validOpts,
context: obj
};
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
+1 -1
View File
@@ -14,6 +14,6 @@
},
"files": [
"index.d.ts",
"jquery.slimScroll-tests.ts"
"jquery.slimscroll-tests.ts"
]
}
@@ -1,5 +1,3 @@
/// <reference path="jstimezonedetect.d.ts" />
import * as jstz from 'jstimezonedetect';
jstz.determine().name() === 'America/Montreal';
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"jstimezonedetect-tests.ts"
]
}
+1 -1
View File
@@ -5,7 +5,7 @@
],
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
+25 -2
View File
@@ -1222,12 +1222,35 @@ declare namespace L {
}
export namespace DomEvent {
export function on(el: HTMLElement, types: string, fn: Function, context?: Object): typeof DomEvent;
export function on(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: Object): typeof DomEvent;
export function on(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent;
export function off(el: HTMLElement, types: string, fn: Function, context?: Object): typeof DomEvent;
export function off(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: Object): typeof DomEvent;
export function off(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent;
export function stopPropagation(ev: Event): typeof DomEvent;
export function disableScrollPropagation(el: HTMLElement): typeof DomEvent;
export function disableClickPropagation(el: HTMLElement): typeof DomEvent;
export function preventDefault(ev: Event): typeof DomEvent;
export function stop(ev: Event): typeof DomEvent;
export function getMousePosition(ev: Event, container?: HTMLElement): Point;
export function getWheelDelta(ev: Event): number;
export function addListener(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: Object): typeof DomEvent;
export function addListener(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent;
export function removeListener(el: HTMLElement, types: string, fn: (ev: Event) => any, context?: Object): typeof DomEvent;
export function removeListener(el: HTMLElement, eventMap: {[eventName: string]: Function}, context?: Object): typeof DomEvent;
}
interface DefaultMapPanes {
+18 -6
View File
@@ -208,12 +208,24 @@ tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOpti
tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''});
let eventHandler = () => {};
L.DomEvent.on(htmlElement, 'click', eventHandler);
L.DomEvent.off(htmlElement, 'click', eventHandler);
L.DomEvent.on(htmlElement, { 'click': eventHandler });
L.DomEvent.off(htmlElement, { 'click': eventHandler }, eventHandler);
L.DomEvent.disableScrollPropagation(htmlElement);
L.DomEvent.disableClickPropagation(htmlElement);
let domEvent: Event = {} as Event;
L.DomEvent
.on(htmlElement, 'click', eventHandler)
.addListener(htmlElement, 'click', eventHandler)
.off(htmlElement, 'click', eventHandler)
.removeListener(htmlElement, 'click', eventHandler)
.on(htmlElement, {'click': eventHandler})
.addListener(htmlElement, {'click': eventHandler})
.off(htmlElement, {'click': eventHandler}, eventHandler)
.removeListener(htmlElement, {'click': eventHandler}, eventHandler)
.stopPropagation(domEvent)
.disableScrollPropagation(htmlElement)
.disableClickPropagation(htmlElement)
.preventDefault(domEvent)
.stop(domEvent);
point = L.DomEvent.getMousePosition(domEvent);
point = L.DomEvent.getMousePosition(domEvent, htmlElement);
const wheelDelta: number = L.DomEvent.getWheelDelta(domEvent);
map = map
// addControl
+1 -1
View File
@@ -14,6 +14,6 @@
},
"files": [
"index.d.ts",
"leapmotionTS-tests.ts"
"leapmotionts-tests.ts"
]
}
+6 -6
View File
@@ -17,13 +17,13 @@ export declare function parseHtmlString(source: string): HTMLDocument;
export declare class XMLDocument {
constructor(version: number, encoding: string);
child(idx: number): Element;
child(idx: number): Element | undefined;
childNodes(): Element[];
errors(): SyntaxError[];
encoding(): string;
encoding(enc: string): void;
find(xpath: string): Element[];
get(xpath: string): Element;
get(xpath: string): Element | undefined;
node(name: string, content: string): Element;
root(): Element;
toString(): string;
@@ -48,7 +48,7 @@ export declare class Element {
attrs(): Attribute[];
parent(): Element;
doc(): XMLDocument;
child(idx: number): Element;
child(idx: number): Element | undefined;
childNodes(): Element[];
addChild(child: Element): Element;
nextSibling(): Element;
@@ -60,9 +60,9 @@ export declare class Element {
find(xpath: string): Element[];
find(xpath: string, ns_uri: string): Element[];
find(xpath: string, namespaces: { [key: string]: string; }): Element[];
get(xpath: string): Element;
get(xpath: string, ns_uri: string): Element;
get(xpath: string, ns_uri: { [key: string]: string; }): Element;
get(xpath: string): Element | undefined;
get(xpath: string, ns_uri: string): Element | undefined;
get(xpath: string, ns_uri: { [key: string]: string; }): Element | undefined;
defineNamespace(href: string): Namespace;
defineNamespace(prefix: string, href: string): Namespace;
namespace(): Namespace;
+3 -3
View File
@@ -8,7 +8,7 @@
export interface Loader {
path: string;
query: string;
request: any;
request: string;
options: any;
normal: any;
pitch: any;
@@ -24,12 +24,12 @@ export interface RunLoaderOption {
resource: string;
loaders: any[];
context: any;
readResource: (filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void) => void;
readResource: (filename: string, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void) => void;
}
export function runLoaders(
options: RunLoaderOption,
callback: (err: NodeJS.ErrnoException, result: any) => any
callback: (err: NodeJS.ErrnoException | null, result: any) => any
): void;
+2 -1
View File
@@ -3,7 +3,8 @@ import { runLoaders, getContext, Loader, RunLoaderOption } from 'loader-runner';
const option = {} as RunLoaderOption;
runLoaders(option, function (err, result) {
console.log(err, result);
if(err)
console.log(err, result);
});
getContext('sdlfkjaldfjiojsdf');
+1 -1
View File
@@ -290,7 +290,7 @@
],
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
+31 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for lz-string v1.3.3
// Type definitions for lz-string v1.3.5
// Project: https://github.com/pieroxy/lz-string
// Definitions by: Roman Nikitin <https://github.com/M0ns1gn0r>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -57,5 +57,35 @@ declare namespace LZString {
* @param compressed A string obtained from a call to compressToBase64().
*/
decompressFromBase64(compressed: string): string;
/**
* produces ASCII strings representing the original string encoded in Base64 with a few
* tweaks to make these URI safe. Hence, you can send them to the server without thinking
* about URL encoding them. This saves bandwidth and CPU
*
* @param uncompressed A string which should be compressed.
*/
compressToEncodedURIComponent(uncompressed: string): string;
/**
* Decompresses "valid" input string created by the method compressToEncodedURIComponent().
*
* @param compressed A string obtained from a call to compressToEncodedURIComponent().
*/
decompressFromEncodedURIComponent(compressed: string): string;
/**
* produces an uint8Array
*
* @param uncompressed A string which should be compressed.
*/
compressToUint8Array(uncompressed: string): Uint8Array;
/**
* Decompresses "valid" array created by the method compressToUint8Array().
*
* @param compressed A string obtained from a call to compressToUint8Array().
*/
decompressFromUint8Array(compressed: Uint8Array): string;
}
}
+6 -1
View File
@@ -3,10 +3,15 @@
var input = "Someting to compress";
var encoded: string;
var decoded: string;
var encodedU8: Uint8Array;
encoded = LZString.compress(input);
decoded = LZString.decompress(encoded);
encoded = LZString.compressToUTF16(input);
decoded = LZString.decompressFromUTF16(encoded);
encoded = LZString.compressToBase64(input);
decoded = LZString.decompressFromBase64(encoded);
decoded = LZString.decompressFromBase64(encoded);
encoded = LZString.compressToEncodedURIComponent(input);
decoded = LZString.compressToEncodedURIComponent(encoded);
encodedU8 = LZString.compressToUint8Array(input);
decoded = LZString.decompressFromUint8Array(encodedU8);
+1 -1
View File
@@ -141,7 +141,7 @@ declare namespace __MaterialUI {
fontFamily?: string;
palette?: ThemePalette;
isRtl?: boolean;
userAgent?: string;
userAgent?: string | boolean;
zIndex?: zIndex;
baseTheme?: RawTheme;
rawTheme?: RawTheme;
+1 -1
View File
@@ -871,7 +871,7 @@ declare module "mongoose" {
/** Hash containing current validation errors. */
errors: Object;
/** This documents _id. */
_id: mongodb.ObjectID;
_id: any;
/** Boolean flag specifying if the document is new. */
isNew: boolean;
/** The documents schema. */
+2 -1
View File
@@ -9,7 +9,8 @@
"../"
],
"types": [],
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"fs.d.ts",
+74 -5
View File
@@ -214,6 +214,67 @@ export class RecurrenceRule {
nextInvocationDate(base:Date):Date;
}
/**
* Recurrence rule specification.
*/
export interface RecurrenceSpec {
/**
* Day of the month.
*
* @public
* @type {RecurrenceSegment}
*/
date?: RecurrenceSegment;
/**
* Day of the week.
*
* @public
* @type {RecurrenceSegment}
*/
dayOfWeek?: RecurrenceSegment;
/**
* Hour.
*
* @public
* @type {RecurrenceSegment}
*/
hour?: RecurrenceSegment;
/**
* Minute.
*
* @public
* @type {RecurrenceSegment}
*/
minute?: RecurrenceSegment;
/**
* Month.
*
* @public
* @type {RecurrenceSegment}
*/
month?: RecurrenceSegment;
/**
* Second.
*
* @public
* @type {RecurrenceSegment}
*/
second?: RecurrenceSegment;
/**
* Year.
*
* @public
* @type {RecurrenceSegment}
*/
year?: RecurrenceSegment;
}
/**
* Invocation.
*
@@ -266,11 +327,19 @@ export class Invocation {
/**
* Create a schedule job.
*
* @param {string|RecurrenceRule|Date} name either an optional name for the new Job or scheduling information
* @param {RecurrenceRule|Date|string} rule either the scheduling info or the JobCallback
* @param {JobCallback} callback The callback to be executed on each invocation.
* @param {string} name name for the new Job
* @param {RecurrenceRule|RecurrenceSpec|Date|string} rule scheduling info
* @param {JobCallback} callback callback to be executed on each invocation
*/
export function scheduleJob(name:string|RecurrenceRule|Date, rule: RecurrenceRule|Date|string|JobCallback, callback?: JobCallback): Job;
export function scheduleJob(name: string, rule: RecurrenceRule | RecurrenceSpec | Date | string, callback: JobCallback): Job;
/**
* Create a schedule job.
*
* @param {RecurrenceRule|RecurrenceSpec|Date|string} rule scheduling info
* @param {JobCallback} callback callback to be executed on each invocation
*/
export function scheduleJob(rule: RecurrenceRule | RecurrenceSpec | Date | string, callback: JobCallback): Job;
/**
* Changes the timing of a Job, canceling all pending invocations.
@@ -279,7 +348,7 @@ export class Invocation {
* @param spec {JobCallback} the new timing for this Job
* @return {Job} if the job could be rescheduled, {null} otherwise.
*/
export function rescheduleJob(job:Job|string, spec:RecurrenceRule|Date|string):Job;
export function rescheduleJob(job: Job | string, spec: RecurrenceRule | RecurrenceSpec | Date | string): Job;
/**
* Dictionary of all Jobs, accessible by name.
+1 -1
View File
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
+20 -22
View File
@@ -1,36 +1,34 @@
// Type definitions for ora v0.3.0
// Project: https://github.com/sindresorhus/ora
// Definitions by: Basarat Ali Syed <https://github.com/basarat/>
// Definitions by: Basarat Ali Syed <https://github.com/basarat/>, Christian Rackerseder <https://www.echooff.de/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray';
type Text = string;
interface Options {
text?: Text;
spinner?: string | Spinner;
text?: string;
spinner?: string | Spinner;
color?: Color;
interval?: number;
stream?: NodeJS.WritableStream;
enabled?: boolean;
}
interface Spinner {
interval?: number;
frames: string[];
interval?: number;
stream?: NodeJS.WritableStream;
enabled?: boolean;
}
interface Spinner {
interval?: number;
frames: string[];
}
interface Instance {
start(): Instance;
stop(): Instance;
succeed(): Instance;
fail(): Instance;
stopAndPersist(symbol?: string): Instance;
clear(): Instance;
render(): Instance;
frame(): Instance;
text: string;
start(): Instance;
stop(): Instance;
succeed(): Instance;
fail(): Instance;
stopAndPersist(symbol?: string): Instance;
clear(): Instance;
render(): Instance;
frame(): Instance;
text: string;
color: Color;
}
declare function ora(options: Options | Text): Instance;
declare function ora(options: Options | string): Instance;
export = ora;
+1 -2
View File
@@ -1,7 +1,6 @@
import ora = require('ora');
const spinner = ora('Loading unicorns');
spinner.start();
const spinner = ora('Loading unicorns').start();
setTimeout(() => {
spinner.color = 'yellow';
@@ -23,6 +23,7 @@ import { Strategy as LocalStrategy } from 'passport-local';
//#region Test Models
interface User extends PassportLocalDocument {
_id: string;
username: string;
hash: string;
salt: string;
+1
View File
@@ -540,6 +540,7 @@ declare namespace ReactBootstrap {
brand?: any; // TODO: Add more specific type
bsSize?: Sizes;
bsStyle?: string;
collapseOnSelect?: boolean;
componentClass?: React.ReactType;
defaultNavExpanded?: boolean;
fixedBottom?: boolean;
+5 -6
View File
@@ -7,14 +7,11 @@
import * as React from "react";
declare var Helmet: {
(): ReactHelmet.HelmetComponent
rewind(): ReactHelmet.HelmetData
}
export = Helmet;
declare function ReactHelmet(): ReactHelmet.HelmetComponent;
declare namespace ReactHelmet {
function rewind(): ReactHelmet.HelmetData;
interface HelmetProps {
base?: any;
defaultTitle?: string;
@@ -43,3 +40,5 @@ declare namespace ReactHelmet {
class HelmetComponent extends React.Component<HelmetProps, any> {}
}
export = ReactHelmet;
+6
View File
@@ -39,3 +39,9 @@ function HTML() {
</html>
);
}
function log(datum: Helmet.HelmetDatum) {
return console.log('logging a helmet datum:', datum.toString());
}
log(head.title);
+1 -1
View File
@@ -15,6 +15,6 @@
},
"files": [
"index.d.ts",
"react-json-tree-tests.ts"
"react-json-tree-tests.tsx"
]
}
+3 -1
View File
@@ -1,8 +1,10 @@
// Type definitions for react-router v2.0.0
// Project: https://github.com/rackt/react-router
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>, Nathan Brown <https://github.com/ngbrown>, Alex Wendland <https://github.com/awendland>
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>, Nathan Brown <https://github.com/ngbrown>, Alex Wendland <https://github.com/awendland>, Kostya Esmukov <https://github.com/KostyaEsmukov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="history" />
export as namespace ReactRouter;
import * as React from 'react';
+11 -9
View File
@@ -1,4 +1,5 @@
import * as React from 'react';
import RouterContext from './RouterContext';
import {
QueryString, Query,
Location, LocationDescriptor, LocationState,
@@ -48,16 +49,17 @@ declare namespace Router {
components: RouteComponent[];
}
interface RouterProps extends React.Props<Router> {
history?: History;
routes?: RouteConfig; // alias for children
createElement?: (component: RouteComponent, props: Object) => any;
onError?: (error: any) => any;
onUpdate?: () => any;
parseQueryString?: ParseQueryString;
stringifyQuery?: StringifyQuery;
interface RouterProps extends React.Props<Router> {
history?: History;
routes?: RouteConfig; // alias for children
createElement?: (component: RouteComponent, props: Object) => any;
onError?: (error: any) => any;
onUpdate?: () => any;
parseQueryString?: ParseQueryString;
stringifyQuery?: StringifyQuery;
basename?: string;
}
render?: (renderProps: React.Props<{}>) => RouterContext;
}
interface PlainRoute {
path?: RoutePattern;
+5 -3
View File
@@ -1,7 +1,9 @@
import * as React from 'react';
import Router from './Router';
import RouterContext from './RouterContext';
export interface Middleware {
renderRouterContext: (previous: React.Props<{}>[], props: React.Props<{}>) => React.Props<{}>[];
renderRouteComponent: (previous: React.Props<{}>[], props: React.Props<{}>) => React.Props<{}>[];
renderRouterContext?: (previous: RouterContext, props: React.Props<{}>) => RouterContext;
renderRouteComponent?: (previous: Router.RouteComponent, props: React.Props<{}>) => Router.RouteComponent;
}
export default function applyRouterMiddleware(...middlewares: Middleware[]): (renderProps: React.Props<{}>) => React.Props<{}>[];
export default function applyRouterMiddleware(...middlewares: Middleware[]): (renderProps: React.Props<{}>) => RouterContext;
+13 -1
View File
@@ -2,7 +2,7 @@ import * as React from "react"
import * as ReactDOM from "react-dom"
import {renderToString} from "react-dom/server";
import { browserHistory, hashHistory, match, createMemoryHistory, withRouter, routerShape, Router, Route, IndexRoute, InjectedRouter, Link, RouterOnContext, RouterContext} from "react-router";
import { applyRouterMiddleware, browserHistory, hashHistory, match, createMemoryHistory, withRouter, routerShape, Router, Route, IndexRoute, InjectedRouter, Link, RouterOnContext, RouterContext} from "react-router";
interface MasterContext {
router: RouterOnContext;
@@ -105,3 +105,15 @@ const routes = (
match({history, routes, location: "baseurl"}, (error, redirectLocation, renderProps) => {
renderToString(<RouterContext {...renderProps} />);
});
ReactDOM.render((
<Router
history={history}
routes={routes}
render={applyRouterMiddleware({
renderRouteComponent: child => child
})}
>
</Router>
), document.body);
+71 -6
View File
@@ -28,7 +28,7 @@ declare namespace React {
interface ReactElement<P> {
type: string | ComponentClass<P> | SFC<P>;
props: P;
key?: Key;
key: Key | null;
}
interface SFCElement<P> extends ReactElement<P> {
@@ -74,7 +74,7 @@ declare namespace React {
type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>;
interface DOMFactory<P extends DOMAttributes<T>, T extends Element> {
(props?: P & ClassAttributes<T>, ...children: ReactNode[]): DOMElement<P, T>;
(props?: P & ClassAttributes<T> | null, ...children: ReactNode[]): DOMElement<P, T>;
}
interface HTMLFactory<T extends HTMLElement> extends DOMFactory<HTMLAttributes<T>, T> {
@@ -93,7 +93,7 @@ declare namespace React {
// Should be Array<ReactNode> but type aliases cannot be recursive
type ReactFragment = {} | Array<ReactChild | any[] | boolean>;
type ReactNode = ReactChild | ReactFragment | boolean;
type ReactNode = ReactChild | ReactFragment | boolean | null | undefined;
//
// Top Level API
@@ -201,7 +201,7 @@ declare namespace React {
type SFC<P> = StatelessComponent<P>;
interface StatelessComponent<P> {
(props: P, context?: any): ReactElement<any> | null;
(props: P & { children?: ReactNode }, context?: any): ReactElement<any>;
propTypes?: ValidationMap<P>;
contextTypes?: ValidationMap<any>;
defaultProps?: P;
@@ -262,7 +262,7 @@ declare namespace React {
}
interface ComponentSpec<P, S> extends Mixin<P, S> {
render(): ReactElement<any>;
render(): ReactElement<any> | null;
[propertyName: string]: any;
}
@@ -436,98 +436,163 @@ declare namespace React {
// Clipboard Events
onCopy?: ClipboardEventHandler<T>;
onCopyCapture?: ClipboardEventHandler<T>;
onCut?: ClipboardEventHandler<T>;
onCutCapture?: ClipboardEventHandler<T>;
onPaste?: ClipboardEventHandler<T>;
onPasteCapture?: ClipboardEventHandler<T>;
// Composition Events
onCompositionEnd?: CompositionEventHandler<T>;
onCompositionEndCapture?: CompositionEventHandler<T>;
onCompositionStart?: CompositionEventHandler<T>;
onCompositionStartCapture?: CompositionEventHandler<T>;
onCompositionUpdate?: CompositionEventHandler<T>;
onCompositionUpdateCapture?: CompositionEventHandler<T>;
// Focus Events
onFocus?: FocusEventHandler<T>;
onFocusCapture?: FocusEventHandler<T>;
onBlur?: FocusEventHandler<T>;
onBlurCapture?: FocusEventHandler<T>;
// Form Events
onChange?: FormEventHandler<T>;
onChangeCapture?: FormEventHandler<T>;
onInput?: FormEventHandler<T>;
onInputCapture?: FormEventHandler<T>;
onSubmit?: FormEventHandler<T>;
onSubmitCapture?: FormEventHandler<T>;
// Image Events
onLoad?: ReactEventHandler<T>;
onLoadCapture?: ReactEventHandler<T>;
onError?: ReactEventHandler<T>; // also a Media Event
onErrorCapture?: ReactEventHandler<T>; // also a Media Event
// Keyboard Events
onKeyDown?: KeyboardEventHandler<T>;
onKeyDownCapture?: KeyboardEventHandler<T>;
onKeyPress?: KeyboardEventHandler<T>;
onKeyPressCapture?: KeyboardEventHandler<T>;
onKeyUp?: KeyboardEventHandler<T>;
onKeyUpCapture?: KeyboardEventHandler<T>;
// Media Events
onAbort?: ReactEventHandler<T>;
onAbortCapture?: ReactEventHandler<T>;
onCanPlay?: ReactEventHandler<T>;
onCanPlayCapture?: ReactEventHandler<T>;
onCanPlayThrough?: ReactEventHandler<T>;
onCanPlayThroughCapture?: ReactEventHandler<T>;
onDurationChange?: ReactEventHandler<T>;
onDurationChangeCapture?: ReactEventHandler<T>;
onEmptied?: ReactEventHandler<T>;
onEmptiedCapture?: ReactEventHandler<T>;
onEncrypted?: ReactEventHandler<T>;
onEncryptedCapture?: ReactEventHandler<T>;
onEnded?: ReactEventHandler<T>;
onEndedCapture?: ReactEventHandler<T>;
onLoadedData?: ReactEventHandler<T>;
onLoadedDataCapture?: ReactEventHandler<T>;
onLoadedMetadata?: ReactEventHandler<T>;
onLoadedMetadataCapture?: ReactEventHandler<T>;
onLoadStart?: ReactEventHandler<T>;
onLoadStartCapture?: ReactEventHandler<T>;
onPause?: ReactEventHandler<T>;
onPauseCapture?: ReactEventHandler<T>;
onPlay?: ReactEventHandler<T>;
onPlayCapture?: ReactEventHandler<T>;
onPlaying?: ReactEventHandler<T>;
onPlayingCapture?: ReactEventHandler<T>;
onProgress?: ReactEventHandler<T>;
onProgressCapture?: ReactEventHandler<T>;
onRateChange?: ReactEventHandler<T>;
onRateChangeCapture?: ReactEventHandler<T>;
onSeeked?: ReactEventHandler<T>;
onSeekedCapture?: ReactEventHandler<T>;
onSeeking?: ReactEventHandler<T>;
onSeekingCapture?: ReactEventHandler<T>;
onStalled?: ReactEventHandler<T>;
onStalledCapture?: ReactEventHandler<T>;
onSuspend?: ReactEventHandler<T>;
onSuspendCapture?: ReactEventHandler<T>;
onTimeUpdate?: ReactEventHandler<T>;
onTimeUpdateCapture?: ReactEventHandler<T>;
onVolumeChange?: ReactEventHandler<T>;
onVolumeChangeCapture?: ReactEventHandler<T>;
onWaiting?: ReactEventHandler<T>;
onWaitingCapture?: ReactEventHandler<T>;
// MouseEvents
onClick?: MouseEventHandler<T>;
onClickCapture?: MouseEventHandler<T>;
onContextMenu?: MouseEventHandler<T>;
onContextMenuCapture?: MouseEventHandler<T>;
onDoubleClick?: MouseEventHandler<T>;
onDoubleClickCapture?: MouseEventHandler<T>;
onDrag?: DragEventHandler<T>;
onDragCapture?: DragEventHandler<T>;
onDragEnd?: DragEventHandler<T>;
onDragEndCapture?: DragEventHandler<T>;
onDragEnter?: DragEventHandler<T>;
onDragEnterCapture?: DragEventHandler<T>;
onDragExit?: DragEventHandler<T>;
onDragExitCapture?: DragEventHandler<T>;
onDragLeave?: DragEventHandler<T>;
onDragLeaveCapture?: DragEventHandler<T>;
onDragOver?: DragEventHandler<T>;
onDragOverCapture?: DragEventHandler<T>;
onDragStart?: DragEventHandler<T>;
onDragStartCapture?: DragEventHandler<T>;
onDrop?: DragEventHandler<T>;
onDropCapture?: DragEventHandler<T>;
onMouseDown?: MouseEventHandler<T>;
onMouseDownCapture?: MouseEventHandler<T>;
onMouseEnter?: MouseEventHandler<T>;
onMouseLeave?: MouseEventHandler<T>;
onMouseMove?: MouseEventHandler<T>;
onMouseMoveCapture?: MouseEventHandler<T>;
onMouseOut?: MouseEventHandler<T>;
onMouseOutCapture?: MouseEventHandler<T>;
onMouseOver?: MouseEventHandler<T>;
onMouseOverCapture?: MouseEventHandler<T>;
onMouseUp?: MouseEventHandler<T>;
onMouseUpCapture?: MouseEventHandler<T>;
// Selection Events
onSelect?: ReactEventHandler<T>;
onSelectCapture?: ReactEventHandler<T>;
// Touch Events
onTouchCancel?: TouchEventHandler<T>;
onTouchCancelCapture?: TouchEventHandler<T>;
onTouchEnd?: TouchEventHandler<T>;
onTouchEndCapture?: TouchEventHandler<T>;
onTouchMove?: TouchEventHandler<T>;
onTouchMoveCapture?: TouchEventHandler<T>;
onTouchStart?: TouchEventHandler<T>;
onTouchStartCapture?: TouchEventHandler<T>;
// UI Events
onScroll?: UIEventHandler<T>;
onScrollCapture?: UIEventHandler<T>;
// Wheel Events
onWheel?: WheelEventHandler<T>;
onWheelCapture?: WheelEventHandler<T>;
// Animation Events
onAnimationStart?: AnimationEventHandler;
onAnimationStartCapture?: AnimationEventHandler;
onAnimationEnd?: AnimationEventHandler;
onAnimationEndCapture?: AnimationEventHandler;
onAnimationIteration?: AnimationEventHandler;
onAnimationIterationCapture?: AnimationEventHandler;
// Transition Events
onTransitionEnd?: TransitionEventHandler;
onTransitionEndCapture?: TransitionEventHandler;
}
// This interface is not complete. Only properties accepting
@@ -2289,7 +2354,7 @@ declare namespace React {
// ----------------------------------------------------------------------
interface Validator<T> {
(object: T, key: string, componentName: string, ...rest: any[]): Error;
(object: T, key: string, componentName: string, ...rest: any[]): Error | null;
}
interface Requireable<T> extends Validator<T> {
+39 -26
View File
@@ -41,7 +41,7 @@ var props: Props & React.ClassAttributes<{}> = {
foo: 42
};
var container: Element;
var container: Element = document.createElement("div");
//
// Top-Level API
@@ -49,11 +49,12 @@ var container: Element;
var ClassicComponent: React.ClassicComponentClass<Props> =
React.createClass<Props, State>({
displayName: "ClassicComponent",
getDefaultProps() {
return {
hello: undefined,
hello: "hello",
world: "peace",
foo: undefined
foo: 0,
};
},
getInitialState() {
@@ -151,6 +152,10 @@ StatelessComponent2.defaultProps = {
foo: 42
};
var StatelessComponent3: React.SFC<SCProps> =
// allows usage of props.children
props => React.DOM.div(null, props.foo, props.children);
// React.createFactory
var factory: React.CFactory<Props, ModernComponent> =
React.createFactory(ModernComponent);
@@ -187,6 +192,10 @@ var domElement: React.ReactHTMLElement<HTMLDivElement> =
// React.cloneElement
var clonedElement: React.CElement<Props, ModernComponent> =
React.cloneElement(element, { foo: 43 });
React.cloneElement(element, {});
React.cloneElement(element, {}, null);
var clonedElement2: React.CElement<Props, ModernComponent> =
// known problem: cloning with key or ref requires cast
React.cloneElement(element, <React.ClassAttributes<ModernComponent>>{
@@ -240,18 +249,15 @@ domNode = ReactDOM.findDOMNode(domNode);
var type: React.ComponentClass<Props> = element.type;
var elementProps: Props = element.props;
var key: React.Key = element.key;
var t: React.ReactType;
var name = typeof t === "string" ? t : t.displayName;
var key = element.key;
//
// React Components
// --------------------------------------------------------------------------
var displayName: string = ClassicComponent.displayName;
var defaultProps: Props = ClassicComponent.getDefaultProps();
var propTypes: React.ValidationMap<Props> = ClassicComponent.propTypes;
var displayName: string | undefined = ClassicComponent.displayName;
var defaultProps: Props = ClassicComponent.getDefaultProps ? ClassicComponent.getDefaultProps() : <Props>{};
var propTypes: React.ValidationMap<Props> | undefined = ClassicComponent.propTypes;
//
// Component API
@@ -282,7 +288,7 @@ class RefComponent extends React.Component<RCProps, {}> {
}
}
var componentRef: RefComponent;
var componentRef: RefComponent = new RefComponent();
RefComponent.create({ ref: "componentRef" });
// type of c should be inferred
RefComponent.create({ ref: c => componentRef = c });
@@ -315,6 +321,10 @@ var htmlAttr: React.HTMLProps<HTMLElement> = {
event.preventDefault();
event.stopPropagation();
},
onClickCapture: (event: React.MouseEvent<{}>) => {
event.preventDefault();
event.stopPropagation();
},
dangerouslySetInnerHTML: {
__html: "<strong>STRONG</strong>"
}
@@ -373,14 +383,14 @@ var PropTypesSpecification: React.ComponentSpec<any, any> = {
}),
requiredFunc: React.PropTypes.func.isRequired,
requiredAny: React.PropTypes.any.isRequired,
customProp: function(props: any, propName: string, componentName: string) {
customProp: function(props: any, propName: string, componentName: string): Error | null {
if (!/matchme/.test(props[propName])) {
return new Error("Validation failed!");
}
return null;
},
// https://facebook.github.io/react/warnings/dont-call-proptypes.html#fixing-the-false-positive-in-third-party-proptypes
percentage: (object: any, key: string, componentName: string, ...rest: any[]): Error => {
percentage: (object: any, key: string, componentName: string, ...rest: any[]): Error | null => {
const error = React.PropTypes.number(object, key, componentName, ...rest);
if (error) {
return error;
@@ -391,7 +401,7 @@ var PropTypesSpecification: React.ComponentSpec<any, any> = {
return null;
}
},
render: (): React.ReactElement<any> => {
render: (): React.ReactElement<any> | null => {
return null;
}
};
@@ -425,14 +435,14 @@ var ContextTypesSpecification: React.ComponentSpec<any, any> = {
}),
requiredFunc: React.PropTypes.func.isRequired,
requiredAny: React.PropTypes.any.isRequired,
customProp: function(props: any, propName: string, componentName: string) {
customProp: function(props: any, propName: string, componentName: string): Error | null {
if (!/matchme/.test(props[propName])) {
return new Error("Validation failed!");
}
return null;
}
},
render: (): React.ReactElement<any> => {
render: (): null => {
return null;
}
};
@@ -495,7 +505,7 @@ createFragment({
// --------------------------------------------------------------------------
React.createFactory(CSSTransitionGroup)({
component: React.createClass({
render: (): React.ReactElement<any> => null
render: (): null => null
}),
childFactory: (c) => c,
transitionName: "transition",
@@ -601,16 +611,19 @@ var foundComponents: ModernComponent[] = TestUtils.scryRenderedComponentsWithTyp
// ReactTestUtils custom type guards
var emptyElement: React.ReactElement<{}>;
if (TestUtils.isElementOfType(emptyElement, StatelessComponent)) {
emptyElement.props.foo;
var emptyElement1: React.ReactElement<{}> = React.createElement(ModernComponent);
if (TestUtils.isElementOfType(emptyElement1, StatelessComponent)) {
emptyElement1.props.foo;
}
var emptyElement2: React.ReactElement<{}> = React.createElement(StatelessComponent);
if (TestUtils.isElementOfType(emptyElement2, StatelessComponent)) {
emptyElement2.props.foo;
}
var anyInstance: Element | React.Component<any, any>;
if (TestUtils.isDOMComponent(anyInstance)) {
anyInstance.getAttribute("className");
} else if (TestUtils.isCompositeComponent(anyInstance)) {
anyInstance.props;
if (TestUtils.isDOMComponent(container)) {
container.getAttribute("className");
} else if (TestUtils.isCompositeComponent(new ModernComponent())) {
new ModernComponent().props;
}
//
@@ -651,4 +664,4 @@ class ConstructorSpreadArgsPureComponent extends React.PureComponent<{}, {}> {
constructor(...args: any[]) {
super(...args);
}
}
}
+10
View File
@@ -13,3 +13,13 @@ StatelessComponent.defaultProps = {
};
<StatelessComponent />;
var StatelessComponent2: React.SFC<SCProps> = ({ foo, children }) => {
return <div>{ foo }{ children }</div>;
};
StatelessComponent2.displayName = "StatelessComponent4";
StatelessComponent2.defaultProps = {
foo: 42
};
<StatelessComponent2>24</StatelessComponent2>;
+1 -1
View File
@@ -8,7 +8,7 @@
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
+2 -2
View File
@@ -12,13 +12,13 @@ declare namespace ReduxActions {
type: string
}
interface Action<Payload> extends BaseAction {
export interface Action<Payload> extends BaseAction {
payload?: Payload
error?: boolean
meta?: any
}
interface ActionMeta<Payload, Meta> extends Action<Payload> {
export interface ActionMeta<Payload, Meta> extends Action<Payload> {
meta: Meta
}
+1 -1
View File
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
+4 -4
View File
@@ -1,4 +1,4 @@
// Type definitions for source-map v0.1.38
// Type definitions for source-map v0.5.6
// Project: https://github.com/mozilla/source-map
// Definitions by: Morten Houston Ludvigsen <https://github.com/MortenHoustonLudvigsen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -58,7 +58,7 @@ declare namespace SourceMap {
public static GENERATED_ORDER: number;
public static ORIGINAL_ORDER: number;
constructor(rawSourceMap: RawSourceMap);
constructor(rawSourceMap: RawSourceMap | string);
public computeColumnSpans(): void;
@@ -115,9 +115,9 @@ declare namespace SourceMap {
relativePath?: string
): SourceNode;
public add(chunk: any): SourceNode;
public add(chunk: (string | SourceNode)[] | SourceNode | string): SourceNode;
public prepend(chunk: any): SourceNode;
public prepend(chunk: (string | SourceNode)[] | SourceNode | string): SourceNode;
public setSourceContent(sourceFile: string, sourceContent: string): void;
+13
View File
@@ -14,6 +14,15 @@ function testSourceMapConsumer() {
file: 'sdf'
});
scm = new SourceMap.SourceMapConsumer(JSON.stringify({
version: 3,
sources: ['foo', 'bar'],
names: ['foo', 'bar'],
sourcesContent: ['foo'],
mappings: 'foo',
file: 'sdf'
}));
// create with partial RawSourceMap
scm = new SourceMap.SourceMapConsumer({
version: 3,
@@ -129,10 +138,14 @@ function testSourceNode() {
function testAdd(node: SourceMap.SourceNode) {
node.add('foo');
node.add(new SourceMap.SourceNode());
node.add([new SourceMap.SourceNode(), 'bar']);
}
function testPrepend(node: SourceMap.SourceNode) {
node.prepend('foo');
node.prepend(new SourceMap.SourceNode());
node.prepend([new SourceMap.SourceNode(), 'bar']);
}
function testSetSourceContent(node: SourceMap.SourceNode) {
+2 -1
View File
@@ -9,7 +9,8 @@
"../"
],
"types": [],
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+2 -1
View File
@@ -9,7 +9,8 @@
"../"
],
"types": [],
"noEmit": true
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
+67
View File
@@ -0,0 +1,67 @@
// Type definitions for stompjs 2.3
// Project: https://github.com/jmesnil/stomp-websocket
// Definitions by: Jimi Charalampidis <https://github.com/jimic>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export const VERSIONS: {
V1_0: string,
V1_1: string,
V1_2: string,
supportedVersions: () => Array<string>
};
export class Client {
connected: boolean;
counter: number;
heartbeat: {
incoming: number,
outgoing: number
};
maxWebSocketFrameSize: number;
subscriptions: {};
ws: WebSocket;
debug(...args: string[]): any;
connect(...args: any[]): any;
disconnect(disconnectCallback: () => any, headers?: {}): any;
send(destination: string, headers?: {}, body?: string): any;
subscribe(destination: string, callback?: (message: Message) => any, headers?: {}): any;
unsubscribe(): any;
begin(transaction: string): any;
commit(transaction: string): any;
abort(transaction: string): any;
ack(messageID: string, subscription: string, headers?: {}): any;
nack(messageID: string, subscription: string, headers?: {}): any;
}
export interface Message {
command: string;
headers: {};
body: string;
ack(headers?: {}): any;
nack(headers?: {}): any;
}
export class Frame {
constructor(command: string, headers?: {}, body?: string);
toString(): string;
sizeOfUTF8(s: string): number;
unmarshall(datas: any): any;
marshall(command: string, headers?: {}, body?: string): any;
}
export function client(url: string, protocols?: string | Array<string>): Client;
export function over(ws: WebSocket): Client;
export function overTCP(host: string, port: number): Client;
export function overWS(url: string): Client;
export function setInterval(interval: number, f: (...args: any[]) => void): NodeJS.Timer;
export function clearInterval(id: NodeJS.Timer): void;
+87
View File
@@ -0,0 +1,87 @@
import * as Stomp from 'stompjs';
let interval = Stomp.setInterval(1000, () => { });
Stomp.clearInterval(interval);
let client: Stomp.Client;
client = Stomp.client('url');
client = Stomp.client('url', Stomp.VERSIONS.supportedVersions());
client = Stomp.client('url', Stomp.VERSIONS.V1_0);
client = Stomp.client('url', Stomp.VERSIONS.V1_1);
client = Stomp.over(new WebSocket('url'));
client = Stomp.over(new WebSocket('url', Stomp.VERSIONS.supportedVersions()));
client = Stomp.over(new WebSocket('url', Stomp.VERSIONS.V1_0));
client = Stomp.over(new WebSocket('url', Stomp.VERSIONS.V1_1));
client = Stomp.overTCP('host', 0);
client = Stomp.overWS('url');
client.connected = false;
client.counter = 0;
client.heartbeat = { incoming: 20000, outgoing: 20000 };
client.maxWebSocketFrameSize = 16 * 1024;
client.subscriptions = { 'sub-0': {}, 'sub-1': () => { } };
client.ws = new WebSocket('url');
client.debug();
client.connect();
client.connect('', () => { }, {});
client.disconnect(() => { });
client.disconnect(() => { }, {});
client.send('destination');
client.send('destination', {});
client.send('destination', {}, 'body');
client.subscribe('destination', (message) => { });
client.subscribe('destination', (message) => { }, {});
client.unsubscribe();
client.begin('transaction');
client.commit('transaction');
client.abort('transaction');
client.ack('messageID', 'subscription');
client.nack('messageID', 'subscription', {});
let message: Stomp.Message = {
command: 'command',
headers: {},
body: 'body',
ack({}) { },
nack({}) { }
}
message.ack();
message.ack({});
message.nack();
message.nack({});
let frame: Stomp.Frame;
frame = new Stomp.Frame('command');
frame = new Stomp.Frame('command', {});
frame = new Stomp.Frame('command', {}, 'body');
frame.toString();
frame.sizeOfUTF8('abc');
frame.unmarshall(0);
frame.unmarshall('data');
frame.unmarshall({});
frame.unmarshall([{}, {}]);
frame.marshall('command');
frame.marshall('command', {});
frame.marshall('command', {}, 'body');
+19
View File
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"stompjs-tests.ts"
]
}
+67 -7
View File
@@ -1,9 +1,10 @@
// Type definitions for stripe
// Project: https://stripe.com/
// Definitions by: Andy Hawkins <https://github.com/a904guy/,http://a904guy.com>, Eric J. Smith <https://github.com/ejsmith/>, Amrit Kahlon <https://github.com/amritk/>
// Definitions by: Andy Hawkins <https://github.com/a904guy/,http://a904guy.com>, Eric J. Smith <https://github.com/ejsmith/>, Amrit Kahlon <https://github.com/amritk/>, Adam Cmiel <https://github.com/adamcmiel>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface StripeStatic {
applePay: StripeApplePay;
setPublishableKey(key: string): void;
validateCardNumber(cardNumber: string): boolean;
validateExpiry(month: string, year: string): boolean;
@@ -34,11 +35,11 @@ interface StripeTokenResponse {
id: string;
card: StripeCardData;
created: number;
currency: string;
livemode: boolean;
object: string;
type: string;
used: boolean;
error: StripeError;
error?: StripeError;
}
interface StripeError {
@@ -51,10 +52,8 @@ interface StripeError {
interface StripeCardData {
object: string;
last4: string;
type: string;
exp_month: number;
exp_year: number;
fingerprint: string;
country?: string;
name?: string;
address_line1?: string;
@@ -87,7 +86,6 @@ interface StripeBankTokenResponse
{
id: string;
bank_account: {
id: string;
country: string;
bank_name: string;
last4: number;
@@ -99,10 +97,72 @@ interface StripeBankTokenResponse
type: string;
object: string;
used: boolean;
error: StripeError;
error?: StripeError;
}
declare var Stripe: StripeStatic;
declare module "Stripe" {
export = StripeStatic;
}
interface StripeApplePay
{
checkAvailability(resopnseHandler: (result: boolean) => void): void;
buildSession(data: StripeApplePayPaymentRequest,
onSuccessHandler: (result: StripeApplePaySessionResult, completion: ((value: any) => void)) => void,
onErrorHanlder: (error: { message: string }) => void): any;
}
type StripeApplePayBillingContactField = 'postalAddress' | 'name';
type StripeApplePayShippingContactField = StripeApplePayBillingContactField | 'phone' | 'email';
type StripeApplePayShipping = 'shipping' | 'delivery' | 'storePickup' | 'servicePickup';
interface StripeApplePayPaymentRequest
{
billingContact: StripeApplePayPaymentContact;
countryCode: string;
currencyCode: string;
total: StripeApplePayLineItem;
lineItems?: StripeApplePayLineItem[];
requiredBillingContactFields?: StripeApplePayBillingContactField[];
requiredShippingContactFields?: StripeApplePayShippingContactField[];
shippingContact?: StripeApplePayPaymentContact;
shippingMethods?: StripeApplePayShippingMethod[];
shippingType?: StripeApplePayShipping[];
}
// https://developer.apple.com/reference/applepayjs/1916082-applepay_js_data_types
interface StripeApplePayLineItem
{
type: 'pending' | 'final';
label: string;
amount: number;
}
interface StripeApplePaySessionResult
{
token: StripeTokenResponse;
shippingContact?: StripeApplePayPaymentContact;
shippingMethod?: StripeApplePayShippingMethod;
}
interface StripeApplePayShippingMethod
{
label: string;
detail: string;
amount: number;
identifier: string;
}
interface StripeApplePayPaymentContact
{
emailAddress: string;
phoneNumber: string;
givenName: string;
familyName: string;
addressLines: string[];
locality: string;
administrativeArea: string;
postalCode: string;
countryCode: string;
}

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