From c4e9d77c1899652d9ed320f35ccd85bd7b6f5e29 Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Thu, 29 Sep 2016 23:48:42 +0300 Subject: [PATCH 001/313] add id --- express-session/express-session.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/express-session/express-session.d.ts b/express-session/express-session.d.ts index 90e1ed07cc..0320ff1aed 100644 --- a/express-session/express-session.d.ts +++ b/express-session/express-session.d.ts @@ -10,11 +10,14 @@ declare namespace Express { export interface Request { session?: Session; + readonly sessionId: string; } export interface Session { [key: string]: any; + readonly id: string; + regenerate: (callback: (err: any) => void) => void; destroy: (callback: (err: any) => void) => void; reload: (callback: (err: any) => void) => void; From 9c8c07801e8c65631d9dc563d3ef1604ac009d4d Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Fri, 30 Sep 2016 00:00:15 +0300 Subject: [PATCH 002/313] remove readonly --- express-session/express-session.d.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/express-session/express-session.d.ts b/express-session/express-session.d.ts index 0320ff1aed..c685c8a1bb 100644 --- a/express-session/express-session.d.ts +++ b/express-session/express-session.d.ts @@ -10,13 +10,12 @@ declare namespace Express { export interface Request { session?: Session; - readonly sessionId: string; + sessionId?: string; } export interface Session { [key: string]: any; - - readonly id: string; + id: string; regenerate: (callback: (err: any) => void) => void; destroy: (callback: (err: any) => void) => void; From 5a0b946a42315f58b3f5fdd3de6dc70e9f24cfea Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Fri, 30 Sep 2016 01:16:45 +0300 Subject: [PATCH 003/313] add touch after --- connect-mongo/connect-mongo.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/connect-mongo/connect-mongo.d.ts b/connect-mongo/connect-mongo.d.ts index 49f93e2d46..7c779e2d07 100644 --- a/connect-mongo/connect-mongo.d.ts +++ b/connect-mongo/connect-mongo.d.ts @@ -78,6 +78,12 @@ declare module "connect-mongo" { * (Default: 10) */ autoRemoveInterval?: number; + + + /** + * don't save session if unmodified + */ + touchAfter?: number; } export interface MongoUrlOptions extends DefaultOptions { From 30b38b4e5a16967e9f4c07b4be5da58c04213700 Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Fri, 30 Sep 2016 06:49:17 +0300 Subject: [PATCH 004/313] fix typo --- express-session/express-session.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/express-session/express-session.d.ts b/express-session/express-session.d.ts index c685c8a1bb..9af409ddc5 100644 --- a/express-session/express-session.d.ts +++ b/express-session/express-session.d.ts @@ -10,7 +10,7 @@ declare namespace Express { export interface Request { session?: Session; - sessionId?: string; + sessionID?: string; } export interface Session { From a5ba907cc7429738f88308f04087d5d43af5e37d Mon Sep 17 00:00:00 2001 From: Christopher Cortes Date: Fri, 30 Sep 2016 16:58:18 +0200 Subject: [PATCH 005/313] Add missing Valdr types Add ValdrValidationConstraints and ValdrValidationResult typings --- valdr/valdr.d.ts | 61 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/valdr/valdr.d.ts b/valdr/valdr.d.ts index 5df4d13aa0..2762eabc1e 100644 --- a/valdr/valdr.d.ts +++ b/valdr/valdr.d.ts @@ -1,25 +1,72 @@ -// Type definitions for valdr.js v1.1.5 +// Type definitions for valdr.js v1.1.5+ // Project: https://github.com/netceteragroup/valdr // Definitions by: Kai Ilbertz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace valdr { + /** + * Custom validators must implement this interface to provide custom validation logic. + */ + interface ValdrValidator { + + /** + * Custom validator's name, that will be set in the violation's validator field. + */ + name: string; + + /** + * Method to be called to perform custom validation over given value. + */ + validate(value: any, validationArguments?: {[argumentName:string]: any}): boolean; + } + + interface ValdrConstraintValidator { + [argumentName:string]: any; + message: string; + } + + interface ValdrConstraintFieldName { + [validatorName:string]: ValdrConstraintValidator; + } + + interface ValdrConstraintTypeName { + [fieldName:string]: ValdrConstraintFieldName; + } + + interface ValdrConstraints { + [typeName:string]: ValdrConstraintTypeName; + } + + interface ValdrViolation extends ValdrConstraintValidator { + valid: boolean; + value: string; + field: string; + type: string; + validator: string; + } + + interface ValdrValidationResult { + valid: boolean; + violations: ValdrViolation[]|undefined; + validationResults: ValdrViolation[]|undefined; + } + interface Valdr { /** * Validates the value of the given type with the constraints for the given field name. * @param typeName the type name. * @param fieldName the field name. * @param value the value to validate. - * @returns {*} the validation result. + * @returns {ValdrValidationResult} the validation result. */ - validate(typeName: string, fieldName: string, value: string): any; + validate(typeName: string, fieldName: string, value: string): ValdrValidationResult; /** * Adds a new list of constraints (JSON Object). * @param newConstraints the list of constraints (JSON Object). */ - addConstraints(newConstraints: any): void; + addConstraints(newConstraints: ValdrConstraints): void; /** * Removes one or many contraints. @@ -31,7 +78,7 @@ declare namespace valdr { * Gets the list of constraints (JSON Object). * @returns the list of constraints. */ - getConstraints(): any; + getConstraints(): ValdrConstraints; /** * Sets custom classes on the surrounding elements. @@ -45,7 +92,7 @@ declare namespace valdr { * Adds a new list of constraints (JSON Object). * @param newConstraints the list of constraints (JSON Object). */ - addConstraints(newConstraints: any): void; + addConstraints(newConstraints: ValdrConstraints): void; /** * Removes one or many contraints. @@ -72,4 +119,4 @@ declare namespace valdr { */ addConstraintAlias(valdrName: string, alias: string): void; } -} \ No newline at end of file +} From d8ba429527d295b8f02299cded37df76e7790508 Mon Sep 17 00:00:00 2001 From: Christopher Cortes Date: Fri, 30 Sep 2016 17:01:59 +0200 Subject: [PATCH 006/313] Refine Valdr-message typings Set a more refined type to messages instead of any --- valdr-message/valdr-message.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/valdr-message/valdr-message.d.ts b/valdr-message/valdr-message.d.ts index b8c2a6673b..7dfb32b5db 100644 --- a/valdr-message/valdr-message.d.ts +++ b/valdr-message/valdr-message.d.ts @@ -1,4 +1,4 @@ -// Type definitions for valdr.js v1.1.5 (valdr-message) +// Type definitions for valdr.js v1.1.5+ (valdr-message) // Project: https://github.com/netceteragroup/valdr // Definitions by: Kai Ilbertz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -31,7 +31,7 @@ declare namespace valdr.message { * Adds messages for AngularJS build-in validators (eg "required" and "number") or for specific fields (eg "Person.lastName.required"). * @param messages the list of key/value pairs. */ - addMessages(messages: any): void; + addMessages(messages: {[key:string]: string}): void; /** * Gets the validator message. @@ -51,7 +51,7 @@ declare namespace valdr.message { setTemplate(template: string): void; /** - * Sets the URL for the default message template (eg "/partials/valdrMesssageTemplate.html"). + * Sets the URL for the default message template (eg "/partials/valdrMessageTemplate.html"). * @param url the URL of the default message template. */ setTemplateUrl(url: string): void; @@ -60,7 +60,7 @@ declare namespace valdr.message { * Adds messages for AngularJS build-in validators (eg "required" and "number") or for specific fields (eg "Person.lastName.required"). * @param messages the list of key/value pairs. */ - addMessages(messages: any): void; + addMessages(messages: {[key:string]: string}): void; /** * Gets the validator message. @@ -71,4 +71,4 @@ declare namespace valdr.message { */ getMessage(typeName: string, fieldName: string, validatorName: string): string; } -} \ No newline at end of file +} From 2734133d7122658b08c1fbcbff42b2252098ed4e Mon Sep 17 00:00:00 2001 From: Christopher Cortes Date: Fri, 30 Sep 2016 17:31:18 +0200 Subject: [PATCH 007/313] Expand Valdr typings tests Expand tests to include added typings for ValdrValidationResult and ValdrConstraints --- valdr/valdr-tests.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/valdr/valdr-tests.ts b/valdr/valdr-tests.ts index eb263223d3..674f763606 100644 --- a/valdr/valdr-tests.ts +++ b/valdr/valdr-tests.ts @@ -3,6 +3,25 @@ function ValdrTests() { var valdr: valdr.Valdr; var validation = valdr.validate('person', 'lastName', 'test'); + var isValid = validation.valid; + var violations = validation.violations; + violations.forEach(function(violation) { + var valid = violation.valid; + var value = violation.value; + var field = violation.field; + var type = violation.type; + var validator = violation.validator; + var message = violation.message; + }); + var results = validation.validationResults; + results.forEach(function(violation) { + var valid = violation.valid; + var value = violation.value; + var field = violation.field; + var type = violation.type; + var validator = violation.validator; + var message = violation.message; + }); valdr.addConstraints({ 'person': { 'lastName': { @@ -14,6 +33,10 @@ function ValdrTests() { }); valdr.removeConstraints('person'); var constraints = valdr.getConstraints(); + var constraintTypeName = constraints["person"]; + var constraintFieldName = constraintTypeName["lastName"]; + var constraintValidatorName = constraintFieldName["test"]; + var validationMessage = constraintValidatorName.message; valdr.setClasses({ valid: 'demo-is-valid', invalid: 'demo-is-invalid' @@ -35,4 +58,4 @@ function ValdrProviderTests() { valdrProvider.setConstraintUrl('/api/constraints'); valdrProvider.addValidator('customValidator'); valdrProvider.addConstraintAlias('customValidator', 'customValidatorAlias'); -} \ No newline at end of file +} From dd4dffc5d985f154a1d76a769291eb0aea96d1da Mon Sep 17 00:00:00 2001 From: Christopher Cortes Date: Fri, 30 Sep 2016 17:33:21 +0200 Subject: [PATCH 008/313] Fix spacing Replace tabs by spaces --- valdr/valdr-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/valdr/valdr-tests.ts b/valdr/valdr-tests.ts index 674f763606..20cffd91eb 100644 --- a/valdr/valdr-tests.ts +++ b/valdr/valdr-tests.ts @@ -12,7 +12,7 @@ function ValdrTests() { var type = violation.type; var validator = violation.validator; var message = violation.message; - }); + }); var results = validation.validationResults; results.forEach(function(violation) { var valid = violation.valid; @@ -31,12 +31,12 @@ function ValdrTests() { } } }); - valdr.removeConstraints('person'); var constraints = valdr.getConstraints(); var constraintTypeName = constraints["person"]; var constraintFieldName = constraintTypeName["lastName"]; var constraintValidatorName = constraintFieldName["test"]; var validationMessage = constraintValidatorName.message; + valdr.removeConstraints('person'); valdr.setClasses({ valid: 'demo-is-valid', invalid: 'demo-is-invalid' From 9c31d1146789d99543928624b437f879583d39e6 Mon Sep 17 00:00:00 2001 From: Christopher Cortes Date: Fri, 30 Sep 2016 17:34:29 +0200 Subject: [PATCH 009/313] Rename vars in test Rename vars to make test clearer --- valdr/valdr-tests.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/valdr/valdr-tests.ts b/valdr/valdr-tests.ts index 20cffd91eb..4f33549946 100644 --- a/valdr/valdr-tests.ts +++ b/valdr/valdr-tests.ts @@ -32,10 +32,10 @@ function ValdrTests() { } }); var constraints = valdr.getConstraints(); - var constraintTypeName = constraints["person"]; - var constraintFieldName = constraintTypeName["lastName"]; - var constraintValidatorName = constraintFieldName["test"]; - var validationMessage = constraintValidatorName.message; + var constraintType = constraints["person"]; + var constraintField = constraintType["lastName"]; + var constraintValidator = constraintField["test"]; + var validationMessage = constraintValidator.message; valdr.removeConstraints('person'); valdr.setClasses({ valid: 'demo-is-valid', From 6ef7a05b7781d436fef8e72968d0e72d606305f2 Mon Sep 17 00:00:00 2001 From: Christopher Cortes Date: Fri, 30 Sep 2016 17:45:57 +0200 Subject: [PATCH 010/313] Fix TS issues Added missing types --- valdr/valdr-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/valdr/valdr-tests.ts b/valdr/valdr-tests.ts index 4f33549946..38af12a95e 100644 --- a/valdr/valdr-tests.ts +++ b/valdr/valdr-tests.ts @@ -5,7 +5,7 @@ function ValdrTests() { var validation = valdr.validate('person', 'lastName', 'test'); var isValid = validation.valid; var violations = validation.violations; - violations.forEach(function(violation) { + violations.forEach(function(violation:ValdrViolation) { var valid = violation.valid; var value = violation.value; var field = violation.field; @@ -14,7 +14,7 @@ function ValdrTests() { var message = violation.message; }); var results = validation.validationResults; - results.forEach(function(violation) { + results.forEach(function(violation:ValdrViolation) { var valid = violation.valid; var value = violation.value; var field = violation.field; From b522e153529738d7a469c827aab3792daba71fec Mon Sep 17 00:00:00 2001 From: Christopher Cortes Date: Fri, 30 Sep 2016 17:49:28 +0200 Subject: [PATCH 011/313] Remove undefined In TS by default null and undefined are subtypes of all other types --- valdr/valdr.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/valdr/valdr.d.ts b/valdr/valdr.d.ts index 2762eabc1e..3de33267cb 100644 --- a/valdr/valdr.d.ts +++ b/valdr/valdr.d.ts @@ -48,8 +48,8 @@ declare namespace valdr { interface ValdrValidationResult { valid: boolean; - violations: ValdrViolation[]|undefined; - validationResults: ValdrViolation[]|undefined; + violations: ValdrViolation[]; + validationResults: ValdrViolation[]; } interface Valdr { From 01566c4b78e236850f41b712bfcf979b5edbf417 Mon Sep 17 00:00:00 2001 From: Christopher Cortes Date: Fri, 30 Sep 2016 17:54:32 +0200 Subject: [PATCH 012/313] Fix wrong type Add missing namespace --- valdr/valdr-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/valdr/valdr-tests.ts b/valdr/valdr-tests.ts index 38af12a95e..be3348e792 100644 --- a/valdr/valdr-tests.ts +++ b/valdr/valdr-tests.ts @@ -5,7 +5,7 @@ function ValdrTests() { var validation = valdr.validate('person', 'lastName', 'test'); var isValid = validation.valid; var violations = validation.violations; - violations.forEach(function(violation:ValdrViolation) { + violations.forEach(function(violation:valdr.ValdrViolation) { var valid = violation.valid; var value = violation.value; var field = violation.field; @@ -14,7 +14,7 @@ function ValdrTests() { var message = violation.message; }); var results = validation.validationResults; - results.forEach(function(violation:ValdrViolation) { + results.forEach(function(violation:valdr.ValdrViolation) { var valid = violation.valid; var value = violation.value; var field = violation.field; From 60a1b1e3a65a6494aecee2fd7ddba42bb3d92113 Mon Sep 17 00:00:00 2001 From: Christopher Cortes Date: Mon, 3 Oct 2016 23:46:05 +0200 Subject: [PATCH 013/313] Fix wrong version number Set version to only numbers --- valdr/valdr.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/valdr/valdr.d.ts b/valdr/valdr.d.ts index 3de33267cb..ab6870ab4b 100644 --- a/valdr/valdr.d.ts +++ b/valdr/valdr.d.ts @@ -1,4 +1,4 @@ -// Type definitions for valdr.js v1.1.5+ +// Type definitions for valdr.js v1.1.5 // Project: https://github.com/netceteragroup/valdr // Definitions by: Kai Ilbertz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From 99237c1aec929c87301cce4f1f8db8d6eeac4aa6 Mon Sep 17 00:00:00 2001 From: Christopher Cortes Date: Mon, 3 Oct 2016 23:47:08 +0200 Subject: [PATCH 014/313] Fix wrong version number Keep version to only numbers --- valdr-message/valdr-message.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/valdr-message/valdr-message.d.ts b/valdr-message/valdr-message.d.ts index 7dfb32b5db..961fd8d156 100644 --- a/valdr-message/valdr-message.d.ts +++ b/valdr-message/valdr-message.d.ts @@ -1,4 +1,4 @@ -// Type definitions for valdr.js v1.1.5+ (valdr-message) +// Type definitions for valdr.js v1.1.5 (valdr-message) // Project: https://github.com/netceteragroup/valdr // Definitions by: Kai Ilbertz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped From fe6b43c5bd2b120aa99969be4d4c00181178d6c3 Mon Sep 17 00:00:00 2001 From: Nikias Kalpaxis Date: Tue, 4 Oct 2016 12:48:57 -0400 Subject: [PATCH 015/313] add missing isEmpty function (#11698) --- enzyme/enzyme-tests.tsx | 12 ++++++++++++ enzyme/enzyme.d.ts | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/enzyme/enzyme-tests.tsx b/enzyme/enzyme-tests.tsx index 67dccafeaf..ff23b91445 100644 --- a/enzyme/enzyme-tests.tsx +++ b/enzyme/enzyme-tests.tsx @@ -112,6 +112,10 @@ namespace ShallowWrapperTest { boolVal = shallowWrapper.is('.some-class'); } + function test_isEmpty() { + boolVal = shallowWrapper.isEmpty() + } + function test_not() { elementWrapper = shallowWrapper.find('.foo').not('.bar'); } @@ -399,6 +403,10 @@ namespace ReactWrapperTest { boolVal = reactWrapper.is('.some-class'); } + function test_isEmpty() { + boolVal = reactWrapper.isEmpty() + } + function test_not() { elementWrapper = reactWrapper.find('.foo').not('.bar'); } @@ -636,6 +644,10 @@ namespace CheerioWrapperTest { boolVal = cheerioWrapper.is('.some-class'); } + function test_isEmpty() { + boolVal = cheerioWrapper.isEmpty() + } + function test_not() { elementWrapper = cheerioWrapper.find('.foo').not('.bar'); } diff --git a/enzyme/enzyme.d.ts b/enzyme/enzyme.d.ts index 31ffce8923..b94b7b9f9f 100644 --- a/enzyme/enzyme.d.ts +++ b/enzyme/enzyme.d.ts @@ -102,6 +102,11 @@ declare module "enzyme" { */ is(selector: EnzymeSelector): boolean; + /** + * Returns whether or not the current node is empty. + */ + isEmpty(): boolean; + /** * Returns a new wrapper with only the nodes of the current wrapper that don't match the provided selector. * This method is effectively the negation or inverse of filter. From 1cc8629b019b8ebe6187351557dc47fcd3bf4cd7 Mon Sep 17 00:00:00 2001 From: Arun Aravind Date: Tue, 4 Oct 2016 22:20:05 +0530 Subject: [PATCH 016/313] Added type definitions for terminal-menu (#11697) --- terminal-menu/terminal-menu-tests.ts | 40 +++++++ terminal-menu/terminal-menu.d.ts | 159 +++++++++++++++++++++++++++ 2 files changed, 199 insertions(+) create mode 100644 terminal-menu/terminal-menu-tests.ts create mode 100644 terminal-menu/terminal-menu.d.ts diff --git a/terminal-menu/terminal-menu-tests.ts b/terminal-menu/terminal-menu-tests.ts new file mode 100644 index 0000000000..e428ca6bdf --- /dev/null +++ b/terminal-menu/terminal-menu-tests.ts @@ -0,0 +1,40 @@ +/// +import * as tty from "tty"; // For typing + +let stdin = ( process.stdin); + +if(!stdin.isTTY) { + console.log("Terminal not supported"); + process.exit(0); +} + +const MenuContainerFactory = require("terminal-menu"); + +let menu = MenuContainerFactory({ width: 29, x: 4, y: 2 }); +menu.reset(); + +menu.write('SERIOUS BUSINESS TERMINAL\n'); +menu.write('-------------------------\n'); + +menu.add('ADD TRANSACTION INVOICE'); +menu.add('BUSINESS INTELLIGENCE'); +menu.add('ACCOUNTS PAYABLE'); +menu.add('LEDGER BOOKINGS'); +menu.add('INDICATOR CHART METRICS'); +menu.add('BACKUP DATA TO FLOPPY DISK'); +menu.add('RESTORE FROM FLOPPY DISK'); +menu.add('EXIT'); + +menu.on('select', function (label: string) { + menu.close(); + console.log('SELECTED: ' + label); +}); + +stdin.pipe(menu.createStream()).pipe(process.stdout); + +stdin.setRawMode(true); + +menu.on('close', function () { + stdin.setRawMode(false); + stdin.end(); +}); diff --git a/terminal-menu/terminal-menu.d.ts b/terminal-menu/terminal-menu.d.ts new file mode 100644 index 0000000000..8485243425 --- /dev/null +++ b/terminal-menu/terminal-menu.d.ts @@ -0,0 +1,159 @@ +// Type definitions for terminal-menu v2.1.1 +// Project: https://github.com/substack/terminal-menu +// Definitions by: Arun Aravind +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "terminal-menu" { + import * as stream from "stream"; + + /** + * Creates a TerminalMenu with default settings. + */ + function MenuContainerFactory(): MenuContainerFactory.TerminalMenu; + + /** + * Creates a TerminalMenu using options to override default settings. + * @param options Override values for available settings. + */ + function MenuContainerFactory(options: MenuContainerFactory.TerminalMenuOptions): MenuContainerFactory.TerminalMenu; + + namespace MenuContainerFactory { + + /** + * A Thickness structure specifying the amount of padding to apply. + */ + export interface Thickness { + /** + * Represents width of the left side of the bounding rectangle. + */ + left: number, + + /** + * Represents width of the right side of the bounding rectangle. + */ + right: number, + + /** + * Represents width of the upper side of the bounding rectangle. + */ + top: number, + + /** + * Represents width of the lower side of the bounding rectangle. + */ + bottom: number + } + + /** + * Options to configure the menu. + */ + export interface TerminalMenuOptions { + /** + * Menu width in columns. + * Default = 50. + */ + width?: number; + + /** + * Horizontal offset for top-left corner. + * Default = 1 + */ + x?: number; + + /** + * Vertical offset for top-left corner. + * Default = 1 + */ + y?: number; + + /** + * Foreground color for the menu. + * Default = 'white' + */ + fg?: string; + + /** + * Background color for the menu. + * Default = 'blue' + */ + bg?: string; + + /** + * Padding for the bounding rectangle. + * If a number is passed, all elements of the Thickness structure will be set to + * that value. + * Default = { + * left: 2, + * right: 2, + * top: 1, + * bottom: 1 + * } + */ + padding?: number | Thickness; + + /** + * Index of the menu item to be selected. + * Default = 0 + */ + selected?: number + } + + /** + * Retro ansi terminal menus. + */ + export interface TerminalMenu extends NodeJS.EventEmitter { + /** + * Create a new selectable menu item with label as the anchor. + * @param label Label to use as the menu item anchor. + */ + add(label: string): void; + + /** + * Create a new selectable menu item with label as the anchor. + * @param label Label to use as the menu item anchor. + * @param callback Callback to invoke when the menu item is selected. + */ + add(label: string, callback: (label: string, index: number) => void): void; + + /** + * Writes a message to the terminal. + * @param msg Message to be written. + */ + write(msg: string): void; + + /** + * Return a duplex stream to wire up input and output. + */ + createStream(): stream.Duplex; + + /** + * Reset the terminal, clearing all content. + */ + reset(): void; + + /** + * Unregister all listeners and puts the terminal back to its original state. + */ + close(): void; + + /** + * When a menu item is selected, this event is fired. + * @param eventName Name of the event. Only value available for eventName is "select" + * @param callback Handler for the event specified by eventName + */ + on(eventName: string | symbol, callback: (label: string, index: number) => void): this; + + /** + * When a menu item is selected, this event is fired. + * This overload ensures backward compatibility with older versions of NodeJS (< 6.0) + * @param eventName Name of the event. Only value available for eventName is "select" + * @param callback Handler for the event specified by eventName + */ + on(eventName: string, callback: (label: string, index: number) => void): this; + } + } + + export = MenuContainerFactory; +} From e77a0d93ef38eabfa04b1072ad3250e2c4d5cfb7 Mon Sep 17 00:00:00 2001 From: valorcurse Date: Tue, 4 Oct 2016 19:09:59 +0200 Subject: [PATCH 017/313] Update THREE.js definitions to r81 (#11679) * Update THREE.js definitions to r81 * Update test_unit_maths.ts to r81 * Update version in header to r81 --- threejs/tests/math/test_unit_math.ts | 56 ++++++++++++++-------------- threejs/three.d.ts | 16 ++++---- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/threejs/tests/math/test_unit_math.ts b/threejs/tests/math/test_unit_math.ts index 5d095315dc..226ebbb709 100644 --- a/threejs/tests/math/test_unit_math.ts +++ b/threejs/tests/math/test_unit_math.ts @@ -92,56 +92,56 @@ test( "center", function() { var a = new THREE.Box2( zero2.clone(), zero2.clone() ); - ok( a.center().equals( zero2 ), "Passed!" ); + ok( a.getCenter().equals( zero2 ), "Passed!" ); a = new THREE.Box2( zero2, one2 ); var midpoint = one2.clone().multiplyScalar( 0.5 ); - ok( a.center().equals( midpoint ), "Passed!" ); + ok( a.getCenter().equals( midpoint ), "Passed!" ); }); test( "size", function() { var a = new THREE.Box2( zero2.clone(), zero2.clone() ); - ok( a.size().equals( zero2 ), "Passed!" ); + ok( a.getSize().equals( zero2 ), "Passed!" ); a = new THREE.Box2( zero2.clone(), one2.clone() ); - ok( a.size().equals( one2 ), "Passed!" ); + ok( a.getSize().equals( one2 ), "Passed!" ); }); test( "expandByPoint", function() { var a = new THREE.Box2( zero2.clone(), zero2.clone() ); a.expandByPoint( zero2 ); - ok( a.size().equals( zero2 ), "Passed!" ); + ok( a.getSize().equals( zero2 ), "Passed!" ); a.expandByPoint( one2 ); - ok( a.size().equals( one2 ), "Passed!" ); + ok( a.getSize().equals( one2 ), "Passed!" ); a.expandByPoint( one2.clone().negate() ); - ok( a.size().equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" ); - ok( a.center().equals( zero2 ), "Passed!" ); + ok( a.getSize().equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" ); + ok( a.getCenter().equals( zero2 ), "Passed!" ); }); test( "expandByVector", function() { var a = new THREE.Box2( zero2.clone(), zero2.clone() ); a.expandByVector( zero2 ); - ok( a.size().equals( zero2 ), "Passed!" ); + ok( a.getSize().equals( zero2 ), "Passed!" ); a.expandByVector( one2 ); - ok( a.size().equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" ); - ok( a.center().equals( zero2 ), "Passed!" ); + ok( a.getSize().equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" ); + ok( a.getCenter().equals( zero2 ), "Passed!" ); }); test( "expandByScalar", function() { var a = new THREE.Box2( zero2.clone(), zero2.clone() ); a.expandByScalar( 0 ); - ok( a.size().equals( zero2 ), "Passed!" ); + ok( a.getSize().equals( zero2 ), "Passed!" ); a.expandByScalar( 1 ); - ok( a.size().equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" ); - ok( a.center().equals( zero2 ), "Passed!" ); + ok( a.getSize().equals( one2.clone().multiplyScalar( 2 ) ), "Passed!" ); + ok( a.getCenter().equals( zero2 ), "Passed!" ); }); test( "containsPoint", function() { @@ -333,56 +333,56 @@ test( "center", function() { var a = new THREE.Box3( zero3.clone(), zero3.clone() ); - ok( a.center().equals( zero3 ), "Passed!" ); + ok( a.getCenter().equals( zero3 ), "Passed!" ); a = new THREE.Box3( zero3.clone(), one3.clone() ); var midpoint = one3.clone().multiplyScalar( 0.5 ); - ok( a.center().equals( midpoint ), "Passed!" ); + ok( a.getCenter().equals( midpoint ), "Passed!" ); }); test( "size", function() { var a = new THREE.Box3( zero3.clone(), zero3.clone() ); - ok( a.size().equals( zero3 ), "Passed!" ); + ok( a.getSize().equals( zero3 ), "Passed!" ); a = new THREE.Box3( zero3.clone(), one3.clone() ); - ok( a.size().equals( one3 ), "Passed!" ); + ok( a.getSize().equals( one3 ), "Passed!" ); }); test( "expandByPoint", function() { var a = new THREE.Box3( zero3.clone(), zero3.clone() ); a.expandByPoint( zero3 ); - ok( a.size().equals( zero3 ), "Passed!" ); + ok( a.getSize().equals( zero3 ), "Passed!" ); a.expandByPoint( one3 ); - ok( a.size().equals( one3 ), "Passed!" ); + ok( a.getSize().equals( one3 ), "Passed!" ); a.expandByPoint( one3.clone().negate() ); - ok( a.size().equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" ); - ok( a.center().equals( zero3 ), "Passed!" ); + ok( a.getSize().equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" ); + ok( a.getCenter().equals( zero3 ), "Passed!" ); }); test( "expandByVector", function() { var a = new THREE.Box3( zero3.clone(), zero3.clone() ); a.expandByVector( zero3 ); - ok( a.size().equals( zero3 ), "Passed!" ); + ok( a.getSize().equals( zero3 ), "Passed!" ); a.expandByVector( one3 ); - ok( a.size().equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" ); - ok( a.center().equals( zero3 ), "Passed!" ); + ok( a.getSize().equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" ); + ok( a.getCenter().equals( zero3 ), "Passed!" ); }); test( "expandByScalar", function() { var a = new THREE.Box3( zero3.clone(), zero3.clone() ); a.expandByScalar( 0 ); - ok( a.size().equals( zero3 ), "Passed!" ); + ok( a.getSize().equals( zero3 ), "Passed!" ); a.expandByScalar( 1 ); - ok( a.size().equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" ); - ok( a.center().equals( zero3 ), "Passed!" ); + ok( a.getSize().equals( one3.clone().multiplyScalar( 2 ) ), "Passed!" ); + ok( a.getCenter().equals( zero3 ), "Passed!" ); }); test( "containsPoint", function() { diff --git a/threejs/three.d.ts b/threejs/three.d.ts index 830edbf864..05b903bce6 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1,4 +1,4 @@ -// Type definitions for three.js r80 +// Type definitions for three.js r81 // Project: http://mrdoob.github.com/three.js/ // Definitions by: Kon , Satoru Kimura , Florent Poujol , SereznoKot // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -2778,8 +2778,8 @@ declare namespace THREE { copy(box: this): this; makeEmpty(): Box2; isEmpty(): boolean; - center(optionalTarget?: Vector2): Vector2; - size(optionalTarget?: Vector2): Vector2; + getCenter(optionalTarget?: Vector2): Vector2; + getSize(optionalTarget?: Vector2): Vector2; expandByPoint(point: Vector2): Box2; expandByVector(vector: Vector2): Box2; expandByScalar(scalar: number): Box2; @@ -2813,8 +2813,8 @@ declare namespace THREE { copy(box: this): this; makeEmpty(): Box3; isEmpty(): boolean; - center(optionalTarget?: Vector3): Vector3; - size(optionalTarget?: Vector3): Vector3; + getCenter(optionalTarget?: Vector3): Vector3; + getSize(optionalTarget?: Vector3): Vector3; expandByPoint(point: Vector3): Box3; expandByVector(vector: Vector3): Box3; expandByScalar(scalar: number): Box3; @@ -3175,7 +3175,7 @@ declare namespace THREE { set(start?: Vector3, end?: Vector3): Line3; clone(): this; copy(line: this): this; - center(optionalTarget?: Vector3): Vector3; + getCenter(optionalTarget?: Vector3): Vector3; delta(optionalTarget?: Vector3): Vector3; distanceSq(): number; distance(): number; @@ -3330,7 +3330,7 @@ declare namespace THREE { * Transposes this matrix into the supplied array r, and returns itself. */ transposeIntoArray(r: number[]): number[]; - fromArray(array: number[]): Matrix3; + fromArray(array: number[], offset?: number): Matrix3; toArray(): number[]; // deprecated @@ -3513,7 +3513,7 @@ declare namespace THREE { */ makeOrthographic(left: number, right: number, top: number, bottom: number, near: number, far: number): Matrix4; equals( matrix: Matrix4 ): boolean; - fromArray(array: number[]): Matrix4; + fromArray(array: number[], offset?: number): Matrix4; toArray(): number[]; // deprecated From 2a5f017607f4c463cd961231590ca469c0136cf0 Mon Sep 17 00:00:00 2001 From: RecuencoJones Date: Tue, 4 Oct 2016 19:11:23 +0200 Subject: [PATCH 018/313] UPDATE localForage type definitions (#11702) --- localForage/localForage-tests.ts | 85 ++++++++++++++++++++------------ localForage/localForage.d.ts | 30 ++++++++--- 2 files changed, 75 insertions(+), 40 deletions(-) diff --git a/localForage/localForage-tests.ts b/localForage/localForage-tests.ts index 6f162e8c4b..4a885f18fc 100644 --- a/localForage/localForage-tests.ts +++ b/localForage/localForage-tests.ts @@ -1,65 +1,86 @@ /// -declare var localForage: LocalForage; +declare let localForage: LocalForage; -() => { +namespace LocalForageTest { localForage.clear((err: any) => { - var newError: any = err; + let newError: any = err; }); localForage.iterate((str: string, key: string, num: number) => { - var newStr: string = str; - var newKey: string = key; - var newNum: number = num; + let newStr: string = str; + let newKey: string = key; + let newNum: number = num; }); localForage.length((err: any, num: number) => { - var newError: any = err; - var newNumber: number = num; + let newError: any = err; + let newNumber: number = num; }); localForage.key(0, (err: any, value: string) => { - var newError: any = err; - var newValue: string = value; + let newError: any = err; + let newValue: string = value; }); localForage.keys((err: any, keys: Array) => { - var newError: any = err; - var newArray: Array = keys; + let newError: any = err; + let newArray: Array = keys; }); localForage.getItem("key",(err: any, str: string) => { - var newError: any = err; - var newStr: string = str + let newError: any = err; + let newStr: string = str }); localForage.getItem("key").then((str: string) => { - var newStr: string = str; + let newStr: string = str; }); - + localForage.setItem("key", "value",(err: any, str: string) => { - var newError: any = err; - var newStr: string = str + let newError: any = err; + let newStr: string = str }); localForage.setItem("key", "value").then((str: string) => { - var newStr: string = str; + let newStr: string = str; }); - + localForage.removeItem("key",(err: any) => { - var newError: any = err; + let newError: any = err; }); localForage.removeItem("key").then(() => { }); - - var config = localForage.config({ - name: "testyo", - driver: localForage.LOCALSTORAGE - }); - - var store = localForage.createInstance({ - name: "da instance", - driver: localForage.LOCALSTORAGE - }); -} \ No newline at end of file + + { + let config: boolean; + + config = localForage.config({ + name: "testyo", + driver: localForage.LOCALSTORAGE + }); + } + + { + let store: LocalForage; + + store = localForage.createInstance({ + name: "da instance", + driver: localForage.LOCALSTORAGE + }); + } + + { + let testSerializer: LocalForageSerializer; + + localForage.getSerializer() + .then((serializer: LocalForageSerializer) => { + testSerializer = serializer; + }); + + localForage.getSerializer((serializer: LocalForageSerializer) => { + testSerializer = serializer; + }); + } +} diff --git a/localForage/localForage.d.ts b/localForage/localForage.d.ts index c727d93b3a..eaafd8b8c8 100644 --- a/localForage/localForage.d.ts +++ b/localForage/localForage.d.ts @@ -39,6 +39,16 @@ interface LocalForageDriver { setItem(key: string, value: any, callback: (err: any, value: any) => void): void; } +interface LocalForageSerializer { + serialize(value: T | ArrayBuffer | Blob, callback: (value: string, error: any) => {}): void; + + deserialize(value: string): T | ArrayBuffer | Blob; + + stringToBuffer(serializedString: string): ArrayBuffer; + + bufferToString(buffer: ArrayBuffer): string; +} + interface LocalForage { LOCALSTORAGE: string; WEBSQL: string; @@ -50,6 +60,12 @@ interface LocalForage { * @param {ILocalForageConfig} options? */ config(options: LocalForageOptions): boolean; + + /** + * Create a new instance of localForage to point to a different store. + * All the configuration options used by config are supported. + * @param {LocalForageOptions} options + */ createInstance(options: LocalForageOptions): LocalForage; driver(): string; @@ -62,6 +78,11 @@ interface LocalForage { defineDriver(driver: LocalForageDriver): Promise; defineDriver(driver: LocalForageDriver, callback: () => void, errorCallback: (error: any) => void): void; + getSerializer(): Promise; + getSerializer(callback: (serializer: LocalForageSerializer) => void): void; + + supports(driverName: string): boolean; + getItem(key: string): Promise; getItem(key: string, callback: (err: any, value: T) => void): void; @@ -86,16 +107,9 @@ interface LocalForage { iterate(iteratee: (value: any, key: string, iterationNumber: number) => any): Promise; iterate(iteratee: (value: any, key: string, iterationNumber: number) => any, callback: (err: any, result: any) => void): void; - - /** - * Create a new instance of localForage to point to a different store. - * All the configuration options used by config are supported. - * @param {LocalForageOptions} options - */ - createInstance(options: LocalForageOptions): LocalForage; } declare module "localforage" { - var localforage: LocalForage; + let localforage: LocalForage; export = localforage; } From 18faea35154d44650005de30336c1f0203a55af6 Mon Sep 17 00:00:00 2001 From: Sean Dawson Date: Wed, 5 Oct 2016 04:14:13 +1100 Subject: [PATCH 019/313] Update Google Maps API type definition to 3.25 (#11626) * Update Google Maps Places Library definition - According to the Places Library documentation (https://goo.gl/EJFiuQ), certain fields are being removed - I have aligned the Places Library definitions with the API reference (https://goo.gl/kYoi9V) and added deprecation comments for the old properties as they are still accepted until February - I could not find an official deprecation attribute or similar for Typescript definitions so I just left a comment * Update the API version in the header * Apply API changes between version 3.20 and 3.25 - Used the Google Maps API release notes (https://goo.gl/nRUZGJ) as a reference * Fix inconsistant type definition --- googlemaps/google.maps.d.ts | 39 +++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index 0aef3b74a6..2b56c2e836 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Google Maps JavaScript API 3.20 +// Type definitions for Google Maps JavaScript API 3.25 // Project: https://developers.google.com/maps/ // Definitions by: Folia A/S , Chris Wrench // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -922,6 +922,7 @@ declare namespace google.maps { formatted_address: string; geometry: GeocoderGeometry; partial_match: boolean; + place_id: string; postcode_localities: string[]; types: string[]; } @@ -984,10 +985,11 @@ declare namespace google.maps { avoidFerries?: boolean; avoidHighways?: boolean; avoidTolls?: boolean; - destination?: LatLng|LatLngLiteral|string; - durationInTraffic?: boolean; + destination?: string|LatLng|Place; + durationInTraffic?: boolean; /* Deprecated. Use drivingOptions field instead */ + drivingOptions?: DrivingOptions; optimizeWaypoints?: boolean; - origin?: LatLng|LatLngLiteral|string; + origin?: string|LatLng|Place; provideRouteAlternatives?: boolean; region?: string; transitOptions?: TransitOptions; @@ -1031,6 +1033,18 @@ declare namespace google.maps { export interface TransitFare { } + export interface DrivingOptions { + departureTime: Date; + trafficModel: TrafficModel + } + + export enum TrafficModel + { + BEST_GUESS, + OPTIMISTIC, + PESSIMISTIC + } + export interface DirectionsWaypoint { location: LatLng|LatLngLiteral|string; stopover: boolean; @@ -1215,9 +1229,10 @@ declare namespace google.maps { avoidFerries?: boolean; avoidHighways?: boolean; avoidTolls?: boolean; - destinations?: LatLng[]|string[]; + destinations?: string[]|LatLng[]|Place[]; + drivingOptions?: DrivingOptions; durationInTraffic?: boolean; - origins?: LatLng[]|string[]; + origins?: string[]|LatLng[]|Place[]; region?: string; transitOptions?: TransitOptions; travelMode?: TravelMode; @@ -1237,6 +1252,7 @@ declare namespace google.maps { export interface DistanceMatrixResponseElement { distance: Distance; duration: Duration; + duration_in_traffic: Duration; fare: TransitFare; status: DistanceMatrixElementStatus; } @@ -2060,7 +2076,7 @@ declare namespace google.maps { export interface PlaceResult { address_components: GeocoderAddressComponent[]; - aspects: PlaceAspectRating[]; + aspects: PlaceAspectRating[]; /* Deprecated. Will be removed May 2, 2017 */ formatted_address: string; formatted_phone_number: string; geometry: PlaceGeometry; @@ -2103,7 +2119,8 @@ declare namespace google.maps { openNow?: boolean; radius?: number; rankBy?: RankBy; - types?: string[]; + types?: string[]; /* Deprecated. Will be removed February 16, 2017 */ + type?: string; } export class PlacesService { @@ -2144,7 +2161,8 @@ declare namespace google.maps { location?: LatLng|LatLngLiteral; name?: string; radius?: number; - types?: string[]; + types?: string[]; /* Deprecated. Will be removed February 16, 2017 */ + type?: string; } export enum RankBy { @@ -2168,7 +2186,8 @@ declare namespace google.maps { location?: LatLng|LatLngLiteral; query: string; radius?: number; - types?: string[]; + types?: string[]; /* Deprecated. Will be removed February 16, 2017 */ + type?: string; } } From c55d26d1791a0fb72a5cb576e4efcf7a53cc8232 Mon Sep 17 00:00:00 2001 From: stonio Date: Tue, 4 Oct 2016 19:15:00 +0200 Subject: [PATCH 020/313] Override ol.layer.Vector#getSource() (#11703) Reference: http://openlayers.org/en/latest/apidoc/ol.layer.Vector.html --- openlayers/openlayers.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index ed3c8e9e21..8f7309e92a 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -6360,6 +6360,13 @@ declare module ol { */ constructor(opt_options?: olx.layer.VectorOptions); + /** + * Return the associated {@link ol.source.Vector vectorsource} of the layer. + * @return {ol.source.Vector} Source. + * @api stable + */ + getSource(): ol.source.Vector; + /** * Get the style for features. This returns whatever was passed to the `style` * option at construction or to the `setStyle` method. From dd95604a2f52d566b2908be415e74bcc21f6cf0e Mon Sep 17 00:00:00 2001 From: stonio Date: Tue, 4 Oct 2016 19:15:21 +0200 Subject: [PATCH 021/313] Replace number[] by [number, number] (#11704) --- openlayers/openlayers.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index 8f7309e92a..c321517697 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -10982,7 +10982,7 @@ declare module ol { * An array of numbers representing an xy coordinate. Example: `[16, 48]`. * @typedef {Array.} */ - type Coordinate = number[]; + type Coordinate = [number, number]; /** * A function that takes a {@link ol.Coordinate} and transforms it into a @@ -11036,7 +11036,7 @@ declare module ol { * An array of numbers representing an extent: `[minx, miny, maxx, maxy]`. * @typedef {Array.} */ - type Extent = number[]; + type Extent = [number, number, number, number]; /** * {@link ol.source.Vector} sources use a function of this type to load @@ -11110,7 +11110,7 @@ declare module ol { * x-coordinate, the second the y-coordinate of the pixel. * @typedef {Array.} */ - type Pixel = number[]; + type Pixel = [number, number]; /** * Function to perform manipulations before rendering. This function is called @@ -11160,7 +11160,7 @@ declare module ol { * An array of numbers representing a size: `[width, height]`. * @typedef {Array.} */ - type Size = number[]; + type Size = [number, number]; /** * @typedef {{attributions: (ol.AttributionLike|undefined), @@ -11291,7 +11291,7 @@ declare module ol { * grid. The order is `z`, `x`, and `y`. `z` is the zoom level. * @typedef {Array.} ol.TileCoord */ - type TileCoord = number[]; + type TileCoord = [number, number, number]; /** * A function that takes an {@link ol.Tile} for the tile and a `{string}` for From 8922f46b5adf49bd44fc7bf5db61d0df3bc593f0 Mon Sep 17 00:00:00 2001 From: Artur Eshenbrener Date: Tue, 4 Oct 2016 21:44:55 +0400 Subject: [PATCH 022/313] [lodash]: memoize.Cache expects construcor (#11707) https://lodash.com/docs/4.15.0#memoize --- lodash/lodash-tests.ts | 18 ++++++++++++------ lodash/lodash.d.ts | 5 ++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index f00a5537ab..f0f958b0c8 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5872,12 +5872,18 @@ namespace TestMemoize { result = _(memoizeFn).chain().memoize(memoizeResolverFn); } - _.memoize.Cache = { - delete: key => false, - get: key => undefined, - has: key => false, - set(key, value) { return this; } - }; + interface MemoizeCache { + delete(key: K): boolean; + get(key: K): V; + has(key: K): boolean; + set(key: K, value: V): this; + } + interface MemoizeCacheConstructor { + new (): MemoizeCache; + } + let MemoizeCache: MemoizeCacheConstructor + + _.memoize.Cache = MemoizeCache; } // _.overArgs diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 68443af1fd..3305528a5e 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -355,6 +355,9 @@ declare module _ { */ set(key: string, value: any): _.Dictionary; } + interface MapCacheConstructor { + new (): MapCache; + } interface LoDashWrapperBase { } @@ -10411,7 +10414,7 @@ declare module _ { */ memoize: { (func: T, resolver?: Function): T & MemoizedFunction; - Cache: MapCache; + Cache: MapCacheConstructor; } } From f1595fd8b87f5f0132e19038ea4a10a240b3760b Mon Sep 17 00:00:00 2001 From: felipedgarcia Date: Tue, 4 Oct 2016 14:55:19 -0300 Subject: [PATCH 023/313] Added jquery.flagstrap.js definition suport (#11710) --- jquery.flagstrap/jquery.flagstrap-tests.ts | 77 ++++++++++++++++++++ jquery.flagstrap/jquery.flagstrap.d.ts | 84 ++++++++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 jquery.flagstrap/jquery.flagstrap-tests.ts create mode 100644 jquery.flagstrap/jquery.flagstrap.d.ts diff --git a/jquery.flagstrap/jquery.flagstrap-tests.ts b/jquery.flagstrap/jquery.flagstrap-tests.ts new file mode 100644 index 0000000000..d274b3b61d --- /dev/null +++ b/jquery.flagstrap/jquery.flagstrap-tests.ts @@ -0,0 +1,77 @@ +/// +/// + +class TestObject { + +} + +$(function () { + // basic test + // written in according to basic example from documentation + var htmlSelect = '
' + + '
' + + '
' + + '
' + + '
' + + '
'; + $('body').html(htmlSelect); + $('#flagstrap').flagStrap(); + + // for this test we expect more than 30 thousands of characters + console.log('characters count: ' + $('#flagstrap').html().length + '\n' + $('#flagstrap').html()); + + // options test + // options -> data attributes + // written in according to options -> data attributes example from documentation + htmlSelect = '
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
'; + $('body').html(htmlSelect); + $('#flagstrap2').flagStrap(); + + console.log('\n\ncharacters count: ' + $('#flagstrap2').html().length + '\n' + $('#flagstrap2').html()); + + // options test + // options -> instance options + // written in according to options -> instance options example from documentation + htmlSelect = '
' + + '
' + + '
' + + '
' + + '
' + + '
'; + $('body').html(htmlSelect); + $('#flagstrap3').flagStrap({ + countries: { + "AU": "Australia", + "GB": "United Kingdom", + "US": "United States" + }, + inputName: 'country', + buttonSize: "btn-lg", + buttonType: "btn-primary", + labelMargin: "20px", + scrollable: false, + scrollableHeight: "350px", + onSelect: function(value: any, element: any) { + // + }, + placeholder: { + value: "", + text: "Please select a country" + } + }); + + console.log('\n\ncharacters count: ' + $('#flagstrap3').html().length + '\n' + $('#flagstrap3').html()); +}) + diff --git a/jquery.flagstrap/jquery.flagstrap.d.ts b/jquery.flagstrap/jquery.flagstrap.d.ts new file mode 100644 index 0000000000..a61db5c48d --- /dev/null +++ b/jquery.flagstrap/jquery.flagstrap.d.ts @@ -0,0 +1,84 @@ +// Type definitions for jQuery Flagstrap Plugin v1.0 +// Project: https://github.com/blazeworx/flagstrap +// Definitions by: Felipe de Sena Garcia +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module jQueryFlagStrap { + interface FlagStrapOptions { + /** + * Default: uniquely generated + * the `name` attribute for the actual `select` input + */ + inputName: string; + /** + * Default: uniquely generated + * the `id` attribute for the actual `select` input + */ + inputId?: string; + /** + * Default: "btn-md" + * The bootstrap button size `class` for this drop down + */ + buttonSize: string; + /** + * Default: "btn-default" + * The bootstrap button type `class` for this drop down + */ + buttonType: string; + /** + * Default: "20px" + * The `margin` between `flag` and `text label` + */ + labelMargin: string; + /** + * Default: false + * Scrollable or full height drop down + */ + scrollable: boolean; + /** + * Default: "250px" + * `max-height` for the scrollable drop down + */ + scrollableHeight?: string; + /** + * Default: (all) + * Only show specific countries + * Example: + * + * {"GB": "United Kingdom", "US": "United States"} + * + * will only show the USA and UK. + */ + countries?: Object; + /** + * Default: {value: "", text: "Please select a country"} + * Set the placeholder value and text. To disable the placeholder define as (boolean) false. + */ + placeholder: boolean | FlagStrapPlaceholderOptions; + /** + * Default: null + * This callback gets called each time the select is changed. It receives two parameters, the new value, and the select element. + */ + onSelect?(value: any, element: any): void; + } + + interface FlagStrapStatic { + flagStrap?: void; + } + + interface FlagStrapPlaceholderOptions { + value: string; + text: string; + } +} + +interface JQuery { + /** + * A lightwieght jQuery plugin for creating Bootstrap 3 compatible country select boxes with flags. + */ + + flagStrap(): void; + flagStrap(options: jQueryFlagStrap.FlagStrapOptions): void; +} \ No newline at end of file From dcb46429c820bac49c31ef9f4ee4154cac01fb80 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Wed, 5 Oct 2016 03:27:50 +0900 Subject: [PATCH 024/313] apply declaration merging (#10900) --- whatwg-fetch/whatwg-fetch.d.ts | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/whatwg-fetch/whatwg-fetch.d.ts b/whatwg-fetch/whatwg-fetch.d.ts index 793244976e..287adb2875 100644 --- a/whatwg-fetch/whatwg-fetch.d.ts +++ b/whatwg-fetch/whatwg-fetch.d.ts @@ -39,7 +39,9 @@ interface Body { } declare type RequestInfo = Request | string; -interface Request extends Body { +declare class Request { + constructor(input: RequestInfo, init?: RequestInit); + method: string; url: string; headers: Headers; @@ -56,6 +58,7 @@ interface Request extends Body { clone(): Request; } +interface Request extends Body {} interface RequestInit { method?: string; headers?: HeadersInit; @@ -69,10 +72,6 @@ interface RequestInit { integrity?: string; window?: any; } -interface RequestConstructor { - new (input: RequestInfo, init?: RequestInit): Request; -} -declare var Request: RequestConstructor; type RequestType = "" | "audio" | "font" | "image" | "script" | "style" | "track" | "video"; type RequestDestination = "" | "document" | "embed" | "font" | "image" | "manifest" | "media" | "object" | "report" | "script" | "serviceworker" | "sharedworker" | "style" | "worker" | "xslt"; @@ -82,7 +81,12 @@ type RequestCache = "default" | "no-store" | "reload" | "no-cache" | "force-cach type RequestRedirect = "follow" | "error" | "manual"; type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; -interface Response extends Body { +declare class Response { + constructor(body?: BodyInit, init?: ResponseInit); + + static error(): Response; + static redirect(url: string, status?: number): Response; + type: ResponseType; url: string; redirected: boolean; @@ -95,17 +99,11 @@ interface Response extends Body { clone(): Response; } +interface Response extends Body {} interface ResponseInit { status?: number; statusText?: string; headers?: HeadersInit; } -interface ResponseConstructor { - new (body?: BodyInit, init?: ResponseInit): Response; - - error(): Response; - redirect(url: string, status?: number): Response; -} -declare var Response: ResponseConstructor; type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"; From 7f2cfbd0ff94cfb4242dcbd1a1a3cd7ca9259304 Mon Sep 17 00:00:00 2001 From: Frank van den Berg Date: Tue, 4 Oct 2016 20:34:28 +0200 Subject: [PATCH 025/313] Update material-ui.d.ts (#11353) Expose ThemePalette interface. --- material-ui/material-ui.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/material-ui/material-ui.d.ts b/material-ui/material-ui.d.ts index 31472154b3..2318f9d913 100644 --- a/material-ui/material-ui.d.ts +++ b/material-ui/material-ui.d.ts @@ -135,6 +135,7 @@ declare namespace __MaterialUI { clockCircleColor?: string; shadowColor?: string; } + export var ThemePalette: ThemePalette; interface MuiTheme { spacing?: Spacing; fontFamily?: string; From debb3797cd60df4c7324abb38a0aa47c46d205db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francis=20B=C3=A9liveau?= Date: Tue, 4 Oct 2016 14:39:59 -0400 Subject: [PATCH 026/313] Change ChartAxisXOptions (#11449) Change the type for minimum and maximum options in ChartAxisXOptions to support both number and Date. --- canvasjs/canvasjs.d.ts | 44 ++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/canvasjs/canvasjs.d.ts b/canvasjs/canvasjs.d.ts index 75ea058e3e..bfb4dd03cd 100644 --- a/canvasjs/canvasjs.d.ts +++ b/canvasjs/canvasjs.d.ts @@ -376,7 +376,7 @@ declare namespace CanvasJS { dataSeriesIndex: number; } - interface ChartAxisXOptions { + interface ChartAxisOptions { /** * Sets the Axis Title. * Default: null @@ -472,18 +472,6 @@ declare namespace CanvasJS { */ valueFormatString?: string; /** - * Sets the minimum value of Axis. Values smaller than minimum are clipped. - * Default: Automatically Calculated based on the data - * Example: 100, 350.. - */ - minimum?: number; - /** - * Sets the maximum value permitted on Axis. Values greater than maximum are clipped. - * Default: Automatically Calculated based on the data - * Example: 100, 350.. - */ - maximum?: number; - /** * Sets the distance between Tick Marks, Grid Lines and Interlaced Colors. * Default: Automatically Calculated * Example: 50, 75.. @@ -638,13 +626,41 @@ declare namespace CanvasJS { labelFontStyle?: string; } - interface ChartAxisYOptions extends ChartAxisXOptions { + interface ChartAxisXOptions extends ChartAxisOptions { + /** + * Sets the minimum value of Axis. Values smaller than minimum are clipped. + * Default: Automatically Calculated based on the data + * Example: 100, 350.. + */ + minimum?: number | Date; + /** + * Sets the maximum value permitted on Axis. Values greater than maximum are clipped. + * Default: Automatically Calculated based on the data + * Example: 100, 350.. + */ + maximum?: number | Date; + } + + interface ChartAxisYOptions extends ChartAxisOptions { /** * When includeZero is set to true, axisY sets the range in such a way that Zero is a part of it. It is set to true by default. But, whenever y values are very big and difference among dataPoints are hard to judge, setting includeZero to false makes axisY to set a range that makes the differences prominently visible. * Default: true * Example: true, false */ includeZero?: boolean; + + /** + * Sets the minimum value of Axis. Values smaller than minimum are clipped. + * Default: Automatically Calculated based on the data + * Example: 100, 350.. + */ + minimum?: number; + /** + * Sets the maximum value permitted on Axis. Values greater than maximum are clipped. + * Default: Automatically Calculated based on the data + * Example: 100, 350.. + */ + maximum?: number; } interface ChartToolTipOptions { From 667d77f21cf01e8037beb07d0cbbfe1a982f66db Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Tue, 4 Oct 2016 19:56:34 +0100 Subject: [PATCH 027/313] Improve support for arrays of promises (#11685) * Alias IWhenable = IPromise | T * Allow all Q functions to work with either promises or raw values * Allow functions expecting arrays to take promises for arrays Q.race is deliberately excluded, as this does not support this type of argument. --- q/Q-tests.ts | 16 ++++++++++++++++ q/Q.d.ts | 51 ++++++++++++++++++++++----------------------------- 2 files changed, 38 insertions(+), 29 deletions(-) diff --git a/q/Q-tests.ts b/q/Q-tests.ts index eaa1241016..a950dfebeb 100644 --- a/q/Q-tests.ts +++ b/q/Q-tests.ts @@ -207,4 +207,20 @@ namespace TestCanRethrowRejectedPromises { } +// test Q.Promise.all +var y1 = Q().then(() => { + var s = Q("hello"); + var n = Q(1); + return <[typeof s, typeof n]>[s, n]; +}); +var y2 = Q().then(() => { + var s = "hello"; + var n = Q(1); + return <[typeof s, typeof n]>[s, n]; +}); + +var p2: Q.Promise<[string, number]> = y1.then(val => Q.all(val)); +var p3: Q.Promise<[string, number]> = Q.all(y1); +var p5: Q.Promise<[string, number]> = y2.then(val => Q.all(val)); +var p6: Q.Promise<[string, number]> = Q.all(y2); diff --git a/q/Q.d.ts b/q/Q.d.ts index 55ac3df6a1..1074d92601 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -18,14 +18,14 @@ declare function Q(value: T): Q.Promise; declare function Q(): Q.Promise; declare namespace Q { + type IWhenable = IPromise | T; interface IPromise { - then(onFulfill?: (value: T) => U | IPromise, onReject?: (error: any) => U | IPromise): IPromise; + then(onFulfill?: (value: T) => IWhenable, onReject?: (error: any) => IWhenable): IPromise; } interface Deferred { promise: Promise; - resolve(value?: T): void; - resolve(value?: IPromise): void; + resolve(value?: IWhenable): void; reject(reason: any): void; notify(value: any): void; makeNodeResolver(): (reason: any, value: T) => void; @@ -48,21 +48,21 @@ declare namespace Q { /** * The then method from the Promises/A+ specification, with an additional progress handler. */ - then(onFulfill?: (value: T) => U | IPromise, onReject?: (error: any) => U | IPromise, onProgress?: Function): Promise; + then(onFulfill?: (value: T) => IWhenable, onReject?: (error: any) => IWhenable, onProgress?: Function): Promise; /** * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. * * This is especially useful in conjunction with all */ - spread(onFulfill: (...args: any[]) => IPromise | U, onReject?: (reason: any) => IPromise | U): Promise; + spread(onFulfill: (...args: any[]) => IWhenable, onReject?: (reason: any) => IWhenable): Promise; - fail(onRejected: (reason: any) => U | IPromise): Promise; + fail(onRejected: (reason: any) => IWhenable): Promise; /** * A sugar method, equivalent to promise.then(undefined, onRejected). */ - catch(onRejected: (reason: any) => U | IPromise): Promise; + catch(onRejected: (reason: any) => IWhenable): Promise; /** * A sugar method, equivalent to promise.then(undefined, undefined, onProgress). @@ -177,10 +177,10 @@ declare namespace Q { export function when(): Promise; // if no fulfill, reject, or progress provided, returned promise will be of same type - export function when(value: T | IPromise): Promise; + export function when(value: IWhenable): Promise; // If a non-promise value is provided, it will not reject or progress - export function when(value: T | IPromise, onFulfilled: (val: T) => U | IPromise, onRejected?: (reason: any) => U | IPromise, onProgress?: (progress: any) => any): Promise; + export function when(value: IWhenable, onFulfilled: (val: T) => IWhenable, onRejected?: (reason: any) => IWhenable, onProgress?: (progress: any) => any): Promise; /** * Currently "impossible" (and I use the term loosely) to implement due to TypeScript limitations as it is now. @@ -188,7 +188,7 @@ declare namespace Q { */ // export function try(method: Function, ...args: any[]): Promise; - export function fbind(method: (...args: any[]) => T | IPromise, ...args: any[]): (...args: any[]) => Promise; + export function fbind(method: (...args: any[]) => IWhenable, ...args: any[]): (...args: any[]) => Promise; export function fcall(method: (...args: any[]) => T, ...args: any[]): Promise; @@ -210,45 +210,45 @@ declare namespace Q { /** * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. */ - export function all(promises: [IPromise, IPromise, IPromise, IPromise, IPromise, IPromise]): Promise<[A, B, C, D, E, F]>; + export function all(promises: IWhenable<[IWhenable, IWhenable, IWhenable, IWhenable, IWhenable, IWhenable]>): Promise<[A, B, C, D, E, F]>; /** * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. */ - export function all(promises: [IPromise, IPromise, IPromise, IPromise, IPromise]): Promise<[A, B, C, D, E]>; + export function all(promises: IWhenable<[IWhenable, IWhenable, IWhenable, IWhenable, IWhenable]>): Promise<[A, B, C, D, E]>; /** * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. */ - export function all(promises: [IPromise, IPromise, IPromise, IPromise]): Promise<[A, B, C, D]>; + export function all(promises: IWhenable<[IWhenable, IWhenable, IWhenable, IWhenable]>): Promise<[A, B, C, D]>; /** * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. */ - export function all(promises: [IPromise, IPromise, IPromise]): Promise<[A, B, C]>; + export function all(promises: IWhenable<[IWhenable, IWhenable, IWhenable]>): Promise<[A, B, C]>; /** * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. */ - export function all(promises: [IPromise, IPromise]): Promise<[A, B]>; + export function all(promises: IWhenable<[IWhenable, IWhenable]>): Promise<[A, B]>; /** * Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected. */ - export function all(promises: IPromise[]): Promise; + export function all(promises: IWhenable[]>): Promise; /** * Returns a promise for the first of an array of promises to become settled. */ - export function race(promises: IPromise[]): Promise; + export function race(promises: IWhenable[]): Promise; /** * Returns a promise that is fulfilled with an array of promise state snapshots, but only after all the original promises have settled, i.e. become either fulfilled or rejected. */ - export function allSettled(promises: IPromise[]): Promise[]>; + export function allSettled(promises: IWhenable[]>): Promise[]>; - export function allResolved(promises: IPromise[]): Promise[]>; + export function allResolved(promises: IWhenable[]>): Promise[]>; /** * Like then, but "spreads" the array into a variadic fulfillment handler. If any of the promises in the array are rejected, instead calls onRejected with the first rejected promise's rejection reason. * This is especially useful in conjunction with all. */ - export function spread(promises: IPromise[], onFulfilled: (...args: T[]) => U | IPromise, onRejected?: (reason: any) => U | IPromise): Promise; + export function spread(promises: IWhenable[], onFulfilled: (...args: T[]) => IWhenable, onRejected?: (reason: any) => IWhenable): Promise; /** * Returns a promise that will have the same result as promise, except that if promise is not fulfilled or rejected before ms milliseconds, the returned promise will be rejected with an Error with the given message. If message is not supplied, the message will be "Timed out after " + ms + " ms". @@ -295,7 +295,7 @@ declare namespace Q { */ export function reject(reason?: any): Promise; - export function Promise(resolver: (resolve: (val: T | IPromise) => void , reject: (reason: any) => void , notify: (progress: any) => void ) => void ): Promise; + export function Promise(resolver: (resolve: (val: IWhenable) => void , reject: (reason: any) => void , notify: (progress: any) => void ) => void ): Promise; /** * Creates a new version of func that accepts any combination of promise and non-promise values, converting them to their fulfillment values before calling the original func. The returned version also always returns a promise: if func does a return or throw, then Q.promised(func) will return fulfilled or rejected promise, respectively. @@ -346,14 +346,7 @@ declare namespace Q { * Calling resolve with a fulfilled promise causes promise to be fulfilled with the passed promise's fulfillment value. * Calling resolve with a non-promise value causes promise to be fulfilled with that value. */ - export function resolve(object: IPromise): Promise; - /** - * Calling resolve with a pending promise causes promise to wait on the passed promise, becoming fulfilled with its fulfillment value or rejected with its rejection reason (or staying pending forever, if the passed promise does). - * Calling resolve with a rejected promise causes promise to be rejected with the passed promise's rejection reason. - * Calling resolve with a fulfilled promise causes promise to be fulfilled with the passed promise's fulfillment value. - * Calling resolve with a non-promise value causes promise to be fulfilled with that value. - */ - export function resolve(object: T): Promise; + export function resolve(object: IWhenable): Promise; /** * Resets the global "Q" variable to the value it has before Q was loaded. From beff62f66f85d38c545687e9b589254302b40540 Mon Sep 17 00:00:00 2001 From: WilliamPeralta Date: Tue, 4 Oct 2016 21:04:19 +0200 Subject: [PATCH 028/313] scheduler options (#11543) --- fullCalendar/fullCalendar.d.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fullCalendar/fullCalendar.d.ts b/fullCalendar/fullCalendar.d.ts index 81ce91d119..5d31fdeaad 100644 --- a/fullCalendar/fullCalendar.d.ts +++ b/fullCalendar/fullCalendar.d.ts @@ -131,6 +131,14 @@ declare namespace FullCalendar { eventAfterRender?: (event: EventObject, element: HTMLDivElement, view: ViewObject) => void; eventAfterAllRender?: (view: ViewObject) => void; eventDestroy?: (event: EventObject, element: JQuery, view: ViewObject) => void; + + //scheduler options + resourceAreaWidth?:number, + schedulerLicenseKey?:string, + customButtons?:any, + resourceLabelText?:any, + resourceColumns?:any, + displayEventTime?:any, } /** From 13308a020d67ad90337790d51f635747e307161c Mon Sep 17 00:00:00 2001 From: Sander Koenders Date: Tue, 4 Oct 2016 21:04:49 +0200 Subject: [PATCH 029/313] Added missing move function (#11563) * Added missing move function Added missing move function in typings so that the move function is recognised by the IDE and the compiler. * Minor derp here --- fs-extra/fs-extra.d.ts | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/fs-extra/fs-extra.d.ts b/fs-extra/fs-extra.d.ts index 7061f08746..d052752ba9 100644 --- a/fs-extra/fs-extra.d.ts +++ b/fs-extra/fs-extra.d.ts @@ -8,7 +8,7 @@ /// declare module "fs-extra" { - export * from "fs"; + export * from "fs"; export function copy(src: string, dest: string, callback?: (err: Error) => void): void; export function copy(src: string, dest: string, filter: CopyFilter, callback?: (err: Error) => void): void; @@ -18,6 +18,9 @@ declare module "fs-extra" { export function copySync(src: string, dest: string, filter: CopyFilter): void; export function copySync(src: string, dest: string, options: CopyOptions): void; + export function move(src: string, dest: string, callback?: (err: Error) => void): void; + export function move(src: string, dest: string, options: MoveOptions, callback?: (err: Error) => void): void; + export function createFile(file: string, callback?: (err: Error) => void): void; export function createFileSync(file: string): void; @@ -55,8 +58,8 @@ declare module "fs-extra" { export function writeJsonSync(file: string, object: any, options?: OpenOptions): void; export function writeJSONSync(file: string, object: any, options?: OpenOptions): void; - export function ensureDir(path: string, cb: (err: Error) => void): void; - export function ensureDirSync(path: string): void; + export function ensureDir(path: string, cb: (err: Error) => void): void; + export function ensureDirSync(path: string): void; export function ensureFile(path: string, cb: (err: Error) => void): void; export function ensureFileSync(path: string): void; @@ -67,10 +70,10 @@ declare module "fs-extra" { export function ensureSymlink(path: string, cb: (err: Error) => void): void; export function ensureSymlinkSync(path: string): void; - export function emptyDir(path: string, callback?: (err: Error) => void): void; - export function emptyDirSync(path: string): boolean; - - export interface CopyFilterFunction { + export function emptyDir(path: string, callback?: (err: Error) => void): void; + export function emptyDirSync(path: string): boolean; + + export interface CopyFilterFunction { (src: string): boolean } @@ -83,6 +86,11 @@ declare module "fs-extra" { filter?: CopyFilter recursive?: boolean } + + export interface MoveOptions { + clobber? : boolean; + limit?: number; + } export interface OpenOptions { encoding?: string; From b26b960488568032a30784845a007ca1d7d1de9a Mon Sep 17 00:00:00 2001 From: Christopher Cortes Date: Tue, 4 Oct 2016 22:58:12 +0200 Subject: [PATCH 030/313] Add missing Valdr typings for validation results and constraints (#11636) * Add missing Valdr types Add ValdrValidationConstraints and ValdrValidationResult typings * Refine Valdr-message typings Set a more refined type to messages instead of any * Expand Valdr typings tests Expand tests to include added typings for ValdrValidationResult and ValdrConstraints * Fix spacing Replace tabs by spaces * Rename vars in test Rename vars to make test clearer * Fix TS issues Added missing types * Remove undefined In TS by default null and undefined are subtypes of all other types * Fix wrong type Add missing namespace * Fix wrong version number Set version to only numbers * Fix wrong version number Keep version to only numbers --- valdr-message/valdr-message.d.ts | 8 ++--- valdr/valdr-tests.ts | 27 +++++++++++++-- valdr/valdr.d.ts | 59 ++++++++++++++++++++++++++++---- 3 files changed, 82 insertions(+), 12 deletions(-) diff --git a/valdr-message/valdr-message.d.ts b/valdr-message/valdr-message.d.ts index b8c2a6673b..961fd8d156 100644 --- a/valdr-message/valdr-message.d.ts +++ b/valdr-message/valdr-message.d.ts @@ -31,7 +31,7 @@ declare namespace valdr.message { * Adds messages for AngularJS build-in validators (eg "required" and "number") or for specific fields (eg "Person.lastName.required"). * @param messages the list of key/value pairs. */ - addMessages(messages: any): void; + addMessages(messages: {[key:string]: string}): void; /** * Gets the validator message. @@ -51,7 +51,7 @@ declare namespace valdr.message { setTemplate(template: string): void; /** - * Sets the URL for the default message template (eg "/partials/valdrMesssageTemplate.html"). + * Sets the URL for the default message template (eg "/partials/valdrMessageTemplate.html"). * @param url the URL of the default message template. */ setTemplateUrl(url: string): void; @@ -60,7 +60,7 @@ declare namespace valdr.message { * Adds messages for AngularJS build-in validators (eg "required" and "number") or for specific fields (eg "Person.lastName.required"). * @param messages the list of key/value pairs. */ - addMessages(messages: any): void; + addMessages(messages: {[key:string]: string}): void; /** * Gets the validator message. @@ -71,4 +71,4 @@ declare namespace valdr.message { */ getMessage(typeName: string, fieldName: string, validatorName: string): string; } -} \ No newline at end of file +} diff --git a/valdr/valdr-tests.ts b/valdr/valdr-tests.ts index eb263223d3..be3348e792 100644 --- a/valdr/valdr-tests.ts +++ b/valdr/valdr-tests.ts @@ -3,6 +3,25 @@ function ValdrTests() { var valdr: valdr.Valdr; var validation = valdr.validate('person', 'lastName', 'test'); + var isValid = validation.valid; + var violations = validation.violations; + violations.forEach(function(violation:valdr.ValdrViolation) { + var valid = violation.valid; + var value = violation.value; + var field = violation.field; + var type = violation.type; + var validator = violation.validator; + var message = violation.message; + }); + var results = validation.validationResults; + results.forEach(function(violation:valdr.ValdrViolation) { + var valid = violation.valid; + var value = violation.value; + var field = violation.field; + var type = violation.type; + var validator = violation.validator; + var message = violation.message; + }); valdr.addConstraints({ 'person': { 'lastName': { @@ -12,8 +31,12 @@ function ValdrTests() { } } }); - valdr.removeConstraints('person'); var constraints = valdr.getConstraints(); + var constraintType = constraints["person"]; + var constraintField = constraintType["lastName"]; + var constraintValidator = constraintField["test"]; + var validationMessage = constraintValidator.message; + valdr.removeConstraints('person'); valdr.setClasses({ valid: 'demo-is-valid', invalid: 'demo-is-invalid' @@ -35,4 +58,4 @@ function ValdrProviderTests() { valdrProvider.setConstraintUrl('/api/constraints'); valdrProvider.addValidator('customValidator'); valdrProvider.addConstraintAlias('customValidator', 'customValidatorAlias'); -} \ No newline at end of file +} diff --git a/valdr/valdr.d.ts b/valdr/valdr.d.ts index 5df4d13aa0..ab6870ab4b 100644 --- a/valdr/valdr.d.ts +++ b/valdr/valdr.d.ts @@ -5,21 +5,68 @@ declare namespace valdr { + /** + * Custom validators must implement this interface to provide custom validation logic. + */ + interface ValdrValidator { + + /** + * Custom validator's name, that will be set in the violation's validator field. + */ + name: string; + + /** + * Method to be called to perform custom validation over given value. + */ + validate(value: any, validationArguments?: {[argumentName:string]: any}): boolean; + } + + interface ValdrConstraintValidator { + [argumentName:string]: any; + message: string; + } + + interface ValdrConstraintFieldName { + [validatorName:string]: ValdrConstraintValidator; + } + + interface ValdrConstraintTypeName { + [fieldName:string]: ValdrConstraintFieldName; + } + + interface ValdrConstraints { + [typeName:string]: ValdrConstraintTypeName; + } + + interface ValdrViolation extends ValdrConstraintValidator { + valid: boolean; + value: string; + field: string; + type: string; + validator: string; + } + + interface ValdrValidationResult { + valid: boolean; + violations: ValdrViolation[]; + validationResults: ValdrViolation[]; + } + interface Valdr { /** * Validates the value of the given type with the constraints for the given field name. * @param typeName the type name. * @param fieldName the field name. * @param value the value to validate. - * @returns {*} the validation result. + * @returns {ValdrValidationResult} the validation result. */ - validate(typeName: string, fieldName: string, value: string): any; + validate(typeName: string, fieldName: string, value: string): ValdrValidationResult; /** * Adds a new list of constraints (JSON Object). * @param newConstraints the list of constraints (JSON Object). */ - addConstraints(newConstraints: any): void; + addConstraints(newConstraints: ValdrConstraints): void; /** * Removes one or many contraints. @@ -31,7 +78,7 @@ declare namespace valdr { * Gets the list of constraints (JSON Object). * @returns the list of constraints. */ - getConstraints(): any; + getConstraints(): ValdrConstraints; /** * Sets custom classes on the surrounding elements. @@ -45,7 +92,7 @@ declare namespace valdr { * Adds a new list of constraints (JSON Object). * @param newConstraints the list of constraints (JSON Object). */ - addConstraints(newConstraints: any): void; + addConstraints(newConstraints: ValdrConstraints): void; /** * Removes one or many contraints. @@ -72,4 +119,4 @@ declare namespace valdr { */ addConstraintAlias(valdrName: string, alias: string): void; } -} \ No newline at end of file +} From bf103e8654d6201f834fc597f7e7640326084528 Mon Sep 17 00:00:00 2001 From: York Yao Date: Thu, 6 Oct 2016 04:17:48 +0800 Subject: [PATCH 031/313] add type definitions for qrcode (#11723) --- qrcode/qrcode-tests.ts | 16 ++++++++++++++++ qrcode/qrcode.d.ts | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 qrcode/qrcode-tests.ts create mode 100644 qrcode/qrcode.d.ts diff --git a/qrcode/qrcode-tests.ts b/qrcode/qrcode-tests.ts new file mode 100644 index 0000000000..dc1e539a8e --- /dev/null +++ b/qrcode/qrcode-tests.ts @@ -0,0 +1,16 @@ +/// + +import * as QRCode from 'qrcode'; + +QRCode.toDataURL('i am a pony!', function (err, url) { + console.log(url); +}); + +var qrcodedraw = new QRCodeLib.QRCodeDraw(); + +qrcodedraw.draw(document.getElementById('test') as HTMLCanvasElement, "this text will be in the code!", function (error, canvas) { + if (error) { + return console.log('Error =( ', error); + } + console.log('success!'); +}); diff --git a/qrcode/qrcode.d.ts b/qrcode/qrcode.d.ts new file mode 100644 index 0000000000..f3f355d90b --- /dev/null +++ b/qrcode/qrcode.d.ts @@ -0,0 +1,35 @@ +// Type definitions for qrcode +// Project: https://github.com/soldair/node-qrcode +// Definitions by: York Yao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type QRCodeOptions = { + errorCorrectLevel?: "minimum" | "medium" | "high" | "max"; +} + +declare module "qrcode" { + var qrcode: { + toDataURL(text: string, callback: (error: Error, dataURL: string) => void): void; + toDataURL(text: string, options: QRCodeOptions, callback: (error: Error, dataURL: string) => void): void; + draw(text: string, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; + draw(text: string, options: QRCodeOptions, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; + drawSvg(text: string, callback: (error: Error, svgString: string) => void): void; + drawSvg(text: string, options: QRCodeOptions, callback: (error: Error, svgString: string) => void): void; + save(path: string, text: string, callback: (error: Error, written: any) => void): void; + save(path: string, text: string, options: QRCodeOptions, callback: (error: Error, written: any) => void): void; + drawText(text: string, callback: (error: Error) => void): void; + drawText(text: string, options: QRCodeOptions, callback: (error: Error) => void): void; + drawBitArray(text: string, callback: (error: Error, bits: any, width: number) => void): void; + drawBitArray(text: string, options: QRCodeOptions, callback: (error: Error, bits: any, width: number) => void): void; + }; + export = qrcode; +} + +declare var QRCodeLib: { + QRCodeDraw: { + new (): { + draw(element: HTMLCanvasElement, text: string, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; + draw(element: HTMLCanvasElement, text: string, options: QRCodeOptions, callback: (error: Error, canvas: HTMLCanvasElement) => void): void; + } + }; +}; From 12649b923f2bb94dcce80f4bc65f21cb300620d7 Mon Sep 17 00:00:00 2001 From: Olivier Lamothe Date: Wed, 5 Oct 2016 16:44:41 -0400 Subject: [PATCH 032/313] Add types definition for jstz (jsTimezoneDetect) (#11716) * Add types definition for jstz (jsTimezoneDetect https://bitbucket.org/pellepim/jstimezonedetect) * Rename to jstimezonedetect --- jstimezonedetect/jstimezonedetect-tests.ts | 5 +++++ jstimezonedetect/jstimezonedetect.d.ts | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 jstimezonedetect/jstimezonedetect-tests.ts create mode 100644 jstimezonedetect/jstimezonedetect.d.ts diff --git a/jstimezonedetect/jstimezonedetect-tests.ts b/jstimezonedetect/jstimezonedetect-tests.ts new file mode 100644 index 0000000000..c4907aa6b0 --- /dev/null +++ b/jstimezonedetect/jstimezonedetect-tests.ts @@ -0,0 +1,5 @@ +/// + +import * as jstz from 'jstimezonedetect'; + +jstz.determine().name() === 'America/Montreal'; diff --git a/jstimezonedetect/jstimezonedetect.d.ts b/jstimezonedetect/jstimezonedetect.d.ts new file mode 100644 index 0000000000..9709f52724 --- /dev/null +++ b/jstimezonedetect/jstimezonedetect.d.ts @@ -0,0 +1,16 @@ +// Type definitions for jsTimezoneDetect +// Project: https://bitbucket.org/pellepim/jstimezonedetect +// Definitions by: Olivier Lamothe +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface JsTimezoneDetect { + determine: ()=> { + name: ()=> string; + } +} + +declare var jstimezonedetect: JsTimezoneDetect; + +declare module "jstimezonedetect" { + export = jstimezonedetect; +} From 5b4b22a2e84ad166ecd4f388f872a4ba32fddfbd Mon Sep 17 00:00:00 2001 From: rgvassar Date: Wed, 5 Oct 2016 13:55:51 -0700 Subject: [PATCH 033/313] Uncommented ol.proj.setProj4. (#11744) Changed the type of the parameter to any. --- openlayers/openlayers.d.ts | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/openlayers/openlayers.d.ts b/openlayers/openlayers.d.ts index c321517697..19bb0f4a8a 100644 --- a/openlayers/openlayers.d.ts +++ b/openlayers/openlayers.d.ts @@ -6366,7 +6366,7 @@ declare module ol { * @api stable */ getSource(): ol.source.Vector; - + /** * Get the style for features. This returns whatever was passed to the `style` * option at construction or to the `setStyle` method. @@ -7767,19 +7767,19 @@ declare module ol { } - // /** - // * Register proj4. If not explicitly registered, it will be assumed that - // * proj4js will be loaded in the global namespace. For example in a - // * browserify ES6 environment you could use: - // * - // * import ol from 'openlayers'; - // * import proj4 from 'proj4'; - // * ol.proj.setProj4(proj4); - // * - // * @param {proj4} proj4 Proj4. - // * @api - // */ - // function setProj4(proj4: proj4): void; + /** + * Register proj4. If not explicitly registered, it will be assumed that + * proj4js will be loaded in the global namespace. For example in a + * browserify ES6 environment you could use: + * + * import ol from 'openlayers'; + * import proj4 from 'proj4'; + * ol.proj.setProj4(proj4); + * + * @param {any} proj4 Proj4. + * @api + */ + function setProj4(proj4: any): void; /** * Registers transformation functions that don't alter coordinates. Those allow @@ -7888,8 +7888,6 @@ declare module ol { * @param {ol.Coordinate} coordinate Coordinate. * @param {ol.ProjectionLike} source Source projection-like. * @param {ol.ProjectionLike} destination Destination projection-like. - * @return {ol.Coordinate} Coordinate. - * @api stable */ function transform(coordinate: ol.Coordinate, source: ol.ProjectionLike, destination: ol.ProjectionLike): ol.Coordinate; From db995d641cce0de40691d83673613092ab549318 Mon Sep 17 00:00:00 2001 From: lucap86 Date: Thu, 6 Oct 2016 02:20:03 +0200 Subject: [PATCH 034/313] GreenSock easing classes fix (#11594) * refs #9944 * refs #11265 * refs #11265 * Fixed ease types --- greensock/greensock.d.ts | 224 ++++++++++++++++++--------------------- 1 file changed, 103 insertions(+), 121 deletions(-) diff --git a/greensock/greensock.d.ts b/greensock/greensock.d.ts index 004ec79dab..95c2ad6a4c 100644 --- a/greensock/greensock.d.ts +++ b/greensock/greensock.d.ts @@ -44,7 +44,7 @@ declare type TweenConfig = { autoCSS?: boolean; callbackScope?: Object; } - + //com.greensock.core declare class Animation { static ticker: IDispatcher; @@ -198,109 +198,106 @@ declare class TimelineMax extends TimelineLite { } //com.greensock.easing -interface Back { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; +declare class Ease { + constructor(func:Function, extraParams:any[], type:number, power:number); + public getRatio(p: number): number; } -interface Bounce { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Circ { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Cubic { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Ease { - getRatio(p:number):number; -} -interface EaseLookup { - find(name:string):Ease; -} -interface Elastic { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Expo { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Linear { - ease:Linear; - easeIn:Linear; - easeInOut:Linear; - easeNone:Linear; - easeOut:Linear; -} -interface Power0 { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Power1 { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Power2 { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Power3 { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Power4 { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Quad { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Quart { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Quint { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface Sine { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; -} -interface SlowMo { - ease:SlowMo; - new (linearRatio:number, power:number, yoyoMode:boolean):SlowMo; - config(linearRatio:number, power:number, yoyoMode:boolean):SlowMo; - getRatio(p:number):number; +declare class EaseLookup { + public static find(name: string): Ease; } -interface SteppedEase { - config(steps:number):SteppedEase; - getRatio(p:number):number; + +declare class Back extends Ease { + public static easeIn: Back; + public static easeInOut: Back; + public static easeOut: Back; + public config(overshoot: number): Elastic; + } -interface Strong { - easeIn:Ease; - easeInOut:Ease; - easeOut:Ease; +declare class Bounce extends Ease { + public static easeIn: Bounce; + public static easeInOut: Bounce; + public static easeOut: Bounce; +} +declare class Circ extends Ease { + public static easeIn: Circ; + public static easeInOut: Circ; + public static easeOut: Circ; +} +declare class Cubic extends Ease { + public static easeIn: Cubic; + public static easeInOut: Cubic; + public static easeOut: Cubic; +} + +declare class Elastic extends Ease { + public static easeIn: Elastic; + public static easeInOut: Elastic; + public static easeOut: Elastic; + public config(amplitude: number, period: number): Elastic; +} + +declare class Expo extends Ease { + public static easeIn: Expo; + public static easeInOut: Expo; + public static easeOut: Expo; +} + +declare class Linear extends Ease { + public static ease: Linear; + public static easeIn: Linear; + public static easeInOut: Linear; + public static easeNone: Linear; + public static easeOut: Linear; +} + +declare class Quad extends Ease { + public static easeIn: Quad; + public static easeInOut: Quad; + public static easeOut: Quad; +} + +declare class Quart extends Ease { + public static easeIn: Quart; + public static easeInOut: Quart; + public static easeOut: Quart; +} + +declare class Quint extends Ease { + public static easeIn: Quint; + public static easeInOut: Quint; + public static easeOut: Quint; +} + +declare class Sine extends Ease { + public static easeIn: Sine; + public static easeInOut: Sine; + public static easeOut: Sine; +} + +declare class SlowMo extends Ease { + public static ease: SlowMo; + public config(linearRatio: number, power: number, yoyoMode: boolean): SlowMo; +} + +declare class SteppedEase extends Ease { + constructor(staps: number); + public config(steps: number): SteppedEase; +} + +declare type RoughEaseConfig = { + clamp?: boolean; + points?: number; + randomize?: boolean; + strength?: number; + taper?: string; /* one of "in" | "out" | "both" | "none" */ + template?: Ease; +} + +declare class RoughEase extends Ease { + public static ease: RoughEase; + constructor(vars: RoughEaseConfig); + public config(steps: number): SteppedEase; } //com.greensock.plugins @@ -335,27 +332,12 @@ interface TweenPlugin { } //com.greensock.easing -declare var Back:Back; -declare var Bounce:Bounce; -declare var Circ:Circ; -declare var Cubic:Cubic; -declare var Ease:Ease; -declare var EaseLookup:EaseLookup; -declare var Elastic:Elastic; -declare var Expo:Expo; -declare var Linear:Linear; -declare var Power0:Power0; -declare var Power1:Power1; -declare var Power2:Power2; -declare var Power3:Power3; -declare var Power4:Power4; -declare var Quad:Quad; -declare var Quart:Quart; -declare var Quint:Quint; -declare var Sine:Sine; -declare var SlowMo:SlowMo; -declare var SteppedEase:SteppedEase; -declare var Strong:Strong; +declare var Power0: typeof Linear; +declare var Power1: typeof Quad; +declare var Power2: typeof Cubic; +declare var Power3: typeof Quart; +declare var Power4: typeof Quint; +declare var Strong: typeof Quint; //com.greensock.plugins declare var BezierPlugin:BezierPlugin; From 988a0d16a3c35cb8b6b3748356660406f81c2294 Mon Sep 17 00:00:00 2001 From: Jeffery Grajkowski Date: Wed, 5 Oct 2016 20:24:00 -0700 Subject: [PATCH 035/313] Definitions for quoted-printable. (#11749) * Definitions for quoted-printable. * Fix the spelling of my own dang name. --- quoted-printable/quoted-printable-tests.ts | 11 +++++++++ quoted-printable/quoted-printable.d.ts | 27 ++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 quoted-printable/quoted-printable-tests.ts create mode 100644 quoted-printable/quoted-printable.d.ts diff --git a/quoted-printable/quoted-printable-tests.ts b/quoted-printable/quoted-printable-tests.ts new file mode 100644 index 0000000000..c13580bbf9 --- /dev/null +++ b/quoted-printable/quoted-printable-tests.ts @@ -0,0 +1,11 @@ +/// +/// + +import * as quotedPrintable from "quoted-printable"; +import * as utf8 from "utf8"; + +quotedPrintable.version === "0.2.1"; +quotedPrintable.encode(utf8.encode("foo=bar")); +quotedPrintable.encode(utf8.encode("Iñtërnâtiônàlizætiøn☃💩")); +utf8.decode(quotedPrintable.decode("foo=3Dbar")); +utf8.decode(quotedPrintable.decode("I=C3=B1t=C3=ABrn=C3=A2ti=C3=B4n=C3=A0liz=C3=A6ti=C3=B8n=E2=98=83=F0=9F=92=\r\n=A9")); diff --git a/quoted-printable/quoted-printable.d.ts b/quoted-printable/quoted-printable.d.ts new file mode 100644 index 0000000000..2d3edceb0a --- /dev/null +++ b/quoted-printable/quoted-printable.d.ts @@ -0,0 +1,27 @@ +// Type definitions for quoted-printable v0.2.1 +// Project: https://github.com/mathiasbynens/quoted-printable +// Definitions by: Jeffery Grajkowski +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "quoted-printable" { + /** + * A string representing the semantic version number. + */ + export const version: string; + + /** + * This function takes an encoded byte string (the input + * parameter) and Quoted-Printable-encodes it. Each item + * in the input string represents an octet as per the + * desired character encoding. + */ + export function encode(input: string): string; + + /** + * This function takes a string of text (the text parameter) + * and Quoted-Printable-decodes it. The return value is a + * ‘byte string’, i.e. a string of which each item represents + * an octet as per the character encoding that’s being used. + */ + export function decode(input: string): string; +} From ed55234e6f716015ca3638063fb60c025114d8f3 Mon Sep 17 00:00:00 2001 From: Daniel Areiza Date: Wed, 5 Oct 2016 22:46:17 -0500 Subject: [PATCH 036/313] jquery-colorpicker update (#11297) * jquery-colorpicker update * Changed suggested type to original --- jquery.colorpicker/jquery.colorpicker.d.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/jquery.colorpicker/jquery.colorpicker.d.ts b/jquery.colorpicker/jquery.colorpicker.d.ts index 0f904b8c1c..22a9dac449 100644 --- a/jquery.colorpicker/jquery.colorpicker.d.ts +++ b/jquery.colorpicker/jquery.colorpicker.d.ts @@ -8,12 +8,12 @@ interface JQueryColorpickerOptions { // Events // TODO: Figure out actual types. - cancel: Function, - close: Function, - init: Function, - select: Function, - ok: Function, - open: Function, + cancel?: Function, + close?: Function, + init?: Function, + select?: Function, + ok?: Function, + open?: Function, alpha?: boolean; altAlpha?: boolean; @@ -32,6 +32,8 @@ interface JQueryColorpickerOptions { colorFormat?: string; draggable?: boolean; duration?: string; + format?: string; + horizontal?: boolean; hsv?: boolean; inline?: boolean; inlineFrame?: boolean; From b73e47ca80e9c8d68e202500fb7f7952e04092f7 Mon Sep 17 00:00:00 2001 From: Daniel Areiza Date: Thu, 6 Oct 2016 00:17:30 -0500 Subject: [PATCH 037/313] bootstrap-datepicker view mode option (#11755) * jquery-colorpicker update * Changed suggested type to original * bootstrap-datepicker view mode option --- bootstrap-datepicker/bootstrap-datepicker.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap-datepicker/bootstrap-datepicker.d.ts b/bootstrap-datepicker/bootstrap-datepicker.d.ts index 1a2bb2124b..007f812c03 100644 --- a/bootstrap-datepicker/bootstrap-datepicker.d.ts +++ b/bootstrap-datepicker/bootstrap-datepicker.d.ts @@ -36,6 +36,7 @@ interface DatepickerOptions { multidateSeparator?: string; orientation?: string; assumeNearbyYear?: any; + viewMode?: string; } interface DatepickerCustomFormatOptions { From 851b50fa81b02d2ab2e84d087f511d1e68e3f499 Mon Sep 17 00:00:00 2001 From: jakubskopal Date: Thu, 6 Oct 2016 15:21:46 +0200 Subject: [PATCH 038/313] add byline default function calling convention (#11659) * add byline default function calling convention * add tests for function-like usage of byline --- byline/byline-tests.ts | 7 ++++--- byline/byline.d.ts | 46 +++++++++++++++++++----------------------- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/byline/byline-tests.ts b/byline/byline-tests.ts index 42de3d5d9c..201d5dbda3 100644 --- a/byline/byline-tests.ts +++ b/byline/byline-tests.ts @@ -7,8 +7,9 @@ import fs = require( 'fs' ); import byline = require( 'byline' ); -//TODO can this be typed in an ambient way? -//var stream = byline( fs.createReadStream( 'sample.txt', {encoding: 'utf8'} ) ); +var stream = byline(); + +var stream = byline( fs.createReadStream( 'sample.txt', {encoding: 'utf8'} ) ); var stream = byline.createStream( fs.createReadStream( 'sample.txt', {encoding: 'utf8'} ) ); @@ -44,4 +45,4 @@ var output = fs.createWriteStream('nolines.txt'); var lineStream:byline.LineStream = new LineStream(); input.pipe(lineStream); -lineStream.pipe(output); \ No newline at end of file +lineStream.pipe(output); diff --git a/byline/byline.d.ts b/byline/byline.d.ts index 48ddd2d57a..68cb81e139 100644 --- a/byline/byline.d.ts +++ b/byline/byline.d.ts @@ -8,31 +8,27 @@ declare module "byline" { import stream = require("stream"); - export interface LineStreamOptions extends stream.TransformOptions { - keepEmptyLines?: boolean; + function bl(): bl.LineStream; + function bl(stream: NodeJS.ReadableStream, options?: bl.LineStreamOptions): bl.LineStream; + + namespace bl { + + export interface LineStreamOptions extends stream.TransformOptions { + keepEmptyLines?: boolean; + } + + export interface LineStream extends stream.Transform { + } + + export interface LineStreamCreatable extends LineStream { + new (options?: LineStreamOptions): LineStream + } + + export function createStream(): LineStream; + export function createStream(stream: NodeJS.ReadableStream, options?: LineStreamOptions): LineStream; + + export var LineStream: LineStreamCreatable; } - export interface LineStream extends stream.Transform { - } - - export interface LineStreamCreatable extends LineStream { - new (options?:LineStreamOptions):LineStream - } - - //TODO is it possible to declare static factory functions without name (directly on the module) - // - // JS: - // // convinience API - // module.exports = function(readStream, options) { - // return module.exports.createStream(readStream, options); - // }; - // - // TS: - // ():LineStream; // same as createStream():LineStream - // (stream:stream.Stream, options?:LineStreamOptions):LineStream; // same as createStream(stream, options?):LineStream - - export function createStream():LineStream; - export function createStream(stream:NodeJS.ReadableStream, options?:LineStreamOptions):LineStream; - - export var LineStream:LineStreamCreatable; + export = bl; } From 6a70dd082e6dd97218d76cffb56bf7540dc51368 Mon Sep 17 00:00:00 2001 From: Sam Verschueren Date: Thu, 6 Oct 2016 16:03:53 +0200 Subject: [PATCH 039/313] fix object-assign (#11709) --- object-assign/object-assign-tests.ts | 12 ++++++------ object-assign/object-assign.d.ts | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/object-assign/object-assign-tests.ts b/object-assign/object-assign-tests.ts index 6b9a898ed4..7fa41a7cb7 100644 --- a/object-assign/object-assign-tests.ts +++ b/object-assign/object-assign-tests.ts @@ -1,5 +1,5 @@ /// -import objectAssign = require("object-assign"); +import * as objectAssign from 'object-assign'; interface Target { hellow: string; @@ -10,7 +10,7 @@ interface Source1 { } interface Result extends Target, Source1 { - + } interface Source2 { @@ -18,7 +18,7 @@ interface Source2 { } interface Result2 extends Result, Source2 { - + } interface Source3 { @@ -26,7 +26,7 @@ interface Source3 { } interface Result3 extends Result2, Source3 { - + } interface Source4 { @@ -34,7 +34,7 @@ interface Source4 { } interface Result4 extends Result3, Source4 { - + } interface Source5 { @@ -42,7 +42,7 @@ interface Source5 { } interface Result5 extends Result4, Source5 { - + } function assign1(): Result { diff --git a/object-assign/object-assign.d.ts b/object-assign/object-assign.d.ts index c3f92b7592..5ed4fca2d1 100644 --- a/object-assign/object-assign.d.ts +++ b/object-assign/object-assign.d.ts @@ -10,5 +10,6 @@ declare module "object-assign" { function objectAssign(target: T, source1: U, source2: V, source3: W, source4: Q): T & U & V & W & Q; function objectAssign(target: T, source1: U, source2: V, source3: W, source4: Q, source5: R): T & U & V & W & Q & R; function objectAssign(target: any, ...sources: any[]): any; + namespace objectAssign { } export = objectAssign; } From 877a2af148ad04675bb647e1a358be6d2b25b985 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Verg=C3=A9?= Date: Thu, 6 Oct 2016 16:26:24 +0200 Subject: [PATCH 040/313] fix(CKEditor): Fix config.toolbar type (#11567) The type for toolbar is currently defined as `string | (string[])[]`, but it should be `string | (string | string[])[]`. The `toolbar` property is either: * a toolbar name (`string`) * or an array of elements, that can be `string`s (for instance a newline marker `'/'`) or `string[]`s (for instance a list of buttons). For example, this is a valid configuration: ```js CKEDITOR.config.toolbar = [ [ 'mode', 'document', 'doctools' ], [ 'clipboard', 'undo' ], '/', [ 'find', 'selection', 'spellchecker' ], [ 'basicstyles', 'cleanup' ], '/', [ 'list', 'indent', 'blocks', 'align', 'bidi' ], ]; ``` --- ckeditor/ckeditor-tests.ts | 17 +++++++++++++++++ ckeditor/ckeditor.d.ts | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ckeditor/ckeditor-tests.ts b/ckeditor/ckeditor-tests.ts index bcf2a7807b..97a5c73937 100644 --- a/ckeditor/ckeditor-tests.ts +++ b/ckeditor/ckeditor-tests.ts @@ -37,6 +37,23 @@ function test_CKEDITOR() { CKEDITOR.replaceAll((textarea, config) => false); } +function test_config() { + var config1: CKEDITOR.config = { + toolbar: 'basic', + }; + var config2: CKEDITOR.config = { + toolbar: [ + [ 'mode', 'document', 'doctools' ], + [ 'clipboard', 'undo' ], + '/', + [ 'find', 'selection', 'spellchecker' ], + [ 'basicstyles', 'cleanup' ], + '/', + [ 'list', 'indent', 'blocks', 'align', 'bidi' ], + ], + }; +} + function test_dom_comment() { var type = CKEDITOR.NODE_COMMENT; var nativeNode = document.createComment('Example'); diff --git a/ckeditor/ckeditor.d.ts b/ckeditor/ckeditor.d.ts index b5009fa031..d43446dd83 100644 --- a/ckeditor/ckeditor.d.ts +++ b/ckeditor/ckeditor.d.ts @@ -807,7 +807,7 @@ declare namespace CKEDITOR { templates_files?: Object; templates_replaceContent?: boolean; title?: string | boolean; - toolbar?: string | (string[])[]; + toolbar?: string | (string | string[])[]; toolbarCanCollapse?: boolean; toolbarGroupCycling?: boolean; toolbarGroups?: toolbarGroups[]; From 384a4f4a5dbe893e4c6edcac900bc37c6d6d7779 Mon Sep 17 00:00:00 2001 From: Schwobaland Date: Thu, 6 Oct 2016 16:32:53 +0200 Subject: [PATCH 041/313] fixed setMaxBounds to match maxBounds in MapOptions (#11738) * fixed setMaxBounds to match maxBounds in MapOptions * comment removed and splitted into two overloads. --- leaflet/leaflet-tests.ts | 4 ++-- leaflet/leaflet.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/leaflet/leaflet-tests.ts b/leaflet/leaflet-tests.ts index 9b07b8fd03..4b435fe2af 100644 --- a/leaflet/leaflet-tests.ts +++ b/leaflet/leaflet-tests.ts @@ -237,8 +237,8 @@ map = map .panTo(latLngTuple, panOptions) .panBy(point) .panBy(pointTuple) - .setMaxBounds(bounds) // investigate if this really receives Bounds instead of LatLngBounds - .setMaxBounds(boundsLiteral) + .setMaxBounds(latLngBounds) + .setMaxBounds(latLngBoundsLiteral) .setMinZoom(5) .setMaxZoom(10) .panInsideBounds(latLngBounds) diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index 50051df19d..2f5b908661 100644 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -1231,8 +1231,8 @@ declare namespace L { panTo(latlng: LatLngTuple, options?: PanOptions): this; panBy(offset: Point): this; panBy(offset: PointTuple): this; - setMaxBounds(bounds: Bounds): this; // is this really bounds and not lanlngbounds? - setMaxBounds(bounds: BoundsLiteral): this; + setMaxBounds(bounds: LatLngBounds): this; + setMaxBounds(bounds: LatLngBoundsLiteral): this; setMinZoom(zoom: number): this; setMaxZoom(zoom: number): this; panInsideBounds(bounds: LatLngBounds, options?: PanOptions): this; From afa8fc20023d9dff9313a63cd65a97758bcbab70 Mon Sep 17 00:00:00 2001 From: Jani Date: Thu, 6 Oct 2016 17:33:50 +0300 Subject: [PATCH 042/313] yargs: fix fail API (#11757) * yargs: fix --target es6 * yargs: fix fail API --- yargs/yargs-tests.ts | 15 ++++++++++++++- yargs/yargs.d.ts | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts index c964e1b724..9246bf4725 100644 --- a/yargs/yargs-tests.ts +++ b/yargs/yargs-tests.ts @@ -4,8 +4,9 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +/// -import yargs = require('yargs'); +import * as yargs from 'yargs'; // Examples taken from yargs website // https://github.com/chevex/yargs @@ -343,3 +344,15 @@ function Argv$commandDirWithOptions() { }) .argv } + +// http://yargs.js.org/docs/#methods-failfn +function Argv$fail() { + var argv = yargs + .fail(function (msg, err) { + if (err) throw err // preserve stack + console.error('You broke it!') + console.error(msg) + process.exit(1) + }) + .argv +} diff --git a/yargs/yargs.d.ts b/yargs/yargs.d.ts index e2f329e3c0..547b6e9e63 100644 --- a/yargs/yargs.d.ts +++ b/yargs/yargs.d.ts @@ -135,7 +135,7 @@ declare module "yargs" { count(key: string): Argv; count(keys: string[]): Argv; - fail(func: (msg: string) => any): void; + fail(func: (msg: string, err: Error) => any): Argv; } interface RequireDirectoryOptions { From f63e50aa818affaffb2eb0faf5ca426746e67ebc Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Thu, 6 Oct 2016 23:36:47 +0900 Subject: [PATCH 043/313] TypeScript-STL v1.1.2 & Samchon-Framework v2-gamma.3 (#11758) * Samchon Framework & TypeScript-STL for TS2.0 * bootstrap-datepicker view mode option (#11755) * jquery-colorpicker update * Changed suggested type to original * bootstrap-datepicker view mode option * Revert "Samchon Framework & TypeScript-STL for TS2.0" This reverts commit 6d9853350f1d9cc4cb19da72ed4d7aebb5f21eeb. * TypeScript-STL v1.1.2 & Samchon-Framework v2-gamma.3 --- samchon-collection/samchon-collection.d.ts | 6 +- samchon-framework/samchon-framework.d.ts | 10317 +++++++++++++------ typescript-stl/typescript-stl.d.ts | 501 +- 3 files changed, 7371 insertions(+), 3453 deletions(-) diff --git a/samchon-collection/samchon-collection.d.ts b/samchon-collection/samchon-collection.d.ts index 0bff8791f9..3041c6a618 100644 --- a/samchon-collection/samchon-collection.d.ts +++ b/samchon-collection/samchon-collection.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Samchon Collection v0.0.2 +// Type definitions for Samchon Collection v0.0.4 // Project: https://github.com/samchon/framework // Definitions by: Jeongho Nam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,7 +7,7 @@ declare module "samchon-collection" { - import collection = samchon.collection; - export = collection; + import collections = samchon.collections; + export = collections; } diff --git a/samchon-framework/samchon-framework.d.ts b/samchon-framework/samchon-framework.d.ts index 70d9dda38f..d04ed7fcf3 100644 --- a/samchon-framework/samchon-framework.d.ts +++ b/samchon-framework/samchon-framework.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Samchon Framework v2.0.0-beta.8 +// Type definitions for Samchon Framework v2.0.0-gamma.3 // Project: https://github.com/samchon/framework // Definitions by: Jeongho Nam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -7,63 +7,110 @@ declare module "samchon-framework" { - export = samchon; + export = samchon; } /** *

Samchon-Framework

* - *
+ * + * * - *

Samchon, a SDN (Software Defined Network) framework.

+ * Samchon, a SDN (Software Defined Network) framework. * - *

With Samchon Framework, you can implement distributed processing system within framework of OOD like - * handling S/W objects (classes). You can realize cloud and distributed system very easily with provided - * system templates and even integration with C++ is possible.

+ * With Samchon Framework, you can implement distributed processing system within framework of OOD like handling S/W + * objects (classes). You can realize cloud and distributed system very easily with provided system templates and even + * integration with C++ is possible. * - *

The goal, ultimate utilization model of Samchon Framework is, building cloud system with NodeJS and - * takING heavy works to C++ distributed systems with provided modules (those are system templates).

+ * The goal, ultimate utilization model of Samchon Framework is, building cloud system with NodeJS and taking heavy works + * to C++ distributed systems with provided modules (those are system templates). * * @git https://github.com/samchon/framework * @author Jeongho Nam */ declare namespace samchon { /** - *

Running on Node.

+ * Running on Node. * - *

Test whether the JavaScript is running on Node.

+ * Test whether the JavaScript is running on Node. * * @references http://stackoverflow.com/questions/17575790/environment-detection-node-js-or-browser */ function is_node(): boolean; } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * A {@link Vector} who can detect element I/O events. * - *
    - *
  • insert typed events:
      - *
    • {@link assign}
    • - *
    • {@link insert}
    • - *
    • {@link push}
    • - *
    • {@link push_back}
    • - *
    • {@link unshift}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link assign}
    • - *
    • {@link clear}
    • - *
    • {@link erase}
    • - *
    • {@link pop_back}
    • - *
    • {@link shift}
    • - *
    • {@link pop}
    • - *
    • {@link splice}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link sort}
    • - *
  • - *
+ * Below is the list of methods who are dispatching {@link CollectionEvent}: + * - *insert* typed events: + * - {@link assign} + * - {@link insert} + * - {@link push} + * - {@link push_back} + * - {@link unshift} + * - *erase* typed events: + * - {@link assign} + * - {@link clear} + * - {@link erase} + * - {@link pop_back} + * - {@link shift} + * - {@link pop} + * - {@link splice} + * - *refresh* typed events: + * - {@link refresh} * + * #### [Inherited] {@link Vector} + * {@link Vector Vectors}s are sequence containers representing arrays that can change in size. + * + * Just like arrays, {@link Vector}s use contiguous storage locations for their elements, which means that their + * elements can also be accessed using offsets on regular pointers to its elements, and just as efficiently as in + * arrays. But unlike arrays, their size can change dynamically, with their storage being handled automatically + * by the container. + * + * Internally, {@link Vector}s use a dynamically allocated array to store their elements. This array may need to + * be reallocated in order to grow in size when new elements are inserted, which implies allocating a new array + * and moving all elements to it. This is a relatively expensive task in terms of processing time, and thus, + * {@link Vector}s do not reallocate each time an element is added to the container. + * + * Instead, {@link Vector} containers may allocate some extra storage to accommodate for possible growth, and + * thus the container may have an actual {@link capacity} greater than the storage strictly needed to contain its + * elements (i.e., its {@link size}). Libraries can implement different strategies for growth to balance between + * memory usage and reallocations, but in any case, reallocations should only happen at logarithmically growing + * intervals of {@link size} so that the insertion of individual elements at the end of the {@link Vector} can be + * provided with amortized constant time complexity (see {@link push_back push_back()}). + * + * Therefore, compared to arrays, {@link Vector}s consume more memory in exchange for the ability to manage + * storage and grow dynamically in an efficient way. + * + * Compared to the other dynamic sequence containers ({@link Deque}s, {@link List}s), {@link Vector Vectors} are + * very efficient accessing its elements (just like arrays) and relatively efficient adding or removing elements + * from its end. For operations that involve inserting or removing elements at positions other than the end, they + * perform worse than the others, and have less consistent iterators and references than {@link List}s. + * + * + * + * + * + *

Container properties

+ *
+ *
Sequence
+ *
+ * Elements in sequence containers are ordered in a strict linear sequence. Individual elements are + * accessed by their position in this sequence. + *
+ * + *
Dynamic array
+ *
+ * Allows direct access to any element in the sequence, even through pointer arithmetics, and provides + * relatively fast addition/removal of elements at the end of the sequence. + *
+ *
+ * + * @param Type of the elements. + * + * @reference http://www.cplusplus.com/reference/vector/vector + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class ArrayCollection extends std.Vector implements ICollection { @@ -74,7 +121,7 @@ declare namespace samchon.collection { /** * @inheritdoc */ - push(...items: U[]): number; + push(...items: T[]): number; /** * @inheritdoc */ @@ -170,6 +217,7 @@ declare namespace samchon.library { * A basic event class of Samchon Framework. * * @reference https://developer.mozilla.org/en-US/docs/Web/API/Event + * @handbook https://github.com/samchon/framework/wiki/TypeScript-Library-EventDispatcher * @author Jeongho Nam */ class BasicEvent { @@ -248,48 +296,57 @@ declare namespace samchon.library { returnValue: boolean; } } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * Type of function pointer for listener of {@link CollectionEvent CollectionEvents}. */ type CollectionEventListener = (event: CollectionEvent) => void; } -declare namespace samchon.collection { +declare namespace samchon.collections { /** + * An event occured in a {@link ICollection collection} object. + * + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class CollectionEvent extends library.BasicEvent { /** * @hidden */ - protected first_: std.Iterator; + private first_; + /** + * @hidden + */ + private last_; /** * @hidden */ - protected last_: std.Iterator; private temporary_container_; + /** + * @hidden + */ private origin_first_; /** * Initialization Constructor. * * @param type Type of collection event. - * @param first - * @param last + * @param first An {@link Iterator} to the initial position in this {@link CollectionEvent}. + * @param last An {@link Iterator} to the final position in this {@link CollectionEvent}. */ constructor(type: string, first: std.Iterator, last: std.Iterator); constructor(type: "insert", first: std.Iterator, last: std.Iterator); constructor(type: "erase", first: std.Iterator, last: std.Iterator); constructor(type: "refresh", first: std.Iterator, last: std.Iterator); /** - * Get associative target, the container. + * Associative target, the {@link ICollection collection}. */ target: ICollection; /** - * Get range of the first. + * An {@link Iterator} to the initial position in this {@link CollectionEvent}. */ first: std.Iterator; /** - * Get range of the last. + * An {@link Iterator} to the final position in this {@link CollectionEvent}. */ last: std.Iterator; /** @@ -301,34 +358,78 @@ declare namespace samchon.collection { /** * @hidden */ -declare namespace samchon.collection.CollectionEvent { +declare namespace samchon.collections.CollectionEvent { const INSERT: "insert"; const ERASE: "erase"; const REFRESH: "refresh"; } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * A {@link Deque} who can detect element I/O events. * - *

Below are list of methods who are dispatching {@link CollectionEvent}:

+ * Below is the list of methods who are dispatching {@link CollectionEvent}: + * - *insert* typed events: + * - {@link assign} + * - {@link insert} + * - {@link push} + * - {@link push_front} + * - {@link push_back} + * - *erase* typed events: + * - {@link assign} + * - {@link clear} + * - {@link erase} + * - {@link pop_front} + * - {@link pop_back} + * - *refresh* typed events: + * - {@link refresh} * - *
    - *
  • insert typed events:
      - *
    • {@link assign}
    • - *
    • {@link insert}
    • - *
    • {@link push}
    • - *
    • {@link push_front}
    • - *
    • {@link push_back}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link assign}
    • - *
    • {@link clear}
    • - *
    • {@link erase}
    • - *
    • {@link pop_front}
    • - *
    • {@link pop_back}
    • - *
  • - *
+ * #### [Inherited] {@link Deque} + * {@link Deque} (usually pronounced like "*deck*") is an irregular acronym of **d**ouble-**e**nded **q**ueue. + * Double-ended queues are sequence containers with dynamic sizes that can be expanded or contracted on both ends + * (either its front or its back). * + * Specific libraries may implement deques in different ways, generally as some form of dynamic array. But in any + * case, they allow for the individual elements to be accessed directly through random access iterators, with + * storage handled automatically by expanding and contracting the container as needed. + * + * Therefore, they provide a functionality similar to vectors, but with efficient insertion and deletion of + * elements also at the beginning of the sequence, and not only at its end. But, unlike {@link Vector Vectors}, + * {@link Deque Deques} are not guaranteed to store all its elements in contiguous storage locations: accessing + * elements in a deque by offsetting a pointer to another element causes undefined behavior. + * + * Both {@link Vector}s and {@link Deque}s provide a very similar interface and can be used for similar purposes, + * but internally both work in quite different ways: While {@link Vector}s use a single array that needs to be + * occasionally reallocated for growth, the elements of a {@link Deque} can be scattered in different chunks of + * storage, with the container keeping the necessary information internally to provide direct access to any of its + * elements in constant time and with a uniform sequential interface (through iterators). Therefore, + * {@link Deque Deques} are a little more complex internally than {@link Vector}s, but this allows them to grow + * more efficiently under certain circumstances, especially with very long sequences, where reallocations become + * more expensive. + * + * For operations that involve frequent insertion or removals of elements at positions other than the beginning or + * the end, {@link Deque Deques} perform worse and have less consistent iterators and references than + * {@link List Lists}. + * + * + * + * + * + *

Container properties

+ *
+ *
Sequence
+ *
Elements in sequence containers are ordered in a strict linear sequence. Individual elements + * are accessed by their position in this sequence.
+ * + *
Dynamic array
+ *
Generally implemented as a dynamic array, it allows direct access to any element in the + * sequence and provides relatively fast addition/removal of elements at the beginning or the end + * of the sequence.
+ *
+ * + * @param Type of the elements. + * + * @reference http://www.cplusplus.com/reference/deque/deque/ + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class DequeCollection extends std.Deque implements ICollection { @@ -339,7 +440,7 @@ declare namespace samchon.collection { /** * @inheritdoc */ - push(...items: U[]): number; + push(...items: T[]): number; /** * @inheritdoc */ @@ -418,30 +519,72 @@ declare namespace samchon.collection { removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; } } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * A {@link HashMap} who can detect element I/O events. * - *
    - *
  • insert typed events:
      - *
    • {@link assign}
    • - *
    • {@link insert}
    • - *
    • {@link push}
    • - *
    • {@link set}
    • - *
    • {@link insert_or_assign}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link assign}
    • - *
    • {@link clear}
    • - *
    • {@link erase}
    • - *
    • {@link extract}
    • - *
  • - *
  • refresh typed events:
      - *
    • {@link set}
    • - *
    • {@link insert_or_assign}
    • - *
  • - *
+ * Below is the list of methods who are dispatching {@link MapCollectionEvent}: + * - *insert* typed events: + * - {@link assign} + * - {@link insert} + * - {@link insert_or_assign} + * - {@link emplace} + * - {@link set} + * - {@link push} + * - *erase* typed events: + * - {@link assign} + * - {@link clear} + * - {@link erase} + * - {@link extract} + * - *refresh* typed events: + * - {@link refresh} * + * #### [Inherited] {@link HashMap} + * {@link HashMap HashMaps} are associative containers that store elements formed by the combination of a + * *key value* and a *mapped value*, and which allows for fast retrieval of individual elements based on their + * *keys*. + * + * In an {@link HashMap}, the *key value* is generally used to uniquely identify the element, while the + * *mapped value* is an object with the content associated to this *key*. Types of *key* and *mapped value* may + * differ. + * + * Internally, the elements in the {@link HashMap} are not sorted in any particular order with respect to either + * their *key* or *mapped values*, but organized into *buckets* depending on their hash values to allow for fast + * access to individual elements directly by their *key values* (with a constant average time complexity on + * average). + * + * {@link HashMap} containers are faster than {@link TreeMap} containers to access individual elements by their + * *key*, although they are generally less efficient for range iteration through a subset of their elements. + * + * + * + * + * + *

Container properties

+ *
+ *
Associative
+ *
Elements in associative containers are referenced by their *key* and not by their absolute + * position in the container.
+ * + *
Hashed
+ *
Hashed containers organize their elements using hash tables that allow for fast access to elements + * by their *key*.
+ * + *
Map
+ *
Each element associates a *key* to a *mapped value*: + * *Keys* are meant to identify the elements whose main content is the *mapped value*.
+ * + *
Unique keys
+ *
No two elements in the container can have equivalent keys.
+ *
+ * + * @param Type of the key values. + * Each element in an {@link HashMap} is uniquely identified by its key value. + * @param Type of the mapped value. + * Each element in an {@link HashMap} is used to store some data as its mapped value. + * + * @reference http://www.cplusplus.com/reference/unordered_map/unordered_map + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class HashMapCollection extends std.HashMap implements ICollection> { @@ -507,23 +650,69 @@ declare namespace samchon.collection { removeEventListener(type: "refresh", listener: MapCollectionEventListener, thisArg: Object): void; } } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * A {@link HashMultiMap} who can detect element I/O events. * - *
    - *
  • insert typed events:
      - *
    • {@link assign}
    • - *
    • {@link insert}
    • - *
    • {@link push}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link assign}
    • - *
    • {@link clear}
    • - *
    • {@link erase}
    • - *
  • - *
+ * Below is the list of methods who are dispatching {@link MapCollectionEvent}: + * - *insert* typed events: + * - {@link assign} + * - {@link insert} + * - {@link emplace} + * - {@link push} + * - *erase* typed events: + * - {@link assign} + * - {@link clear} + * - {@link erase} + * - *refresh* typed events: + * - {@link refresh} * + * #### [Inherited] {@link HashMultiMap} + * {@link HashMultiMap HashMultiMap}s are associative containers that store elements formed by the combination of + * a *key value* and a *mapped value*, much like {@link HashMultiMap} containers, but allowing different elements + * to have equivalent *keys*. + * + * In an {@link HashMultiMap}, the *key value* is generally used to uniquely identify the element, while the + * *mapped value* is an object with the content associated to this *key*. Types of *key* and *mapped value* may + * differ. + * + * Internally, the elements in the {@link HashMultiMap} are not sorted in any particular order with respect to + * either their *key* or *mapped values*, but organized into *buckets* depending on their hash values to allow for + * fast access to individual elements directly by their *key values* (with a constant average time complexity on + * average). + * + * Elements with equivalent *keys* are grouped together in the same bucket and in such a way that an iterator can + * iterate through all of them. Iterators in the container are doubly linked iterators. + * + * + * + * + * + *

Container properties

+ *
+ *
Associative
+ *
Elements in associative containers are referenced by their *key* and not by their absolute + * position in the container.
+ * + *
Hashed
+ *
Hashed containers organize their elements using hash tables that allow for fast access to elements + * by their *key*.
+ * + *
Map
+ *
Each element associates a *key* to a *mapped value*: + * *Keys* are meant to identify the elements whose main content is the *mapped value*.
+ * + *
Multiple equivalent keys
+ *
The container can hold multiple elements with equivalent *keys*.
+ *
+ * + * @param Type of the key values. + * Each element in an {@link HashMultiMap} is identified by a key value. + * @param Type of the mapped value. + * Each element in an {@link HashMultiMap} is used to store some data as its mapped value. + * + * @reference http://www.cplusplus.com/reference/unordered_map/unordered_multimap + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class HashMultiMapCollection extends std.HashMap implements ICollection> { @@ -589,23 +778,64 @@ declare namespace samchon.collection { removeEventListener(type: "refresh", listener: MapCollectionEventListener, thisArg: Object): void; } } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * A {@link HashMultiSet} who can detect element I/O events. * - *
    - *
  • insert typed events:
      - *
    • {@link assign}
    • - *
    • {@link insert}
    • - *
    • {@link push}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link assign}
    • - *
    • {@link clear}
    • - *
    • {@link erase}
    • - *
  • - *
+ * Below is the list of methods who are dispatching {@link CollectionEvent}: + * - *insert* typed events: + * - {@link assign} + * - {@link insert} + * - {@link push} + * - *erase* typed events: + * - {@link assign} + * - {@link clear} + * - {@link erase} + * - *refresh* typed events: + * - {@link refresh} * + * #### [Inherited] {@link HashMultiSet} + * {@link HashMultiSet HashMultiSets} are containers that store elements in no particular order, allowing fast + * retrieval of individual elements based on their value, much like {@link HashMultiSet} containers, but allowing + * different elements to have equivalent values. + * + * In an {@link HashMultiSet}, the value of an element is at the same time its *key*, used to identify it. *Keys* + * are immutable, therefore, the elements in an {@link HashMultiSet} cannot be modified once in the container - + * they can be inserted and removed, though. + * + * Internally, the elements in the {@link HashMultiSet} are not sorted in any particular, but organized into + * *buckets* depending on their hash values to allow for fast access to individual elements directly by their + * *values* (with a constant average time complexity on average). + * + * Elements with equivalent values are grouped together in the same bucket and in such a way that an iterator can + * iterate through all of them. Iterators in the container are doubly linked iterators. + * + * + * + * + * + *

Container properties

+ *
+ *
Associative
+ *
Elements in associative containers are referenced by their *key* and not by their absolute + * position in the container.
+ * + *
Hashed
+ *
Hashed containers organize their elements using hash tables that allow for fast access to elements + * by their *key*.
+ * + *
Set
+ *
The value of an element is also the *key* used to identify it.
+ * + *
Multiple equivalent keys
+ *
The container can hold multiple elements with equivalent *keys*.
+ *
+ * + * @param Type of the elements. + * Each element in an {@link UnorderedMultiSet} is also identified by this value.. + * + * @reference http://www.cplusplus.com/reference/unordered_set/unordered_multiset + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class HashMultiSetCollection extends std.HashMultiSet implements ICollection { @@ -671,24 +901,65 @@ declare namespace samchon.collection { removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; } } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * A {@link HashSet} who can detect element I/O events. * - *
    - *
  • insert typed events:
      - *
    • {@link assign}
    • - *
    • {@link insert}
    • - *
    • {@link push}
    • - *
  • - *
  • erase typed events:
      - *
    • {@link assign}
    • - *
    • {@link clear}
    • - *
    • {@link erase}
    • - *
    • {@link extract}
    • - *
  • - *
+ * Below is the list of methods who are dispatching {@link CollectionEvent}: + * - *insert* typed events: + * - {@link assign} + * - {@link insert} + * - {@link push} + * - {@link insert_or_assign} + * - *erase* typed events: + * - {@link assign} + * - {@link clear} + * - {@link erase} + * - {@link extract} + * - *refresh* typed events: + * - {@link refresh} * + * #### [Inherited] {@link HashSet} + * {@link HashSet HashSets} are containers that store unique elements in no particular order, and which allow for + * fast retrieval of individual elements based on their value. + * + * In an {@link HashSet}, the value of an element is at the same time its *key*, that identifies it uniquely. + * Keys are immutable, therefore, the elements in an {@link HashSet} cannot be modified once in the container - + * they can be inserted and removed, though. + * + * Internally, the elements in the {@link HashSet} are not sorted in any particular order, but organized into + * buckets depending on their hash values to allow for fast access to individual elements directly by their + * *values* (with a constant average time complexity on average). + * + * {@link HashSet} containers are faster than {@link TreeSet} containers to access individual elements by their + * *key*, although they are generally less efficient for range iteration through a subset of their elements. + * + * + * + * + * + *

Container properties

+ *
+ *
Associative
+ *
Elements in associative containers are referenced by their *key* and not by their absolute + * position in the container.
+ * + *
Hashed
+ *
Hashed containers organize their elements using hash tables that allow for fast access to elements + * by their *key*.
+ * + *
Set
+ *
The value of an element is also the *key* used to identify it.
+ * + *
Unique keys
+ *
No two elements in the container can have equivalent *keys*.
+ *
+ * + * @param Type of the elements. + * Each element in an {@link HashSet} is also uniquely identified by this value. + * + * @reference http://www.cplusplus.com/reference/unordered_set/unordered_set + * @handbook [Collections](https://github.com/samchon/framework/wiki/TypeScript-STL#collections) * @author Jeongho Nam */ class HashSetCollection extends std.HashSet implements ICollection { @@ -754,75 +1025,73 @@ declare namespace samchon.collection { removeEventListener(type: "refresh", listener: CollectionEventListener, thisArg: Object): void; } } -declare namespace samchon.collection { +declare namespace samchon.collections { /** * An interface for {@link IContainer containers} who can detect element I/O events. * - *

Below are list of methods who are dispatching {@link CollectionEvent}:

- * - *

- *