From 1136e3f00c525d2eeb381aee7497c730748eecfd Mon Sep 17 00:00:00 2001 From: abraaoalves Date: Sun, 4 Sep 2016 22:22:59 -0300 Subject: [PATCH 01/88] feat(data_table): add support to cucumberjs --- cucumber/cucumber-tests.ts | 48 ++++++++++++++++++++++++++++++++++---- cucumber/cucumber.d.ts | 11 ++++++++- 2 files changed, 54 insertions(+), 5 deletions(-) diff --git a/cucumber/cucumber-tests.ts b/cucumber/cucumber-tests.ts index d6ada278c2..9f22e3f75d 100644 --- a/cucumber/cucumber-tests.ts +++ b/cucumber/cucumber-tests.ts @@ -1,24 +1,26 @@ /// +/// function StepSample() { type Callback = cucumber.CallbackStepDefinition; + type Table = cucumber.TableDefinition; var step = this; var hook = this; - + hook.Before(function(scenario, callback){ scenario.isFailed() && callback.pending(); }) - + hook.Around(function(scenario, runScenario) { scenario.isFailed() && runScenario(null, function(){ console.log('finish tasks'); }); }); - + hook.registerHandler('AfterFeatures', function (event, callback) { callback(); }); - + step.Given(/^I am on the Cucumber.js GitHub repository$/, function(callback:Callback) { this.visit('https://github.com/cucumber/cucumber-js', callback); }); @@ -36,5 +38,43 @@ function StepSample() { callback(new Error("Expected to be on page with title " + title)); } }); + + // Type for data_table.js on + // https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js + + step.Given(/^a table step with Table raw$/, function(table:Table){ + var expected = [ + ['Cucumber', 'Cucumis sativus'], + ['Burr Gherkin', 'Cucumis anguria'] + ]; + + assert.deepEqual(table.raw(), expected); + }); + + step.Given(/^a table step with Table rows$/, function(table: Table){ + var expected = [ + ['Apricot', '5'], + ['Brocolli', '2'], + ['Cucumber', '10'] + ]; + assert.deepEqual(table.rows(), expected) + }); + + step.Given(/^a table step with Table rowHash$/, function(table:Table){ + var expected = { + 'Cucumber': 'Cucumis sativus', + 'Burr Gherkin': 'Cucumis anguria' + }; + assert.deepEqual(table.rowsHash(), expected) + }); + + step.Given(/^a table step$/, function(table:Table){ + var expected = [ + {'Vegetable': 'Apricot', 'Rating': '5'}, + {'Vegetable': 'Brocolli', 'Rating': '2'}, + {'Vegetable': 'Cucumber', 'Rating': '10'} + ]; + assert.deepEqual(table.hashes(), expected) + }); } diff --git a/cucumber/cucumber.d.ts b/cucumber/cucumber.d.ts index 6c4273e4e0..cb37208477 100644 --- a/cucumber/cucumber.d.ts +++ b/cucumber/cucumber.d.ts @@ -10,8 +10,17 @@ declare namespace cucumber { (errror?:any):void; } + export interface TableDefinition{ + raw: () => Array; + rows: () => Array; + rowsHash: () => {}; + hashes: () => {}; + } + + type StepDefinitionParam = string | CallbackStepDefinition | TableDefinition; + interface StepDefinitionCode { - (...stepArgs: Array): PromiseLike | any | void; + (...stepArgs: Array): PromiseLike | any | void; } interface StepDefinitionOptions{ From f905616e26f99a47ebda0ea9c64d6a1e582de8a5 Mon Sep 17 00:00:00 2001 From: nikogu <644506165@qq.com> Date: Mon, 5 Sep 2016 16:29:38 +0800 Subject: [PATCH 02/88] add dva declaration --- dva/dva-tests.tsx | 46 ++++++++++++++++++++++++++++++++++++++++++++++ dva/dva.d.ts | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 dva/dva-tests.tsx create mode 100644 dva/dva.d.ts diff --git a/dva/dva-tests.tsx b/dva/dva-tests.tsx new file mode 100644 index 0000000000..079e0eea81 --- /dev/null +++ b/dva/dva-tests.tsx @@ -0,0 +1,46 @@ +// +// + +import dva from 'dva'; +import { connect } from 'dva'; +import { Router, Route } from 'dva/router'; + +// 1. Initialize +const app = dva(); + +// 2. Model +app.model({ + namespace: 'count', + state: 0, + reducers: { + add (count) { + return count + 1 + }, + minus(count) { + return count - 1 + }, + }, +}); + +// 3. View +const App = connect(({ count }) => ({ + count +}))(function (props) { + return ( +
+

{ props.count }

+ + +
+ ); +}); + +// 4. Router +app.router(({ history }) => + + + +); + +// 5. Start +const countApp = app.start(); diff --git a/dva/dva.d.ts b/dva/dva.d.ts new file mode 100644 index 0000000000..ffaa618785 --- /dev/null +++ b/dva/dva.d.ts @@ -0,0 +1,45 @@ +// Type definitions for dva v1.0.0 +// Project: https://github.com/dvajs/dva +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module 'dva' { + /** connecting Container Components */ + export function connect(maps):Function; + + export default function dva(opts?:Object):{ + + /** dva plugin */ + use: (hooks:Object)=>void, + + /** dva bootstrap */ + start: (selector?:Object)=>void, + + /** dva add model */ + model: (model:Object)=>void, + + /** dva setting router */ + router: (router)=>void, + }; +} + +/** + * https://github.com/reactjs/react-router + */ +declare module 'dva/router' { + export class Router {} + export class Route {} +} + +/** + * https://github.com/reactjs/react-router-redux + */ +declare module 'dva/routerRedux' { + export default Object; +} + +/** + * https://github.com/fis-components/whatwg-fetch + */ +declare module 'dva/fetch' { + export default Function; +} From 5cb131b218074bc0eedc00cc2d4113dd0b9c4ddd Mon Sep 17 00:00:00 2001 From: nikogu <644506165@qq.com> Date: Mon, 5 Sep 2016 16:50:52 +0800 Subject: [PATCH 03/88] pass the test --- dva/dva-tests.tsx | 18 ++++++++++-------- dva/dva.d.ts | 25 +++++++++++++++++++++---- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/dva/dva-tests.tsx b/dva/dva-tests.tsx index 079e0eea81..917ee69e60 100644 --- a/dva/dva-tests.tsx +++ b/dva/dva-tests.tsx @@ -1,5 +1,7 @@ -// -// +/// +/// + +import React = __React; import dva from 'dva'; import { connect } from 'dva'; @@ -13,10 +15,10 @@ app.model({ namespace: 'count', state: 0, reducers: { - add (count) { + add(count: number) { return count + 1 }, - minus(count) { + minus(count: number) { return count - 1 }, }, @@ -25,12 +27,12 @@ app.model({ // 3. View const App = connect(({ count }) => ({ count -}))(function (props) { +}))(function ({ count, dispatch }) { return (
-

{ props.count }

- - +

{ count }

+ +
); }); diff --git a/dva/dva.d.ts b/dva/dva.d.ts index ffaa618785..b6d7e78248 100644 --- a/dva/dva.d.ts +++ b/dva/dva.d.ts @@ -1,10 +1,12 @@ // Type definitions for dva v1.0.0 // Project: https://github.com/dvajs/dva +// Definitions by: nikogu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// declare module 'dva' { /** connecting Container Components */ - export function connect(maps):Function; + export function connect(maps:Object):Function; export default function dva(opts?:Object):{ @@ -18,7 +20,7 @@ declare module 'dva' { model: (model:Object)=>void, /** dva setting router */ - router: (router)=>void, + router: (router:Object)=>void, }; } @@ -26,8 +28,23 @@ declare module 'dva' { * https://github.com/reactjs/react-router */ declare module 'dva/router' { - export class Router {} - export class Route {} + import React = __React; + + interface RouterProps { + history?: Object + } + export class Router extends React.Component { + render(): JSX.Element + } + + + interface RouteProps { + path?: string, + component?: React.ReactNode + } + export class Route extends React.Component { + render(): JSX.Element + } } /** From bbbc2633179c978b41ab44c6a37a260cf7f4f21b Mon Sep 17 00:00:00 2001 From: Mickael Burguet Date: Tue, 6 Sep 2016 11:12:59 -0400 Subject: [PATCH 04/88] [pino]: Fix constructor argument stream typing --- pino/pino.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pino/pino.d.ts b/pino/pino.d.ts index 1d7049cf05..0a51c49275 100644 --- a/pino/pino.d.ts +++ b/pino/pino.d.ts @@ -41,8 +41,8 @@ declare module 'pino' { } interface Pino { - (optionsOrStream?: LoggerOptions | stream.Writable): Logger - (options: LoggerOptions, stream: stream.Writable): Logger + (optionsOrStream?: LoggerOptions | stream.Writable | stream.Readable): Logger + (options: LoggerOptions, stream: stream.Writable | stream.Readable): Logger levels: { values: LevelLabelsToValues labels: LevelValuesToLabels From ff773ccff899b0dc1826508f12516b831cddc04c Mon Sep 17 00:00:00 2001 From: rvassar Date: Tue, 6 Sep 2016 14:56:46 -0700 Subject: [PATCH 05/88] Added a constructor and interface for the OSM class. --- openlayers/openlayers.d.ts | 77 +++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 25 deletions(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index ec180bf45d..486a488724 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -211,6 +211,30 @@ declare namespace olx { /** experimental Whether to wrap the world horizontally. When set to false, only one world will be rendered. When true, tiles will be requested for one world only, but they will be wrapped horizontally to render multiple worlds. The default is true. */ wrapX?: boolean; } + interface OSMOptions { + /** Attributions */ + attributions?: ol.AttributionLike; + /** Cache size. Default is 2048. */ + cacheSize?: number; + /** + * The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL + * renderer or if you want to access pixel data with the Canvas renderer. + * See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail. Default is anonymous. + */ + crossOrigin?: string; + /** Max zoom. Default is 19. */ + maxZoom?: number; + /** Whether the layer is opaque. Default is true. */ + opaque?: boolean; + /** Maximum allowed reprojection error (in pixels). Default is 0.5. Higher values can increase reprojection performance, but decrease precision. */ + reprojectionErrorThreshold?: number; + /** Optional function to load a tile given a URL. */ + tileLoadFunction?: ol.TileLoadFunctionType; + /** URL template. Must include {x}, {y} or {-y}, and {z} placeholders. Default is https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png. */ + url?: string; + /** Whether to wrap the world horizontally. Default is true. */ + wrapX?: boolean; + } /** * Object literal with config options for the map logo. */ @@ -791,24 +815,24 @@ declare namespace olx { */ wrapX?: boolean; } - + interface ClusterOptions extends VectorOptions{ - + /** * Minimum distance in pixels between clusters. Default is 20. */ distance?: number; - + extent?: ol.Extent; - + geometryFunction?: any; - + projection?: ol.proj.ProjectionLike; - + source: ol.source.Vector; - + } - + interface WMTSOptions { attributions?: Array; crossOrigin?: string; @@ -1127,6 +1151,8 @@ declare namespace ol { interface ImageLoadFunctionType { (image: ol.Image, url: string): void } + type AttributionLike = string | Array | ol.Attribution | Array + /** * An attribution for a layer source. */ @@ -2422,9 +2448,9 @@ declare namespace ol { * @returns Control.s */ function defaults(options?: olx.control.DefaultsOptions): ol.Collection; - + namespace ScaleLine { - + /** * Units for the scale line. Supported values are 'degrees', 'imperial', 'nautical', 'metric', 'us'. */ @@ -2433,29 +2459,29 @@ declare namespace ol { class Control extends ol.Object{ constructor(options: olx.control.ControlOptions); - + /** * Get the map associated with this control. */ getMap():ol.Map; - + /** - * Remove the control from its current map and attach it to the new map. + * Remove the control from its current map and attach it to the new map. * Subclasses may set up event handlers to get notified about changes to the map here. */ setMap(map: ol.Map):void; - + /** - * This function is used to set a target element for the control. - * It has no effect if it is called after the control has been added to the map (i.e. after setMap is called on the control). + * This function is used to set a target element for the control. + * It has no effect if it is called after the control has been added to the map (i.e. after setMap is called on the control). * If no target is set in the options passed to the control constructor and if setTarget is not called then the control is * added to the map's overlay container. */ setTarget(target: Element | string):void; - - + + } - + class Attribution extends Control { } @@ -2472,17 +2498,17 @@ declare namespace ol { } class ScaleLine extends Control { - + /** * Return the units to use in the scale line. */ getUnits(): ScaleLine.Units; - + /** * Set the units to use in the scale line. */ setUnits(units: ScaleLine.Units): void; - + } class Zoom extends Control{ @@ -4061,7 +4087,7 @@ declare namespace ol { * @argument map. */ setMap(map: ol.Map): void; - + /** * Set Z-index of the layer, which is used to order layers before rendering. The default Z-index is 0. */ @@ -4254,12 +4280,13 @@ declare namespace ol { } class OSM extends XYZ { + constructor(opt_options?: olx.OSMOptions); } class Source extends ol.Object { - + constructor(options: any); - + /** * Get the projection of the source. * @return Projection. From fbfb2a48ec6a06dcaacfe4ee1d2880c51a848883 Mon Sep 17 00:00:00 2001 From: Sumit Kumar Maitra Date: Wed, 7 Sep 2016 00:43:03 +0100 Subject: [PATCH 06/88] Updating Quill JS definitions to v1.0.0 Refactoring definitions as per latest guidelines/best-practices Built using Typescript 1.8 --- quill/quill-tests.ts | 78 +++++++----------- quill/quill.d.ts | 183 ++++++++++++++++++------------------------- 2 files changed, 104 insertions(+), 157 deletions(-) diff --git a/quill/quill-tests.ts b/quill/quill-tests.ts index 3a87bd5948..dbf8cb466f 100644 --- a/quill/quill-tests.ts +++ b/quill/quill-tests.ts @@ -1,10 +1,6 @@ /// -/// - -//export var Quill = require("quill"); function test_quill() { - var quillEditor = new Quill('#editor', { modules: { @@ -14,6 +10,31 @@ function test_quill() { }); } +function test_deleteText() { + var quillEditor = new Quill('#editor'); + quillEditor.deleteText(0, 10); +} + +function test_disable() { + let quillEditor = new Quill('#Editor'); + quillEditor.disable(); +} + +function test_enable() { + let quillEditor = new Quill('#Editor'); + quillEditor.enable(); +} + +function test_getContents() { + var quillEditor = new Quill('#editor'); + var delta: QuillJS.DeltaStatic = quillEditor.getContents(); +} + +function test_getLength() { + var quillEditor = new Quill('#editor'); + var num: number = quillEditor.getLength(); +} + function test_getText() { var quillEditor = new Quill('#editor'); var strValue: string = quillEditor.getText(); @@ -29,26 +50,11 @@ function test_getText_substring() { var strValue: string = quillEditor.getText(0, 10); } -function test_getLength() { - var quillEditor = new Quill('#editor'); - var num: number = quillEditor.getLength(); -} - -function test_getContents() { - var quillEditor = new Quill('#editor'); - var delta: DeltaStatic = quillEditor.getContents(); -} - function test_insertText() { var quillEditor = new Quill('#editor'); quillEditor.insertText(0, "Hello World"); } -function test_deleteText() { - var quillEditor = new Quill('#editor'); - quillEditor.deleteText(0, 10); -} - function test_formatText() { var quillEditor = new Quill('#editor'); quillEditor.formatText(0, 5, 'bold', true); @@ -71,7 +77,7 @@ function test_formatLine() { function test_insertEmbed() { var quillEditor = new Quill('#editor'); - quillEditor.insertEmbed(10, 'image', 'http://quilljs.com/images/cloud.png'); + quillEditor.insertEmbed(10, 'image', 'http://com/images/cloud.png'); } function test_updateContents() { @@ -96,12 +102,6 @@ function test_setContents() { ]); } -function test_setHTML() { - var quillEditor = new Quill('#editor'); - - quillEditor.setHTML('
Hello
'); -} - function test_setText() { var quillEditor = new Quill('#editor'); quillEditor.setText('Hello\n'); @@ -113,10 +113,10 @@ function test_getSelection() { var range = quillEditor.getSelection(); if (range) { - if (range.start == range.end) { - console.log('User cursor is at index', range.start); + if (range.index == range.length) { + console.log('User cursor is at index', range.index); } else { - var text = quillEditor.getText(range.start, range.end); + var text = quillEditor.getText(range.index, range.length); console.log('User has highlighted: ', text); } } else { @@ -129,11 +129,6 @@ function test_setSelection() { quillEditor.setSelection(0, 5); } -function test_prepareFormat() { - var quillEditor = new Quill('#editor'); - quillEditor.prepareFormat('bold', true); -} - function test_focus() { var quillEditor = new Quill('#editor'); quillEditor.focus(); @@ -144,14 +139,6 @@ function test_getBounds() { quillEditor.setText('Hello\nWorld\n'); } -function test_addModule() { - var quillEditor = new Quill('#editor'); - - var toolbar = quillEditor.addModule('toolbar', { - container: '#toolbar-container' - }); -} - function test_getModule() { var quillEditor = new Quill('#editor'); @@ -159,13 +146,6 @@ function test_getModule() var toolbar = quillEditor.getModule('toolbar'); } - -function test_addFormat() -{ - var quillEditor = new Quill('#editor'); - quillEditor.addFormat('strike', { tag: 'S', prepare: 'strikeThrough' }); -} - function test_addContainer() { var quillEditor = new Quill('#editor'); diff --git a/quill/quill.d.ts b/quill/quill.d.ts index 3cef088442..f1afd4c69f 100644 --- a/quill/quill.d.ts +++ b/quill/quill.d.ts @@ -1,118 +1,85 @@ -// Type definitions for Quill +// Type definitions for Quill v1.0.0 // Project: http://quilljs.com // Definitions by: Sumit // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +declare namespace QuillJS { -declare interface DeltaStatic{ - ops? : Array; - retain?: any, - delete?: any, - insert?: any, - attributes?: any + + export interface BoundsStatic { + left: number, + top: number, + height: number, + width: number + } + + export interface DeltaStatic { + ops?: Array; + retain?: any, + delete?: any, + insert?: any, + attributes?: any + } + + export interface RangeStatic { + new (): RangeStatic; + index: number; + length: number; + } + + export interface QuillStatic { + new (selector: string, options?: Object): QuillStatic; + + deleteText(start: number, end: number, source?: string): void; + disable(): void; + enable(enabled?: boolean): void; + getContents(start?: number, end?: number): DeltaStatic; + getLength(): number; + getText(start?: number, end?: number): string; + insertEmbed(index: number, type: string, url: string, source?: string): void; + insertText(index: number, text: string, source?: string): void; + insertText(index: number, text: string, format: string, value: string, source?: string): void; + insertText(index: number, text: string, formats: any, source?: string): void; + pasteHTML(): string; + setContents(delta: DeltaStatic, source?: string): void; + setText(text: string, source?: string): void; + update(source?: string): void; + updateContents(delta: DeltaStatic, source?: string): void; + + format(name: string, value: any, source?: string): void; + formatLine(index: number, length: number, source?: string): void; + formatLine(index: number, length: number, format: string, value: any, source?: string): void; + formatLine(index: number, length: number, formats: any, source?: string): void; + formatText(index: number, length: number, source?: string): void; + formatText(index: number, length: number, format: string, value: any, source?: string): void; + formatText(index: number, length: number, formats: any, source?: string): void; + getFormat(range?: RangeStatic): any; + getFormat(index: number, length?: number): any; + removeFormat(index: Number, length: Number, source?: String): void; + + blur(): void; + focus(): void; + getBounds(index: number, length?: number): BoundsStatic; + getSelection(focus?: boolean): RangeStatic; + hasFocus(): boolean; + setSelection(index: number, length: number, source?: string): void; + setSelection(range: RangeStatic, source?: string): void; + + on(eventName: string, callback: (delta: DeltaStatic, oldContents: DeltaStatic, source: String) => void): QuillStatic; + on(eventName: string, callback: (range: RangeStatic, oldRange: RangeStatic, source: String) => void): QuillStatic; + once(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic; + off(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic; + + debug(level: string): void; + import(path: string): any; + register(path: string, def: any, suppressWarning?: boolean): void; + register(defs: any, suppressWarning?: boolean): void; + addContainer(className: string, refNode?: any): any; + getModule(name: string): any + } } -declare interface RangeStatic{ - new(): RangeStatic; - start: number; - end: number; -} - -declare interface QuillStatic { - new(selector: string, options?: Object):QuillStatic; - - on(eventName: string, callback: (delta: DeltaStatic, source: string) => void): EventEmitter2; - addModule(id: string, options: any) : Object; - - getText(): string; - getText(start: number): string; - getText(start: number, end: number): string; - - getLength(): number; - - getContents(): DeltaStatic; - getContents(start: number): DeltaStatic; - getContents(start: number, end: number): DeltaStatic; - - getHTML(): string; - - insertText(index: number, text: string): void; - insertText(index: number, text: string, name: string, value: string): void; - insertText(index: number, text: string, formats: any): void; - insertText(index: number, text: string, source: string) : void; - insertText(index: number, text: string, name: string, value: string, source: string): void; - insertText(index: number, text: string, formats: any, source: string): void; - - deleteText(start: number, end: number): void; - deleteText(start: number, end: number, source: string): void; - - formatText(start: number, end: number): void; - formatText(start: number, end: number, name: string, value: boolean): void; - formatText(start: number, end: number, formats: any): void; - formatText(start: number, end: number, source: string): void; - formatText(start: number, end: number, name: string, value: string, source: string): void; - formatText(start: number, end: number, formats: string, source: string): void; - - - formatLine(start: number, end: number): void; - formatLine(start: number, end: number, name: string, value: boolean): void; - formatLine(start: number, end: number, formats: any): void; - formatLine(start: number, end: number, source: string): void; - formatLine(start: number, end: number, name: string, value: string, source: string): void; - formatLine(start: number, end: number, formats: any, source: string): void; - - - insertEmbed(index: number, type: string, url: string): void; - insertEmbed(index: number, type: string, url: string, source: string): void; - - updateContents(delta: DeltaStatic): void; - - setContents(delta: DeltaStatic): void; - - setHTML(html: string): void; - - setText(text: string): void; - - getSelection(): RangeStatic; - - setSelection(start: number, end: number): void; - setSelection(start: number, end: number, source: string): void; - setSelection(range: RangeStatic): void; - setSelection(range: RangeStatic, source: string): void; - - prepareFormat(format: string, value: boolean): void; - - focus(): void; - - getBounds(index: number): any; - - registerModule(name: string, callback: (quill: QuillStatic, options: any) => {}): any; - - addModule(name: string, options: any): any; - - getModule(name: string): any; - - onModuleLoad(name: string, callback: (input: any) => {}): void; - - addFormat(name: string, config: any): void; - - addContainer(cssClass: string, before?: number): HTMLDivElement; -} - -declare module "Range" -{ - var Range: RangeStatic; - export = Range; -} - -declare var Delta: DeltaStatic; - -declare module "Delta"{ - export = Delta; -} - -declare var Quill: QuillStatic; +declare var Quill: QuillJS.QuillStatic; declare module "Quill" { export = Quill; From d13b79b85168ffcfccf2923b076a03e02705601f Mon Sep 17 00:00:00 2001 From: Sumit Kumar Maitra Date: Wed, 7 Sep 2016 03:37:18 +0100 Subject: [PATCH 07/88] Updated Quill definitions (to v1.0.0) with revisions as per inputs from @zhengbli --- quill/quill-tests.ts | 23 +++++++++++++++++- quill/quill.d.ts | 55 +++++++++++++++++++++++++------------------- 2 files changed, 53 insertions(+), 25 deletions(-) diff --git a/quill/quill-tests.ts b/quill/quill-tests.ts index dbf8cb466f..5116ace525 100644 --- a/quill/quill-tests.ts +++ b/quill/quill-tests.ts @@ -69,11 +69,24 @@ function test_formatText2() { }); } -function test_formatLine() { +function test_formatLine1() { + var quillEditor = new Quill('#editor'); + quillEditor.formatLine(1, 3, 'api'); +} + +function test_formatLine2() { var quillEditor = new Quill('#editor'); quillEditor.formatLine(1, 3, 'align', 'right'); } +function test_formatLine3() { + var quillEditor = new Quill('#editor'); + quillEditor.formatLine(1, 3, { + 'align': 'right', + 'bold': false, + }); +} + function test_insertEmbed() { var quillEditor = new Quill('#editor'); @@ -151,3 +164,11 @@ function test_addContainer() var quillEditor = new Quill('#editor'); quillEditor.addContainer('ql-custom'); } + +function test_on_EventType1(){ + var quillEditor = new Quill('#editor'); + quillEditor.on('text-change', (newDelta, oldDelta, source)=>{ + // happened + }); + +} diff --git a/quill/quill.d.ts b/quill/quill.d.ts index f1afd4c69f..2ec959ef99 100644 --- a/quill/quill.d.ts +++ b/quill/quill.d.ts @@ -5,6 +5,13 @@ declare namespace QuillJS { + export interface QuillOptionsStatic { + debug?: string, + modules?: {[key: string]: any}, + placeholder?: string, + readOnly?: boolean, + theme?: string + } export interface BoundsStatic { left: number, @@ -28,52 +35,52 @@ declare namespace QuillJS { } export interface QuillStatic { - new (selector: string, options?: Object): QuillStatic; + new (selector: string, options?: QuillOptionsStatic): QuillStatic; - deleteText(start: number, end: number, source?: string): void; + deleteText(start: number, end: number, source?: "api"|"user"|"silent"): void; disable(): void; enable(enabled?: boolean): void; getContents(start?: number, end?: number): DeltaStatic; getLength(): number; getText(start?: number, end?: number): string; - insertEmbed(index: number, type: string, url: string, source?: string): void; - insertText(index: number, text: string, source?: string): void; - insertText(index: number, text: string, format: string, value: string, source?: string): void; - insertText(index: number, text: string, formats: any, source?: string): void; + insertEmbed(index: number, type: string, url: string, source?: "api"|"user"|"silent"): void; + insertText(index: number, text: string, source?: "api"|"user"|"silent"): void; + insertText(index: number, text: string, format: string, value: string, source?: "api"|"user"|"silent"): void; + insertText(index: number, text: string, formats: { [key: string] : any }, source?: "api"|"user"|"silent"): void; pasteHTML(): string; - setContents(delta: DeltaStatic, source?: string): void; - setText(text: string, source?: string): void; + setContents(delta: DeltaStatic, source?: "api"|"user"|"silent"): void; + setText(text: string, source?: "api"|"user"|"silent"): void; update(source?: string): void; - updateContents(delta: DeltaStatic, source?: string): void; + updateContents(delta: DeltaStatic, source?: "api"|"user"|"silent"): void; - format(name: string, value: any, source?: string): void; - formatLine(index: number, length: number, source?: string): void; - formatLine(index: number, length: number, format: string, value: any, source?: string): void; - formatLine(index: number, length: number, formats: any, source?: string): void; - formatText(index: number, length: number, source?: string): void; - formatText(index: number, length: number, format: string, value: any, source?: string): void; - formatText(index: number, length: number, formats: any, source?: string): void; - getFormat(range?: RangeStatic): any; - getFormat(index: number, length?: number): any; - removeFormat(index: Number, length: Number, source?: String): void; + format(name: string, value: any, source?: "api"|"user"|"silent"): void; + formatLine(index: number, length: number, source?: "api"|"user"|"silent"): void; + formatLine(index: number, length: number, format: string, value: any, source?: "api"|"user"|"silent"): void; + formatLine(index: number, length: number, formats: { [key: string] : any }, source?: "api"|"user"|"silent"): void; + formatText(index: number, length: number, source?: "api"|"user"|"silent"): void; + formatText(index: number, length: number, format: string, value: any, source?: "api"|"user"|"silent"): void; + formatText(index: number, length: number, formats: { [key: string] : any }, source?: "api"|"user"|"silent"): void; + getFormat(range?: RangeStatic): {[key: string]: any}; + getFormat(index: number, length?: number): {[key: string]: any}; + removeFormat(index: Number, length: Number, source?: "api"|"user"|"silent"): void; blur(): void; focus(): void; getBounds(index: number, length?: number): BoundsStatic; getSelection(focus?: boolean): RangeStatic; hasFocus(): boolean; - setSelection(index: number, length: number, source?: string): void; - setSelection(range: RangeStatic, source?: string): void; + setSelection(index: number, length: number, source?: "api"|"user"|"silent"): void; + setSelection(range: RangeStatic, source?: "api"|"user"|"silent"): void; - on(eventName: string, callback: (delta: DeltaStatic, oldContents: DeltaStatic, source: String) => void): QuillStatic; - on(eventName: string, callback: (range: RangeStatic, oldRange: RangeStatic, source: String) => void): QuillStatic; + on(eventName: string, callback: ((delta: T, oldContents: T, source: string) => void) | + ((name: string, ...args) => void )): QuillStatic; once(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic; off(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic; debug(level: string): void; import(path: string): any; register(path: string, def: any, suppressWarning?: boolean): void; - register(defs: any, suppressWarning?: boolean): void; + register(defs: { [key: string] : any }, suppressWarning?: boolean): void; addContainer(className: string, refNode?: any): any; getModule(name: string): any } From fecb5454fdda83792af72e47cd5345f2ce5284ea Mon Sep 17 00:00:00 2001 From: Sumit Kumar Maitra Date: Wed, 7 Sep 2016 03:45:10 +0100 Subject: [PATCH 08/88] Missed out one change to fix build --- quill/quill.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quill/quill.d.ts b/quill/quill.d.ts index 2ec959ef99..88436f7f58 100644 --- a/quill/quill.d.ts +++ b/quill/quill.d.ts @@ -73,7 +73,7 @@ declare namespace QuillJS { setSelection(range: RangeStatic, source?: "api"|"user"|"silent"): void; on(eventName: string, callback: ((delta: T, oldContents: T, source: string) => void) | - ((name: string, ...args) => void )): QuillStatic; + ((name: string, ...args:any[]) => void )): QuillStatic; once(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic; off(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic; From baddf2c360cf9198053f0f2d482d1ed97b021736 Mon Sep 17 00:00:00 2001 From: Sumit Kumar Maitra Date: Wed, 7 Sep 2016 07:40:40 +0100 Subject: [PATCH 09/88] creating type aliases --- quill/quill.d.ts | 50 +++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/quill/quill.d.ts b/quill/quill.d.ts index 88436f7f58..885f6bdc34 100644 --- a/quill/quill.d.ts +++ b/quill/quill.d.ts @@ -7,7 +7,7 @@ declare namespace QuillJS { export interface QuillOptionsStatic { debug?: string, - modules?: {[key: string]: any}, + modules?: { [key: string]: any }, placeholder?: string, readOnly?: boolean, theme?: string @@ -34,53 +34,55 @@ declare namespace QuillJS { length: number; } + type sourceType = "api" | "user" | "silent"; + type formatsType = { [key: string]: any }; + export interface QuillStatic { new (selector: string, options?: QuillOptionsStatic): QuillStatic; - - deleteText(start: number, end: number, source?: "api"|"user"|"silent"): void; + deleteText(start: number, end: number, source?: sourceType): void; disable(): void; enable(enabled?: boolean): void; getContents(start?: number, end?: number): DeltaStatic; getLength(): number; getText(start?: number, end?: number): string; - insertEmbed(index: number, type: string, url: string, source?: "api"|"user"|"silent"): void; - insertText(index: number, text: string, source?: "api"|"user"|"silent"): void; - insertText(index: number, text: string, format: string, value: string, source?: "api"|"user"|"silent"): void; - insertText(index: number, text: string, formats: { [key: string] : any }, source?: "api"|"user"|"silent"): void; + insertEmbed(index: number, type: string, url: string, source?: sourceType): void; + insertText(index: number, text: string, source?: sourceType): void; + insertText(index: number, text: string, format: string, value: string, source?: sourceType): void; + insertText(index: number, text: string, formats: formatsType, source?: sourceType): void; pasteHTML(): string; - setContents(delta: DeltaStatic, source?: "api"|"user"|"silent"): void; - setText(text: string, source?: "api"|"user"|"silent"): void; + setContents(delta: DeltaStatic, source?: sourceType): void; + setText(text: string, source?: sourceType): void; update(source?: string): void; - updateContents(delta: DeltaStatic, source?: "api"|"user"|"silent"): void; + updateContents(delta: DeltaStatic, source?: sourceType): void; - format(name: string, value: any, source?: "api"|"user"|"silent"): void; - formatLine(index: number, length: number, source?: "api"|"user"|"silent"): void; - formatLine(index: number, length: number, format: string, value: any, source?: "api"|"user"|"silent"): void; - formatLine(index: number, length: number, formats: { [key: string] : any }, source?: "api"|"user"|"silent"): void; - formatText(index: number, length: number, source?: "api"|"user"|"silent"): void; - formatText(index: number, length: number, format: string, value: any, source?: "api"|"user"|"silent"): void; - formatText(index: number, length: number, formats: { [key: string] : any }, source?: "api"|"user"|"silent"): void; - getFormat(range?: RangeStatic): {[key: string]: any}; - getFormat(index: number, length?: number): {[key: string]: any}; - removeFormat(index: Number, length: Number, source?: "api"|"user"|"silent"): void; + format(name: string, value: any, source?: sourceType): void; + formatLine(index: number, length: number, source?: sourceType): void; + formatLine(index: number, length: number, format: string, value: any, source?: sourceType): void; + formatLine(index: number, length: number, formats: formatsType, source?: sourceType): void; + formatText(index: number, length: number, source?: sourceType): void; + formatText(index: number, length: number, format: string, value: any, source?: sourceType): void; + formatText(index: number, length: number, formats: formatsType, source?: sourceType): void; + getFormat(range?: RangeStatic): formatsType; + getFormat(index: number, length?: number): formatsType; + removeFormat(index: Number, length: Number, source?: sourceType): void; blur(): void; focus(): void; getBounds(index: number, length?: number): BoundsStatic; getSelection(focus?: boolean): RangeStatic; hasFocus(): boolean; - setSelection(index: number, length: number, source?: "api"|"user"|"silent"): void; - setSelection(range: RangeStatic, source?: "api"|"user"|"silent"): void; + setSelection(index: number, length: number, source?: sourceType): void; + setSelection(range: RangeStatic, source?: sourceType): void; on(eventName: string, callback: ((delta: T, oldContents: T, source: string) => void) | - ((name: string, ...args:any[]) => void )): QuillStatic; + ((name: string, ...args: any[]) => void)): QuillStatic; once(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic; off(eventName: string, callback: (delta: DeltaStatic, source: string) => void): QuillStatic; debug(level: string): void; import(path: string): any; register(path: string, def: any, suppressWarning?: boolean): void; - register(defs: { [key: string] : any }, suppressWarning?: boolean): void; + register(defs: formatsType, suppressWarning?: boolean): void; addContainer(className: string, refNode?: any): any; getModule(name: string): any } From 8f455d7c998e1f653aed2a670eca441bcbbc18ce Mon Sep 17 00:00:00 2001 From: Hongbo Miao Date: Wed, 7 Sep 2016 03:23:27 -0400 Subject: [PATCH 10/88] add engine.ws to Server --- socket.io/socket.io.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index ad95f39ef3..abc554c065 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -47,7 +47,8 @@ interface SocketIOStatic { declare namespace SocketIO { interface Server { - + engine: { ws: WebSocketServer }; + /** * A dictionary of all the namespaces currently on this Server */ From a8706001dbdb1ca9ccec8751745cc4c408daa3be Mon Sep 17 00:00:00 2001 From: Hongbo Miao Date: Wed, 7 Sep 2016 03:38:19 -0400 Subject: [PATCH 11/88] Update socket.io.d.ts --- socket.io/socket.io.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/socket.io/socket.io.d.ts b/socket.io/socket.io.d.ts index abc554c065..603079e5a1 100644 --- a/socket.io/socket.io.d.ts +++ b/socket.io/socket.io.d.ts @@ -47,7 +47,7 @@ interface SocketIOStatic { declare namespace SocketIO { interface Server { - engine: { ws: WebSocketServer }; + engine: { ws: any }; /** * A dictionary of all the namespaces currently on this Server From 18748e6b995ad6e95ab7667e2eb8151bb0fd184f Mon Sep 17 00:00:00 2001 From: york yao Date: Wed, 7 Sep 2016 19:37:50 +0800 Subject: [PATCH 12/88] fix types of node crypto module --- node/node.d.ts | 105 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 75 insertions(+), 30 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index 245aa95abe..f6e5ab3769 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -2142,6 +2142,35 @@ declare module "tls" { } declare module "crypto" { + export interface Certificate { + exportChallenge(spkac: string | Buffer): Buffer; + exportPublicKey(spkac: string | Buffer): Buffer; + verifySpkac(spkac: Buffer): boolean; + } + export var Certificate: { + new (): Certificate; + (): Certificate; + } + + export function createECDH(curve_name: string): ECDH; + export interface ECDH { + generateKeys(): Buffer; + generateKeys(encoding: "latin1" | "hex" | "base64"): string; + generateKeys(encoding: "latin1" | "hex" | "base64", format: "compressed" | "uncompressed" | "hybrid"): string; + computeSecret(other_public_key: Buffer): Buffer; + computeSecret(other_public_key: string, input_encoding: "latin1" | "hex" | "base64"): Buffer; + computeSecret(other_public_key: string, input_encoding: "latin1" | "hex" | "base64", output_encoding: "latin1" | "hex" | "base64"): string; + getPrivateKey(): Buffer; + getPrivateKey(encoding: "latin1" | "hex" | "base64"): string; + getPublicKey(): Buffer; + getPublicKey(encoding: "latin1" | "hex" | "base64"): string; + getPublicKey(encoding: "latin1" | "hex" | "base64", format: "compressed" | "uncompressed" | "hybrid"): string; + setPrivateKey(private_key: Buffer): void; + setPrivateKey(private_key: string, encoding: "latin1" | "hex" | "base64"): void; + } + + export var fips: boolean; + export interface CredentialDetails { pfx: string; key: string; @@ -2154,19 +2183,18 @@ declare module "crypto" { export interface Credentials { context?: any; } export function createCredentials(details: CredentialDetails): Credentials; export function createHash(algorithm: string): Hash; - export function createHmac(algorithm: string, key: string): Hmac; - export function createHmac(algorithm: string, key: Buffer): Hmac; - export interface Hash { - update(data: any, input_encoding?: string): Hash; - digest(encoding: 'buffer'): Buffer; - digest(encoding: string): any; + export function createHmac(algorithm: string, key: string | Buffer): Hmac; + export interface Hash extends NodeJS.ReadWriteStream { + update(data: string | Buffer): Hash; + update(data: string | Buffer, input_encoding: "utf8" | "ascii" | "latin1"): Hash; digest(): Buffer; + digest(encoding: "latin1" | "hex" | "base64"): string; } export interface Hmac extends NodeJS.ReadWriteStream { - update(data: any, input_encoding?: string): Hmac; - digest(encoding: 'buffer'): Buffer; - digest(encoding: string): any; + update(data: string | Buffer): Hmac; + update(data: string | Buffer, input_encoding: "utf8" | "ascii" | "latin1"): Hmac; digest(): Buffer; + digest(encoding: "latin1" | "hex" | "base64"): string; } export function createCipher(algorithm: string, password: any): Cipher; export function createCipheriv(algorithm: string, key: any, iv: any): Cipher; @@ -2177,8 +2205,9 @@ declare module "crypto" { update(data: string, input_encoding: "utf8" | "ascii" | "binary", output_encoding: "binary" | "base64" | "hex"): string; final(): Buffer; final(output_encoding: string): string; - setAutoPadding(auto_padding: boolean): void; + setAutoPadding(auto_padding?: boolean): void; getAuthTag(): Buffer; + setAAD(buffer: Buffer): void; } export function createDecipher(algorithm: string, password: any): Decipher; export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher; @@ -2189,37 +2218,51 @@ declare module "crypto" { update(data: string, input_encoding: "binary" | "base64" | "hex", output_encoding: "utf8" | "ascii" | "binary"): string; final(): Buffer; final(output_encoding: string): string; - setAutoPadding(auto_padding: boolean): void; + setAutoPadding(auto_padding?: boolean): void; setAuthTag(tag: Buffer): void; + setAAD(buffer: Buffer): void; } export function createSign(algorithm: string): Signer; export interface Signer extends NodeJS.WritableStream { - update(data: any): void; - sign(private_key: string): Buffer; - sign(private_key: string, output_format: 'latin1' | 'hex' | 'base64'): string; + update(data: string | Buffer): Signer; + update(data: string | Buffer, input_encoding: "utf8" | "ascii" | "latin1"): Signer; + sign(private_key: string | { key: string; passphrase: string }): Buffer; + sign(private_key: string | { key: string; passphrase: string }, output_format: "latin1" | "hex" | "base64"): string; } export function createVerify(algorith: string): Verify; export interface Verify extends NodeJS.WritableStream { - update(data: any): void; + update(data: string | Buffer): Verify; + update(data: string | Buffer, input_encoding: "utf8" | "ascii" | "latin1"): Verify; verify(object: string, signature: Buffer): boolean; - verify(object: string, signature: string, signature_format: 'latin1' | 'hex' | 'base64'): boolean; + verify(object: string, signature: string, signature_format: string): boolean; } - export function createDiffieHellman(prime_length: number): DiffieHellman; - export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman; + export function createDiffieHellman(prime_length: number, generator?: number): DiffieHellman; + export function createDiffieHellman(prime: Buffer): DiffieHellman; + export function createDiffieHellman(prime: string, prime_encoding: "latin1" | "hex" | "base64"): DiffieHellman; + export function createDiffieHellman(prime: string, prime_encoding: "latin1" | "hex" | "base64", generator: number | Buffer): DiffieHellman; + export function createDiffieHellman(prime: string, prime_encoding: "latin1" | "hex" | "base64", generator: string, generator_encoding: "latin1" | "hex" | "base64"): DiffieHellman; export interface DiffieHellman { - generateKeys(encoding?: string): string; - computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string; - getPrime(encoding?: string): string; - getGenerator(encoding: string): string; - getPublicKey(encoding?: string): string; - getPrivateKey(encoding?: string): string; - setPublicKey(public_key: string, encoding?: string): void; - setPrivateKey(public_key: string, encoding?: string): void; + generateKeys(): Buffer; + generateKeys(encoding: "latin1" | "hex" | "base64"): string; + computeSecret(other_public_key: Buffer): Buffer; + computeSecret(other_public_key: string, input_encoding: "latin1" | "hex" | "base64"): Buffer; + computeSecret(other_public_key: string, input_encoding: "latin1" | "hex" | "base64", output_encoding: "latin1" | "hex" | "base64"): string; + getPrime(): Buffer; + getPrime(encoding: "latin1" | "hex" | "base64"): string; + getGenerator(): Buffer; + getGenerator(encoding: "latin1" | "hex" | "base64"): string; + getPublicKey(): Buffer; + getPublicKey(encoding: "latin1" | "hex" | "base64"): string; + getPrivateKey(): Buffer; + getPrivateKey(encoding: "latin1" | "hex" | "base64"): string; + setPublicKey(public_key: Buffer): void; + setPublicKey(public_key: string, encoding: string): void; + setPrivateKey(private_key: Buffer): void; + setPrivateKey(private_key: string, encoding: string): void; + verifyError: number; } export function getDiffieHellman(group_name: string): DiffieHellman; - export function pbkdf2(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, callback: (err: Error, derivedKey: Buffer) => any): void; export function pbkdf2(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string, callback: (err: Error, derivedKey: Buffer) => any): void; - export function pbkdf2Sync(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number): Buffer; export function pbkdf2Sync(password: string | Buffer, salt: string | Buffer, iterations: number, keylen: number, digest: string): Buffer; export function randomBytes(size: number): Buffer; export function randomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void; @@ -2227,15 +2270,17 @@ declare module "crypto" { export function pseudoRandomBytes(size: number, callback: (err: Error, buf: Buffer) => void): void; export interface RsaPublicKey { key: string; - padding?: any; + padding?: number; } export interface RsaPrivateKey { key: string; passphrase?: string, - padding?: any; + padding?: number; } export function publicEncrypt(public_key: string | RsaPublicKey, buffer: Buffer): Buffer export function privateDecrypt(private_key: string | RsaPrivateKey, buffer: Buffer): Buffer + export function privateEncrypt(private_key: string | RsaPrivateKey, buffer: Buffer): Buffer + export function publicDecrypt(public_key: string | RsaPublicKey, buffer: Buffer): Buffer export function getCiphers(): string[]; export function getCurves(): string[]; export function getHashes(): string[]; From 6e12852dc95b1b07024fe0f99d241a48eb379f93 Mon Sep 17 00:00:00 2001 From: AbraaoAlves Date: Wed, 7 Sep 2016 09:02:22 -0300 Subject: [PATCH 13/88] unify the indent style with other lines --- cucumber/cucumber.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cucumber/cucumber.d.ts b/cucumber/cucumber.d.ts index cb37208477..ff384b481f 100644 --- a/cucumber/cucumber.d.ts +++ b/cucumber/cucumber.d.ts @@ -10,14 +10,14 @@ declare namespace cucumber { (errror?:any):void; } - export interface TableDefinition{ - raw: () => Array; - rows: () => Array; - rowsHash: () => {}; - hashes: () => {}; - } + export interface TableDefinition{ + raw: () => Array; + rows: () => Array; + rowsHash: () => {}; + hashes: () => {}; + } - type StepDefinitionParam = string | CallbackStepDefinition | TableDefinition; + type StepDefinitionParam = string | CallbackStepDefinition | TableDefinition; interface StepDefinitionCode { (...stepArgs: Array): PromiseLike | any | void; From dd581d009ebe7fef6652bc234038ce2af2836902 Mon Sep 17 00:00:00 2001 From: york yao Date: Wed, 7 Sep 2016 20:34:02 +0800 Subject: [PATCH 14/88] merge the 2 ECDH interfaces and createECDH functions --- node/node.d.ts | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index f6e5ab3769..995084c035 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -2152,23 +2152,6 @@ declare module "crypto" { (): Certificate; } - export function createECDH(curve_name: string): ECDH; - export interface ECDH { - generateKeys(): Buffer; - generateKeys(encoding: "latin1" | "hex" | "base64"): string; - generateKeys(encoding: "latin1" | "hex" | "base64", format: "compressed" | "uncompressed" | "hybrid"): string; - computeSecret(other_public_key: Buffer): Buffer; - computeSecret(other_public_key: string, input_encoding: "latin1" | "hex" | "base64"): Buffer; - computeSecret(other_public_key: string, input_encoding: "latin1" | "hex" | "base64", output_encoding: "latin1" | "hex" | "base64"): string; - getPrivateKey(): Buffer; - getPrivateKey(encoding: "latin1" | "hex" | "base64"): string; - getPublicKey(): Buffer; - getPublicKey(encoding: "latin1" | "hex" | "base64"): string; - getPublicKey(encoding: "latin1" | "hex" | "base64", format: "compressed" | "uncompressed" | "hybrid"): string; - setPrivateKey(private_key: Buffer): void; - setPrivateKey(private_key: string, encoding: "latin1" | "hex" | "base64"): void; - } - export var fips: boolean; export interface CredentialDetails { @@ -2285,12 +2268,19 @@ declare module "crypto" { export function getCurves(): string[]; export function getHashes(): string[]; export interface ECDH { - computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string | Buffer; - generateKeys(encoding?: string, format?: string): string | Buffer; - getPrivateKey(encoding?: string): string | Buffer; - getPublicKey(encodind?: string): string | Buffer; - setPrivateKey(private_key: string | Buffer, encoding?: string): void; - setPublicKey(publick_key: string | Buffer, encoding?: string): void; + generateKeys(): Buffer; + generateKeys(encoding: "latin1" | "hex" | "base64"): string; + generateKeys(encoding: "latin1" | "hex" | "base64", format: "compressed" | "uncompressed" | "hybrid"): string; + computeSecret(other_public_key: Buffer): Buffer; + computeSecret(other_public_key: string, input_encoding: "latin1" | "hex" | "base64"): Buffer; + computeSecret(other_public_key: string, input_encoding: "latin1" | "hex" | "base64", output_encoding: "latin1" | "hex" | "base64"): string; + getPrivateKey(): Buffer; + getPrivateKey(encoding: "latin1" | "hex" | "base64"): string; + getPublicKey(): Buffer; + getPublicKey(encoding: "latin1" | "hex" | "base64"): string; + getPublicKey(encoding: "latin1" | "hex" | "base64", format: "compressed" | "uncompressed" | "hybrid"): string; + setPrivateKey(private_key: Buffer): void; + setPrivateKey(private_key: string, encoding: "latin1" | "hex" | "base64"): void; } export function createECDH(curve_name: string): ECDH; } From 28f791f3ea3082f00159a150938f71f4403c36ce Mon Sep 17 00:00:00 2001 From: AbraaoAlves Date: Wed, 7 Sep 2016 09:45:17 -0300 Subject: [PATCH 15/88] unify the indent style with other lines in tests --- cucumber/cucumber-tests.ts | 76 +++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/cucumber/cucumber-tests.ts b/cucumber/cucumber-tests.ts index 9f22e3f75d..56623e14d6 100644 --- a/cucumber/cucumber-tests.ts +++ b/cucumber/cucumber-tests.ts @@ -3,7 +3,7 @@ function StepSample() { type Callback = cucumber.CallbackStepDefinition; - type Table = cucumber.TableDefinition; + type Table = cucumber.TableDefinition; var step = this; var hook = this; @@ -39,42 +39,42 @@ function StepSample() { } }); - // Type for data_table.js on - // https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js - - step.Given(/^a table step with Table raw$/, function(table:Table){ - var expected = [ - ['Cucumber', 'Cucumis sativus'], - ['Burr Gherkin', 'Cucumis anguria'] - ]; - - assert.deepEqual(table.raw(), expected); - }); - - step.Given(/^a table step with Table rows$/, function(table: Table){ - var expected = [ - ['Apricot', '5'], - ['Brocolli', '2'], - ['Cucumber', '10'] - ]; - assert.deepEqual(table.rows(), expected) - }); - - step.Given(/^a table step with Table rowHash$/, function(table:Table){ - var expected = { - 'Cucumber': 'Cucumis sativus', - 'Burr Gherkin': 'Cucumis anguria' - }; - assert.deepEqual(table.rowsHash(), expected) - }); - - step.Given(/^a table step$/, function(table:Table){ - var expected = [ - {'Vegetable': 'Apricot', 'Rating': '5'}, - {'Vegetable': 'Brocolli', 'Rating': '2'}, - {'Vegetable': 'Cucumber', 'Rating': '10'} - ]; - assert.deepEqual(table.hashes(), expected) - }); + // Type for data_table.js on + // https://github.com/cucumber/cucumber-js/blob/a5fd8251918c278ab2e389226d165cedb44df14a/lib/cucumber/ast/data_table.js + + step.Given(/^a table step with Table raw$/, function(table:Table){ + var expected = [ + ['Cucumber', 'Cucumis sativus'], + ['Burr Gherkin', 'Cucumis anguria'] + ]; + + assert.deepEqual(table.raw(), expected); + }); + + step.Given(/^a table step with Table rows$/, function(table: Table){ + var expected = [ + ['Apricot', '5'], + ['Brocolli', '2'], + ['Cucumber', '10'] + ]; + assert.deepEqual(table.rows(), expected) + }); + + step.Given(/^a table step with Table rowHash$/, function(table:Table){ + var expected = { + 'Cucumber': 'Cucumis sativus', + 'Burr Gherkin': 'Cucumis anguria' + }; + assert.deepEqual(table.rowsHash(), expected) + }); + + step.Given(/^a table step$/, function(table:Table){ + var expected = [ + {'Vegetable': 'Apricot', 'Rating': '5'}, + {'Vegetable': 'Brocolli', 'Rating': '2'}, + {'Vegetable': 'Cucumber', 'Rating': '10'} + ]; + assert.deepEqual(table.hashes(), expected) + }); } From 11999b5ef590a1e4101173da776e37f2052705a7 Mon Sep 17 00:00:00 2001 From: Mickael Burguet Date: Wed, 7 Sep 2016 10:06:58 -0400 Subject: [PATCH 16/88] Add testcase --- pino/pino-tests.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pino/pino-tests.ts b/pino/pino-tests.ts index 9a2c423222..4a1470db24 100644 --- a/pino/pino-tests.ts +++ b/pino/pino-tests.ts @@ -26,6 +26,12 @@ var instance = PINO({ } }) +var pretty = PINO.pretty() +var instance2 = PINO({ + name: 'app', + safe: true +}, pretty) + var logger = instance logger.child({ a: 'property' }).info('hello child!') From 69089fffa5deb6dd1914139944ac70da5e1bdeee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20S=C3=A1nchez?= Date: Tue, 6 Sep 2016 14:12:51 -0600 Subject: [PATCH 17/88] Moved fs constants under constants as per documentation and added tests for access and accessSync --- node/node-tests.ts | 16 ++++++++++++++++ node/node.d.ts | 25 +++++++++++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index de2f284c1f..1b05e60bdb 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -165,6 +165,22 @@ fs.watch('/tmp/foo-', { console.log(event, filename); }); +fs.access('/path/to/folder', (err) => {}); + +fs.access(Buffer.from(''), (err) => {}); + +fs.access('/path/to/folder', fs.constants.F_OK | fs.constants.R_OK, (err) => {}); + +fs.access(Buffer.from(''), fs.constants.F_OK | fs.constants.R_OK, (err) => {}); + +fs.accessSync('/path/to/folder'); + +fs.accessSync(Buffer.from('')); + +fs.accessSync('path/to/folder', fs.constants.W_OK | fs.constants.X_OK); + +fs.accessSync(Buffer.from(''), fs.constants.W_OK | fs.constants.X_OK); + /////////////////////////////////////////////////////// /// Buffer tests : https://nodejs.org/api/buffer.html /////////////////////////////////////////////////////// diff --git a/node/node.d.ts b/node/node.d.ts index d8ec206f42..4439dee6e8 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1717,14 +1717,23 @@ declare module "fs" { export function watch(filename: string, options: { persistent?: boolean; recursive?: boolean; encoding?: string }, listener?: (event: string, filename: string | Buffer) => any): FSWatcher; export function exists(path: string | Buffer, callback?: (exists: boolean) => void): void; export function existsSync(path: string | Buffer): boolean; - /** Constant for fs.access(). File is visible to the calling process. */ - export var F_OK: number; - /** Constant for fs.access(). File can be read by the calling process. */ - export var R_OK: number; - /** Constant for fs.access(). File can be written by the calling process. */ - export var W_OK: number; - /** Constant for fs.access(). File can be executed by the calling process. */ - export var X_OK: number; + + interface Constants { + /** Constant for fs.access(). File is visible to the calling process. */ + F_OK: number; + + /** Constant for fs.access(). File can be read by the calling process. */ + R_OK: number; + + /** Constant for fs.access(). File can be written by the calling process. */ + W_OK: number; + + /** Constant for fs.access(). File can be executed by the calling process. */ + X_OK: number; + } + + export const constants: Constants; + /** Tests a user's permissions for the file specified by path. */ export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void; export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void; From e1eb4995d219c8ac9977d78feb89164218855510 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Thu, 8 Sep 2016 00:24:06 +0800 Subject: [PATCH 18/88] Clean up assert module --- node/node-tests.ts | 50 +++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index b250a732dc..40bc6d82f1 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -26,22 +26,44 @@ import * as timers from "timers"; // Specifically test buffer module regression. import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer"; -assert(1 + 1 - 2 === 0, "The universe isn't how it should."); +////////////////////////////////////////////////////////// +/// Assert Tests : https://nodejs.org/api/assert.html /// +////////////////////////////////////////////////////////// -assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP"); +namespace assert_tests{ + { + assert(1 + 1 - 2 === 0, "The universe isn't how it should."); + + assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP"); + + // TODO: assert.deepStrictEqual + + assert.doesNotThrow(() => { + const b = false; + if (b) { throw "a hammer at your face"; } + }, undefined, "What the...*crunch*"); + + assert.equal(3, "3", "uses == comparator"); -assert.equal(3, "3", "uses == comparator"); - -assert.notStrictEqual(2, "2", "uses === comparator"); - -assert.notDeepStrictEqual({ x: { y: "3" } }, { x: { y: 3 } }, "uses === comparator"); - -assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT"); - -assert.doesNotThrow(() => { - const b = false; - if (b) { throw "a hammer at your face"; } -}, undefined, "What the...*crunch*"); + // TODO: assert.fail + + // TODO: assert.ifError + + assert.notDeepStrictEqual({ x: { y: "3" } }, { x: { y: 3 } }, "uses === comparator"); + + // TODO: assert.notDeepStrictEqual + + // TODO: assert.notEqual + + assert.notStrictEqual(2, "2", "uses === comparator"); + + // TODO: assert.ok + + // TODO: assert.strictEqual + + assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT"); + } +} //////////////////////////////////////////////////// /// Events tests : http://nodejs.org/api/events.html From 7a87e2477320855830b31786a5ae72e741bb51fb Mon Sep 17 00:00:00 2001 From: rvassar Date: Wed, 7 Sep 2016 09:32:09 -0700 Subject: [PATCH 19/88] Updated version number. --- openlayers/openlayers.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index 6287edec46..00922aeb3b 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -1,4 +1,4 @@ -// Type definitions for OpenLayers v3.6.0 +// Type definitions for OpenLayers v3.18.2 // Project: http://openlayers.org/ // Definitions by: Wouter Goedhart // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 97c9fd0050996bf5cbed0eea801477efa12fd289 Mon Sep 17 00:00:00 2001 From: TonyYang Date: Thu, 8 Sep 2016 00:33:38 +0800 Subject: [PATCH 20/88] Clean up assert module --- node/node-4-tests.ts | 50 +++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/node/node-4-tests.ts b/node/node-4-tests.ts index 5a25f1fa20..3c177bcc77 100644 --- a/node/node-4-tests.ts +++ b/node/node-4-tests.ts @@ -24,22 +24,44 @@ import * as string_decoder from "string_decoder"; // Specifically test buffer module regression. import {Buffer as ImportedBuffer, SlowBuffer as ImportedSlowBuffer} from "buffer"; -assert(1 + 1 - 2 === 0, "The universe isn't how it should."); +////////////////////////////////////////////////////////// +/// Assert Tests : https://nodejs.org/api/assert.html /// +////////////////////////////////////////////////////////// -assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP"); +namespace assert_tests{ + { + assert(1 + 1 - 2 === 0, "The universe isn't how it should."); + + assert.deepEqual({ x: { y: 3 } }, { x: { y: 3 } }, "DEEP WENT DERP"); + + // TODO: assert.deepStrictEqual + + assert.doesNotThrow(() => { + const b = false; + if (b) { throw "a hammer at your face"; } + }, undefined, "What the...*crunch*"); + + assert.equal(3, "3", "uses == comparator"); -assert.equal(3, "3", "uses == comparator"); - -assert.notStrictEqual(2, "2", "uses === comparator"); - -assert.notDeepStrictEqual({ x: { y: "3" } }, { x: { y: 3 } }, "uses === comparator"); - -assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT"); - -assert.doesNotThrow(() => { - const b = false; - if (b) { throw "a hammer at your face"; } -}, undefined, "What the...*crunch*"); + // TODO: assert.fail + + // TODO: assert.ifError + + assert.notDeepStrictEqual({ x: { y: "3" } }, { x: { y: 3 } }, "uses === comparator"); + + // TODO: assert.notDeepStrictEqual + + // TODO: assert.notEqual + + assert.notStrictEqual(2, "2", "uses === comparator"); + + // TODO: assert.ok + + // TODO: assert.strictEqual + + assert.throws(() => { throw "a hammer at your face"; }, undefined, "DODGED IT"); + } +} //////////////////////////////////////////////////// /// Events tests : http://nodejs.org/api/events.html From c28effe556e1dc93900a988d524a29f38de78118 Mon Sep 17 00:00:00 2001 From: Leo Rudberg Date: Wed, 7 Sep 2016 16:42:48 -0500 Subject: [PATCH 21/88] Changed return type of `toArray` to `Element[]` Also changed the return type for `get(void)` and added a JSDoc `@alias` annotation. --- jquery/jquery.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 0f72c709cf..043ca70124 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -2780,8 +2780,9 @@ interface JQuery { /** * Retrieve all the elements contained in the jQuery set, as an array. + * @name toArray */ - toArray(): any[]; + toArray(): Element[]; /** * Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place. @@ -2837,8 +2838,9 @@ interface JQuery { get(index: number): HTMLElement; /** * Retrieve the elements matched by the jQuery object. + * @alias toArray */ - get(): any[]; + get(): Element[]; /** * Search for a given element from among the matched elements. From 86b7c1a2688e38d8db2f53bf9949e7caec0d7630 Mon Sep 17 00:00:00 2001 From: Izaak Baker Date: Wed, 7 Sep 2016 14:23:16 -0700 Subject: [PATCH 22/88] Add typings for Creatable class in react-select --- react-select/react-select-tests.tsx | 28 +++++++++++++++-- react-select/react-select.d.ts | 47 +++++++++++++++++++++-------- 2 files changed, 60 insertions(+), 15 deletions(-) diff --git a/react-select/react-select-tests.tsx b/react-select/react-select-tests.tsx index de45b52d32..3b2ce8b429 100644 --- a/react-select/react-select-tests.tsx +++ b/react-select/react-select-tests.tsx @@ -5,7 +5,7 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; -import { Option, ReactSelectProps, ReactAsyncSelectProps, MenuRendererProps } from "react-select-props"; +import { Option, ReactSelectProps, ReactAsyncSelectProps, ReactCreatableSelectProps, MenuRendererProps } from "react-select-props"; import Select = require("react-select"); const CustomOption = React.createClass({ @@ -104,7 +104,6 @@ class SelectTest extends React.Component, {}> { key: "1", options: options, optionRenderer: optionRenderer, - allowCreate: true, autofocus: true, autosize: true, clearable: true, @@ -200,3 +199,28 @@ class SelectAsyncTest extends React.Component, {}> { } } + +class SelectCreatableTest extends React.Component, {}> { + + render() { + const options: Option[] = [{ label: "Foo", value: "bar" }]; + const onChange = (value: any) => console.log(value); + + const creatableSelectProps: ReactCreatableSelectProps = { + name: "test-creatable-select", + value: "bar", + options: options, + onChange: onChange, + isOptionUnique: () => { return true; }, + isValidNewOption: () => { return true; }, + newOptionCreator: () => { return { label: "NewFoo", value: "newBar" }; }, + promptTextCreator: () => { return ""; }, + shouldKeyDownEventCreateNewOption: () => { return true; } + }; + + return
+ +
+ } + +} diff --git a/react-select/react-select.d.ts b/react-select/react-select.d.ts index f58cdafbdb..701d5efc4a 100644 --- a/react-select/react-select.d.ts +++ b/react-select/react-select.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-select v1.0.0 // Project: https://github.com/JedWatson/react-select -// Definitions by: ESQUIBET Hugo , Gilad Gray +// Definitions by: ESQUIBET Hugo , Gilad Gray , Izaak Baker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -68,12 +68,6 @@ declare namespace ReactSelect { * @default 'Add "{label}"?' */ addLabelText?: string; - /** - * allow new options to be created in multi mode (displays an "Add