From 8e009d56c03c197c7e72e3187d313bca9c3ea33f Mon Sep 17 00:00:00 2001 From: Gary Bortosky Date: Thu, 12 Dec 2013 15:48:27 -0600 Subject: [PATCH 01/21] adding explicit any --- jquerymobile/jquerymobile.d.ts | 111 +++++++++++++++---------------- qunit/qunit.d.ts | 116 ++++++++++++++++----------------- 2 files changed, 114 insertions(+), 113 deletions(-) diff --git a/jquerymobile/jquerymobile.d.ts b/jquerymobile/jquerymobile.d.ts index 3485cd6b1..e7f92e8a2 100644 --- a/jquerymobile/jquerymobile.d.ts +++ b/jquerymobile/jquerymobile.d.ts @@ -6,7 +6,7 @@ /// -interface JQueryMobileEvent { (event: Event, ui): void; } +interface JQueryMobileEvent { (event: Event, ui: any): void; } interface DialogOptions { closeBtn?: string; @@ -208,7 +208,7 @@ interface JQueryMobileOptions { ajaxEnabled?: boolean; allowCrossDomainPages?: boolean; autoInitializePage?: boolean; - buttonMarkup; + buttonMarkup: any; defaultDialogTransition?: string; defaultPageTransition?: string; getMaxScrollForTransition?: number; @@ -227,43 +227,43 @@ interface JQueryMobileOptions { pushStateEnabled?: boolean; subPageUrlKey?: string; touchOverflowEnabled?: boolean; - transitionFallbacks; + transitionFallbacks: any; } interface JQueryMobileEvents { - tap; - taphold; - swipe; - swipeleft; - swiperight; + tap: any; + taphold: any; + swipe: any; + swipeleft: any; + swiperight: any; - vmouseover; - vmouseout; - vmousedown; - vmousemove; - vmouseup; - vclick; - vmousecancel; + vmouseover: any; + vmouseout: any; + vmousedown: any; + vmousemove: any; + vmouseup: any; + vclick: any; + vmousecancel: any; - orientationchange; - scrollstart; - scrollstop; + orientationchange: any; + scrollstart: any; + scrollstop: any; - pagebeforeload; - pageload; - pageloadfailed; - pagebeforechange; - pagechange; - pagechangefailed; - pagebeforeshow; - pagebeforehide; - pageshow; - pagehide; - pagebeforecreate; - pagecreate; - pageinit; - pageremove; - updatelayout; + pagebeforeload: any; + pageload: any; + pageloadfailed: any; + pagebeforechange: any; + pagechange: any; + pagechangefailed: any; + pagebeforeshow: any; + pagebeforehide: any; + pageshow: any; + pagehide: any; + pagebeforecreate: any; + pagecreate: any; + pageinit: any; + pageremove: any; + updatelayout: any; } interface ChangePageOptions { @@ -307,37 +307,38 @@ interface JQueryMobile extends JQueryMobileOptions { loadPage(url: any, options?: LoadPageOptions): void; loading(command: string, options?: LoaderOptions): void; - base; + base: any; silentScroll(yPos: number): void; - activePage; + activePage: JQuery; options: JQueryMobileOptions; - transitionFallbacks; - showPageLoadingMsg(); - hidePageLoadingMsg(); - loader; - page; + transitionFallbacks: any; + showPageLoadingMsg(): void; + hidePageLoadingMsg(): void; + loader: any; + page: any; - touchOverflow; - showCategory; - path; + touchOverflow: any; + showCategory: any; + path: any; - dialog; - popup; - fixedtoolbar; - button; - collapsible; - collapsibleset; - textinput; - slider; - checkboxradio; - selectmenu; - listview; + dialog: any; + popup: any; + fixedtoolbar: any; + button: any; + collapsible: any; + collapsibleset: any; + textinput: any; + slider: any; + checkboxradio: any; + selectmenu: any; + listview: any; + defaultHomeScroll: number; } interface JQuerySupport { - touchOverflow; + touchOverflow: any; } interface JQuery { diff --git a/qunit/qunit.d.ts b/qunit/qunit.d.ts index ee923c59c..68d0163b6 100644 --- a/qunit/qunit.d.ts +++ b/qunit/qunit.d.ts @@ -175,13 +175,13 @@ interface QUnitAssert { * @param expected Known comparison value * @param message A short description of the assertion */ - deepEqual(actual: any, expected: any, message?: string); + deepEqual(actual: any, expected: any, message?: string): any; /** * A non-strict comparison assertion, roughly equivalent to JUnit assertEquals. * * The equal assertion uses the simple comparison operator (==) to compare the actual - * and expected arguments. When they are equal, the assertion passes; otherwise, it fails. + * and expected arguments. When they are equal, the assertion passes: any; otherwise, it fails. * When it fails, both actual and expected values are displayed in the test result, * in addition to a given message. * @@ -189,7 +189,7 @@ interface QUnitAssert { * @param expected Known comparison value * @param message A short description of the assertion */ - equal(actual: any, expected: any, message?: string); + equal(actual: any, expected: any, message?: string): any; /** * An inverted deep recursive comparison assertion, working on primitive types, @@ -203,13 +203,13 @@ interface QUnitAssert { * @param expected Known comparison value * @param message A short description of the assertion */ - notDeepEqual(actual: any, expected: any, message?: string); + notDeepEqual(actual: any, expected: any, message?: string): any; /** * A non-strict comparison assertion, checking for inequality. * * The notEqual assertion uses the simple inverted comparison operator (!=) to compare - * the actual and expected arguments. When they aren't equal, the assertion passes; + * the actual and expected arguments. When they aren't equal, the assertion passes: any; * otherwise, it fails. When it fails, both actual and expected values are displayed * in the test result, in addition to a given message. * @@ -217,25 +217,25 @@ interface QUnitAssert { * @param expected Known comparison value * @param message A short description of the assertion */ - notEqual(actual: any, expected: any, message?: string); + notEqual(actual: any, expected: any, message?: string): any; - notPropEqual(actual: any, expected: any, message?: string); + notPropEqual(actual: any, expected: any, message?: string): any; - propEqual(actual: any, expected: any, message?: string); + propEqual(actual: any, expected: any, message?: string): any; /** * A non-strict comparison assertion, checking for inequality. * * The notStrictEqual assertion uses the strict inverted comparison operator (!==) * to compare the actual and expected arguments. When they aren't equal, the assertion - * passes; otherwise, it fails. When it fails, both actual and expected values are + * passes: any; otherwise, it fails. When it fails, both actual and expected values are * displayed in the test result, in addition to a given message. * * @param actual Expression being tested * @param expected Known comparison value * @param message A short description of the assertion */ - notStrictEqual(actual: any, expected: any, message?: string); + notStrictEqual(actual: any, expected: any, message?: string): any; /** * A boolean assertion, equivalent to CommonJS’s assert.ok() and JUnit’s assertTrue(). @@ -248,7 +248,7 @@ interface QUnitAssert { * @param state Expression being tested * @param message A short description of the assertion */ - ok(state: any, message?: string); + ok(state: any, message?: string): any; /** * A strict type and value comparison assertion. @@ -260,7 +260,7 @@ interface QUnitAssert { * @param expected Known comparison value * @param message A short description of the assertion */ - strictEqual(actual: any, expected: any, message?: string); + strictEqual(actual: any, expected: any, message?: string): any; /** * Assertion to test if a callback throws an exception when run. @@ -272,13 +272,13 @@ interface QUnitAssert { * @param expected Error Object to compare * @param message A short description of the assertion */ - throws(block: () => any, expected: any, message?: string); + throws(block: () => any, expected: any, message?: string): any; /** * @param block Function to execute * @param message A short description of the assertion */ - throws(block: () => any, message?: string); + throws(block: () => any, message?: string): any; } interface QUnitStatic extends QUnitAssert{ @@ -291,7 +291,7 @@ interface QUnitStatic extends QUnitAssert{ * * @param decrement Optional argument to merge multiple start() calls into one. Use with multiple corrsponding stop() calls. */ - start(decrement?: number); + start(decrement?: number): any; /** * Stop the testrunner to wait for async tests to run. Call start() to continue. @@ -302,7 +302,7 @@ interface QUnitStatic extends QUnitAssert{ * * @param decrement Optional argument to merge multiple stop() calls into one. Use with multiple corrsponding start() calls. */ - stop(increment? : number); + stop(increment? : number): any; /* CALLBACKS */ @@ -314,14 +314,14 @@ interface QUnitStatic extends QUnitAssert{ * * @param callback Callback to execute */ - begin(callback: () => any); + begin(callback: () => any): any; /** * Register a callback to fire whenever the test suite ends. * * @param callback Callback to execute. */ - done(callback: (details: DoneCallbackObject) => any); + done(callback: (details: DoneCallbackObject) => any): any; /** * Register a callback to fire whenever an assertion completes. @@ -331,35 +331,35 @@ interface QUnitStatic extends QUnitAssert{ * * @param callback Callback to execute. */ - log(callback: (details: LogCallbackObject) => any); + log(callback: (details: LogCallbackObject) => any): any; /** * Register a callback to fire whenever a module ends. * * @param callback Callback to execute. */ - moduleDone(callback: (details: ModuleDoneCallbackObject) => any); + moduleDone(callback: (details: ModuleDoneCallbackObject) => any): any; /** * Register a callback to fire whenever a module begins. * * @param callback Callback to execute. */ - moduleStart(callback: (details: ModuleStartCallbackObject) => any); + moduleStart(callback: (details: ModuleStartCallbackObject) => any): any; /** * Register a callback to fire whenever a test ends. * * @param callback Callback to execute. */ - testDone(callback: (details: TestDoneCallbackObject) => any); + testDone(callback: (details: TestDoneCallbackObject) => any): any; /** * Register a callback to fire whenever a test begins. * * @param callback Callback to execute. */ - testStart(callback: (details: TestStartCallbackObject) => any); + testStart(callback: (details: TestStartCallbackObject) => any): any; /* CONFIGURATION */ @@ -381,7 +381,7 @@ interface QUnitStatic extends QUnitAssert{ * @param expected Number of assertions in this test * @param test Function to close over assertions */ - asyncTest(name: string, expected: number, test: () => any); + asyncTest(name: string, expected: number, test: () => any): any; /** * Add an asynchronous test to run. The test must include a call to start(). @@ -392,7 +392,7 @@ interface QUnitStatic extends QUnitAssert{ * @param name Title of unit being tested * @param test Function to close over assertions */ - asyncTest(name: string, test: () => any); + asyncTest(name: string, test: () => any): any; /** * Specify how many assertions are expected to run within a test. @@ -403,7 +403,7 @@ interface QUnitStatic extends QUnitAssert{ * * @param amount Number of assertions in this test. */ - expect(amount: number); + expect(amount: number): any; /** * Group related tests under a single label. @@ -415,7 +415,7 @@ interface QUnitStatic extends QUnitAssert{ * @param name Label for this group of tests * @param lifecycle Callbacks to run before and after each test */ - module(name: string, lifecycle?: LifecycleObject); + module(name: string, lifecycle?: LifecycleObject): any; /** * Add a test to run. @@ -429,18 +429,18 @@ interface QUnitStatic extends QUnitAssert{ * @param expected Number of assertions in this test * @param test Function to close over assertions */ - test(title: string, expected: number, test: (assert: QUnitAssert) => any); + test(title: string, expected: number, test: (assert: QUnitAssert) => any): any; /** * @param title Title of unit being tested * @param test Function to close over assertions */ - test(title: string, test: (assert: QUnitAssert) => any); + test(title: string, test: (assert: QUnitAssert) => any): any; /** * https://github.com/jquery/qunit/blob/master/qunit/qunit.js#L1568 */ - equiv(a: any, b: any); + equiv(a: any, b: any): any; // https://github.com/jquery/qunit/blob/master/qunit/qunit.js#L661 raises: any; @@ -448,7 +448,7 @@ interface QUnitStatic extends QUnitAssert{ /** * https://github.com/jquery/qunit/blob/master/qunit/qunit.js#L897 */ - push(result, actual, expected, message): any; + push(result: any, actual: any, expected: any, message: string): any; /** * https://github.com/jquery/qunit/blob/master/qunit/qunit.js#L839 @@ -470,13 +470,13 @@ interface QUnitStatic extends QUnitAssert{ * @param expected Known comparison value * @param message A short description of the assertion */ -declare function deepEqual(actual: any, expected: any, message?: string); +declare function deepEqual(actual: any, expected: any, message?: string): any; /** * A non-strict comparison assertion, roughly equivalent to JUnit assertEquals. * * The equal assertion uses the simple comparison operator (==) to compare the actual -* and expected arguments. When they are equal, the assertion passes; otherwise, it fails. +* and expected arguments. When they are equal, the assertion passes: any; otherwise, it fails. * When it fails, both actual and expected values are displayed in the test result, * in addition to a given message. * @@ -484,7 +484,7 @@ declare function deepEqual(actual: any, expected: any, message?: string); * @param expected Known comparison value * @param message A short description of the assertion */ -declare function equal(actual: any, expected: any, message?: string); +declare function equal(actual: any, expected: any, message?: string): any; /** * An inverted deep recursive comparison assertion, working on primitive types, @@ -498,7 +498,7 @@ declare function equal(actual: any, expected: any, message?: string); * @param expected Known comparison value * @param message A short description of the assertion */ -declare function notDeepEqual(actual: any, expected: any, message?: string); +declare function notDeepEqual(actual: any, expected: any, message?: string): any; /** * A non-strict comparison assertion, checking for inequality. @@ -512,7 +512,7 @@ declare function notDeepEqual(actual: any, expected: any, message?: string); * @param expected Known comparison value * @param message A short description of the assertion */ -declare function notEqual(actual: any, expected: any, message?: string); +declare function notEqual(actual: any, expected: any, message?: string): any; /** * A non-strict comparison assertion, checking for inequality. @@ -526,7 +526,7 @@ declare function notEqual(actual: any, expected: any, message?: string); * @param expected Known comparison value * @param message A short description of the assertion */ -declare function notStrictEqual(actual: any, expected: any, message?: string); +declare function notStrictEqual(actual: any, expected: any, message?: string): any; /** * A boolean assertion, equivalent to CommonJS’s assert.ok() and JUnit’s assertTrue(). @@ -539,7 +539,7 @@ declare function notStrictEqual(actual: any, expected: any, message?: string); * @param state Expression being tested * @param message A short description of the assertion */ -declare function ok(state: any, message?: string); +declare function ok(state: any, message?: string): any; /** * A strict type and value comparison assertion. @@ -551,7 +551,7 @@ declare function ok(state: any, message?: string); * @param expected Known comparison value * @param message A short description of the assertion */ -declare function strictEqual(actual: any, expected: any, message?: string); +declare function strictEqual(actual: any, expected: any, message?: string): any; /** * Assertion to test if a callback throws an exception when run. @@ -563,13 +563,13 @@ declare function strictEqual(actual: any, expected: any, message?: string); * @param expected Error Object to compare * @param message A short description of the assertion */ -declare function throws(block: () => any, expected: any, message?: string); +declare function throws(block: () => any, expected: any, message?: string): any; /** * @param block Function to execute * @param message A short description of the assertion */ -declare function throws(block: () => any, message?: string); +declare function throws(block: () => any, message?: string): any; /* ASYNC CONTROL */ @@ -580,7 +580,7 @@ declare function throws(block: () => any, message?: string); * * @param decrement Optional argument to merge multiple start() calls into one. Use with multiple corrsponding stop() calls. */ -declare function start(decrement?: number); +declare function start(decrement?: number): any; /** * Stop the testrunner to wait for async tests to run. Call start() to continue. @@ -591,7 +591,7 @@ declare function start(decrement?: number); * * @param decrement Optional argument to merge multiple stop() calls into one. Use with multiple corrsponding start() calls. */ -declare function stop(increment? : number); +declare function stop(increment? : number): any; /* CALLBACKS */ @@ -603,14 +603,14 @@ declare function stop(increment? : number); * * @param callback Callback to execute */ -declare function begin(callback: () => any); +declare function begin(callback: () => any): any; /** * Register a callback to fire whenever the test suite ends. * * @param callback Callback to execute. */ -declare function done(callback: (details: DoneCallbackObject) => any); +declare function done(callback: (details: DoneCallbackObject) => any): any; /** * Register a callback to fire whenever an assertion completes. @@ -620,35 +620,35 @@ declare function done(callback: (details: DoneCallbackObject) => any); * * @param callback Callback to execute. */ -declare function log(callback: (details: LogCallbackObject) => any); +declare function log(callback: (details: LogCallbackObject) => any): any; /** * Register a callback to fire whenever a module ends. * * @param callback Callback to execute. */ -declare function moduleDone(callback: (details: ModuleDoneCallbackObject) => any); +declare function moduleDone(callback: (details: ModuleDoneCallbackObject) => any): any; /** * Register a callback to fire whenever a module begins. * * @param callback Callback to execute. */ -declare function moduleStart(callback: (name: string) => any); +declare function moduleStart(callback: (name: string) => any): any; /** * Register a callback to fire whenever a test ends. * * @param callback Callback to execute. */ -declare function testDone(callback: (details: TestDoneCallbackObject) => any); +declare function testDone(callback: (details: TestDoneCallbackObject) => any): any; /** * Register a callback to fire whenever a test begins. * * @param callback Callback to execute. */ -declare function testStart(callback: (details: TestStartCallbackObject) => any); +declare function testStart(callback: (details: TestStartCallbackObject) => any): any; /* TEST */ @@ -662,7 +662,7 @@ declare function testStart(callback: (details: TestStartCallbackObject) => any); * @param expected Number of assertions in this test * @param test Function to close over assertions */ -declare function asyncTest(name: string, expected?: any, test?: () => any); +declare function asyncTest(name: string, expected?: any, test?: () => any): any; /** * Add an asynchronous test to run. The test must include a call to start(). @@ -673,7 +673,7 @@ declare function asyncTest(name: string, expected?: any, test?: () => any); * @param name Title of unit being tested * @param test Function to close over assertions */ -declare function asyncTest(name: string, test: () => any); +declare function asyncTest(name: string, test: () => any): any; /** * Specify how many assertions are expected to run within a test. @@ -684,7 +684,7 @@ declare function asyncTest(name: string, test: () => any); * * @param amount Number of assertions in this test. */ -declare function expect(amount: number); +declare function expect(amount: number): any; // ** conflict with TypeScript module keyword. Must be used on QUnit namespace //declare var module: (name: string, lifecycle?: LifecycleObject) => any; @@ -701,20 +701,20 @@ declare function expect(amount: number); * @param expected Number of assertions in this test * @param test Function to close over assertions */ -declare function test(title: string, expected: number, test: (assert?: QUnitAssert) => any); +declare function test(title: string, expected: number, test: (assert?: QUnitAssert) => any): any; /** * @param title Title of unit being tested * @param test Function to close over assertions */ -declare function test(title: string, test: (assert?: QUnitAssert) => any); +declare function test(title: string, test: (assert?: QUnitAssert) => any): any; -declare function notPropEqual(actual: any, expected: any, message?: string); +declare function notPropEqual(actual: any, expected: any, message?: string): any; -declare function propEqual(actual: any, expected: any, message?: string); +declare function propEqual(actual: any, expected: any, message?: string): any; // https://github.com/jquery/qunit/blob/master/qunit/qunit.js#L1568 -declare function equiv(a: any, b: any); +declare function equiv(a: any, b: any): any; // https://github.com/jquery/qunit/blob/master/qunit/qunit.js#L661 declare var raises: any; From bb1fbec552f59273a7248ca2293d91a99916b4fe Mon Sep 17 00:00:00 2001 From: Brett Postin Date: Fri, 13 Dec 2013 10:11:18 +0000 Subject: [PATCH 02/21] Update to resolve issue #1434 Alternative fix as suggested here: https://github.com/borisyankov/DefinitelyTyped/pull/1435 --- requirejs/require.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirejs/require.d.ts b/requirejs/require.d.ts index 89c6f97f6..bb58e5143 100644 --- a/requirejs/require.d.ts +++ b/requirejs/require.d.ts @@ -290,7 +290,7 @@ interface RequireDefine { * callback param deps module dependencies * callback return module definition **/ - (deps: string[], ready: (...deps: any[]) => any): void; + (deps: string[], ready: Function): void; /** * Define module with simplified CommonJS wrapper. @@ -310,7 +310,7 @@ interface RequireDefine { * callback deps module dependencies * callback return module definition **/ - (name: string, deps: string[], ready: (...deps: any[]) => any): void; + (name: string, deps: string[], ready: Function): void; } // Ambient declarations for 'require' and 'define' From 18beeab5e2f6bba7bca96b4bfa1ab23952f722d5 Mon Sep 17 00:00:00 2001 From: Thomas Butler Date: Fri, 13 Dec 2013 07:20:48 -0500 Subject: [PATCH 03/21] changed [illegal] variant type usage to a prefered static typing --- knockout/tests/knockout-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/knockout/tests/knockout-tests.ts b/knockout/tests/knockout-tests.ts index fb3955241..6aeaae89f 100644 --- a/knockout/tests/knockout-tests.ts +++ b/knockout/tests/knockout-tests.ts @@ -56,13 +56,13 @@ function test_computed() { function MyViewModel1() { this.price = ko.observable(25.99); - this.formattedPrice = ko.computed({ + this.formattedPrice = ko.computed({ read: function () { return '$' + this.price().toFixed(2); }, write: function (value) { - value = parseFloat(value.replace(/[^\.\d]/g, "")); - this.price(isNaN(value) ? 0 : value); + var num = parseFloat(value.replace(/[^\.\d]/g, "")); + this.price(isNaN(num) ? 0 : num); }, owner: this }); From e61f72fd71d79eec9640da3d7e1bf77791072f11 Mon Sep 17 00:00:00 2001 From: Thomas Butler Date: Fri, 13 Dec 2013 07:24:45 -0500 Subject: [PATCH 04/21] removed access of non-existant property --- knockout/tests/knockout-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knockout/tests/knockout-tests.ts b/knockout/tests/knockout-tests.ts index 6aeaae89f..805f02638 100644 --- a/knockout/tests/knockout-tests.ts +++ b/knockout/tests/knockout-tests.ts @@ -124,7 +124,7 @@ function test_observableArrays() { myObservableArray.unshift('Some new value'); myObservableArray.shift(); myObservableArray.reverse(); - myObservableArray.sort(function (left, right) { return left.lastName == right.lastName ? 0 : (left.lastName < right.lastName ? -1 : 1) }); + myObservableArray.sort(function (left, right) { return left == right ? 0 : (left < right ? -1 : 1) }); myObservableArray.splice(1, 3); myObservableArray.remove('Blah'); From cbc8adfb1ed01564212853e0deb6d0169684facf Mon Sep 17 00:00:00 2001 From: Thomas Butler Date: Fri, 13 Dec 2013 07:25:35 -0500 Subject: [PATCH 05/21] removed duplicate identifier 'update' --- knockout/tests/knockout-tests.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/knockout/tests/knockout-tests.ts b/knockout/tests/knockout-tests.ts index 805f02638..8432089d9 100644 --- a/knockout/tests/knockout-tests.ts +++ b/knockout/tests/knockout-tests.ts @@ -180,8 +180,6 @@ function test_bindings() { init: function (element, valueAccessor) { var value = ko.utils.unwrapObservable(valueAccessor()); $(element).toggle(value); - }, - update: function (element, valueAccessor, allBindingsAccessor) { } }; ko.bindingHandlers.hasFocus = { From 0e8a450390e23216b58dee8c4f556b4b08b76fd9 Mon Sep 17 00:00:00 2001 From: damianog Date: Fri, 13 Dec 2013 19:49:11 +0100 Subject: [PATCH 06/21] Update angular-scenario.d.ts 'enter' lacks return-type annotation, implicitly has an 'any' return type --- angularjs/angular-scenario.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angularjs/angular-scenario.d.ts b/angularjs/angular-scenario.d.ts index 54711bbb4..abd5709db 100644 --- a/angularjs/angular-scenario.d.ts +++ b/angularjs/angular-scenario.d.ts @@ -80,7 +80,7 @@ declare module angularScenario { } export interface Input { - enter(value: any); + enter(value: any): any; check(): any; select(radioButtonValue: any): any; val(): Future; From ee212d0ececc3a792ec10bddfa46050014abc941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Oborn=C3=ADk?= Date: Sat, 14 Dec 2013 00:06:24 +0100 Subject: [PATCH 07/21] Restify: updated plugin defintions, allowed --noImplicitAny compile flag --- restify/restify.d.ts | 46 +++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/restify/restify.d.ts b/restify/restify.d.ts index dae93f783..cd65e6666 100644 --- a/restify/restify.d.ts +++ b/restify/restify.d.ts @@ -43,11 +43,12 @@ interface Response { interface Server { use: (... handler: any[]) => any; - post: (route: any, routeCallBack: (req: Request, res: Response, next: Function) => any) => any; - put: (route: any, routeCallBack: (req: Request, res: Response, next: Function) => any) => any; - del: (route: any, routeCallBack: (req: Request, res: Response, next: Function) => any) => any; - get: (route: any, routeCallBack: (req: Request, res: Response, next: Function ) => any) => any; - head: (route: any, routeCallBack: (req: Request, res: Response, next: Function) => any) => any; + post: (route: any, routeCallBack: RequestHadler) => any; + patch: (route: any, routeCallBack: RequestHadler) => any; + put: (route: any, routeCallBack: RequestHadler) => any; + del: (route: any, routeCallBack: RequestHadler) => any; + get: (route: any, routeCallBack: RequestHadler) => any; + head: (route: any, routeCallBack: RequestHadler) => any; on: (event: string, callback: Function) => any; name: string; version: string; @@ -57,7 +58,7 @@ interface Server { address: () => addressInterface; listen: (... args: any[]) => any; close: (... args: any[]) => any; - pre: (routeCallBack: (req: Request, res: Response, next: Function) => any) => any; + pre: (routeCallBack: RequestHadler) => any; } @@ -115,13 +116,17 @@ interface ThrottleOptions { overrides?: Object; } +interface RequestHadler { + (req: Request, res: Response, next: Function): any; +} + declare module "restify" { export function createServer(options?: ServerOptions): Server; export function createJsonClient(options?: ClientOptions): Client; export function createStringClient(options?: ClientOptions): Client; export function createClient(options?: ClientOptions): HttpClient; - + export class ConflictError { constructor(message?: any); } export class InvalidArguementError { constructor(message?: any); } export class RestError { constructor(message?: any); } @@ -140,18 +145,19 @@ declare module "restify" { export class ResourceNotFoundError { constructor(message: any); } export class WrongAcceptError { constructor(message: any); } - export function acceptParser(parser: any); - export function authorizationParser(); - export function dateParser(skew?: number); - export function queryParser(options?: Object); - export function urlEncodedBodyParser(options?: Object); - export function jsonp(options?: Object); - export function gzipResponse(options?: Object); - export function bodyParser(options?: Object); - export function requestLogger(options?: Object); - export function serveStatic(options?: Object); - export function throttle(options?: ThrottleOptions); - export function conditionalRequest(options?: Object); - export function auditLogger(options?: Object); + export function acceptParser(parser: any): RequestHadler; + export function authorizationParser(): RequestHadler; + export function dateParser(skew?: number): RequestHadler; + export function queryParser(options?: Object): RequestHadler; + export function urlEncodedBodyParser(options?: Object): RequestHadler[]; + export function jsonp(): RequestHadler; + export function gzipResponse(options?: Object): RequestHadler; + export function bodyParser(options?: Object): RequestHadler[]; + export function requestLogger(options?: Object): RequestHadler; + export function serveStatic(options?: Object): RequestHadler; + export function throttle(options?: ThrottleOptions): RequestHadler; + export function conditionalRequest(): RequestHadler[]; + export function auditLogger(options?: Object): Function; + export function fullResponse(): RequestHadler; export var defaultResponseHeaders : any; } From 61d7c7cb00513a4b01a4e4caa79f0e304669ebdb Mon Sep 17 00:00:00 2001 From: Paul Loyd Date: Sun, 15 Dec 2013 00:05:05 +0400 Subject: [PATCH 08/21] node-ffi: adopt for --noImplicitAny --- node-ffi/node-ffi-tests.ts.tscparams | 1 - node-ffi/node-ffi.d.ts | 20 ++++++++++---------- node-ffi/node-ffi.d.ts.tscparams | 1 - 3 files changed, 10 insertions(+), 12 deletions(-) delete mode 100644 node-ffi/node-ffi-tests.ts.tscparams delete mode 100644 node-ffi/node-ffi.d.ts.tscparams diff --git a/node-ffi/node-ffi-tests.ts.tscparams b/node-ffi/node-ffi-tests.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/node-ffi/node-ffi-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/node-ffi/node-ffi.d.ts b/node-ffi/node-ffi.d.ts index 2f7ad15d7..b2bdd522d 100644 --- a/node-ffi/node-ffi.d.ts +++ b/node-ffi/node-ffi.d.ts @@ -140,10 +140,10 @@ declare module "ffi" { * accept C callback functions. */ export var Callback: { - new (retType, argTypes: any[], abi: number, fn: Function): NodeBuffer; - new (retType, argTypes: any[], fn: Function): NodeBuffer; - (retType, argTypes: any[], abi: number, fn: Function): NodeBuffer; - (retType, argTypes: any[], fn: Function): NodeBuffer; + new (retType: any, argTypes: any[], abi: number, fn: Function): NodeBuffer; + new (retType: any, argTypes: any[], fn: Function): NodeBuffer; + (retType: any, argTypes: any[], abi: number, fn: Function): NodeBuffer; + (retType: any, argTypes: any[], fn: Function): NodeBuffer; } export var ffiType: { @@ -200,7 +200,7 @@ declare module "ref" { /** To invoke when `ref.get` is invoked on a buffer of this type. */ get(buffer: NodeBuffer, offset: number): any; /** To invoke when `ref.set` is invoked on a buffer of this type. */ - set(buffer: NodeBuffer, offset: number, value): void; + set(buffer: NodeBuffer, offset: number, value: any): void; /** The name to use during debugging for this datatype. */ name?: string; /** The alignment of this datatype when placed inside a struct. */ @@ -214,9 +214,9 @@ declare module "ref" { /** Get the memory address of buffer. */ export function address(buffer: NodeBuffer): number; /** Allocate the memory with the given value written to it. */ - export function alloc(type: Type, value?): NodeBuffer; + export function alloc(type: Type, value?: any): NodeBuffer; /** Allocate the memory with the given value written to it. */ - export function alloc(type: string, value?): NodeBuffer; + export function alloc(type: string, value?: any): NodeBuffer; /** * Allocate the memory with the given string written to it with the given @@ -310,9 +310,9 @@ declare module "ref" { offset?: number): NodeBuffer; /** Write pointer if the indirection is 1, otherwise write value. */ - export function set(buffer: NodeBuffer, offset: number, value, type?: Type): void; + export function set(buffer: NodeBuffer, offset: number, value: any, type?: Type): void; /** Write pointer if the indirection is 1, otherwise write value. */ - export function set(buffer: NodeBuffer, offset: number, value, type?: string): void; + export function set(buffer: NodeBuffer, offset: number, value: any, type?: string): void; /** Write the string as a NULL terminated. Default encoding is utf8. */ export function writeCString(buffer: NodeBuffer, offset: number, string: string, encoding?: string): void; @@ -347,7 +347,7 @@ declare module "ref" { * Attach object to buffer such. * It prevents object from being garbage collected until buffer does. */ - export function _attach(buffer: NodeBuffer, object: Object); + export function _attach(buffer: NodeBuffer, object: Object): void; /** Same as ref.reinterpret, except that this version does not attach buffer. */ export function _reinterpret(buffer: NodeBuffer, size: number, diff --git a/node-ffi/node-ffi.d.ts.tscparams b/node-ffi/node-ffi.d.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/node-ffi/node-ffi.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" From a63e5a7e1e906eeb84a4fe704c18da021763685b Mon Sep 17 00:00:00 2001 From: Jed Hunsaker Date: Thu, 5 Dec 2013 15:16:37 -0600 Subject: [PATCH 09/21] Fix Ember/Handlebars --- ember/ember-tests.ts | 99 ++-- ember/ember.d.ts | 922 ++++++--------------------------- handlebars/handlebars-tests.ts | 68 +-- handlebars/handlebars.d.ts | 55 +- 4 files changed, 270 insertions(+), 874 deletions(-) diff --git a/ember/ember-tests.ts b/ember/ember-tests.ts index eaf0bff05..254e1682c 100644 --- a/ember/ember-tests.ts +++ b/ember/ember-tests.ts @@ -1,20 +1,21 @@ /// /// + var App; App = Em.Application.create(); App.president = Em.Object.create({ - name: "Barack Obama" + name: 'Barack Obama' }); App.country = Em.Object.create({ presidentNameBinding: 'MyApp.president.name' }); App.country.get('presidentName'); App.president = Em.Object.create({ - firstName: "Barack", - lastName: "Obama", + firstName: 'Barack', + lastName: 'Obama', fullName: function () { return this.get('firstName') + ' ' + this.get('lastName'); }.property() @@ -24,47 +25,51 @@ App.president.get('fullName'); declare class MyPerson extends Em.Object { static createMan(): MyPerson; } -var Person = Em.Object.extend({ + +var Person1 = Em.Object.extend({ say: (thing) => { alert(thing); } }); + declare class MyPerson2 extends Em.Object { helloWorld(): void; } -var tom = Person.create({ - name: "Tom Dale", - helloWorld: () => { - this.say("Hi my name is " + this.get('name')); +var tom = Person1.create({ + name: 'Tom Dale', + helloWorld: function() { + this.say('Hi my name is ' + this.get('name')); } }); tom.helloWorld(); -Person.reopen({ isPerson: true }); -Person.create().get('isPerson'); +Person1.reopen({ isPerson: true }); +Person1.create().get('isPerson'); -Person.reopenClass({ +Person1.reopenClass({ createMan: () => { - return Person.create({ isMan: true }) + return Person1.create({ isMan: true }); } }); -Person.createMan().get('isMan'); +// ReSharper disable once DuplicatingLocalDeclaration +declare var Person1: typeof MyPerson; +Person1.createMan().get('isMan'); -var person = Person.create({ - firstName: "Yehuda", - lastName: "Katz" +var person = Person1.create({ + firstName: 'Yehuda', + lastName: 'Katz' }); -person.addObserver('fullName', () => { }); -person.set('firstName', "Brohuda"); +person.addObserver('fullName', null, () => { }); +person.set('firstName', 'Brohuda'); App.todosController = Em.Object.create({ todos: [ Em.Object.create({ isDone: false }) ], - remaining: () => { + remaining: (function() { var todos = this.get('todos'); return todos.filterProperty('isDone', false).get('length'); - }.property('todos.@each.isDone') + }).property('todos.@each.isDone') }); var todos = App.todosController.get('todos'); @@ -86,29 +91,29 @@ App.husband.set('householdIncome', 90000); App.wife.get('householdIncome'); App.user = Em.Object.create({ - fullName: "Kara Gates" + fullName: 'Kara Gates' }); App.userView = Em.View.create({ userNameBinding: Em.Binding.oneWay('App.user.fullName') }); -App.user.set('fullName', "Krang Gates"); -App.userView.set('userName', "Truckasaurus Gates"); +App.user.set('fullName', 'Krang Gates'); +App.userView.set('userName', 'Truckasaurus Gates'); App.user.get('fullName'); App = Em.Application.create({ rootElement: '#sidebar' }); -var view = Em.View.create({ +var view = Em.View.create({ templateName: 'say-hello', - name: "Bob" + name: 'Bob' }); view.appendTo('#container'); view.append(); view.remove(); App.AlertView = Em.View.extend({ - priority: "p4", + priority: 'p4', isUrgent: true }); @@ -121,21 +126,21 @@ App.ListingView = Em.View.extend({ App.userController = Em.Object.create({ content: Em.Object.create({ - firstName: "Albert", - lastName: "Hofmann", + firstName: 'Albert', + lastName: 'Hofmann', posts: 25, - hobbies: "Riding bicycles" + hobbies: 'Riding bicycles' }) }); -Handlebars.registerHelper('highlight', (property, options) => { +Handlebars.registerHelper('highlight', function(property, options) { var value = Em.Handlebars.get(this, property, options); return new Handlebars.SafeString('' + value + ''); }); App.MyText = Em.TextField.extend({ formBlurredBinding: 'App.adminController.formBlurred', - change: (evt) => { + change: function() { this.set('formBlurred', true); } }); @@ -145,26 +150,26 @@ var textArea = Em.TextArea.create({ }); App.ClickableView = Em.View.extend({ - click: (evt) => { - alert("ClickableView was clicked!"); + click: () => { + alert('ClickableView was clicked!'); } }); -var container = Em.ContainerView.create(); +var container = Em.ContainerView.create(); container.append(); var coolView = App.CoolView.create(), childViews = container.get('childViews'); childViews.pushObject(coolView); -Person = Em.Object.extend({ - sayHello: () => { - console.log("Hello from " + this.get('name')); +var Person2 = Em.Object.extend({ + sayHello: function() { + console.log('Hello from ' + this.get('name')); } }); var people = [ - Person.create({ name: "Juan" }), - Person.create({ name: "Charles" }), - Person.create({ name: "Majd" }) + Person2.create({ name: 'Juan' }), + Person2.create({ name: 'Charles' }), + Person2.create({ name: 'Majd' }) ]; people.invoke('sayHello'); @@ -172,19 +177,19 @@ var arr = [Em.Object.create(), Em.Object.create()]; arr.setEach('name', 'unknown'); arr.getEach('name'); -Person = Em.Object.extend({ +var Person3 = Em.Object.extend({ name: null, isHappy: false }); var people2 = [ - Person.create({ name: 'Yehuda', isHappy: true }), - Person.create({ name: 'Majd', isHappy: false }) + Person3.create({ name: 'Yehuda', isHappy: true }), + Person3.create({ name: 'Majd', isHappy: false }) ]; -people2.every((person, index, self) => { - if (person.get('isHappy')) { return true; } +people2.every((person: Em.Object) => { + return !!person.get('isHappy'); }); -people2.some((person, index, self) => { - if (person.get('isHappy')) { return true; } +people2.some((person: Em.Object) => { + return !!person.get('isHappy'); }); people2.everyProperty('isHappy', true); people2.someProperty('isHappy', true); diff --git a/ember/ember.d.ts b/ember/ember.d.ts index 574bb3b9f..4657ac5cb 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -6,6 +6,7 @@ /// /// +declare var Handlebars: HandlebarsStatic; declare module EmberStates { @@ -50,7 +51,7 @@ interface String { dasherize(): string; decamelize(): string; fmt(...string): string; - htmlSafe(): Handlebars.SafeString; + htmlSafe(): typeof Handlebars.SafeString; loc(...string): string; underscore(): string; w(): string[]; @@ -58,14 +59,13 @@ interface String { interface Array { constructor(arr: any[]); - constructor(arr: Array); activate(): void; - addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): Array; - addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Array; + addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[]; + addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[]; any(callback: Function, target?: any): boolean; anyBy(key: string, value?: string): boolean; - arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): Array; - arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): Array; + arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): any[]; someProperty(key: string, value?: any): boolean; clear(): any[]; compact(): any[]; @@ -78,10 +78,10 @@ interface Array { enumerableContentDidChange(removing: Ember.Enumerable, adding: number); enumerableContentDidChange(removing: number, adding: Ember.Enumerable); enumerableContentDidChange(removing: Ember.Enumerable, adding: Ember.Enumerable); - enumerableContentWillChange(removing: number, adding: number): Array; - enumerableContentWillChange(removing: Ember.Enumerable, adding: number): Array; - enumerableContentWillChange(removing: number, adding: Ember.Enumerable): Array; - enumerableContentWillChange(removing: Ember.Enumerable, adding: Ember.Enumerable): Array; + enumerableContentWillChange(removing: number, adding: number): any[]; + enumerableContentWillChange(removing: Ember.Enumerable, adding: number): any[]; + enumerableContentWillChange(removing: number, adding: Ember.Enumerable): any[]; + enumerableContentWillChange(removing: Ember.Enumerable, adding: Ember.Enumerable): any[]; every(callback: Function, target?: any): boolean; everyBy(key: string, value?: string): boolean; everyProperty(key: string, value?: any): boolean; @@ -92,7 +92,7 @@ interface Array { forEach(callback: Function, target?: any): any; getEach(key: string): any[]; indexOf(object: any, startAt: number): number; - insertAt(idx: number, object: any): Array; + insertAt(idx: number, object: any): any[]; invoke(methodName: string, ...any): any[]; lastIndexOf(object: any, startAt: number): number; mapBy(key: string): any[]; @@ -101,56 +101,56 @@ interface Array { objectsAt(...number): any[]; popObject(): any; pushObject(obj: any): any; - pushObjects(...any): Array; + pushObjects(...any): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; - removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): Array; + removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; removeAt(start: number, len: number): any; - removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Array; + removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[]; replace(idx: number, amt: number, objects: any[]); - reverseObjects(): Array; + reverseObjects(): any[]; setEach(key: string, value?: any): any; - setObjects(objects: any[]): Array; + setObjects(objects: any[]): any[]; shiftObject(): any; slice(beginIndex?: number, endIndex?: number): any[]; some(callback: Function, target?: any): boolean; toArray(): any[]; - uniq(): Array; + uniq(): any[]; unshiftObject(object: any): any; - unshiftObjects(objects: any[]): Array; - without(value: any): Array; - '[]': Array; + unshiftObjects(objects: any[]): any[]; + without(value: any): any[]; + '[]': any[]; '@each': Ember.EachProxy; Boolean: boolean; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; addObject(object: any): any; - addObjects(objects: Ember.Enumerable): Array; + addObjects(objects: Ember.Enumerable): any[]; removeObject(object: any): any; - removeObjects(objects: Ember.Enumerable): Array; + removeObjects(objects: Ember.Enumerable): any[]; addObserver: ModifyObserver; - beginPropertyChanges(): Array; + beginPropertyChanges(): any[]; cacheFor(keyName: string): any; decrementProperty(keyName: string, decrement?: number): number; - endPropertyChanges(): Array; + endPropertyChanges(): any[]; get(keyName: string): any; getProperties(...string): {}; getProperties(keys: string[]): {}; getWithDefault(keyName: string, defaultValue: any): any; hasObserverFor(key: string): boolean; incrementProperty(keyName: string, increment?: number): number; - notifyPropertyChange(keyName: string): Array; - propertyDidChange(keyName: string): Array; - propertyWillChange(keyName: string): Array; + notifyPropertyChange(keyName: string): any[]; + propertyDidChange(keyName: string): any[]; + propertyWillChange(keyName: string): any[]; removeObserver(key: string, target: any, method: string): Ember.Observable; removeObserver(key: string, target: any, method: Function): Ember.Observable; - set(keyName: string, value: any): Array; - setProperties(hash: {}): Array; + set(keyName: string, value: any): any[]; + setProperties(hash: {}): any[]; toggleProperty(keyName: string): any; - copy(deep: boolean): Array; - frozenCopy(): Array; + copy(deep: boolean): any[]; + frozenCopy(): any[]; } interface ApplicationCreateArguments { @@ -189,20 +189,6 @@ interface CoreObjectArguments { willDestroy?: Function; } -interface ClassMixin { - extend(arguments?: {}): T; - create(arguments?: {}): T; - createWithMixins(arguments?: {}): T; - detect(obj: any): boolean; - detectInstance(obj: any): boolean; - eachComputedProperty(callback: Function, binding: {}): void; - metaForProperty(key: string): {}; - reopen(arguments?: {}): T; - reopenClass(arguments?: {}): T; - isClass: boolean; - isMethod: boolean; -} - interface EnumerableConfigurationOptions { willChange? ; didChange? ; @@ -254,6 +240,7 @@ declare module Ember { /** Alias for jQuery. **/ + // ReSharper disable once DuplicatingLocalDeclaration var $: JQueryStatic; /** Creates an Ember.NativeArray from an Array like object. Does not modify the original object. @@ -266,20 +253,7 @@ declare module Ember { An instance of Ember.Application is the starting point for every Ember application. It helps to instantiate, initialize and coordinate the many objects that make up your app. **/ - class Application extends Namespace implements ClassMixin { - /** - Creates a subclass of the Application class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: ApplicationCreateArguments): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: ApplicationCreateArguments): T; + class Application extends Namespace { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -292,17 +266,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; static initializer(arguments?: ApplicationInitializerArguments): void; @@ -389,12 +352,12 @@ declare module Ember { Array class as well as other controllers, etc. that want to appear to be arrays. **/ class Array implements Enumerable { - addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): Array; + addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[]; addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; any(callback: Function, target?: any): boolean; anyBy(key: string, value?: string): boolean; - arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): Array; - arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): Array; + arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): any[]; someProperty(key: string, value?: string): boolean; compact(): any[]; contains(obj: any): boolean; @@ -430,7 +393,7 @@ declare module Ember { reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; - removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): Array; + removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; setEach(key: string, value?: any): any; slice(beginIndex?: number, endIndex?: number): any[]; @@ -440,7 +403,7 @@ declare module Ember { without(value: any): Enumerable; '@each': EachProxy; Boolean: boolean; - '[]': Array; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; @@ -450,20 +413,7 @@ declare module Ember { Provides a way for you to publish a collection of objects so that you can easily bind to the collection from a Handlebars #each helper, an Ember.CollectionView, or other controllers. **/ - class ArrayController extends ArrayProxy implements SortableMixin, ControllerMixin, ClassMixin { - /** - Creates a subclass of the ArrayController class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class ArrayController extends ArrayProxy implements SortableMixin, ControllerMixin { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -476,17 +426,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; lookupItemController(object: any): string; @@ -514,20 +453,7 @@ declare module Ember { forwarding all requests. This makes it very useful for a number of binding use cases or other cases where being able to swap out the underlying array is useful. **/ - class ArrayProxy extends Object implements MutableArray, ClassMixin { - /** - Creates a subclass of the ArrayProxy class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class ArrayProxy extends Object implements MutableArray { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -540,25 +466,14 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; - addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): ArrayProxy; - addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): ArrayProxy; + addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[]; + addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[]; any(callback: Function, target?: any): boolean; anyBy(key: string, value?: string): boolean; - arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): ArrayProxy; - arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): ArrayProxy; + arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): any[]; someProperty(key: string, value?: string): boolean; clear(): any[]; compact(): any[]; @@ -571,10 +486,10 @@ declare module Ember { enumerableContentDidChange(removing: Enumerable, adding: number); enumerableContentDidChange(removing: number, adding: Enumerable); enumerableContentDidChange(removing: Enumerable, adding: Enumerable); - enumerableContentWillChange(removing: number, adding: number): ArrayProxy; - enumerableContentWillChange(removing: Enumerable, adding: number): ArrayProxy; - enumerableContentWillChange(removing: number, adding: Enumerable): ArrayProxy; - enumerableContentWillChange(removing: Enumerable, adding: Enumerable): ArrayProxy; + enumerableContentWillChange(removing: number, adding: number): any[]; + enumerableContentWillChange(removing: Enumerable, adding: number): any[]; + enumerableContentWillChange(removing: number, adding: Enumerable): any[]; + enumerableContentWillChange(removing: Enumerable, adding: Enumerable): any[]; every(callback: Function, target?: any): boolean; everyBy(key: string, value?: string): boolean; everyProperty(key: string, value?: string): boolean; @@ -585,7 +500,7 @@ declare module Ember { forEach(callback: Function, target?: any): any; getEach(key: string): any[]; indexOf(object: any, startAt: number): number; - insertAt(idx: number, object: any): ArrayProxy; + insertAt(idx: number, object: any): any[]; invoke(methodName: string, ...any): any[]; lastIndexOf(object: any, startAt: number): number; map: ItemIndexEnumerableCallbackTarget; @@ -596,27 +511,27 @@ declare module Ember { objectsAt(...number): any[]; popObject(): any; pushObject(obj: any): any; - pushObjects(...any): ArrayProxy; + pushObjects(...any): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; - removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): ArrayProxy; + removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; removeAt(start: number, len: number): any; - removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): ArrayProxy; + removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[]; replace(idx: number, amt: number, objects: any[]); replaceContent(idx: number, amt: number, objects: any[]): void; - reverseObjects(): ArrayProxy; + reverseObjects(): any[]; setEach(key: string, value?: any): any; - setObjects(objects: any[]): ArrayProxy; + setObjects(objects: any[]): any[]; shiftObject(): any; slice(beginIndex?: number, endIndex?: number): any[]; some(callback: Function, target?: any): boolean; toArray(): any[]; - uniq(): ArrayProxy; + uniq(): any[]; unshiftObject(object: any): any; - unshiftObjects(objects: any[]): ArrayProxy; - without(value: any): ArrayProxy; - '[]': ArrayProxy; + unshiftObjects(objects: any[]): any[]; + without(value: any): any[]; + '[]': any[]; '@each': EachProxy; Boolean: boolean; firstObject: any; @@ -624,9 +539,9 @@ declare module Ember { lastObject: any; length: number; addObject(object: any): any; - addObjects(objects: Enumerable): ArrayProxy; + addObjects(objects: Enumerable): any[]; removeObject(object: any): any; - removeObjects(objects: Enumerable): ArrayProxy; + removeObjects(objects: Enumerable): any[]; } var BOOTED: boolean; /** @@ -644,20 +559,7 @@ declare module Ember { to(pathTuple: any[]): Binding; toString(): string; } - class Button extends View implements TargetActionSupport, ClassMixin { - /** - Creates a subclass of the Button class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class Button extends View implements TargetActionSupport { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -670,17 +572,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; triggerAction(opts: {}): boolean; @@ -689,20 +580,7 @@ declare module Ember { The internal class used to create text inputs when the {{input}} helper is used with type of checkbox. See Handlebars.helpers.input for usage details. **/ - class Checkbox extends View implements ClassMixin { - /** - Creates a subclass of the Checkbox class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class Checkbox extends View { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -715,17 +593,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; } @@ -742,7 +609,7 @@ declare module Ember { destroy(): CollectionView; init(): void; static CONTAINER_MAP: {}; - content: Array; + content: any[]; emptyView: View; itemViewClass: View; } @@ -758,20 +625,7 @@ declare module Ember { and actions are targeted at the view object. There is no access to the surrounding context or outer controller; all contextual information is passed in. **/ - class Component extends View implements ClassMixin { - /** - Creates a subclass of the Component class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class Component extends View { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -784,17 +638,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; sendAction(action: string, context: any): void; @@ -813,7 +656,9 @@ declare module Ember { property(...string): ComputedProperty; readOnly(): ComputedProperty; set(keyName: string, newValue: any, oldValue: string): any; + // ReSharper disable UsingOfReservedWord volatile(): ComputedProperty; + // ReSharper restore UsingOfReservedWord } class Container { constructor(parent: Container); @@ -851,20 +696,7 @@ declare module Ember { An Ember.View subclass that implements Ember.MutableArray allowing programatic management of its child views. **/ - class ContainerView extends View implements ClassMixin { - /** - Creates a subclass of the ContainerView class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class ContainerView extends View { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -877,17 +709,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; } @@ -912,20 +733,7 @@ declare module Ember { copy(deep: boolean): Copyable; frozenCopy(): Copyable; } - class CoreObject implements ClassMixin { - /** - Creates a subclass of the CoreObject class. - **/ - static extend(arguments?: CoreObjectArguments): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class CoreObject { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -938,17 +746,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; /** @@ -986,20 +783,7 @@ declare module Ember { and other classes like Ember._SimpleMetamorphView that don't need the fully functionaltiy of Ember.View. Unless you have specific needs for CoreView, you will use Ember.View in your applications. **/ - class CoreView extends Object implements ClassMixin { - /** - Creates a subclass of the CoreView class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class CoreView extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -1012,17 +796,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; parentView: CoreView; @@ -1071,20 +844,7 @@ declare module Ember { This is the object instance returned when you get the @each property on an array. It uses the unknownProperty handler to automatically create EachArray instances for property names. **/ - class EachProxy extends Object implements ClassMixin { - /** - Creates a subclass of the EachProxy class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class EachProxy extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -1097,20 +857,9 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; - unknownProperty(keyName: string, value: any): Array; + unknownProperty(keyName: string, value: any): any[]; } /** This mixin defines the common interface implemented by enumerable objects in Ember. Most of these @@ -1160,7 +909,7 @@ declare module Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '[]': Array; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; @@ -1169,25 +918,13 @@ declare module Ember { /** A subclass of the JavaScript Error object for use in Ember. **/ + // ReSharper disable once DuplicatingLocalDeclaration var Error: typeof Error; /** Handles delegating browser events to their corresponding Ember.Views. For example, when you click on a view, Ember.EventDispatcher ensures that that view's mouseDown method gets called. **/ - class EventDispatcher extends Object implements ClassMixin { - /** - Creates a subclass of the EventDispatcher class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class EventDispatcher extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -1200,17 +937,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; events: {}; @@ -1280,20 +1006,7 @@ declare module Ember { function log(level, str): void; function compile(environment, options?, context?, asObject?); } - class HashLocation extends Object implements ClassMixin { - /** - Creates a subclass of the HashLocation class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class HashLocation extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -1306,34 +1019,10 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; } - class HistoryLocation extends Object implements ClassMixin { - /** - Creates a subclass of the HistoryLocation class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class HistoryLocation extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -1346,17 +1035,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; rootURL: string; @@ -1374,20 +1052,7 @@ declare module Ember { var LOG_BINDINGS: boolean; var LOG_STACKTRACE_ON_DEPRECATION: boolean; var LOG_VERSION: boolean; - class LinkView extends View implements ClassMixin { - /** - Creates a subclass of the LinkView class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class LinkView extends View { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -1400,17 +1065,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; init(): void; @@ -1469,12 +1123,12 @@ declare module Ember { reopen(arguments?: {}): T; } class MutableArray implements Array, MutableEnumberable { - addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): Array; + addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[]; addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; any(callback: Function, target?: any): boolean; anyBy(key: string, value?: string): boolean; - arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): Array; - arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): Array; + arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): any[]; someProperty(key: string, value?: string): boolean; clear(): any[]; compact(): any[]; @@ -1501,7 +1155,7 @@ declare module Ember { forEach(callback: Function, target?: any): any; getEach(key: string): any[]; indexOf(object: any, startAt: number): number; - insertAt(idx: number, object: any): MutableArray; + insertAt(idx: number, object: any): any[]; invoke(methodName: string, ...any): any[]; lastIndexOf(object: any, startAt: number): number; map: ItemIndexEnumerableCallbackTarget; @@ -1511,26 +1165,26 @@ declare module Ember { objectsAt(...number): any[]; popObject(): any; pushObject(obj: any): any; - pushObjects(...any): MutableArray; + pushObjects(...any): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; - removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): Array; + removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; removeAt(start: number, len: number): any; removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): Enumerable; replace(idx: number, amt: number, objects: any[]); - reverseObjects(): Array; + reverseObjects(): any[]; setEach(key: string, value?: any): any; - setObjects(objects: any[]): Array; + setObjects(objects: any[]): any[]; shiftObject(): any; slice(beginIndex?: number, endIndex?: number): any[]; some(callback: Function, target?: any): boolean; toArray(): any[]; uniq(): Enumerable; unshiftObject(object: any): any; - unshiftObjects(objects: any[]): Array; + unshiftObjects(objects: any[]): any[]; without(value: any): Enumerable; - '[]': Array; + '[]': any[]; '@each': EachProxy; Boolean: boolean; firstObject: any; @@ -1587,26 +1241,13 @@ declare module Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '[]': Array; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; } var NAME_KEY: string; - class Namespace extends Object implements ClassMixin { - /** - Creates a subclass of the Namespace class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class Namespace extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -1619,30 +1260,18 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; } class NativeArray implements MutableArray, Observable, Copyable { constructor(arr: any[]); - constructor(arr: NativeArray); static activate(): void; - addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): NativeArray; - addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): NativeArray; + addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[]; + addEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[]; any(callback: Function, target?: any): boolean; anyBy(key: string, value?: string): boolean; - arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): NativeArray; - arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): NativeArray; + arrayContentDidChange(startIdx: number, removeAmt: number, addAmt: number): any[]; + arrayContentWillChange(startIdx: number, removeAmt: number, addAmt: number): any[]; someProperty(key: string, value?: any): boolean; clear(): any[]; compact(): any[]; @@ -1655,10 +1284,10 @@ declare module Ember { enumerableContentDidChange(removing: Enumerable, adding: number); enumerableContentDidChange(removing: number, adding: Enumerable); enumerableContentDidChange(removing: Enumerable, adding: Enumerable); - enumerableContentWillChange(removing: number, adding: number): NativeArray; - enumerableContentWillChange(removing: Enumerable, adding: number): NativeArray; - enumerableContentWillChange(removing: number, adding: Enumerable): NativeArray; - enumerableContentWillChange(removing: Enumerable, adding: Enumerable): NativeArray; + enumerableContentWillChange(removing: number, adding: number): any[]; + enumerableContentWillChange(removing: Enumerable, adding: number): any[]; + enumerableContentWillChange(removing: number, adding: Enumerable): any[]; + enumerableContentWillChange(removing: Enumerable, adding: Enumerable): any[]; every(callback: Function, target?: any): boolean; everyBy(key: string, value?: string): boolean; everyProperty(key: string, value?: any): boolean; @@ -1669,7 +1298,7 @@ declare module Ember { forEach(callback: Function, target?: any): any; getEach(key: string): any[]; indexOf(object: any, startAt: number): number; - insertAt(idx: number, object: any): NativeArray; + insertAt(idx: number, object: any): any[]; invoke(methodName: string, ...any): any[]; lastIndexOf(object: any, startAt: number): number; map: ItemIndexEnumerableCallbackTarget; @@ -1679,26 +1308,26 @@ declare module Ember { objectsAt(...number): any[]; popObject(): any; pushObject(obj: any): any; - pushObjects(...any): NativeArray; + pushObjects(...any): any[]; reduce(callback: ReduceCallback, initialValue: any, reducerProperty: string): any; reject: ItemIndexEnumerableCallbackTarget; rejectBy(key: string, value?: string): any[]; - removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): NativeArray; + removeArrayObserver(target: any, opts: EnumerableConfigurationOptions): any[]; removeAt(start: number, len: number): any; - removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): NativeArray; + removeEnumerableObserver(target: any, opts: EnumerableConfigurationOptions): any[]; replace(idx: number, amt: number, objects: any[]); - reverseObjects(): NativeArray; + reverseObjects(): any[]; setEach(key: string, value?: any): any; - setObjects(objects: any[]): NativeArray; + setObjects(objects: any[]): any[]; shiftObject(): any; slice(beginIndex?: number, endIndex?: number): any[]; some(callback: Function, target?: any): boolean; toArray(): any[]; - uniq(): NativeArray; + uniq(): any[]; unshiftObject(object: any): any; - unshiftObjects(objects: any[]): NativeArray; - without(value: any): NativeArray; - '[]': Array; + unshiftObjects(objects: any[]): any[]; + without(value: any): any[]; + '[]': any[]; '@each': EachProxy; Boolean: boolean; firstObject: any; @@ -1706,45 +1335,32 @@ declare module Ember { lastObject: any; length: number; addObject(object: any): any; - addObjects(objects: Enumerable): NativeArray; + addObjects(objects: Enumerable): any[]; removeObject(object: any): any; - removeObjects(objects: Enumerable): NativeArray; + removeObjects(objects: Enumerable): any[]; addObserver: ModifyObserver; - beginPropertyChanges(): NativeArray; + beginPropertyChanges(): any[]; cacheFor(keyName: string): any; decrementProperty(keyName: string, decrement?: number): number; - endPropertyChanges(): NativeArray; + endPropertyChanges(): any[]; get(keyName: string): any; getProperties(...string): {}; getProperties(keys: string[]): {}; getWithDefault(keyName: string, defaultValue: any): any; hasObserverFor(key: string): boolean; incrementProperty(keyName: string, increment?: number): number; - notifyPropertyChange(keyName: string): NativeArray; - propertyDidChange(keyName: string): NativeArray; - propertyWillChange(keyName: string): NativeArray; + notifyPropertyChange(keyName: string): any[]; + propertyDidChange(keyName: string): any[]; + propertyWillChange(keyName: string): any[]; removeObserver(key: string, target: any, method: string): Observable; removeObserver(key: string, target: any, method: Function): Observable; - set(keyName: string, value: any): NativeArray; - setProperties(hash: {}): NativeArray; + set(keyName: string, value: any): any[]; + setProperties(hash: {}): any[]; toggleProperty(keyName: string): any; - copy(deep: boolean): NativeArray; - frozenCopy(): NativeArray; + copy(deep: boolean): any[]; + frozenCopy(): any[]; } - class NoneLocation extends Object implements ClassMixin { - /** - Creates a subclass of the NoneLocation class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class NoneLocation extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -1757,22 +1373,11 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; } var ORDER_DEFINITION: string[]; - class Object extends CoreObject implements Observable, ClassMixin { + class Object extends CoreObject implements Observable { /** Creates a subclass of the Object class. **/ @@ -1781,11 +1386,11 @@ declare module Ember { Creates an instance of the class. @param arguments A hash containing values with which to initialize the newly instantiated object. **/ - static create(arguments?: {}): T; + static create(arguments?: {}): T; /** Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. **/ - static createWithMixins(arguments?: {}): T; + static createWithMixins(arguments?: {}): T; static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -1802,13 +1407,13 @@ declare module Ember { Augments a constructor's prototype with additional properties and functions. To add functions and properties to the constructor itself, see reopenClass. **/ - static reopen(arguments?: {}): T; + static reopen(arguments?: {}): T; /** Augments a constructor's own properties and functions. To add functions and properties to instances of a constructor by extending the constructor's prototype see reopen. **/ - static reopenClass(arguments?: {}): T; + static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; addObserver: ModifyObserver; @@ -1838,20 +1443,7 @@ declare module Ember { needs: string[]; target: any; } - class ObjectProxy extends Object implements ClassMixin { - /** - Creates a subclass of the ObjectProxy class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class ObjectProxy extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -1864,17 +1456,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; /** @@ -1938,20 +1519,7 @@ declare module Ember { elementTag: string; parentBuffer: RenderBuffer; } - class Route extends Object implements ClassMixin { - /** - Creates a subclass of the Route class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class Route extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -1964,17 +1532,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; activate: Function; @@ -1988,27 +1545,16 @@ declare module Ember { modelFor(name: string): {}; render(name: string, options?: RenderOptions): void; renderTemplate(controller: Controller, model: {}): void; + // ReSharper disable once InconsistentNaming replaceWith(name: string, ...Object): void; send(name: string, ...any): void; serialize(model: {}, params: string[]): string; setupController(controller: Controller, model: {}): void; + // ReSharper disable once InconsistentNaming transitionTo(name: string, ...Object): void; actions: ActionsHash; } - class Router extends Object implements ClassMixin { - /** - Creates a subclass of the Router class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class Router extends Object { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -2021,37 +1567,13 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; } var RouterDSL: Function; var SHIM_ES5: boolean; var STRINGS: boolean; - class Select extends View implements ClassMixin { - /** - Creates a subclass of the View class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class Select extends View { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -2064,17 +1586,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; content: any[]; @@ -2088,20 +1599,7 @@ declare module Ember { selection: any; value: string; } - class SelectOption extends View implements ClassMixin { - /** - Creates a subclass of the SelectOption class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class SelectOption extends View { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -2114,17 +1612,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; } @@ -2173,7 +1660,7 @@ declare module Ember { toArray(): any[]; uniq(): Set; without(value: any): Set; - '[]': Array; + '[]': any[]; firstObject: any; hasEnumerableObservers: boolean; lastObject: any; @@ -2238,7 +1725,7 @@ declare module Ember { toArray(): any[]; uniq(): Enumerable; without(value: any): Enumerable; - '[]': Array; + '[]': any[]; arrangedContent: any; firstObject: any; hasEnumerableObservers: boolean; @@ -2247,20 +1734,7 @@ declare module Ember { sortFunction: Comparable; sortProperties: any[]; } - class State extends Object implements Evented, ClassMixin { - /** - Creates a subclass of the State class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class State extends Object implements Evented { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -2273,17 +1747,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; has(name: string): boolean; @@ -2304,20 +1767,7 @@ declare module Ember { exit: Function; setup: Function; } - class StateManager extends State implements ClassMixin { - /** - Creates a subclass of the StateManager class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class StateManager extends State { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -2330,17 +1780,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; contextFreeTransition(currentState: State, path: string): TransitionsHash; @@ -2395,20 +1834,7 @@ declare module Ember { static adapter: Object; testHelpers: {}; } - class TextArea extends View implements TextSupport, ClassMixin { - /** - Creates a subclass of the TextArea class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class TextArea extends View implements TextSupport { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -2421,17 +1847,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; cancel(event: Function): void; @@ -2443,20 +1858,7 @@ declare module Ember { bubbles: boolean; onEvent: string; } - class TextField extends View implements TextSupport, ClassMixin { - /** - Creates a subclass of the TextField class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class TextField extends View implements TextSupport { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -2469,17 +1871,6 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; cancel(event: Function): void; @@ -2506,20 +1897,7 @@ declare module Ember { onEvent: string; } var VERSION: string; - class View extends CoreView implements ClassMixin { - /** - Creates a subclass of the View class. - **/ - static extend(arguments?: {}): T; - /** - Creates an instance of the class. - @param arguments A hash containing values with which to initialize the newly instantiated object. - **/ - static create(arguments?: {}): T; - /** - Equivalent to doing extend(arguments).create(). If possible use the normal create method instead. - **/ - static createWithMixins(arguments?: {}): T; + class View extends CoreView { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -2532,24 +1910,15 @@ declare module Ember { @param key property name **/ static metaForProperty(key: string): {}; - /** - Augments a constructor's prototype with additional properties and functions. - To add functions and properties to the constructor itself, see reopenClass. - **/ - static reopen(arguments?: {}): T; - /** - Augments a constructor's own properties and functions. - To add functions and properties to instances of a constructor by extending the - constructor's prototype see reopen. - **/ - static reopenClass(arguments?: {}): T; static isClass: boolean; static isMethod: boolean; $(): JQuery; append(): View; + // ReSharper disable InconsistentNaming appendTo(A: string): View; appendTo(A: HTMLElement): View; appendTo(A: JQuery): View; + // ReSharper restore InconsistentNaming createChildView(viewClass: {}, attrs?: {}): View; createChildView(viewClass: string, attrs?: {}): View; createElement(): View; @@ -2561,9 +1930,11 @@ declare module Ember { removeChild(view: View): View; removeFromParent(): View; render(buffer: RenderBuffer): void; + // ReSharper disable InconsistentNaming replaceIn(A: string): View; replaceIn(A: HTMLElement): View; replaceIn(A: JQuery): View; + // ReSharper restore InconsistentNaming rerender(): void; ariaRole: string; attributeBindings: any; @@ -2616,6 +1987,7 @@ declare module Ember { function canInvoke(obj: any, methodName: string): boolean; function changeProperties(callback: Function, binding?: any): void; function compare(v: any, w: any): number; + // ReSharper disable once DuplicatingLocalDeclaration var computed: { (callback: Function): ComputedProperty; alias(dependentKey: string): ComputedProperty; @@ -2637,7 +2009,9 @@ declare module Ember { oneWay(dependentKey: string): ComputedProperty; or(...string): ComputedProperty; }; + // ReSharper disable DuplicatingLocalDeclaration var config: {}; + // ReSharper restore DuplicatingLocalDeclaration function controllerFor(container: Container, controllerName: string, lookupOptions?: {}): Controller; function copy(obj: any, deep: boolean): any; /** @@ -2653,8 +2027,10 @@ declare module Ember { /** Ember.empty is deprecated. Please use Ember.isEmpty instead. **/ + // ReSharper disable once DuplicatingLocalDeclaration var empty: typeof deprecateFunc; function endPropertyChanges(): void; + // ReSharper disable once DuplicatingLocalDeclaration var exports: {}; function finishChains(obj: any): void; function flushPendingChains(): void; @@ -2687,6 +2063,7 @@ declare module Ember { function listenersDiff(obj: any, eventName: string, otherActions: any[]): any[]; function listenersFor(obj: any, eventName: string): any[]; function listenersUnion(obj: any, eventName: string, otherActions: any[]): void; + // ReSharper disable once DuplicatingLocalDeclaration var lookup: {}; // TODO: define interface function makeArray(obj: any): any[]; function merge(original: any, updates: any): any; @@ -2704,6 +2081,7 @@ declare module Ember { function oneWay(obj: any, to: string, from: string): Binding; var onError: Error; function overrideChains(obj: any, keyName: string, m: any): boolean; + // ReSharper disable once DuplicatingLocalDeclaration var platform: { addBeforeObserver: ModifyObserver; addObserver: ModifyObserver; @@ -2772,6 +2150,7 @@ declare module Ember { function unwatch(obj: any, keyPath: string): void; function unwatchKey(obj: any, keyName: string): void; function unwatchPath(obj: any, keyPath: string): void; + // ReSharper disable once DuplicatingLocalDeclaration var uuid: number; function valueOf(): {}; function warn(message: string, test?: boolean): void; @@ -2782,6 +2161,7 @@ declare module Ember { function wrap(func: Function, superFunc: Function): Function; } +// ReSharper disable DuplicatingLocalDeclaration declare module Em { /** Alias for jQuery. diff --git a/handlebars/handlebars-tests.ts b/handlebars/handlebars-tests.ts index cfda4d072..1846f943d 100644 --- a/handlebars/handlebars-tests.ts +++ b/handlebars/handlebars-tests.ts @@ -1,77 +1,79 @@ /// +import Handlebars = require('handlebars'); + var context = { - author: { firstName: "Alan", lastName: "Johnson" }, - body: "I Love Handlebars", + author: { firstName: 'Alan', lastName: 'Johnson' }, + body: 'I Love Handlebars', comments: [{ - author: { firstName: "Yehuda", lastName: "Katz" }, - body: "Me too!" + author: { firstName: 'Yehuda', lastName: 'Katz' }, + body: 'Me too!' }] }; Handlebars.registerHelper('fullName', (person) => { - return person.firstName + " " + person.lastName; + return person.firstName + ' ' + person.lastName; }); -Handlebars.registerHelper('agree_button', () => { +Handlebars.registerHelper('agree_button', function() { return new Handlebars.SafeString( - "" + '' ); }); -var source = "

Hello, my name is {{name}}. I am from {{hometown}}. I have " + - "{{kids.length}} kids:

" + - "
    {{#kids}}
  • {{name}} is {{age}}
  • {{/kids}}
"; +var source = '

Hello, my name is {{name}}. I am from {{hometown}}. I have ' + + '{{kids.length}} kids:

' + + '
    {{#kids}}
  • {{name}} is {{age}}
  • {{/kids}}
'; var template = Handlebars.compile(source); -var data = { "name": "Alan", "hometown": "Somewhere, TX", - "kids": [{"name": "Jimmy", "age": "12"}, {"name": "Sally", "age": "4"}]}; +var data = { 'name': 'Alan', 'hometown': 'Somewhere, TX', + 'kids': [{'name': 'Jimmy', 'age': '12'}, {'name': 'Sally', 'age': '4'}]}; var result = template(data); Handlebars.registerHelper('link_to', (context) => { - return "" + context.body + ""; + return '' + context.body + ''; }); -var context2 = { posts: [{url: "/hello-world", body: "Hello World!"}] }; -var source2 = "
    {{#posts}}
  • {{{link_to this}}}
  • {{/posts}}
" +var context2 = { posts: [{url: '/hello-world', body: 'Hello World!'}] }; +var source2 = '
    {{#posts}}
  • {{{link_to this}}}
  • {{/posts}}
'; var template2 = Handlebars.compile(source2); template2(context2); Handlebars.registerHelper('link_to', (title, context) => { - return "" + title + "!" + return '' + title + '!'; }); -var context3 = { posts: [{url: "/hello-world", body: "Hello World!"}] }; -var source3 = '
    {{#posts}}
  • {{{link_to "Post" this}}}
  • {{/posts}}
' +var context3 = { posts: [{url: '/hello-world', body: 'Hello World!'}] }; +var source3 = '
    {{#posts}}
  • {{{link_to "Post" this}}}
  • {{/posts}}
'; var template3 = Handlebars.compile(source3); template3(context3); -var source4 = "
    {{#people}}
  • {{#link}}{{name}}{{/link}}
  • {{/people}}
"; -Handlebars.registerHelper('link', (context, options) => { +var source4 = '
    {{#people}}
  • {{#link}}{{name}}{{/link}}
  • {{/people}}
'; +Handlebars.registerHelper('link', function(context) { return '' + context.fn(this) + ''; }); var template4 = Handlebars.compile(source4); -var data2 = { "people": [ - { "name": "Alan", "id": 1 }, - { "name": "Yehuda", "id": 2 } +var data2 = { 'people': [ + { 'name': 'Alan', 'id': 1 }, + { 'name': 'Yehuda', 'id': 2 } ]}; template4(data2); -var source5 = "
    {{#people}}
  • {{> link}}
  • {{/people}}
"; -Handlebars.registerPartial('link', '{{name}}') +var source5 = '
    {{#people}}
  • {{> link}}
  • {{/people}}
'; +Handlebars.registerPartial('link', '{{name}}'); var template5 = Handlebars.compile(source5); -var data3 = { "people": [ - { "name": "Alan", "id": 1 }, - { "name": "Yehuda", "id": 2 } +var data3 = { 'people': [ + { 'name': 'Alan', 'id': 1 }, + { 'name': 'Yehuda', 'id': 2 } ]}; template5(data3); Handlebars.registerHelper('list', (items, fn) => { - var out = "
    "; + var out = '
      '; for(var i=0, l=items.length; i" + fn(items[i]) + ""; + out = out + '
    • ' + fn(items[i]) + '
    • '; } - return out + "
    "; + return out + '
'; }); Handlebars.registerHelper('fullName', (person) => { - return person.firstName + " " + person.lastName; -}); \ No newline at end of file + return person.firstName + ' ' + person.lastName; +}); diff --git a/handlebars/handlebars.d.ts b/handlebars/handlebars.d.ts index 8449fde07..28158031e 100644 --- a/handlebars/handlebars.d.ts +++ b/handlebars/handlebars.d.ts @@ -4,30 +4,39 @@ // Definitions: https://github.com/borisyankov/DefinitelyTyped -declare module Handlebars { - function registerHelper(name: string, fn: Function, inverse?: boolean): void; - function registerPartial(name: string, str: any): void; - function K(): void; - function createFrame(object: any): any; - function Exception(message: string): void; - class SafeString { - constructor(str: string); - static toString(): string; - } - function parse(input: string): boolean; - var logger: Logger; - function log(level: number, obj: any): void; - function compile(input: any, options?: any): (context: any, options?: any) => string; +declare var Handlebars: HandlebarsStatic; - interface Logger { - DEBUG: number; - INFO: number; - WARN: number; - ERROR: number; - level: number; +interface HandlebarsStatic { + registerHelper(name: string, fn: Function, inverse?: boolean): void; + registerPartial(name: string, str: any): void; + K(): void; + createFrame(object: any): any; + Exception(message: string): void; + SafeString: typeof SafeString; + parse(input: string): boolean; + logger: Logger; + log(level: number, obj: any): void; + compile(input: any, options?: any): (context: any, options?: any) => string; + Logger: typeof Logger; +} - methodMap: { [level: number]: string }; +declare class SafeString { + constructor(str: string); + static toString(): string; +} - log(level: number, obj: string): void; - } +interface Logger { + DEBUG: number; + INFO: number; + WARN: number; + ERROR: number; + level: number; + + methodMap: { [level: number]: string }; + + log(level: number, obj: string): void; +} + +declare module "handlebars" { + export = Handlebars; } From ef0db52948a021bc53137d2e88b3d0397526b369 Mon Sep 17 00:00:00 2001 From: damianog Date: Sun, 15 Dec 2013 13:16:39 +0100 Subject: [PATCH 10/21] Update globalize.d.ts 'format' lacks return-type annotation --- globalize/globalize.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/globalize/globalize.d.ts b/globalize/globalize.d.ts index 91f991833..0bdaeb4bf 100644 --- a/globalize/globalize.d.ts +++ b/globalize/globalize.d.ts @@ -111,8 +111,8 @@ interface GlobalizeStatic { addCultureInfo(cultureName: string, info: Object): void; addCultureInfo(info: Object): void; findClosestCulture(cultureSelector: string): GlobalizeStatic; - format(value: number, format: string, cultureSelector?: string); - format(value: Date, format: string, cultureSelector?: string); + format(value: number, format: string, cultureSelector?: string): string; + format(value: Date, format: string, cultureSelector?: string): string; localize(key: string, cultureSelector?: string): string; parseDate(value: string, format?: string, cultureSelector?: string): Date; From a3cca0d72f9de9445c76c8a9b680e37f3e9bc3c6 Mon Sep 17 00:00:00 2001 From: damianog Date: Sun, 15 Dec 2013 13:50:21 +0100 Subject: [PATCH 11/21] Update highcharts.d.ts Fixed missing type declarations. --- highcharts/highcharts.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/highcharts/highcharts.d.ts b/highcharts/highcharts.d.ts index f20ffcdb5..f6f6e9265 100644 --- a/highcharts/highcharts.d.ts +++ b/highcharts/highcharts.d.ts @@ -1011,7 +1011,7 @@ interface HighchartsChartObject { setTitle(title: HighchartsTitleOptions): void; setTitle(title: HighchartsTitleOptions, subtitle: HighchartsSubtitleOptions): void; showLoading(): void; - showLoading(str: string); + showLoading(str: string): void; xAxis: HighchartsAxisObject[]; yAxis: HighchartsAxisObject[]; @@ -1058,7 +1058,7 @@ interface HighchartsStatic { setOptions(options: HighchartsOptions): HighchartsOptions; getOptions(): HighchartsOptions; - map(array: any[], any): any[]; + map(array: any[], fn: Function): any[]; } declare var Highcharts: HighchartsStatic; @@ -1088,16 +1088,16 @@ interface HighchartsPointObject { } interface HighchartsSeriesObject { - addPoint(options: any); - addPoint(options: any, redraw: boolean, shift: boolean); - addPoint(options: any, redraw: boolean, shift: boolean, animation: boolean); - addPoint(options: any, redraw: boolean, shift: boolean, animation: HighchartsAnimation); + addPoint(options: any): void; + addPoint(options: any, redraw: boolean, shift: boolean): void; + addPoint(options: any, redraw: boolean, shift: boolean, animation: boolean): void; + addPoint(options: any, redraw: boolean, shift: boolean, animation: HighchartsAnimation): void; chart: HighchartsChartObject; data: HighchartsDataPoint[]; hide(): void; options: HighchartsSeriesOptions; remove(): void; - remove(redraw: boolean); + remove(redraw: boolean): void; name: string; points: HighchartsPointObject[]; select(): void; From 0d2fb0d17a37d6ad11abb3bb0bbd361153bf19d0 Mon Sep 17 00:00:00 2001 From: Michal Kutil Date: Sun, 15 Dec 2013 23:04:05 +0100 Subject: [PATCH 12/21] jQuery: The interface used to specify easing functions add --- jquery/jquery-tests.ts | 5 +++++ jquery/jquery.d.ts | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 434cf2554..0a935ce44 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -410,6 +410,11 @@ function test_animatedSelector() { animateIt(); } +function test_easing() { + var result: number = $.easing.linear(3); + var result: number = $.easing.swing(3); +} + function test_append() { $('.inner').append('

Test

'); $('.container').append($('h2')); diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 2bd9beecc..e68d50e36 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -348,6 +348,13 @@ interface JQueryEventConstructor { new (name: string, eventProperties?: any): JQueryEventObject; } +/** + * The interface used to specify easing functions. + */ +interface JQueryEasing { + linear(p: number): number; + swing(p: number): number; +} /* Static members of jQuery (those on $ and jQuery themselves) @@ -647,6 +654,7 @@ interface JQueryStatic { Animation(elem: any, properties: any, options: any): any; + easing: JQueryEasing; } /* From 41a7127404b965dd1abeac2f0c5fd3522e4a3b90 Mon Sep 17 00:00:00 2001 From: Jonathan Park Date: Mon, 16 Dec 2013 17:17:39 -0800 Subject: [PATCH 13/21] updating angular resource and injector definitions --- angularjs/angular-resource.d.ts | 129 +++++++++++++++++--------------- angularjs/angular.d.ts | 28 +++---- 2 files changed, 83 insertions(+), 74 deletions(-) diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index f74f3eb44..f3a8870cd 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -1,7 +1,6 @@ // Type definitions for Angular JS 1.2 (ngResource module) // Project: http://angularjs.org -// Definitions by: Diego Vilar -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/daptiv/DefinitelyTyped /// @@ -19,10 +18,19 @@ declare module ng.resource { // that deeply. /////////////////////////////////////////////////////////////////////////// interface IResourceService { + + , U extends IResourceClass>(url: string, paramDefaults?: any, + /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } + where deleteDescriptor : IActionDescriptor */ + actionDescriptors?: any): U; + >(url: string, paramDefaults?: any, + /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } + where deleteDescriptor : IActionDescriptor */ + actionDescriptors?: any): IResourceClass; (url: string, paramDefaults?: any, - /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } - where deleteDescriptor : IActionDescriptor */ - actionDescriptors?: any): IResourceClass; + /** example: {update: { method: 'PUT' }, delete: deleteDescriptor } + where deleteDescriptor : IActionDescriptor */ + actionDescriptors?: any): IResourceClass>; } // Just a reference to facilitate describing new actions @@ -42,65 +50,66 @@ declare module ng.resource { // PATCH (in other words, methods with body). Otherwise, it's going // to be considered as parameters to the request. // https://github.com/angular/angular.js/blob/v1.2.0/src/ngResource/resource.js#L461-L465 - interface IResourceClass { - get(): IResource; - get(dataOrParams: any): IResource; - get(dataOrParams: any, success: Function): IResource; - get(success: Function, error?: Function): IResource; - get(params: any, data: any, success?: Function, error?: Function): IResource; - save(): IResource; - save(dataOrParams: any): IResource; - save(dataOrParams: any, success: Function): IResource; - save(success: Function, error?: Function): IResource; - save(params: any, data: any, success?: Function, error?: Function): IResource; - query(): IResource[]; - query(dataOrParams: any): IResource[]; - query(dataOrParams: any, success: Function): IResource[]; - query(success: Function, error?: Function): IResource[]; - query(params: any, data: any, success?: Function, error?: Function): IResource[]; - remove(): IResource; - remove(dataOrParams: any): IResource; - remove(dataOrParams: any, success: Function): IResource; - remove(success: Function, error?: Function): IResource; - remove(params: any, data: any, success?: Function, error?: Function): IResource; - delete(): IResource; - delete(dataOrParams: any): IResource; - delete(dataOrParams: any, success: Function): IResource; - delete(success: Function, error?: Function): IResource; - delete(params: any, data: any, success?: Function, error?: Function): IResource; + interface IResourceClass> { + get(): T; + get(dataOrParams: any): T; + get(dataOrParams: any, success: Function): T; + get(success: Function, error?: Function): T; + get(params: any, data: any, success?: Function, error?: Function): T; + save(): T; + save(dataOrParams: any): T; + save(dataOrParams: any, success: Function): T; + save(success: Function, error?: Function): T; + save(params: any, data: any, success?: Function, error?: Function): T; + query(): T[]; + query(dataOrParams: any): T[]; + query(dataOrParams: any, success: Function): T[]; + query(success: Function, error?: Function): T[]; + query(params: any, data: any, success?: Function, error?: Function): T[]; + remove(): T; + remove(dataOrParams: any): T; + remove(dataOrParams: any, success: Function): T; + remove(success: Function, error?: Function): T; + remove(params: any, data: any, success?: Function, error?: Function): T; + delete(): T; + delete(dataOrParams: any): T; + delete(dataOrParams: any, success: Function): T; + delete(success: Function, error?: Function): T; + delete(params: any, data: any, success?: Function, error?: Function): T; } - interface IResource { - $get(): IResource; - $get(dataOrParams: any): IResource; - $get(dataOrParams: any, success: Function): IResource; - $get(success: Function, error?: Function): IResource; - $get(params: any, data: any, success?: Function, error?: Function): IResource; - $save(): IResource; - $save(dataOrParams: any): IResource; - $save(dataOrParams: any, success: Function): IResource; - $save(success: Function, error?: Function): IResource; - $save(params: any, data: any, success?: Function, error?: Function): IResource; - $query(): IResource[]; - $query(dataOrParams: any): IResource[]; - $query(dataOrParams: any, success: Function): IResource[]; - $query(success: Function, error?: Function): IResource[]; - $query(params: any, data: any, success?: Function, error?: Function): IResource[]; - $remove(): IResource; - $remove(dataOrParams: any): IResource; - $remove(dataOrParams: any, success: Function): IResource; - $remove(success: Function, error?: Function): IResource; - $remove(params: any, data: any, success?: Function, error?: Function): IResource; - $delete(): IResource; - $delete(dataOrParams: any): IResource; - $delete(dataOrParams: any, success: Function): IResource; - $delete(success: Function, error?: Function): IResource; - $delete(params: any, data: any, success?: Function, error?: Function): IResource; + interface IResource> { + $get(): T; + $get(dataOrParams: any): T; + $get(dataOrParams: any, success: Function): T; + $get(success: Function, error?: Function): T; + $get(params: any, data: any, success?: Function, error?: Function): T; + $save(): T; + $save(dataOrParams: any): T; + $save(dataOrParams: any, success: Function): T; + $save(success: Function, error?: Function): T; + $save(params: any, data: any, success?: Function, error?: Function): T; + $query(): T[]; + $query(dataOrParams: any): T[]; + $query(dataOrParams: any, success: Function): T[]; + $query(success: Function, error?: Function): T[]; + $query(params: any, data: any, success?: Function, error?: Function): T[]; + $remove(): T; + $remove(dataOrParams: any): T; + $remove(dataOrParams: any, success: Function): T; + $remove(success: Function, error?: Function): T; + $remove(params: any, data: any, success?: Function, error?: Function): T; + $delete(): T; + $delete(dataOrParams: any): T; + $delete(dataOrParams: any, success: Function): T; + $delete(success: Function, error?: Function): T; + $delete(params: any, data: any, success?: Function, error?: Function): T; } /** when creating a resource factory via IModule.factory */ - interface IResourceServiceFactoryFunction { - ($resource: ng.resource.IResourceService): ng.resource.IResourceClass; + interface IResourceServiceFactoryFunction> { + ($resource: ng.resource.IResourceService): IResourceClass; + >($resource: ng.resource.IResourceService): U; } } @@ -109,6 +118,6 @@ declare module ng { interface IModule { /** creating a resource service factory */ - factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction): IModule; + factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction): IModule; } } diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 3b0599ac4..af897a962 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -127,15 +127,15 @@ declare module ng { // this is necessary to be able to access the scoped attributes. it's not very elegant // because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way // this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656 - [name: string]: any; - - // Adds the CSS class value specified by the classVal parameter to the - // element. If animations are enabled then an animation will be triggered + [name: string]: any; + + // Adds the CSS class value specified by the classVal parameter to the + // element. If animations are enabled then an animation will be triggered // for the class addition. $addClass(classVal: string): void; - // Removes the CSS class value specified by the classVal parameter from the - // element. If animations are enabled then an animation will be triggered for + // Removes the CSS class value specified by the classVal parameter from the + // element. If animations are enabled then an animation will be triggered for // the class removal. $removeClass(classVal: string): void; @@ -143,12 +143,12 @@ declare module ng { $set(key: string, value: any): void; // Observes an interpolated attribute. - // The observer function will be invoked once during the next $digest - // following compilation. The observer is then invoked whenever the + // The observer function will be invoked once during the next $digest + // following compilation. The observer is then invoked whenever the // interpolated value changes. $observe(name: string, fn:(value?:any)=>any): Function; - // A map of DOM element attribute names to the normalized name. This is needed + // A map of DOM element attribute names to the normalized name. This is needed // to do reverse lookup from normalized name back to actual name. $attr: Object; } @@ -451,12 +451,12 @@ declare module ng { then(successCallback: (promiseValue: T) => IHttpPromise, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; then(successCallback: (promiseValue: T) => IPromise, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; then(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult, notifyCallback?: (state: any) => any): IPromise; - - + + catch(onRejected: (reason: any) => IHttpPromise): IPromise; catch(onRejected: (reason: any) => IPromise): IPromise; catch(onRejected: (reason: any) => TResult): IPromise; - + finally(finallyCallback: ()=>any):IPromise; } @@ -700,7 +700,7 @@ declare module ng { valueOf(value: any): any; } - + /////////////////////////////////////////////////////////////////////////// // SCEDelegateProvider // see http://docs.angularjs.org/api/ng.$sceDelegateProvider @@ -709,7 +709,7 @@ declare module ng { resourceUrlBlacklist(blacklist: any[]): void; resourceUrlWhitelist(whitelist: any[]): void; } - + /////////////////////////////////////////////////////////////////////////// // Directive // see http://docs.angularjs.org/api/ng.$compileProvider#directive From 72cc26150630924e0a3fc3f6caadf351f043a245 Mon Sep 17 00:00:00 2001 From: Jonathan Park Date: Mon, 16 Dec 2013 17:39:28 -0800 Subject: [PATCH 14/21] adding invoke inline annotated functions --- angularjs/angular.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index af897a962..12742a531 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -793,6 +793,7 @@ declare module ng { annotate(inlineAnnotadedFunction: any[]): string[]; get (name: string): any; instantiate(typeConstructor: Function, locals?: any): any; + invoke(inlineAnnotadedFunction: any[]): any; invoke(func: Function, context?: any, locals?: any): any; } From 71e23deaddd6c11702cee0ac4a76a61150da0859 Mon Sep 17 00:00:00 2001 From: John Emau Date: Mon, 16 Dec 2013 19:03:37 -0800 Subject: [PATCH 15/21] added tests for new angular-resource generics signatures --- angularjs/angular-resource-tests.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/angularjs/angular-resource-tests.ts b/angularjs/angular-resource-tests.ts index 2b7c5c438..911267f15 100644 --- a/angularjs/angular-resource-tests.ts +++ b/angularjs/angular-resource-tests.ts @@ -1,5 +1,8 @@ /// +interface IMyResource extends ng.resource.IResource { }; +interface IMyResourceClass extends ng.resource.IResourceClass { }; + /////////////////////////////////////// // IActionDescriptor /////////////////////////////////////// @@ -14,9 +17,9 @@ actionDescriptor.params = { key: 'value' }; /////////////////////////////////////// // IResourceClass /////////////////////////////////////// -var resourceClass: ng.resource.IResourceClass; -var resource: ng.resource.IResource; -var resourceArray: ng.resource.IResource[]; +var resourceClass: IMyResourceClass; +var resource: IMyResource; +var resourceArray: IMyResource[]; resource = resourceClass.delete(); resource = resourceClass.delete({ key: 'value' }); @@ -63,12 +66,19 @@ resource = resourceClass.save({ key: 'value' }, { key: 'value' }); resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { }); resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { }, function () { }); +/////////////////////////////////////// +// IResourceService +/////////////////////////////////////// +var resourceService: ng.resource.IResourceService; +resourceClass = resourceService('test'); +resourceClass = resourceService('test'); +resourceClass = resourceService('test'); /////////////////////////////////////// // IModule /////////////////////////////////////// var mod: ng.IModule; -var resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction; +var resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction; var resourceService: ng.resource.IResourceService; resourceServiceFactoryFunction = function (resourceService) { return resourceClass }; From a859e22699e843e6934b4bbb934510c9c6916983 Mon Sep 17 00:00:00 2001 From: John Emau Date: Mon, 16 Dec 2013 19:15:42 -0800 Subject: [PATCH 16/21] added missing test for resource service factory and updated readme --- angularjs/README.md | 228 ++++++++++++++-------------- angularjs/angular-resource-tests.ts | 4 +- 2 files changed, 118 insertions(+), 114 deletions(-) diff --git a/angularjs/README.md b/angularjs/README.md index 9cf668559..363aea49d 100644 --- a/angularjs/README.md +++ b/angularjs/README.md @@ -72,7 +72,7 @@ TypeScript allows for static checking. Among other obvious things, that means yo Consider the following ordinary code: - function Controller($scope) { + function Controller($scope) { $scope.$broadcast('myEvent'); $scope.title = 'Yabadabadu'; } @@ -93,7 +93,7 @@ Since you are augmenting the $scope object, you should let the compiler know wha interface ICustomScope extends ng.IScope { title: string; } - + function Controller($scope: ng.ICustomScope) { $scope.$broadcast('myEvent'); $scope.title = 'Yabadabadu'; @@ -102,125 +102,127 @@ Since you are augmenting the $scope object, you should let the compiler know wha ## Examples ### Working with $resource +```ts +/// +/// - /// - /// +// We have the option to define arguments for a custom resource +interface IArticleParameters { + id: number; +} - // We have the option to define arguments for a custom resource - interface IArticleParameters { - id: number; +interface IArticleResource extends ng.resource.IResource { + title: string; + text: string; + date: Date; + author: number; + + // Although all actions defined on IArticleResourceClass are avaiable with + // the '$' prefix, we have the choice to expose only what we will use + $publish(): IArticleResource; + $unpublish(): IArticleResource; +} + +// Let's define a custom resource +interface IArticleResourceClass extends ng.resource.IResourceClass { + // Overload get to accept our custom parameters + get(): ng.resource.IResource; + get(params: IArticleParameters, onSuccess: Function): IArticleResource; + + // Add our custom resource actions + publish(): IArticleResource; + publish(params: IArticleParameters): IArticleResource; + unpublish(params: IArticleParameters): IArticleResource; +} + +function MainController($resource: ng.resource.IResourceService) { + + // IntelliSense will provide IActionDescriptor interface and will validate + // your assignment against it + var publishDescriptor: ng.resource.IActionDescriptor; + publishDescriptor = { + method: 'GET', + isArray: false + }; + + // I could still create a descriptor without the interface... + var unpublishDescriptor = { + method: 'POST' } - // Let's define a custom resource - interface IArticleResourceClass extends ng.resource.IResourceClass { - // Overload get to accept our custom parameters - get(): ng.resource.IResource; - get(params: IArticleParameters, onSuccess: Function): IArticleResource; + // A call to the $resource service returns a IResourceClass. Since + // our own IArticleResourceClass defines 2 more actions, we cast the return + // value to make the compiler aware of that + var articleResource = $resource('/articles/:id', null, { + publish : publishDescriptor, + unpublish : unpublishDescriptor + }); - // Add our custom resource actions - publish(): IArticleResource; - publish(params: IArticleParameters): IArticleResource; - unpublish(params: IArticleParameters): IArticleResource; - } - - interface IArticleResource extends ng.resource.IResource { - title: string; - text: string; - date: Date; - author: number; - - // Although all actions defined on IArticleResourceClass are avaiable with - // the '$' prefix, we have the choice to expose only what we will use - $publish(): IArticleResource; - $unpublish(): IArticleResource; - } - - function MainController($resource: ng.resource.IResourceService) { - - // IntelliSense will provide IActionDescriptor interface and will validate - // your assignment against it - var publishDescriptor: ng.resource.IActionDescriptor; - publishDescriptor = { - method: 'GET', - isArray: false - }; - - // I could still create a descriptor without the interface... - var unpublishDescriptor = { - method: 'POST' - } - - // A call to the $resource service returns a IResourceClass. Since - // our own IArticleResourceClass defines 2 more actions, we cast the return - // value to make the compiler aware of that - var articleResource = $resource('/articles/:id', null, { - publish : publishDescriptor, - unpublish : unpublishDescriptor - }); - - // Now we can do this - articleResource.unpublish({ id: 1 }); - - // IResourceClass.get() will be automatically available here - var article: IArticleResource = articleResource.get({id: 1}, function success() { - // Again, default + custom action here... - article.title = 'New Title'; - article.$save(); - article.$publish(); - }); - } - -### Working with $resource in angular-1.0 definitions - - /// - /// - - // Let's define a custom resource - interface IArticleResourceClass extends ng.resource.IResourceClass { - publish: ng.resource.IActionCall; - unpublish: ng.resource.IActionCall; - } - interface IArticleResource extends ng.resource.IResource { - title: string; - text: string; - date: Date; - author: number; - $publish: ng.resource.IActionCall; - $unpublish: ng.resource.IActionCall; - } - - function MainController($resource: ng.resource.IResourceService) { - - // IntelliSense will provide IActionDescriptor interface and will validate - // your assignment against it - var publishDescriptor: ng.resource.IActionDescriptor; - publishDescriptor = { - method: 'GET', - isArray: false - }; - - // I could still create a descriptor without the interface... - var unpublishDescriptor = { - method: 'POST' - } - - // A call to the $resource service returns a IResourceClass. Since - // our own IArticleResourceClass defines 2 more actions, we cast the return - // value to make the compiler aware of that - var articles = $resource('/articles/:id', null, { - publish : publishDescriptor, - unpublish : unpublishDescriptor - }); - - // Now we can do this - articles.unpublish({ id: 1 }); - - // IResourceClass.get() will be automatically available here - var article = articles.get({id: 1}); + // Now we can do this + articleResource.unpublish({ id: 1 }); + // IResourceClass.get() will be automatically available here + var article: IArticleResource = articleResource.get({id: 1}, function success() { // Again, default + custom action here... article.title = 'New Title'; article.$save(); article.$publish(); - + }); +} +``` + +### Working with $resource in angular-1.0 definitions +```ts +/// +/// + +// Let's define a custom resource +interface IArticleResourceClass extends ng.resource.IResourceClass { + publish: ng.resource.IActionCall; + unpublish: ng.resource.IActionCall; +} +interface IArticleResource extends ng.resource.IResource { + title: string; + text: string; + date: Date; + author: number; + $publish: ng.resource.IActionCall; + $unpublish: ng.resource.IActionCall; +} + +function MainController($resource: ng.resource.IResourceService) { + + // IntelliSense will provide IActionDescriptor interface and will validate + // your assignment against it + var publishDescriptor: ng.resource.IActionDescriptor; + publishDescriptor = { + method: 'GET', + isArray: false + }; + + // I could still create a descriptor without the interface... + var unpublishDescriptor = { + method: 'POST' } + + // A call to the $resource service returns a IResourceClass. Since + // our own IArticleResourceClass defines 2 more actions, we cast the return + // value to make the compiler aware of that + var articles = $resource('/articles/:id', null, { + publish : publishDescriptor, + unpublish : unpublishDescriptor + }); + + // Now we can do this + articles.unpublish({ id: 1 }); + + // IResourceClass.get() will be automatically available here + var article = articles.get({id: 1}); + + // Again, default + custom action here... + article.title = 'New Title'; + article.$save(); + article.$publish(); + +} +``` diff --git a/angularjs/angular-resource-tests.ts b/angularjs/angular-resource-tests.ts index 911267f15..b223b8171 100644 --- a/angularjs/angular-resource-tests.ts +++ b/angularjs/angular-resource-tests.ts @@ -78,8 +78,10 @@ resourceClass = resourceService('test'); // IModule /////////////////////////////////////// var mod: ng.IModule; -var resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction; +var resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction; var resourceService: ng.resource.IResourceService; +resourceClass = resourceServiceFactoryFunction(resourceService); + resourceServiceFactoryFunction = function (resourceService) { return resourceClass }; mod = mod.factory('factory name', resourceServiceFactoryFunction); From 459e286cd0fc287a3373265816cf00f0a08417ee Mon Sep 17 00:00:00 2001 From: John Emau Date: Mon, 16 Dec 2013 19:17:47 -0800 Subject: [PATCH 17/21] added syntax highlighting --- angularjs/README.md | 50 +++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/angularjs/README.md b/angularjs/README.md index 363aea49d..263e046ea 100644 --- a/angularjs/README.md +++ b/angularjs/README.md @@ -43,11 +43,11 @@ To avoid cluttering the list of suggestions as you type in your IDE, all interfa **ngMockE2E** does not define a new namespace, but rather modifies some of **ng**'s interfaces. Bellow is an example of how to use the interfaces: - - function MainController($scope: ng.IScope, $http: ng.IHttpService) { - // code assistance will now be available for $scope and $http - } - +```ts +function MainController($scope: ng.IScope, $http: ng.IHttpService) { + // code assistance will now be available for $scope and $http +} +``` ## Services and other injectables @@ -71,33 +71,35 @@ The **$httpProvider**, thus, is defined by **ng.IHttpProvider**. TypeScript allows for static checking. Among other obvious things, that means you're gonna have to extend interfaces when you need to augment an object whose interface has been defined, because otherwise the compiler will see it as an error to try to assign a value to a unspecified member. Consider the following ordinary code: - - function Controller($scope) { - $scope.$broadcast('myEvent'); - $scope.title = 'Yabadabadu'; - } - +```ts +function Controller($scope) { + $scope.$broadcast('myEvent'); + $scope.title = 'Yabadabadu'; +} +``` That will not produce any compilation error because the compiler does not know the first thing about $scope to do any checking. For that same reason, you will not get any assistance either. Now consider this: - - function Controller($scope: ng.IScope) { - $scope.$broadcast('myEvent'); - $scope.title = 'Yabadabadu'; - } +```ts +function Controller($scope: ng.IScope) { + $scope.$broadcast('myEvent'); + $scope.title = 'Yabadabadu'; +} +``` Now we annotated `$scope` with the interface `ng.IScope`. The compiler now knows that, among other members, `$scope` has a method called `$broadcast`. That interface, however, does not define a `title` property. The compiler will complain about it. Since you are augmenting the $scope object, you should let the compiler know what to expect then: +```ts +interface ICustomScope extends ng.IScope { + title: string; +} - interface ICustomScope extends ng.IScope { - title: string; - } - - function Controller($scope: ng.ICustomScope) { - $scope.$broadcast('myEvent'); - $scope.title = 'Yabadabadu'; - } +function Controller($scope: ng.ICustomScope) { + $scope.$broadcast('myEvent'); + $scope.title = 'Yabadabadu'; +} +``` ## Examples From d82aee98f0613cf42c802236219012e90594bce7 Mon Sep 17 00:00:00 2001 From: Matthew James Davis Date: Tue, 17 Dec 2013 11:08:13 -0500 Subject: [PATCH 18/21] update --- mapsjs/mapsjs.d.ts | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/mapsjs/mapsjs.d.ts b/mapsjs/mapsjs.d.ts index ef921d27c..29627eae9 100644 --- a/mapsjs/mapsjs.d.ts +++ b/mapsjs/mapsjs.d.ts @@ -1158,7 +1158,7 @@ declare module 'mapsjs' { * @param {renderer} r The renderer delegate function with * signature renderer(quadview). */ - setRenderer(r: tile.renderer): void; + setRenderer(r: any): void; /** * Notifies the tile layer to check for changes to its renderer. @@ -1548,7 +1548,7 @@ declare module 'mapsjs' { * This should be called if the data changes or if, due to extent * changes, the density changes. */ - notifyRecompute(): void; + notifyRecompute(extents?: envelope): void; } /** @@ -1753,7 +1753,7 @@ declare module 'mapsjs' { * The bitmap or vector tile requestor using MapDotNet REST services. * @class requestorMDN */ - export class requestorMDN extends requestor { + export class requestorMDNRest extends requestor { constructor(endpoint: string, options?: { dataFormat?: string; timeoutMs?: number; @@ -2249,7 +2249,22 @@ declare module 'mapsjs' { * @param {number} [durationMs] Duration in miliseconds. * @param {function} [completeAction] Callback to perform on animaton complete. */ - setMapCenterToGeolocationAnimate(durationMs?: number, completeAction?: () => void): void; + setMapCenterToGeolocationAnimate(durationMs?: number, completeAction?: () => void): void; + + /** + * Offsets the current map center by the specified deltas in pixels. + * @param {number} [dx] offset x in pixels. + * @param {number} [dy] offset y in pixels. + */ + offsetMapCenterByPixelDelta(dx: number, dy: number): void; + + /** + * Offsets the current map center by the specified deltas in pixels - animated version. + * @param {number} [dx] offset x in pixels. + * @param {number} [dy] offset y in pixels. + * @param {number} [durationMs] animation duration in mS. + */ + offsetMapCenterByPixelDeltaAnimate(dx: number, dy: number, durationMs?: number): void; /** * Gets the current zoom level. @@ -2380,6 +2395,17 @@ declare module 'mapsjs' { * @returns {tile.layer} The removed tile layer. */ popTileLayer(): tile.layer; + + /** + * Removes a tile layer off the display stack by reference + * @param {tile.layer} tl A tile layer to remove. + */ + removeTileLayer(tl: tile.layer): void; + + /** + * Removes all tile layers off the display stack + */ + removeAllTileLayers(): void; /** * Gets the current number of tile layers in the display stack. @@ -2611,6 +2637,12 @@ declare module 'mapsjs' { * @param {number} cem The content extent margin in pixels. */ setContentExtentsMarginInPixels(cem: number): void; + + /** + * Sets the background color of the map using a css color string + * @param {number} b- a css color string + */ + setBackground(b: string): void; } } From 939223787d8a47a2711deffa513c6ea6d404cf3f Mon Sep 17 00:00:00 2001 From: Matthew James Davis Date: Tue, 17 Dec 2013 11:14:41 -0500 Subject: [PATCH 19/21] update --- mapsjs/mapsjs.d.ts | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/mapsjs/mapsjs.d.ts b/mapsjs/mapsjs.d.ts index c43fd5d56..29627eae9 100644 --- a/mapsjs/mapsjs.d.ts +++ b/mapsjs/mapsjs.d.ts @@ -1158,7 +1158,7 @@ declare module 'mapsjs' { * @param {renderer} r The renderer delegate function with * signature renderer(quadview). */ - setRenderer(r: tile.renderer): void; + setRenderer(r: any): void; /** * Notifies the tile layer to check for changes to its renderer. @@ -1548,7 +1548,7 @@ declare module 'mapsjs' { * This should be called if the data changes or if, due to extent * changes, the density changes. */ - notifyRecompute(): void; + notifyRecompute(extents?: envelope): void; } /** @@ -1753,7 +1753,7 @@ declare module 'mapsjs' { * The bitmap or vector tile requestor using MapDotNet REST services. * @class requestorMDN */ - export class requestorMDN extends requestor { + export class requestorMDNRest extends requestor { constructor(endpoint: string, options?: { dataFormat?: string; timeoutMs?: number; @@ -2249,7 +2249,22 @@ declare module 'mapsjs' { * @param {number} [durationMs] Duration in miliseconds. * @param {function} [completeAction] Callback to perform on animaton complete. */ - setMapCenterToGeolocationAnimate(durationMs?: number, completeAction?: () => void): void; + setMapCenterToGeolocationAnimate(durationMs?: number, completeAction?: () => void): void; + + /** + * Offsets the current map center by the specified deltas in pixels. + * @param {number} [dx] offset x in pixels. + * @param {number} [dy] offset y in pixels. + */ + offsetMapCenterByPixelDelta(dx: number, dy: number): void; + + /** + * Offsets the current map center by the specified deltas in pixels - animated version. + * @param {number} [dx] offset x in pixels. + * @param {number} [dy] offset y in pixels. + * @param {number} [durationMs] animation duration in mS. + */ + offsetMapCenterByPixelDeltaAnimate(dx: number, dy: number, durationMs?: number): void; /** * Gets the current zoom level. @@ -2382,15 +2397,15 @@ declare module 'mapsjs' { popTileLayer(): tile.layer; /** - * Removes a tile layer off the display stack by reference - * @param {tile.layer} tl - a tile layer - */ - removeTileLayer(tl: tile.layer): void; + * Removes a tile layer off the display stack by reference + * @param {tile.layer} tl A tile layer to remove. + */ + removeTileLayer(tl: tile.layer): void; - /** - * Removes all tile layers off the display stack - */ - removeAllTileLayers(): void; + /** + * Removes all tile layers off the display stack + */ + removeAllTileLayers(): void; /** * Gets the current number of tile layers in the display stack. From 93d4a199722de236005bc1c44c71d5809b30911c Mon Sep 17 00:00:00 2001 From: Richard Hepburn Date: Tue, 17 Dec 2013 11:29:04 -0500 Subject: [PATCH 20/21] Added TypeScript Definition files for Html2Canvas Added TypeScript Definition files for Html2Canvas - a library for taking screenshots of a browser window. --- README.md | 1 + html2canvas/html2canvas-tests.ts | 7 ++++ html2canvas/html2canvas.d.ts | 66 ++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 html2canvas/html2canvas-tests.ts create mode 100644 html2canvas/html2canvas.d.ts diff --git a/README.md b/README.md index 7e305efe3..4613bb106 100755 --- a/README.md +++ b/README.md @@ -97,6 +97,7 @@ List of Definitions * [Highcharts](http://www.highcharts.com/) (by [damianog](https://github.com/damianog)) * [highlight.js](https://github.com/isagalaev/highlight.js) (by [Niklas Mollenhauer](https://github.com/nikeee)) * [History.js](https://github.com/browserstate/history.js) (by [Boris Yankov](https://github.com/borisyankov)) +* [Html2Canvas.js](https://github.com/niklasvh/html2canvas/) (by [Richard Hepburn](https://github.com/rwhepburn)) * [Humane.js](http://wavded.github.com/humane-js/) (by [John Vrbanac](https://github.com/jmvrbanac)) * [i18next](http://i18next.com/) (by [Maarten Docter](https://github.com/mdocter)) * [iCheck](http://damirfoy.com/iCheck/) (by [Dániel Tar](https://github.com/qcz)) diff --git a/html2canvas/html2canvas-tests.ts b/html2canvas/html2canvas-tests.ts new file mode 100644 index 000000000..389e3f286 --- /dev/null +++ b/html2canvas/html2canvas-tests.ts @@ -0,0 +1,7 @@ +/// + +var element: HTMLElement; + +html2canvas(element); +html2canvas(element, {}); + diff --git a/html2canvas/html2canvas.d.ts b/html2canvas/html2canvas.d.ts new file mode 100644 index 000000000..689421971 --- /dev/null +++ b/html2canvas/html2canvas.d.ts @@ -0,0 +1,66 @@ +// Type definitions for html2canvas.js v0.4.1 +// Project: https://github.com/niklasvh/html2canvas +// Definitions by: Richard Hepburn +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module Html2Canvas { + interface Html2CanvasOptions { + /** Whether to allow cross-origin images to taint the canvas */ + allowTaint?: boolean; + + /** Canvas background color, if none is specified in DOM. Set undefined for transparent */ + background?: string; + + /** Define the heigt of the canvas in pixels. If null, renders with full height of the window. */ + height?: number; + + /** Whether to render each letter seperately. Necessary if letter-spacing is used. */ + letterRendering?: boolean; + + /** Whether to log events in the console. */ + logging?: boolean; + + /** Url to the proxy which is to be used for loading cross-origin images. If left empty, cross-origin images won't be loaded. */ + proxy?: string; + + /** Whether to test each image if it taints the canvas before drawing them */ + taintTest?: boolean; + + /** Timeout for loading images, in milliseconds. Setting it to 0 will result in no timeout. */ + timeout?: number; + + /** Define the width of the canvas in pixels. If null, renders with full width of the window. */ + width?: number; + + /** Whether to attempt to load cross-origin images as CORS served, before reverting back to proxy. */ + useCORS?: boolean; + + } +} + +interface Html2CanvasStatic { + + /** + * Renders an HTML element to a canvas so that a screenshot can be generated. + * + * The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, + * but builds the screenshot based on the information available on the page. + * + * @param {HTMLElement} element The HTML element which will be rendered to the canvas. Use the root element to render the entire window. + */ + (element: HTMLElement): void; + /** + * Renders an HTML element to a canvas so that a screenshot can be generated. + * + * The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, + * but builds the screenshot based on the information available on the page. + * + * @param {HTMLElement} element The HTML element which will be rendered to the canvas. Use the root element to render the entire window. + * @param {Html2CanvasOptions} options The options object that controls how the element will be rendered. + */ + (element: HTMLElement, options: Html2Canvas.Html2CanvasOptions): void; +} + +declare var html2canvas: Html2CanvasStatic; From cddd0b7aab18761214d26a0c7012cf45de5285a9 Mon Sep 17 00:00:00 2001 From: John Vilk Date: Tue, 17 Dec 2013 15:35:25 -0500 Subject: [PATCH 21/21] [Node] Node attaches errno information to some exceptions. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is valuable information for Node applications that need to figure out why a particular system call failed. Note that errno can either be a string or a number, which is why I have typed it as 'any'. While this is undocumented, it is tested: Code property: https://github.com/joyent/node/blob/v0.10.23-release/test/simple/test-fs-open.js#L34 Errno property [string]: https://github.com/joyent/node/blob/v0.10.23-release/test/internet/test-dns.js#L148 Errno property [number]: https://github.com/joyent/node/blob/v0.10.23-release/test/simple/test-domain-implicit-fs.js#L43 Syscall property: https://github.com/joyent/node/blob/v0.10.23-release/test/simple/test-stdout-close-catch.js#L38 Path property (I can’t find a test, but many examples have this line): https://github.com/joyent/node/blob/v0.10.23-release/deps/npm/node_modules/fstream-npm/example/bundle.js#L6 ..and well supported in the code for all platforms (this is where I got the name 'ErrnoException' from): *nix: https://github.com/joyent/node/blob/v0.10.23-release/src/node.cc#L719 Windows: https://github.com/joyent/node/blob/v0.10.23-release/src/node.cc#L856 Unfortunately, while every errno exception is guaranteed to have the ‘errno’ and ‘code’ properties (see the logic in the source code in node.cc), there is no hard guarantee that particular library functions will always pass an ErrnoException to the callback. I cannot find a counterexample at this moment, though. Since we can’t have union types in TypeScript, I simply made all of the properties on ErrnoException optional as a compromise. I am only adding modifications to the fs module, which definitely throws ErrnoExceptions. But according to the examples above, other modules (e.g. dns) also pass errno information back to applications. People familiar with those other modules can update their typings to reference this interface when applicable; I lack the experience with those modules to update their typings. Further proof: ```javascript $ node > var fs = require('fs'); undefined > fs.open('doesntexistlol', 'r', function(e) { console.log(Object.keys(e)); console.log(e.code); console.log(e.errno); console.log(e.path); }); undefined > [ 'errno', 'code', 'path' ] ENOENT 34 doesntexistlol ``` --- node/node.d.ts | 97 +++++++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 45 deletions(-) diff --git a/node/node.d.ts b/node/node.d.ts index 26ac44b94..b8fff3e27 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -67,6 +67,13 @@ declare var Buffer: { * * ************************************************/ +interface ErrnoException extends Error { + errno?: any; + code?: string; + path?: string; + syscall?: string; +} + interface EventEmitter { addListener(event: string, listener: Function): EventEmitter; on(event: string, listener: Function): EventEmitter; @@ -746,87 +753,87 @@ declare module "fs" { export interface ReadStream extends stream.ReadableStream { } export interface WriteStream extends stream.WritableStream { } - export function rename(oldPath: string, newPath: string, callback?: Function): void; + export function rename(oldPath: string, newPath: string, callback?: (err?: ErrnoException) => void): void; export function renameSync(oldPath: string, newPath: string): void; - export function truncate(path: string, callback?: Function): void; - export function truncate(path: string, len: number, callback?: Function): void; + export function truncate(path: string, callback?: (err?: ErrnoException) => void): void; + export function truncate(path: string, len: number, callback?: (err?: ErrnoException) => void): void; export function truncateSync(path: string, len?: number): void; - export function ftruncate(fd: number, callback?: Function): void; - export function ftruncate(fd: number, len: number, callback?: Function): void; + export function ftruncate(fd: number, callback?: (err?: ErrnoException) => void): void; + export function ftruncate(fd: number, len: number, callback?: (err?: ErrnoException) => void): void; export function ftruncateSync(fd: number, len?: number): void; - export function chown(path: string, uid: number, gid: number, callback?: Function): void; + export function chown(path: string, uid: number, gid: number, callback?: (err?: ErrnoException) => void): void; export function chownSync(path: string, uid: number, gid: number): void; - export function fchown(fd: number, uid: number, gid: number, callback?: Function): void; + export function fchown(fd: number, uid: number, gid: number, callback?: (err?: ErrnoException) => void): void; export function fchownSync(fd: number, uid: number, gid: number): void; - export function lchown(path: string, uid: number, gid: number, callback?: Function): void; + export function lchown(path: string, uid: number, gid: number, callback?: (err?: ErrnoException) => void): void; export function lchownSync(path: string, uid: number, gid: number): void; - export function chmod(path: string, mode: number, callback?: Function): void; - export function chmod(path: string, mode: string, callback?: Function): void; + export function chmod(path: string, mode: number, callback?: (err?: ErrnoException) => void): void; + export function chmod(path: string, mode: string, callback?: (err?: ErrnoException) => void): void; export function chmodSync(path: string, mode: number): void; export function chmodSync(path: string, mode: string): void; - export function fchmod(fd: number, mode: number, callback?: Function): void; - export function fchmod(fd: number, mode: string, callback?: Function): void; + export function fchmod(fd: number, mode: number, callback?: (err?: ErrnoException) => void): void; + export function fchmod(fd: number, mode: string, callback?: (err?: ErrnoException) => void): void; export function fchmodSync(fd: number, mode: number): void; export function fchmodSync(fd: number, mode: string): void; - export function lchmod(path: string, mode: number, callback?: Function): void; - export function lchmod(path: string, mode: string, callback?: Function): void; + export function lchmod(path: string, mode: number, callback?: (err?: ErrnoException) => void): void; + export function lchmod(path: string, mode: string, callback?: (err?: ErrnoException) => void): void; export function lchmodSync(path: string, mode: number): void; export function lchmodSync(path: string, mode: string): void; - export function stat(path: string, callback?: (err: Error, stats: Stats) => any): void; - export function lstat(path: string, callback?: (err: Error, stats: Stats) => any): void; - export function fstat(fd: number, callback?: (err: Error, stats: Stats) => any): void; + export function stat(path: string, callback?: (err: ErrnoException, stats: Stats) => any): void; + export function lstat(path: string, callback?: (err: ErrnoException, stats: Stats) => any): void; + export function fstat(fd: number, callback?: (err: ErrnoException, stats: Stats) => any): void; export function statSync(path: string): Stats; export function lstatSync(path: string): Stats; export function fstatSync(fd: number): Stats; - export function link(srcpath: string, dstpath: string, callback?: Function): void; + export function link(srcpath: string, dstpath: string, callback?: (err?: ErrnoException) => void): void; export function linkSync(srcpath: string, dstpath: string): void; - export function symlink(srcpath: string, dstpath: string, type?: string, callback?: Function): void; + export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: ErrnoException) => void): void; export function symlinkSync(srcpath: string, dstpath: string, type?: string): void; - export function readlink(path: string, callback?: (err: Error, linkString: string) => any): void; + export function readlink(path: string, callback?: (err: ErrnoException, linkString: string) => any): void; export function readlinkSync(path: string): string; - export function realpath(path: string, callback?: (err: Error, resolvedPath: string) => any): void; - export function realpath(path: string, cache: {[path: string]: string}, callback: (err: Error, resolvedPath: string) =>any): void; + export function realpath(path: string, callback?: (err: ErrnoException, resolvedPath: string) => any): void; + export function realpath(path: string, cache: {[path: string]: string}, callback: (err: ErrnoException, resolvedPath: string) =>any): void; export function realpathSync(path: string, cache?: {[path: string]: string}): void; - export function unlink(path: string, callback?: Function): void; + export function unlink(path: string, callback?: (err?: ErrnoException) => void): void; export function unlinkSync(path: string): void; - export function rmdir(path: string, callback?: Function): void; + export function rmdir(path: string, callback?: (err?: ErrnoException) => void): void; export function rmdirSync(path: string): void; - export function mkdir(path: string, callback?: Function): void; - export function mkdir(path: string, mode: number, callback?: Function): void; - export function mkdir(path: string, mode: string, callback?: Function): void; + export function mkdir(path: string, callback?: (err?: ErrnoException) => void): void; + export function mkdir(path: string, mode: number, callback?: (err?: ErrnoException) => void): void; + export function mkdir(path: string, mode: string, callback?: (err?: ErrnoException) => void): void; export function mkdirSync(path: string, mode?: number): void; export function mkdirSync(path: string, mode?: string): void; - export function readdir(path: string, callback?: (err: Error, files: string[]) => void): void; + export function readdir(path: string, callback?: (err: ErrnoException, files: string[]) => void): void; export function readdirSync(path: string): string[]; - export function close(fd: number, callback?: Function): void; + export function close(fd: number, callback?: (err?: ErrnoException) => void): void; export function closeSync(fd: number): void; - export function open(path: string, flags: string, callback?: (err: Error, fd: number) => any): void; - export function open(path: string, flags: string, mode: number, callback?: (err: Error, fd: number) => any): void; - export function open(path: string, flags: string, mode: string, callback?: (err: Error, fd: number) => any): void; + export function open(path: string, flags: string, callback?: (err: ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: number, callback?: (err: ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: string, callback?: (err: ErrnoException, fd: number) => any): void; export function openSync(path: string, flags: string, mode?: number): number; export function openSync(path: string, flags: string, mode?: string): number; - export function utimes(path: string, atime: number, mtime: number, callback?: Function): void; + export function utimes(path: string, atime: number, mtime: number, callback?: (err?: ErrnoException) => void): void; export function utimesSync(path: string, atime: number, mtime: number): void; - export function futimes(fd: number, atime: number, mtime: number, callback?: Function): void; + export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: ErrnoException) => void): void; export function futimesSync(fd: number, atime: number, mtime: number): void; - export function fsync(fd: number, callback?: Function): void; + export function fsync(fd: number, callback?: (err?: ErrnoException) => void): void; export function fsyncSync(fd: number): void; - export function write(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, written: number, buffer: NodeBuffer) => void): void; + export function write(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: ErrnoException, written: number, buffer: NodeBuffer) => void): void; export function writeSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number; - export function read(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: Error, bytesRead: number, buffer: NodeBuffer) => void): void; + export function read(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number, callback?: (err: ErrnoException, bytesRead: number, buffer: NodeBuffer) => void): void; export function readSync(fd: number, buffer: NodeBuffer, offset: number, length: number, position: number): number; - export function readFile(filename: string, options: { encoding?: string; flag?: string; }, callback: (err: Error, data: any) => void): void; - export function readFile(filename: string, callback: (err: Error, data: NodeBuffer) => void ): void; + export function readFile(filename: string, options: { encoding?: string; flag?: string; }, callback: (err: ErrnoException, data: any) => void): void; + export function readFile(filename: string, callback: (err: ErrnoException, data: NodeBuffer) => void ): void; export function readFileSync(filename: string, options?: { flag?: string; }): NodeBuffer; export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string; - export function writeFile(filename: string, data: any, callback?: (err: Error) => void): void; - export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: Error) => void): void; - export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: Error) => void): void; + export function writeFile(filename: string, data: any, callback?: (err: ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: ErrnoException) => void): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; - export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: Error) => void): void; - export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: Error) => void): void; - export function appendFile(filename: string, data: any, callback?: (err: Error) => void): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: ErrnoException) => void): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: ErrnoException) => void): void; + export function appendFile(filename: string, data: any, callback?: (err: ErrnoException) => void): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void;