From 2b02c1b894bc5215d3c16f5b6eb92c955ce939ef Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Tue, 20 Jan 2015 15:46:40 +0100 Subject: [PATCH 01/54] Add definition for "acc-wizard". --- acc-wizard/acc-wizard-tests.ts | 36 ++++++++++ acc-wizard/acc-wizard.d.ts | 101 +++++++++++++++++++++++++++++ acc-wizard/acc-wizard.ts.tscparams | 1 + 3 files changed, 138 insertions(+) create mode 100644 acc-wizard/acc-wizard-tests.ts create mode 100644 acc-wizard/acc-wizard.d.ts create mode 100644 acc-wizard/acc-wizard.ts.tscparams diff --git a/acc-wizard/acc-wizard-tests.ts b/acc-wizard/acc-wizard-tests.ts new file mode 100644 index 000000000..1ccef7c7d --- /dev/null +++ b/acc-wizard/acc-wizard-tests.ts @@ -0,0 +1,36 @@ +/// +/// + +/** + * @summary Test for "accwizard" without options. + */ +function testBasic() { + $('#test').accwizard(); +} + +/** + * @summary Test for "accwizard" with options. + */ +function testBasic() { + var options: AccWizardOptions = { + addButtons: true, + sidebar: '.acc-wizard-sidebar', + activeClass: 'acc-wizard-active', + completedClass: 'acc-wizard-completed', + todoClass: 'acc-wizard-todo', + stepClass: 'acc-wizard-step', + nextText: 'Next Step', + backText: 'Go Back', + nextType: 'submit', + backType: 'reset', + nextClasses: 'btn btn-primary', + backClasses: 'btn', + autoScrolling: true, + onNext: function() {}, + onBack: function() {}, + onInit: function() {}, + onDestroy: function() {} + }; + + $('#test').accwizard(options); +} \ No newline at end of file diff --git a/acc-wizard/acc-wizard.d.ts b/acc-wizard/acc-wizard.d.ts new file mode 100644 index 000000000..899f04b6d --- /dev/null +++ b/acc-wizard/acc-wizard.d.ts @@ -0,0 +1,101 @@ +// Type definitions for acc-wizard +// Project: https://github.com/sathomas/acc-wizard +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface AccWizardOptions { + /** + * @summary Add next/prev buttons to panels. + * @type {boolean} + */ + addButtons: boolean; + + /** + * @summary Selector for task sidebar. + * @type {string} + */ + sidebar: string; + + /** + * @summary Class to indicate the active task in sidebar. + * @type {string} + */ + activeClass: string; + + /** + * @summary Class to indicate task is complete. + * @type {string} + */ + completedClass: string; + + /** + * @summary Class to indicate task is still pending. + * @type {string} + */ + todoClass: string; + + /** + * @summary Class for step buttons within panels. + * @type {string} + */ + stepClass: string; + + /** + * @summary Text for next button. + * @type {string} + */ + nextText: string; + + /** + * @summary Text for back button + * @type {string} + */ + backType: string; + + /** + * @summary Class(es) for next button. + * @type {string} + */ + nextClasses: string; + + /** + * @summary Class(es) for back button. + * @type {string} + */ + backClasses: string; + + /** + * @summary Auto-scrolling. + * @type {boolean} + */ + autoScrolling: boolean; + + /** + * @summary Function to call on next step. + */ + onNext: Function; + + /** + * @summary Function to call on back up. + */ + onBack: Function; + + /** + * @summary A chance to hook initialization. + */ + onInit: Function; + + /** + * @summary A chance to hook destruction. + */ + onDestroy: Function; +} + +/** + * @summary Interface for "acc-wizard" JQuery plugin. + * @author Cyril Schumacher + * @version 1.0 + */ +interface JQueryStatic { + accwizard(options: AccWizardOptions): void; +} \ No newline at end of file diff --git a/acc-wizard/acc-wizard.ts.tscparams b/acc-wizard/acc-wizard.ts.tscparams new file mode 100644 index 000000000..934bc29ef --- /dev/null +++ b/acc-wizard/acc-wizard.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny \ No newline at end of file From e5dc44b41297a4e836ea0a30e1b6260b73c0b22f Mon Sep 17 00:00:00 2001 From: Vladimir Kotikov Date: Thu, 22 Jan 2015 17:44:57 +0300 Subject: [PATCH 02/54] Aligns definitions for cordova and core plugins with latest Cordova updates. --- cordova/cordova-tests.ts | 14 ++++++++++++++ cordova/plugins/Device.d.ts | 2 -- cordova/plugins/FileTransfer.d.ts | 8 ++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/cordova/cordova-tests.ts b/cordova/cordova-tests.ts index dfaa25cc3..e635535ac 100644 --- a/cordova/cordova-tests.ts +++ b/cordova/cordova-tests.ts @@ -177,6 +177,20 @@ file.download('http://some.server.com/download.php', { headers: null }, true); +file.upload('cdvfile://localhost/persistent/path/to/downloads/', + 'http://some.server.com/download.php', + (result: FileUploadResult)=> { console.log('File uploaded. Bytes uploaded: ' + result.bytesSent); }, + (err: FileTransferError) => { + console.error('Error ' + err.code); + if (err.exception) { + console.error('Failed with exception ' + err.exception); + } + }, + { headers: null, httpMethod: "PUT" }, + true); + +file.abort(); + file.abort(); diff --git a/cordova/plugins/Device.d.ts b/cordova/plugins/Device.d.ts index 8365ee70f..283406cb9 100644 --- a/cordova/plugins/Device.d.ts +++ b/cordova/plugins/Device.d.ts @@ -18,8 +18,6 @@ interface Device { * by the device manufacturer and may be different across versions of the same product. */ model: string; - /** device.name is deprecated as of version 2.3.0. Use device.model instead. */ - name: string; /** Get the device's operating system name. */ platform: string; /** Get the device's Universally Unique Identifier (UUID). */ diff --git a/cordova/plugins/FileTransfer.d.ts b/cordova/plugins/FileTransfer.d.ts index 457c9daf2..d0c023ae8 100644 --- a/cordova/plugins/FileTransfer.d.ts +++ b/cordova/plugins/FileTransfer.d.ts @@ -84,6 +84,8 @@ interface FileUploadOptions { fileKey?: string; /** The file name to use when saving the file on the server. Defaults to image.jpg. */ fileName?: string; + /** The HTTP method to use - either `PUT` or `POST`. Defaults to `POST`. */ + httpMethod?: string; /** The mime type of the data to upload. Defaults to image/jpeg. */ mimeType?: string; /** A set of optional key/value pairs to pass in the HTTP request. */ @@ -108,6 +110,7 @@ interface FileTransferError { * FileTransferError.INVALID_URL_ERR * FileTransferError.CONNECTION_ERR * FileTransferError.ABORT_ERR + * FileTransferError.NOT_MODIFIED_ERR */ code: number; /** URL to the source. */ @@ -116,8 +119,8 @@ interface FileTransferError { target: string; /** HTTP status code. This attribute is only available when a response code is received from the HTTP connection. */ http_status: number; - /* Request body */ - body: any; + /* Response body. This attribute is only available when a response is received from the HTTP connection. */ + body: string; /* Exception that is thrown by native code */ exception: any; } @@ -129,4 +132,5 @@ declare var FileTransferError: { INVALID_URL_ERR: number; CONNECTION_ERR: number; ABORT_ERR: number; + NOT_MODIFIED_ERR: number; } \ No newline at end of file From f3e207efe41c0816d04809c81872e98a1ba416b9 Mon Sep 17 00:00:00 2001 From: NN Date: Tue, 27 Jan 2015 12:46:38 +0200 Subject: [PATCH 03/54] Move common details to interface --- chrome/chrome.d.ts | 100 +++++++++++---------------------------------- 1 file changed, 24 insertions(+), 76 deletions(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index a5321d853..cf3407f7f 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -2269,49 +2269,42 @@ declare module chrome.webRequest { file?: string; } - interface OnCompletedDetails { - tabId: number; - ip?: string; - statusLine?: string; - frameId: number; - responseHeaders?: HttpHeader[]; - parentFrameId: number; - fromCache: boolean; - url: string; - timeStamp: number; + interface BaseCallbackDetails { requestId: string; + url: string; + tabId: number; + frameId: number; + parentFrameId: number; + timeStamp: number; + } + + interface CallbackDetails extends BaseCallbackDetails { type: string; method: string; + } + + interface OnCompletedDetails extends CallbackDetails { + ip?: string; + statusLine?: string; + responseHeaders?: HttpHeader[]; + fromCache: boolean; statusCode: number; } - interface OnHeadersReceivedDetails { - tabId: number; + interface OnHeadersReceivedDetails extends CallbackDetails { parentFrameId: number; - url: string; timeStamp: number; statusLine?: string; - frameId: number; - requestId: string; responseHeaders?: HttpHeader[]; - type: string; - method: string; } - interface OnBeforeRedirectDetails { - tabId: number; + interface OnBeforeRedirectDetails extends CallbackDetails { ip?: string; statusLine?: string; - frameId: number; responseHeaders?: HttpHeader[]; parentFrameId: number; fromCache: boolean; - url: string; - timeStamp: number; - requestId: string; redirectUrl: string; - type: string; - method: string; statusCode: number; } @@ -2320,75 +2313,35 @@ declare module chrome.webRequest { port: number; } - interface OnAuthRequiredDetails { - tabId: number; + interface OnAuthRequiredDetails extends CallbackDetails { statusLine?: string; - frameId: number; challenger: Challenger; responseHeaders?: HttpHeader[]; isProxy: boolean; realm?: string; - parentFrameId: number; - url: string; - timeStamp: number; - requestId: string; scheme: string; - type: string; - method: string; } - interface OnBeforeSendHeadersDetails { - tabId: number; - parentFrameId: number; - url: string; - timeStamp: number; - frameId: number; - requestId: number; + interface OnBeforeSendHeadersDetails extends CallbackDetails { requestHeaders?: HttpHeader[]; - type: string; - method: string; } - interface OnErrorOccurredDetails { - tabId: number; + interface OnErrorOccurredDetails extends CallbackDetails { ip?: string; - frameId: number; - parentFrameId: number; fromCache: boolean; - url: string; - timeStamp: number; - requestId: string; error: string; - type: string; - method: string; } - interface OnResponseStartedDetails { - tabId: number; + interface OnResponseStartedDetails extends CallbackDetails { ip?: string; statusLine?: string; - frameId: number; responseHeaders?: HttpHeader[]; - parentFrameId: number; fromCache: boolean; - url: string; - timeStamp: number; - requestId: string; - type: string; - method: string; statusCode: number; } - interface OnSendHeadersDetails { - tabId: number; - parentFrameId: number; - url: string; - timeStamp: number; - frameId: number; - requestId: string; + interface OnSendHeadersDetails extends CallbackDetails { requestHeaders?: HttpHeader[]; - type: string; - method: string; } interface RequestBody { @@ -2397,12 +2350,7 @@ declare module chrome.webRequest { formData?: Object; } - interface OnBeforeRequestDetails { - tabId: number; - parentFrameId: number; - url: string; - timeStamp: number; - frameId: number; + interface OnBeforeRequestDetails extends BaseCallbackDetails { requestBody: RequestBody; } From fd4fb7b4a30108903c0b45845973a1cc84ef9141 Mon Sep 17 00:00:00 2001 From: NN Date: Tue, 27 Jan 2015 15:02:23 +0200 Subject: [PATCH 04/54] Update chrome.d.ts --- chrome/chrome.d.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index cf3407f7f..8ab76f8ec 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -2269,7 +2269,7 @@ declare module chrome.webRequest { file?: string; } - interface BaseCallbackDetails { + interface BasicCallbackDetails { requestId: string; url: string; tabId: number; @@ -2278,12 +2278,12 @@ declare module chrome.webRequest { timeStamp: number; } - interface CallbackDetails extends BaseCallbackDetails { + interface ExtendedCallbackDetails extends BasicCallbackDetails { type: string; method: string; } - interface OnCompletedDetails extends CallbackDetails { + interface OnCompletedDetails extends ExtendedCallbackDetails { ip?: string; statusLine?: string; responseHeaders?: HttpHeader[]; @@ -2291,14 +2291,14 @@ declare module chrome.webRequest { statusCode: number; } - interface OnHeadersReceivedDetails extends CallbackDetails { + interface OnHeadersReceivedDetails extends ExtendedCallbackDetails { parentFrameId: number; timeStamp: number; statusLine?: string; responseHeaders?: HttpHeader[]; } - interface OnBeforeRedirectDetails extends CallbackDetails { + interface OnBeforeRedirectDetails extends ExtendedCallbackDetails { ip?: string; statusLine?: string; responseHeaders?: HttpHeader[]; @@ -2313,7 +2313,7 @@ declare module chrome.webRequest { port: number; } - interface OnAuthRequiredDetails extends CallbackDetails { + interface OnAuthRequiredDetails extends ExtendedCallbackDetails { statusLine?: string; challenger: Challenger; responseHeaders?: HttpHeader[]; @@ -2322,17 +2322,17 @@ declare module chrome.webRequest { scheme: string; } - interface OnBeforeSendHeadersDetails extends CallbackDetails { + interface OnBeforeSendHeadersDetails extends ExtendedCallbackDetails { requestHeaders?: HttpHeader[]; } - interface OnErrorOccurredDetails extends CallbackDetails { + interface OnErrorOccurredDetails extends ExtendedCallbackDetails { ip?: string; fromCache: boolean; error: string; } - interface OnResponseStartedDetails extends CallbackDetails { + interface OnResponseStartedDetails extends ExtendedCallbackDetails { ip?: string; statusLine?: string; responseHeaders?: HttpHeader[]; @@ -2340,7 +2340,7 @@ declare module chrome.webRequest { statusCode: number; } - interface OnSendHeadersDetails extends CallbackDetails { + interface OnSendHeadersDetails extends ExtendedCallbackDetails { requestHeaders?: HttpHeader[]; } @@ -2350,7 +2350,7 @@ declare module chrome.webRequest { formData?: Object; } - interface OnBeforeRequestDetails extends BaseCallbackDetails { + interface OnBeforeRequestDetails extends BasicCallbackDetails { requestBody: RequestBody; } From 7713b86c7cdd6f36f3425cce637fb4fad1178f06 Mon Sep 17 00:00:00 2001 From: NN Date: Wed, 28 Jan 2015 12:08:35 +0200 Subject: [PATCH 05/54] Merge interfaces. --- chrome/chrome.d.ts | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 8ab76f8ec..2ba31b1af 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -2269,21 +2269,18 @@ declare module chrome.webRequest { file?: string; } - interface BasicCallbackDetails { + interface CallbackDetails { requestId: string; - url: string; + url: string; + method: string; tabId: number; frameId: number; parentFrameId: number; timeStamp: number; - } - - interface ExtendedCallbackDetails extends BasicCallbackDetails { type: string; - method: string; } - interface OnCompletedDetails extends ExtendedCallbackDetails { + interface OnCompletedDetails extends CallbackDetails { ip?: string; statusLine?: string; responseHeaders?: HttpHeader[]; @@ -2291,14 +2288,14 @@ declare module chrome.webRequest { statusCode: number; } - interface OnHeadersReceivedDetails extends ExtendedCallbackDetails { + interface OnHeadersReceivedDetails extends CallbackDetails { parentFrameId: number; timeStamp: number; statusLine?: string; responseHeaders?: HttpHeader[]; } - interface OnBeforeRedirectDetails extends ExtendedCallbackDetails { + interface OnBeforeRedirectDetails extends CallbackDetails { ip?: string; statusLine?: string; responseHeaders?: HttpHeader[]; @@ -2313,7 +2310,7 @@ declare module chrome.webRequest { port: number; } - interface OnAuthRequiredDetails extends ExtendedCallbackDetails { + interface OnAuthRequiredDetails extends CallbackDetails { statusLine?: string; challenger: Challenger; responseHeaders?: HttpHeader[]; @@ -2322,17 +2319,17 @@ declare module chrome.webRequest { scheme: string; } - interface OnBeforeSendHeadersDetails extends ExtendedCallbackDetails { + interface OnBeforeSendHeadersDetails extends CallbackDetails { requestHeaders?: HttpHeader[]; } - interface OnErrorOccurredDetails extends ExtendedCallbackDetails { + interface OnErrorOccurredDetails extends CallbackDetails { ip?: string; fromCache: boolean; error: string; } - interface OnResponseStartedDetails extends ExtendedCallbackDetails { + interface OnResponseStartedDetails extends CallbackDetails { ip?: string; statusLine?: string; responseHeaders?: HttpHeader[]; @@ -2340,7 +2337,7 @@ declare module chrome.webRequest { statusCode: number; } - interface OnSendHeadersDetails extends ExtendedCallbackDetails { + interface OnSendHeadersDetails extends CallbackDetails { requestHeaders?: HttpHeader[]; } @@ -2350,7 +2347,7 @@ declare module chrome.webRequest { formData?: Object; } - interface OnBeforeRequestDetails extends BasicCallbackDetails { + interface OnBeforeRequestDetails extends CallbackDetails { requestBody: RequestBody; } From 1174e808b332b2785d1039a8358abceda0f36c0a Mon Sep 17 00:00:00 2001 From: NN Date: Wed, 28 Jan 2015 12:37:36 +0200 Subject: [PATCH 06/54] Fix WebRequestAuthRequredEvent functions --- chrome/chrome.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index a5321d853..1339dc4a4 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -2422,8 +2422,8 @@ declare module chrome.webRequest { } interface WebRequestAuthRequiredEvent extends chrome.events.Event { - addListener(callback: (details: OnAuthRequiredDetails, callback?: (response: BlockingResponse) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]) => void): void; - removeListener(callback: (details: OnAuthRequiredDetails, callback?: (response: BlockingResponse) => void) => void): void; + addListener(callback: (details: OnAuthRequiredDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void; + removeListener(callback: (details: OnAuthRequiredDetails) => BlockingResponse) : void; } interface WebRequestBeforeSendHeadersEvent extends chrome.events.Event { From b9318019f8398af36725ae07876623acdc8d1a90 Mon Sep 17 00:00:00 2001 From: apathytomorrow Date: Wed, 28 Jan 2015 15:26:47 +0000 Subject: [PATCH 07/54] Addd isDuration tests --- moment/moment-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/moment/moment-tests.ts b/moment/moment-tests.ts index d58a27fe3..dc11eeac8 100644 --- a/moment/moment-tests.ts +++ b/moment/moment-tests.ts @@ -195,6 +195,10 @@ moment.isMoment(); moment.isMoment(new Date()); moment.isMoment(moment()); +moment.isDuration(); +moment.isDuration(new Date()); +moment.isDuration(moment.duration()); + moment.localeData('fr'); moment(1316116057189).fromNow(); From 3fdfa45029acf79d78764e136b5abac8a80b5ee8 Mon Sep 17 00:00:00 2001 From: apathytomorrow Date: Wed, 28 Jan 2015 15:27:34 +0000 Subject: [PATCH 08/54] Added IsDuration tests --- moment/moment-external-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/moment/moment-external-tests.ts b/moment/moment-external-tests.ts index ced06cdbf..1b1d083ba 100644 --- a/moment/moment-external-tests.ts +++ b/moment/moment-external-tests.ts @@ -195,6 +195,10 @@ moment.isMoment(); moment.isMoment(new Date()); moment.isMoment(moment()); +moment.isDuration(); +moment.isDuration(new Date()); +moment.isDuration(moment.duration()); + moment.localeData('fr'); moment(1316116057189).fromNow(); From 0019e204e8c8aa5e8bd91a867baa25ab7c7ff7c5 Mon Sep 17 00:00:00 2001 From: apathytomorrow Date: Wed, 28 Jan 2015 15:28:45 +0000 Subject: [PATCH 09/54] Update moment.d.ts --- moment/moment.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/moment/moment.d.ts b/moment/moment.d.ts index 4d315946b..6bd041c5c 100644 --- a/moment/moment.d.ts +++ b/moment/moment.d.ts @@ -399,6 +399,8 @@ declare module moment { invalid(parsingFlags?: Object): Moment; isMoment(): boolean; isMoment(m: any): boolean; + isDuration(): boolean; + isDuration(d: any): boolean; // Deprecated in 2.8.0. lang(language?: string): string; From c73a7587ca7508356157af61a76bae906ac1bbcf Mon Sep 17 00:00:00 2001 From: NN Date: Wed, 28 Jan 2015 17:47:04 +0200 Subject: [PATCH 10/54] Restore original --- chrome/chrome.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 2ba31b1af..334390ebf 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -10,7 +10,7 @@ //////////////////// declare module chrome.alarms { interface AlarmCreateInfo { - delayInMinutes?: number; + delayInMinutes?: number;ad periodInMinutes?: number; when?: number; } From d8e4ecb9a96c682136b85c8e51f8d0659807a910 Mon Sep 17 00:00:00 2001 From: NN Date: Wed, 28 Jan 2015 17:54:23 +0200 Subject: [PATCH 11/54] Correct callback in WebRequestAuthRequiredEvent.addListener --- chrome/chrome.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 1339dc4a4..f8f1e08db 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -2422,8 +2422,8 @@ declare module chrome.webRequest { } interface WebRequestAuthRequiredEvent extends chrome.events.Event { - addListener(callback: (details: OnAuthRequiredDetails) => BlockingResponse, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void; - removeListener(callback: (details: OnAuthRequiredDetails) => BlockingResponse) : void; + addListener(callback: (details: OnAuthRequiredDetails, callback?: (response: BlockingResponse) => void) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void; + removeListener(callback: (details: OnAuthRequiredDetails, callback?: (response: BlockingResponse) => void) => void): void; } interface WebRequestBeforeSendHeadersEvent extends chrome.events.Event { From 9ef4455b75beebf743f3c8793293b6df801e50b9 Mon Sep 17 00:00:00 2001 From: NN Date: Wed, 28 Jan 2015 17:55:11 +0200 Subject: [PATCH 12/54] Remove spacing --- chrome/chrome.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index f8f1e08db..0b7dad528 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -2422,7 +2422,7 @@ declare module chrome.webRequest { } interface WebRequestAuthRequiredEvent extends chrome.events.Event { - addListener(callback: (details: OnAuthRequiredDetails, callback?: (response: BlockingResponse) => void) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void; + addListener(callback: (details: OnAuthRequiredDetails, callback?: (response: BlockingResponse) => void) => void, filter?: RequestFilter, opt_extraInfoSpec?: string[]): void; removeListener(callback: (details: OnAuthRequiredDetails, callback?: (response: BlockingResponse) => void) => void): void; } From 46b738810159b66c462a7c63bef1ab8b0aef3266 Mon Sep 17 00:00:00 2001 From: NN Date: Wed, 28 Jan 2015 17:56:49 +0200 Subject: [PATCH 13/54] Remove bad letters --- chrome/chrome.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 334390ebf..2ba31b1af 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -10,7 +10,7 @@ //////////////////// declare module chrome.alarms { interface AlarmCreateInfo { - delayInMinutes?: number;ad + delayInMinutes?: number; periodInMinutes?: number; when?: number; } From 1bcd371e6076a30724b45f653c840205e772cee1 Mon Sep 17 00:00:00 2001 From: davetayls Date: Thu, 29 Jan 2015 09:28:44 +0000 Subject: [PATCH 14/54] added getOption to view --- marionette/marionette-tests.ts | 1 + marionette/marionette.d.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/marionette/marionette-tests.ts b/marionette/marionette-tests.ts index c75837810..a37eccc9f 100644 --- a/marionette/marionette-tests.ts +++ b/marionette/marionette-tests.ts @@ -96,6 +96,7 @@ module Marionette.Tests { constructor() { super(); + this.getOption('foo'); this.triggers = { 'click .foo': 'bar' }; diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index 40c0f6775..363d4142a 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -721,6 +721,12 @@ declare module Marionette { getTemplate(): any; + /** + * Retrieve an object's attribute either directly from the object, or + * from the object's this.options, with this.options taking precedence. + */ + getOption(optionName:string): T; + mixinTemplateHelpers(target?: any): any; configureTriggers(): any; From bf0636260421e5f8891b79ab592f5d62c45927ea Mon Sep 17 00:00:00 2001 From: NN Date: Thu, 29 Jan 2015 12:30:02 +0200 Subject: [PATCH 15/54] Changes according to review. --- chrome/chrome.d.ts | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index 2ba31b1af..0095784dc 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -2269,7 +2269,7 @@ declare module chrome.webRequest { file?: string; } - interface CallbackDetails { + interface WebRequestCallbackDetails { requestId: string; url: string; method: string; @@ -2280,7 +2280,7 @@ declare module chrome.webRequest { type: string; } - interface OnCompletedDetails extends CallbackDetails { + interface OnCompletedDetails extends WebRequestCallbackDetails { ip?: string; statusLine?: string; responseHeaders?: HttpHeader[]; @@ -2288,18 +2288,15 @@ declare module chrome.webRequest { statusCode: number; } - interface OnHeadersReceivedDetails extends CallbackDetails { - parentFrameId: number; - timeStamp: number; + interface OnHeadersReceivedDetails extends WebRequestCallbackDetails { statusLine?: string; responseHeaders?: HttpHeader[]; } - interface OnBeforeRedirectDetails extends CallbackDetails { + interface OnBeforeRedirectDetails extends WebRequestCallbackDetails { ip?: string; statusLine?: string; responseHeaders?: HttpHeader[]; - parentFrameId: number; fromCache: boolean; redirectUrl: string; statusCode: number; @@ -2310,7 +2307,7 @@ declare module chrome.webRequest { port: number; } - interface OnAuthRequiredDetails extends CallbackDetails { + interface OnAuthRequiredDetails extends WebRequestCallbackDetails { statusLine?: string; challenger: Challenger; responseHeaders?: HttpHeader[]; @@ -2319,17 +2316,17 @@ declare module chrome.webRequest { scheme: string; } - interface OnBeforeSendHeadersDetails extends CallbackDetails { + interface OnBeforeSendHeadersDetails extends WebRequestCallbackDetails { requestHeaders?: HttpHeader[]; } - interface OnErrorOccurredDetails extends CallbackDetails { + interface OnErrorOccurredDetails extends WebRequestCallbackDetails { ip?: string; fromCache: boolean; error: string; } - interface OnResponseStartedDetails extends CallbackDetails { + interface OnResponseStartedDetails extends WebRequestCallbackDetails { ip?: string; statusLine?: string; responseHeaders?: HttpHeader[]; @@ -2337,7 +2334,7 @@ declare module chrome.webRequest { statusCode: number; } - interface OnSendHeadersDetails extends CallbackDetails { + interface OnSendHeadersDetails extends WebRequestCallbackDetails { requestHeaders?: HttpHeader[]; } @@ -2347,8 +2344,8 @@ declare module chrome.webRequest { formData?: Object; } - interface OnBeforeRequestDetails extends CallbackDetails { - requestBody: RequestBody; + interface OnBeforeRequestDetails extends WebRequestCallbackDetails { + requestBody?: RequestBody; } interface WebRequestCompletedEvent extends chrome.events.Event { From 3dedff38f82faf28502cc52c90f671b625759566 Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Tue, 20 Jan 2015 15:46:40 +0100 Subject: [PATCH 16/54] Add definition for "acc-wizard". --- acc-wizard/acc-wizard-tests.ts | 36 ++++++++++ acc-wizard/acc-wizard.d.ts | 101 +++++++++++++++++++++++++++++ acc-wizard/acc-wizard.ts.tscparams | 1 + 3 files changed, 138 insertions(+) create mode 100644 acc-wizard/acc-wizard-tests.ts create mode 100644 acc-wizard/acc-wizard.d.ts create mode 100644 acc-wizard/acc-wizard.ts.tscparams diff --git a/acc-wizard/acc-wizard-tests.ts b/acc-wizard/acc-wizard-tests.ts new file mode 100644 index 000000000..1ccef7c7d --- /dev/null +++ b/acc-wizard/acc-wizard-tests.ts @@ -0,0 +1,36 @@ +/// +/// + +/** + * @summary Test for "accwizard" without options. + */ +function testBasic() { + $('#test').accwizard(); +} + +/** + * @summary Test for "accwizard" with options. + */ +function testBasic() { + var options: AccWizardOptions = { + addButtons: true, + sidebar: '.acc-wizard-sidebar', + activeClass: 'acc-wizard-active', + completedClass: 'acc-wizard-completed', + todoClass: 'acc-wizard-todo', + stepClass: 'acc-wizard-step', + nextText: 'Next Step', + backText: 'Go Back', + nextType: 'submit', + backType: 'reset', + nextClasses: 'btn btn-primary', + backClasses: 'btn', + autoScrolling: true, + onNext: function() {}, + onBack: function() {}, + onInit: function() {}, + onDestroy: function() {} + }; + + $('#test').accwizard(options); +} \ No newline at end of file diff --git a/acc-wizard/acc-wizard.d.ts b/acc-wizard/acc-wizard.d.ts new file mode 100644 index 000000000..899f04b6d --- /dev/null +++ b/acc-wizard/acc-wizard.d.ts @@ -0,0 +1,101 @@ +// Type definitions for acc-wizard +// Project: https://github.com/sathomas/acc-wizard +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface AccWizardOptions { + /** + * @summary Add next/prev buttons to panels. + * @type {boolean} + */ + addButtons: boolean; + + /** + * @summary Selector for task sidebar. + * @type {string} + */ + sidebar: string; + + /** + * @summary Class to indicate the active task in sidebar. + * @type {string} + */ + activeClass: string; + + /** + * @summary Class to indicate task is complete. + * @type {string} + */ + completedClass: string; + + /** + * @summary Class to indicate task is still pending. + * @type {string} + */ + todoClass: string; + + /** + * @summary Class for step buttons within panels. + * @type {string} + */ + stepClass: string; + + /** + * @summary Text for next button. + * @type {string} + */ + nextText: string; + + /** + * @summary Text for back button + * @type {string} + */ + backType: string; + + /** + * @summary Class(es) for next button. + * @type {string} + */ + nextClasses: string; + + /** + * @summary Class(es) for back button. + * @type {string} + */ + backClasses: string; + + /** + * @summary Auto-scrolling. + * @type {boolean} + */ + autoScrolling: boolean; + + /** + * @summary Function to call on next step. + */ + onNext: Function; + + /** + * @summary Function to call on back up. + */ + onBack: Function; + + /** + * @summary A chance to hook initialization. + */ + onInit: Function; + + /** + * @summary A chance to hook destruction. + */ + onDestroy: Function; +} + +/** + * @summary Interface for "acc-wizard" JQuery plugin. + * @author Cyril Schumacher + * @version 1.0 + */ +interface JQueryStatic { + accwizard(options: AccWizardOptions): void; +} \ No newline at end of file diff --git a/acc-wizard/acc-wizard.ts.tscparams b/acc-wizard/acc-wizard.ts.tscparams new file mode 100644 index 000000000..934bc29ef --- /dev/null +++ b/acc-wizard/acc-wizard.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny \ No newline at end of file From 32404b178f2e7de1889c9fc782326fc765853d5c Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Thu, 29 Jan 2015 17:16:42 +0100 Subject: [PATCH 17/54] Add definition for "IBAN.js". --- iban/iban.d.ts | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 iban/iban.d.ts diff --git a/iban/iban.d.ts b/iban/iban.d.ts new file mode 100644 index 000000000..55efdaa2a --- /dev/null +++ b/iban/iban.d.ts @@ -0,0 +1,58 @@ +// Type definitions for iban.js 0.0.5 +// Project: https://github.com/arhs/iban.js/ +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module ARHS { + /** + * @summary Interface for {@link IBAN} object. + * @author Cyril Schumacher + * @version 1.0 + */ + interface IBANStatic { + /** + * @summary Returns the IBAN in a electronic format. + * @param {string} iban The IBAN to convert. + * @param {string} The IBAN in electronic format. + */ + electronicFormat(iban: string): string; + + /** + * @summary Convert the passed BBAN to an IBAN for this country specification. + * @param {string} bban The BBAN to convert to IBAN + * @returns {string} The IBAN + */ + fromBBAN(bban: string): string; + + /** + * @summary Check if the passed iban is valid according to this specification. + * @param {string} iban The iban to validate. + * @returns {boolean} True if valid, false otherwise. + */ + isValid(iban: string): boolean; + + /** + * @summary Check of the passed BBAN is valid. + * @param {string} bban The BBAN to validate + * @returns {boolean} True if valid, false otherwise. + */ + isValidBBAN(bban: string): boolean; + + /** + * @summary Returns the IBAN in a print format. + * @param {string} iban The IBAN to convert. + * @param {string} The IBAN in print format. + */ + printFormat(iban: string, separator: string[]): string; + + /** + * @summary Convert the passed IBAN to a country-specific BBAN. + * @param {string} iban The IBAN to convert. + * @param {string[]} Separator the separator to use between BBAN blocks. + * @returns {string} The BBAN + */ + toBBAN(iban: string, separator: string[]): string; + } +} + +declare var IBAN: ARHS.IBANStatic; \ No newline at end of file From a9678270a56065449020a0eb02f7ef6494ccdb34 Mon Sep 17 00:00:00 2001 From: Han Lin Yap Date: Thu, 29 Jan 2015 18:25:55 +0100 Subject: [PATCH 18/54] Allow to use as module --- hammerjs/hammerjs.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hammerjs/hammerjs.d.ts b/hammerjs/hammerjs.d.ts index a3a7aed42..871cee299 100644 --- a/hammerjs/hammerjs.d.ts +++ b/hammerjs/hammerjs.d.ts @@ -1,10 +1,14 @@ // Type definitions for Hammer.js 2.0.4 // Project: http://hammerjs.github.io/ -// Definitions by: Philip Bulley +// Definitions by: Philip Bulley , Han Lin Yap // Definitions: https://github.com/borisyankov/DefinitelyTyped declare var Hammer:HammerStatic; +declare module "Hammer" { + export = Hammer; +} + interface HammerStatic { new( element:HTMLElement, options?:any ): HammerManager; From f6da4b13b86327e1d9e9ab781dd091cf5a868879 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Fri, 30 Jan 2015 06:02:33 +0100 Subject: [PATCH 19/54] Discern new vs old style components through render By overloading createElement() for the ClassicComponentClass and creating a separate ReactClassicElement type, we can keep track of which calls to render() should create a ClassicComponent versus a new style Component. Useful for keeping the old API, which makes migration easier. --- react/react-0.13.0.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/react/react-0.13.0.d.ts b/react/react-0.13.0.d.ts index b5a1d1495..9ee102541 100644 --- a/react/react-0.13.0.d.ts +++ b/react/react-0.13.0.d.ts @@ -17,6 +17,9 @@ declare module React { ref: string; } + interface ReactClassicElement

extends ReactElement

{ + } + interface ReactHTMLElement extends ReactElement {} interface ReactSVGElement extends ReactElement {} @@ -112,8 +115,10 @@ declare module React { interface TopLevelAPI { createClass(spec: ComponentSpec): ClassicComponentClass; + createElement

(type: ClassicComponentClass, props: P, ...children: ReactNode[]): ReactClassicElement

; createElement

(type: ComponentClass | string, props: P, ...children: ReactNode[]): ReactElement

; createFactory

(type: ComponentClass | string): ComponentFactory

; + render(element: ReactClassicElement

, container: Element, callback?: () => any): ClassicComponent; render(element: ReactElement

, container: Element, callback?: () => any): Component; unmountComponentAtNode(container: Element): boolean; renderToString(element: ReactElement): string; From 77b4c9cb9aed8de7b17434a7bd5f05676c93096c Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Fri, 30 Jan 2015 08:50:31 +0100 Subject: [PATCH 20/54] Add tests. Update definition. --- iban/iban-tests.ts | 53 ++++++++++++++++++++++++++++++++++++++++++ iban/iban.d.ts | 12 ++++++---- iban/iban.ts.tscparams | 1 + 3 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 iban/iban-tests.ts create mode 100644 iban/iban.ts.tscparams diff --git a/iban/iban-tests.ts b/iban/iban-tests.ts new file mode 100644 index 000000000..f33faeebd --- /dev/null +++ b/iban/iban-tests.ts @@ -0,0 +1,53 @@ +/// + +/** + * @summary Test for "electronicFormat" method. + */ +function testElectronicFormat() { + var iban: string = 'BE68539007547034'; + var format: string = IBAN.electronicFormat(iban); +} + +/** + * @summary Test for "fromBBAN" method. + */ +function testFromBBAN() { + var countryCode: string = 'fr'; + var bban: string = 'BBBBBGGGGGCCCCCCCCCCCKK'; + var iban: string = IBAN.fromBBAN(countryCode, bban); +} + +/** + * @summary Test for "isValid" method. + */ +function testIsValid() { + var iban: string = 'BE68539007547034'; + var valid: boolean = IBAN.isValid(iban); +} + +/** + * @summary Test for "isValidBBAN" method. + */ +function testIsValidBBAN() { + var countryCode: string = 'fr'; + var bban: string = 'BBBBBGGGGGCCCCCCCCCCCKK'; + var valid: boolean = IBAN.isValidBBAN(countryCode, bban); +} + +/** + * @summary Test for "printFormat" method. + */ +function testPrintFormat() { + var iban: string = 'BE68539007547034'; + var separator: string[] = ['fr']; + var format: string = IBAN.printFormat(iban, separator); +} + +/** + * @summary Test for "toBBAN" method. + */ +function testToBBAN() { + var iban: string = 'BE68539007547034'; + var separator: string[] = ['-']; + var bban: string = IBAN.toBBAN(iban, separator); +} \ No newline at end of file diff --git a/iban/iban.d.ts b/iban/iban.d.ts index 55efdaa2a..b39f5908c 100644 --- a/iban/iban.d.ts +++ b/iban/iban.d.ts @@ -19,10 +19,11 @@ declare module ARHS { /** * @summary Convert the passed BBAN to an IBAN for this country specification. - * @param {string} bban The BBAN to convert to IBAN - * @returns {string} The IBAN + * @param {string} countryCode The country of the BBAN. + * @param {string} bban The BBAN to convert to IBAN. + * @returns {string} The IBAN. */ - fromBBAN(bban: string): string; + fromBBAN(countryCode: string, bban: string): string; /** * @summary Check if the passed iban is valid according to this specification. @@ -33,10 +34,11 @@ declare module ARHS { /** * @summary Check of the passed BBAN is valid. - * @param {string} bban The BBAN to validate + * @param {string} countryCode The country of the BBAN. + * @param {string} bban The BBAN to validate. * @returns {boolean} True if valid, false otherwise. */ - isValidBBAN(bban: string): boolean; + isValidBBAN(countryCode: string, bban: string): boolean; /** * @summary Returns the IBAN in a print format. diff --git a/iban/iban.ts.tscparams b/iban/iban.ts.tscparams new file mode 100644 index 000000000..934bc29ef --- /dev/null +++ b/iban/iban.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny \ No newline at end of file From 62c57a3c8a88f1ea5b586f44dbf1903a719547fe Mon Sep 17 00:00:00 2001 From: Cyril Schumacher Date: Fri, 30 Jan 2015 13:13:46 +0100 Subject: [PATCH 21/54] Add definition for "jquery.dropotron". --- jquery.dropotron/jquery.dropotron-tests.ts | 42 +++++ jquery.dropotron/jquery.dropotron.d.ts | 160 ++++++++++++++++++ .../jquery.dropotron.ts.tscparams | 1 + 3 files changed, 203 insertions(+) create mode 100644 jquery.dropotron/jquery.dropotron-tests.ts create mode 100644 jquery.dropotron/jquery.dropotron.d.ts create mode 100644 jquery.dropotron/jquery.dropotron.ts.tscparams diff --git a/jquery.dropotron/jquery.dropotron-tests.ts b/jquery.dropotron/jquery.dropotron-tests.ts new file mode 100644 index 000000000..6b55c6d58 --- /dev/null +++ b/jquery.dropotron/jquery.dropotron-tests.ts @@ -0,0 +1,42 @@ +/// +/// + +/** + * @summary Test for "dropotron" without configurations. + */ +function testDropotron() { + var foo: JQuery = $('#main-nav > ul'); + foo.dropotron(); +} + +/** + * @summary Test for "dropotron" with configurations. + */ +function testDropotronConfiguration() { + var config: DropotronConfiguration = { + selectorParent: null, + baseZIndex: 1000, + menuClass: 'dropotron', + expandMode: 'hover', + hoverDelay: 150, + hideDelay: 250, + openerClass: 'opener', + openerActiveClass: 'active', + submenuClassPrefix: 'level-', + mode: 'fade', + speed: 'fast', + easing: 'swing', + alignment: 'left', + offsetX: 0, + offsetY: 0, + globalOffsetY: 0, + IEOffsetX: 0, + IEOffsetY: 0, + noOpenerFade: true, + detach: true, + cloneOnDetach: true + }; + + var foo: JQuery = $('#main-nav > ul'); + foo.dropotron(config); +} \ No newline at end of file diff --git a/jquery.dropotron/jquery.dropotron.d.ts b/jquery.dropotron/jquery.dropotron.d.ts new file mode 100644 index 000000000..6c3df6a27 --- /dev/null +++ b/jquery.dropotron/jquery.dropotron.d.ts @@ -0,0 +1,160 @@ +// Type definitions for jquery.dropotron 1.4.3 +// Project: https://github.com/n33/jquery.dropotron +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped/ + +/** + * @summary Interface for "dropotron" configurations. + * @author Cyril Schumacher + * @version 1.0 + */ +interface DropotronConfiguration { + + /** + * @summary Alignment ("left", "center", "right"). + * @type {string} + */ + alignment: string; + + /** + * @summary Base Z-Index. + * @type {number} + */ + baseZIndex: number; + + /** + * @summary If true and detach = true, leave original menu intact. + * @type {boolean} + */ + cloneOnDetach: boolean; + + /** + * @summary Detach second level menus (prevents parent style bleed). + * @type {boolean} + */ + detach: boolean; + + /** + * @summary Easing mode ("swing", "linear"). + * @type {string} + */ + easing: string; + + /** + * @summary IE Offset X. + * @type {number} + */ + IEOffsetX: number; + + /** + * @summary IE Offset Y. + * @type {number} + */ + IEOffsetY: number; + + /** + * @summary Expansion mode ("hover" or "click"). + * @type {string} + */ + expandMode: string; + + /** + * @summary Global offset Y. + * @type {number} + */ + globalOffsetY: number; + + /** + * @summary Hide delay (in ms; 0 disables). + * @type {number} + */ + hideDelay: number; + + /** + * @summary Hover delay (in ms). + * @type {number} + */ + hoverDelay: number; + + /** + * @summary Menu class (assigned to every

    ). + * @type {string} + */ + menuClass: string; + + /** + * @summary Menu mode ("instant", "fade", "slide", "zoom"). + * @type {string} + */ + mode: string; + + /** + * @summary If true and mode = "fade", prevents top-level opener fade. + * @type {boolean} + */ + noOpenerFade: boolean; + + /** + * @summary Submenu offset X. + * @type {number} + */ + offsetX: number; + + /** + * @summary Submenu offset Y. + * @type {number} + */ + offsetY: number; + + /** + * @summary Active opener class. + * @type {string} + */ + openerActiveClass: string; + + /** + * @summary Opener class. + * @type {number} + */ + openerClass: number; + + /** + * @summary Parent jQuery object. + * @type {JQuery} + */ + selectorParent: JQuery; + + /** + * @summary Menu speed ("fast", "slow", or ms). + * @type {string} + */ + speed: string; + + /** + * @summary Submenu class prefix. + * @type {string} + */ + submenuClassPrefix: string; +} + +/** + * @summary Interface for "dropotron". + * @author Cyril Schumacher + * @version 1.0 + */ +interface Dropotron { + /** + * @summary Adds multilevel dropdown menus to jQuery. + * @param {DropotronConfiguration} config Optional. Configuration. + */ + (config?: DropotronConfiguration): void; +} + +/** + * @summary Interface for "JQuery". + * @author Cyril Schumacher + * @version 1.0 + */ +interface JQuery { + dropotron: Dropotron; +} \ No newline at end of file diff --git a/jquery.dropotron/jquery.dropotron.ts.tscparams b/jquery.dropotron/jquery.dropotron.ts.tscparams new file mode 100644 index 000000000..934bc29ef --- /dev/null +++ b/jquery.dropotron/jquery.dropotron.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny \ No newline at end of file From 3d84b2d7f3505d43e155aba1659e038a24e8df35 Mon Sep 17 00:00:00 2001 From: Hraban Luyat Date: Fri, 30 Jan 2015 14:43:26 +0100 Subject: [PATCH 22/54] [react 0.13] Adapt unit tests to new classic API Allows to use the API with one less type cast. --- react/react-0.13.0-tests.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/react/react-0.13.0-tests.ts b/react/react-0.13.0-tests.ts index 26b2d4fb1..18d4bcf4e 100644 --- a/react/react-0.13.0-tests.ts +++ b/react/react-0.13.0-tests.ts @@ -42,7 +42,7 @@ var INPUT_REF: string = "input"; // Top-Level API // -------------------------------------------------------------------------- -var reactClass: React.ComponentClass = React.createClass({ +var reactClassicClass: React.ClassicComponentClass = React.createClass({ getDefaultProps: () => { return { hello: undefined, @@ -69,6 +69,8 @@ var reactClass: React.ComponentClass = React.createClass< } }); +var reactClass: React.ComponentClass = reactClassicClass; + class ModernComponent extends React.Component implements React.ChildContextProvider { constructor(props: Props, context: Context) { super(props, context); @@ -149,6 +151,11 @@ var isValid = React.isValidElement(reactElement); // true React.initializeTouchEvents(true); var domNode: Element = React.findDOMNode(component); +var reactClassicElement: React.ReactClassicElement; +reactClassicElement = React.createElement(reactClassicClass, props); +var classicComponent: React.ClassicComponent; +classicComponent = React.render(reactClassicElement, container); + // // React Elements // -------------------------------------------------------------------------- @@ -177,8 +184,6 @@ component.setState({ inputValue: "!!!" }); component.forceUpdate(); // classic -var classicComponent = >component; - var htmlElement: Element = classicComponent.getDOMNode(); var divElement: HTMLDivElement = classicComponent.getDOMNode(); var isMounted: boolean = classicComponent.isMounted(); From e16b425072e83dbbeb12d4d492ba972f32d06195 Mon Sep 17 00:00:00 2001 From: cyrilschumacher Date: Fri, 30 Jan 2015 20:10:32 +0100 Subject: [PATCH 23/54] Fix bugs. --- acc-wizard/acc-wizard-tests.ts | 2 +- acc-wizard/acc-wizard.d.ts | 2 +- jquery.dropotron/jquery.dropotron.d.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/acc-wizard/acc-wizard-tests.ts b/acc-wizard/acc-wizard-tests.ts index 1ccef7c7d..9cf089b44 100644 --- a/acc-wizard/acc-wizard-tests.ts +++ b/acc-wizard/acc-wizard-tests.ts @@ -11,7 +11,7 @@ function testBasic() { /** * @summary Test for "accwizard" with options. */ -function testBasic() { +function testWithOptions() { var options: AccWizardOptions = { addButtons: true, sidebar: '.acc-wizard-sidebar', diff --git a/acc-wizard/acc-wizard.d.ts b/acc-wizard/acc-wizard.d.ts index 899f04b6d..19d549884 100644 --- a/acc-wizard/acc-wizard.d.ts +++ b/acc-wizard/acc-wizard.d.ts @@ -96,6 +96,6 @@ interface AccWizardOptions { * @author Cyril Schumacher * @version 1.0 */ -interface JQueryStatic { +interface JQuery { accwizard(options: AccWizardOptions): void; } \ No newline at end of file diff --git a/jquery.dropotron/jquery.dropotron.d.ts b/jquery.dropotron/jquery.dropotron.d.ts index 6c3df6a27..2b7d2090e 100644 --- a/jquery.dropotron/jquery.dropotron.d.ts +++ b/jquery.dropotron/jquery.dropotron.d.ts @@ -114,9 +114,9 @@ interface DropotronConfiguration { /** * @summary Opener class. - * @type {number} + * @type {string} */ - openerClass: number; + openerClass: string; /** * @summary Parent jQuery object. From 7ab1e5f60455d21dfb208dbc11f6837dbe2a4fa3 Mon Sep 17 00:00:00 2001 From: cyrilschumacher Date: Fri, 30 Jan 2015 20:12:14 +0100 Subject: [PATCH 24/54] Fix bugs. --- acc-wizard/acc-wizard.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acc-wizard/acc-wizard.d.ts b/acc-wizard/acc-wizard.d.ts index 19d549884..5eb81a11c 100644 --- a/acc-wizard/acc-wizard.d.ts +++ b/acc-wizard/acc-wizard.d.ts @@ -97,5 +97,5 @@ interface AccWizardOptions { * @version 1.0 */ interface JQuery { - accwizard(options: AccWizardOptions): void; + accwizard(options?: AccWizardOptions): void; } \ No newline at end of file From 428f69ab68b5ff495d881dd08daef96f01e3fbe4 Mon Sep 17 00:00:00 2001 From: Tsuguya Toma Date: Sun, 1 Feb 2015 03:40:05 +0900 Subject: [PATCH 25/54] update web audio api --- webaudioapi/waa.d.ts | 129 +++++++++++++++++++++++++++---------------- 1 file changed, 82 insertions(+), 47 deletions(-) diff --git a/webaudioapi/waa.d.ts b/webaudioapi/waa.d.ts index 2ca02d2c6..128855da8 100644 --- a/webaudioapi/waa.d.ts +++ b/webaudioapi/waa.d.ts @@ -12,7 +12,7 @@ * * var context = new AudioContext(); */ -interface AudioContext { +interface AudioContext extends EventTarget { /** * An AudioDestinationNode with a single input representing the final destination for all audio (to be rendered to the audio hardware). All AudioNodes actively rendering audio will directly or indirectly connect to destination. */ @@ -33,11 +33,6 @@ interface AudioContext { */ listener: AudioListener; - /** - * The number of AudioBufferSourceNodes that are currently playing. - */ - activeSourceCount: number; - /** * Creates an AudioBuffer of the given size. The audio data in the buffer will be zero-initialized (silent). An exception will be thrown if the numberOfChannels or sampleRate are out-of-bounds. * @param numberOfChannels how many channels the buffer will have. An implementation must support at least 32 channels. @@ -69,9 +64,9 @@ interface AudioContext { * 5. The audioData neutered state will be restored to normal * 6. The successCallback function will be scheduled to run on the main thread's event loop given the AudioBuffer from step (4) as an argument. * - * @param ArrayBuffer containing audio file data. - * @param callback function which will be invoked when the decoding is finished. The single argument to this callback is an AudioBuffer representing the decoded PCM audio data. - * @param callback function which will be invoked if there is an error decoding the audio file data. + * @param audioData an ArrayBuffer containing audio file data. + * @param successCallback callback function which will be invoked when the decoding is finished. The single argument to this callback is an AudioBuffer representing the decoded PCM audio data. + * @param errorCallback callback function which will be invoked if there is an error decoding the audio file data. */ decodeAudioData(audioData: ArrayBuffer, successCallback: (decodedData: AudioBuffer) => any, errorCallback?: Function): void; @@ -102,7 +97,7 @@ interface AudioContext { * @param numberOfInputChannels (defaults to 2) the number of channels for this node's input. Values of up to 32 must be supported. * @param numberOfOutputChannels (defaults to 2) the number of channels for this node's output. Values of up to 32 must be supported. */ - createScriptProcessor(bufferSize: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; + createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; /** * Creates a AnalyserNode. @@ -119,7 +114,6 @@ interface AudioContext { * @param maxDelayTime the maximum delay time in seconds allowed for the delay line. If specified, this value must be greater than zero and less than three minutes or a NOT_SUPPORTED_ERR exception will be thrown. */ createDelay(maxDelayTime?: number): DelayNode; - //createDelayNode(maxDelayTime?: number): DelayNode; /** * Creates a BiquadFilterNode representing a second order filter which can be configured as one of several common filter types. @@ -180,10 +174,6 @@ declare var webkitAudioContext: { new (): AudioContext; } -interface OfflineRenderSuccessCallback{ - (renderedData: AudioBuffer): void; -} - /** * OfflineAudioContext is a particular type of AudioContext for rendering/mixing-down (potentially) faster than real-time. It does not render to the audio hardware, but instead renders as quickly as possible, calling a render callback function upon completion with the result provided as an AudioBuffer. It is constructed by specifying the numberOfChannels, length, and sampleRate as follows: * @@ -191,13 +181,36 @@ interface OfflineRenderSuccessCallback{ */ interface OfflineAudioContext extends AudioContext{ startRendering(): void; - oncomplete: OfflineRenderSuccessCallback; + oncomplete: EventHandler; +} + +declare var OfflineAudioContext: { + new (numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; } declare var webkitOfflineAudioContext: { new (numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; } +interface OfflineAudioCompletionEvent extends Event { + /** + * An AudioBuffer containing the rendered audio data once an OfflineAudioContext has finished rendering. It will have a number of channels equal to the numberOfChannels parameter of the OfflineAudioContext constructor. + */ + renderedBuffer: AudioBuffer; +} + + +declare enum ChannelCountMode { + 'max', + 'clamped-max', + 'explicit' +} + +declare enum ChannelInterpretation { + speakers, + discrete +} + /** * AudioNodes are the building blocks of an AudioContext. This interface represents audio sources, the audio destination, and intermediate processing modules. These modules can be connected together to form processing graphs for rendering audio to the audio hardware. Each node can have inputs and/or outputs. An AudioSourceNode has no inputs and a single output. An AudioDestinationNode has one input and no outputs and represents the final destination to the audio hardware. Most processing nodes such as filters will have one input and one output. Each type of AudioNode differs in the details of how it processes or synthesizes audio. But, in general, AudioNodes will process its inputs (if it has any), and generate audio for its outputs (if it has any). * @@ -279,6 +292,25 @@ interface AudioNode extends EventTarget { * The number of outputs coming out of the AudioNode. This will be 0 for an AudioDestinationNode. */ numberOfOutputs: number; + + /** + * The number of channels used when up-mixing and down-mixing connections to any inputs to the node. The default value is 2 except for specific nodes where its value is specially determined. This attribute has no effect for nodes with no inputs. If this value is set to zero, the implementation MUST throw a NOT_SUPPORTED_ERR exception. + */ + channelCount: number; + + /** + * Determines how channels will be counted when up-mixing and down-mixing connections to any inputs to the node . This attribute has no effect for nodes with no inputs. + * + * See the Channel up-mixing and down-mixing section for more information on this attribute. + */ + channelCountMode: ChannelCountMode; + + /** + * Determines how individual channels will be treated when up-mixing and down-mixing connections to any inputs to the node. This attribute has no effect for nodes with no inputs. + * + * See the Channel up-mixing and down-mixing section for more information on this attribute. + */ + channelInterpretation: ChannelInterpretation; } @@ -371,7 +403,7 @@ interface AudioParam { * @param value the value the parameter will linearly ramp to at the given time. * @param endTime the time in the same time coordinate system as AudioContext.currentTime. */ - linearRampToValueAtTime(value: number, time: number): void; + linearRampToValueAtTime(value: number, endTime: number): void; /** * Schedules an exponential continuous change in parameter value from the previous scheduled parameter value to the given value. Parameters representing filter frequencies and playback rate are best changed exponentially because of the way humans perceive sound. @@ -420,7 +452,7 @@ interface AudioParam { * @param duration the amount of time in seconds (after the time parameter) where values will be calculated according to the values parameter.. * */ - setValueCurveAtTime(values: Float32Array, time: number, duration: number): void; + setValueCurveAtTime(values: Float32Array, startTime: number, duration: number): void; /** * Cancels all scheduled parameter changes with times greater than or equal to startTime. @@ -506,17 +538,12 @@ interface AudioBuffer { } /** - * This interface represents an audio source from an in-memory audio asset in an AudioBuffer. It generally will be used for short audio assets which require a high degree of scheduling flexibility (can playback in rhythmically perfect ways). The playback state of an AudioBufferSourceNode goes through distinct stages during its lifetime in this order: UNSCHEDULED_STATE, SCHEDULED_STATE, PLAYING_STATE, FINISHED_STATE. The start() method causes a transition from the UNSCHEDULED_STATE to SCHEDULED_STATE. Depending on the time argument passed to start(), a transition is made from the SCHEDULED_STATE to PLAYING_STATE, at which time sound is first generated. Following this, a transition from the PLAYING_STATE to FINISHED_STATE happens when either the buffer's audio data has been completely played (if the loop attribute is false), or when the stop() method has been called and the specified time has been reached. Please see more details in the start() and stop() description. Once an AudioBufferSourceNode has reached the FINISHED state it will no longer emit any sound. Thus start() and stop() may not be issued multiple times for a given AudioBufferSourceNode. + * This interface represents an audio source from an in-memory audio asset in an AudioBuffer. It is useful for playing short audio assets which require a high degree of scheduling flexibility (can playback in rhythmically perfect ways). The start() method is used to schedule when sound playback will happen. The playback will stop automatically when the buffer's audio data has been completely played (if the loop attribute is false), or when the stop() method has been called and the specified time has been reached. Please see more details in the start() and stop() description. start() and stop() may not be issued multiple times for a given AudioBufferSourceNode. * * numberOfInputs : 0 * numberOfOutputs : 1 */ -interface AudioBufferSourceNode extends AudioSourceNode { - - /** - * The playback state, initialized to UNSCHEDULED_STATE. - */ - playbackState: number; +interface AudioBufferSourceNode extends AudioNode { /** * Represents the audio asset to be played. @@ -546,7 +573,7 @@ interface AudioBufferSourceNode extends AudioSourceNode { /** * A property used to set the EventHandler for the ended event that is dispatched to AudioBufferSourceNode node types. When the playback of the buffer for an AudioBufferSourceNode is finished, an event of type Event will be dispatched to the event handler. */ - onended: EventListener; + onended: EventHandler; /** * Schedules a sound to playback at an exact time. @@ -571,7 +598,7 @@ interface AudioBufferSourceNode extends AudioSourceNode { * numberOfInputs : 0 * numberOfOutputs : 1 */ -interface MediaElementAudioSourceNode extends AudioSourceNode { +interface MediaElementAudioSourceNode extends AudioNode { } /** @@ -590,7 +617,7 @@ interface ScriptProcessorNode extends AudioNode { /** * An event listener which is called periodically for audio processing. An event of type AudioProcessingEvent will be passed to the event handler. */ - onaudioprocess: EventListener; + onaudioprocess: EventHandler; /** * The size of the buffer (in sample-frames) which needs to be processed each time onprocessaudio is called. Legal values are (256, 512, 1024, 2048, 4096, 8192, 16384). @@ -604,11 +631,6 @@ interface ScriptProcessorNode extends AudioNode { * The event handler processes audio from the input (if any) by accessing the audio data from the inputBuffer attribute. The audio data which is the result of the processing (or the synthesized data if there are no inputs) is then placed into the outputBuffer. */ interface AudioProcessingEvent extends Event { - /** - * The ScriptProcessorNode associated with this processing event. - */ - node: ScriptProcessorNode; - /** * The time when the audio will be played in the same time coordinate system as AudioContext.currentTime. playbackTime allows for very tight synchronization between processing directly in JavaScript with the other events in the context's rendering graph. */ @@ -634,12 +656,7 @@ declare enum PanningModelType { /** * A higher quality spatialization algorithm using a convolution with measured impulse responses from human subjects. This panning method renders stereo output. */ - HRTF, - - /** - * An algorithm which spatializes multi-channel audio using sound field algorithms. - */ - soundfield + HRTF } declare enum DistanceModelType { @@ -1056,6 +1073,12 @@ interface BiquadFilterNode extends AudioNode { getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } +declare enum OverSampleType { + 'none', + '2x', + '4x' +} + /** * WaveShaperNode is an AudioNode processor implementing non-linear distortion effects. * @@ -1069,6 +1092,19 @@ interface WaveShaperNode extends AudioNode { * The shaping curve used for the waveshaping effect. The input signal is nominally within the range -1 -> +1. Each input sample within this range will index into the shaping curve with a signal level of zero corresponding to the center value of the curve array. Any sample value less than -1 will correspond to the first value in the curve array. Any sample value less greater than +1 will correspond to the last value in the curve array. */ curve: Float32Array; + + /** + * Specifies what type of oversampling (if any) should be used when applying the shaping curve. The default value is "none", meaning the curve will be applied directly to the input samples. A value of "2x" or "4x" can improve the quality of the processing by avoiding some aliasing, with the "4x" value yielding the highest quality. For some applications, it's better to use no oversampling in order to get a very precise shaping curve. + * + * A value of "2x" or "4x" means that the following steps must be performed: + * + * 1. Up-sample the input samples to 2x or 4x the sample-rate of the AudioContext. Thus for each processing block of 128 samples, generate 256 (for 2x) or 512 (for 4x) samples. + * 2. Apply the shaping curve. + * 3. Down-sample the result back to the sample-rate of the AudioContext. Thus taking the 256 (or 512) processed samples, generating 128 as the final result. + * + * The exact up-sampling and down-sampling filters are not specified, and can be tuned for sound quality (low aliasing, etc.), low latency, and performance. + */ + oversample: OverSampleType } declare enum OscillatorType { @@ -1099,18 +1135,12 @@ declare enum OscillatorType { * numberOfInputs : 0 * numberOfOutputs : 1 (mono output) */ -interface OscillatorNode extends AudioSourceNode { +interface OscillatorNode extends AudioNode { /** * The shape of the periodic waveform. It may directly be set to any of the type constant values except for "custom". The setPeriodicWave() method can be used to set a custom waveform, which results in this attribute being set to "custom". The default value is "sine". */ type: OscillatorType; - /** - * defined as in AudioBufferSourceNode. - * @readonly - */ - playbackState: number; - /** * The frequency (in Hertz) of the periodic waveform. This parameter is a-rate * @readonly @@ -1136,6 +1166,11 @@ interface OscillatorNode extends AudioSourceNode { * Sets an arbitrary custom periodic waveform given a PeriodicWave. */ setPeriodicWave(periodicWave: PeriodicWave): void; + + /** + * A property used to set the EventHandler (described in HTML) for the ended event that is dispatched to OscillatorNode node types. When the playback of the buffer for an OscillatorNode is finished, an event of type Event (described in HTML) will be dispatched to the event handler. + */ + onended: EventHandler } /** @@ -1150,7 +1185,7 @@ interface PeriodicWave { * numberOfInputs : 0 * numberOfOutputs : 1 */ -interface MediaStreamAudioSourceNode extends AudioSourceNode { +interface MediaStreamAudioSourceNode extends AudioNode { } /** From a7900a928d4c6d61ab0d0998b9b9d84263464dc4 Mon Sep 17 00:00:00 2001 From: Tsuguya Toma Date: Sun, 1 Feb 2015 04:18:44 +0900 Subject: [PATCH 26/54] update waa-tests. --- webaudioapi/waa-tests.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webaudioapi/waa-tests.ts b/webaudioapi/waa-tests.ts index 91c611463..505f6214e 100644 --- a/webaudioapi/waa-tests.ts +++ b/webaudioapi/waa-tests.ts @@ -317,7 +317,9 @@ declare var footstepsBuffer: any; ()=>{ var context = new webkitOfflineAudioContext(1, 2, 44100.5); + context.oncomplete = function(e) { + context.createBufferSource().buffer; + } context.startRendering(); - context.oncomplete(context.createBufferSource().buffer); } From b04655e76dddefab6722908c7c826fedda1ec6e6 Mon Sep 17 00:00:00 2001 From: Jean-Martin Thibault Date: Sat, 31 Jan 2015 17:55:30 -0500 Subject: [PATCH 27/54] added support for custom nconf.formats and added missing format in IFileOptions --- nconf/nconf-tests.ts | 25 ++++++++++++++++++++++++- nconf/nconf.d.ts | 14 ++++++++++---- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/nconf/nconf-tests.ts b/nconf/nconf-tests.ts index 13b314af8..7037abfb6 100644 --- a/nconf/nconf-tests.ts +++ b/nconf/nconf-tests.ts @@ -13,6 +13,7 @@ var opts: nconf.IOptions; var fopts: nconf.IFileOptions; var store: nconf.IStore; var callback: (err: Error) => void; +var fmt: nconf.IFormat; value = nconf.clear(str, callback); value = nconf.get (str, callback); @@ -37,7 +38,10 @@ p = nconf.env(opts); p = nconf.file(str); p = nconf.file(str, fopts); p = nconf.file(fopts); - +p = nconf.file({ + format: fmt, + file: 'jsonFile.custom' +}); p = nconf.use(str); p = nconf.use(str, opts); @@ -92,6 +96,18 @@ p = p.env(opts); p = p.file(str); p = p.file(str, fopts); p = p.file(fopts); +p = p.file({ + file: 'iniFile.ini', + format: nconf.formats.ini +}); +p = p.file({ + file: 'jsonFile.json', + format: nconf.formats.json +}); +p = p.file({ + file: 'jsonFile.custom', + format: fmt +}); p = p.use(str, opts); p = p.defaults(opts); @@ -99,3 +115,10 @@ p.init(opts); p = p.overrides(opts); p.remove(str); store = p.create(str, opts); + +// - - - - - - - - - - - - - - - - - - - - - - - - - + +class CustomFmt implements nconf.IFormat { + stringify(obj: any, replacer: any, spacing?: any): string { return ""; } + parse(str: string): any { return {} } +}; diff --git a/nconf/nconf.d.ts b/nconf/nconf.d.ts index 2ebd18a15..ee59591fd 100644 --- a/nconf/nconf.d.ts +++ b/nconf/nconf.d.ts @@ -1,6 +1,6 @@ // Type definitions for nconf // Project: https://github.com/flatiron/nconf -// Definitions by: Jeff Goddard +// Definitions by: Jeff Goddard , Jean-Martin Thibault // Definitions: https://github.com/borisyankov/DefinitelyTyped // Imported from: https://github.com/soywiz/typescript-node-definitions/nconf.d.ts @@ -38,9 +38,14 @@ declare module "nconf" { export function loadFiles(files: any, callback?: ICallbackFunction): void; export function loadFilesSync(files: any, callback?: ICallbackFunction): void; - export enum formats { - json, - ini + export var formats: { + json: IFormat; + ini: IFormat; + }; + + export interface IFormat { + stringify: (obj: any, replacer: any, spacing?: any) => string; + parse: (str: string) => any; } export interface IOptions { @@ -51,6 +56,7 @@ declare module "nconf" { file?: string; dir?: string; search?: boolean; + format?: IFormat; json_spacing?: number; } From ce14ae27a020194da3d35aa3468ca1e9e5296316 Mon Sep 17 00:00:00 2001 From: Alan Date: Mon, 26 Jan 2015 00:23:24 -0500 Subject: [PATCH 28/54] Fixed ShellJS.exec() definition in .d.ts. --- shelljs/shelljs-tests.ts | 26 ++++++++++++++++++ shelljs/shelljs.d.ts | 57 +++++++++++++++++++++++++--------------- 2 files changed, 62 insertions(+), 21 deletions(-) diff --git a/shelljs/shelljs-tests.ts b/shelljs/shelljs-tests.ts index d28b72398..835f177a6 100644 --- a/shelljs/shelljs-tests.ts +++ b/shelljs/shelljs-tests.ts @@ -85,8 +85,34 @@ shell.ln("-sf", "file", "existing"); var testPath = shell.env["path"]; +import child = require("child_process"); + var version = shell.exec("node --version").output; +var version2 = shell.exec("node --version", { async: false }); +var output = version2.output; + +var asyncVersion3 = shell.exec("node --version", { async: true }); +var pid = asyncVersion3.pid; + +shell.exec("node --version", { silent: true }, function (code, output) { + var version = output; +}); +shell.exec("node --version", { silent: true, async: true }, function (code, output) { + var version = output; +}); +shell.exec("node --version", function (code, output) { + var version = output; +}); +shell.exec("node --version", function (code: number) { + var num: number = code; +}); + +var childProc = shell.exec("node --version", function (code: number) { + var num: number = code; +}); +var pid = childProc.pid; + shell.chmod(755, "/Users/brandon"); shell.chmod("755", "/Users/brandon"); // same as above shell.chmod("u+x", "/Users/brandon"); diff --git a/shelljs/shelljs.d.ts b/shelljs/shelljs.d.ts index b3b732d05..c4608caee 100644 --- a/shelljs/shelljs.d.ts +++ b/shelljs/shelljs.d.ts @@ -8,6 +8,8 @@ declare module "shelljs" { + import child = require("child_process"); + /** * Changes to directory dir for the duration of the script * @param {string} dir Directory to change in. @@ -434,31 +436,44 @@ declare module "shelljs" * Object containing environment variables (both getter and setter). Shortcut to process.env. */ export var env: { [key: string]: string }; - - /* - - // Not yet implemented due to implementation issues (constant overloads and return types). - // See: https://github.com/arturadib/shelljs#execcommand--options--callback - - export function exec(command: string, options: ExecOptions, callback: (code: number, output: string) => any): any; - export function exec(command: string, options: ExecOptions): any; - - interface ExecOptions - { - silent: boolean; - async: boolean; - } - - */ - + /** * Executes the given command synchronously. - * @param {string} command The commadn to execute. - * @return {ExecReturnValue} Returns an object containing the return code and output as string. + * @param {string} command The command to execute. + * @return {ExecOutputReturnValue} Returns an object containing the return code and output as string. */ - export function exec(command: string): ExecReturnValue; + export function exec(command: string): ExecOutputReturnValue; + /** + * Executes the given command synchronously. + * @param {string} command The command to execute. + * @param {ExecOptions} options Silence and synchronous options. + * @return {ExecOutputReturnValue | child.ChildProcess} Returns an object containing the return code and output as string, or if {async:true} was passed, a ChildProcess. + */ + export function exec(command: string, options: ExecOptions): ExecOutputReturnValue | child.ChildProcess; + /** + * Executes the given command synchronously. + * @param {string} command The command to execute. + * @param {ExecOptions} options Silence and synchronous options. + * @param {ExecCallback} callback Receives code and output asynchronously. + */ + export function exec(command: string, options: ExecOptions, callback: ExecCallback): child.ChildProcess; + /** + * Executes the given command synchronously. + * @param {string} command The command to execute. + * @param {ExecCallback} callback Receives code and output asynchronously. + */ + export function exec(command: string, callback: ExecCallback): child.ChildProcess; - interface ExecReturnValue + export interface ExecCallback { + (code: number, output: string): any; + } + + export interface ExecOptions { + silent?: boolean; + async?: boolean; + } + + export interface ExecOutputReturnValue { code: number; output: string; From 4e752c7705436f8867323f2fc8d6d89aef673ea3 Mon Sep 17 00:00:00 2001 From: xinkai Date: Sun, 1 Feb 2015 12:32:26 +0800 Subject: [PATCH 29/54] add two missing functions to ip (subnet, cidrSubnet) --- ip/ip-tests.ts | 4 +++- ip/ip.d.ts | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ip/ip-tests.ts b/ip/ip-tests.ts index b852e08e7..338c2bc04 100644 --- a/ip/ip-tests.ts +++ b/ip/ip-tests.ts @@ -16,4 +16,6 @@ ip.mask("192.168.0.1", "255.255.255.0"); ip.not("255.255.255.0"); ip.or("192.168.0.1", "255.255.255.0"); var buff:any = ip.toBuffer(myIP); -ip.toString(buff); \ No newline at end of file +ip.toString(buff); +ip.subnet('192.168.1.134', '255.255.255.192'); +ip.cidrSubnet('192.168.1.134/26'); diff --git a/ip/ip.d.ts b/ip/ip.d.ts index 2fe3201c7..da722688d 100644 --- a/ip/ip.d.ts +++ b/ip/ip.d.ts @@ -5,6 +5,17 @@ interface NodeBuffer { } +interface SubnetInfo { + networkAddress: string; + firstAddress: string; + lastAddress: string; + broadcastAddress: string; + subnetMask: string; + subnetMaskLength: number; + numHosts: number; + length: number; +} + declare module "ip" { /** * Check two IP address are the same. @@ -88,4 +99,17 @@ declare module "ip" { * Convert an IPv4 IP address from its the long numeric value to a string. **/ export function fromLong(ip: number): string; + + /** + * Get the subnet information. + * @param ip IP address. + * @param subnet Subnet address. + */ + export function subnet(ip: string, subnet: string): SubnetInfo; + + /** + * Get the subnet information. + * @param cidr CIDR address. + */ + export function cidrSubnet(cidr: string): SubnetInfo; } \ No newline at end of file From 0740b810ebc822472dfa85187e82d3b82e405927 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Sun, 1 Feb 2015 18:13:15 +0900 Subject: [PATCH 30/54] webspeechapi --- webspeechapi/webspeechapi.d.ts | 146 +++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 webspeechapi/webspeechapi.d.ts diff --git a/webspeechapi/webspeechapi.d.ts b/webspeechapi/webspeechapi.d.ts new file mode 100644 index 000000000..a0c088bab --- /dev/null +++ b/webspeechapi/webspeechapi.d.ts @@ -0,0 +1,146 @@ +// Type definitions for Web Speech API +// Project: https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html +// Definitions by: SaschaNaz +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface SpeechRecognition extends EventTarget { + grammars: SpeechGrammarList; + lang: string; + continuous: boolean; + interimResults: boolean; + maxAlternatives: number; + serviceURI: string; + + start(): void; + stop(): void; + abort(): void; + + onaudiostart: (ev: SpeechRecognitionEvent) => any; + onsoundstart: (ev: SpeechRecognitionEvent) => any; + onspeechstart: (ev: SpeechRecognitionEvent) => any; + onspeechend: (ev: SpeechRecognitionEvent) => any; + onsoundend: (ev: SpeechRecognitionEvent) => any; + onresult: (ev: SpeechRecognitionEvent) => any; + onnomatch: (ev: SpeechRecognitionEvent) => any; + onerror: (ev: SpeechRecognitionError) => any; + onstart: (ev: SpeechRecognitionEvent) => any; + onend: (ev: SpeechRecognitionEvent) => any; +} +interface SpeechRecognitionStatic { + prototype: SpeechRecognition; + new (): SpeechRecognition; +} +declare var SpeechRecognition: SpeechRecognitionStatic; +declare var webkitSpeechRecognition: SpeechRecognitionStatic; + +interface SpeechRecognitionError extends Event { + error: string; + message: string; +} + +interface SpeechRecognitionAlternative { + transcript: string; + confidence: number; +} + +interface SpeechRecognitionResult { + length: number; + item(index: number): SpeechRecognitionAlternative; + final: boolean; +} + +interface SpeechRecognitionResultList { + length: number; + item(index: number): SpeechRecognitionResult; +} + +interface SpeechRecognitionEvent extends Event { + resultIndex: number; + results: SpeechRecognitionResultList; + interpretation: any; + emma: Document; +} + +interface SpeechGrammar { + src: string; + weight: number; +} +interface SpeechGrammarStatic { + prototype: SpeechGrammar; + new (): SpeechGrammar; +} +declare var SpeechGrammar: SpeechGrammarStatic; +declare var webkitSpeechGrammar: SpeechGrammarStatic; + +interface SpeechGrammarList { + length: number; + item(index: number): SpeechGrammar; + addFromURI(src: string, weight: number): void; + addFromString(string: string, weight: number): void; +} +interface SpeechGrammarListStatic { + prototype: SpeechGrammarList; + new (): SpeechGrammarList; +} +declare var SpeechGrammarList: SpeechGrammarListStatic; +declare var webkitSpeechGrammarList: SpeechGrammarListStatic; + +interface SpeechSynthesis { + pending: boolean; + speaking: boolean; + paused: boolean; + + speak(utterance: SpeechSynthesisUtterance): void; + cancel(): void; + pause(): void; + resume(): void; + getVoices(): SpeechSynthesisVoiceList; +} + +interface SpeechSynthesisGetter { + speechSynthesis: SpeechSynthesis; +} +interface Window extends SpeechSynthesisGetter { +} + +interface SpeechSynthesisUtterance extends EventTarget { + text: string; + lang: string; + voiceURI: string; + volume: number; + rate: number; + pitch: number; + + onstart: (ev: SpeechSynthesisEvent) => any; + onend: (ev: SpeechSynthesisEvent) => any; + onerror: (ev: ErrorEvent) => any; + onpause: (ev: SpeechSynthesisEvent) => any; + onresume: (ev: SpeechSynthesisEvent) => any; + onmark: (ev: SpeechSynthesisEvent) => any; + onboundary: (ev: SpeechSynthesisEvent) => any; +} +interface SpeechSynthesisUtteranceStatic { + prototype: SpeechSynthesisUtterance; + new (): SpeechSynthesisUtterance; + new (text: string): SpeechSynthesisUtterance; +} +declare var SpeechSynthesisUtterance: SpeechSynthesisUtteranceStatic; + +interface SpeechSynthesisEvent extends Event { + charIndex: number; + elapsedTime: number; + name: string; +} + +interface SpeechSynthesisVoice { + voiceURI: string; + name: string; + lang: string; + localService: boolean; + default: boolean; +} + +interface SpeechSynthesisVoiceList { + length: number; + item(index: number): SpeechSynthesisVoice; +} \ No newline at end of file From feec83a5d59b32320dbdc5a7c743a76df91a78f6 Mon Sep 17 00:00:00 2001 From: davetayls Date: Sun, 1 Feb 2015 20:22:50 +0000 Subject: [PATCH 31/54] added triggerMethod to Marionette.Controller as described https://github.com/marionettejs/backbone.marionette/blob/master/src/controller.js#L33 --- marionette/marionette.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index 40c0f6775..39faea563 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -231,6 +231,8 @@ declare module Marionette { * @param optionName the name of the option to retrieve. */ getOption(optionName: string): any; + + triggerMethod(name: string, ...args: any[]): any; } interface RegionConstructionOptions { From 4135f7e697b062e6b7692b936f507d0e17514b7b Mon Sep 17 00:00:00 2001 From: reppners Date: Mon, 2 Feb 2015 11:29:48 +0100 Subject: [PATCH 32/54] + nedb typings + test --- nedb/nedb-test.ts | 553 ++++++++++++++++++++++++++++++++++++++++++++++ nedb/nedb.d.ts | 207 +++++++++++++++++ 2 files changed, 760 insertions(+) create mode 100644 nedb/nedb-test.ts create mode 100644 nedb/nedb.d.ts diff --git a/nedb/nedb-test.ts b/nedb/nedb-test.ts new file mode 100644 index 000000000..fd6005719 --- /dev/null +++ b/nedb/nedb-test.ts @@ -0,0 +1,553 @@ +/** + * Created by stefansteinhart on 31.01.15. + */ + +/// +/// +/// + +import Q = require('q'); +import nedb = require('nedb'); + +class BaseCollection { + + private dataStore:nedb; + + constructor(dataStore:nedb) { + + this.dataStore = dataStore; + } + + public insert(document:T):Q.Promise { + + var deferred = Q.defer(); + + this.dataStore.insert(document, function (err:Error, newDoc:T) { // Callback is optional + // newDoc is the newly inserted document, including its _id + if (err) { + deferred.reject(err); + } + else { + deferred.resolve(newDoc); + } + }); + + return deferred.promise; + } + + public count():Q.Promise { + + var deferred = Q.defer(); + + this.dataStore.count({}, function (err:Error, count:number) { + if (err) { + deferred.reject(err); + } + else { + deferred.resolve(count); + } + }); + + return deferred.promise; + } + + public countBy(criteria:any):Q.Promise { + + var deferred = Q.defer(); + + this.dataStore.count(criteria, function (err:Error, count:number) { + if (err) { + deferred.reject(err); + } + else { + deferred.resolve(count); + } + }); + + return deferred.promise; + } + + public findByID(id:string):Q.Promise { + + var deferred = Q.defer(); + + this.dataStore.findOne({_id: id}, function (err:Error, doc:T) { + if (err) { + deferred.reject(err); + } + else { + deferred.resolve(doc); + } + }); + + return deferred.promise; + } + + public findOne(criteria:any):Q.Promise { + + var deferred = Q.defer(); + + this.dataStore.findOne(criteria, function (err:Error, doc:T) { + if (err) { + deferred.reject(err); + } + else { + deferred.resolve(doc); + } + }); + + return deferred.promise; + } + + public find(criteria:any):Q.Promise> { + + var deferred = Q.defer>(); + + this.dataStore.find(criteria, function (err:Error, docs:Array) { + if (err) { + deferred.reject(err); + } + else { + deferred.resolve(docs); + } + }); + + return deferred.promise; + } + + public all():Q.Promise> { + + var deferred = Q.defer>(); + + this.dataStore.find({}, function (err:Error, docs:Array) { + if (err) { + deferred.reject(err); + } + else { + deferred.resolve(docs); + } + }); + + return deferred.promise; + } + + public upsert(query:any, updateQuery:any):Q.Promise { + + var deferred = Q.defer(); + + this.dataStore.update(query, updateQuery, {upsert: true}, function (err:Error, numberOfUpdated:number, upsert:boolean) { + if (err) { + deferred.reject(err); + } + else { + //deferred.resolve(newDoc); + } + }); + + return deferred.promise; + } + + public update(query:Object, updateQuery:Object, options?:NeDB.UpdateOptions):Q.Promise { + + var deferred = Q.defer(); + + this.dataStore.update(query, updateQuery, options, function (err:Error, numberOfUpdated:number) { + if (err) { + deferred.reject(err); + } + else { + deferred.resolve(numberOfUpdated); + } + }); + + return deferred.promise; + } + + public remove(criteria:any):Q.Promise { + + var deferred = Q.defer(); + + this.dataStore.remove(criteria, function (err:Error, numberOfDeletedEntrys:number) { + + if (err) { + deferred.reject(err); + } + else { + deferred.resolve(numberOfDeletedEntrys); + } + }); + + return deferred.promise; + } +} + +// Type 1: In-memory only datastore (no need to load the database) +import Datastore = require('nedb'); +var db = new Datastore(); + + +// Type 2: Persistent datastore with manual loading +db = new Datastore({filename: 'path/to/datafile'}); +db.loadDatabase(function (err) { // Callback is optional + // Now commands will be executed +}); + + +// Type 3: Persistent datastore with automatic loading +db = new Datastore({filename: 'path/to/datafile', autoload: true}); +// You can issue commands right away + + +// Type 4: Persistent datastore for a Node Webkit app called 'nwtest' +// For example on Linux, the datafile will be ~/.config/nwtest/nedb-data/something.db +import path = require('path'); +db = new Datastore({filename: path.join(require('nw.gui').App.dataPath, 'something.db')}); + + +// Of course you can create multiple datastores if you need several +// collections. In this case it's usually a good idea to use autoload for all collections. +var dbContainer:any = {}; +dbContainer.users = new Datastore('path/to/users.db'); +dbContainer.robots = new Datastore('path/to/robots.db'); + +// You need to load each database (here we do it asynchronously) +dbContainer.users.loadDatabase(); +dbContainer.robots.loadDatabase(); + +var doc:any = { + hello: 'world' + , n: 5 + , today: new Date() + , nedbIsAwesome: true + , notthere: null + , notToBeSaved: undefined // Will not be saved + , fruits: ['apple', 'orange', 'pear'] + , infos: {name: 'nedb'} +}; + +db.insert(doc, function (err:Error, newDoc:any) { // Callback is optional + // newDoc is the newly inserted document, including its _id + // newDoc has no key called notToBeSaved since its value was undefined +}); + +db.insert([{a: 5}, {a: 42}], function (err:Error, newdocs:Array) { + // Two documents were inserted in the database + // newDocs is an array with these documents, augmented with their _id +}); + +// If there is a unique constraint on field 'a', this will fail +db.insert([{a: 5}, {a: 42}, {a: 5}], function (err:Error) { + // err is a 'uniqueViolated' error + // The database was not modified +}); + +// Finding all planets in the solar system +db.find({system: 'solar'}, function (err:Error, docs:Array) { + // docs is an array containing documents Mars, Earth, Jupiter + // If no document is found, docs is equal to [] +}); + +// Finding all planets whose name contain the substring 'ar' using a regular expression +db.find({planet: /ar/}, function (err:Error, docs:Array) { + // docs contains Mars and Earth +}); + +// Finding all inhabited planets in the solar system +db.find({system: 'solar', inhabited: true}, function (err:Error, docs:Array) { + // docs is an array containing document Earth only +}); + +// Use the dot-notation to match fields in subdocuments +db.find({"humans.genders": 2}, function (err:Error, docs:Array) { + // docs contains Earth +}); + +// Use the dot-notation to navigate arrays of subdocuments +db.find({"completeData.planets.name": "Mars"}, function (err:Error, docs:Array) { + // docs contains document 5 +}); + +db.find({"completeData.planets.name": "Jupiter"}, function (err:Error, docs:Array) { + // docs is empty +}); + +db.find({"completeData.planets.0.name": "Earth"}, function (err:Error, docs:Array) { + // docs contains document 5 + // If we had tested against "Mars" docs would be empty because we are matching against a specific array element +}); + + +// You can also deep-compare objects. Don't confuse this with dot-notation! +db.find({humans: {genders: 2}}, function (err:Error, docs:Array) { + // docs is empty, because { genders: 2 } is not equal to { genders: 2, eyes: true } +}); + +// Find all documents in the collection +db.find({}, function (err:Error, docs:Array) { +}); + +// The same rules apply when you want to only find one document +db.findOne({_id: 'id1'}, function (err:Error, doc:any) { + // doc is the document Mars + // If no document is found, doc is null +}); + +// $lt, $lte, $gt and $gte work on numbers and strings +db.find({"humans.genders": {$gt: 5}}, function (err:Error, docs:Array) { + // docs contains Omicron Persei 8, whose humans have more than 5 genders (7). +}); + +// When used with strings, lexicographical order is used +db.find({planet: {$gt: 'Mercury'}}, function (err:Error, docs:Array) { + // docs contains Omicron Persei 8 +}) + +// Using $in. $nin is used in the same way +db.find({planet: {$in: ['Earth', 'Jupiter']}}, function (err:Error, docs:Array) { + // docs contains Earth and Jupiter +}); + +// Using $exists +db.find({satellites: {$exists: true}}, function (err:Error, docs:Array) { + // docs contains only Mars +}); + +// Using $regex with another operator +db.find({planet: {$regex: /ar/, $nin: ['Jupiter', 'Earth']}}, function (err:Error, docs:Array) { + // docs only contains Mars because Earth was excluded from the match by $nin +}); + +// Using an array-specific comparison function +// Note: you can't use nested comparison functions, e.g. { $size: { $lt: 5 } } will throw an error +db.find({satellites: {$size: 2}}, function (err:Error, docs:Array) { + // docs contains Mars +}); + +db.find({satellites: {$size: 1}}, function (err:Error, docs:Array) { + // docs is empty +}); + +// If a document's field is an array, matching it means matching any element of the array +db.find({satellites: 'Phobos'}, function (err:Error, docs:Array) { + // docs contains Mars. Result would have been the same if query had been { satellites: 'Deimos' } +}); + +// This also works for queries that use comparison operators +db.find({satellites: {$lt: 'Amos'}}, function (err:Error, docs:Array) { + // docs is empty since Phobos and Deimos are after Amos in lexicographical order +}); + +// This also works with the $in and $nin operator +db.find({satellites: {$in: ['Moon', 'Deimos']}}, function (err:Error, docs:Array) { + // docs contains Mars (the Earth document is not complete!) +}); + +db.find({$or: [{planet: 'Earth'}, {planet: 'Mars'}]}, function (err:Error, docs:Array) { + // docs contains Earth and Mars +}); + +db.find({$not: {planet: 'Earth'}}, function (err:Error, docs:Array) { + // docs contains Mars, Jupiter, Omicron Persei 8 +}); + +db.find({ + $where: function () { + return parseInt(Object.keys(this)[0]) > 6; + } +}, function (err:Error, docs:Array) { + // docs with more than 6 properties +}); + +// You can mix normal queries, comparison queries and logical operators +db.find({$or: [{planet: 'Earth'}, {planet: 'Mars'}], inhabited: true}, function (err:Error, docs:Array) { + // docs contains Earth +}); + +// No query used means all results are returned (before the Cursor modifiers) +db.find({}).sort({planet: 1}).skip(1).limit(2).exec(function (err:Error, docs:Array) { + // docs is [doc3, doc1] +}); + +// You can sort in reverse order like this +db.find({system: 'solar'}).sort({planet: -1}).exec(function (err:Error, docs:Array) { + // docs is [doc1, doc3, doc2] +}); + +// You can sort on one field, then another, and so on like this: +db.find({}).sort({firstField: 1, secondField: -1}); + +// Same database as above + +// Keeping only the given fields +db.find({planet: 'Mars'}, {planet: 1, system: 1}, function (err:Error, docs:Array) { + // docs is [{ planet: 'Mars', system: 'solar', _id: 'id1' }] +}); + +// Keeping only the given fields but removing _id +db.find({planet: 'Mars'}, {planet: 1, system: 1, _id: 0}, function (err:Error, docs:Array) { + // docs is [{ planet: 'Mars', system: 'solar' }] +}); + +// Omitting only the given fields and removing _id +db.find({planet: 'Mars'}, {planet: 0, system: 0, _id: 0}, function (err:Error, docs:Array) { + // docs is [{ inhabited: false, satellites: ['Phobos', 'Deimos'] }] +}); + +// Failure: using both modes at the same time +db.find({planet: 'Mars'}, {planet: 0, system: 1}, function (err:Error, docs:Array) { + // err is the error message, docs is undefined +}); + +// You can also use it in a Cursor way but this syntax is not compatible with MongoDB +// If upstream compatibility is important don't use this method +db.find({planet: 'Mars'}).projection({planet: 1, system: 1}).exec(function (err:Error, docs:Array) { + // docs is [{ planet: 'Mars', system: 'solar', _id: 'id1' }] +}); + +// Count all planets in the solar system +db.count({system: 'solar'}, function (err:Error, count:number) { + // count equals to 3 +}); + +// Count all documents in the datastore +db.count({}, function (err:Error, count:number) { + // count equals to 4 +}); + +// Let's use the same example collection as in the "finding document" part +// { _id: 'id1', planet: 'Mars', system: 'solar', inhabited: false } +// { _id: 'id2', planet: 'Earth', system: 'solar', inhabited: true } +// { _id: 'id3', planet: 'Jupiter', system: 'solar', inhabited: false } +// { _id: 'id4', planet: 'Omicron Persia 8', system: 'futurama', inhabited: true } + +// Replace a document by another +db.update({planet: 'Jupiter'}, {planet: 'Pluton'}, {}, function (err:Error, numReplaced:number) { + // numReplaced = 1 + // The doc #3 has been replaced by { _id: 'id3', planet: 'Pluton' } + // Note that the _id is kept unchanged, and the document has been replaced + // (the 'system' and inhabited fields are not here anymore) +}); + +// Set an existing field's value +db.update({system: 'solar'}, {$set: {system: 'solar system'}}, {multi: true}, function (err:Error, numReplaced:number) { + // numReplaced = 3 + // Field 'system' on Mars, Earth, Jupiter now has value 'solar system' +}); + +// Setting the value of a non-existing field in a subdocument by using the dot-notation +db.update({planet: 'Mars'}, {$set: {"data.satellites": 2, "data.red": true}}, {}, function () { + // Mars document now is { _id: 'id1', system: 'solar', inhabited: false + // , data: { satellites: 2, red: true } + // } + // Not that to set fields in subdocuments, you HAVE to use dot-notation + // Using object-notation will just replace the top-level field + db.update({planet: 'Mars'}, {$set: {data: {satellites: 3}}}, {}, function () { + // Mars document now is { _id: 'id1', system: 'solar', inhabited: false + // , data: { satellites: 3 } + // } + // You lost the "data.red" field which is probably not the intended behavior + }); +}); + +// Deleting a field +db.update({planet: 'Mars'}, {$unset: {planet: true}}, {}, function () { + // Now the document for Mars doesn't contain the planet field + // You can unset nested fields with the dot notation of course +}); + +// Upserting a document +db.update({planet: 'Pluton'}, { + planet: 'Pluton', + inhabited: false +}, {upsert: true}, function (err:Error, numReplaced:number, upsert:boolean) { + // numReplaced = 1, upsert = { _id: 'id5', planet: 'Pluton', inhabited: false } + // A new document { _id: 'id5', planet: 'Pluton', inhabited: false } has been added to the collection +}); + +// If you upsert with a modifier, the upserted doc is the query modified by the modifier +// This is simpler than it sounds :) +db.update({planet: 'Pluton'}, {$inc: {distance: 38}}, {upsert: true}, function () { + // A new document { _id: 'id5', planet: 'Pluton', distance: 38 } has been added to the collection +}); + +// If we insert a new document { _id: 'id6', fruits: ['apple', 'orange', 'pear'] } in the collection, +// let's see how we can modify the array field atomically + +// $push inserts new elements at the end of the array +db.update({_id: 'id6'}, {$push: {fruits: 'banana'}}, {}, function () { + // Now the fruits array is ['apple', 'orange', 'pear', 'banana'] +}); + +// $pop removes an element from the end (if used with 1) or the front (if used with -1) of the array +db.update({_id: 'id6'}, {$pop: {fruits: 1}}, {}, function () { + // Now the fruits array is ['apple', 'orange'] + // With { $pop: { fruits: -1 } }, it would have been ['orange', 'pear'] +}); + +// $addToSet adds an element to an array only if it isn't already in it +// Equality is deep-checked (i.e. $addToSet will not insert an object in an array already containing the same object) +// Note that it doesn't check whether the array contained duplicates before or not +db.update({_id: 'id6'}, {$addToSet: {fruits: 'apple'}}, {}, function () { + // The fruits array didn't change + // If we had used a fruit not in the array, e.g. 'banana', it would have been added to the array +}); + +// $pull removes all values matching a value or even any NeDB query from the array +db.update({_id: 'id6'}, {$pull: {fruits: 'apple'}}, {}, function () { + // Now the fruits array is ['orange', 'pear'] +}); +db.update({_id: 'id6'}, {$pull: {fruits: {$in: ['apple', 'pear']}}}, {}, function () { + // Now the fruits array is ['orange'] +}); + + +// $each can be used to $push or $addToSet multiple values at once +// This example works the same way with $addToSet +db.update({_id: 'id6'}, {$push: {fruits: {$each: ['banana', 'orange']}}}, {}, function () { + // Now the fruits array is ['apple', 'orange', 'pear', 'banana', 'orange'] +}); + +// Let's use the same example collection as in the "finding document" part +// { _id: 'id1', planet: 'Mars', system: 'solar', inhabited: false } +// { _id: 'id2', planet: 'Earth', system: 'solar', inhabited: true } +// { _id: 'id3', planet: 'Jupiter', system: 'solar', inhabited: false } +// { _id: 'id4', planet: 'Omicron Persia 8', system: 'futurama', inhabited: true } + +// Remove one document from the collection +// options set to {} since the default for multi is false +db.remove({_id: 'id2'}, {}, function (err:Error, numRemoved:number) { + // numRemoved = 1 +}); + +// Remove multiple documents +db.remove({system: 'solar'}, {multi: true}, function (err:Error, numRemoved:number) { + // numRemoved = 3 + // All planets from the solar system were removed +}); + +db.ensureIndex({fieldName: 'somefield'}, function (err:Error) { + // If there was an error, err is not null +}); + +// Using a unique constraint with the index +db.ensureIndex({fieldName: 'somefield', unique: true}, function (err:Error) { +}); + +// Using a sparse unique index +db.ensureIndex({fieldName: 'somefield', unique: true, sparse: true}, function (err:Error) { +}); + + +// Format of the error message when the unique constraint is not met +db.insert({somefield: 'nedb'}, function (err:Error) { + // err is null + db.insert({somefield: 'nedb'}, function (err:Error) { + // err is { errorType: 'uniqueViolated' + // , key: 'name' + // , message: 'Unique constraint violated for key name' } + }); +}); + +// Remove index on field somefield +db.removeIndex('somefield', function (err:Error) { +}); \ No newline at end of file diff --git a/nedb/nedb.d.ts b/nedb/nedb.d.ts new file mode 100644 index 000000000..3207796d4 --- /dev/null +++ b/nedb/nedb.d.ts @@ -0,0 +1,207 @@ +// Type definitions for NeDB +// Project: https://github.com/louischatriot/nedb +// Definitions by: Stefan Steinhart +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "nedb" { + + class NeDBDataStore { + + constructor(); + constructor(path:string); + constructor(options:NeDB.DataStoreOptions); + + persistence:NeDB.Persistence; + + /** + * Load the database from the datafile, and trigger the execution of buffered commands if any + */ + loadDatabase(cb?:(err:Error)=>void):void; + + /** + * Get an array of all the data in the database + */ + getAllData():Array; + + + /** + * Reset all currently defined indexes + */ + resetIndexes(newData:any):void; + + /** + * Ensure an index is kept for this field. Same parameters as lib/indexes + * For now this function is synchronous, we need to test how much time it takes + * We use an async API for consistency with the rest of the code + * @param {String} options.fieldName + * @param {Boolean} options.unique + * @param {Boolean} options.sparse + * @param {Function} cb Optional callback, signature: err + */ + ensureIndex(options:NeDB.EnsureIndexOptions, cb?:(err:Error)=>void):void; + + /** + * Remove an index + * @param {String} fieldName + * @param {Function} cb Optional callback, signature: err + */ + removeIndex(fieldName:string, cb?:(err:Error)=>void):void; + + /** + * Add one or several document(s) to all indexes + */ + addToIndexes(doc:T):void; + addToIndexes(doc:Array):void; + + /** + * Remove one or several document(s) from all indexes + */ + removeFromIndexes(doc:T):void; + removeFromIndexes(doc:Array):void; + + /** + * Update one or several documents in all indexes + * To update multiple documents, oldDoc must be an array of { oldDoc, newDoc } pairs + * If one update violates a constraint, all changes are rolled back + */ + updateIndexes(oldDoc:T, newDoc:T):void; + updateIndexes(updates:Array<{oldDoc:T; newDoc:T;}>):void; + + /** + * Return the list of candidates for a given query + * Crude implementation for now, we return the candidates given by the first usable index if any + * We try the following query types, in this order: basic match, $in match, comparison match + * One way to make it better would be to enable the use of multiple indexes if the first usable index + * returns too much data. I may do it in the future. + * + * TODO: needs to be moved to the Cursor module + */ + getCandidates(query:any):void; + + /** + * Insert a new document + * @param {Function} cb Optional callback, signature: err, insertedDoc + */ + insert(newDoc:T, cb?:(err:Error, document:T)=>void):void; + + /** + * Count all documents matching the query + * @param {any} query MongoDB-style query + */ + count(query:any, callback:(err:Error, n:number)=>void):void; + count(query:any):NeDB.CursorCount; + + /** + * Find all documents matching the query + * If no callback is passed, we return the cursor so that user can limit, skip and finally exec + * @param {any} query MongoDB-style query + * @param {any} projection MongoDB-style projection + */ + find(query:any, projection:T, callback:(err:Error, documents:Array)=>void):void; + find(query:any, projection:T):NeDB.Cursor; + + /** + * Find all documents matching the query + * If no callback is passed, we return the cursor so that user can limit, skip and finally exec + * * @param {any} query MongoDB-style query + */ + find(query:any, callback:(err:Error, documents:Array)=>void):void; + find(query:any):NeDB.Cursor; + + /** + * Find one document matching the query + * @param {any} query MongoDB-style query + * @param {any} projection MongoDB-style projection + */ + findOne(query:any, projection:T, callback:(err:Error, document:T)=>void):void; + + /** + * Find one document matching the query + * @param {any} query MongoDB-style query + */ + findOne(query:any, callback:(err:Error, document:T)=>void):void; + + /** + * Update all docs matching query + * For now, very naive implementation (recalculating the whole database) + * @param {any} query + * @param {any} updateQuery + * @param {Object} options Optional options + * options.multi If true, can update multiple documents (defaults to false) + * options.upsert If true, document is inserted if the query doesn't match anything + * @param {Function} cb Optional callback, signature: err, numReplaced, upsert (set to true if the update was in fact an upsert) + * + * @api private Use Datastore.update which has the same signature + */ + update(query:any, updateQuery:any, options?:NeDB.UpdateOptions, cb?:(err:Error, numberOfUpdated:number, upsert:boolean)=>void):void; + + /** + * Remove all docs matching the query + * For now very naive implementation (similar to update) + * @param {Object} query + * @param {Object} options Optional options + * options.multi If true, can update multiple documents (defaults to false) + * @param {Function} cb Optional callback, signature: err, numRemoved + * + * @api private Use Datastore.remove which has the same signature + */ + remove(query:any, options:NeDB.RemoveOptions, cb?:(err:Error, n:number)=>void):void; + remove(query:any, cb?:(err:Error, n:number)=>void):void; + } + + export = NeDBDataStore; +} + +declare module NeDB { + + interface Cursor { + sort(query:any):Cursor; + skip(n:number):Cursor; + limit(n:number):Cursor; + projection(query:any):Cursor; + exec(callback:(err:Error, documents:Array)=>void):void; + } + + interface CursorCount { + exec(callback:(err:Error, count:number)=>void):void; + } + + interface DataStoreOptions { + filename?:string // Optional, datastore will be in-memory only if not provided + inMemoryOnly?:boolean // Optional, default to false + nodeWebkitAppName?:boolean // Optional, specify the name of your NW app if you want options.filename to be relative to the directory where + autoload?:boolean // Optional, defaults to false + onload?:(error:Error)=>any // Optional, if autoload is used this will be called after the load database with the error object as parameter. If you don't pass it the error will be thrown + afterSerialization?:(line:string)=>string; // (optional): hook you can use to transform data after it was serialized and before it is written to disk. Can be used for example to encrypt data before writing database to disk. This function takes a string as parameter (one line of an NeDB data file) and outputs the transformed string, which must absolutely not contain a \n character (or data will be lost) + beforeDeserialization?:(line:string)=>string; // (optional): reverse of afterSerialization. Make sure to include both and not just one or you risk data loss. For the same reason, make sure both functions are inverses of one another. Some failsafe mechanisms are in place to prevent data loss if you misuse the serialization hooks: NeDB checks that never one is declared without the other, and checks that they are reverse of one another by testing on random strings of various lengths. In addition, if too much data is detected as corrupt, NeDB will refuse to start as it could mean you're not using the deserialization hook corresponding to the serialization hook used before (see below) + corruptAlertThreshold?:number; // (optional): between 0 and 1, defaults to 10%. NeDB will refuse to start if more than this percentage of the datafile is corrupt. 0 means you don't tolerate any corruption, 1 means you don't care + } + + /** + * multi (defaults to false) which allows the modification of several documents if set to true + * upsert (defaults to false) if you want to insert a new document corresponding to the update rules if your query doesn't match anything + */ + interface UpdateOptions { + multi?: boolean; + upsert?: boolean; + } + + /** + * options only one option for now: multi which allows the removal of multiple documents if set to true. Default is false + */ + interface RemoveOptions { + multi?:boolean + } + + interface EnsureIndexOptions { + fieldName:string; + unique?:boolean; + sparse?:boolean; + } + + interface Persistence { + compactDatafile():void; + setAutocompactionInterval(interval:number):void; + stopAutocompaction():void; + } +} \ No newline at end of file From 165746e355b5c9cfe0cd6cec8ae789a31aced625 Mon Sep 17 00:00:00 2001 From: reppners Date: Mon, 2 Feb 2015 11:54:17 +0100 Subject: [PATCH 33/54] + added missing type definition of ensureDir() method --- fs-extra/fs-extra.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/fs-extra/fs-extra.d.ts b/fs-extra/fs-extra.d.ts index 3d1af12ac..5b1ecf0b9 100644 --- a/fs-extra/fs-extra.d.ts +++ b/fs-extra/fs-extra.d.ts @@ -164,6 +164,7 @@ declare module "fs-extra" { export function watch(filename: string, options?: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; export function exists(path: string, callback?: (exists: boolean) => void ): void; export function existsSync(path: string): boolean; + export function ensureDir(path: string, cb: (err: Error) => void): void; export interface OpenOptions { encoding?: string; From 76b96d4775dd158334a7982e1d4bb5815a5c8c64 Mon Sep 17 00:00:00 2001 From: ryiwamoto Date: Mon, 2 Feb 2015 21:00:06 +0900 Subject: [PATCH 34/54] add type annotations --- flot/jquery.flot.d.ts | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/flot/jquery.flot.d.ts b/flot/jquery.flot.d.ts index 1f6cf71cb..62054809b 100644 --- a/flot/jquery.flot.d.ts +++ b/flot/jquery.flot.d.ts @@ -173,6 +173,11 @@ declare module jquery.flot { y: number; } + interface offset { + left: number; + top: number; + } + interface canvasPoint { top: number; left: number; @@ -188,24 +193,24 @@ declare module jquery.flot { } interface axis extends axisOptions { - p2c(point):canvasPoint; - c2p(canvasPoint):point; + p2c(point: point):canvasPoint; + c2p(canvasPoint: canvasPoint):point; } interface plot { - highlight(series: dataSeries, datapoint: item); - unhightlight(); - unhighlight(series: dataSeries, datapoint: item); - setData(data: any); - setupGrid(); - draw(); - triggerRedrawOverlay(); - width(); - height(); - offset(); - pointOffset(point: point); - resize(); - shutdown(); + highlight(series: dataSeries, datapoint: item): void; + unhightlight(): void; + unhighlight(series: dataSeries, datapoint: item): void; + setData(data: any): void; + setupGrid(): void; + draw(): void; + triggerRedrawOverlay(): void; + width(): number; + height(): number; + offset(): JQueryCoordinates; + pointOffset(point: point): offset; + resize(): void; + shutdown(): void; getData(): dataSeries[]; getAxes(): axes; getPlaceholder(): JQuery; From 0a7d1f04b029ce02c01b1fcc6f21f4f0e922b41a Mon Sep 17 00:00:00 2001 From: ryiwamoto Date: Mon, 2 Feb 2015 21:35:51 +0900 Subject: [PATCH 35/54] update jquery.flot.d.ts --- flot/jquery.flot.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/flot/jquery.flot.d.ts b/flot/jquery.flot.d.ts index 62054809b..9ea862c5c 100644 --- a/flot/jquery.flot.d.ts +++ b/flot/jquery.flot.d.ts @@ -193,6 +193,7 @@ declare module jquery.flot { } interface axis extends axisOptions { + options: axisOptions; p2c(point: point):canvasPoint; c2p(canvasPoint: canvasPoint):point; } @@ -213,6 +214,8 @@ declare module jquery.flot { shutdown(): void; getData(): dataSeries[]; getAxes(): axes; + getXAxes(): axis[]; + getYAxes(): axis[]; getPlaceholder(): JQuery; getCanvas(): HTMLCanvasElement; getPlotOffset(): canvasPoint; From 61e79e78dbc0c9027e6ef30a9fe4faa679d85eda Mon Sep 17 00:00:00 2001 From: Adam Robins Date: Mon, 2 Feb 2015 16:08:49 +0000 Subject: [PATCH 36/54] addAxis interface Can now have stock definition to add an Axis dynamically. --- highcharts/highcharts.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 0ba39aa14..79be054ac 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -990,6 +990,7 @@ interface HighchartsChartObject { addSeries(options: HighchartsSeriesOptions, redraw: boolean): HighchartsSeriesOptions; addSeries(options: HighchartsSeriesOptions, redraw: boolean, animation: boolean): HighchartsSeriesOptions; addSeries(options: HighchartsSeriesOptions, redraw: boolean, animation: HighchartsAnimation): HighchartsSeriesOptions; + addAxis(options: HighchartsAxisOptions): HighchartsAxisObject; container: HTMLElement; destroy(): void; exportChart(): void; From 23b6edd28c0f5ccbe9e01bcfc84963d07b921ff7 Mon Sep 17 00:00:00 2001 From: vvakame Date: Tue, 3 Feb 2015 12:26:42 +0900 Subject: [PATCH 37/54] update CONTRIBUTORS.md --- CONTRIBUTORS.md | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 345527262..172ddfd80 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -2,6 +2,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakame/dt-contributors-generator). (but run scripts are manual operation. please wait :P) +* [:link:](acc-wizard/acc-wizard.d.ts) [acc-wizard](https://github.com/sathomas/acc-wizard) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](accounting/accounting.d.ts) [accounting.js](http://josscrowcroft.github.io/accounting.js) by [Sergey Gerasimov](https://github.com/gerich-home) * [:link:](ace/ace.d.ts) [Ace Ajax.org Cloud9 Editor](http://ace.ajax.org) by [Diullei Gomes](https://github.com/Diullei) * [:link:](add2home/add2home.d.ts) [add2home](http://cubiq.org/add-to-home-screen) by [James Wilkins](http://www.codeplex.com/site/users/view/jamesnw) @@ -73,10 +74,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](bootstrap-notify/bootstrap-notify.d.ts) [bootstrap-notify](https://github.com/Nijikokun/bootstrap-notify) by [Blake Niemyjski](https://github.com/niemyjski) * [:link:](bootstrap.datepicker/bootstrap.datepicker.d.ts) [bootstrap.datepicker](https://github.com/eternicode/bootstrap-datepicker) by [Boris Yankov](https://github.com/borisyankov) * [:link:](bootstrap.paginator/bootstrap.paginator.d.ts) [bootstrap.paginator](https://github.com/lyonlai/bootstrap-paginator) by [derikwhittaker](https://github.com/derikwhittaker) -* [:link:](box2d/box2dweb.d.ts) [bootstrap.timepicker](http://code.google.com/p/box2dweb) by [jbaldwin](https://github.com/jbaldwin) * [:link:](bootstrap.timepicker/bootstrap.timepicker.d.ts) [bootstrap.timepicker](https://github.com/jdewit/bootstrap-timepicker) by [derikwhittaker](https://github.com/derikwhittaker) +* [:link:](box2d/box2dweb.d.ts) [bootstrap.timepicker](http://code.google.com/p/box2dweb) by [jbaldwin](https://github.com/jbaldwin) * [:link:](breeze/breeze.d.ts) [Breeze](http://www.breezejs.com) by [Boris Yankov](https://github.com/borisyankov), [IdeaBlade](https://github.com/IdeaBlade/Breeze) * [:link:](browser-harness/browser-harness.d.ts) [Browser Harness](https://github.com/scriby/browser-harness) by [Chris Scribner](https://github.com/scriby) +* [:link:](browser-sync/browser-sync.d.ts) [browser-sync](http://www.browsersync.io) by [Asana](https://asana.com) * [:link:](browserify/browserify.d.ts) [Browserify](http://browserify.org) by [Andrew Gaspar](https://github.com/AndrewGaspar) * [:link:](bucks/bucks.d.ts) [bucks.js](https://github.com/CyberAgent/bucks.js) by [Shunsuke Ohtani](https://github.com/zaneli) * [:link:](buffer-equal/buffer-equal.d.ts) [buffer-equal](https://github.com/substack/node-buffer-equal) by [Bart van der Schoor](https://github.com/Bartvds) @@ -136,6 +138,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](debug/debug.d.ts) [debug](https://github.com/visionmedia/debug) by [Seon-Wook Park](https://github.com/swook) * [:link:](deep-diff/deep-diff.d.ts) [deep-diff](https://github.com/flitbit/diff) by [ZauberNerd](https://github.com/ZauberNerd) * [:link:](deep-freeze/deep-freeze.d.ts) [deep-freeze](https://github.com/substack/deep-freeze) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](del/del.d.ts) [del](https://github.com/sindresorhus/del) by [Asana](https://asana.com) * [:link:](deployJava/deployJava.d.ts) [deployJava.js](https://www.java.com/js/deployJava.txt) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](detect-indent/detect-indent.d.ts) [detect-indent](https://github.com/sindresorhus/detect-indent) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](devextreme/dx.devextreme.d.ts) [DevExtreme](http://js.devexpress.com) by [DevExpress Inc.](http://devexpress.com) @@ -153,6 +156,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](doublearray/doublearray.d.ts) [doublearray](https://github.com/takuyaa/doublearray) by [MIZUSHIMA Junki](https://github.com/mzsm) * [:link:](dropboxjs/dropboxjs.d.ts) [dropbox-js](https://github.com/dropbox/dropbox-js) by [Steve Fenton](https://github.com/Steve-Fenton), [Pedro Casaubon](https://github.com/xperiments) * [:link:](dropzone/dropzone.d.ts) [Dropzone](http://www.dropzonejs.com) by [Natan Vivo](https://github.com/nvivo) +* [:link:](dts-bundle/dts-bundle.d.ts) [dts-bundle](https://github.com/TypeStrong/dts-bundle) by [Asana](https://asana.com) * [:link:](durandal/durandal.d.ts) [Durandal](http://durandaljs.com) by [Blue Spire](https://github.com/BlueSpire) * [:link:](easeljs/easeljs.d.ts) [EaselJS](http://www.createjs.com/#!/EaselJS) by [Pedro Ferreira](https://bitbucket.org/drk4), [Chris Smith](https://github.com/evilangelist) * [:link:](easy-table/easy-table.d.ts) [easy-table](https://github.com/eldargab/easy-table) by [Bart van der Schoor](https://github.com/Bartvds) @@ -167,7 +171,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](emscripten/emscripten.d.ts) [Emscripten](http://kripken.github.io/emscripten-site/index.html) by [Kensuke Matsuzaki](https://github.com/zakki) * [:link:](epiceditor/epiceditor.d.ts) [EpicEditor](http://epiceditor.com) by [Boris Yankov](https://github.com/borisyankov) * [:link:](errorhandler/errorhandler.d.ts) [errorhandler](https://github.com/expressjs/errorhandler) by [Santi Albo](https://github.com/santialbo) -* [:link:](es6-promise/es6-promise.d.ts) [es6-promise](https://github.com/jakearchibald/ES6-Promise) by [François de Campredon](https://github.com/fdecampredon) +* [:link:](es6-promise/es6-promise.d.ts) [es6-promise](https://github.com/jakearchibald/ES6-Promise) by [François de Campredon](https://github.com/fdecampredon), [vvakame](https://github.com/vvakame) * [:link:](esprima/esprima.d.ts) [Esprima](http://esprima.org) by [teppeis](https://github.com/teppeis) * [:link:](eventemitter2/eventemitter2.d.ts) [EventEmitter2](https://github.com/asyncly/EventEmitter2) by [ryiwamoto](https://github.com/ryiwamoto) * [:link:](exit/exit.d.ts) [exit](https://github.com/cowboy/node-exit) by [Bart van der Schoor](https://github.com/Bartvds) @@ -240,8 +244,20 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](gridfs-stream/gridfs-stream.d.ts) [gridfs-stream](https://github.com/aheckmann/gridfs-stream) by [Lior Mualem](https://github.com/liorm) * [:link:](gruntjs/gruntjs.d.ts) [Grunt 0.4.x](http://gruntjs.com) by [Jeff May](https://github.com/jeffmay), [Basarat Ali Syed](https://github.com/basarat) * [:link:](gulp/gulp.d.ts) [Gulp v3.8.x](http://gulpjs.com) by [Drew Noakes](https://drewnoakes.com) +* [:link:](gulp-autoprefixer/gulp-autoprefixer.d.ts) [gulp-autoprefixer](https://github.com/sindresorhus/gulp-autoprefixer) by [Asana](https://asana.com) +* [:link:](gulp-gh-pages/gulp-gh-pages.d.ts) [gulp-gh-pages](https://github.com/rowoot/gulp-gh-pages) by [Asana](https://asana.com) +* [:link:](gulp-if/gulp-if.d.ts) [gulp-if](https://github.com/robrich/gulp-if) by [Asana](https://asana.com) +* [:link:](gulp-istanbul/gulp-istanbul.d.ts) [gulp-istanbul](https://github.com/SBoudrias/gulp-istanbul) by [Asana](https://asana.com) +* [:link:](gulp-mocha/gulp-mocha.d.ts) [gulp-mocha](https://github.com/sindresorhus/gulp-mocha) by [Asana](https://asana.com) +* [:link:](gulp-rename/gulp-rename.d.ts) [gulp-rename](https://github.com/hparra/gulp-rename) by [Asana](https://asana.com) +* [:link:](gulp-replace/gulp-replace.d.ts) [gulp-replace](https://github.com/lazd/gulp-replace) by [Asana](https://asana.com) +* [:link:](gulp-sass/gulp-sass.d.ts) [gulp-sass](https://github.com/dlmanning/gulp-sass) by [Asana](https://asana.com) +* [:link:](gulp-sourcemaps/gulp-sourcemaps.d.ts) [gulp-sourcemaps](https://github.com/floridoo/gulp-sourcemaps) by [Asana](https://asana.com) +* [:link:](gulp-tslint/gulp-tslint.d.ts) [gulp-tslint](https://github.com/panuhorsmalahti/gulp-tslint) by [Asana](https://asana.com) +* [:link:](gulp-typedoc/gulp-typedoc.d.ts) [gulp-typedoc](https://github.com/rogierschouten/gulp-typedoc) by [Asana](https://asana.com) +* [:link:](gulp-typescript/gulp-typescript.d.ts) [gulp-typescript](https://github.com/ivogabe/gulp-typescript) by [Asana](https://asana.com) * [:link:](gulp-util/gulp-util.d.ts) [gulp-util v3.0.x](https://github.com/gulpjs/gulp-util) by [jedmao](https://github.com/jedmao) -* [:link:](hammerjs/hammerjs.d.ts) [Hammer.js](http://hammerjs.github.io) by [Philip Bulley](https://github.com/milkisevil) +* [:link:](hammerjs/hammerjs.d.ts) [Hammer.js](http://hammerjs.github.io) by [Philip Bulley](https://github.com/milkisevil), [Han Lin Yap](https://github.com/codler) * [:link:](handlebars/handlebars.d.ts) [Handlebars](http://handlebarsjs.com) by [Boris Yankov](https://github.com/borisyankov) * [:link:](hapi/hapi.d.ts) [hapi](http://github.com/spumko/hapi) by [Hakubo](http://github.com/hakubo) * [:link:](hashmap/hashmap.d.ts) [HashMap](https://github.com/flesler/hashmap) by [Rafał Wrzeszcz](http://wrzasq.pl) @@ -260,6 +276,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](humane/humane.d.ts) [Humane](http://wavded.github.com/humane-js) by [jmvrbanac](https://github.com/jmvrbanac) * [:link:](i18n-node/i18n-node.d.ts) [i18n-node](https://github.com/mashpie/i18n-node) by [Maxime LUCE](https://github.com/SomaticIT) * [:link:](i18next/i18next.d.ts) [i18next](http://i18next.com) by [Maarten Docter](https://github.com/mdocter) +* [:link:](iban/iban.d.ts) [iban.js](https://github.com/arhs/iban.js) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](icheck/icheck.d.ts) [iCheck](http://damirfoy.com/iCheck) by [Dániel Tar](https://github.com/qcz) * [:link:](imagemagick/imagemagick.d.ts) [imagemagick](http://github.com/rsms/node-imagemagick) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](imap/imap.d.ts) [imap](https://www.npmjs.com/package/imap) by [Peter Snider](https://github.com/psnider) @@ -325,6 +342,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.colorbox/jquery.colorbox.d.ts) [jQuery.Colorbox](http://www.jacklmoore.com/colorbox) by [Gidon Junge](https://github.com/gjunge) * [:link:](jquery.customSelect/jquery.customSelect.d.ts) [jquery.customSelect.js](http://adam.co/lab/jquery/customselect/) by [adamcoulombe](https://github.com/adamcoulombe) * [:link:](jquery.cycle/jquery.cycle.d.ts) [jQuery.cycle.js](http://jquery.malsup.com/cycle) by [François Guillot](http://fguillot.developpez.com) +* [:link:](jquery.dropotron/jquery.dropotron.d.ts) [jquery.dropotron](https://github.com/n33/jquery.dropotron) by [Cyril Schumacher](https://github.com/cyrilschumacher) * [:link:](jquery.dynatree/jquery.dynatree.d.ts) [jquery.dynatree](http://code.google.com/p/dynatree) by [François de Campredon](https://github.com/fdecampredon) * [:link:](jquery.fancytree/jquery.fancytree.d.ts) [jquery.fancytree](https://github.com/mar10/fancytree) by [Peter Palotas](https://github.com/alphaleonis) * [:link:](jquery.finger/jquery.finger.d.ts) [jquery.finger.js](http://ngryman.sh/jquery.finger) by [Max Ackley](https://github.com/maxackley) @@ -469,7 +487,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](mu2/mu2.d.ts) [mu2](http://github.com/raycmorgan/mu) by [Jeff Goddard](https://github.com/jedigo) * [:link:](multer/multer.d.ts) [multer](https://github.com/expressjs/multer) by [jt000](https://github.com/jt000) * [:link:](mustache/mustache.d.ts) [Mustache](https://github.com/janl/mustache.js) by [Mark Ashley Bell](https://github.com/markashleybell) -* [:link:](nconf/nconf.d.ts) [nconf](https://github.com/flatiron/nconf) by [Jeff Goddard](https://github.com/jedigo) +* [:link:](nconf/nconf.d.ts) [nconf](https://github.com/flatiron/nconf) by [Jeff Goddard](https://github.com/jedigo), [Jean-Martin Thibault](https://github.com/jmthibault) * [:link:](ncp/ncp.d.ts) [ncp](https://github.com/AvianFlu/ncp) by [Bart van der Schoor](https://github.com/bartvds) * [:link:](needle/needle.d.ts) [needle](https://github.com/tomas/needle) by [San Chen](https://github.com/bigsan) * [:link:](nexpect/nexpect.d.ts) [nexpect](https://github.com/nodejitsu/nexpect) by [vvakame](http://github.com/vvakame) @@ -502,11 +520,11 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](nodemailer/nodemailer.d.ts) [Nodemailer](https://github.com/andris9/Nodemailer) by [Vincent Bortone](https://github.com/vbortone) * [:link:](nodeunit/nodeunit.d.ts) [nodeunit](https://github.com/caolan/nodeunit) by [Jeff Goddard](https://github.com/jedigo) * [:link:](nomnom/nomnom.d.ts) [nomnom](https://github.com/harthur/nomnom) by [Paul Vick](https://github.com/panopticoncentral) -* [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker) * [:link:](notify/notify.d.ts) [Notify.js](https://github.com/jpillora/notifyjs) by [Xiaohan Zhang](https://github.com/hellochar) +* [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker) * [:link:](noVNC/noVNC.d.ts) [noVNC](https://github.com/kanaka/noVNC) by [Ken Smith](https://github.com/smithkl42) * [:link:](npm/npm.d.ts) [npm](https://github.com/npm/npm) by [Maxime LUCE](https://github.com/SomaticIT) -* [:link:](nprogress/nprogress.d.ts) [NProgress](https://github.com/rstacruz/nprogress) by [Judah Gabriel Himango](http://debuggerdotbreak.wordpress.com) +* [:link:](nprogress/NProgress.d.ts) [NProgress](https://github.com/rstacruz/nprogress) by [Judah Gabriel Himango](http://debuggerdotbreak.wordpress.com) * [:link:](numeraljs/numeraljs.d.ts) [Numeral.js](https://github.com/adamwdraper/Numeral-js) by [Vincent Bortone](https://github.com/vbortone) * [:link:](object-path/object-path.d.ts) [objectPath](https://github.com/mariocasciaro/object-path) by [Paulo Cesar](https://github.com/pocesar) * [:link:](oboe/oboe.d.ts) [oboe](https://github.com/jimhigson/oboe.js) by [Jared Klopper](https://github.com/optical) @@ -714,6 +732,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](vimeo/froogaloop.d.ts) [Vimeo](http://developer.vimeo.com/player/js-api) by [Daz Wilkin](https://github.com/DazWilkin) * [:link:](vinyl/vinyl.d.ts) [vinyl](https://github.com/wearefractal/vinyl) by [vvakame](https://github.com/vvakame), [jedmao](https://github.com/jedmao) * [:link:](vinyl-fs/vinyl-fs.d.ts) [vinyl-fs](https://github.com/wearefractal/vinyl-fs) by [vvakame](https://github.com/vvakame) +* [:link:](vinyl-source-stream/vinyl-source-stream.d.ts) [vinyl-source-stream](https://github.com/hughsk/vinyl-source-stream) by [Asana](https://asana.com) * [:link:](vue/vue.d.ts) [vuejs](https://github.com/yyx990803/vue) by [odangosan](https://github.com/odangosan) * [:link:](watch/watch.d.ts) [watch](https://github.com/mikeal/watch) by [Carlos Ballesteros Velasco](https://github.com/soywiz) * [:link:](jquery.watermark/jquery.watermark.d.ts) [Watermark plugin for jQuery](http://jquery-watermark.googlecode.com) by [Anwar Javed](https://github.com/anwarjaved) From 0fa2e9c38a40ff9a78251afb79b3bee615ad5336 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Tue, 3 Feb 2015 16:55:32 +0900 Subject: [PATCH 38/54] indices + tests --- webspeechapi/webspeechapi-tests.ts | 152 +++++++++++++++++++++++++++++ webspeechapi/webspeechapi.d.ts | 5 + 2 files changed, 157 insertions(+) create mode 100644 webspeechapi/webspeechapi-tests.ts diff --git a/webspeechapi/webspeechapi-tests.ts b/webspeechapi/webspeechapi-tests.ts new file mode 100644 index 000000000..3479f897d --- /dev/null +++ b/webspeechapi/webspeechapi-tests.ts @@ -0,0 +1,152 @@ +/// + +/* +Examples from the spec: +https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html#examples-recognition +*/ + +// 6.1 Speech Recognition Examples + +// Example 1 +declare var q: HTMLInputElement; +() => { + var recognition = new SpeechRecognition(); + recognition.onresult = function (event) { + if (event.results.length > 0) { + q.value = event.results[0][0].transcript; + q.form.submit(); + } + } +} + +// Example 2 +declare var select: HTMLSelectElement; +() => { + var recognition = new SpeechRecognition(); + recognition.maxAlternatives = 10; + recognition.onresult = function (event) { + if (event.results.length > 0) { + var result = event.results[0]; + for (var i = 0; i < result.length; ++i) { + var text = result[i].transcript; + select.options[i] = new Option(text, text); + } + } + } + + function start() { + select.options.length = 0; + recognition.start(); + } +} + +// Example 3 +/* +This example has some changes from the one in spec. +`var i = resultIndex` -> `var i = event.resultIndex` (Recorded as Errata 16) +`event.results.final` -> `event.results[i].final` +*/ +declare var textarea: HTMLTextAreaElement; +declare var button: HTMLButtonElement; +() => { + var recognizing: boolean; + var recognition = new SpeechRecognition(); + recognition.continuous = true; + reset(); + recognition.onend = reset; + + recognition.onresult = function (event) { + for (var i = event.resultIndex; i < event.results.length; ++i) { + if (event.results[i].final) { + textarea.value += event.results[i][0].transcript; + } + } + } + + function reset() { + recognizing = false; + button.innerHTML = "Click to Speak"; + } + + function toggleStartStop() { + if (recognizing) { + recognition.stop(); + reset(); + } else { + recognition.start(); + recognizing = true; + button.innerHTML = "Click to Stop"; + } + } +} + +// Example 4 +/* +This example has a change from the one in spec. +`recognition.interim = true;` -> `recognition.interimResults = true;` (Recorded as Errata 1) +*/ +declare var button: HTMLButtonElement; +declare var final_span: HTMLSpanElement; +declare var interim_span: HTMLSpanElement; +() => { + var recognizing: boolean; + var recognition = new SpeechRecognition(); + recognition.continuous = true; + recognition.interimResults = true; + reset(); + recognition.onend = reset; + + recognition.onresult = function (event) { + var final = ""; + var interim = ""; + for (var i = 0; i < event.results.length; ++i) { + if (event.results[i].final) { + final += event.results[i][0].transcript; + } else { + interim += event.results[i][0].transcript; + } + } + final_span.innerHTML = final; + interim_span.innerHTML = interim; + } + + function reset() { + recognizing = false; + button.innerHTML = "Click to Speak"; + } + + function toggleStartStop() { + if (recognizing) { + recognition.stop(); + reset(); + } else { + recognition.start(); + recognizing = true; + button.innerHTML = "Click to Stop"; + final_span.innerHTML = ""; + interim_span.innerHTML = ""; + } + } +} + + +// 6.2 Speech Synthesis Examples + +// Example 1 +/* +This example has a change from the one in spec. +`SpeechSynthesisUtterance('Hello World')` -> `new SpeechSynthesisUtterance('Hello World')` +*/ +() => { + speechSynthesis.speak(new SpeechSynthesisUtterance('Hello World')); +} + +//Example 2 +() => { + var u = new SpeechSynthesisUtterance(); + u.text = 'Hello World'; + u.lang = 'en-US'; + u.rate = 1.2; + u.onend = function (event) { alert('Finished in ' + event.elapsedTime + ' seconds.'); } + speechSynthesis.speak(u); +} \ No newline at end of file diff --git a/webspeechapi/webspeechapi.d.ts b/webspeechapi/webspeechapi.d.ts index a0c088bab..47e7ce561 100644 --- a/webspeechapi/webspeechapi.d.ts +++ b/webspeechapi/webspeechapi.d.ts @@ -46,12 +46,14 @@ interface SpeechRecognitionAlternative { interface SpeechRecognitionResult { length: number; item(index: number): SpeechRecognitionAlternative; + [index: number]: SpeechRecognitionAlternative; final: boolean; } interface SpeechRecognitionResultList { length: number; item(index: number): SpeechRecognitionResult; + [index: number]: SpeechRecognitionResult; } interface SpeechRecognitionEvent extends Event { @@ -75,6 +77,7 @@ declare var webkitSpeechGrammar: SpeechGrammarStatic; interface SpeechGrammarList { length: number; item(index: number): SpeechGrammar; + [index: number]: SpeechGrammar; addFromURI(src: string, weight: number): void; addFromString(string: string, weight: number): void; } @@ -102,6 +105,7 @@ interface SpeechSynthesisGetter { } interface Window extends SpeechSynthesisGetter { } +declare var speechSynthesis: SpeechSynthesis; interface SpeechSynthesisUtterance extends EventTarget { text: string; @@ -143,4 +147,5 @@ interface SpeechSynthesisVoice { interface SpeechSynthesisVoiceList { length: number; item(index: number): SpeechSynthesisVoice; + [index: number]: SpeechSynthesisVoice; } \ No newline at end of file From ec8cccc29b5f37df43a7dd56777dc09670a5e671 Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Tue, 3 Feb 2015 18:14:22 +0900 Subject: [PATCH 39/54] event fix + corrections from errata --- webspeechapi/webspeechapi-tests.ts | 11 ++++--- webspeechapi/webspeechapi.d.ts | 49 +++++++++++++++++++----------- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/webspeechapi/webspeechapi-tests.ts b/webspeechapi/webspeechapi-tests.ts index 3479f897d..91e623b0f 100644 --- a/webspeechapi/webspeechapi-tests.ts +++ b/webspeechapi/webspeechapi-tests.ts @@ -44,7 +44,7 @@ declare var select: HTMLSelectElement; /* This example has some changes from the one in spec. `var i = resultIndex` -> `var i = event.resultIndex` (Recorded as Errata 16) -`event.results.final` -> `event.results[i].final` +`event.results.final` -> `event.results[i].isFinal` (Recorded as Errata 02) */ declare var textarea: HTMLTextAreaElement; declare var button: HTMLButtonElement; @@ -57,7 +57,7 @@ declare var button: HTMLButtonElement; recognition.onresult = function (event) { for (var i = event.resultIndex; i < event.results.length; ++i) { - if (event.results[i].final) { + if (event.results[i].isFinal) { textarea.value += event.results[i][0].transcript; } } @@ -83,7 +83,8 @@ declare var button: HTMLButtonElement; // Example 4 /* This example has a change from the one in spec. -`recognition.interim = true;` -> `recognition.interimResults = true;` (Recorded as Errata 1) +`recognition.interim = true;` -> `recognition.interimResults = true;` (Recorded as Errata 01) +`event.results[i].final` -> `event.results[i].isFinal` (Recorded as Errata 02) */ declare var button: HTMLButtonElement; declare var final_span: HTMLSpanElement; @@ -100,7 +101,7 @@ declare var interim_span: HTMLSpanElement; var final = ""; var interim = ""; for (var i = 0; i < event.results.length; ++i) { - if (event.results[i].final) { + if (event.results[i].isFinal) { final += event.results[i][0].transcript; } else { interim += event.results[i][0].transcript; @@ -135,7 +136,7 @@ declare var interim_span: HTMLSpanElement; // Example 1 /* This example has a change from the one in spec. -`SpeechSynthesisUtterance('Hello World')` -> `new SpeechSynthesisUtterance('Hello World')` +`SpeechSynthesisUtterance('Hello World')` -> `new SpeechSynthesisUtterance('Hello World')` (Recorded as Errata 09) */ () => { speechSynthesis.speak(new SpeechSynthesisUtterance('Hello World')); diff --git a/webspeechapi/webspeechapi.d.ts b/webspeechapi/webspeechapi.d.ts index 47e7ce561..1b554af6a 100644 --- a/webspeechapi/webspeechapi.d.ts +++ b/webspeechapi/webspeechapi.d.ts @@ -3,6 +3,10 @@ // Definitions by: SaschaNaz // Definitions: https://github.com/borisyankov/DefinitelyTyped +// Spec version: 19 October 2012 +// Errata version: 6 June 2014 +// Corrected unofficial spec version: 6 June 2014 + interface SpeechRecognition extends EventTarget { grammars: SpeechGrammarList; lang: string; @@ -15,16 +19,16 @@ interface SpeechRecognition extends EventTarget { stop(): void; abort(): void; - onaudiostart: (ev: SpeechRecognitionEvent) => any; - onsoundstart: (ev: SpeechRecognitionEvent) => any; - onspeechstart: (ev: SpeechRecognitionEvent) => any; - onspeechend: (ev: SpeechRecognitionEvent) => any; - onsoundend: (ev: SpeechRecognitionEvent) => any; + onaudiostart: (ev: Event) => any; + onsoundstart: (ev: Event) => any; + onspeechstart: (ev: Event) => any; + onspeechend: (ev: Event) => any; + onsoundend: (ev: Event) => any; onresult: (ev: SpeechRecognitionEvent) => any; onnomatch: (ev: SpeechRecognitionEvent) => any; onerror: (ev: SpeechRecognitionError) => any; - onstart: (ev: SpeechRecognitionEvent) => any; - onend: (ev: SpeechRecognitionEvent) => any; + onstart: (ev: Event) => any; + onend: (ev: Event) => any; } interface SpeechRecognitionStatic { prototype: SpeechRecognition; @@ -47,7 +51,8 @@ interface SpeechRecognitionResult { length: number; item(index: number): SpeechRecognitionAlternative; [index: number]: SpeechRecognitionAlternative; - final: boolean; + /* Errata 02 */ + isFinal: boolean; } interface SpeechRecognitionResultList { @@ -88,16 +93,21 @@ interface SpeechGrammarListStatic { declare var SpeechGrammarList: SpeechGrammarListStatic; declare var webkitSpeechGrammarList: SpeechGrammarListStatic; -interface SpeechSynthesis { +/* Errata 08 */ +interface SpeechSynthesis extends EventTarget { pending: boolean; speaking: boolean; paused: boolean; + /* Errata 11 */ + onvoiceschanged: (ev: Event) => any; + speak(utterance: SpeechSynthesisUtterance): void; cancel(): void; pause(): void; resume(): void; - getVoices(): SpeechSynthesisVoiceList; + /* Errata 05 */ + getVoices(): SpeechSynthesisVoice[]; } interface SpeechSynthesisGetter { @@ -110,14 +120,16 @@ declare var speechSynthesis: SpeechSynthesis; interface SpeechSynthesisUtterance extends EventTarget { text: string; lang: string; - voiceURI: string; + /* Errata 07 */ + voice: SpeechSynthesisVoice; volume: number; rate: number; pitch: number; onstart: (ev: SpeechSynthesisEvent) => any; onend: (ev: SpeechSynthesisEvent) => any; - onerror: (ev: ErrorEvent) => any; + /* Errata 12 */ + onerror: (ev: SpeechSynthesisErrorEvent) => any; onpause: (ev: SpeechSynthesisEvent) => any; onresume: (ev: SpeechSynthesisEvent) => any; onmark: (ev: SpeechSynthesisEvent) => any; @@ -131,21 +143,22 @@ interface SpeechSynthesisUtteranceStatic { declare var SpeechSynthesisUtterance: SpeechSynthesisUtteranceStatic; interface SpeechSynthesisEvent extends Event { + /* Errata 08 */ + utterance: SpeechSynthesisUtterance; charIndex: number; elapsedTime: number; name: string; } +/* Errata 12 */ +interface SpeechSynthesisErrorEvent extends SpeechSynthesisEvent { + error: string; +} + interface SpeechSynthesisVoice { voiceURI: string; name: string; lang: string; localService: boolean; default: boolean; -} - -interface SpeechSynthesisVoiceList { - length: number; - item(index: number): SpeechSynthesisVoice; - [index: number]: SpeechSynthesisVoice; } \ No newline at end of file From dfd94df9d7634ca8f5ed2e137a69a7948ee14495 Mon Sep 17 00:00:00 2001 From: JCKodel Date: Tue, 3 Feb 2015 11:50:39 -0200 Subject: [PATCH 40/54] invokeApi support Added support for invokeApi call, with its related InvokeApiOptions. --- .../AzureMobileServicesClient.d.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/azure-mobile-services-client/AzureMobileServicesClient.d.ts b/azure-mobile-services-client/AzureMobileServicesClient.d.ts index 2aec11114..107cb242b 100644 --- a/azure-mobile-services-client/AzureMobileServicesClient.d.ts +++ b/azure-mobile-services-client/AzureMobileServicesClient.d.ts @@ -19,8 +19,17 @@ declare module Microsoft.WindowsAzure { logout(): void; getTable(tableName: string): MobileServiceTable; withFilter(serviceFilter: (request: any, next: (request: any, callback: (error:any, response: any) => void ) => void, callback: (error: any, response: any) => void ) => void ) : MobileServiceClient; + invokeApi(apiName: string, options?:InvokeApiOptions): asyncPromise; } + interface InvokeApiOptions + { + method?: string; + body?: any; + headers?: Object; + parameters?: Object; + } + // User object based on Microsoft Azure documentation: http://msdn.microsoft.com/en-us/library/windowsazure/jj554220.aspx interface User { getIdentities(): any;// { [providerName: string]: { userId: string, accessToken: string, accessTokenSecret?: string }; }; From afca0689f780a76f515e4674ae3cf95924cb0fb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Pa=CC=88rsson?= Date: Tue, 3 Feb 2015 15:24:11 +0100 Subject: [PATCH 41/54] Add support for chaining and calls on Jasmine spies --- jasmine/jasmine-tests.ts | 38 ++++++++++++++++++++++++++++++++++++++ jasmine/jasmine.d.ts | 8 ++++---- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/jasmine/jasmine-tests.ts b/jasmine/jasmine-tests.ts index 8a4a00e22..1a9b1b2e4 100644 --- a/jasmine/jasmine-tests.ts +++ b/jasmine/jasmine-tests.ts @@ -400,6 +400,44 @@ describe("A spy, when configured to throw a value", function () { }); }); +describe("A spy, when configured with multiple actions", function () { + var foo: any, bar: any, fetchedBar: any; + + beforeEach(function () { + foo = { + setBar: function (value: any) { + bar = value; + }, + getBar: function () { + return bar; + } + }; + + spyOn(foo, 'getBar').and.callThrough().and.callFake(() => { + this.fakeCalled = true; + }); + + foo.setBar(123); + fetchedBar = foo.getBar(); + }); + + it("tracks that the spy was called", function () { + expect(foo.getBar).toHaveBeenCalled(); + }); + + it("should not effect other functions", function () { + expect(bar).toEqual(123); + }); + + it("when called returns the requested value", function () { + expect(fetchedBar).toEqual(123); + }); + + it("should have called the fake implementation", function () { + expect(this.fakeCalled).toEqual(true); + }); +}); + describe("A spy", function () { var foo: any, bar: any = null; diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index e94e5fce1..6c323e146 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -1,6 +1,6 @@ // Type definitions for Jasmine 2.1 // Project: http://pivotal.github.com/jasmine/ -// Definitions by: Boris Yankov , Theodore Brown +// Definitions by: Boris Yankov , Theodore Brown , David Pärsson // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -372,15 +372,15 @@ declare module jasmine { interface SpyAnd { /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */ - callThrough(): void; + callThrough(): Spy; /** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */ returnValue(val: any): void; /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */ - callFake(fn: Function): void; + callFake(fn: Function): Spy; /** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */ throwError(msg: string): void; /** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */ - stub(): void; + stub(): Spy; } interface Calls { From 6f80a5812e78e69214c7c5b2158d3601bfea0af3 Mon Sep 17 00:00:00 2001 From: milkisevil Date: Tue, 3 Feb 2015 14:57:45 +0000 Subject: [PATCH 42/54] `srcEvent` now uses a union type (as introduced with Typescript 1.4) --- hammerjs/hammerjs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hammerjs/hammerjs.d.ts b/hammerjs/hammerjs.d.ts index 871cee299..6f19912d7 100644 --- a/hammerjs/hammerjs.d.ts +++ b/hammerjs/hammerjs.d.ts @@ -167,7 +167,7 @@ declare class HammerInput center:HammerPoint; /** Source event object, type TouchEvent, MouseEvent or PointerEvent. */ - srcEvent:Event; // TODO: Update to Union Type (TouchEvent | MouseEvent | PointerEvent) if it lands in TS1.4 + srcEvent:TouchEvent | MouseEvent | PointerEvent; /** Target that received the event. */ target:HTMLElement; From f56ac12afda50bd349e7a0d95b371a6e837c5200 Mon Sep 17 00:00:00 2001 From: milkisevil Date: Tue, 3 Feb 2015 15:19:02 +0000 Subject: [PATCH 43/54] Added reference to `touch-events/touch-events.d.ts` --- hammerjs/hammerjs.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hammerjs/hammerjs.d.ts b/hammerjs/hammerjs.d.ts index 6f19912d7..84d4f9431 100644 --- a/hammerjs/hammerjs.d.ts +++ b/hammerjs/hammerjs.d.ts @@ -3,6 +3,8 @@ // Definitions by: Philip Bulley , Han Lin Yap // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare var Hammer:HammerStatic; declare module "Hammer" { From c420b1fd87258b4f5d4c8d168be4a0e2a1707e5b Mon Sep 17 00:00:00 2001 From: Qinfeng Chen Date: Tue, 3 Feb 2015 11:09:26 -0500 Subject: [PATCH 44/54] add constraint typing for webcola --- webcola/webcola.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webcola/webcola.d.ts b/webcola/webcola.d.ts index b8794f31e..177039b13 100644 --- a/webcola/webcola.d.ts +++ b/webcola/webcola.d.ts @@ -30,6 +30,13 @@ declare module WebCola{ stop(): void; } + interface Constraint { + axis: string; + gap: number; + left: number; + right: number; + } + interface FlowLayout{ axis: string; minSeparation?: number; From 938122b49bc6c59bdc3553985965e635fbd516ed Mon Sep 17 00:00:00 2001 From: Eric Lu Date: Tue, 3 Feb 2015 10:07:56 -0800 Subject: [PATCH 45/54] Expose raw http server --- restify/restify.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index 6e0ee450a..7128ca3d0 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -95,6 +95,7 @@ declare module "restify" { listen(... args: any[]): any; close(... args: any[]): any; pre(routeCallBack: RequestHandler): any; + server: http.Server; } From 70ac4a78578ccadf99f0add17f6dfc0fdd9b498c Mon Sep 17 00:00:00 2001 From: "EWOUT-QMINO\\Ewout" Date: Wed, 4 Feb 2015 09:52:44 +0100 Subject: [PATCH 46/54] - Added findModelsFromPoint definition to Graph, Handle interface and SelectionView class definitions. --- jointjs/jointjs.d.ts | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts index c2ff9c1c7..9e6a2f0cc 100644 --- a/jointjs/jointjs.d.ts +++ b/jointjs/jointjs.d.ts @@ -24,6 +24,7 @@ declare module joint { getConnectedLinks(cell: Cell, opt?: any): Link[]; disconnectLinks(cell: Cell); removeLinks(cell: Cell); + findModelsFromPoint(point:{x : number; y: number}):Element[]; } class Cell extends Backbone.Model { @@ -95,7 +96,34 @@ declare module joint { } - module ui { } + module ui { + interface Handle { + name : string; + position : string; + icon: string; + } + + class SelectionView extends Backbone.Model { + paper:joint.dia.Paper; + graph:joint.dia.Graph; + model:Backbone.Collection; + + constructor(opt:{ + paper : joint.dia.Paper; + graph : joint.dia.Graph; + model : Backbone.Collection + }); + + createSelectionBox(cellView:joint.dia.CellView); + destroySelectionBox(cellView:joint.dia.CellView); + startSelecting(evt:any); + cancelSelection(); + + addHandle(handle:Handle); + removeHandle(name:string); + changeHandle(name:string, handle:Handle); + } + } module shapes { module basic { From a03020d91a54ebaf14c5ae081e847e9fc1038365 Mon Sep 17 00:00:00 2001 From: "EWOUT-QMINO\\Ewout" Date: Wed, 4 Feb 2015 10:46:26 +0100 Subject: [PATCH 47/54] Added wraper attribute in Element. --- jointjs/jointjs.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts index 9e6a2f0cc..d4f3024dd 100644 --- a/jointjs/jointjs.d.ts +++ b/jointjs/jointjs.d.ts @@ -40,6 +40,7 @@ declare module joint { } class Element extends Cell { + wrapper : any; position(x: number, y: number): Element; translate(tx: number, ty?: number): Element; resize(width: number, height: number): Element; From bae19ebcaae7da42f4999a07da9cca6977a5817e Mon Sep 17 00:00:00 2001 From: "EWOUT-QMINO\\Ewout" Date: Wed, 4 Feb 2015 10:49:43 +0100 Subject: [PATCH 48/54] removed wrapper from Element. --- jointjs/jointjs.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/jointjs/jointjs.d.ts b/jointjs/jointjs.d.ts index d4f3024dd..9e6a2f0cc 100644 --- a/jointjs/jointjs.d.ts +++ b/jointjs/jointjs.d.ts @@ -40,7 +40,6 @@ declare module joint { } class Element extends Cell { - wrapper : any; position(x: number, y: number): Element; translate(tx: number, ty?: number): Element; resize(width: number, height: number): Element; From 675a63e4036624d24b06f1b173a92cbe7bb72ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Pa=CC=88rsson?= Date: Wed, 4 Feb 2015 11:28:29 +0100 Subject: [PATCH 49/54] Added global fail() function to Jasmine typings --- jasmine/jasmine-tests.ts | 16 ++++++++++++++++ jasmine/jasmine.d.ts | 2 ++ 2 files changed, 18 insertions(+) diff --git a/jasmine/jasmine-tests.ts b/jasmine/jasmine-tests.ts index 1a9b1b2e4..cbac45d16 100644 --- a/jasmine/jasmine-tests.ts +++ b/jasmine/jasmine-tests.ts @@ -714,6 +714,22 @@ describe("Asynchronous specs", function () { }); }); +describe("Fail", function () { + + it("should fail test when called without arguments", function () { + fail(); + }); + + it("should fail test when called with a fail message", function () { + fail("The test failed"); + }); + + it("should fail test when called an error", function () { + fail(new Error("The test failed with this error")); + }); + +}); + (() => { // from boot.js var env = jasmine.getEnv(); diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index 6c323e146..3d5e48669 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -33,6 +33,8 @@ declare function afterAll(action: (done: () => void) => void): void; declare function expect(spy: Function): jasmine.Matchers; declare function expect(actual: any): jasmine.Matchers; +declare function fail(e?: any): void; + declare function spyOn(object: any, method: string): jasmine.Spy; declare function runs(asyncMethod: Function): void; From 37a3481b7fb0e166ef07120f64f51e6096690a2d Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 4 Feb 2015 22:11:13 +0900 Subject: [PATCH 50/54] improve highcharts/highcharts.d.ts refs #3586 --- highcharts/highcharts.d.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index 79be054ac..98e96e2ef 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -136,7 +136,7 @@ interface HighchartsAxisOptions { tickWidth?: number; tickmarkPlacement?: string; // "between" or "on" title?: HighchartsAxisTitle; - type?: string; // "linear", "logarithmic" or "datetime" + type?: string; // "linear", "logarithmic" or "datetime" } interface HighchartsExtremes { @@ -175,7 +175,7 @@ interface HighchartsColorOrGradient { cx: number; cy: number; r: number; }; stops?: any[][]; - + brighten?(amount: number): HighchartsColorOrGradient; get?(type: string): string; } @@ -986,11 +986,10 @@ interface HighchartsAxisObject { } interface HighchartsChartObject { - addSeries(options: HighchartsSeriesOptions): HighchartsSeriesOptions; - addSeries(options: HighchartsSeriesOptions, redraw: boolean): HighchartsSeriesOptions; - addSeries(options: HighchartsSeriesOptions, redraw: boolean, animation: boolean): HighchartsSeriesOptions; - addSeries(options: HighchartsSeriesOptions, redraw: boolean, animation: HighchartsAnimation): HighchartsSeriesOptions; - addAxis(options: HighchartsAxisOptions): HighchartsAxisObject; + addSeries(options: HighchartsSeriesOptions, redraw?: boolean, animation?: boolean): HighchartsSeriesOptions; + addSeries(options: HighchartsSeriesOptions, redraw?: boolean, animation?: HighchartsAnimation): HighchartsSeriesOptions; + addAxis(options: HighchartsAxisOptions, isX?: boolean, redraw?: boolean, animation?: boolean): HighchartsAxisObject; + addAxis(options: HighchartsAxisOptions, isX?: boolean, redraw?: boolean, animation?: HighchartsAnimation): HighchartsAxisObject; container: HTMLElement; destroy(): void; exportChart(): void; @@ -1058,7 +1057,7 @@ interface HighchartsStatic { numberFormat(value: number, decimals?: number, decimalPoint?: string, thousandsSep?: string): string; setOptions(options: HighchartsOptions): HighchartsOptions; getOptions(): HighchartsOptions; - + map(array: any[], fn: Function): any[]; } declare var Highcharts: HighchartsStatic; @@ -1104,9 +1103,9 @@ interface HighchartsSeriesObject { select(): void; select(selected?: boolean): void; selected: boolean; - setData(data: number[]): void; // [value1,value2, ... ] + setData(data: number[]): void; // [value1,value2, ... ] setData(data: number[], redraw: boolean): void; - setData(data: number[][]): void; // [[x1,y1],[x2,y2],... ] + setData(data: number[][]): void; // [[x1,y1],[x2,y2],... ] setData(data: number[][], redraw: boolean): void; setData(data: HighchartsDataPoint[]): void; // HighchartsDataPoint[] setData(data: HighchartsDataPoint[], redraw: boolean): void; From 597795c538993b7590630ca96a1ef6cf27021a62 Mon Sep 17 00:00:00 2001 From: Panu Horsmalahti Date: Wed, 4 Feb 2015 15:30:53 +0200 Subject: [PATCH 51/54] Add ZeroMQ unbind function types --- node_zeromq/zmq-tests.ts | 4 ++++ node_zeromq/zmq.d.ts | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/node_zeromq/zmq-tests.ts b/node_zeromq/zmq-tests.ts index 648193259..696a98c13 100644 --- a/node_zeromq/zmq-tests.ts +++ b/node_zeromq/zmq-tests.ts @@ -5,6 +5,7 @@ import zmq = require('zmq'); function test1() { var sock = zmq.socket('push'); sock.bindSync('tcp://127.0.0.1:3000'); + sock.unbindSync('tcp://127.0.0.1:3000'); sock.send("some work"); } @@ -28,6 +29,9 @@ function test4() { sock.bind('tcp://127.0.0.1', err => { sock.send("some work"); }); + sock.unbind('tcp://127.0.0.1', err => { + // + }); } function test5() { diff --git a/node_zeromq/zmq.d.ts b/node_zeromq/zmq.d.ts index e84615c85..731461204 100644 --- a/node_zeromq/zmq.d.ts +++ b/node_zeromq/zmq.d.ts @@ -94,6 +94,23 @@ declare module 'zmq' { */ bindSync(addr: string): Socket; + /** + * Async unbind. + * + * Emits the "unbind" event. + * + * @param addr Socket address + * @param cb Unind callback + */ + unbind(addr: string, callback: (error: string) => void ): Socket; + + /** + * Sync unbind. + * + * @param addr Socket address + */ + unbindSync(addr: string): Socket; + /** * Connect to `addr`. * From 832fc23ba6863a37d4439c32e95dbd8933e7f16a Mon Sep 17 00:00:00 2001 From: vvakame Date: Wed, 4 Feb 2015 23:34:20 +0900 Subject: [PATCH 52/54] update CONTRIBUTORS.md --- CONTRIBUTORS.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 172ddfd80..23fbf41c5 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -230,8 +230,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](google.analytics/ga.d.ts) [Google Analytics (Classic and Universal)](https://developers.google.com/analytics/devguides/collection/gajs) by [Ronnie Haakon Hegelund](http://ronniehegelund.blogspot.dk), [Pat Kujawa](http://patkujawa.com) * [:link:](gapi/gapi.d.ts) [Google API Client](https://code.google.com/p/google-api-javascript-client) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](google.feeds/google.feed.api.d.ts) [Google Feed Apis](https://developers.google.com/feed) by [RodneyJT](https://github.com/RodneyJT) -* [:link:](google.geolocation/google.geolocation.d.ts) [Google Geolocation](https://code.google.com/p/geo-location-javascript) by [Vincent Bortone](https://github.com/vbortone) * [:link:](googlemaps/google.maps.d.ts) [Google Geolocation](https://developers.google.com/maps) by [Folia A/S](http://www.folia.dk) +* [:link:](google.geolocation/google.geolocation.d.ts) [Google Geolocation](https://code.google.com/p/geo-location-javascript) by [Vincent Bortone](https://github.com/vbortone) * [:link:](gapi.pagespeedonline/gapi.pagespeedonline.d.ts) [Google Page Speed Online Api](https://developers.google.com/speed/pagespeed) by [Frank M](https://github.com/sgtfrankieboy) * [:link:](recaptcha/recaptcha.d.ts) [Google Recaptcha](https://www.google.com/recaptcha) by [Brent Jenkins](https://github.com/brentj73) * [:link:](gapi.translate/gapi.translate.d.ts) [Google Translate API](https://developers.google.com/translate) by [Frank M](https://github.com/sgtfrankieboy) @@ -293,7 +293,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](ix.js/ix.d.ts) [IxJS 1.0.6 / ix.js](https://github.com/Reactive-Extensions/IxJS) by [Igor Oleinikov](https://github.com/Igorbek) * [:link:](ix.js/l2o.d.ts) [IxJS 1.0.6 / l2o.js](https://github.com/Reactive-Extensions/IxJS) by [Igor Oleinikov](https://github.com/Igorbek) * [:link:](jake/jake.d.ts) [jake](https://github.com/mde/jake) by [Kon](http://phyzkit.net) -* [:link:](jasmine/jasmine.d.ts) [Jasmine](http://pivotal.github.com/jasmine) by [Boris Yankov](https://github.com/borisyankov), [Theodore Brown](https://github.com/theodorejb) +* [:link:](jasmine/jasmine.d.ts) [Jasmine](http://pivotal.github.com/jasmine) by [Boris Yankov](https://github.com/borisyankov), [Theodore Brown](https://github.com/theodorejb), [David Pärsson](https://github.com/davidparsson) * [:link:](jasmine-data_driven_tests/jasmine-data_driven_tests.d.ts) [Jasmine Data Driven Tests](https://github.com/gburghardt/jasmine-data_driven_tests) by [Anthony MacKinnon](https://github.com/AnthonyMacKinnon) * [:link:](jasmine-fixture/jasmine-fixture.d.ts) [Jasmine-fixture](https://github.com/searls/jasmine-fixture) by [Craig Brett](https://github.com/craigbrett17) * [:link:](jasmine-jquery/jasmine-jquery.d.ts) [Jasmine-JQuery](https://github.com/velesin/jasmine-jquery) by [Gregor Stamac](https://github.com/gstamac) @@ -489,6 +489,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](mustache/mustache.d.ts) [Mustache](https://github.com/janl/mustache.js) by [Mark Ashley Bell](https://github.com/markashleybell) * [:link:](nconf/nconf.d.ts) [nconf](https://github.com/flatiron/nconf) by [Jeff Goddard](https://github.com/jedigo), [Jean-Martin Thibault](https://github.com/jmthibault) * [:link:](ncp/ncp.d.ts) [ncp](https://github.com/AvianFlu/ncp) by [Bart van der Schoor](https://github.com/bartvds) +* [:link:](nedb/nedb.d.ts) [NeDB](https://github.com/louischatriot/nedb) by [Stefan Steinhart](https://github.com/reppners) * [:link:](needle/needle.d.ts) [needle](https://github.com/tomas/needle) by [San Chen](https://github.com/bigsan) * [:link:](nexpect/nexpect.d.ts) [nexpect](https://github.com/nodejitsu/nexpect) by [vvakame](http://github.com/vvakame) * [:link:](ng-grid/ng-grid.d.ts) [ng-grid](http://angular-ui.github.io/ng-grid) by [Ken Smith](https://github.com/smithkl42), [Roland Zwaga](https://github.com/rolandzwaga), [Kent Cooper](https://github.com/kentcooper) @@ -524,7 +525,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker) * [:link:](noVNC/noVNC.d.ts) [noVNC](https://github.com/kanaka/noVNC) by [Ken Smith](https://github.com/smithkl42) * [:link:](npm/npm.d.ts) [npm](https://github.com/npm/npm) by [Maxime LUCE](https://github.com/SomaticIT) -* [:link:](nprogress/NProgress.d.ts) [NProgress](https://github.com/rstacruz/nprogress) by [Judah Gabriel Himango](http://debuggerdotbreak.wordpress.com) +* [:link:](nprogress/nprogress.d.ts) [NProgress](https://github.com/rstacruz/nprogress) by [Judah Gabriel Himango](http://debuggerdotbreak.wordpress.com) * [:link:](numeraljs/numeraljs.d.ts) [Numeral.js](https://github.com/adamwdraper/Numeral-js) by [Vincent Bortone](https://github.com/vbortone) * [:link:](object-path/object-path.d.ts) [objectPath](https://github.com/mariocasciaro/object-path) by [Paulo Cesar](https://github.com/pocesar) * [:link:](oboe/oboe.d.ts) [oboe](https://github.com/jimhigson/oboe.js) by [Jared Klopper](https://github.com/optical) @@ -739,6 +740,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](webaudioapi/waa.d.ts) [Web Audio API](http://www.w3.org/TR/webaudio) by [Baruch Berger](https://github.com/bbss), [Kon](http://phyzkit.net), [kubosho](https://github.com/kubosho) * [:link:](webaudioapi/waa-nightly.d.ts) [Web Audio API (nightly)](http://www.w3.org/TR/2012/WD-webaudio-20120802) by [Baruch Berger](https://github.com/bbss) * [:link:](webmidi/webmidi.d.ts) [Web MIDI API](http://www.w3.org/TR/webmidi) by [Toshiya Nakakura](https://github.com/nakakura) +* [:link:](webspeechapi/webspeechapi.d.ts) [Web Speech API](https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html) by [SaschaNaz](https://github.com/saschanaz) * [:link:](webcola/webcola.d.ts) [webcola](https://github.com/tgdwyer/WebCola) by [Qinfeng Chen](https://github.com/qinfchen) * [:link:](webcrypto/WebCrypto.d.ts) [WebCrypto](http://www.w3.org/TR/WebCryptoAPI) by [Lucas Dixon](https://github.com/iislucas) * [:link:](webrtc/MediaStream.d.ts) [WebRTC](http://dev.w3.org/2011/webrtc) by [Ken Smith](https://github.com/smithkl42) From 345859505affe86ffde7a5fb7a7c240af415ecb4 Mon Sep 17 00:00:00 2001 From: vvakame Date: Thu, 5 Feb 2015 00:51:04 +0900 Subject: [PATCH 53/54] update jasmine project url --- jasmine/jasmine.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index 3d5e48669..17658120d 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -1,5 +1,5 @@ // Type definitions for Jasmine 2.1 -// Project: http://pivotal.github.com/jasmine/ +// Project: http://jasmine.github.io/ // Definitions by: Boris Yankov , Theodore Brown , David Pärsson // Definitions: https://github.com/borisyankov/DefinitelyTyped From d10a94e0e1633361eebab6749dcf5085c82d451a Mon Sep 17 00:00:00 2001 From: Panu Horsmalahti Date: Wed, 4 Feb 2015 18:15:22 +0200 Subject: [PATCH 54/54] Update zmq.d.ts Made callbacks optional --- node_zeromq/zmq.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node_zeromq/zmq.d.ts b/node_zeromq/zmq.d.ts index 731461204..8d29e0569 100644 --- a/node_zeromq/zmq.d.ts +++ b/node_zeromq/zmq.d.ts @@ -85,7 +85,7 @@ declare module 'zmq' { * @param addr Socket address * @param cb Bind callback */ - bind(addr: string, callback: (error: string) => void ): Socket; + bind(addr: string, callback?: (error: string) => void ): Socket; /** * Sync bind. @@ -102,7 +102,7 @@ declare module 'zmq' { * @param addr Socket address * @param cb Unind callback */ - unbind(addr: string, callback: (error: string) => void ): Socket; + unbind(addr: string, callback?: (error: string) => void ): Socket; /** * Sync unbind.