From bd0de57f3c3ace8d08f5ccc5b89ef5ae1966922c Mon Sep 17 00:00:00 2001 From: Ron Zeidman Date: Mon, 10 Oct 2016 16:02:41 +0300 Subject: [PATCH 01/63] Error object fix Source: https://github.com/hapijs/joi/blob/master/API.md#errors ## Errors Joi throws classical javascript `Error`s containing : - `name` - `'ValidationError'`. - `isJoi` - `true`. - `details` - an array of errors : - `message` - string with a description of the error. - `path` - dotted path to the key where the error happened. - `type` - type of the error. - `context` - object providing context of the error. - `annotate` - function that returns a string with an annotated version of the object pointing at the places where errors occured. - `_object` - the original object to validate. --- joi/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/joi/index.d.ts b/joi/index.d.ts index ece6bb6d62..0b2cf1e8cb 100644 --- a/joi/index.d.ts +++ b/joi/index.d.ts @@ -121,17 +121,17 @@ 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 { message: string; type: string; path: string; - options?: ValidationOptions; + context?: any; } export interface ValidationResult { From db86a7a621d9fe465f433ab6cf89e91952ff1d32 Mon Sep 17 00:00:00 2001 From: Ron Zeidman Date: Mon, 10 Oct 2016 16:05:26 +0300 Subject: [PATCH 02/63] Update joi-tests.ts --- joi/joi-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index eb0f147f78..557146cabc 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -125,7 +125,7 @@ validErrItem = { message: str, type: str, path: str, - options: validOpts + context: obj }; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- From f116c1260178815885ad43ff7497f91abfb1fbc8 Mon Sep 17 00:00:00 2001 From: Ron Zeidman Date: Tue, 11 Oct 2016 09:47:42 +0300 Subject: [PATCH 03/63] Update index.d.ts Options does exist --- joi/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/joi/index.d.ts b/joi/index.d.ts index 0b2cf1e8cb..c192f49dd1 100644 --- a/joi/index.d.ts +++ b/joi/index.d.ts @@ -131,6 +131,7 @@ export interface ValidationErrorItem { message: string; type: string; path: string; + options?: ValidationOptions; context?: any; } From a388c6c5f9de3a3ba8afdf866a69e35e6ff44de2 Mon Sep 17 00:00:00 2001 From: Ron Zeidman Date: Tue, 11 Oct 2016 09:50:15 +0300 Subject: [PATCH 04/63] Update joi-tests.ts options does exist --- joi/joi-tests.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index 557146cabc..759be529ad 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -125,6 +125,7 @@ validErrItem = { message: str, type: str, path: str, + options: validOpts, context: obj }; From 76d8d5f439ea7ad02e5980950c0efc004bc9034e Mon Sep 17 00:00:00 2001 From: Joakim Gunst Date: Thu, 13 Oct 2016 12:26:36 +0300 Subject: [PATCH 05/63] Fixed bugs in angular-permission 2.3.6 type defintions. --- angular-permission/index.d.ts | 45 +++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/angular-permission/index.d.ts b/angular-permission/index.d.ts index 0b8d06f32a..8c03a79642 100644 --- a/angular-permission/index.d.ts +++ b/angular-permission/index.d.ts @@ -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 + 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 + 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, + 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): 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,7 +151,7 @@ declare module 'angular' { * * @returns {Object} Defined roles collection */ - getStore(): Role[]; + getStore(): {[roleName: string]: Role}; } export interface Role { @@ -150,12 +165,12 @@ declare module 'angular' { validationFunction?: PermissionValidationFunction; } - interface RoleValidationFunction { - (permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; + export interface RoleValidationFunction { + (roleName?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; } - interface PermissionValidationFunction { - (permission?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; + export interface PermissionValidationFunction { + (permissionName?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; } export interface IPermissionState extends angular.ui.IState { From 5cd9600ed26230241d177b557bf558e232c1112b Mon Sep 17 00:00:00 2001 From: Joakim Gunst Date: Thu, 13 Oct 2016 14:28:41 +0300 Subject: [PATCH 06/63] Updated tests. --- angular-permission/angular-permission-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/angular-permission/angular-permission-tests.ts b/angular-permission/angular-permission-tests.ts index 4f3a35f5df..051ace69b8 100644 --- a/angular-permission/angular-permission-tests.ts +++ b/angular-permission/angular-permission-tests.ts @@ -66,7 +66,7 @@ angular PermissionStore.removePermissionDefinition('user'); - let permissions: Array = PermissionStore.getStore(); + let permissions = PermissionStore.getStore(); }); @@ -90,5 +90,5 @@ angular RoleStore.removeRoleDefinition('user'); - let roles: Array = RoleStore.getStore(); + let roles = RoleStore.getStore(); }); From 76c4a34b96dbf795207dc132b1725cc95463c1ee Mon Sep 17 00:00:00 2001 From: Joakim Gunst Date: Thu, 13 Oct 2016 17:12:14 +0300 Subject: [PATCH 07/63] Removed redeclared 'cache' variable in 'ejs' that caused tests to fail. --- ejs/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/ejs/index.d.ts b/ejs/index.d.ts index b0f4bfeaa3..9f617287b7 100644 --- a/ejs/index.d.ts +++ b/ejs/index.d.ts @@ -62,7 +62,6 @@ declare namespace Ejs { set(key: string, val: any): any; get(key: string): any; } - var cache: Cache; function resolve(from1: string, to: string): string; function resolve(from1: string, from2: string, to: string): string; function resolve(from1: string, from2: string, from3: string, to: string): string; From 9b10e5ccd7aa30d89ed56a19d7c0d41893e6e13a Mon Sep 17 00:00:00 2001 From: Joakim Gunst Date: Fri, 14 Oct 2016 08:21:44 +0300 Subject: [PATCH 08/63] Fixes and improvements to angular-permission. --- angular-permission/index.d.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/angular-permission/index.d.ts b/angular-permission/index.d.ts index 8c03a79642..5d4b7f74c8 100644 --- a/angular-permission/index.d.ts +++ b/angular-permission/index.d.ts @@ -84,7 +84,7 @@ declare module 'angular' { * * @returns {Object} Permissions collection */ - getStore(): {[permissionName: string]: Permission}; + getStore(): { [permissionName: string]: Permission }; } export interface RoleStore { @@ -110,7 +110,7 @@ declare module 'angular' { * @param permissions {Array} Set of permission names */ defineRole( - roleName: string, + roleName: string, permissions: string[] ): void; @@ -151,7 +151,7 @@ declare module 'angular' { * * @returns {Object} Defined roles collection */ - getStore(): {[roleName: string]: Role}; + getStore(): { [roleName: string]: Role }; } export interface Role { @@ -165,13 +165,15 @@ declare module 'angular' { validationFunction?: PermissionValidationFunction; } - export interface RoleValidationFunction { - (roleName?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; - } + export type RoleValidationFunction = ( + roleName?: string, + transitionProperties?: TransitionProperties + ) => boolean | angular.IPromise; - export interface PermissionValidationFunction { - (permissionName?: string, transitionProperties?: TransitionProperties): boolean | angular.IPromise; - } + export type PermissionValidationFunction = ( + permissionName?: string, + transitionProperties?: TransitionProperties + ) => boolean | angular.IPromise; export interface IPermissionState extends angular.ui.IState { data?: any | DataWithPermissions; @@ -179,8 +181,8 @@ declare module 'angular' { export interface DataWithPermissions { permissions?: { - only?: (() => void) | Array | angular.IPromise; - except?: (() => void) | Array | angular.IPromise; + only?: (() => void) | string | string[] | angular.IPromise; + except?: (() => void) | string | string[] | angular.IPromise; redirectTo: string | (() => string) | (() => PermissionRedirectConfigation) | { [index: string]: PermissionRedirectConfigation } }; } From 12f1b0a5571004f91b79a0d9c0aeb51957db92b4 Mon Sep 17 00:00:00 2001 From: Joakim Gunst Date: Fri, 14 Oct 2016 11:07:18 +0300 Subject: [PATCH 09/63] Added validate methods to Role and Permission in angular-permission. --- angular-permission/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/angular-permission/index.d.ts b/angular-permission/index.d.ts index 5d4b7f74c8..28781cb5df 100644 --- a/angular-permission/index.d.ts +++ b/angular-permission/index.d.ts @@ -158,11 +158,13 @@ declare module 'angular' { roleName: string; permissionNames: string[]; validationFunction?: RoleValidationFunction; + validateRole: () => angular.IPromise; } export interface Permission { permissionName: string; validationFunction?: PermissionValidationFunction; + validatePermission: () => angular.IPromise; } export type RoleValidationFunction = ( From 9f9210d7af2ebe1356fee4f16b8807af364a00e1 Mon Sep 17 00:00:00 2001 From: Christian Rackerseder Date: Wed, 19 Oct 2016 16:04:00 +0200 Subject: [PATCH 10/63] Fixed types for ora v0.3.0 --- ora/index.d.ts | 52 +++++++++++++++++++++++++++++------------------- ora/ora-tests.ts | 3 +-- 2 files changed, 33 insertions(+), 22 deletions(-) diff --git a/ora/index.d.ts b/ora/index.d.ts index e58b5575c7..f5db7383e7 100644 --- a/ora/index.d.ts +++ b/ora/index.d.ts @@ -1,25 +1,37 @@ -// Type definitions for ora +// Type definitions for ora v0.3.0 // Project: https://github.com/sindresorhus/ora -// Definitions by: Basarat Ali Syed +// Definitions by: Christian Rackerseder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// -type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; -type Text = string; -interface Options { - text?: Text; - spinner?: string | { interval?: number; frames: string[]; } - color?: Color; - stream?: any; +declare module "ora" { + type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; + type Text = string; + interface Options { + text?: Text; + spinner?: string | Spinner; + color?: Color; + 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; + color: Color; + } + function ora(options: Options | Text): Instance; + export = ora; } -interface Instance { - start(): void; - stop(): void; - clear(): void; - frame(): void; - render(): void; - text: Text; - color: Color; -} -declare function ora(options: Options | Text): Instance; -export = ora; diff --git a/ora/ora-tests.ts b/ora/ora-tests.ts index 7116db78ce..32e39aa753 100644 --- a/ora/ora-tests.ts +++ b/ora/ora-tests.ts @@ -1,8 +1,7 @@ import ora = require('ora'); -const spinner = ora('Loading unicorns'); -spinner.start(); +const spinner = ora('Loading unicorns').start(); setTimeout(() => { spinner.color = 'yellow'; From f572efa5593cb23f4f0003ec811b62a0d36a240c Mon Sep 17 00:00:00 2001 From: Christian Rackerseder Date: Thu, 20 Oct 2016 06:48:41 +0200 Subject: [PATCH 11/63] Fixed names in // Definitions --- ora/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ora/index.d.ts b/ora/index.d.ts index f5db7383e7..6e06bd35ec 100644 --- a/ora/index.d.ts +++ b/ora/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for ora v0.3.0 // Project: https://github.com/sindresorhus/ora -// Definitions by: Christian Rackerseder +// Definitions by: Basarat Ali Syed , Christian Rackerseder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// From 38960a30f9516850dc78b3c1abbe33662ea72f79 Mon Sep 17 00:00:00 2001 From: feng zhi hao Date: Fri, 21 Oct 2016 16:43:35 +0800 Subject: [PATCH 12/63] add @types/history dependency --- react-router/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/react-router/index.d.ts b/react-router/index.d.ts index 8dfc205478..f3984853cd 100644 --- a/react-router/index.d.ts +++ b/react-router/index.d.ts @@ -3,6 +3,8 @@ // Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík , Nathan Brown , Alex Wendland // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + export as namespace ReactRouter; import * as React from 'react'; From 8bdaf9418da10a6fe35ca94e5a6bde558c62f77c Mon Sep 17 00:00:00 2001 From: jupl Date: Sun, 23 Oct 2016 19:06:15 -0500 Subject: [PATCH 13/63] Export action interfaces Exporting the actions helps with casting/signatures when crafting reducers. --- redux-actions/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redux-actions/index.d.ts b/redux-actions/index.d.ts index de7cb4f026..a770c3006b 100644 --- a/redux-actions/index.d.ts +++ b/redux-actions/index.d.ts @@ -12,13 +12,13 @@ declare namespace ReduxActions { type: string } - interface Action extends BaseAction { + export interface Action extends BaseAction { payload?: Payload error?: boolean meta?: any } - interface ActionMeta extends Action { + export interface ActionMeta extends Action { meta: Meta } From dff0f0f29c6485d98d3a9e1e75030e553832dce6 Mon Sep 17 00:00:00 2001 From: Hendrik Liebau Date: Mon, 24 Oct 2016 12:08:37 +0200 Subject: [PATCH 14/63] export ReactHelmet namespace --- react-helmet/index.d.ts | 11 +++++------ react-helmet/react-helmet-tests.tsx | 6 ++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/react-helmet/index.d.ts b/react-helmet/index.d.ts index c44639e0d0..3ddfd1ebb5 100644 --- a/react-helmet/index.d.ts +++ b/react-helmet/index.d.ts @@ -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 {} } + +export = ReactHelmet; diff --git a/react-helmet/react-helmet-tests.tsx b/react-helmet/react-helmet-tests.tsx index 2db79eb547..3a4a3f09d7 100644 --- a/react-helmet/react-helmet-tests.tsx +++ b/react-helmet/react-helmet-tests.tsx @@ -39,3 +39,9 @@ function HTML() { ); } + +function log(datum: Helmet.HelmetDatum) { + return console.log('logging a helmet datum:', datum.toString()); +} + +log(head.title); From 14eed8a1fef49ef9543dd9a75a5622afb23ade30 Mon Sep 17 00:00:00 2001 From: Christian Rackerseder Date: Wed, 26 Oct 2016 07:34:34 +0200 Subject: [PATCH 15/63] Replaced Text with string --- ora/index.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ora/index.d.ts b/ora/index.d.ts index 6e06bd35ec..976005200b 100644 --- a/ora/index.d.ts +++ b/ora/index.d.ts @@ -7,9 +7,8 @@ declare module "ora" { type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; - type Text = string; interface Options { - text?: Text; + text?: string; spinner?: string | Spinner; color?: Color; interval?: number; @@ -32,6 +31,6 @@ declare module "ora" { text: string; color: Color; } - function ora(options: Options | Text): Instance; + function ora(options: Options | string): Instance; export = ora; } From a27693680c4fcde005f99ceeb2f4b1182c76ee7b Mon Sep 17 00:00:00 2001 From: Christian Rackerseder Date: Thu, 27 Oct 2016 11:21:39 +0200 Subject: [PATCH 16/63] Removed declare module "ora" --- ora/index.d.ts | 54 ++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/ora/index.d.ts b/ora/index.d.ts index 976005200b..e45a585442 100644 --- a/ora/index.d.ts +++ b/ora/index.d.ts @@ -5,32 +5,30 @@ /// -declare module "ora" { - type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; - interface Options { - text?: string; - spinner?: string | Spinner; - color?: Color; - 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; - color: Color; - } - function ora(options: Options | string): Instance; - export = ora; +type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; +interface Options { + text?: string; + spinner?: string | Spinner; + color?: Color; + 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; + color: Color; +} +declare function ora(options: Options | string): Instance; +export = ora; From 6e4467c37963e826fbf47cc2460130aa83608503 Mon Sep 17 00:00:00 2001 From: Kostya Esmukov Date: Thu, 27 Oct 2016 15:35:59 +0300 Subject: [PATCH 17/63] react-router: added render prop and fixed applyRouterMiddleware types --- react-router/index.d.ts | 2 +- react-router/lib/Router.d.ts | 20 +++++++++++--------- react-router/lib/applyRouterMiddleware.d.ts | 8 +++++--- react-router/react-router-tests.tsx | 14 +++++++++++++- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/react-router/index.d.ts b/react-router/index.d.ts index 8dfc205478..f85b121c6a 100644 --- a/react-router/index.d.ts +++ b/react-router/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-router v2.0.0 // Project: https://github.com/rackt/react-router -// Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík , Nathan Brown , Alex Wendland +// Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík , Nathan Brown , Alex Wendland , Kostya Esmukov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export as namespace ReactRouter; diff --git a/react-router/lib/Router.d.ts b/react-router/lib/Router.d.ts index c375f71513..5a4cfacb15 100644 --- a/react-router/lib/Router.d.ts +++ b/react-router/lib/Router.d.ts @@ -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 { - 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 { + 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; diff --git a/react-router/lib/applyRouterMiddleware.d.ts b/react-router/lib/applyRouterMiddleware.d.ts index a92384bba6..ed87d815db 100644 --- a/react-router/lib/applyRouterMiddleware.d.ts +++ b/react-router/lib/applyRouterMiddleware.d.ts @@ -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; diff --git a/react-router/react-router-tests.tsx b/react-router/react-router-tests.tsx index 77262bad50..77a0703462 100644 --- a/react-router/react-router-tests.tsx +++ b/react-router/react-router-tests.tsx @@ -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(); }); + + +ReactDOM.render(( + child + })} + > + +), document.body); From 3b995c66f4276281c489558cec4f0519b2ea2d76 Mon Sep 17 00:00:00 2001 From: lucideer Date: Thu, 27 Oct 2016 21:42:46 +0100 Subject: [PATCH 18/63] Union types for possibly undefined return values See https://github.com/libxmljs/libxmljs/wiki --- libxmljs/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libxmljs/index.d.ts b/libxmljs/index.d.ts index bc33a4eec1..c928f57362 100644 --- a/libxmljs/index.d.ts +++ b/libxmljs/index.d.ts @@ -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; From 737653ccb00bce0a39e2070a78a7105806ebd6f9 Mon Sep 17 00:00:00 2001 From: Casper Skydt Date: Fri, 28 Oct 2016 13:39:38 +0200 Subject: [PATCH 19/63] Added Kinises to AWS-SDK --- aws-sdk/aws-sdk-tests.ts | 39 ++++++++++++++++++++++++++++++ aws-sdk/index.d.ts | 52 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 90 insertions(+), 1 deletion(-) diff --git a/aws-sdk/aws-sdk-tests.ts b/aws-sdk/aws-sdk-tests.ts index 7d3b7a5c2c..5188a3e725 100644 --- a/aws-sdk/aws-sdk-tests.ts +++ b/aws-sdk/aws-sdk-tests.ts @@ -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 +}); \ No newline at end of file diff --git a/aws-sdk/index.d.ts b/aws-sdk/index.d.ts index 7d70edf939..42919b3d57 100644 --- a/aws-sdk/index.d.ts +++ b/aws-sdk/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for aws-sdk // Project: https://github.com/aws/aws-sdk-js -// Definitions by: midknight41 +// Definitions by: midknight41 , Casper Skydt // 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; From 5b3fcc4f7d0e404b738f86195f8f49035b6133c5 Mon Sep 17 00:00:00 2001 From: Stefan Dobrev Date: Tue, 1 Nov 2016 15:25:15 +0200 Subject: [PATCH 20/63] [material-ui] Add boolean for muiTheme.userAgent It turns out that `muiTheme.userAgent` supports booleans as well. This is used when you want to disable the autoprefixer functionality: https://github.com/callemall/material-ui/blob/ccf712c5733508784cd709c18c29059542d6aad1/src/utils/autoprefixer.js#L20 --- material-ui/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/material-ui/index.d.ts b/material-ui/index.d.ts index 941b7aff72..c04d673dc9 100644 --- a/material-ui/index.d.ts +++ b/material-ui/index.d.ts @@ -141,7 +141,7 @@ declare namespace __MaterialUI { fontFamily?: string; palette?: ThemePalette; isRtl?: boolean; - userAgent?: string; + userAgent?: string | boolean; zIndex?: zIndex; baseTheme?: RawTheme; rawTheme?: RawTheme; From c5ea2b4c69f6f6a8f8346645630c805773f628b1 Mon Sep 17 00:00:00 2001 From: Connor Peet Date: Tue, 1 Nov 2016 09:06:04 -0700 Subject: [PATCH 21/63] Treat clipboard as a CJS module --- clipboard/clipboard-tests.ts | 2 +- clipboard/index.d.ts | 98 ++++++++++++++++++------------------ 2 files changed, 51 insertions(+), 49 deletions(-) diff --git a/clipboard/clipboard-tests.ts b/clipboard/clipboard-tests.ts index c6c7b756cb..7521c651dd 100644 --- a/clipboard/clipboard-tests.ts +++ b/clipboard/clipboard-tests.ts @@ -1,4 +1,4 @@ - +import * as Clipboard from 'clipboard'; var cb1 = new Clipboard('.btn'); var cb2 = new Clipboard(document.getElementById('id'), { diff --git a/clipboard/index.d.ts b/clipboard/index.d.ts index d4b014e2f3..0757eb1208 100644 --- a/clipboard/index.d.ts +++ b/clipboard/index.d.ts @@ -3,54 +3,56 @@ // Definitions by: Andrei Kurosh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare class Clipboard { - constructor(selector: (string | Element | NodeListOf), 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} 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), 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} 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; } From 8b403021835240c203d323f848b5fb104fd1d20f Mon Sep 17 00:00:00 2001 From: e-cloud Date: Fri, 4 Nov 2016 09:34:46 +0800 Subject: [PATCH 22/63] fix: update version number for source-map --- source-map/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source-map/index.d.ts b/source-map/index.d.ts index dfddb63e27..d7da94ff75 100644 --- a/source-map/index.d.ts +++ b/source-map/index.d.ts @@ -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 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 78098d48dfe83939979f1d8b9d3f310f68335460 Mon Sep 17 00:00:00 2001 From: e-cloud Date: Tue, 8 Nov 2016 11:07:53 +0800 Subject: [PATCH 23/63] fix: more accurate types and corresponding tests --- source-map/index.d.ts | 6 +++--- source-map/source-map-tests.ts | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/source-map/index.d.ts b/source-map/index.d.ts index d7da94ff75..8b8f800c85 100644 --- a/source-map/index.d.ts +++ b/source-map/index.d.ts @@ -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; diff --git a/source-map/source-map-tests.ts b/source-map/source-map-tests.ts index 23722d8179..4e584d2338 100644 --- a/source-map/source-map-tests.ts +++ b/source-map/source-map-tests.ts @@ -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) { From d59071ff079c895986b4b761421a53874e0c3085 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 7 Nov 2016 21:09:10 -0800 Subject: [PATCH 24/63] Decomposed 'winston' into a var/namespace/type so it can export a member named 'default'. --- winston/index.d.ts | 590 +++++++++++++++++++++++---------------------- 1 file changed, 298 insertions(+), 292 deletions(-) diff --git a/winston/index.d.ts b/winston/index.d.ts index 1db5b33c32..67c37f1352 100644 --- a/winston/index.d.ts +++ b/winston/index.d.ts @@ -11,330 +11,336 @@ /// Winston v2.2.x ///****************** +declare var winston: Winston; +export = winston; -export declare var transports: Transports; -export declare var Transport: TransportStatic; -export declare var Logger: LoggerStatic; -export declare var Container: ContainerStatic; -export declare var loggers: ContainerInstance; -export declare var defaultLogger: LoggerInstance; +interface Winston { + transports: winston.Transports; + Transport: winston.TransportStatic; + Logger: winston.LoggerStatic; + Container: winston.ContainerStatic; + loggers: winston.ContainerInstance; + defaultLogger: winston.LoggerInstance; -export declare var exception: Exception; + exception: winston.Exception; -export declare var exitOnError: boolean; -export declare var level: string; + exitOnError: boolean; + level: string; -export declare var log: LogMethod; + log: winston.LogMethod; -export declare var debug: LeveledLogMethod; -export declare var info: LeveledLogMethod; -export declare var warn: LeveledLogMethod; -export declare var error: LeveledLogMethod; + debug: winston.LeveledLogMethod; + info: winston.LeveledLogMethod; + warn: winston.LeveledLogMethod; + error: winston.LeveledLogMethod; -export declare function query(options: QueryOptions, callback?: (err: Error, results: any) => void): any; -export declare function query(callback: (err: Error, results: any) => void): any; -export declare function stream(options?: any): NodeJS.ReadableStream; -export declare function handleExceptions(...transports: TransportInstance[]): void; -export declare function unhandleExceptions(...transports: TransportInstance[]): void; -export declare function add(transport: TransportInstance, options?: TransportOptions, created?: boolean): LoggerInstance; -export declare function clear(): void; -export declare function remove(transport: string): LoggerInstance; -export declare function remove(transport: TransportInstance): LoggerInstance; -export declare function startTimer(): ProfileHandler; -export declare function profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance; -export declare function addColors(target: any): any; -export declare function setLevels(target: any): any; -export declare function cli(): LoggerInstance; -export declare function close(): void; - export function configure(options: LoggerOptions): void; - -export interface ExceptionProcessInfo { - pid: number; - uid?: number; - gid?: number; - cwd: string; - execPath: string; - version: string; - argv: string; - memoryUsage: NodeJS.MemoryUsage; -} - -export interface ExceptionOsInfo { - loadavg: [number, number, number]; - uptime: number; -} - -export interface ExceptionTrace { - column: number; - file: string; - "function": string; - line: number; - method: string; - native: boolean; -} - -export interface ExceptionAllInfo { - date: Date; - process: ExceptionProcessInfo; - os: ExceptionOsInfo; - trace: Array; - stack: Array; -} - -export interface Exception { - getAllInfo(err: Error): ExceptionAllInfo; - getProcessInfo(): ExceptionProcessInfo; - getOsInfo(): ExceptionOsInfo; - getTrace(err: Error): Array; -} - -export interface MetadataRewriter { - (level: string, msg: string, meta: any): any; -} - -export interface MetadataFilter { - (level: string, msg: string, meta: any): string | { msg: any; meta: any; }; -} - -export interface LoggerStatic { - new (options?: LoggerOptions): LoggerInstance; -} - -export interface LoggerInstance extends NodeJS.EventEmitter { - rewriters: Array; - filters: Array; - transports: Array; - - extend(target: any): LoggerInstance; - - log: LogMethod; - - debug: LeveledLogMethod; - info: LeveledLogMethod; - warn: LeveledLogMethod; - error: LeveledLogMethod; - - query(options: QueryOptions, callback?: (err: Error, results: any) => void): any; + query(options: winston.QueryOptions, callback?: (err: Error, results: any) => void): any; query(callback: (err: Error, results: any) => void): any; stream(options?: any): NodeJS.ReadableStream; - close(): void; - handleExceptions(...transports: TransportInstance[]): void; - unhandleExceptions(...transports: TransportInstance[]): void; - add(transport: TransportInstance, options?: TransportOptions, created?: boolean): LoggerInstance; + handleExceptions(...transports: winston.TransportInstance[]): void; + unhandleExceptions(...transports: winston.TransportInstance[]): void; + add(transport: winston.TransportInstance, options?: winston.TransportOptions, created?: boolean): winston.LoggerInstance; clear(): void; - remove(transport: TransportInstance): LoggerInstance; - startTimer(): ProfileHandler; - profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance; - configure(options: LoggerOptions): void; + remove(transport: string): winston.LoggerInstance; + remove(transport: winston.TransportInstance): winston.LoggerInstance; + startTimer(): winston.ProfileHandler; + profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): winston.LoggerInstance; + addColors(target: any): any; setLevels(target: any): any; - cli(): LoggerInstance; - - level: string; -} - -export interface LoggerOptions { - transports?: TransportInstance[]; - rewriters?: TransportInstance[]; - exceptionHandlers?: TransportInstance[]; - handleExceptions?: boolean; - - /** - * @type {(boolean|(err: Error) => void)} - */ - exitOnError?: any; - - // TODO: Need to make instances specific, - // and need to get options for each instance. - // Unfortunately, the documentation is unhelpful. - [optionName: string]: any; -} - -export interface TransportStatic { - new (options?: TransportOptions): TransportInstance; -} - -export interface TransportInstance extends TransportStatic, NodeJS.EventEmitter { - formatQuery(query: (string | Object)): (string | Object); - normalizeQuery(options: QueryOptions): QueryOptions; - formatResults(results: (Object | Array), options?: Object): (Object | Array); - logException(msg: string, meta: Object, callback: () => void): void; -} - -export interface ConsoleTransportInstance extends TransportInstance { - new (options?: ConsoleTransportOptions): ConsoleTransportInstance; -} - -export interface DailyRotateFileTransportInstance extends TransportInstance { - new (options?: DailyRotateFileTransportOptions): DailyRotateFileTransportInstance; -} - -export interface FileTransportInstance extends TransportInstance { - new (options?: FileTransportOptions): FileTransportInstance; + cli(): winston.LoggerInstance; close(): void; + configure(options: winston.LoggerOptions): void; } -export interface HttpTransportInstance extends TransportInstance { - new (options?: HttpTransportOptions): HttpTransportInstance; -} +declare namespace winston { + export interface ExceptionProcessInfo { + pid: number; + uid?: number; + gid?: number; + cwd: string; + execPath: string; + version: string; + argv: string; + memoryUsage: NodeJS.MemoryUsage; + } -export interface MemoryTransportInstance extends TransportInstance { - new (options?: MemoryTransportOptions): MemoryTransportInstance; -} + export interface ExceptionOsInfo { + loadavg: [number, number, number]; + uptime: number; + } -export interface WebhookTransportInstance extends TransportInstance { - new (options?: WebhookTransportOptions): WebhookTransportInstance; -} + export interface ExceptionTrace { + column: number; + file: string; + "function": string; + line: number; + method: string; + native: boolean; + } -export interface WinstonModuleTrasportInstance extends TransportInstance { - new (options?: WinstonModuleTransportOptions): WinstonModuleTrasportInstance; -} + export interface ExceptionAllInfo { + date: Date; + process: ExceptionProcessInfo; + os: ExceptionOsInfo; + trace: Array; + stack: Array; + } -export interface ContainerStatic { - new (options: LoggerOptions): ContainerInstance; -} + export interface Exception { + getAllInfo(err: Error): ExceptionAllInfo; + getProcessInfo(): ExceptionProcessInfo; + getOsInfo(): ExceptionOsInfo; + getTrace(err: Error): Array; + } -export interface ContainerInstance extends ContainerStatic { - get(id: string, options?: LoggerOptions): LoggerInstance; - add(id: string, options: LoggerOptions): LoggerInstance; - has(id: string): boolean; - close(id: string): void; - options: LoggerOptions; - loggers: any; - default: LoggerOptions; -} + export interface MetadataRewriter { + (level: string, msg: string, meta: any): any; + } -export interface Transports { - File: FileTransportInstance; - Console: ConsoleTransportInstance; - Loggly: WinstonModuleTrasportInstance; - DailyRotateFile: DailyRotateFileTransportInstance; - Http: HttpTransportInstance; - Memory: MemoryTransportInstance; - Webhook: WebhookTransportInstance; -} + export interface MetadataFilter { + (level: string, msg: string, meta: any): string | { msg: any; meta: any; }; + } -export type TransportOptions = ConsoleTransportOptions | DailyRotateFileTransportOptions | FileTransportOptions | HttpTransportOptions | MemoryTransportOptions | WebhookTransportOptions | WinstonModuleTransportOptions; + export interface LoggerStatic { + new (options?: LoggerOptions): LoggerInstance; + } -export interface GenericTransportOptions { - level?: string; - silent?: boolean; - raw?: boolean; - name?: string; - formatter?: Function; - handleExceptions?: boolean; - exceptionsLevel?: string; - humanReadableUnhandledException?: boolean; -} + export interface LoggerInstance extends NodeJS.EventEmitter { + rewriters: Array; + filters: Array; + transports: Array; -export interface GenericTextTransportOptions { - json?: boolean; - colorize?: boolean; - colors?: any; - prettyPrint?: boolean; - timestamp?: (Function | boolean); - showLevel?: boolean; - label?: string; - depth?: number; - stringify?: Function; -} + extend(target: any): LoggerInstance; -export interface GenericNetworkTransportOptions { - host?: string; - port?: number; - auth?: { - username: string; - password: string; - }; - path?: string; -} + log: LogMethod; -export interface ConsoleTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { - logstash?: boolean; - debugStdout?: boolean; -} + debug: LeveledLogMethod; + info: LeveledLogMethod; + warn: LeveledLogMethod; + error: LeveledLogMethod; -export interface DailyRotateFileTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { - logstash?: boolean; - maxsize?: number; - maxFiles?: number; - eol?: string; - maxRetries?: number; - datePattern?: string; - filename?: string; - dirname?: string; - options?: { - flags?: string; - highWaterMark?: number; - }; - stream?: NodeJS.WritableStream; -} + query(options: QueryOptions, callback?: (err: Error, results: any) => void): any; + query(callback: (err: Error, results: any) => void): any; + stream(options?: any): NodeJS.ReadableStream; + close(): void; + handleExceptions(...transports: TransportInstance[]): void; + unhandleExceptions(...transports: TransportInstance[]): void; + add(transport: TransportInstance, options?: TransportOptions, created?: boolean): LoggerInstance; + clear(): void; + remove(transport: TransportInstance): LoggerInstance; + startTimer(): ProfileHandler; + profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance; + configure(options: LoggerOptions): void; + setLevels(target: any): any; + cli(): LoggerInstance; -export interface FileTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { - logstash?: boolean; - maxsize?: number; - rotationFormat?: boolean; - zippedArchive?: boolean; - maxFiles?: number; - eol?: string; - tailable?: boolean; - maxRetries?: number; - filename?: string; - dirname?: string; - options?: { - flags?: string; - highWaterMark?: number; - }; - stream?: NodeJS.WritableStream; -} + level: string; + } -export interface HttpTransportOptions extends GenericTransportOptions, GenericNetworkTransportOptions { - ssl?: boolean; -} + export interface LoggerOptions { + transports?: TransportInstance[]; + rewriters?: TransportInstance[]; + exceptionHandlers?: TransportInstance[]; + handleExceptions?: boolean; -export interface MemoryTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { -} + /** + * @type {(boolean|(err: Error) => void)} + */ + exitOnError?: any; -export interface WebhookTransportOptions extends GenericTransportOptions, GenericNetworkTransportOptions { - method?: string; - ssl?: { - key?: any; - cert?: any; - ca: any; - }; -} + // TODO: Need to make instances specific, + // and need to get options for each instance. + // Unfortunately, the documentation is unhelpful. + [optionName: string]: any; + } -export interface WinstonModuleTransportOptions extends GenericTransportOptions { - [optionName: string]: any; -} + export interface TransportStatic { + new (options?: TransportOptions): TransportInstance; + } -export interface QueryOptions { - rows?: number; - limit?: number; - start?: number; - from?: Date; - until?: Date; - order?: "asc" | "desc"; - fields: any; -} + export interface TransportInstance extends TransportStatic, NodeJS.EventEmitter { + formatQuery(query: (string | Object)): (string | Object); + normalizeQuery(options: QueryOptions): QueryOptions; + formatResults(results: (Object | Array), options?: Object): (Object | Array); + logException(msg: string, meta: Object, callback: () => void): void; + } -export interface ProfileHandler { - logger: LoggerInstance; - start: Date; - done: (msg: string) => LoggerInstance; -} + export interface ConsoleTransportInstance extends TransportInstance { + new (options?: ConsoleTransportOptions): ConsoleTransportInstance; + } -interface LogMethod { - (level: string, msg: string, callback: LogCallback): LoggerInstance; - (level: string, msg: string, meta: any, callback: LogCallback): LoggerInstance; - (level: string, msg: string, ...meta: any[]): LoggerInstance; -} + export interface DailyRotateFileTransportInstance extends TransportInstance { + new (options?: DailyRotateFileTransportOptions): DailyRotateFileTransportInstance; + } -interface LeveledLogMethod { - (msg: string, callback: LogCallback): LoggerInstance; - (msg: string, meta: any, callback: LogCallback): LoggerInstance; - (msg: string, ...meta: any[]): LoggerInstance; -} + export interface FileTransportInstance extends TransportInstance { + new (options?: FileTransportOptions): FileTransportInstance; + close(): void; + } -interface LogCallback { - (error?: any, level?: string, msg?: string, meta?: any): void; -} + export interface HttpTransportInstance extends TransportInstance { + new (options?: HttpTransportOptions): HttpTransportInstance; + } + + export interface MemoryTransportInstance extends TransportInstance { + new (options?: MemoryTransportOptions): MemoryTransportInstance; + } + + export interface WebhookTransportInstance extends TransportInstance { + new (options?: WebhookTransportOptions): WebhookTransportInstance; + } + + export interface WinstonModuleTrasportInstance extends TransportInstance { + new (options?: WinstonModuleTransportOptions): WinstonModuleTrasportInstance; + } + + export interface ContainerStatic { + new (options: LoggerOptions): ContainerInstance; + } + + export interface ContainerInstance extends ContainerStatic { + get(id: string, options?: LoggerOptions): LoggerInstance; + add(id: string, options: LoggerOptions): LoggerInstance; + has(id: string): boolean; + close(id: string): void; + options: LoggerOptions; + loggers: any; + default: LoggerOptions; + } + + export interface Transports { + File: FileTransportInstance; + Console: ConsoleTransportInstance; + Loggly: WinstonModuleTrasportInstance; + DailyRotateFile: DailyRotateFileTransportInstance; + Http: HttpTransportInstance; + Memory: MemoryTransportInstance; + Webhook: WebhookTransportInstance; + } + + export type TransportOptions = ConsoleTransportOptions | DailyRotateFileTransportOptions | FileTransportOptions | HttpTransportOptions | MemoryTransportOptions | WebhookTransportOptions | WinstonModuleTransportOptions; + + export interface GenericTransportOptions { + level?: string; + silent?: boolean; + raw?: boolean; + name?: string; + formatter?: Function; + handleExceptions?: boolean; + exceptionsLevel?: string; + humanReadableUnhandledException?: boolean; + } + + export interface GenericTextTransportOptions { + json?: boolean; + colorize?: boolean; + colors?: any; + prettyPrint?: boolean; + timestamp?: (Function | boolean); + showLevel?: boolean; + label?: string; + depth?: number; + stringify?: Function; + } + + export interface GenericNetworkTransportOptions { + host?: string; + port?: number; + auth?: { + username: string; + password: string; + }; + path?: string; + } + + export interface ConsoleTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { + logstash?: boolean; + debugStdout?: boolean; + } + + export interface DailyRotateFileTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { + logstash?: boolean; + maxsize?: number; + maxFiles?: number; + eol?: string; + maxRetries?: number; + datePattern?: string; + filename?: string; + dirname?: string; + options?: { + flags?: string; + highWaterMark?: number; + }; + stream?: NodeJS.WritableStream; + } + + export interface FileTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { + logstash?: boolean; + maxsize?: number; + rotationFormat?: boolean; + zippedArchive?: boolean; + maxFiles?: number; + eol?: string; + tailable?: boolean; + maxRetries?: number; + filename?: string; + dirname?: string; + options?: { + flags?: string; + highWaterMark?: number; + }; + stream?: NodeJS.WritableStream; + } + + export interface HttpTransportOptions extends GenericTransportOptions, GenericNetworkTransportOptions { + ssl?: boolean; + } + + export interface MemoryTransportOptions extends GenericTransportOptions, GenericTextTransportOptions { + } + + export interface WebhookTransportOptions extends GenericTransportOptions, GenericNetworkTransportOptions { + method?: string; + ssl?: { + key?: any; + cert?: any; + ca: any; + }; + } + + export interface WinstonModuleTransportOptions extends GenericTransportOptions { + [optionName: string]: any; + } + + export interface QueryOptions { + rows?: number; + limit?: number; + start?: number; + from?: Date; + until?: Date; + order?: "asc" | "desc"; + fields: any; + } + + export interface ProfileHandler { + logger: LoggerInstance; + start: Date; + done: (msg: string) => LoggerInstance; + } + + interface LogMethod { + (level: string, msg: string, callback: LogCallback): LoggerInstance; + (level: string, msg: string, meta: any, callback: LogCallback): LoggerInstance; + (level: string, msg: string, ...meta: any[]): LoggerInstance; + } + + interface LeveledLogMethod { + (msg: string, callback: LogCallback): LoggerInstance; + (msg: string, meta: any, callback: LogCallback): LoggerInstance; + (msg: string, ...meta: any[]): LoggerInstance; + } + + interface LogCallback { + (error?: any, level?: string, msg?: string, meta?: any): void; + } +} \ No newline at end of file From a32d7bf9563ddbddde1aeb28eda1597206b0f9fb Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 7 Nov 2016 21:13:30 -0800 Subject: [PATCH 25/63] Fixed 'winston' to expose a member named 'default'. --- winston/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winston/index.d.ts b/winston/index.d.ts index 67c37f1352..8a5ef6a687 100644 --- a/winston/index.d.ts +++ b/winston/index.d.ts @@ -20,7 +20,7 @@ interface Winston { Logger: winston.LoggerStatic; Container: winston.ContainerStatic; loggers: winston.ContainerInstance; - defaultLogger: winston.LoggerInstance; + default: winston.LoggerInstance; exception: winston.Exception; From ce87f73b3e87cd86f69945246be26f5dd741db0c Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 7 Nov 2016 21:13:52 -0800 Subject: [PATCH 26/63] Added a test for the default logger in 'winston'. --- winston/winston-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/winston/winston-tests.ts b/winston/winston-tests.ts index 0b3c9f916b..dae649d1f9 100644 --- a/winston/winston-tests.ts +++ b/winston/winston-tests.ts @@ -265,3 +265,5 @@ var logger: winston.LoggerInstance = new (winston.Logger)({ /* Reconfigure logger */ logger.configure({ level: 'silly' }); + +winston.default.warn("Don't export reserved words in JavaScript!"); From e1a436489d1d8b13d6b2d7e17be5e2cf71f9307b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 7 Nov 2016 21:22:42 -0800 Subject: [PATCH 27/63] Moved the 'Winston' interface to the namespace so that it can be augmented. --- winston/index.d.ts | 78 +++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/winston/index.d.ts b/winston/index.d.ts index 8a5ef6a687..6fccfe514c 100644 --- a/winston/index.d.ts +++ b/winston/index.d.ts @@ -11,48 +11,48 @@ /// Winston v2.2.x ///****************** -declare var winston: Winston; +declare var winston: winston.Winston; export = winston; -interface Winston { - transports: winston.Transports; - Transport: winston.TransportStatic; - Logger: winston.LoggerStatic; - Container: winston.ContainerStatic; - loggers: winston.ContainerInstance; - default: winston.LoggerInstance; - - exception: winston.Exception; - - exitOnError: boolean; - level: string; - - log: winston.LogMethod; - - debug: winston.LeveledLogMethod; - info: winston.LeveledLogMethod; - warn: winston.LeveledLogMethod; - error: winston.LeveledLogMethod; - - query(options: winston.QueryOptions, callback?: (err: Error, results: any) => void): any; - query(callback: (err: Error, results: any) => void): any; - stream(options?: any): NodeJS.ReadableStream; - handleExceptions(...transports: winston.TransportInstance[]): void; - unhandleExceptions(...transports: winston.TransportInstance[]): void; - add(transport: winston.TransportInstance, options?: winston.TransportOptions, created?: boolean): winston.LoggerInstance; - clear(): void; - remove(transport: string): winston.LoggerInstance; - remove(transport: winston.TransportInstance): winston.LoggerInstance; - startTimer(): winston.ProfileHandler; - profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): winston.LoggerInstance; - addColors(target: any): any; - setLevels(target: any): any; - cli(): winston.LoggerInstance; - close(): void; - configure(options: winston.LoggerOptions): void; -} - declare namespace winston { + export interface Winston { + transports: winston.Transports; + Transport: winston.TransportStatic; + Logger: winston.LoggerStatic; + Container: winston.ContainerStatic; + loggers: winston.ContainerInstance; + default: winston.LoggerInstance; + + exception: winston.Exception; + + exitOnError: boolean; + level: string; + + log: winston.LogMethod; + + debug: winston.LeveledLogMethod; + info: winston.LeveledLogMethod; + warn: winston.LeveledLogMethod; + error: winston.LeveledLogMethod; + + query(options: winston.QueryOptions, callback?: (err: Error, results: any) => void): any; + query(callback: (err: Error, results: any) => void): any; + stream(options?: any): NodeJS.ReadableStream; + handleExceptions(...transports: winston.TransportInstance[]): void; + unhandleExceptions(...transports: winston.TransportInstance[]): void; + add(transport: winston.TransportInstance, options?: winston.TransportOptions, created?: boolean): winston.LoggerInstance; + clear(): void; + remove(transport: string): winston.LoggerInstance; + remove(transport: winston.TransportInstance): winston.LoggerInstance; + startTimer(): winston.ProfileHandler; + profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): winston.LoggerInstance; + addColors(target: any): any; + setLevels(target: any): any; + cli(): winston.LoggerInstance; + close(): void; + configure(options: winston.LoggerOptions): void; + } + export interface ExceptionProcessInfo { pid: number; uid?: number; From 732b0378d8bdef1ce564b38705631f655cb2e3dc Mon Sep 17 00:00:00 2001 From: David Zearing Date: Tue, 8 Nov 2016 05:25:07 -0800 Subject: [PATCH 28/63] Updating capture events + test. (#12327) * Updating capture events + test. * Updating Capture methods to be inlined. * Removing mouse enter/leave captures. --- react/index.d.ts | 65 ++++++++++++++++++++++++++++++++++++++++++++ react/react-tests.ts | 4 +++ 2 files changed, 69 insertions(+) diff --git a/react/index.d.ts b/react/index.d.ts index 5f2477d678..92aa3a03fc 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -436,98 +436,163 @@ declare namespace React { // Clipboard Events onCopy?: ClipboardEventHandler; + onCopyCapture?: ClipboardEventHandler; onCut?: ClipboardEventHandler; + onCutCapture?: ClipboardEventHandler; onPaste?: ClipboardEventHandler; + onPasteCapture?: ClipboardEventHandler; // Composition Events onCompositionEnd?: CompositionEventHandler; + onCompositionEndCapture?: CompositionEventHandler; onCompositionStart?: CompositionEventHandler; + onCompositionStartCapture?: CompositionEventHandler; onCompositionUpdate?: CompositionEventHandler; + onCompositionUpdateCapture?: CompositionEventHandler; // Focus Events onFocus?: FocusEventHandler; + onFocusCapture?: FocusEventHandler; onBlur?: FocusEventHandler; + onBlurCapture?: FocusEventHandler; // Form Events onChange?: FormEventHandler; + onChangeCapture?: FormEventHandler; onInput?: FormEventHandler; + onInputCapture?: FormEventHandler; onSubmit?: FormEventHandler; + onSubmitCapture?: FormEventHandler; // Image Events onLoad?: ReactEventHandler; + onLoadCapture?: ReactEventHandler; onError?: ReactEventHandler; // also a Media Event + onErrorCapture?: ReactEventHandler; // also a Media Event // Keyboard Events onKeyDown?: KeyboardEventHandler; + onKeyDownCapture?: KeyboardEventHandler; onKeyPress?: KeyboardEventHandler; + onKeyPressCapture?: KeyboardEventHandler; onKeyUp?: KeyboardEventHandler; + onKeyUpCapture?: KeyboardEventHandler; // Media Events onAbort?: ReactEventHandler; + onAbortCapture?: ReactEventHandler; onCanPlay?: ReactEventHandler; + onCanPlayCapture?: ReactEventHandler; onCanPlayThrough?: ReactEventHandler; + onCanPlayThroughCapture?: ReactEventHandler; onDurationChange?: ReactEventHandler; + onDurationChangeCapture?: ReactEventHandler; onEmptied?: ReactEventHandler; + onEmptiedCapture?: ReactEventHandler; onEncrypted?: ReactEventHandler; + onEncryptedCapture?: ReactEventHandler; onEnded?: ReactEventHandler; + onEndedCapture?: ReactEventHandler; onLoadedData?: ReactEventHandler; + onLoadedDataCapture?: ReactEventHandler; onLoadedMetadata?: ReactEventHandler; + onLoadedMetadataCapture?: ReactEventHandler; onLoadStart?: ReactEventHandler; + onLoadStartCapture?: ReactEventHandler; onPause?: ReactEventHandler; + onPauseCapture?: ReactEventHandler; onPlay?: ReactEventHandler; + onPlayCapture?: ReactEventHandler; onPlaying?: ReactEventHandler; + onPlayingCapture?: ReactEventHandler; onProgress?: ReactEventHandler; + onProgressCapture?: ReactEventHandler; onRateChange?: ReactEventHandler; + onRateChangeCapture?: ReactEventHandler; onSeeked?: ReactEventHandler; + onSeekedCapture?: ReactEventHandler; onSeeking?: ReactEventHandler; + onSeekingCapture?: ReactEventHandler; onStalled?: ReactEventHandler; + onStalledCapture?: ReactEventHandler; onSuspend?: ReactEventHandler; + onSuspendCapture?: ReactEventHandler; onTimeUpdate?: ReactEventHandler; + onTimeUpdateCapture?: ReactEventHandler; onVolumeChange?: ReactEventHandler; + onVolumeChangeCapture?: ReactEventHandler; onWaiting?: ReactEventHandler; + onWaitingCapture?: ReactEventHandler; // MouseEvents onClick?: MouseEventHandler; + onClickCapture?: MouseEventHandler; onContextMenu?: MouseEventHandler; + onContextMenuCapture?: MouseEventHandler; onDoubleClick?: MouseEventHandler; + onDoubleClickCapture?: MouseEventHandler; onDrag?: DragEventHandler; + onDragCapture?: DragEventHandler; onDragEnd?: DragEventHandler; + onDragEndCapture?: DragEventHandler; onDragEnter?: DragEventHandler; + onDragEnterCapture?: DragEventHandler; onDragExit?: DragEventHandler; + onDragExitCapture?: DragEventHandler; onDragLeave?: DragEventHandler; + onDragLeaveCapture?: DragEventHandler; onDragOver?: DragEventHandler; + onDragOverCapture?: DragEventHandler; onDragStart?: DragEventHandler; + onDragStartCapture?: DragEventHandler; onDrop?: DragEventHandler; + onDropCapture?: DragEventHandler; onMouseDown?: MouseEventHandler; + onMouseDownCapture?: MouseEventHandler; onMouseEnter?: MouseEventHandler; onMouseLeave?: MouseEventHandler; onMouseMove?: MouseEventHandler; + onMouseMoveCapture?: MouseEventHandler; onMouseOut?: MouseEventHandler; + onMouseOutCapture?: MouseEventHandler; onMouseOver?: MouseEventHandler; + onMouseOverCapture?: MouseEventHandler; onMouseUp?: MouseEventHandler; + onMouseUpCapture?: MouseEventHandler; // Selection Events onSelect?: ReactEventHandler; + onSelectCapture?: ReactEventHandler; // Touch Events onTouchCancel?: TouchEventHandler; + onTouchCancelCapture?: TouchEventHandler; onTouchEnd?: TouchEventHandler; + onTouchEndCapture?: TouchEventHandler; onTouchMove?: TouchEventHandler; + onTouchMoveCapture?: TouchEventHandler; onTouchStart?: TouchEventHandler; + onTouchStartCapture?: TouchEventHandler; // UI Events onScroll?: UIEventHandler; + onScrollCapture?: UIEventHandler; // Wheel Events onWheel?: WheelEventHandler; + onWheelCapture?: WheelEventHandler; // 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 diff --git a/react/react-tests.ts b/react/react-tests.ts index b033907a79..85bc4c0704 100644 --- a/react/react-tests.ts +++ b/react/react-tests.ts @@ -315,6 +315,10 @@ var htmlAttr: React.HTMLProps = { event.preventDefault(); event.stopPropagation(); }, + onClickCapture: (event: React.MouseEvent<{}>) => { + event.preventDefault(); + event.stopPropagation(); + }, dangerouslySetInnerHTML: { __html: "STRONG" } From 9fbf2bbcd8b64789e3004a83e569a9fb4c0170aa Mon Sep 17 00:00:00 2001 From: Rand Scullard Date: Tue, 8 Nov 2016 08:35:23 -0500 Subject: [PATCH 29/63] node-schedule: Add support for object literal syntax. (#12445) --- node-schedule/index.d.ts | 79 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 74 insertions(+), 5 deletions(-) diff --git a/node-schedule/index.d.ts b/node-schedule/index.d.ts index b4cf431e64..d21f46715d 100644 --- a/node-schedule/index.d.ts +++ b/node-schedule/index.d.ts @@ -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. From b4cd313a9a5cfa016fb8cacebb957c6e41473ce1 Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 8 Nov 2016 14:43:32 +0100 Subject: [PATCH 30/63] constructor of Chart also accepts HTMLCanvasElement (#12526) According to http://www.chartjs.org/docs/#getting-started-creating-a-chart the constructor also accepts a HTMLCanvasElement as first argument. --- chart.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chart.js/index.d.ts b/chart.js/index.d.ts index 9bf41eeaae..e9186035c7 100644 --- a/chart.js/index.d.ts +++ b/chart.js/index.d.ts @@ -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) => {}; From fd7d42b3f171b183fa86edf3316f56cd87a2d5b2 Mon Sep 17 00:00:00 2001 From: SONIC3D Date: Tue, 8 Nov 2016 21:43:58 +0800 Subject: [PATCH 31/63] [dat-gui]Updated definitions to dat.gui 0.6.1 (#12370) --- dat-gui/index.d.ts | 68 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/dat-gui/index.d.ts b/dat-gui/index.d.ts index 5a902b228b..7d1e2147d7 100644 --- a/dat-gui/index.d.ts +++ b/dat-gui/index.d.ts @@ -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 -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Definitions by: Satoru Kimura , ZongJing Lu +// 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; } } From 374978e36aec5e8f263ed2944cda8f0bfe3801de Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 8 Nov 2016 13:58:24 +0000 Subject: [PATCH 32/63] Add definitions for trim (#12292) * Add definitions for trim * comments from PR --- trim/index.d.ts | 12 ++++++++++++ trim/trim-tests.ts | 9 +++++++++ trim/tsconfig.json | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 trim/index.d.ts create mode 100644 trim/trim-tests.ts create mode 100644 trim/tsconfig.json diff --git a/trim/index.d.ts b/trim/index.d.ts new file mode 100644 index 0000000000..4d9981052e --- /dev/null +++ b/trim/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for trim 0.01 +// Project: https://www.npmjs.com/package/trim +// Definitions by: Steve Jenkins +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function Trim(str: string): string; +declare namespace Trim { + function left(str: string): string; + function right(str: string): string; +} + +export = Trim; \ No newline at end of file diff --git a/trim/trim-tests.ts b/trim/trim-tests.ts new file mode 100644 index 0000000000..906d2a7b03 --- /dev/null +++ b/trim/trim-tests.ts @@ -0,0 +1,9 @@ +import trim = require("trim"); + +var original: string = " padded string "; + +trim(original); + +trim.left(original); + +trim.right(original); diff --git a/trim/tsconfig.json b/trim/tsconfig.json new file mode 100644 index 0000000000..b063e69e5f --- /dev/null +++ b/trim/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "trim-tests.ts" + ] +} \ No newline at end of file From 1a5687cdc6dddcd436088208d358a655723c4bec Mon Sep 17 00:00:00 2001 From: Endel Dreyer Date: Tue, 8 Nov 2016 14:59:16 +0100 Subject: [PATCH 33/63] EaselJS: add relatedTarget to MouseEvent (#12533) * EaselJS: add propagationStopped and relatedTarget to MouseEvent * remove propagationStopped from MouseEvent it should rather be in createjs-lib.d.ts Event definition --- easeljs/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/easeljs/index.d.ts b/easeljs/index.d.ts index a0dc7b566f..a5916a56f2 100644 --- a/easeljs/index.d.ts +++ b/easeljs/index.d.ts @@ -623,6 +623,7 @@ declare namespace createjs { primary: boolean; rawX: number; rawY: number; + relatedTarget: DisplayObject; stageX: number; stageY: number; mouseMoveOutside: boolean; From 93bb233648560505c01abf9b370e81ae637a0a0f Mon Sep 17 00:00:00 2001 From: Rasmus Prentow Date: Tue, 8 Nov 2016 14:59:28 +0100 Subject: [PATCH 34/63] Added missing method and missing param (#12403) --- google-libphonenumber/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/google-libphonenumber/index.d.ts b/google-libphonenumber/index.d.ts index 937a0d9623..4a0f865373 100644 --- a/google-libphonenumber/index.d.ts +++ b/google-libphonenumber/index.d.ts @@ -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 { From 67213581f3e3cf0785e5f1b3703613d17dedeca0 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 8 Nov 2016 06:05:52 -0800 Subject: [PATCH 35/63] Upgrade packages for types-2.0 (#12539) --- cookiejs/tsconfig.json | 4 ++-- jstimezonedetect/jstimezonedetect-tests.ts | 2 -- jstimezonedetect/tsconfig.json | 19 +++++++++++++++++++ leadfoot/tsconfig.json | 2 +- mz/tsconfig.json | 3 ++- react-json-tree/tsconfig.json | 2 +- 6 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 jstimezonedetect/tsconfig.json diff --git a/cookiejs/tsconfig.json b/cookiejs/tsconfig.json index 49aa749ae4..76d537c57c 100644 --- a/cookiejs/tsconfig.json +++ b/cookiejs/tsconfig.json @@ -5,11 +5,11 @@ "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", - "typesSearchPaths": [ + "typeRoots": [ "../" ], + "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true }, "files": [ diff --git a/jstimezonedetect/jstimezonedetect-tests.ts b/jstimezonedetect/jstimezonedetect-tests.ts index c4907aa6b0..9baf0f4aa5 100644 --- a/jstimezonedetect/jstimezonedetect-tests.ts +++ b/jstimezonedetect/jstimezonedetect-tests.ts @@ -1,5 +1,3 @@ -/// - import * as jstz from 'jstimezonedetect'; jstz.determine().name() === 'America/Montreal'; diff --git a/jstimezonedetect/tsconfig.json b/jstimezonedetect/tsconfig.json new file mode 100644 index 0000000000..d036a843d1 --- /dev/null +++ b/jstimezonedetect/tsconfig.json @@ -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" + ] +} \ No newline at end of file diff --git a/leadfoot/tsconfig.json b/leadfoot/tsconfig.json index cdd1c4b81c..b09d84c423 100644 --- a/leadfoot/tsconfig.json +++ b/leadfoot/tsconfig.json @@ -5,7 +5,7 @@ ], "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/mz/tsconfig.json b/mz/tsconfig.json index 83fafa87ea..7622a546f2 100644 --- a/mz/tsconfig.json +++ b/mz/tsconfig.json @@ -9,7 +9,8 @@ "../" ], "types": [], - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "fs.d.ts", diff --git a/react-json-tree/tsconfig.json b/react-json-tree/tsconfig.json index 3076bbca2e..b1145acf81 100644 --- a/react-json-tree/tsconfig.json +++ b/react-json-tree/tsconfig.json @@ -15,6 +15,6 @@ }, "files": [ "index.d.ts", - "react-json-tree-tests.ts" + "react-json-tree-tests.tsx" ] } From 8f06c382f041b87acc1f6516ed0b9d908ede9658 Mon Sep 17 00:00:00 2001 From: Dan Manastireanu Date: Tue, 8 Nov 2016 16:13:47 +0200 Subject: [PATCH 36/63] Update ChartAnnotations in google.visualization. Closes #11828 (#12362) --- .../google.visualization-tests.ts | 85 ++++++++++++++++++- google.visualization/index.d.ts | 24 +++++- 2 files changed, 105 insertions(+), 4 deletions(-) diff --git a/google.visualization/google.visualization-tests.ts b/google.visualization/google.visualization-tests.ts index 2cbd8220f2..129b0dd971 100644 --- a/google.visualization/google.visualization-tests.ts +++ b/google.visualization/google.visualization-tests.ts @@ -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,77 @@ 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 + } + }; +} diff --git a/google.visualization/index.d.ts b/google.visualization/index.d.ts index a4dc1b7b1a..e315ec8cb1 100644 --- a/google.visualization/index.d.ts +++ b/google.visualization/index.d.ts @@ -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; From 2f38649769efde0468be5ef4e0b5aba56da2b844 Mon Sep 17 00:00:00 2001 From: Adam Cmiel Date: Tue, 8 Nov 2016 06:15:49 -0800 Subject: [PATCH 37/63] Types 2.0 (#12429) * add missing members for token creation add `createToken: (StripeTokenData) => Promise` overload to StripeStatic add `type: string` in StripeTokenResponse * [FIX] response interfaces * add apple pay * [FIX] tests --- stripe/index.d.ts | 74 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 67 insertions(+), 7 deletions(-) diff --git a/stripe/index.d.ts b/stripe/index.d.ts index 8a03ee3f33..2f8c895298 100644 --- a/stripe/index.d.ts +++ b/stripe/index.d.ts @@ -1,9 +1,10 @@ // Type definitions for stripe // Project: https://stripe.com/ -// Definitions by: Andy Hawkins , Eric J. Smith , Amrit Kahlon +// Definitions by: Andy Hawkins , Eric J. Smith , Amrit Kahlon , Adam Cmiel // 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; +} From ded43c0126962de20c6478289d82242369654d0b Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 8 Nov 2016 06:39:26 -0800 Subject: [PATCH 38/63] Make test files lowercase so they compile on linux (#12549) --- .../{jquery.ajaxFile-tests.ts => jquery.ajaxfile-tests.ts} | 0 .../{jquery.SlimScroll-tests.ts => jquery.slimscroll-tests.ts} | 0 jquery.slimscroll/tsconfig.json | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename jquery.ajaxfile/{jquery.ajaxFile-tests.ts => jquery.ajaxfile-tests.ts} (100%) rename jquery.slimscroll/{jquery.SlimScroll-tests.ts => jquery.slimscroll-tests.ts} (100%) diff --git a/jquery.ajaxfile/jquery.ajaxFile-tests.ts b/jquery.ajaxfile/jquery.ajaxfile-tests.ts similarity index 100% rename from jquery.ajaxfile/jquery.ajaxFile-tests.ts rename to jquery.ajaxfile/jquery.ajaxfile-tests.ts diff --git a/jquery.slimscroll/jquery.SlimScroll-tests.ts b/jquery.slimscroll/jquery.slimscroll-tests.ts similarity index 100% rename from jquery.slimscroll/jquery.SlimScroll-tests.ts rename to jquery.slimscroll/jquery.slimscroll-tests.ts diff --git a/jquery.slimscroll/tsconfig.json b/jquery.slimscroll/tsconfig.json index 910f07039e..524b9a8740 100644 --- a/jquery.slimscroll/tsconfig.json +++ b/jquery.slimscroll/tsconfig.json @@ -14,6 +14,6 @@ }, "files": [ "index.d.ts", - "jquery.slimScroll-tests.ts" + "jquery.slimscroll-tests.ts" ] } \ No newline at end of file From 7f9ddef9b85e2ef3661a62bd3d4ad01d2452b3d8 Mon Sep 17 00:00:00 2001 From: Linken Dinh Date: Tue, 8 Nov 2016 15:53:49 +0100 Subject: [PATCH 39/63] [types-2.0] react - better strict mode compatibility (#11935) * strict mode compatible * include 11931 * vsiao - code review * vsiao - code review - revert complex cloneelement case * validator to accept null * remove double tests * test use Error | null * code reviews * code reviews --- react/index.d.ts | 12 +++++----- react/react-tests.ts | 57 ++++++++++++++++++++++++-------------------- react/tsconfig.json | 2 +- 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/react/index.d.ts b/react/index.d.ts index 92aa3a03fc..8d5edbab51 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -28,7 +28,7 @@ declare namespace React { interface ReactElement

{ type: string | ComponentClass

| SFC

; props: P; - key?: Key; + key: Key | null; } interface SFCElement

extends ReactElement

{ @@ -74,7 +74,7 @@ declare namespace React { type ClassicFactory

= CFactory>; interface DOMFactory

, T extends Element> { - (props?: P & ClassAttributes, ...children: ReactNode[]): DOMElement; + (props?: P & ClassAttributes | null, ...children: ReactNode[]): DOMElement; } interface HTMLFactory extends DOMFactory, T> { @@ -93,7 +93,7 @@ declare namespace React { // Should be Array but type aliases cannot be recursive type ReactFragment = {} | Array; - type ReactNode = ReactChild | ReactFragment | boolean; + type ReactNode = ReactChild | ReactFragment | boolean | null | undefined; // // Top Level API @@ -201,7 +201,7 @@ declare namespace React { type SFC

= StatelessComponent

; interface StatelessComponent

{ - (props: P, context?: any): ReactElement | null; + (props: P, context?: any): ReactElement; propTypes?: ValidationMap

; contextTypes?: ValidationMap; defaultProps?: P; @@ -262,7 +262,7 @@ declare namespace React { } interface ComponentSpec extends Mixin { - render(): ReactElement; + render(): ReactElement | null; [propertyName: string]: any; } @@ -2354,7 +2354,7 @@ declare namespace React { // ---------------------------------------------------------------------- interface Validator { - (object: T, key: string, componentName: string, ...rest: any[]): Error; + (object: T, key: string, componentName: string, ...rest: any[]): Error | null; } interface Requireable extends Validator { diff --git a/react/react-tests.ts b/react/react-tests.ts index 85bc4c0704..7cdecd9e86 100644 --- a/react/react-tests.ts +++ b/react/react-tests.ts @@ -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 = React.createClass({ + displayName: "ClassicComponent", getDefaultProps() { return { - hello: undefined, + hello: "hello", world: "peace", - foo: undefined + foo: 0, }; }, getInitialState() { @@ -187,6 +188,10 @@ var domElement: React.ReactHTMLElement = // React.cloneElement var clonedElement: React.CElement = React.cloneElement(element, { foo: 43 }); + +React.cloneElement(element, {}); +React.cloneElement(element, {}, null); + var clonedElement2: React.CElement = // known problem: cloning with key or ref requires cast React.cloneElement(element, >{ @@ -240,18 +245,15 @@ domNode = ReactDOM.findDOMNode(domNode); var type: React.ComponentClass = 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 = ClassicComponent.propTypes; +var displayName: string | undefined = ClassicComponent.displayName; +var defaultProps: Props = ClassicComponent.getDefaultProps ? ClassicComponent.getDefaultProps() : {}; +var propTypes: React.ValidationMap | undefined = ClassicComponent.propTypes; // // Component API @@ -282,7 +284,7 @@ class RefComponent extends React.Component { } } -var componentRef: RefComponent; +var componentRef: RefComponent = new RefComponent(); RefComponent.create({ ref: "componentRef" }); // type of c should be inferred RefComponent.create({ ref: c => componentRef = c }); @@ -377,14 +379,14 @@ var PropTypesSpecification: React.ComponentSpec = { }), 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; @@ -395,7 +397,7 @@ var PropTypesSpecification: React.ComponentSpec = { return null; } }, - render: (): React.ReactElement => { + render: (): React.ReactElement | null => { return null; } }; @@ -429,14 +431,14 @@ var ContextTypesSpecification: React.ComponentSpec = { }), 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 => { + render: (): null => { return null; } }; @@ -499,7 +501,7 @@ createFragment({ // -------------------------------------------------------------------------- React.createFactory(CSSTransitionGroup)({ component: React.createClass({ - render: (): React.ReactElement => null + render: (): null => null }), childFactory: (c) => c, transitionName: "transition", @@ -605,16 +607,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; -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; } // @@ -655,4 +660,4 @@ class ConstructorSpreadArgsPureComponent extends React.PureComponent<{}, {}> { constructor(...args: any[]) { super(...args); } -} \ No newline at end of file +} diff --git a/react/tsconfig.json b/react/tsconfig.json index 55fd2537d4..d89fd3bdf7 100644 --- a/react/tsconfig.json +++ b/react/tsconfig.json @@ -8,7 +8,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" From 0052449e2933524dc66132a751cb82754755ecb1 Mon Sep 17 00:00:00 2001 From: Jan Michael Alonzo Date: Wed, 9 Nov 2016 02:03:45 +1100 Subject: [PATCH 40/63] [Yargs] Allow Command modules to be passed into command fn (#12524) * [Yargs] Allow Command modules to be passed into command fn * [yargs] Remove I prefix in CommandModule * [Yargs] Replace Array<> with string[] * Make builder, command, describe optional; Handle (c, d, m) command signature --- yargs/index.d.ts | 11 +++++++++++ yargs/yargs-tests.ts | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/yargs/index.d.ts b/yargs/index.d.ts index 238f5d1edd..97c68f07cd 100644 --- a/yargs/index.d.ts +++ b/yargs/index.d.ts @@ -70,6 +70,8 @@ declare namespace yargs { command(command: string, description: string, builder: { [optionName: string]: Options }): Argv; command(command: string, description: string, builder: { [optionName: string]: Options }, handler: (args: Argv) => void): Argv; command(command: string, description: string, builder: (args: Argv) => Options, handler: (args: Argv) => void): Argv; + command(command: string, description: string, module: CommandModule): Argv; + command(module: CommandModule): Argv; commandDir(dir: string, opts?: RequireDirectoryOptions): Argv; @@ -199,6 +201,15 @@ declare namespace yargs { nargs?: number; } + interface CommandModule { + aliases?: string[] | string; + builder?: CommandBuilder; + command?: string[] | string; + describe?: string | false; + handler: (args: any) => void; + } + + type CommandBuilder = {[key: string]: Options} | ((args: Argv) => Argv); type SyncCompletionFunction = (current: string, argv: any) => string[]; type AsyncCompletionFunction = (current: string, argv: any, done: (completion: string[]) => void) => void; } diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index 011d305621..5770f9dd9c 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -207,6 +207,23 @@ function command() { description:"Should i publish?" } }) + .command({ + command: "test", + describe: "test package", + builder: { + mateys: { + demand: false + } + }, + handler: (args: any) => { + /* handle me mateys! */ + } + }) + .command("test", "test mateys", { + handler: (args: any) => { + /* handle me mateys! */ + } + }) .help('help') .argv; } From 5f1b0991303a64bcadc754b71708ffae05a4ddba Mon Sep 17 00:00:00 2001 From: Ilya Kuznetsov Date: Tue, 8 Nov 2016 18:06:35 +0300 Subject: [PATCH 41/63] [Types 2.0] Add Chai-spies (#12489) * Types for chai-spies * References for external dependencies were added * chai-spies: reference to 'chai' typings was added --- chai-spies/chai-spies-tests.ts | 135 +++++++++++ chai-spies/index.d.ts | 411 +++++++++++++++++++++++++++++++++ chai-spies/tsconfig.json | 19 ++ 3 files changed, 565 insertions(+) create mode 100644 chai-spies/chai-spies-tests.ts create mode 100644 chai-spies/index.d.ts create mode 100644 chai-spies/tsconfig.json diff --git a/chai-spies/chai-spies-tests.ts b/chai-spies/chai-spies-tests.ts new file mode 100644 index 0000000000..7ac0610e4d --- /dev/null +++ b/chai-spies/chai-spies-tests.ts @@ -0,0 +1,135 @@ +/// +/// + +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); \ No newline at end of file diff --git a/chai-spies/index.d.ts b/chai-spies/index.d.ts new file mode 100644 index 0000000000..ffed6e594b --- /dev/null +++ b/chai-spies/index.d.ts @@ -0,0 +1,411 @@ +// Type definitions for chai-spies +// Project: https://github.com/chaijs/chai-spies +// Definitions by: Ilya Kuznetsov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +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; + (fn: SpyFunc0): SpyFunc0Proxy; + (fn: SpyFunc1): SpyFunc1Proxy; + (fn: SpyFunc2): SpyFunc2Proxy; + (fn: SpyFunc3): SpyFunc3Proxy; + (fn: SpyFunc4): SpyFunc4Proxy; + (fn: SpyFunc5): SpyFunc5Proxy; + (fn: SpyFunc6): SpyFunc6Proxy; + (fn: SpyFunc7): SpyFunc7Proxy; + (fn: SpyFunc8): SpyFunc8Proxy; + (fn: SpyFunc9): SpyFunc9Proxy; + (fn: SpyFunc10): SpyFunc10Proxy; + (name: string, fn: SpyFunc0): SpyFunc0Proxy; + (name: string, fn: SpyFunc1): SpyFunc1Proxy; + (name: string, fn: SpyFunc2): SpyFunc2Proxy; + (name: string, fn: SpyFunc3): SpyFunc3Proxy; + (name: string, fn: SpyFunc4): SpyFunc4Proxy; + (name: string, fn: SpyFunc5): SpyFunc5Proxy; + (name: string, fn: SpyFunc6): SpyFunc6Proxy; + (name: string, fn: SpyFunc7): SpyFunc7Proxy; + (name: string, fn: SpyFunc8): SpyFunc8Proxy; + (name: string, fn: SpyFunc9): SpyFunc9Proxy; + (name: string, fn: SpyFunc10): SpyFunc10Proxy; + + /** + * #### 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(name: string, methods: T): T; + object(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(value: T): SpyFunc0Proxy; + } + + 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; + } + + interface SpyFunc1 { + (a: A1): R; + } + + interface SpyFunc2 { + (a: A1, b: A2): R; + } + + interface SpyFunc3 { + (a: A1, b: A2, c: A3): R; + } + + interface SpyFunc4 { + (a: A1, b: A2, c: A3, d: A4): R; + } + + interface SpyFunc5 { + (a: A1, b: A2, c: A3, d: A4, e: A5): R; + } + + interface SpyFunc6 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6): R; + } + + interface SpyFunc7 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7): R; + } + + interface SpyFunc8 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8): R; + } + + interface SpyFunc9 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9): R; + } + + interface SpyFunc10 { + (a: A1, b: A2, c: A3, d: A4, e: A5, f: A6, g: A7, h: A8, i: A9, j: A10): R; + } + + interface SpyFunc0Proxy extends SpyFunc0, Resetable { + } + + interface SpyFunc1Proxy extends SpyFunc1, Resetable { + } + + interface SpyFunc2Proxy extends SpyFunc2, Resetable { + } + + interface SpyFunc3Proxy extends SpyFunc3, Resetable { + } + + interface SpyFunc4Proxy extends SpyFunc4, Resetable { + } + + interface SpyFunc5Proxy extends SpyFunc5, Resetable { + } + + interface SpyFunc6Proxy extends SpyFunc6, Resetable { + } + + interface SpyFunc7Proxy extends SpyFunc7, Resetable { + } + + interface SpyFunc8Proxy extends SpyFunc8, Resetable { + } + + interface SpyFunc9Proxy extends SpyFunc9, Resetable { + } + + interface SpyFunc10Proxy extends SpyFunc10, Resetable { + } +} + +declare var spies: ChaiSpies.Spy; + +declare module "chai-spies" { + export = spies; +} diff --git a/chai-spies/tsconfig.json b/chai-spies/tsconfig.json new file mode 100644 index 0000000000..91c115a7a5 --- /dev/null +++ b/chai-spies/tsconfig.json @@ -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" + ] +} \ No newline at end of file From 4bb4da03933c76e1ddf2d8707749faecaaa600ab Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Tue, 8 Nov 2016 09:12:49 -0600 Subject: [PATCH 42/63] line argument is an object, not a primitive (#12393) --- codemirror/index.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/codemirror/index.d.ts b/codemirror/index.d.ts index 708b32812e..83c45e93ab 100644 --- a/codemirror/index.d.ts +++ b/codemirror/index.d.ts @@ -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 { } } } - From 9d945fb562a16a1166291dbb775ba6b35ce554cd Mon Sep 17 00:00:00 2001 From: Martin Sikora Date: Tue, 8 Nov 2016 16:15:41 +0100 Subject: [PATCH 43/63] Added missing onStop() method. (#12558) --- tween.js/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tween.js/index.d.ts b/tween.js/index.d.ts index 7091b5a05b..c2c5a22297 100644 --- a/tween.js/index.d.ts +++ b/tween.js/index.d.ts @@ -21,6 +21,7 @@ declare namespace TWEEN { interpolation(interpolation: (v:number[], k:number) => number): Tween; chain(...tweens:Tween[]): Tween; onStart(callback: (object?: any) => void): Tween; + onStop(callback: (object?: any) => void): Tween; onUpdate(callback: (object?: any) => void): Tween; onComplete(callback: (object?: any) => void): Tween; update(time: number): boolean; @@ -101,4 +102,4 @@ interface TweenInterpolation { declare module 'tween.js' { export = TWEEN; -} \ No newline at end of file +} From 8b21b7adde51faa74d8cfd611d21fee868361a34 Mon Sep 17 00:00:00 2001 From: Philipp A Date: Tue, 8 Nov 2016 16:16:00 +0100 Subject: [PATCH 44/63] Fixed StringProtocolCallback call signature (#12522) --- electron/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/electron/index.d.ts b/electron/index.d.ts index d39710189b..c0797775a2 100644 --- a/electron/index.d.ts +++ b/electron/index.d.ts @@ -2850,7 +2850,7 @@ declare namespace Electron { interface StringProtocolCallback extends ProtocolCallback { (str: string): void; (obj: { - data: Buffer, + data: string, mimeType: string, charset?: string }): void; From 988774a261086d762ed27b302bddf027fc38af8a Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 8 Nov 2016 15:17:25 +0000 Subject: [PATCH 45/63] bind ponyfill type def (#12559) --- bind-ponyfill/bind-ponyfill-tests.ts | 8 ++++++++ bind-ponyfill/index.d.ts | 7 +++++++ bind-ponyfill/tsconfig.json | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 bind-ponyfill/bind-ponyfill-tests.ts create mode 100644 bind-ponyfill/index.d.ts create mode 100644 bind-ponyfill/tsconfig.json diff --git a/bind-ponyfill/bind-ponyfill-tests.ts b/bind-ponyfill/bind-ponyfill-tests.ts new file mode 100644 index 0000000000..8c5ba7ec05 --- /dev/null +++ b/bind-ponyfill/bind-ponyfill-tests.ts @@ -0,0 +1,8 @@ +import ponyBind = require('bind-ponyfill'); + +let boundFn: Function; + +boundFn = ponyBind(() => { console.log(this); }, 'Hello world!'); +boundFn = ponyBind((...args: Array) => { console.log(this, ...args); }, 'Hello world!', 'arg1'); +boundFn = ponyBind((...args: Array) => { console.log(this, ...args); }, 'Hello world!', 'arg1', 'arg2'); +boundFn = ponyBind((arg1: string, arg2: number) => { console.log(this, arg1, arg2); }, 'Hello world!', 'arg1', 2); \ No newline at end of file diff --git a/bind-ponyfill/index.d.ts b/bind-ponyfill/index.d.ts new file mode 100644 index 0000000000..8fb2227627 --- /dev/null +++ b/bind-ponyfill/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for bind-ponyfill 0.1.0 +// Project: https://www.npmjs.com/package/bind-ponyfill +// Definitions by: Steve Jenkins +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function ponyBind(fn: Function, that: any, ...args: Array): Function; +export = ponyBind; \ No newline at end of file diff --git a/bind-ponyfill/tsconfig.json b/bind-ponyfill/tsconfig.json new file mode 100644 index 0000000000..44c1eca54a --- /dev/null +++ b/bind-ponyfill/tsconfig.json @@ -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" + ] +} From 77b51c349b535f80c541f670c4c43abcb21ff716 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 8 Nov 2016 15:17:47 +0000 Subject: [PATCH 46/63] updated typings (#12532) * updated typings * fix comments from PR --- lz-string/index.d.ts | 32 +++++++++++++++++++++++++++++++- lz-string/lz-string-tests.ts | 7 ++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/lz-string/index.d.ts b/lz-string/index.d.ts index 499c9cf50c..19c97c419f 100644 --- a/lz-string/index.d.ts +++ b/lz-string/index.d.ts @@ -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 // 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; } } diff --git a/lz-string/lz-string-tests.ts b/lz-string/lz-string-tests.ts index e26160f5f4..131bce2105 100644 --- a/lz-string/lz-string-tests.ts +++ b/lz-string/lz-string-tests.ts @@ -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); \ No newline at end of file +decoded = LZString.decompressFromBase64(encoded); +encoded = LZString.compressToEncodedURIComponent(input); +decoded = LZString.compressToEncodedURIComponent(encoded); +encodedU8 = LZString.compressToUint8Array(input); +decoded = LZString.decompressFromUint8Array(encodedU8); \ No newline at end of file From 215055b6c6ae3898b031529c4af278678873d677 Mon Sep 17 00:00:00 2001 From: Bradford Wagner Date: Tue, 8 Nov 2016 10:20:32 -0500 Subject: [PATCH 47/63] adding angular clipboard (#12458) * adding angular clipboard * adding tests * fixing unit tests * Update angular-clipboard-tests.ts triggering build * adhering to the no interface I convention * just using a module now * strictNullChecks: true, and removing declare module --- angular-clipboard/angular-clipboard-tests.ts | 14 ++++++++++++++ angular-clipboard/index.d.ts | 20 ++++++++++++++++++++ angular-clipboard/tsconfig.json | 19 +++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 angular-clipboard/angular-clipboard-tests.ts create mode 100644 angular-clipboard/index.d.ts create mode 100644 angular-clipboard/tsconfig.json diff --git a/angular-clipboard/angular-clipboard-tests.ts b/angular-clipboard/angular-clipboard-tests.ts new file mode 100644 index 0000000000..ccb1c7ce9a --- /dev/null +++ b/angular-clipboard/angular-clipboard-tests.ts @@ -0,0 +1,14 @@ +/// +/// + +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'); + } + }; +}); diff --git a/angular-clipboard/index.d.ts b/angular-clipboard/index.d.ts new file mode 100644 index 0000000000..bb2d93ce49 --- /dev/null +++ b/angular-clipboard/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for angular-clipboard v1.5 +// Project: https://github.com/omichelsen/angular-clipboard +// Definitions by: Bradford Wagner +// 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; +} diff --git a/angular-clipboard/tsconfig.json b/angular-clipboard/tsconfig.json new file mode 100644 index 0000000000..df3b091b93 --- /dev/null +++ b/angular-clipboard/tsconfig.json @@ -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": false + } +} From 2b4f52b1eb19cd849d40240bed5dde2e3c016a98 Mon Sep 17 00:00:00 2001 From: valorize Date: Tue, 8 Nov 2016 20:43:26 +0100 Subject: [PATCH 48/63] Added collapseOnSelect --- react-bootstrap/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/react-bootstrap/index.d.ts b/react-bootstrap/index.d.ts index 9780efb443..d23874c246 100644 --- a/react-bootstrap/index.d.ts +++ b/react-bootstrap/index.d.ts @@ -551,6 +551,7 @@ declare namespace ReactBootstrap { staticTop?: boolean; toggleButton?: any; // TODO: Add more specific type toggleNavKey?: string | number; + collapseOnSelect?: boolean; } interface NavbarClass extends React.ClassicComponentClass { Brand: typeof NavbarBrand; From b8c6cce44415475000bf3a712112978f958fe5ee Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 8 Nov 2016 12:59:26 -0800 Subject: [PATCH 49/63] Prefer es6 target and forceConsistentCasingInFileNames (#12537) --- browser-resolve/tsconfig.json | 2 +- cassandra-driver/tsconfig.json | 4 ++-- cordova-plugin-battery-status/tsconfig.json | 3 ++- cordova-plugin-camera/tsconfig.json | 3 ++- cordova-plugin-contacts/tsconfig.json | 3 ++- cordova-plugin-device-motion/tsconfig.json | 3 ++- cordova-plugin-device/tsconfig.json | 3 ++- cordova-plugin-dialogs/tsconfig.json | 3 ++- cordova-plugin-file/tsconfig.json | 3 ++- cordova-plugin-globalization/tsconfig.json | 3 ++- cordova-plugin-inappbrowser/tsconfig.json | 3 ++- cordova-plugin-keyboard/tsconfig.json | 3 ++- cordova-plugin-media/tsconfig.json | 3 ++- cordova-plugin-splashscreen/tsconfig.json | 3 ++- cordova-plugin-statusbar/tsconfig.json | 3 ++- cordova-plugin-vibration/tsconfig.json | 3 ++- cordova-plugin-websql/tsconfig.json | 3 ++- cordova/tsconfig.json | 3 ++- ids/tsconfig.json | 2 +- lodash/tsconfig.json | 2 +- object-refs/tsconfig.json | 2 +- resolve/tsconfig.json | 2 +- ssh2-streams/tsconfig.json | 3 ++- ssh2/tsconfig.json | 3 ++- winrt-uwp/tsconfig.json | 2 +- winrt/tsconfig.json | 2 +- yayson/tsconfig.json | 2 +- 27 files changed, 46 insertions(+), 28 deletions(-) diff --git a/browser-resolve/tsconfig.json b/browser-resolve/tsconfig.json index 937a2406b8..d708711572 100644 --- a/browser-resolve/tsconfig.json +++ b/browser-resolve/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/cassandra-driver/tsconfig.json b/cassandra-driver/tsconfig.json index 0dec57214f..10b7ab8253 100644 --- a/cassandra-driver/tsconfig.json +++ b/cassandra-driver/tsconfig.json @@ -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" ] } \ No newline at end of file diff --git a/cordova-plugin-battery-status/tsconfig.json b/cordova-plugin-battery-status/tsconfig.json index b781800488..0ba34b4eaf 100644 --- a/cordova-plugin-battery-status/tsconfig.json +++ b/cordova-plugin-battery-status/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-camera/tsconfig.json b/cordova-plugin-camera/tsconfig.json index fd82d2283c..4bcb17e701 100644 --- a/cordova-plugin-camera/tsconfig.json +++ b/cordova-plugin-camera/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-contacts/tsconfig.json b/cordova-plugin-contacts/tsconfig.json index 150cbbc01b..e7622317a1 100644 --- a/cordova-plugin-contacts/tsconfig.json +++ b/cordova-plugin-contacts/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-device-motion/tsconfig.json b/cordova-plugin-device-motion/tsconfig.json index 38d054da74..8fdea1bb00 100644 --- a/cordova-plugin-device-motion/tsconfig.json +++ b/cordova-plugin-device-motion/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-device/tsconfig.json b/cordova-plugin-device/tsconfig.json index 2382a3c48b..a7004ed713 100644 --- a/cordova-plugin-device/tsconfig.json +++ b/cordova-plugin-device/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-dialogs/tsconfig.json b/cordova-plugin-dialogs/tsconfig.json index 8a06fc75a3..66e676d30c 100644 --- a/cordova-plugin-dialogs/tsconfig.json +++ b/cordova-plugin-dialogs/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-file/tsconfig.json b/cordova-plugin-file/tsconfig.json index 62e93d809e..52446e1912 100644 --- a/cordova-plugin-file/tsconfig.json +++ b/cordova-plugin-file/tsconfig.json @@ -9,7 +9,8 @@ "../" ], "types": [], - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-globalization/tsconfig.json b/cordova-plugin-globalization/tsconfig.json index c743a2a3ee..1f61009199 100644 --- a/cordova-plugin-globalization/tsconfig.json +++ b/cordova-plugin-globalization/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-inappbrowser/tsconfig.json b/cordova-plugin-inappbrowser/tsconfig.json index 171d99407e..d26ba0222f 100644 --- a/cordova-plugin-inappbrowser/tsconfig.json +++ b/cordova-plugin-inappbrowser/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-keyboard/tsconfig.json b/cordova-plugin-keyboard/tsconfig.json index 00a8c3f7c5..d2f26294bc 100644 --- a/cordova-plugin-keyboard/tsconfig.json +++ b/cordova-plugin-keyboard/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-media/tsconfig.json b/cordova-plugin-media/tsconfig.json index 7875dd04a0..d9fc3553b5 100644 --- a/cordova-plugin-media/tsconfig.json +++ b/cordova-plugin-media/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-splashscreen/tsconfig.json b/cordova-plugin-splashscreen/tsconfig.json index 032aed70bc..43e60dcd63 100644 --- a/cordova-plugin-splashscreen/tsconfig.json +++ b/cordova-plugin-splashscreen/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-statusbar/tsconfig.json b/cordova-plugin-statusbar/tsconfig.json index c464e89096..99f1b831a0 100644 --- a/cordova-plugin-statusbar/tsconfig.json +++ b/cordova-plugin-statusbar/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-vibration/tsconfig.json b/cordova-plugin-vibration/tsconfig.json index 8835563a00..65aa81393a 100644 --- a/cordova-plugin-vibration/tsconfig.json +++ b/cordova-plugin-vibration/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova-plugin-websql/tsconfig.json b/cordova-plugin-websql/tsconfig.json index 36e7e41481..7bace33807 100644 --- a/cordova-plugin-websql/tsconfig.json +++ b/cordova-plugin-websql/tsconfig.json @@ -4,7 +4,8 @@ "target": "es6", "noImplicitAny": false, "strictNullChecks": false, - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/cordova/tsconfig.json b/cordova/tsconfig.json index 417dadb8b6..afe8d4ba45 100644 --- a/cordova/tsconfig.json +++ b/cordova/tsconfig.json @@ -9,7 +9,8 @@ "../" ], "types": [], - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/ids/tsconfig.json b/ids/tsconfig.json index 822ef6cd32..85fbd7f361 100644 --- a/ids/tsconfig.json +++ b/ids/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/lodash/tsconfig.json b/lodash/tsconfig.json index dd337af9c4..0a0d666d66 100644 --- a/lodash/tsconfig.json +++ b/lodash/tsconfig.json @@ -290,7 +290,7 @@ ], "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/object-refs/tsconfig.json b/object-refs/tsconfig.json index 472dc47723..6b81d1c07d 100644 --- a/object-refs/tsconfig.json +++ b/object-refs/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/resolve/tsconfig.json b/resolve/tsconfig.json index 3327aff4ab..61c58f56db 100644 --- a/resolve/tsconfig.json +++ b/resolve/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/ssh2-streams/tsconfig.json b/ssh2-streams/tsconfig.json index 476b06feb6..78441a6fbf 100644 --- a/ssh2-streams/tsconfig.json +++ b/ssh2-streams/tsconfig.json @@ -9,7 +9,8 @@ "../" ], "types": [], - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/ssh2/tsconfig.json b/ssh2/tsconfig.json index 4ab8f30918..a89361b4db 100644 --- a/ssh2/tsconfig.json +++ b/ssh2/tsconfig.json @@ -9,7 +9,8 @@ "../" ], "types": [], - "noEmit": true + "noEmit": true, + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", diff --git a/winrt-uwp/tsconfig.json b/winrt-uwp/tsconfig.json index e8f51c4af5..79b9eb6b27 100644 --- a/winrt-uwp/tsconfig.json +++ b/winrt-uwp/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/winrt/tsconfig.json b/winrt/tsconfig.json index e8f51c4af5..79b9eb6b27 100644 --- a/winrt/tsconfig.json +++ b/winrt/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", diff --git a/yayson/tsconfig.json b/yayson/tsconfig.json index dc04b6dd8c..33d32555f9 100644 --- a/yayson/tsconfig.json +++ b/yayson/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "target": "es5", + "target": "es6", "noImplicitAny": true, "strictNullChecks": false, "baseUrl": "../", From c1b6039500e6f37d3a88af7ef8c026014efb72c7 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Tue, 8 Nov 2016 13:18:44 -0800 Subject: [PATCH 50/63] Upgrade angular-ui-router-uib-modal for types-2.0 --- angular-clipboard/tsconfig.json | 2 +- .../angular-ui-router-uib-modal-tests.ts | 2 -- ...ar-ui-router-uib-modal.d.ts => index.d.ts} | 10 ++++++---- angular-ui-router-uib-modal/tsconfig.json | 19 +++++++++++++++++++ 4 files changed, 26 insertions(+), 7 deletions(-) rename angular-ui-router-uib-modal/{angular-ui-router-uib-modal.d.ts => index.d.ts} (64%) create mode 100644 angular-ui-router-uib-modal/tsconfig.json diff --git a/angular-clipboard/tsconfig.json b/angular-clipboard/tsconfig.json index df3b091b93..1f69b1e8fa 100644 --- a/angular-clipboard/tsconfig.json +++ b/angular-clipboard/tsconfig.json @@ -14,6 +14,6 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": false + "forceConsistentCasingInFileNames": true } } diff --git a/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts b/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts index 3f14b2a40f..2ca6e18806 100644 --- a/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts +++ b/angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts @@ -1,5 +1,3 @@ -/// - angular.module("test", [ "ui.bootstrap", "ui.router", diff --git a/angular-ui-router-uib-modal/angular-ui-router-uib-modal.d.ts b/angular-ui-router-uib-modal/index.d.ts similarity index 64% rename from angular-ui-router-uib-modal/angular-ui-router-uib-modal.d.ts rename to angular-ui-router-uib-modal/index.d.ts index 598fe964fe..29e963fc6e 100644 --- a/angular-ui-router-uib-modal/angular-ui-router-uib-modal.d.ts +++ b/angular-ui-router-uib-modal/index.d.ts @@ -3,10 +3,12 @@ // Definitions by: Stepan Riha // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +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[]; + } } } diff --git a/angular-ui-router-uib-modal/tsconfig.json b/angular-ui-router-uib-modal/tsconfig.json new file mode 100644 index 0000000000..08dbd4d4cf --- /dev/null +++ b/angular-ui-router-uib-modal/tsconfig.json @@ -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" + ] +} \ No newline at end of file From 559095e6e29b571cae70fd6a7afc4ce4fd750ed8 Mon Sep 17 00:00:00 2001 From: thevtm Date: Tue, 8 Nov 2016 19:49:40 -0200 Subject: [PATCH 51/63] Revert "[@types/mongoose] Declare a right type for _id" --- mongoose/index.d.ts | 2 +- passport-local-mongoose/passport-local-mongoose-tests.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mongoose/index.d.ts b/mongoose/index.d.ts index 12c92571b5..150d94b2df 100644 --- a/mongoose/index.d.ts +++ b/mongoose/index.d.ts @@ -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. */ diff --git a/passport-local-mongoose/passport-local-mongoose-tests.ts b/passport-local-mongoose/passport-local-mongoose-tests.ts index 21a928a8d7..7b428561fe 100644 --- a/passport-local-mongoose/passport-local-mongoose-tests.ts +++ b/passport-local-mongoose/passport-local-mongoose-tests.ts @@ -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; From 5257be31cc94a912aaf88812f1e474543319e203 Mon Sep 17 00:00:00 2001 From: haoliangyu Date: Tue, 8 Nov 2016 22:47:52 -0500 Subject: [PATCH 52/63] update --- leaflet/index.d.ts | 32 ++++++++++++++++++++++++++++++++ leaflet/leaflet-tests.ts | 20 ++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/leaflet/index.d.ts b/leaflet/index.d.ts index feb9694126..d43a2303da 100644 --- a/leaflet/index.d.ts +++ b/leaflet/index.d.ts @@ -1185,6 +1185,38 @@ declare namespace L { distance: number; } + export namespace 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: (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 { mapPane: HTMLElement; tilePane: HTMLElement; diff --git a/leaflet/leaflet-tests.ts b/leaflet/leaflet-tests.ts index 0551118cee..34a5fa245f 100644 --- a/leaflet/leaflet-tests.ts +++ b/leaflet/leaflet-tests.ts @@ -207,6 +207,26 @@ tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png'); tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', tileLayerOptions); tileLayer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png?{foo}&{bar}&{abc}', {foo: 'bar', bar: (data: any) => 'foo', abc: () => ''}); +let eventHandler = () => {}; +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 // removeControl From 6922165cbb9ddd22192e3b6937ffa84ddc311f55 Mon Sep 17 00:00:00 2001 From: Alexander Chudesnov Date: Wed, 9 Nov 2016 20:49:55 +0300 Subject: [PATCH 53/63] =?UTF-8?q?Allow=20children=20in=20stateless=20compo?= =?UTF-8?q?nents=E2=80=99=20props?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows passing children to `StatelessComponent

` exactly like base components without the need to use React.Props or extending the P interface with an explicit 'children' property: # Before ````typescript type FooProps = { bar: number; } const Foo: React.SFC = props => (

{props.children} = {props.bar} // error TS2459: Type 'FooProps' has no property 'children' and no string index signature.
); ```` # After ````typescript type FooProps = { bar: number; } const Foo: React.SFC = props => (
{props.children} = {props.bar}
); 6×9 //
6×9 = 42
```` --- react/index.d.ts | 2 +- react/react-tests.ts | 4 ++++ react/react-tsx-tests.tsx | 10 ++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/react/index.d.ts b/react/index.d.ts index 8d5edbab51..dd2add0e0e 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -201,7 +201,7 @@ declare namespace React { type SFC

= StatelessComponent

; interface StatelessComponent

{ - (props: P, context?: any): ReactElement; + (props: P & { children?: ReactNode }, context?: any): ReactElement; propTypes?: ValidationMap

; contextTypes?: ValidationMap; defaultProps?: P; diff --git a/react/react-tests.ts b/react/react-tests.ts index 7cdecd9e86..ae9538b294 100644 --- a/react/react-tests.ts +++ b/react/react-tests.ts @@ -152,6 +152,10 @@ StatelessComponent2.defaultProps = { foo: 42 }; +var StatelessComponent3: React.SFC = + // allows usage of props.children + props => React.DOM.div(null, props.foo, props.children); + // React.createFactory var factory: React.CFactory = React.createFactory(ModernComponent); diff --git a/react/react-tsx-tests.tsx b/react/react-tsx-tests.tsx index 3756659a53..f5437f751b 100644 --- a/react/react-tsx-tests.tsx +++ b/react/react-tsx-tests.tsx @@ -13,3 +13,13 @@ StatelessComponent.defaultProps = { }; ; + +var StatelessComponent2: React.SFC = ({ foo, children }) => { + return

{ foo }{ children }
; +}; +StatelessComponent2.displayName = "StatelessComponent4"; +StatelessComponent2.defaultProps = { + foo: 42 +}; + +24; From f2094c6d276ed05f9016c7f13bde4c95e092b5c0 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 8 Nov 2016 16:18:01 -0800 Subject: [PATCH 54/63] Fix typings in yargs. Fixed valid keys to the Options argument object. Fixed a couple linting issues. --- yargs/index.d.ts | 45 +++++++++++++++++++++++--------------------- yargs/yargs-tests.ts | 31 ++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 21 deletions(-) diff --git a/yargs/index.d.ts b/yargs/index.d.ts index 97c68f07cd..d2c8026973 100644 --- a/yargs/index.d.ts +++ b/yargs/index.d.ts @@ -146,7 +146,7 @@ declare namespace yargs { count(key: string): Argv; count(keys: string[]): Argv; - fail(func: (msg: string, err: Error) => any): Argv; + fail(func: (msg: string, err: Error) => any): Argv; coerce(key: string|string[], func: (arg: T) => U): Argv; coerce(opts: { [key: string]: (arg: T) => U; }): Argv; @@ -172,33 +172,36 @@ declare namespace yargs { recurse?: boolean; extensions?: string[]; visit?: (commandObject: any, pathToFile?: string, filename?: string) => any; - include?: RegExp | ((pathToFile: string)=>boolean); - exclude?: RegExp | ((pathToFile: string)=>boolean); + include?: RegExp | ((pathToFile: string) => boolean); + exclude?: RegExp | ((pathToFile: string) => boolean); } interface Options { - type?: string; - group?: string; - alias?: any; - demand?: any; - required?: any; - require?: any; + alias?: string | string[]; + array?: boolean; + boolean?: boolean; + choices?: string[]; + coerce?: (arg: any) => any; + config?: boolean; + configParser?: (configPath: string) => Object; + count?: boolean; default?: any; defaultDescription?: string; - boolean?: boolean; - string?: boolean; - count?: boolean; - describe?: any; - description?: any; - desc?: any; - requiresArg?: any; - choices?: string[]; + demand?: boolean | string; + desc?: string | {[key: string]: string}; + describe?: string | {[key: string]: string}; + description?: string | {[key: string]: string}; global?: boolean; - array?: boolean; - config?: boolean; - number?: boolean; - normalize?: boolean; + group?: string; nargs?: number; + normalize?: boolean; + number?: boolean; + require?: boolean | string; + required?: boolean | string; + requiresArg?: boolean | string; + skipValidation?: boolean; + string?: boolean; + type?: "array" | "boolean" | "count" | "number" | "string"; } interface CommandModule { diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index 5770f9dd9c..8fb693803a 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -517,3 +517,34 @@ function Argv$skipValidation() { .skipValidation(['arg2', 'arg3']) .argv } + +function Argv$commandObject() { + var ya = yargs + .command("commandname", "description", { + "arg": { + alias: "string", + array: true, + boolean: true, + choices: ["a", "b", "c"], + coerce: f => JSON.stringify(f), + config: true, + configParser: t => t, + count: true, + default: "myvalue", + defaultDescription: "description", + demand: true, + desc: "desc", + describe: "describe", + description: "description", + global: false, + group: "group", + nargs: 1, + normalize: false, + number: true, + requiresArg: true, + skipValidation: false, + string: true, + type: "string" + } + }) +} From fbbc69d437d54795710f94bed25fd4fed02831a7 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 9 Nov 2016 12:59:28 -0800 Subject: [PATCH 55/63] Fix typing for desc/describe/description. --- yargs/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yargs/index.d.ts b/yargs/index.d.ts index d2c8026973..fa82e2490e 100644 --- a/yargs/index.d.ts +++ b/yargs/index.d.ts @@ -188,9 +188,9 @@ declare namespace yargs { default?: any; defaultDescription?: string; demand?: boolean | string; - desc?: string | {[key: string]: string}; - describe?: string | {[key: string]: string}; - description?: string | {[key: string]: string}; + desc?: string; + describe?: string; + description?: string; global?: boolean; group?: string; nargs?: number; From e25ee6787a2155575df37e9982a873d686ff90ea Mon Sep 17 00:00:00 2001 From: valorize Date: Thu, 10 Nov 2016 09:06:40 +0100 Subject: [PATCH 56/63] Alphabetized --- react-bootstrap/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-bootstrap/index.d.ts b/react-bootstrap/index.d.ts index d23874c246..2ec9eed50d 100644 --- a/react-bootstrap/index.d.ts +++ b/react-bootstrap/index.d.ts @@ -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; @@ -551,7 +552,6 @@ declare namespace ReactBootstrap { staticTop?: boolean; toggleButton?: any; // TODO: Add more specific type toggleNavKey?: string | number; - collapseOnSelect?: boolean; } interface NavbarClass extends React.ClassicComponentClass { Brand: typeof NavbarBrand; From e2a78f7234953e99137b424d959264218f66956b Mon Sep 17 00:00:00 2001 From: "Scott(JuJiang)" Date: Thu, 10 Nov 2016 20:21:13 +0800 Subject: [PATCH 57/63] update: improve typings for some class methods (#12564) --- webpack-sources/index.d.ts | 59 +++++++++++++----------- webpack-sources/webpack-sources-tests.ts | 6 ++- 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/webpack-sources/index.d.ts b/webpack-sources/index.d.ts index c87a29d464..245e251a7f 100644 --- a/webpack-sources/index.d.ts +++ b/webpack-sources/index.d.ts @@ -5,8 +5,10 @@ /// /// +/// -import { SourceNode } from 'source-map' +import { Hash } from 'crypto' +import { SourceNode, RawSourceMap, SourceMapGenerator } from 'source-map' import { SourceListMap } from 'source-list-map' export abstract class Source { @@ -16,10 +18,10 @@ export abstract class Source { sourceAndMap(options?: any): { source: string; - map: string; + map: RawSourceMap; }; - updateHash(hash: any): void; + updateHash(hash: Hash): void; source(options?: any): string; @@ -31,20 +33,22 @@ export abstract class Source { } interface SourceAndMapMixin { - map(options: { columns?: boolean }): string + map(options: { columns?: boolean }): RawSourceMap; sourceAndMap(options: { columns?: boolean }): { - source: string, - map: string - } + source: string; + map: RawSourceMap; + }; } export class CachedSource { _source: Source; _cachedSource: string; _cachedSize: number; - _cachedMaps: any; - node: (options: any) => any; - listMap: (options: any) => any; + _cachedMaps: { + [prop: string]: RawSourceMap + }; + node: (options: any) => SourceNode; + listMap: (options: any) => SourceListMap; constructor(source: Source); @@ -54,12 +58,12 @@ export class CachedSource { sourceAndMap(options: any): { source: string; - map: any; + map: RawSourceMap; }; - map(options: any): any; + map(options: any): RawSourceMap; - updateHash(hash: any): void; + updateHash(hash: Hash): void; } export class ConcatSource extends Source implements SourceAndMapMixin { @@ -77,7 +81,7 @@ export class ConcatSource extends Source implements SourceAndMapMixin { listMap(options: any): SourceListMap; - updateHash(hash: any): void; + updateHash(hash: Hash): void; } export class LineToLineMappedSource extends Source implements SourceAndMapMixin { @@ -93,7 +97,7 @@ export class LineToLineMappedSource extends Source implements SourceAndMapMixin listMap(options: any): SourceListMap; - updateHash(hash: any): void; + updateHash(hash: Hash): void; } export class OriginalSource extends Source implements SourceAndMapMixin { @@ -112,7 +116,7 @@ export class OriginalSource extends Source implements SourceAndMapMixin { listMap(options: any): SourceListMap; - updateHash(hash: any): void; + updateHash(hash: Hash): void; } export class PrefixSource extends Source implements SourceAndMapMixin { @@ -125,9 +129,9 @@ export class PrefixSource extends Source implements SourceAndMapMixin { node(options: any): SourceNode; - listMap(options: any): any; + listMap(options: any): SourceListMap; - updateHash(hash: any): void; + updateHash(hash: Hash): void; } export class RawSource extends Source { @@ -137,13 +141,13 @@ export class RawSource extends Source { source(): string; - map(options: any): any; + map(options: any): null; node(options: any): SourceNode; listMap(options: any): SourceListMap; - updateHash(hash: any): void; + updateHash(hash: Hash): void; } export class ReplaceSource extends Source implements SourceAndMapMixin { @@ -165,7 +169,7 @@ export class ReplaceSource extends Source implements SourceAndMapMixin { node(options: any): SourceNode; - listMap(options: any): any; + listMap(options: any): SourceListMap; _replacementToSourceNode(oldNode: SourceNode, newString: string): string | SourceNode; @@ -178,11 +182,14 @@ export class ReplaceSource extends Source implements SourceAndMapMixin { export class SourceMapSource extends Source implements SourceAndMapMixin { _value: string; _name: string; - _sourceMap: any; - _originalSource: Source; - _innerSourceMap: any; + _sourceMap: SourceMapGenerator | RawSourceMap; + _originalSource: string; + _innerSourceMap: RawSourceMap; - constructor(value: string, name: string, sourceMap: any, originalSource: Source, innerSourceMap?: any); + constructor( + value: string, name: string, sourceMap: SourceMapGenerator | RawSourceMap, originalSource: string, + innerSourceMap?: RawSourceMap + ); source(): string; @@ -194,5 +201,5 @@ export class SourceMapSource extends Source implements SourceAndMapMixin { } ): SourceListMap; - updateHash(hash: any): void; + updateHash(hash: Hash): void; } diff --git a/webpack-sources/webpack-sources-tests.ts b/webpack-sources/webpack-sources-tests.ts index 4c4dc6afab..622f12cb8e 100644 --- a/webpack-sources/webpack-sources-tests.ts +++ b/webpack-sources/webpack-sources-tests.ts @@ -11,6 +11,7 @@ import { SourceMapSource, } from 'webpack-sources'; +import { RawSourceMap } from 'source-map' const s1 = new OriginalSource('a', 'b'); @@ -20,7 +21,10 @@ const s3 = new ConcatSource('a', 'b', s1); const s4 = new RawSource('hey'); +const a = {} as RawSourceMap +const b = {} as RawSourceMap + const s5 = new LineToLineMappedSource('a', 'v', 'c'); const s6 = new PrefixSource(s4, s5); const s7 = new ReplaceSource(s3, 'ha'); -const s8 = new SourceMapSource('va', 'vb', 'vc', s6, 'good'); +const s8 = new SourceMapSource('va', 'vb', a, 'vc', b); From 19e5c2a094527945c6329c23773f21b85f53b75d Mon Sep 17 00:00:00 2001 From: Dan Manastireanu Date: Thu, 10 Nov 2016 14:21:26 +0200 Subject: [PATCH 58/63] Updated google.visualization with OrgChart. Closes #3687 (#12360) --- .../google.visualization-tests.ts | 30 +++++++++++++++++++ google.visualization/index.d.ts | 30 ++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/google.visualization/google.visualization-tests.ts b/google.visualization/google.visualization-tests.ts index 129b0dd971..a51657a592 100644 --- a/google.visualization/google.visualization-tests.ts +++ b/google.visualization/google.visualization-tests.ts @@ -591,3 +591,33 @@ function test_ChartAnnotations() { } }; } + + +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
President
'}, '', 'The President'], + [{v:'Jim', f:'Jim
Vice President
'}, '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(); + +} diff --git a/google.visualization/index.d.ts b/google.visualization/index.d.ts index e315ec8cb1..83b08296f8 100644 --- a/google.visualization/index.d.ts +++ b/google.visualization/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Google Visualisation Apis // Project: https://developers.google.com/chart/ -// Definitions by: Dan Ludwig , Gregory Moore +// Definitions by: Dan Ludwig , Gregory Moore , Dan Manastireanu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace google { @@ -1377,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 } } From 0298c01966cd32884ebefad2cfb5fc347470cb78 Mon Sep 17 00:00:00 2001 From: "Scott(JuJiang)" Date: Thu, 10 Nov 2016 20:21:40 +0800 Subject: [PATCH 59/63] update: add private member info and rename an interface (#12563) --- tapable/index.d.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tapable/index.d.ts b/tapable/index.d.ts index 4588643c6d..68ea3e4104 100644 --- a/tapable/index.d.ts +++ b/tapable/index.d.ts @@ -4,6 +4,10 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare abstract class Tapable { + private _plugins: { + [index: string]: Tapable.Handler[] + } + /** * Register plugin(s) * This acts as the same as on() of EventEmitter, for registering a handler/listener to do something when the @@ -12,9 +16,9 @@ declare abstract class Tapable { * @param names a string or an array of strings to generate the id(group name) of plugins * @param handler a function which provides the plugin functionality * */ - plugin(names: string, handler: Tapable.Listener): void; + plugin(names: string, handler: Tapable.Handler): void; - plugin(names: string[], handler: Tapable.Listener): void; + plugin(names: string[], handler: Tapable.Handler): void; /** * invoke all plugins with this attached. @@ -185,7 +189,7 @@ declare abstract class Tapable { } declare namespace Tapable { - interface Listener { + interface Handler { (...args: any[]): void; } From 1b5a083cdf4505c7435756a3f77102f02c05f23b Mon Sep 17 00:00:00 2001 From: "Scott(JuJiang)" Date: Thu, 10 Nov 2016 20:21:47 +0800 Subject: [PATCH 60/63] update: more accurate types (#12562) --- loader-runner/index.d.ts | 6 +++--- loader-runner/loader-runner-tests.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/loader-runner/index.d.ts b/loader-runner/index.d.ts index 102348ec71..f0b34ec600 100644 --- a/loader-runner/index.d.ts +++ b/loader-runner/index.d.ts @@ -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; diff --git a/loader-runner/loader-runner-tests.ts b/loader-runner/loader-runner-tests.ts index cfdd08f11b..38661b60ec 100644 --- a/loader-runner/loader-runner-tests.ts +++ b/loader-runner/loader-runner-tests.ts @@ -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'); From c4afd27a4427539f287f553ddf339d2b45565fc7 Mon Sep 17 00:00:00 2001 From: Sho Fuji Date: Thu, 10 Nov 2016 22:47:55 +0900 Subject: [PATCH 61/63] Add definition for deku (#12557) * Add definition for deku * Add deku/tsconfig.json * Replace Action to any * Fix test * Fix exporting * Rename deku.d.ts -> index.d.ts * Remove unnecessary reference * Change to more specific type * Add private type: Dispatch * dispatch: Function -> dispatch: Dispatch * Remove duplicated overloading * More specific type for createThunkElement * Fix version * Change interface Actions -> class Actions * interface -> class * Change return type of deku.diff.Actions.case * Update test * Change parameter type of deku.dom.update * dispatch: Function -> dispatch: Dispatch --- deku/deku-tests.ts | 208 +++++++++++++++++++++++++++++++++++++++++++++ deku/index.d.ts | 136 +++++++++++++++++++++++++++++ deku/tsconfig.json | 19 +++++ 3 files changed, 363 insertions(+) create mode 100644 deku/deku-tests.ts create mode 100644 deku/index.d.ts create mode 100644 deku/tsconfig.json diff --git a/deku/deku-tests.ts b/deku/deku-tests.ts new file mode 100644 index 0000000000..d123c7b8f7 --- /dev/null +++ b/deku/deku-tests.ts @@ -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) +})(); diff --git a/deku/index.d.ts b/deku/index.d.ts new file mode 100644 index 0000000000..ff5a68f8bb --- /dev/null +++ b/deku/index.d.ts @@ -0,0 +1,136 @@ +// Type definitions for deku v2.0 +// Project: https://github.com/anthonyshort/deku +// Definitions by: Sho Fuji +// 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(vnode: VirtualElement, path: string, dispatch: Dispatch, context: C): HTMLElement; + + /** + * Modify a DOM element given an array of actions. + */ + function update(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(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(type: string, attributes: A, ...children: any[]): VirtualElement; + + function element(type: Thunk): VirtualElement; + function element(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(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(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; diff --git a/deku/tsconfig.json b/deku/tsconfig.json new file mode 100644 index 0000000000..3a18954e88 --- /dev/null +++ b/deku/tsconfig.json @@ -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" + ] +} From 0fe09ccd9d5b7bd39b1056aa02533820ae458ceb Mon Sep 17 00:00:00 2001 From: "Jimi (Dimitris) Charalampidis" Date: Thu, 10 Nov 2016 22:09:38 +0200 Subject: [PATCH 62/63] Add stompjs types 2.0 definitions. (#12605) --- stompjs/index.d.ts | 67 +++++++++++++++++++++++++++++++ stompjs/stompjs-tests.ts | 87 ++++++++++++++++++++++++++++++++++++++++ stompjs/tsconfig.json | 19 +++++++++ 3 files changed, 173 insertions(+) create mode 100644 stompjs/index.d.ts create mode 100644 stompjs/stompjs-tests.ts create mode 100644 stompjs/tsconfig.json diff --git a/stompjs/index.d.ts b/stompjs/index.d.ts new file mode 100644 index 0000000000..607be77162 --- /dev/null +++ b/stompjs/index.d.ts @@ -0,0 +1,67 @@ +// Type definitions for stompjs 2.3 +// Project: https://github.com/jmesnil/stomp-websocket +// Definitions by: Jimi Charalampidis +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export const VERSIONS: { + V1_0: string, + V1_1: string, + V1_2: string, + supportedVersions: () => Array +}; + +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): 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; diff --git a/stompjs/stompjs-tests.ts b/stompjs/stompjs-tests.ts new file mode 100644 index 0000000000..68320259a9 --- /dev/null +++ b/stompjs/stompjs-tests.ts @@ -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'); diff --git a/stompjs/tsconfig.json b/stompjs/tsconfig.json new file mode 100644 index 0000000000..2377e6b1b7 --- /dev/null +++ b/stompjs/tsconfig.json @@ -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" + ] +} From 697d724a005c4fb9763b91bd6274a1604ad7a863 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 10 Nov 2016 15:06:53 -0800 Subject: [PATCH 63/63] Make more test files lowercase so they compile on linux (#12573) --- arbiter/{Arbiter-tests.ts => arbiter-tests.ts} | 0 extjs/{ExtJS-tests.ts => extjs-tests.ts} | 0 headroom/tsconfig.json | 2 +- leapmotionts/{LeapMotionTS-tests.ts => leapmotionts-tests.ts} | 0 leapmotionts/tsconfig.json | 2 +- 5 files changed, 2 insertions(+), 2 deletions(-) rename arbiter/{Arbiter-tests.ts => arbiter-tests.ts} (100%) rename extjs/{ExtJS-tests.ts => extjs-tests.ts} (100%) rename leapmotionts/{LeapMotionTS-tests.ts => leapmotionts-tests.ts} (100%) diff --git a/arbiter/Arbiter-tests.ts b/arbiter/arbiter-tests.ts similarity index 100% rename from arbiter/Arbiter-tests.ts rename to arbiter/arbiter-tests.ts diff --git a/extjs/ExtJS-tests.ts b/extjs/extjs-tests.ts similarity index 100% rename from extjs/ExtJS-tests.ts rename to extjs/extjs-tests.ts diff --git a/headroom/tsconfig.json b/headroom/tsconfig.json index 6b6f41a4b8..3dd7aec967 100644 --- a/headroom/tsconfig.json +++ b/headroom/tsconfig.json @@ -14,6 +14,6 @@ }, "files": [ "index.d.ts", - "Headroom-tests.ts" + "headroom-tests.ts" ] } \ No newline at end of file diff --git a/leapmotionts/LeapMotionTS-tests.ts b/leapmotionts/leapmotionts-tests.ts similarity index 100% rename from leapmotionts/LeapMotionTS-tests.ts rename to leapmotionts/leapmotionts-tests.ts diff --git a/leapmotionts/tsconfig.json b/leapmotionts/tsconfig.json index d6599c4e70..4e16a4efea 100644 --- a/leapmotionts/tsconfig.json +++ b/leapmotionts/tsconfig.json @@ -14,6 +14,6 @@ }, "files": [ "index.d.ts", - "leapmotionTS-tests.ts" + "leapmotionts-tests.ts" ] } \ No newline at end of file