diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index d634fc8731..1c0246ab40 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -87,6 +87,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](chai-as-promised/chai-as-promised.d.ts) [chai-as-promised](https://github.com/domenic/chai-as-promised) by [jt000](https://github.com/jt000) * [:link:](chai-datetime/chai-datetime.d.ts) [chai-datetime](https://github.com/gaslight/chai-datetime.git) by [Cliff Burger](https://github.com/cliffburger) * [:link:](chai-fuzzy/chai-fuzzy.d.ts) [chai-fuzzy](http://chaijs.com/plugins/chai-fuzzy) by [Bart van der Schoor](https://github.com/Bartvds) +* [:link:](chai-http/chai-http.d.ts) [chai-http](https://github.com/chaijs/chai-http) by [Wim Looman](https://github.com/Nemo157) * [:link:](chai-jquery/chai-jquery.d.ts) [chai-jquery](https://github.com/chaijs/chai-jquery) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid) * [:link:](chalk/chalk.d.ts) [chalk](https://github.com/sindresorhus/chalk) by [Diullei Gomes](https://github.com/Diullei), [Bart van der Schoor](https://github.com/Bartvds) * [:link:](change-case/change-case.d.ts) [change-case](https://github.com/blakeembrey/change-case) by [Asana](https://asana.com) @@ -134,6 +135,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](devextreme/dx.devextreme.d.ts) [DevExtreme](http://js.devexpress.com) by [DevExpress Inc.](http://devexpress.com) * [:link:](dhtmlxgantt/dhtmlxgantt.d.ts) [dhtmlxGantt](http://dhtmlx.com/docs/products/dhtmlxGantt) by [Maksim Kozhukh](http://github.com/mkozhukh) * [:link:](dhtmlxscheduler/dhtmlxscheduler.d.ts) [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler) by [Maksim Kozhukh](http://github.com/mkozhukh) +* [:link:](di-lite/di-lite.d.ts) [di-lite](https://github.com/NickQiZhu/di.js) by [Timothy Morris](https://github.com/dcrusader) * [:link:](diff/diff.d.ts) [diff](https://github.com/kpdecker/jsdiff) by [vvakame](https://github.com/vvakame) * [:link:](docCookies/docCookies.d.ts) [docCookies](https://developer.mozilla.org/en-US/docs/Web/API/document.cookie) by [Jon Egerton](https://github.com/jonegerton) * [:link:](dock-spawn/dock-spawn.d.ts) [Dock Spawn](http://dockspawn.com) by [Drew Noakes](https://drewnoakes.com) @@ -151,6 +153,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](easystarjs/easystarjs.d.ts) [EasyStar.js](http://easystarjs.com) by [Magnus Gustafsson](https://github.com/borundin) * [:link:](ejs-locals/ejs-locals.d.ts) [ejs-locals](https://github.com/randometc/ejs-locals) by [jt000](https://github.com/jt000) * [:link:](jquery.elang/jquery.elang.d.ts) [eLang](https://github.com/sumegizoltan/ELang) by [Zoltan Sumegi](https://github.com/sumegizoltan) +* [:link:](element-resize-event/element-resize-event.d.ts) [element-resize-event](https://github.com/KyleAMathews/element-resize-event) by [Rogier Schouten](https://github.com/rogierschouten) * [:link:](elm/elm.d.ts) [Elm](http://elm-lang.org) by [Dénes Harmath](https://github.com/thSoft) * [:link:](ember/ember.d.ts) [Ember.js](http://emberjs.com) by [Jed Mao](https://github.com/jedmao) * [:link:](emissary/emissary.d.ts) [emissary](https://github.com/atom/emissary) by [vvakame](https://github.com/vvakame) @@ -193,6 +196,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](flux/flux.d.ts) [Flux](http://facebook.github.io/flux) by [Steve Baker](https://github.com/stkb) * [:link:](ion.rangeSlider/ion.rangeSlider.d.ts) [for Ion.RangeSlider](https://github.com/IonDen/ion.rangeSlider) by [Sixin Li](https://github.com/sixinli) * [:link:](form-data/form-data.d.ts) [form-data](https://github.com/felixge/node-form-data) by [Carlos Ballesteros Velasco](https://github.com/soywiz) +* [:link:](formidable/formidable.d.ts) [Formidable](https://github.com/felixge/node-formidable) by [Wim Looman](https://github.com/Nemo157) * [:link:](foundation/foundation.d.ts) [Foundation](http://foundation.zurb.com) by [Boris Yankov](https://github.com/borisyankov) * [:link:](fpsmeter/FPSMeter.d.ts) [FPSmeter](http://darsa.in/fpsmeter) by [Aaron Lampros](http://github.com/alampros) * [:link:](from/from.d.ts) [from](https://github.com/dominictarr/from) by [Bart van der Schoor](https://github.com/Bartvds) @@ -333,6 +337,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jquery.superLink/jquery.superLink.d.ts) [jquery.superLink](http://james.padolsey.com/demos/plugins/jQuery/superLink/superlink.jquery.js) by [Blake Niemyjski](https://github.com/niemyjski) * [:link:](jquery.tile/jquery.tile.d.ts) [jquery.tile.js](https://github.com/urin/jquery.tile.js) by [Shunsuke Ohtani](https://github.com/zaneli) * [:link:](jquery.timeago/jquery.timeago.d.ts) [jQuery.timeago.js](http://timeago.yarp.com) by [François Guillot](http://fguillot.developpez.com) +* [:link:](jquery.tipsy/jquery.tipsy.d.ts) [jQuery.tipsy](http://onehackoranother.com/projects/jquery/tipsy) by [Brian Dukes](https://github.com/bdukes) * [:link:](jquery.transit/jquery.transit.d.ts) [jQuery.transit.js](http://ricostacruz.com/jquery.transit) by [MrBigDog2U](https://github.com/MrBigDog2U) * [:link:](jquery.validation/jquery.validation.d.ts) [jquery.validation](http://jqueryvalidation.org) by [François de Campredon](https://github.com/fdecampredon), [Johj Reilly](https://github.com/johnnyreilly) * [:link:](jquery.timer/jquery.timer.d.ts) [jQueryTimer](https://github.com/jchavannes/jquery-timer) by [Joshua Strobl](https://github.com/JoshStrobl) @@ -345,6 +350,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](jsbn/jsbn.d.ts) [jsbn](http://www-cs-students.stanford.edu/%7Etjw/jsbn) by [Eugene Chernyshov](https://github.com/Evgenus) * [:link:](jscrollpane/jscrollpane.d.ts) [jScrollPane](http://jscrollpane.kelvinluck.com) by [Dániel Tar](https://github.com/qcz) * [:link:](jsdeferred/jsdeferred.d.ts) [JSDeferred](https://github.com/cho45/jsdeferred) by [Daisuke Mino](https://github.com/minodisk) +* [:link:](jsdom/jsdom.d.ts) [jsdom](https://github.com/tmpvar/jsdom) by [Asana](https://asana.com) * [:link:](jsesc/jsesc.d.ts) [jsesc](https://github.com/mathiasbynens/jsesc) by [Bart van der Schoor](https://github.com/Bartvds) * [:link:](jsfl/jsfl.d.ts) [JSFL](https://adobe.com) by [soywiz](https://github.com/soywiz) * [:link:](jshamcrest/jshamcrest.d.ts) [JsHamcrest](https://github.com/danielfm/jshamcrest) by [David Harkness](https://github.com/dharkness) @@ -493,7 +499,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker) * [:link:](noVNC/noVNC.d.ts) [noVNC](https://github.com/kanaka/noVNC) by [Ken Smith](https://github.com/smithkl42) * [:link:](npm/npm.d.ts) [npm](https://github.com/npm/npm) by [Maxime LUCE](https://github.com/SomaticIT) -* [:link:](nprogress/nprogress.d.ts) [NProgress](https://github.com/rstacruz/nprogress) by [Judah Gabriel Himango](http://debuggerdotbreak.wordpress.com) +* [:link:](nprogress/NProgress.d.ts) [NProgress](https://github.com/rstacruz/nprogress) by [Judah Gabriel Himango](http://debuggerdotbreak.wordpress.com) * [:link:](numeraljs/numeraljs.d.ts) [Numeral.js](https://github.com/adamwdraper/Numeral-js) by [Vincent Bortone](https://github.com/vbortone) * [:link:](object-path/object-path.d.ts) [objectPath](https://github.com/mariocasciaro/object-path) by [Paulo Cesar](https://github.com/pocesar) * [:link:](oboe/oboe.d.ts) [oboe](https://github.com/jimhigson/oboe.js) by [Jared Klopper](https://github.com/optical) @@ -581,6 +587,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](rx/rx.time.d.ts) [RxJS-Time](http://rx.codeplex.com) by [Carl de Billy](http://carl.debilly.net), [Igor Oleinikov](https://github.com/Igorbek) * [:link:](rx/rx.virtualtime.d.ts) [RxJS-VirtualTime](http://rx.codeplex.com) by [gsino](http://www.codeplex.com/site/users/view/gsino), [Igor Oleinikov](https://github.com/Igorbek) * [:link:](sammyjs/sammyjs.d.ts) [Sammy.js](http://sammyjs.org) by [Boris Yankov](https://github.com/borisyankov), [Oisin Grehan](https://github.com/oising) +* [:link:](sanitize-filename/sanitize-filename.d.ts) [sanitize-filename](https://github.com/parshap/node-sanitize-filename) by [Wim Looman](https://github.com/Nemo157) * [:link:](screenfull/screenfull.d.ts) [screenfull.js](https://github.com/sindresorhus/screenfull.js) by [Ilia Choly](http://github.com/icholy) * [:link:](select2/select2.d.ts) [Select2](http://ivaynberg.github.com/select2) by [Boris Yankov](https://github.com/borisyankov) * [:link:](selectize/selectize.d.ts) [Selectize](https://github.com/brianreavis/selectize.js) by [Adi Dahiya](https://github.com/adidahiya) @@ -705,6 +712,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam * [:link:](webrtc/MediaStream.d.ts) [WebRTC](http://dev.w3.org/2011/webrtc) by [Ken Smith](https://github.com/smithkl42) * [:link:](websocket/websocket.d.ts) [websocket](https://github.com/Worlize/WebSocket-Node) by [Paul Loyd](https://github.com/loyd) * [:link:](when/when.d.ts) [When](https://github.com/cujojs/when) by [Derek Cicerone](https://github.com/derekcicerone), [Wim Looman](https://github.com/Nemo157) +* [:link:](which/which.d.ts) [which](https://github.com/isaacs/node-which) by [vvakame](https://github.com/vvakame) * [:link:](winjs/winjs.d.ts) [WinJS](http://try.buildwinjs.com) by [TypeScript samples](https://www.typescriptlang.org), [Adam Hewitt](https://github.com/adamhewitt627), [Craig Treasure](https://github.com/craigktreasure), [Jeff Fisher](https://github.com/xirzec) * [:link:](winrt/winrt.d.ts) [WinRT](http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx) by [TypeScript samples](https://www.typescriptlang.org) * [:link:](winston/winston.d.ts) [winston](https://github.com/flatiron/winston) by [bonnici](https://github.com/bonnici), [Peter Harris](https://github.com/codeanimal) diff --git a/FileSaver/FileSaver-tests.ts b/FileSaver/FileSaver-tests.ts new file mode 100644 index 0000000000..6a5426a6a2 --- /dev/null +++ b/FileSaver/FileSaver-tests.ts @@ -0,0 +1,11 @@ +/// + +/** + * @summary Test for "saveAs" function. + */ +function testSaveAs() { + var data: Blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"}); + var filename: string = 'hello world.txt'; + + saveAs(data, filename); +} diff --git a/FileSaver/FileSaver-tests.ts.tscparams b/FileSaver/FileSaver-tests.ts.tscparams new file mode 100644 index 0000000000..934bc29ef2 --- /dev/null +++ b/FileSaver/FileSaver-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny \ No newline at end of file diff --git a/FileSaver/FileSaver.d.ts b/FileSaver/FileSaver.d.ts new file mode 100644 index 0000000000..0b6cc75d60 --- /dev/null +++ b/FileSaver/FileSaver.d.ts @@ -0,0 +1,27 @@ +// Type definitions for FileSaver.js +// Project: https://github.com/eligrey/FileSaver.js/ +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * @summary Interface for "saveAs" function. + * @author Cyril Schumacher + * @version 1.0 + */ +interface FileSaver { + ( + /** + * @summary Data. + * @type {Blob} + */ + data: Blob, + + /** + * @summary File name. + * @type {DOMString} + */ + filename: string + ): void +} + +declare var saveAs: FileSaver; \ No newline at end of file diff --git a/angular-protractor/angular-protractor.d.ts b/angular-protractor/angular-protractor.d.ts index 002676c25f..11e9d3268b 100644 --- a/angular-protractor/angular-protractor.d.ts +++ b/angular-protractor/angular-protractor.d.ts @@ -918,6 +918,7 @@ declare module protractor { * @return {!webdriver.promise.Promise} A promise that resolves to the final * value of the accumulator. */ + reduce(reduceFn: (acc: T, element: ElementFinder, index: number, arr: ElementFinder[]) => webdriver.promise.Promise, initialValue: T): webdriver.promise.Promise; reduce(reduceFn: (acc: T, element: ElementFinder, index: number, arr: ElementFinder[]) => T, initialValue: T): webdriver.promise.Promise; /** diff --git a/angularjs/angular-route-tests.ts b/angularjs/angular-route-tests.ts index 3b35a97bbc..3607b6f137 100644 --- a/angularjs/angular-route-tests.ts +++ b/angularjs/angular-route-tests.ts @@ -8,10 +8,29 @@ declare var $routeProvider: ng.route.IRouteProvider; $routeProvider - .when('/projects/:projectId/dashboard',{ - controller: '', - templateUrl: '', - caseInsensitiveMatch: true, - reloadOnSearch: false - }) - .otherwise({redirectTo: '/'}); + .when('/projects/:projectId/dashboard', { + controller: 'I am a string', + templateUrl: "So am I", + caseInsensitiveMatch: true, + reloadOnSearch: false + }) + .when('/projects/:projectId/dashboard2', { + controller: function () { + //Look at me - I'm a function! + }, + template: function ($routeParams?: ng.route.IRouteParamsService) { + return "I return a string" + } + }) + .when('/projects/:projectId/dashboard3', { + controllerAs: 'I am a string', + template: "Yup. String" + }) + .when('/projects/:projectId/dashboard4', { + controller: 'I am a string', + templateUrl: function ($routeParams?: ng.route.IRouteParamsService) { + return "I return a string" + } + }) + .otherwise({ redirectTo: '/' }) + .otherwise({ redirectTo: ($routeParams?: ng.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) => "" }); diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 949680bf2d..936b42589e 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -42,7 +42,7 @@ declare module ng.route { * {(string|function()=} * Controller fn that should be associated with newly created scope or the name of a registered controller if passed as a string. */ - controller?: any; + controller?: string|Function; /** * A controller alias name. If present the controller will be published to scope under the controllerAs name. */ @@ -59,7 +59,7 @@ declare module ng.route { * * {Array.} - route parameters extracted from the current $location.path() by applying the current route */ - template?: string; + template?: string|{($routeParams?: ng.route.IRouteParamsService) : string;} /** * {string=|function()=} * Path or function that returns a path to an html template that should be used by ngView. @@ -68,14 +68,14 @@ declare module ng.route { * * {Array.} - route parameters extracted from the current $location.path() by applying the current route */ - templateUrl?: any; + templateUrl?: string|{ ($routeParams?: ng.route.IRouteParamsService): string; } /** * {Object.=} - An optional map of dependencies which should be injected into the controller. If any of these dependencies are promises, the router will wait for them all to be resolved or one to be rejected before the controller is instantiated. If all the promises are resolved successfully, the values of the resolved promises are injected and $routeChangeSuccess event is fired. If any of the promises are rejected the $routeChangeError event is fired. The map object is: * * - key - {string}: a name of a dependency to be injected into the controller. * - factory - {string|function}: If string then it is an alias for a service. Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller. Be aware that ngRoute.$routeParams will still refer to the previous route within these resolve functions. Use $route.current.params to access the new route parameters, instead. */ - resolve?: {[key: string]: any}; + resolve?: {[key: string]: any}; /** * {(string|function())=} * Value to update $location path with and trigger route redirection. @@ -87,7 +87,7 @@ declare module ng.route { * - {Object} - current $location.search() * - The custom redirectTo function is expected to return a string which will be used to update $location.path() and $location.search(). */ - redirectTo?: any; + redirectTo?: string|{($routeParams?: ng.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) : string}; /** * Reload route when only $location.search() or $location.hash() changes. * diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index bdaf66b452..f9ebda1208 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -392,32 +392,44 @@ declare module ng { // see http://docs.angularjs.org/api/ng.$compile.directive.Attributes /////////////////////////////////////////////////////////////////////////// interface IAttributes { - // 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 + /** + * 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 - // for the class addition. + /** + * 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 - // the class removal. + /** + * 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; - // Set DOM element attribute value. + /** + * Set DOM element attribute value. + */ $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 - // interpolated value changes. + /** + * Observes an interpolated attribute. + * 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 - // to do reverse lookup from normalized name back to actual name. + /** + * 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; } @@ -820,33 +832,9 @@ declare module ng { * Change search part when called with parameter and return $location. * * @param search New search params - * @param paramValue If search is a string or a Number, then paramValue will override only a single search property. If paramValue is null, the property specified via the first argument will be deleted. + * @param paramValue If search is a string or a Number, then paramValue will override only a single search property. If paramValue is null, the property specified via the first argument will be deleted. If paramValue is an array, it will override the property of the search component of $location specified via the first argument. If paramValue is true, the property specified via the first argument will be added with no value nor trailing equal sign. */ - search(search: string, paramValue: string): ILocationService; - - /** - * Change search part when called with parameter and return $location. - * - * @param search New search params - * @param paramValue If search is a string or a Number, then paramValue will override only a single search property. If paramValue is null, the property specified via the first argument will be deleted. - */ - search(search: string, paramValue: number): ILocationService; - - /** - * Change search part when called with parameter and return $location. - * - * @param search New search params - * @param paramValue If paramValue is an array, it will override the property of the search component of $location specified via the first argument. - */ - search(search: string, paramValue: string[]): ILocationService; - - /** - * Change search part when called with parameter and return $location. - * - * @param search New search params - * @param paramValue If paramValue is true, the property specified via the first argument will be added with no value nor trailing equal sign. - */ - search(search: string, paramValue: boolean): ILocationService; + search(search: string, paramValue: string|number|string[]|boolean): ILocationService; state(): any; state(state: any): ILocationService; @@ -906,15 +894,7 @@ declare module ng { * * @param promises An array or hash of promises. */ - all(promises: IPromise[]): IPromise; - /** - * Combines multiple promises into a single promise that is resolved when all of the input promises are resolved. - * - * Returns a single promise that will be resolved with an array/hash of values, each value corresponding to the promise at the same index/key in the promises array/hash. If any of the promises is resolved with a rejection, this resulting promise will be rejected with the same rejection value. - * - * @param promises An array or hash of promises. - */ - all(promises: { [id: string]: IPromise; }): IPromise<{ [id: string]: any }>; + all(promises: IPromise[]|{ [id: string]: IPromise; }): IPromise; /** * Creates a Deferred object which represents a task which will finish in the future. */ @@ -932,13 +912,7 @@ declare module ng { * * @param value Value or a promise */ - when(value: IPromise): IPromise; - /** - * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. - * - * @param value Value or a promise - */ - when(value: T): IPromise; + when(value: IPromise|T): IPromise; /** * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted. * @@ -953,32 +927,12 @@ declare module ng { * * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. */ - then(successCallback: (promiseValue: T) => IHttpPromise, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; - /** - * Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected. - * - * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. - */ - then(successCallback: (promiseValue: T) => IPromise, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; - /** - * Regardless of when the promise was or will be resolved or rejected, then calls one of the success or error callbacks asynchronously as soon as the result is available. The callbacks are called with a single argument: the result or rejection reason. Additionally, the notify callback may be called zero or more times to provide a progress indication, before the promise is resolved or rejected. - * - * This method returns a new promise which is resolved or rejected via the return value of the successCallback, errorCallback. It also notifies via the return value of the notifyCallback method. The promise can not be resolved or rejected from the notifyCallback method. - */ - then(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult, notifyCallback?: (state: any) => any): IPromise; + then(successCallback: (promiseValue: T) => IHttpPromise|IPromise|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise; /** * Shorthand for promise.then(null, errorCallback) */ - catch(onRejected: (reason: any) => IHttpPromise): IPromise; - /** - * Shorthand for promise.then(null, errorCallback) - */ - catch(onRejected: (reason: any) => IPromise): IPromise; - /** - * Shorthand for promise.then(null, errorCallback) - */ - catch(onRejected: (reason: any) => TResult): IPromise; + catch(onRejected: (reason: any) => IHttpPromise|IPromise|TResult): IPromise; /** * Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value. This is useful to release resources or do some clean-up that needs to be done whether the promise was rejected or resolved. See the full specification for more information. @@ -1273,8 +1227,7 @@ declare module ng { interface IHttpPromise extends IPromise { success(callback: IHttpPromiseCallback): IHttpPromise; error(callback: IHttpPromiseCallback): IHttpPromise; - then(successCallback: (response: IHttpPromiseCallbackArg) => IPromise, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; - then(successCallback: (response: IHttpPromiseCallbackArg) => TResult, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; + then(successCallback: (response: IHttpPromiseCallbackArg) => IPromise|TResult, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise; } /** diff --git a/backbone/backbone.d.ts b/backbone/backbone.d.ts index 4176724589..834ebc8318 100644 --- a/backbone/backbone.d.ts +++ b/backbone/backbone.d.ts @@ -311,14 +311,14 @@ declare module Backbone { private _updateHash(location: Location, fragment: string, replace: boolean): void; } - interface ViewOptions { - model?: TModel; - collection?: Backbone.Collection; - el?: any; - id?: string; - className?: string; - tagName?: string; - attributes?: any[]; + interface ViewOptions { + model?: TModel; + collection?: Backbone.Collection; + el?: any; + id?: string; + className?: string; + tagName?: string; + attributes?: {[id: string]: any}; } class View extends Events { diff --git a/bootbox/bootbox.d.ts b/bootbox/bootbox.d.ts index 6177e13962..b9f3db22b9 100644 --- a/bootbox/bootbox.d.ts +++ b/bootbox/bootbox.d.ts @@ -26,8 +26,8 @@ interface BootboxButton { } interface BootboxDialogOptions { - message: any; // String | Element - title?: any; // String | Element + message: string | Element; + title?: string | Element; callback?: (result: boolean) => any; show?: boolean; onEscape?: () => any; @@ -60,4 +60,4 @@ interface BootboxStatic { hideAll(): void; } -declare var bootbox: BootboxStatic; \ No newline at end of file +declare var bootbox: BootboxStatic; diff --git a/bunyan/bunyan.d.ts b/bunyan/bunyan.d.ts index 3c780c48e4..fd4e9d89a4 100644 --- a/bunyan/bunyan.d.ts +++ b/bunyan/bunyan.d.ts @@ -18,8 +18,8 @@ declare module "bunyan" { child(obj:Object, simple?:boolean):Logger; reopenFileStreams():void; - level(value:any /* number | string */):void; - levels(name:any /* number | string */, value:any /* number | string */):void; + level(value: number | string):void; + levels(name: number | string, value: number | string):void; trace(error:Error, format?:any, ...params:any[]):void; trace(buffer:Buffer, format?:any, ...params:any[]):void; @@ -62,9 +62,9 @@ declare module "bunyan" { interface Stream { type?: string; - level?: any; // number | string + level?: number | string; path?: string; - stream?: WritableStream; + stream?: WritableStream | Stream; closeOnExit?: boolean; } @@ -77,7 +77,7 @@ declare module "bunyan" { export var ERROR:number; export var FATAL:number; - export function resolveLevel(value:any /* number | string */):number; + export function resolveLevel(value: number | string):number; export function createLogger(options:LoggerOptions):Logger; diff --git a/chai-http/chai-http-tests.ts b/chai-http/chai-http-tests.ts new file mode 100644 index 0000000000..e6e4713213 --- /dev/null +++ b/chai-http/chai-http-tests.ts @@ -0,0 +1,103 @@ +/// +/// + +import fs = require('fs'); +import http = require('http'); +import chai = require('chai'); +import chaiHttp = require('chai-http'); +import when = require('when'); + +chai.use(chaiHttp); + +// Add promise support if this does not exist natively. +if (!global.Promise) { + chai.request.addPromises(when.promise); +} + + +var app: http.Server; + +chai.request(app).get('/'); +chai.request('http://localhost:8080').get('/'); + +chai.request(app) + .put('/user/me') + .set('X-API-Key', 'foobar') + .send({ password: '123', confirmPassword: '123' }); + +chai.request(app) + .post('/user/me') + .field('_method', 'put') + .field('password', '123') + .field('confirmPassword', '123'); + +chai.request(app) + .post('/user/avatar') + .attach('imageField', fs.readFileSync('avatar.png'), 'avatar.png'); + +chai.request(app) + .get('/protected') + .auth('user', 'pass'); + +chai.request(app) + .get('/search') + .query('name', 'foo') + .query('limit', '10'); + +chai.request(app) + .put('/user/me') + .send({ passsword: '123', confirmPassword: '123' }) + .end((err: any, res: chaiHttp.Response) => { + chai.expect(err).to.be.null; + chai.expect(res).to.have.status(200); + }); + +chai.request(app) + .put('/user/me') + .send({ passsword: '123', confirmPassword: '123' }) + .then((res: chaiHttp.Response) => chai.expect(res).to.have.status(200)) + .catch((err: any) => { throw err; }); + +var agent = chai.request.agent(app); + +agent + .post('/session') + .send({ username: 'me', password: '123' }) + .then((res: chaiHttp.Response) => { + chai.expect(res).to.have.cookie('sessionid'); + // The `agent` now has the sessionid cookie saved, and will send it + // back to the server in the next request: + return agent.get('/user/me') + .then((res: chaiHttp.Response) => chai.expect(res).to.have.status(200)); + }); + +function test1() { + var req = chai.request(app).get('/'); + req.then((res: chaiHttp.Response) => { + chai.expect(res).to.have.status(200); + chai.expect(res).to.have.header('content-type', 'text/plain'); + chai.expect(res).to.have.header('content-type', /^text/); + chai.expect(res).to.have.headers; + chai.expect('127.0.0.1').to.be.an.ip; + chai.expect(res).to.be.json; + chai.expect(res).to.be.html; + chai.expect(res).to.be.text; + chai.expect(res).to.redirect; + chai.expect(res).to.redirectTo('http://example.com'); + chai.expect(res).to.have.param('orderby'); + chai.expect(res).to.have.param('orderby', 'date'); + chai.expect(res).to.not.have.param('limit'); + chai.expect(req).to.have.cookie('session_id'); + chai.expect(req).to.have.cookie('session_id', '1234'); + chai.expect(req).to.not.have.cookie('PHPSESSID'); + chai.expect(res).to.have.cookie('session_id'); + chai.expect(res).to.have.cookie('session_id', '1234'); + chai.expect(res).to.not.have.cookie('PHPSESSID'); + chai.expect(res.body).to.have.property('version', '4.0.0'); + }, (err: any) => { + throw err; + }); +} + + +when(chai.request(app).get('/')).done(() => console.log('success'), () => console.log('failure')); diff --git a/chai-http/chai-http.d.ts b/chai-http/chai-http.d.ts new file mode 100644 index 0000000000..fed2a84161 --- /dev/null +++ b/chai-http/chai-http.d.ts @@ -0,0 +1,87 @@ +// Type definitions for chai-http +// Project: https://github.com/chaijs/chai-http +// Definitions by: Wim Looman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module chai { + export function request(server: any): chaiHttp.Agent; + + export module request { + export function agent(server: any): chaiHttp.Agent; + export function addPromises(promiseConstructor: chaiHttp.PromiseConstructor): void; + } + + interface Assertions extends chaiHttp.Assertions { + } + + interface TypeComparison extends chaiHttp.TypeComparison { + } +} + +declare function chaiHttp(chai: any, utils: any): void; +declare module chaiHttp { + interface PromiseConstructor { + (resolver: (resolve: (value: T) => void, reject: (reason: any) => void) => void): Promise; + } + + interface Promise { + then(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U): Promise; + } + + interface Response { + body: any; + type: string; + status: number; + } + + interface Request extends FinishedRequest { + attach(field: string, file: string, filename: string): Request; + attach(field: string, file: Buffer, filename: string): Request; + set(field: string, val: string): Request; + query(key: string, value: string): Request; + send(data: Object): Request; + auth(user: string, name: string): Request; + field(name: string, val: string): Request; + end(callback?: (err: any, res: Response) => void): FinishedRequest; + } + + interface FinishedRequest { + then(success?: (res: Response) => void, failure?: (err: any) => void): FinishedRequest; + catch(failure?: (err: any) => void): FinishedRequest; + } + + interface Agent { + get(url: string, callback?: (err: any, res: Response) => void): Request; + post(url: string, callback?: (err: any, res: Response) => void): Request; + put(url: string, callback?: (err: any, res: Response) => void): Request; + head(url: string, callback?: (err: any, res: Response) => void): Request; + del(url: string, callback?: (err: any, res: Response) => void): Request; + options(url: string, callback?: (err: any, res: Response) => void): Request; + patch(url: string, callback?: (err: any, res: Response) => void): Request; + } + + interface Assertions { + status(code: number): any; + header(key: string, value?: string): any; + header(key: string, value?: RegExp): any; + headers: any; + json: any; + // text: any; + // html: any; + redirect: any; + redirectTo(location: string): any; + param(key: string, value?: string): any; + cookie(key: string, value?: string): any; + } + + interface TypeComparison { + ip: any; + } +} + +declare module "chai-http" { + export = chaiHttp; +} diff --git a/chrome/chrome-app.d.ts b/chrome/chrome-app.d.ts index 658ea0f8e8..a2b0d5997e 100644 --- a/chrome/chrome-app.d.ts +++ b/chrome/chrome-app.d.ts @@ -18,7 +18,7 @@ declare module chrome.app.runtime { } interface LaunchDataItem { - entry: File; + entry: FileEntry; type: string; } @@ -367,4 +367,4 @@ declare module chrome.sockets.tcpServer { var onAccept: Event; var onAcceptError: Event; -} \ No newline at end of file +} diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index ede0dfa401..782b6c78f7 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -2173,20 +2173,24 @@ declare module chrome.webNavigation { error: string; } + interface WebNavigationEventFilters { + url: chrome.events.UrlFilter[]; + } + interface WebNavigationReferenceFragmentUpdatedEvent extends chrome.events.Event { - addListener(callback: (details: ReferenceFragmentUpdatedDetails) => void): void; + addListener(callback: (details: ReferenceFragmentUpdatedDetails) => void, filters? : WebNavigationEventFilters): void; } interface WebNavigationCompletedEvent extends chrome.events.Event { - addListener(callback: (details: CompletedDetails) => void): void; + addListener(callback: (details: CompletedDetails) => void, filters? : WebNavigationEventFilters): void; } interface WebNavigationHistoryStateUpdatedEvent extends chrome.events.Event { - addListener(callback: (details: HistoryStateUpdatedDetails) => void): void; + addListener(callback: (details: HistoryStateUpdatedDetails) => void, filters?: WebNavigationEventFilters): void; } interface WebNavigationCreatedNavigationTargetEvent extends chrome.events.Event { - addListener(callback: (details: CreatedNavigationTargetDetails) => void): void; + addListener(callback: (details: CreatedNavigationTargetDetails) => void, filters?: WebNavigationEventFilters): void; } interface WebNavigationTabReplacedEvent extends chrome.events.Event { @@ -2194,19 +2198,19 @@ declare module chrome.webNavigation { } interface WebNavigationBeforeNavigateEvent extends chrome.events.Event { - addListener(callback: (details: BeforeNavigateDetails) => void): void; + addListener(callback: (details: BeforeNavigateDetails) => void, filters?: WebNavigationEventFilters): void; } interface WebNavigationCommittedEvent extends chrome.events.Event { - addListener(callback: (details: CommittedDetails) => void): void; + addListener(callback: (details: CommittedDetails) => void, filters?: WebNavigationEventFilters): void; } interface WebNavigationDomContentLoadedEvent extends chrome.events.Event { - addListener(callback: (details: DomContentLoadedDetails) => void): void; + addListener(callback: (details: DomContentLoadedDetails) => void, filters?: WebNavigationEventFilters): void; } interface WebNavigationErrorOccurredEvent extends chrome.events.Event { - addListener(callback: (details: ErrorOccurredDetails) => void): void; + addListener(callback: (details: ErrorOccurredDetails) => void, filters?: WebNavigationEventFilters): void; } export function getFrame(details: GetFrameDetails, callback: (details?: GetFrameResultDetails) => void): void; diff --git a/convict/convict-tests.ts b/convict/convict-tests.ts index a36b234802..6cde3b38c0 100644 --- a/convict/convict-tests.ts +++ b/convict/convict-tests.ts @@ -32,12 +32,29 @@ var conf = convict({ format: (val: string) => validator.isUUID(val), default: '01527E56-8431-11E4-AF91-47B661C210CA' }, + db: { + ip: { + doc: 'The IP address to bind.', + format: 'ipaddress', + default: '127.0.0.1', + env: 'IP_ADDRESS', + }, + port: { + doc: 'The port to bind.', + format: 'port', + default: 0, + env: 'PORT', + arg: 'port', + } + } + }); // load environment dependent configuration var env = conf.get('env'); +var dbip = conf.get('db.ip'); conf.loadFile('./config/' + env + '.json'); conf.loadFile(['./configs/always.json', './configs/sometimes.json']); diff --git a/convict/convict.d.ts b/convict/convict.d.ts index dc2b8e82bf..74ed100389 100644 --- a/convict/convict.d.ts +++ b/convict/convict.d.ts @@ -8,7 +8,7 @@ declare module "convict" { module convict { interface Schema { - [name: string]: { + [name: string]: convict.Schema | { default: any; doc?: string; format?: any; diff --git a/d3.cloud.layout/d3.cloud.layout-tests.ts b/d3.cloud.layout/d3.cloud.layout-tests.ts new file mode 100644 index 0000000000..c22d76b361 --- /dev/null +++ b/d3.cloud.layout/d3.cloud.layout-tests.ts @@ -0,0 +1,43 @@ +/// +/// + + interface ICompTextSize{ + text:string; + size:number; + x?:number; + y?:number; + rotate?:number; + } + + + var fill = d3.scale.category20(); + d3.layout.cloud().size([300, 300]) + .words([ + "Hello", "world", "normally", "you", "want", "more", "words", + "than", "this"].map(function(d:string) { + return {text: d, size: 10 + Math.random() * 90}; + })) + .padding(5) + .rotate(function() { return ~~(Math.random() * 2) * 90; }) + .font("Impact") + .fontSize(function(d:ICompTextSize) { return d.size; }) + .on("end", draw) + .start(); + function draw(words:ICompTextSize[]) { + d3.select("body").append("svg") + .attr("width", 300) + .attr("height", 300) + .append("g") + .attr("transform", "translate(150,150)") + .selectAll("text") + .data(words) + .enter().append("text") + .style("font-size", function(d:ICompTextSize) { return d.size + "px"; }) + .style("font-family", "Impact") + .style("fill", function(d:ICompTextSize, i:number) { return fill(i); }) + .attr("text-anchor", "middle") + .attr("transform", function(d:ICompTextSize) { + return "translate(" + [d.x, d.y] + ")rotate(" + d.rotate + ")"; + }) + .text(function(d:ICompTextSize) { return d.text; }); + } \ No newline at end of file diff --git a/d3.cloud.layout/d3.cloud.layout.d.ts b/d3.cloud.layout/d3.cloud.layout.d.ts new file mode 100644 index 0000000000..5ac3aced8c --- /dev/null +++ b/d3.cloud.layout/d3.cloud.layout.d.ts @@ -0,0 +1,45 @@ +// Type definitions for d3JS cloud layout plugin by Jason Davies +// Project: https://github.com/jasondavies/d3-cloud +// Definitions by: hans windhoff +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module D3 { + export module Layout { + export interface IRotate { + (number:number) : CloudLayout; + (number:()=>number) : CloudLayout; + } + + + + export interface CloudLayout { + (layers: any[], index?: number): any[]; + values(accessor?: (d: any) => any): CloudLayout; + offset(offset: string): CloudLayout; + size: { + /** + * Gets the available layout size + */ + (): Array; + /** + * Sets the available layout size + */ + (size: Array): CloudLayout; + }; + words: (inputArray: Array) => CloudLayout; + rotate:IRotate; + padding: (number:number) => CloudLayout; + font: (string:string) => CloudLayout; + fontSize(fctn: (d: any) => number): CloudLayout; + on: (eventname: string, callee: (words: any[]) => void) => CloudLayout; + start: () => CloudLayout; + } + + + export interface Layout { + cloud(): CloudLayout; + } + } +} \ No newline at end of file diff --git a/dagre/dagre-tests.ts b/dagre/dagre-tests.ts new file mode 100644 index 0000000000..ab790e5022 --- /dev/null +++ b/dagre/dagre-tests.ts @@ -0,0 +1,13 @@ +/// +module DagreTests { + var gDagre = new dagre.graphlib.Graph(); + gDagre.setGraph({}); + gDagre.setDefaultEdgeLabel(function(){ + return ; + }); + + gDagre.setNode("a", {}); + gDagre.setEdge("b", "c"); + + dagre.layout(gDagre); +} diff --git a/dagre/dagre.d.ts b/dagre/dagre.d.ts new file mode 100644 index 0000000000..a9d452826c --- /dev/null +++ b/dagre/dagre.d.ts @@ -0,0 +1,29 @@ +// Type definitions for dagre 0.7.0 +// Project: https://github.com/cpettitt/dagre +// Definitions by: Qinfeng Chen +// Definitions: https://github.com/borisyankov/DefinitelyTyped +declare module Dagre{ + interface DagreFactory { + graphlib: GraphLib; + layout(graph: Graph): void; + } + + interface Graph { + new (): Graph; + edges(): string[]; + edge(id: string): any; + nodes(): string[]; + node(id: string): any; + setDefaultEdgeLabel(callback: () => void): void; + setEdge(sourceId: string, targetId: string): void; + setGraph(options: { [key: string]: any }): void; + setNode(id: string, node: { [key: string]: any }): void; + } + + interface GraphLib { + Graph: Graph + } +} + +declare var dagre: Dagre.DagreFactory; + diff --git a/deployJava/deployJava-tests.ts b/deployJava/deployJava-tests.ts new file mode 100644 index 0000000000..3e4c491d87 --- /dev/null +++ b/deployJava/deployJava-tests.ts @@ -0,0 +1,280 @@ +/// + +/** + * @summary Test for the method: "allowPlugin". + */ +function testAllowPlugin() { + var result: boolean = deployJava.allowPlugin(); +} + +/** + * @summary Test for the method: "compareVersions". + */ +function testCompareVersions() { + var installed = '1.8'; + var required = '1.7'; + + var result = deployJava.compareVersions(installed, required); +} + +/** + * @summary Test for the method: "compareVersionToPattern". + */ +function testCompareVersionToPattern() { + var version: string = '1.8'; + var patternArray: Array = ['1.6', '1.7', '1.8']; + var familyMatch: boolean = false; + var minMatch: boolean = true; + + var result = deployJava.compareVersionToPattern(version, patternArray, familyMatch, minMatch); +} + +/** + * @summary Test for the method: "enableAlerts". + */ +function testEnableAlerts() { + deployJava.enableAlerts(); +} + +/** + * @summary Test for the method: "FFInstall". + */ +function testFFInstall() { + var result: boolean = deployJava.FFInstall(); +} + +/** + * @summary Test for the method: "getBrowser". + */ +function testGetBrowser() { + var result: string = deployJava.getBrowser(); +} + +/** + * @summary Test for the method: "getJPIVersionUsingMimeType". + */ +function testGetJPIVersionUsingMimeType() { + deployJava.getJPIVersionUsingMimeType(); +} + +/** + * @summary Test for the method: "getJREs". + */ +function testGetJREs() { + var versions: Array = deployJava.getJREs(); +} + +/** + * @summary Test for the method: "getPlugin". + */ +function testGetPlugin() { + var versions: HTMLElement = deployJava.getPlugin(); +} + +/** + * @summary Test for the method: "IEInstall". + */ +function testIEInstall() { + var result: boolean = deployJava.IEInstall(); +} + +/** + * @summary Test for the method: "installJRE". + */ +function testInstallJRE() { + var requestVersion: string = '1.8'; + var result: boolean = deployJava.installJRE(requestVersion); +} + +/** + * @summary Test for the method: "installLatestJRE". + */ +function testInstallLatestJRE() { + var installCallback: Function = () => {}; + var result: boolean = deployJava.installLatestJRE(installCallback); +} + +/** + * @summary Test for the method: "isAutoInstallEnabled". + */ +function testIsAutoInstallEnabled() { + var requestedJREVersion: string = '1.8'; + var result: boolean = deployJava.isAutoInstallEnabled(); + var result: boolean = deployJava.isAutoInstallEnabled(requestedJREVersion); +} + +/** + * @summary Test for the method: "isAutoUpdateEnabled". + */ +function testIsAutoUpdateEnabled() { + var result: boolean = deployJava.isAutoUpdateEnabled(); +} + +/** + * @summary Test for the method: "isCallbackSupported". + */ +function testIsCallbackSupported() { + var result: boolean = deployJava.isCallbackSupported(); +} + +/** + * @summary Test for the method: "isPlugin2". + */ +function testIsPlugin2() { + var result: boolean = deployJava.isPlugin2(); +} + +/** + * @summary Test for the method: "isPluginInstalled". + */ +function testIsPluginInstalled() { + var result: boolean = deployJava.isPluginInstalled(); +} + +/** + * @summary Test for the method: "isWebStartInstalled". + */ +function testIsWebStartInstalled() { + var minimumVersion: string = '1.7'; + var result: boolean = deployJava.isWebStartInstalled(); + var result: boolean = deployJava.isWebStartInstalled(minimumVersion); +} + +/** + * @summary Test for the method: "launch". + */ +function testLaunch() { + var jnlp: string = 'http://www.example.com/'; + var result: boolean = deployJava.launch(jnlp); +} + +/** + * @summary Test for the method: "launchWebStartApplication". + */ +function testLaunchWebStartApplication() { + var jnlp: string = 'http://www.example.com/'; + deployJava.launchWebStartApplication(jnlp); +} + +/** + * @summary Test for the method: "poll". + */ +function testPool() { + deployJava.poll(); +} + +/** + * @summary Test for the method: "refresh". + */ +function testRefresh() { + deployJava.refresh(); +} + +/** + * @summary Test for the method: "runApplet". + */ +function testRunApplet() { + var attributes: Object = { + code:'java2d.Java2DemoApplet.class', + archive:'Java2Demo.jar', + width:710, + height:540 + }; + + var parameters: Object = { fontSize:16, permissions:'sandbox' }; + var version: string = '1.8'; + + deployJava.runApplet(attributes, parameters); + deployJava.runApplet(attributes, parameters, version); +} + +/** + * @summary Test for the method: "setAdditionalPackages". + */ +function testSetAdditionalPackages() { + var packageList: string = 'javax.swing'; + var result: boolean = deployJava.setAdditionalPackages(packageList); +} + +/** + * @summary Test for the method: "setAutoUpdateEnabled". + */ +function testSetAutoUpdateEnabled() { + deployJava.setAutoUpdateEnabled(); +} + +/** + * @summary Test for the method: "setEarlyAccess". + */ +function testSetEarlyAccess() { + var enabled: string = 'true'; + deployJava.setEarlyAccess(enabled); +} + +/** + * @summary Test for the method: "setInstallerType". + */ +function testSetInstallerType() { + var type: string = 'kernel'; + deployJava.setInstallerType(type); +} + +/** + * @summary Test for the method: "testForMSVM". + */ +function testTestForMSVM() { + var result: boolean = deployJava.testForMSVM(); +} + +/** + * @summary Test for the method: "testUsingActiveX". + */ +function testTestUsingActiveX() { + var version: string = '1.7.0'; + var result: boolean = deployJava.testUsingActiveX(version); +} + +/** + * @summary Test for the method: "testUsingMimeTypes". + */ +function testTestUsingMimeTypes() { + var version: string = '1.7.0'; + var result: boolean = deployJava.testUsingMimeTypes(version); +} + +/** + * @summary Test for the method: "testUsingPluginsArray". + */ +function testTestUsingPluginsArray() { + var version: string = '1.7.0'; + var result: boolean = deployJava.testUsingPluginsArray(version); +} + +/** + * @summary Test for the method: "versionCheck". + */ +function testVersionCheck() { + deployJava.versionCheck('1.x'); +} + +/** + * @summary Test for the method: "writeAppletTag". + */ +function testWriteAppletTag() { + var attributes: Object = { + code:'java2d.Java2DemoApplet.class', + archive:'Java2Demo.jar', + width:710, + height:540 + }; + + var parameters: Object = { fontSize:16, permissions:'sandbox' }; + deployJava.writeAppletTag(attributes, parameters); +} + +/** + * @summary Test for the method: "writeEmbedTag". + */ +function testWriteEmbedTag() { + deployJava.writeEmbedTag(); +} \ No newline at end of file diff --git a/deployJava/deployJava-tests.ts.tscparams b/deployJava/deployJava-tests.ts.tscparams new file mode 100644 index 0000000000..934bc29ef2 --- /dev/null +++ b/deployJava/deployJava-tests.ts.tscparams @@ -0,0 +1 @@ +--noImplicitAny \ No newline at end of file diff --git a/deployJava/deployJava.d.ts b/deployJava/deployJava.d.ts new file mode 100644 index 0000000000..76ff5d8cd1 --- /dev/null +++ b/deployJava/deployJava.d.ts @@ -0,0 +1,315 @@ +// Type definitions for deployJava.js +// Project: https://www.java.com/js/deployJava.txt +// Definitions by: Cyril Schumacher +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module DeployJava { + /** + * @summary Interface for {@link deployJava} object. + * @author Cyril Schumacher + * @version 1.0 + */ + interface DeployJavaStatic { + /** + * @summary Brand name. + * @member {string} + */ + brand: string; + + /** + * @summary Debug mode. + * @member {boolean} + */ + debug: boolean; + + /** + * @summary Early Access state. + * @member {string} + */ + EAInstallEnabled: boolean; + + /** + * @summary URL to early access. + * @member {string} + */ + EarlyAccessURL: string; + + /** + * @summary Preferred install type (null, online, kernel). + * @member {string} + */ + installType: string; + + /** + * @summary Locale. + * @member {string} + */ + locale: string; + + /** + * @summary Interval for check versions of JRE available. + * @member {number} + */ + myInterval: number; + + /** + * @summary JRE versions installed. + * @member {Array} + */ + preInstallJREList: Array; + + /** + * @summary URL of current document. + * @member {string} + */ + returnPage: string; + + /** + * @summary Determines if the browser has allowed the Java plugin. + * @return {boolean} True if the Java plugin is allowed, otherwise, False. + */ + allowPlugin(): boolean; + + /** + * @summary Compares a installed version and required version. + * @param {string} installed JRE installed version. + * @param {string} required JRE required version. + * @return {boolean} True if installed version is greater than or equal to required version. + */ + compareVersions(installed: string, required: string): boolean; + + /** + * @summary Compares a version with a pattern. + * @param {string} version Version to compare. + * @param {Array} patternArray Patterns to compare. + * @param {boolean} familyMatch Family match. + * @param {boolean} minMatch Minimum version match. + * @return {boolean} True if a or many patterns are identical to version, otherwise, False. + */ + compareVersionToPattern(version: string, patternArray: Array, familyMatch: boolean, minMatch: boolean): boolean; + + /** + * @summary Enable alerts. + */ + enableAlerts(): void; + + /** + * @summary Redirect to Java plugin website for Mozilla Firefox. + * @return {boolean} True if the redirection to Java plugin website was performed, otherwise, False. + */ + FFInstall(): boolean; + + /** + * @summary Gets browser name. + * @return {string} Browser name. + */ + getBrowser(): string; + + /** + * @summary Obtains JPI version using {@link navigator.mimeTypes} array if found, + * set the version to {@link firefoxJavaVersion}. + */ + getJPIVersionUsingMimeType(): void; + + /** + * @summary Get JRE versions (in format : "#.#[.#[_#]]") installed. + * @return {Array} JRE Version list. + */ + getJREs(): Array; + + /** + * Gets a Java plugin. + * @return {HTMLElement} Java plugin. + */ + getPlugin(): HTMLElement; + + /** + * Redirect to Java plugin website for Internet Explorer. + * @return {boolean} True if the redirection to Java plugin website was performed, otherwise, False. + */ + IEInstall(): boolean; + + /** + * @summary Triggers a JRE installation. + * @param {string} requestVersion JRE request version. + * @return {boolean} True if the install is succeeded, otherwise, False. + */ + installJRE(requestVersion: string): boolean; + + /** + * @summary Triggers a installation of the latest version of JRE. + * @param {Function} installCallback A reference to a javascript callback function for reporting install status. + * @return {boolean} True if the install is succeeded, otherwise, False. + */ + installLatestJRE(installCallback?: Function): boolean; + + /** + * @summary Determines if JRE auto install for the version is enabled for the local system. + * + * DT plugin for 6uX only knows about JRE installer signed by SUN cert. + * If it encounter Oracle signed JRE installer, it will have chance of + * deadlock when running with IE. This function is to guard against this. + * + * @param {string} requestedJREVersion JRE version. If not specified, it will be treated as installing any JRE version. + * @return {boolean} True if JRE auto install for the version is enabled for the local system, otherwise, False. + */ + isAutoInstallEnabled(requestedJREVersion?: string): boolean; + + /** + * @summary Determines if the plugin is installed and AutoUpdate is enabled. + * @return {boolean} True if the plugin is installed and AutoUpdate is enabled, otherwise, False. + */ + isAutoUpdateEnabled(): boolean; + + /** + * @summary Determines if JRE install callback is supported. + * @return {boolean} True if JRE install callback is supported, otherwise, False. + */ + isCallbackSupported(): boolean; + + /** + * @summary Determines if the next generation plugin (Plugin II) is default. + * @return {boolean} True if next generation plugin is default, otherwise, False. + */ + isPlugin2(): boolean; + + /** + * @summary Determines if the ActiveX or XPI plugin is installed. + * @return {boolean} True if the ActiveX or XPI plugin is installed, otherwise, False. + */ + isPluginInstalled(): boolean; + + /** + * @summary Checks if an installation of Java Web Start of the specified minimum version can be detected. + * @param {string} minimumVersion Minimum version. + * @return {boolean} True if an installation of Java Web Start of the specified minimum version can be detected + */ + isWebStartInstalled(minimumVersion?: string): boolean; + + /** + * @summary Launch a JNLP application (using the plugin if available). + * @param {string} jnlp JNLP file. + * @return {boolean} True if a JNLP application is launched, otherwise, False. + */ + launch(jnlp: string): boolean; + + /** + * @summary Launch the specified JNLP application using the passed in jnlp file. + * @param {string} jnlp JNLP file. + */ + launchWebStartApplication(jnlp: string): void; + + /** + * @summary Checks versions of JRE available. + */ + poll(): void; + + /** + * @summary Writes embed tags if JRE plugin is available. + */ + refresh(): void; + + /** + * @summary Ensures that an appropriate JRE is installed and then runs an applet. + * + * After installJRE() is called, the script will attempt to detect that the + * JRE installation has completed and begin running the applet, but there + * are circumstances (such as when the JRE installation requires a browser + * restart) when this cannot be fulfilled. + * As with writeAppletTag(), this function should only be called prior to + * the web page being completely rendered. Note that version wildcards + * (star (*) and plus (+)) are not supported, and including them in the + * minimumVersion will result in an error message. + * + * @param {Object} attributes Names and values of the attributes of the generated tag. + * @param {Object} parameters Names and values of the tags in the generated tag. + * @param {string} minimumVersion A minimum version of the JRE software that is required to run this applet. Default value is : "1.1". + */ + runApplet(attributes: Object, parameters: Object, minimumVersion?: string): void; + + /** + * @summary Sets additional package list. + * + * Note: To be used by kernel installer. + * + * @param {string} packageList Package list. + * @return {boolean} True if the value was set, otherwise, False if the plugin is already installed. + */ + setAdditionalPackages(packageList: string): boolean; + + /** + * @summary Sets AutoUpdate on if plugin is installed. + */ + setAutoUpdateEnabled(): void; + + /** + * @summary Sets preference to install Early Access versions if available. + * @param {string} enabled Preference to install Early Access versions. + */ + setEarlyAccess(enabled: string): void; + + /** + * @summary Sets the preferred install type. + * @param {string} type Preferred install (null, online or kernel). + * @return {boolean} True if the value was set, otherwise, False if the plugin is already installed. + */ + setInstallerType(type: string): boolean; + + /** + * @summary Detects the Microsoft virtual machine. + * @return {boolean} True if the Microsoft virtual machine exists, otherwise, False. + */ + testForMSVM(): boolean; + + /** + * @summary Checks if ActiveX can be used with Java plugin. + * @param {string} Java version. + * @return {boolean} True if ActiveX can be used, otherwise, False. + */ + testUsingActiveX(version: string): boolean; + + /** + * @summary Checks if MIME types can be used with Java plugin. + * @param {string} Java version. + * @return {boolean} True if MIME types can be used, otherwise, False. + */ + testUsingMimeTypes(version: string): boolean; + + /** + * @summary Checks if plugins can be used with Java plugin. + * @param {string} Java version. + * @return {boolean} True if plugins can be used, otherwise, False. + */ + testUsingPluginsArray(version: string): boolean; + + /** + * @summary Check if there is a matching JRE version currently installed. + * @param {string} versionPattern Java version pattern (in format : #[.#[.#[_#]]][+|*]). + * @return {boolean} True if there is a matching JRE version currently installed, otherwise, False. + */ + versionCheck(versionPattern: string): boolean; + + /** + * @summary Write in outputs an applet tag for applet with the specified attributes and parameters. + * + * Each key/value pair in attributes becomes an attribute of the applet tag + * itself, while key/value pairs in parameters become tags. + * No version checking or other special behaviors are performed; the tag is + * simply written to the page using document.writeln(). + * As document.writeln() is generally only safe to use while the page is + * being rendered, you should never call this function after the page + * has been completed. + * + * @param {Object} attributes Names and values of the attributes of the generated tag. + * @param {Object} parameters Names and values of the tags in the generated tag. + */ + writeAppletTag(attributes: Object, parameters: Object): void; + + /** + * @summary Write in outputs an embed tag for applet. + */ + writeEmbedTag(): void; + } +} + +declare var deployJava: DeployJava.DeployJavaStatic; \ No newline at end of file diff --git a/di-lite/di-lite-test.ts b/di-lite/di-lite-test.ts new file mode 100644 index 0000000000..8d6bfb777b --- /dev/null +++ b/di-lite/di-lite-test.ts @@ -0,0 +1,139 @@ +/// + +interface Dependency { + dependencies?: string; +} + +function doTest(test: (ctx: any, ...obj: Dependency[]) => void) { + // create di context + var ctx = di.createContext(), + A: Dependency = () => { + this.dependencies = "b, c"; + }, + B: Dependency = () => { + this.dependencies = "c"; + }, + C: Dependency = () => {}; + + // register a class with an unique name + ctx.register("a", A); + ctx.register("b", B); + ctx.register("c", C); + + test(ctx, A, B, C); +} + +module BasicWiring { + doTest(ctx => { + // initialize di container so all singleton(default) objects will be wired at this stage + ctx.initialize(); + + var instanceOfA = ctx.get("a"); + instanceOfA.b === ctx.get("b"); // true + instanceOfA.c === ctx.get("c"); // true + + var instanceOfB = ctx.get("b"); + instanceOfB.c === ctx.get("c"); // true + }); +} + +module WiringWithAssignment { + doTest((ctx, A) => { + A.dependencies = "bee=b, c"; // mix explicit and implicit assignment + + ctx.initialize(); + + var instanceOfA = ctx.get("a"); + instanceOfA.bee === ctx.get("b"); // true - explicit assignment + instanceOfA.c === ctx.get("c"); // true - implicit assignment + }); +} + +module PassiveDependencyResolution { + doTest((ctx, A) => { + ctx.register("a", A); + ctx.get("a"); // this triggers the dependency resolution for "a" alone + ctx.initialize(); + }); +} + +module PrototypeStrategy { + doTest((ctx, A) => { + ctx.register("prototype", A).strategy(di.strategy.proto); + ctx.get("prototype") === ctx.get("prototype"); // false + ctx.create("prototype", 100); // create can be used if you want to explicitly pass in a new parameter + }); +} + +module PassingConstructorArguments { + class ProfileView { } + + doTest(ctx => { + ctx.register("str", String, "hello world"); // signle simple argument + ctx.register("profileView", ProfileView, { el: "#profile_div" }); // signle object literal argument + ctx.register("array", Array, ["Saab", "Volvo", "BMW"]); // multiple argument is passed in using an array + }); +} + +module CyclicalDependency { + doTest((ctx, A, B) => { + A.dependencies = "b"; + B.dependencies = "a"; + + ctx.register("a", A); + ctx.register("b", B); + + ctx.initialize(); + + ctx.get("a").b === ctx.get("b"); // true + ctx.get("b").a === ctx.get("a"); // true + ctx.get("a").b.a === ctx.get("a"); // true + ctx.get("b").a.b === ctx.get("b"); // true + }); +} + +module FunctionalObject { + doTest(ctx => { + var FuncObject = (spec: any) => { + var that = {}; + return that; + }, + spec: any = []; + + ctx.register("funcObjSingleton", FuncObject, spec).factory(di.factory.func); + + // function chaining can be used to customize your object registration + ctx.register("funcObjProto", FuncObject, spec) + .strategy(di.strategy.proto) + .factory(di.factory.func); + + ctx.initialize(); + + ctx.get("funcObjSingleton"); // will return you a signleton instance of FuncObject + ctx.get("funcObjProto"); // will return you a new instance of FuncObject each time + }); +} + +module RuntimeDependenciesOverride { + doTest((ctx, A) => { + ctx.register("a", A) + .dependencies("bee=b"); // dependencies specified here will take precedence + ctx.get("a").bee === ctx.get("b"); // true + }); +} + +module CreateYourOwn { + class Backbone { + history: History = new History(); + } + + class History { + start() {} + } + + doTest(ctx => { + ctx.register("history").object(new Backbone().history); + ctx.get("history").start(); // you can use it since it is already created and initialized + ctx.initialize(); // initialize the rest of the objects + }); +} diff --git a/di-lite/di-lite.d.ts b/di-lite/di-lite.d.ts new file mode 100644 index 0000000000..356f70c7bc --- /dev/null +++ b/di-lite/di-lite.d.ts @@ -0,0 +1,69 @@ +// Type definitions for di-lite 0.3.3 +// Project: https://github.com/NickQiZhu/di.js +// Definitions by: Timothy Morris +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module DiLite { + interface DiLiteStatic { + version: string; + createContext(): CreateContext; + dependencyExpression(depExp: string): string; + entry(name: string, ctx: CreateContext): any; + strategy: StrategyEnum; + factory: FactoryEnum; + utils: Utils; + } + + interface Dictionary { + [index: string]: T; + } + + interface CreateContext { + map: Dictionary; + entry(name: string): T; + register(name: string, service: T): Entry; + has(name: string): boolean; + get(name: string): any; + create(name: string, args: any): T; + initialize(): void; + clear(): void; + inject(name: string, o: T, dependencies: string): T; + ready(o: Function): T; + ready(o: any): T; + } + + interface Entry { + create(newArgs: any): Entry; + object(o: T): Entry; + object(): T; + strategy(s: Function): Entry; + strategy(): T; + type(t: T): Entry; + type(): T; + dependencies(d: T): Entry; + dependencies(): T; + args(a: T): Entry; + args(): T; + factory(f: Function): Entry; + factory(): T; + } + + interface StrategyEnum { + proto(name: string, object: TObject, type: TType, args: any, ctx: CreateContext, dependencies: any): TObject; + singleton(name: string, object: TObject, type: TType, args: any, ctx?: CreateContext, dependencies?: any): TObject; + } + + interface FactoryEnum { + constructor(type: T, args: any): T; + func(type: T, args: any): T; + } + + interface Utils { + invokeStmt(args: any, op: string): string; + } +} + +declare module "di-lite" { + export = di; +} +declare var di: DiLite.DiLiteStatic; diff --git a/element-resize-event/element-resize-event-tests.ts b/element-resize-event/element-resize-event-tests.ts new file mode 100644 index 0000000000..6155fb1616 --- /dev/null +++ b/element-resize-event/element-resize-event-tests.ts @@ -0,0 +1,8 @@ +/// + +import ere = require("element-resize-event"); + +var domNode: Element = null; +ere(domNode, (): void => { +}); + diff --git a/element-resize-event/element-resize-event.d.ts b/element-resize-event/element-resize-event.d.ts new file mode 100644 index 0000000000..c1c03338dc --- /dev/null +++ b/element-resize-event/element-resize-event.d.ts @@ -0,0 +1,9 @@ +// Type definitions for element-resize-event 1.0.1 +// Project: https://github.com/KyleAMathews/element-resize-event +// Definitions by: Rogier Schouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "element-resize-event" { + function elementResizeEvent(domNode: Element, callback: () => void): void; + export = elementResizeEvent; +} diff --git a/ember/ember.d.ts b/ember/ember.d.ts index 307d47caf9..b6cdde9d61 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -253,6 +253,20 @@ declare module Ember { **/ function A(arr?: any[]): NativeArray; /** + The Ember.ActionHandler mixin implements support for moving an actions property to an _actions + property at extend time, and adding _actions to the object's mergedProperties list. + **/ + class ActionHandlerMixin { + /** + Triggers a named action on the ActionHandler + **/ + send(name: string, ...args: any[]): void; + /** + The collection of functions, keyed by name, available on this ActionHandler as action targets. + **/ + actions: ActionsHash; + } + /** 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. **/ @@ -446,6 +460,11 @@ declare module Ember { controllers: {}; needs: string[]; target: any; + model: any; + queryParams: any; + send(name: string, ...args: any[]): void; + actions: {}; + } /** Array polyfills to support ES5 features in older browsers. @@ -719,15 +738,27 @@ declare module Ember { static isClass: boolean; static isMethod: boolean; } - class Controller extends Object { } - /** - Additional methods for the ControllerMixin. - **/ - class ControllerMixin { + class Controller extends Object implements ControllerMixin { replaceRoute(name: string, ...args: any[]): void; transitionToRoute(name: string, ...args: any[]): void; controllers: {}; + model: any; needs: string[]; + queryParams: any; + target: any; + send(name: string, ...args: any[]): void; + actions: ActionsHash; + } + /** + Additional methods for the ControllerMixin. + **/ + class ControllerMixin extends ActionHandlerMixin { + replaceRoute(name: string, ...args: any[]): void; + transitionToRoute(name: string, ...args: any[]): void; + controllers: {}; + model : any; + needs: string[]; + queryParams: any; target: any; } /** @@ -790,7 +821,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 { + class CoreView extends Object implements ActionHandlerMixin { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -805,6 +836,8 @@ declare module Ember { static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; + send(name: string, ...args: any[]): void; + actions: ActionsHash; parentView: CoreView; } class DAG { @@ -1449,6 +1482,10 @@ declare module Ember { controllers: Object; needs: string[]; target: any; + model: any; + queryParams: any; + send(name: string, ...args: any[]): void; + actions: {}; } class ObjectProxy extends Object { static detect(obj: any): boolean; @@ -1527,7 +1564,7 @@ declare module Ember { elementTag: string; parentBuffer: RenderBuffer; } - class Route extends Object { + class Route extends Object implements ActionHandlerMixin { static detect(obj: any): boolean; static detectInstance(obj: any): boolean; /** @@ -2181,6 +2218,7 @@ declare module Em { **/ var $: typeof Ember.$; var A: typeof Ember.A; + class ActionHandlerMixin extends Ember.ActionHandlerMixin { } class Application extends Ember.Application { } class Array extends Ember.Array { } class ArrayController extends Ember.ArrayController { } diff --git a/formidable/formidable-tests.ts b/formidable/formidable-tests.ts new file mode 100644 index 0000000000..a0f70a713c --- /dev/null +++ b/formidable/formidable-tests.ts @@ -0,0 +1,81 @@ +/// + +import formidable = require('formidable'); +import http = require('http'); +import util = require('util'); + +http.createServer((req, res) => { + if (req.url == '/upload' && req.method.toLowerCase() == 'post') { + // parse a file upload + var form = new formidable.IncomingForm(); + + form.parse(req, (err, fields, files) => { + res.writeHead(200, {'content-type': 'text/plain'}); + res.write('received upload:\n\n'); + res.end(util.inspect({fields: fields, files: files})); + }); + + return; + } + + // show a file upload form + res.writeHead(200, {'content-type': 'text/html'}); + res.end( + '
'+ + '
'+ + '
'+ + ''+ + '
' + ); +}); + + +var form = new formidable.IncomingForm(); + +form.encoding = 'utf-8'; +form.uploadDir = '/my/dir'; +form.keepExtensions = false; +form.maxFieldsSize = 2 * 1024 * 1024; +form.maxFields = 1000; +form.hash = false; +form.hash = 'sha1'; +form.multiples = false; + +if (form.type === 'multipart') { +} +if (form.bytesReceived > 100) { +} +if (form.bytesExpected > 100) { +} + +var req: http.ServerRequest; + +form.parse(req); +form.parse(req, (err: any, fields: formidable.Fields, files: formidable.Files) => { + var key: string; + for (key in fields) { + console.log(key, '=', fields[key]); + } + + for (key in files) { + console.log('file', key, 'is', files[key].type); + } +}); + +form.onPart = function (part: formidable.Part) { + if (!part.filename) { + form.handlePart(part); + } +}; + +var file: formidable.File; + +file.size = 0; +file.path = '/tmp/whatever'; +file.name = 'a_file'; +file.type = 'application/json'; +file.lastModifiedDate = new Date(); +file.hash = '12345'; +JSON.stringify(file.toJSON()); + +form.on('progess', (bytesReceived: number, bytesExpected: number) => {}); diff --git a/formidable/formidable.d.ts b/formidable/formidable.d.ts new file mode 100644 index 0000000000..ba0ed81228 --- /dev/null +++ b/formidable/formidable.d.ts @@ -0,0 +1,56 @@ +// Type definitions for Formidable 1.0.16 +// Project: https://github.com/felixge/node-formidable/ +// Definitions by: Wim Looman +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "formidable" { + import http = require("http"); + import stream = require("stream"); + import events = require("events"); + + export class IncomingForm extends events.EventEmitter { + encoding: string; + uploadDir: string; + keepExtensions: boolean; + maxFieldsSize: number; + maxFields: number; + hash: string | boolean; + multiples: boolean; + type: string; + bytesReceived: number; + bytesExpected: number; + + onPart: (part: Part) => void; + + handlePart(part: Part): void; + parse(req: http.ServerRequest, callback?: (err: any, fields: Fields, files: Files) => any): void; + } + + export interface Fields { + [key: string]: string; + } + + export interface Files { + [key: string]: File; // | File[]; + } + + export interface Part extends stream.Stream { + headers: { [key: string]: string }; + name: string; + filename?: string; + mime?: string; + } + + export interface File { + size: number; + path: string; + name: string; + type: string; + lastModifiedDate?: Date; + hash?: string; + + toJSON(): Object; + } +} diff --git a/gamepad/gamepad-tests.ts b/gamepad/gamepad-tests.ts index 4b0cddcada..6bf80458da 100644 --- a/gamepad/gamepad-tests.ts +++ b/gamepad/gamepad-tests.ts @@ -19,24 +19,22 @@ }; (()=>{ - window.addEventListener('GamepadConnected', (e: Gamepad.GamepadEvent)=>{ + var gamepadconnected = (e: Gamepad.GamepadEvent) => { console.log('Gamepad ' + e.gamepad.index + ' connected!'); - }, false); - window.addEventListener('GamepadDisconnected', (e: Gamepad.GamepadEvent)=>{ + if(e.gamepad.mapping == 'standard'){ + console.log("The Gamepad's controls have been mapped to the Standard Gamepad layout."); + } + }; + var gamepaddisconnected = (e: Gamepad.GamepadEvent) => { console.log('Gamepad ' + e.gamepad.index + ' disconnected!'); - }, false); - window.addEventListener('webkitGamepadConnected', (e: Gamepad.GamepadEvent)=>{ - console.log('Gamepad ' + e.gamepad.index + ' connected!'); - }, false); - window.addEventListener('webkitGamepadDisconnected', (e: Gamepad.GamepadEvent)=>{ - console.log('Gamepad ' + e.gamepad.index + ' disconnected!'); - }, false); - window.addEventListener('mozGamepadConnected', (e: Gamepad.GamepadEvent)=>{ - console.log('Gamepad ' + e.gamepad.index + ' connected!'); - }, false); - window.addEventListener('mozGamepadDisconnected', (e: Gamepad.GamepadEvent)=>{ - console.log('Gamepad ' + e.gamepad.index + ' disconnected!'); - }, false); + }; + + window.addEventListener('GamepadConnected', gamepadconnected, false); + window.addEventListener('GamepadDisconnected', gamepaddisconnected, false); + window.addEventListener('webkitGamepadConnected', gamepadconnected, false); + window.addEventListener('webkitGamepadDisconnected', gamepaddisconnected, false); + window.addEventListener('mozGamepadConnected', gamepadconnected, false); + window.addEventListener('mozGamepadDisconnected', gamepaddisconnected, false); var requestAnimationFrame = window.requestAnimationFrame || (window).mozRequestAnimationFrame; var getGamepads = navigator.getGamepads || navigator.webkitGetGamepads; @@ -45,13 +43,13 @@ { requestAnimationFrame.call(window, runAnimation); - var gamepads: Gamepad.GamepadList = getGamepads.call(navigator); + var gamepads: Gamepad.Gamepad[] = getGamepads.call(navigator); for(var i = 0; i < gamepads.length; i++){ var pad: Gamepad.Gamepad = gamepads[i]; - if(pad){ + if(pad && pad.connected){ for (var k = 0; k < pad.buttons.length; k++) { - var button = pad.buttons[k]; + var button: Gamepad.GamepadButton = pad.buttons[k]; if(button.pressed){ console.log('pad[' + pad.index + ']: ' + 'time=' + pad.timestamp + ' id="' + pad.id + '" button[' + k + '] = ' + button.value); } diff --git a/gamepad/gamepad.d.ts b/gamepad/gamepad.d.ts index 69ef795fb0..647eb1fe69 100644 --- a/gamepad/gamepad.d.ts +++ b/gamepad/gamepad.d.ts @@ -37,6 +37,18 @@ declare module Gamepad{ * @readonly */ buttons:GamepadButton[]; + + /** + * Indicates whether the physical device represented by this object is still connected to the system. When a gamepad becomes unavailable, whether by being physically disconnected, powered off or otherwise unusable, the connected attribute must be set to false. + * @readonly + */ + connected:boolean; + + /** + * The mapping in use for this device. If the user agent has knowledge of the layout of the device, then it should indicate that a mapping is in use by setting this property to a known mapping name. Currently the only known mapping is "standard", which corresponds to the Standard Gamepad layout. If the user agent does not have knowledge of the device layout and is simply providing the controls as represented by the driver in use, then it must set the mapping property to an empty string. + * @readonly + */ + mapping:string; } /** diff --git a/google.analytics/ga.d.ts b/google.analytics/ga.d.ts index 96ba12bf90..a8e1b1e252 100644 --- a/google.analytics/ga.d.ts +++ b/google.analytics/ga.d.ts @@ -40,6 +40,8 @@ declare module UniversalAnalytics { // https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference interface ga { + l: number; + q: any[]; (command: string, poly: string, opt_poly?: {}): UniversalAnalytics.Tracker; (command: string, trackingId: string, auto: string, opt_configObject?: {}): UniversalAnalytics.Tracker; (command: string, hitDetails: {}): void; diff --git a/jquery.bbq/jquery.bbq-tests.ts b/jquery.bbq/jquery.bbq-tests.ts index 6bf301f3c7..77eb35b373 100644 --- a/jquery.bbq/jquery.bbq-tests.ts +++ b/jquery.bbq/jquery.bbq-tests.ts @@ -112,7 +112,7 @@ var params_obj = { a:['4','5','6'], b:{x:['7'], y:'8', z:['9','0','true','false' params_obj_bang_coerce = { "!a":[4], a:[5,6] };//, b:{x:[7], y:8, z:[9,0,true,false,undefined,'']}, c:1 }; test( 'jQuery.param.sorted', function() { - var tests = [ + var tests: any[] = [ { obj: {z:1,b:2,ab:3,bc:4,ba:5,aa:6,a1:7,x:8}, traditional: false, diff --git a/jquery.cookie/jquery.cookie.d.ts b/jquery.cookie/jquery.cookie.d.ts index 3439382c34..06380f999a 100644 --- a/jquery.cookie/jquery.cookie.d.ts +++ b/jquery.cookie/jquery.cookie.d.ts @@ -19,6 +19,7 @@ interface JQueryCookieStatic { (): {[key:string]:string}; (name: string): any; + (name: string, converter: (value: string) => any): any; (name: string, value: string): void; (name: string, value: string, options: JQueryCookieOptions): void; (name: string, value: any): void; @@ -30,4 +31,4 @@ interface JQueryStatic { removeCookie(name: string): boolean; removeCookie(name: string, options: JQueryCookieOptions): boolean; -} \ No newline at end of file +} diff --git a/jquery.livestampjs/jquery.livestampjs.d.ts b/jquery.livestampjs/jquery.livestampjs.d.ts index 35453d4f3f..df96f14287 100644 --- a/jquery.livestampjs/jquery.livestampjs.d.ts +++ b/jquery.livestampjs/jquery.livestampjs.d.ts @@ -22,7 +22,7 @@ interface JQueryStatic { interface JQuery { livestamp(date: Date): JQuery; - livestamp(moment: Moment): JQuery; + livestamp(moment: moment.Moment): JQuery; livestamp(timestamp: number): JQuery; livestamp(timestamp: string): JQuery; } diff --git a/jquery.tipsy/jquery.tipsy-tests.ts b/jquery.tipsy/jquery.tipsy-tests.ts new file mode 100644 index 0000000000..384e34a217 --- /dev/null +++ b/jquery.tipsy/jquery.tipsy-tests.ts @@ -0,0 +1,32 @@ +/// +/// + +// basic +$('#example-1').tipsy(); + +// code snippets from http://onehackoranother.com/projects/jquery/tipsy/ +$('#foo').tipsy({gravity: 'n'}); // nw | n | ne | w | e | sw | s | se + +$('#foo').tipsy({gravity: $.fn.tipsy.autoNS}); + +$('#example-fade').tipsy({fade: true}); + +$('#example-custom-attribute').tipsy({title: 'id'}); + +$('#example-callback').tipsy({title: function() { return this.getAttribute('original-title').toUpperCase(); } }); + +$('#example-fallback').tipsy({fallback: "Where's my tooltip yo'?" }); + +$('#example-html').tipsy({html: true }); + +$('#example-delay').tipsy({delayIn: 500, delayOut: 1000}); + +$(function() { + $('#focus-example [title]').tipsy({trigger: 'focus', gravity: 'w'}); +}); + +function onclickExample1() { $("#manual-example a[rel=tipsy]").tipsy("show"); return false; } +function onclickExample2() { $("#manual-example a[rel=tipsy]").tipsy("hide"); return false; } +$('#manual-example a[rel=tipsy]').tipsy({trigger: 'manual'}); + +$('a.live-tipsy').tipsy({live: true}); \ No newline at end of file diff --git a/jquery.tipsy/jquery.tipsy.d.ts b/jquery.tipsy/jquery.tipsy.d.ts new file mode 100644 index 0000000000..d586eefbde --- /dev/null +++ b/jquery.tipsy/jquery.tipsy.d.ts @@ -0,0 +1,107 @@ +// Type definitions for jQuery.tipsy +// Project: http://onehackoranother.com/projects/jquery/tipsy/ +// Definitions by: Brian Dukes +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface JQuery { + /** + * initialize tipsy plugin + */ + tipsy: JQueryTipsy.Tipsy; +} + +declare module JQueryTipsy { + interface Options { + /** + * delay before showing tooltip (ms) + * + * default: 0 + */ + delayIn?: number; + /** + * delay before hiding tooltip (ms) + * + * default: 0 + */ + delayOut?: number; + /** + * fade tooltips in/out? + * + * default: false + */ + fade?: boolean; + /** + * fallback text to use when no tooltip text + * + * default: '' + */ + fallback?: string; + /** + * gravity + * + * default: 'n' + */ + gravity?: any; // string or () => string + /** + * is tooltip content HTML? + * + * default: false + */ + html?: boolean; + /** + * use live event support? + * + * default: false + */ + live?: boolean; + /** + * pixel offset of tooltip from element + * + * default: 0 + */ + offset?: number; + /** + * opacity of tooltip + * + * default: 0.8 + */ + opacity?: number; + /** + * attribute/callback containing tooltip text + * + * default: 'title' + */ + title?: any; // string or () => string + /** + * how tooltip is triggered - hover | focus | manual + * + * default: 'hover' + */ + trigger?: string; + } + + interface Tipsy { + /** + * initialize tipsy plugin + */ + (options?: Options): JQuery; + /** + * determine gravity either to North or South automatically based on the element's location in the viewport + */ + autoNS: () => string; + /** + * determine gravity either to West or East automatically based on the element's location in the viewport + */ + autoWE: () => string; + /** + * determine gravity either to Southwest or Southeast automatically based on the element's location in the viewport + */ + autoSWSE: () => string; + /** + * determine gravity either to Northwest or Northeast automatically based on the element's location in the viewport + */ + autoNWNE: () => string; + } +} diff --git a/jquery.transit/jquery.transit.d.ts b/jquery.transit/jquery.transit.d.ts index 2153164aab..5da90e18c4 100644 --- a/jquery.transit/jquery.transit.d.ts +++ b/jquery.transit/jquery.transit.d.ts @@ -25,4 +25,12 @@ interface JQuery { transition(options: JQueryTransitOptions, duration: number, easing: string): JQuery; transition(options: JQueryTransitOptions, complete: () => void): JQuery; transition(options: JQueryTransitOptions, duration: number, easing: string, complete: () => void): JQuery; + + /** + * Set one or more CSS properties for the set of matched elements. + * + * @param propertyName A CSS property name. + * @param value A value to set for the property. + */ + css(propertyName: string, value: number[]): JQuery; } diff --git a/jquery.validation/jquery.validation.d.ts b/jquery.validation/jquery.validation.d.ts index 916ae1016b..f8b6ca70c5 100644 --- a/jquery.validation/jquery.validation.d.ts +++ b/jquery.validation/jquery.validation.d.ts @@ -1,6 +1,6 @@ // Type definitions for jquery.validation 1.11.1 // Project: http://jqueryvalidation.org/ -// Definitions by: François de Campredon , Johj Reilly +// Definitions by: François de Campredon , John Reilly // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -89,21 +89,21 @@ interface ValidationOptions * Set to a Function to decide for yourself when to run validation. * A boolean true is not a valid value. */ - onclick?: any; + onclick?: boolean|Function; /** * Boolean or Function. Validate elements (except checkboxes/radio buttons) on blur. If nothing is entered, all rules are skipped, except when the field was already marked as invalid. * * Set to a Function to decide for yourself when to run validation. * A boolean true is not a valid value. */ - onfocusout?: any; + onfocusout?: boolean|Function; /** * Boolean or Function. Validate elements on keyup. As long as the field is not marked as invalid, nothing happens. Otherwise, all rules are checked on each key up event. Set to false to disable. * * Set to a Function to decide for yourself when to run validation. * A boolean true is not a valid value. */ - onkeyup?: any; + onkeyup?: boolean|Function; /** * Validate the form on submit. Set to false to use only other events for validation. * Set to a Function to decide for yourself when to run validation. @@ -127,7 +127,7 @@ interface ValidationOptions /** * String or Function. If specified, the error label is displayed to show a valid element. If a String is given, it is added as a class to the label. If a Function is given, it is called with the label (as a jQuery object) and the validated input (as a DOM element). The label can be used to add a text like "ok!". */ - success?: any; + success?: string|{($label: JQuery, validatedInput: HTMLElement):void}; /** * Called to revert changes made by option highlight, same arguments as highlight. * @@ -180,13 +180,13 @@ interface Validator * @param name The name of the method used to identify it and referencing it; this must be a valid JavaScript identifier * @param method The actual method implementation, returning true if an element is valid. First argument: Current value. Second argument: Validated element. Third argument: Parameters. */ - addMethod(name: string, method: (value: any, element: any, params: any) => any, message?: any): void; + addMethod(name: string, method: (value: any, element: HTMLElement, params: any) => any, message?: any): void; /** * Validates a single element, returns true if it is valid, false otherwise. * * @param element An element to validate, must be inside the validated form. eg "#myselect" */ - element(element: any): boolean; + element(element: string): boolean; /** * Validates the form, returns true if it is valid, false otherwise. */ diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index c3be009d5f..8a2e23cf90 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -3043,7 +3043,7 @@ function test_merge() { var first = ['a', 'b', 'c']; var second = ['d', 'e', 'f']; $.merge($.merge([], first), second); - var z = $.merge([0, 1, 2], ['a', 'b', 'c']); + var z = $.merge([0, 1, 2], ['a', 'b', 'c']); } function test_prop() { diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 9b0e7dcf2d..f53bb07a98 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -276,28 +276,7 @@ interface JQueryGenericPromise { * @param doneFilter A function that is called when the Deferred is resolved. * @param failFilter An optional function that is called when the Deferred is rejected. */ - then(doneFilter: (value: T) => U, failFilter?: (reason: any) => U): JQueryGenericPromise; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - */ - then(doneFilter: (value: T) => JQueryGenericPromise, failFilter?: (reason: any) => U): JQueryGenericPromise; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - */ - then(doneFilter: (value: T) => U, failFilter?: (reason: any) => JQueryGenericPromise): JQueryGenericPromise; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - */ - then(doneFilter: (value: T) => JQueryGenericPromise, failFilter?: (reason: any) => JQueryGenericPromise): JQueryGenericPromise; + then(doneFilter: (value: T) => U|JQueryGenericPromise, failFilter?: (reason: any) => U|JQueryGenericPromise): JQueryGenericPromise; } /** @@ -360,31 +339,7 @@ interface JQueryPromise { * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. */ - then(doneFilter: (value: T) => U, failFilter?: (...reasons: any[]) => U, progressFilter?: (...progression: any[]) => any): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - */ - then(doneFilter: (value: T) => JQueryGenericPromise, failFilter?: (...reasons: any[]) => U, progressFilter?: (...progression: any[]) => any): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - */ - then(doneFilter: (value: T) => U, failFilter?: (...reasons: any[]) => JQueryGenericPromise, progressFilter?: (...progression: any[]) => any): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - */ - then(doneFilter: (value: T) => JQueryGenericPromise, failFilter?: (...reasons: any[]) => JQueryGenericPromise, progressFilter?: (...progression: any[]) => any): JQueryPromise; + then(doneFilter: (value: T) => U|JQueryGenericPromise, failFilter?: (...reasons: any[]) => U|JQueryGenericPromise, progressFilter?: (...progression: any[]) => any): JQueryPromise; // Because JQuery Promises Suck /** @@ -394,31 +349,7 @@ interface JQueryPromise { * @param failFilter An optional function that is called when the Deferred is rejected. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. */ - then(doneFilter: (...values: any[]) => U, failFilter?: (...reasons: any[]) => U, progressFilter?: (...progression: any[]) => any): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - */ - then(doneFilter: (...values: any[]) => JQueryGenericPromise, failFilter?: (...reasons: any[]) => U, progressFilter?: (...progression: any[]) => any): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - */ - then(doneFilter: (...values: any[]) => U, failFilter?: (...reasons: any[]) => JQueryGenericPromise, progressFilter?: (...progression: any[]) => any): JQueryPromise; - /** - * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress. - * - * @param doneFilter A function that is called when the Deferred is resolved. - * @param failFilter An optional function that is called when the Deferred is rejected. - * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred. - */ - then(doneFilter: (...values: any[]) => JQueryGenericPromise, failFilter?: (...reasons: any[]) => JQueryGenericPromise, progressFilter?: (...progression: any[]) => any): JQueryPromise; + then(doneFilter: (...values: any[]) => U|JQueryGenericPromise, failFilter?: (...reasons: any[]) => U|JQueryGenericPromise, progressFilter?: (...progression: any[]) => any): JQueryPromise; } /** @@ -743,16 +674,7 @@ interface JQueryStatic { * @param success A callback function that is executed if the request succeeds. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). */ - get(url: string, data?: Object, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP GET request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html). - */ - get(url: string, data?: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + get(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; /** * Load JSON-encoded data from the server using a GET HTTP request. * @@ -767,15 +689,7 @@ interface JQueryStatic { * @param data A plain object or string that is sent to the server with the request. * @param success A callback function that is executed if the request succeeds. */ - getJSON(url: string, data?: Object, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; - /** - * Load JSON-encoded data from the server using a GET HTTP request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. - */ - getJSON(url: string, data?: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; + getJSON(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR; /** * Load a JavaScript file from the server using a GET HTTP request, then execute it. * @@ -805,16 +719,7 @@ interface JQueryStatic { * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). */ - post(url: string, data?: Object, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; - /** - * Load data from the server using a HTTP POST request. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param success A callback function that is executed if the request succeeds. Required if dataType is provided, but can be null in that case. - * @param dataType The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html). - */ - post(url: string, data?: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; + post(url: string, data?: Object|string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any, dataType?: string): JQueryXHR; /** * A multi-purpose callbacks list object that provides a powerful way to manage callback lists. @@ -836,14 +741,7 @@ interface JQueryStatic { * @param selector A string containing a selector expression * @param context A DOM Element, Document, or jQuery to use as context */ - (selector: string, context?: Element): JQuery; - /** - * Accepts a string containing a CSS selector which is then used to match a set of elements. - * - * @param selector A string containing a selector expression - * @param context A DOM Element, Document, or jQuery to use as context - */ - (selector: string, context?: JQuery): JQuery; + (selector: string, context?: Element|JQuery): JQuery; /** * Accepts a string containing a CSS selector which is then used to match a set of elements. * @@ -1313,15 +1211,7 @@ interface JQuery { * @param data A plain object or string that is sent to the server with the request. * @param complete A callback function that is executed when the request completes. */ - load(url: string, data?: string, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery; - /** - * Load data from the server and place the returned HTML into the matched element. - * - * @param url A string containing the URL to which the request is sent. - * @param data A plain object or string that is sent to the server with the request. - * @param complete A callback function that is executed when the request completes. - */ - load(url: string, data?: Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery; + load(url: string, data?: string|Object, complete?: (responseText: string, textStatus: string, XMLHttpRequest: XMLHttpRequest) => any): JQuery; /** * Encode a set of form elements as a string for submission. @@ -1362,14 +1252,7 @@ interface JQuery { * @param attributeName The name of the attribute to set. * @param value A value to set for the attribute. */ - attr(attributeName: string, value: string): JQuery; - /** - * Set one or more attributes for the set of matched elements. - * - * @param attributeName The name of the attribute to set. - * @param value A value to set for the attribute. - */ - attr(attributeName: string, value: number): JQuery; + attr(attributeName: string, value: string|number): JQuery; /** * Set one or more attributes for the set of matched elements. * @@ -1425,21 +1308,7 @@ interface JQuery { * @param propertyName The name of the property to set. * @param value A value to set for the property. */ - prop(propertyName: string, value: string): JQuery; - /** - * Set one or more properties for the set of matched elements. - * - * @param propertyName The name of the property to set. - * @param value A value to set for the property. - */ - prop(propertyName: string, value: number): JQuery; - /** - * Set one or more properties for the set of matched elements. - * - * @param propertyName The name of the property to set. - * @param value A value to set for the property. - */ - prop(propertyName: string, value: boolean): JQuery; + prop(propertyName: string, value: string|number|boolean): JQuery; /** * Set one or more properties for the set of matched elements. * @@ -1511,49 +1380,14 @@ interface JQuery { * * @param value A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked. */ - val(value: string): JQuery; - /** - * Set the value of each element in the set of matched elements. - * - * @param value A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked. - */ - val(value: string[]): JQuery; + val(value: string|string[]): JQuery; /** * Set the value of each element in the set of matched elements. * * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. */ val(func: (index: number, value: string) => string): JQuery; - /** - * Set the value of each element in the set of matched elements. - * - * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - */ - val(func: (index: number, value: string[]) => string): JQuery; - /** - * Set the value of each element in the set of matched elements. - * - * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - */ - val(func: (index: number, value: number) => string): JQuery; - /** - * Set the value of each element in the set of matched elements. - * - * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - */ - val(func: (index: number, value: string) => string[]): JQuery; - /** - * Set the value of each element in the set of matched elements. - * - * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - */ - val(func: (index: number, value: string[]) => string[]): JQuery; - /** - * Set the value of each element in the set of matched elements. - * - * @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - */ - val(func: (index: number, value: number) => string[]): JQuery; + /** * Get the value of style properties for the first element in the set of matched elements. @@ -1567,42 +1401,14 @@ interface JQuery { * @param propertyName A CSS property name. * @param value A value to set for the property. */ - css(propertyName: string, value: string): JQuery; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A value to set for the property. - */ - css(propertyName: string, value: number): JQuery; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A value to set for the property. - */ - css(propertyName: string, value: string[]): JQuery; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A value to set for the property. - */ - css(propertyName: string, value: number[]): JQuery; + css(propertyName: string, value: string|number): JQuery; /** * Set one or more CSS properties for the set of matched elements. * * @param propertyName A CSS property name. * @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. */ - css(propertyName: string, value: (index: number, value: string) => string): JQuery; - /** - * Set one or more CSS properties for the set of matched elements. - * - * @param propertyName A CSS property name. - * @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments. - */ - css(propertyName: string, value: (index: number, value: number) => number): JQuery; + css(propertyName: string, value: (index: number, value: string) => string|number): JQuery; /** * Set one or more CSS properties for the set of matched elements. * @@ -1619,37 +1425,13 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). */ - height(value: number): JQuery; - /** - * Set the CSS height of every matched element. - * - * @param value An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string). - */ - height(value: string): JQuery; + height(value: number|string): JQuery; /** * Set the CSS height of every matched element. * * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. */ - height(func: (index: number, height: number) => number): JQuery; - /** - * Set the CSS height of every matched element. - * - * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. - */ - height(func: (index: number, height: string) => string): JQuery; - /** - * Set the CSS height of every matched element. - * - * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. - */ - height(func: (index: number, height: string) => number): JQuery; - /** - * Set the CSS height of every matched element. - * - * @param func A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set. - */ - height(func: (index: number, height: number) => string): JQuery; + height(func: (index: number, height: number) => number|string): JQuery; /** * Get the current computed height for the first element in the set of matched elements, including padding but not border. @@ -1661,14 +1443,7 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - innerHeight(height: number): JQuery; - - /** - * Sets the inner height on elements in the set of matched elements, including padding but not border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - innerHeight(height: string): JQuery; + innerHeight(height: number|string): JQuery; /** * Get the current computed width for the first element in the set of matched elements, including padding but not border. @@ -1680,14 +1455,7 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - innerWidth(width: number): JQuery; - - /** - * Sets the inner width on elements in the set of matched elements, including padding but not border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - innerWidth(width: string): JQuery; + innerWidth(width: number|string): JQuery; /** * Get the current coordinates of the first element in the set of matched elements, relative to the document. @@ -1718,15 +1486,8 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - outerHeight(height: number): JQuery; + outerHeight(height: number|string): JQuery; - /** - * Sets the outer height on elements in the set of matched elements, including padding and border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - outerHeight(height: string): JQuery; - /** * Get the current computed width for the first element in the set of matched elements, including padding and border. * @@ -1739,14 +1500,7 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - outerWidth(width: number): JQuery; - - /** - * Sets the outer width on elements in the set of matched elements, including padding and border. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - outerWidth(width: string): JQuery; + outerWidth(width: number|string): JQuery; /** * Get the current coordinates of the first element in the set of matched elements, relative to the offset parent. @@ -1784,37 +1538,13 @@ interface JQuery { * * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). */ - width(value: number): JQuery; - /** - * Set the CSS width of each element in the set of matched elements. - * - * @param value An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string). - */ - width(value: string): JQuery; + width(value: number|string): JQuery; /** * Set the CSS width of each element in the set of matched elements. * * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. */ - width(func: (index: number, width: number) => number): JQuery; - /** - * Set the CSS width of each element in the set of matched elements. - * - * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. - */ - width(func: (index: number, width: string) => string): JQuery; - /** - * Set the CSS width of each element in the set of matched elements. - * - * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. - */ - width(func: (index: number, width: string) => number): JQuery; - /** - * Set the CSS width of each element in the set of matched elements. - * - * @param func A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set. - */ - width(func: (index: number, width: number) => string): JQuery; + width(func: (index: number, width: number) => number|string): JQuery; /** * Remove from the queue all items that have not yet been run. @@ -1882,15 +1612,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - animate(properties: Object, duration?: string, complete?: Function): JQuery; - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - animate(properties: Object, duration?: number, complete?: Function): JQuery; + animate(properties: Object, duration?: string|number, complete?: Function): JQuery; /** * Perform a custom animation of a set of CSS properties. * @@ -1899,16 +1621,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. (default: swing) * @param complete A function to call once the animation is complete. */ - animate(properties: Object, duration?: string, easing?: string, complete?: Function): JQuery; - /** - * Perform a custom animation of a set of CSS properties. - * - * @param properties An object of CSS properties and values that the animation will move toward. - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. (default: swing) - * @param complete A function to call once the animation is complete. - */ - animate(properties: Object, duration?: number, easing?: string, complete?: Function): JQuery; + animate(properties: Object, duration?: string|number, easing?: string, complete?: Function): JQuery; /** * Perform a custom animation of a set of CSS properties. * @@ -1931,14 +1644,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - fadeIn(duration?: number, complete?: Function): JQuery; - /** - * Display the matched elements by fading them to opaque. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - fadeIn(duration?: string, complete?: Function): JQuery; + fadeIn(duration?: number|string, complete?: Function): JQuery; /** * Display the matched elements by fading them to opaque. * @@ -1946,15 +1652,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - fadeIn(duration?: number, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements by fading them to opaque. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - fadeIn(duration?: string, easing?: string, complete?: Function): JQuery; + fadeIn(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Display the matched elements by fading them to opaque. * @@ -1968,14 +1666,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - fadeOut(duration?: number, complete?: Function): JQuery; - /** - * Hide the matched elements by fading them to transparent. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - fadeOut(duration?: string, complete?: Function): JQuery; + fadeOut(duration?: number|string, complete?: Function): JQuery; /** * Hide the matched elements by fading them to transparent. * @@ -1983,15 +1674,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - fadeOut(duration?: number, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements by fading them to transparent. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - fadeOut(duration?: string, easing?: string, complete?: Function): JQuery; + fadeOut(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Hide the matched elements by fading them to transparent. * @@ -2006,15 +1689,7 @@ interface JQuery { * @param opacity A number between 0 and 1 denoting the target opacity. * @param complete A function to call once the animation is complete. */ - fadeTo(duration: string, opacity: number, complete?: Function): JQuery; - /** - * Adjust the opacity of the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param opacity A number between 0 and 1 denoting the target opacity. - * @param complete A function to call once the animation is complete. - */ - fadeTo(duration: number, opacity: number, complete?: Function): JQuery; + fadeTo(duration: string|number, opacity: number, complete?: Function): JQuery; /** * Adjust the opacity of the matched elements. * @@ -2023,16 +1698,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - fadeTo(duration: string, opacity: number, easing?: string, complete?: Function): JQuery; - /** - * Adjust the opacity of the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param opacity A number between 0 and 1 denoting the target opacity. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - fadeTo(duration: number, opacity: number, easing?: string, complete?: Function): JQuery; + fadeTo(duration: string|number, opacity: number, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements by animating their opacity. @@ -2040,14 +1706,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - fadeToggle(duration?: number, complete?: Function): JQuery; - /** - * Display or hide the matched elements by animating their opacity. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - fadeToggle(duration?: string, complete?: Function): JQuery; + fadeToggle(duration?: number|string, complete?: Function): JQuery; /** * Display or hide the matched elements by animating their opacity. * @@ -2055,15 +1714,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - fadeToggle(duration?: number, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements by animating their opacity. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - fadeToggle(duration?: string, easing?: string, complete?: Function): JQuery; + fadeToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements by animating their opacity. * @@ -2084,14 +1735,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - hide(duration?: number, complete?: Function): JQuery; - /** - * Hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - hide(duration?: string, complete?: Function): JQuery; + hide(duration?: number|string, complete?: Function): JQuery; /** * Hide the matched elements. * @@ -2099,15 +1743,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - hide(duration?: number, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - hide(duration?: string, easing?: string, complete?: Function): JQuery; + hide(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Hide the matched elements. * @@ -2121,14 +1757,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - show(duration?: number, complete?: Function): JQuery; - /** - * Display the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - show(duration?: string, complete?: Function): JQuery; + show(duration?: number|string, complete?: Function): JQuery; /** * Display the matched elements. * @@ -2136,15 +1765,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - show(duration?: number, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - show(duration?: string, easing?: string, complete?: Function): JQuery; + show(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Display the matched elements. * @@ -2158,14 +1779,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - slideDown(duration?: number, complete?: Function): JQuery; - /** - * Display the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - slideDown(duration?: string, complete?: Function): JQuery; + slideDown(duration?: number|string, complete?: Function): JQuery; /** * Display the matched elements with a sliding motion. * @@ -2173,15 +1787,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - slideDown(duration?: number, easing?: string, complete?: Function): JQuery; - /** - * Display the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - slideDown(duration?: string, easing?: string, complete?: Function): JQuery; + slideDown(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Display the matched elements with a sliding motion. * @@ -2195,14 +1801,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - slideToggle(duration?: number, complete?: Function): JQuery; - /** - * Display or hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - slideToggle(duration?: string, complete?: Function): JQuery; + slideToggle(duration?: number|string, complete?: Function): JQuery; /** * Display or hide the matched elements with a sliding motion. * @@ -2210,15 +1809,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - slideToggle(duration?: number, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - slideToggle(duration?: string, easing?: string, complete?: Function): JQuery; + slideToggle(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements with a sliding motion. * @@ -2232,14 +1823,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - slideUp(duration?: number, complete?: Function): JQuery; - /** - * Hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - slideUp(duration?: string, complete?: Function): JQuery; + slideUp(duration?: number|string, complete?: Function): JQuery; /** * Hide the matched elements with a sliding motion. * @@ -2247,15 +1831,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - slideUp(duration?: number, easing?: string, complete?: Function): JQuery; - /** - * Hide the matched elements with a sliding motion. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - slideUp(duration?: string, easing?: string, complete?: Function): JQuery; + slideUp(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Hide the matched elements with a sliding motion. * @@ -2285,14 +1861,7 @@ interface JQuery { * @param duration A string or number determining how long the animation will run. * @param complete A function to call once the animation is complete. */ - toggle(duration?: number, complete?: Function): JQuery; - /** - * Display or hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param complete A function to call once the animation is complete. - */ - toggle(duration?: string, complete?: Function): JQuery; + toggle(duration?: number|string, complete?: Function): JQuery; /** * Display or hide the matched elements. * @@ -2300,15 +1869,7 @@ interface JQuery { * @param easing A string indicating which easing function to use for the transition. * @param complete A function to call once the animation is complete. */ - toggle(duration?: number, easing?: string, complete?: Function): JQuery; - /** - * Display or hide the matched elements. - * - * @param duration A string or number determining how long the animation will run. - * @param easing A string indicating which easing function to use for the transition. - * @param complete A function to call once the animation is complete. - */ - toggle(duration?: string, easing?: string, complete?: Function): JQuery; + toggle(duration?: number|string, easing?: string, complete?: Function): JQuery; /** * Display or hide the matched elements. * @@ -2900,28 +2461,14 @@ interface JQuery { * @param eventType A string containing a JavaScript event type, such as click or submit. * @param extraParameters Additional parameters to pass along to the event handler. */ - trigger(eventType: string, extraParameters?: any[]): JQuery; - /** - * Execute all handlers and behaviors attached to the matched elements for the given event type. - * - * @param eventType A string containing a JavaScript event type, such as click or submit. - * @param extraParameters Additional parameters to pass along to the event handler. - */ - trigger(eventType: string, extraParameters?: Object): JQuery; + trigger(eventType: string, extraParameters?: any[]|Object): JQuery; /** * Execute all handlers and behaviors attached to the matched elements for the given event type. * * @param event A jQuery.Event object. * @param extraParameters Additional parameters to pass along to the event handler. */ - trigger(event: JQueryEventObject, extraParameters?: any[]): JQuery; - /** - * Execute all handlers and behaviors attached to the matched elements for the given event type. - * - * @param event A jQuery.Event object. - * @param extraParameters Additional parameters to pass along to the event handler. - */ - trigger(event: JQueryEventObject, extraParameters?: Object): JQuery; + trigger(event: JQueryEventObject, extraParameters?: any[]|Object): JQuery; /** * Execute all handlers attached to an element for an event. @@ -3034,35 +2581,7 @@ interface JQuery { * param content1 HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. */ - after(content1: JQuery, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. - */ - after(content1: any[], ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. - */ - after(content1: Element, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. - */ - after(content1: Text, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, after each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert after each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements. - */ - after(content1: string, ...content2: any[]): JQuery; + after(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, after each element in the set of matched elements. * @@ -3076,35 +2595,7 @@ interface JQuery { * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. */ - append(content1: JQuery, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. - */ - append(content1: any[], ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. - */ - append(content1: Element, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. - */ - append(content1: Text, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the end of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements. - */ - append(content1: string, ...content2: any[]): JQuery; + append(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, to the end of each element in the set of matched elements. * @@ -3117,25 +2608,7 @@ interface JQuery { * * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. */ - appendTo(target: JQuery): JQuery; - /** - * Insert every element in the set of matched elements to the end of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. - */ - appendTo(target: any[]): JQuery; - /** - * Insert every element in the set of matched elements to the end of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. - */ - appendTo(target: Element): JQuery; - /** - * Insert every element in the set of matched elements to the end of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter. - */ - appendTo(target: string): JQuery; + appendTo(target: JQuery|any[]|Element|string): JQuery; /** * Insert content, specified by the parameter, before each element in the set of matched elements. @@ -3143,35 +2616,7 @@ interface JQuery { * param content1 HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. */ - before(content1: JQuery, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. - */ - before(content1: any[], ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. - */ - before(content1: Element, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. - */ - before(content1: Text, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, before each element in the set of matched elements. - * - * param content1 HTML string, DOM element, array of elements, or jQuery object to insert before each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements. - */ - before(content1: string, ...content2: any[]): JQuery; + before(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, before each element in the set of matched elements. * @@ -3204,62 +2649,14 @@ interface JQuery { * * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. */ - insertAfter(target: JQuery): JQuery; - /** - * Insert every element in the set of matched elements after the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. - */ - insertAfter(target: any[]): JQuery; - /** - * Insert every element in the set of matched elements after the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. - */ - insertAfter(target: Element): JQuery; - /** - * Insert every element in the set of matched elements after the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. - */ - insertAfter(target: Text): JQuery; - /** - * Insert every element in the set of matched elements after the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter. - */ - insertAfter(target: string): JQuery; + insertAfter(target: JQuery|any[]|Element|Text|string): JQuery; /** * Insert every element in the set of matched elements before the target. * * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. */ - insertBefore(target: JQuery): JQuery; - /** - * Insert every element in the set of matched elements before the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. - */ - insertBefore(target: any[]): JQuery; - /** - * Insert every element in the set of matched elements before the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. - */ - insertBefore(target: Element): JQuery; - /** - * Insert every element in the set of matched elements before the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. - */ - insertBefore(target: Text): JQuery; - /** - * Insert every element in the set of matched elements before the target. - * - * param target A selector, element, array of elements, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter. - */ - insertBefore(target: string): JQuery; + insertBefore(target: JQuery|any[]|Element|Text|string): JQuery; /** * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. @@ -3267,35 +2664,7 @@ interface JQuery { * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. */ - prepend(content1: JQuery, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. - */ - prepend(content1: any[], ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. - */ - prepend(content1: Element, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. - */ - prepend(content1: Text, ...content2: any[]): JQuery; - /** - * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. - * - * param content1 DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements. - * param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements. - */ - prepend(content1: string, ...content2: any[]): JQuery; + prepend(content1: JQuery|any[]|Element|Text|string, ...content2: any[]): JQuery; /** * Insert content, specified by the parameter, to the beginning of each element in the set of matched elements. * @@ -3308,25 +2677,7 @@ interface JQuery { * * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. */ - prependTo(target: JQuery): JQuery; - /** - * Insert every element in the set of matched elements to the beginning of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. - */ - prependTo(target: any[]): JQuery; - /** - * Insert every element in the set of matched elements to the beginning of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. - */ - prependTo(target: Element): JQuery; - /** - * Insert every element in the set of matched elements to the beginning of the target. - * - * @param target A selector, element, HTML string, array of elements, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter. - */ - prependTo(target: string): JQuery; + prependTo(target: JQuery|any[]|Element|string): JQuery; /** * Remove the set of matched elements from the DOM. @@ -3340,56 +2691,14 @@ interface JQuery { * * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. */ - replaceAll(target: JQuery): JQuery; - /** - * Replace each target element with the set of matched elements. - * - * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. - */ - replaceAll(target: any[]): JQuery; - /** - * Replace each target element with the set of matched elements. - * - * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. - */ - replaceAll(target: Element): JQuery; - /** - * Replace each target element with the set of matched elements. - * - * @param target A selector string, jQuery object, DOM element, or array of elements indicating which element(s) to replace. - */ - replaceAll(target: string): JQuery; + replaceAll(target: JQuery|any[]|Element|string): JQuery; /** * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. * * param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. */ - replaceWith(newContent: JQuery): JQuery; - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. - */ - replaceWith(newContent: any[]): JQuery; - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. - */ - replaceWith(newContent: Element): JQuery; - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. - */ - replaceWith(newContent: Text): JQuery; - /** - * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. - * - * param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object. - */ - replaceWith(newContent: string): JQuery; + replaceWith(newContent: JQuery|any[]|Element|Text|string): JQuery; /** * Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed. * @@ -3404,21 +2713,9 @@ interface JQuery { /** * Set the content of each element in the set of matched elements to the specified text. * - * @param text The text to set as the content of each matched element. + * @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation. */ - text(text: string): JQuery; - /** - * Set the content of each element in the set of matched elements to the specified text. - * - * @param text The text to set as the content of each matched element. - */ - text(text: number): JQuery; - /** - * Set the content of each element in the set of matched elements to the specified text. - * - * @param text The text to set as the content of each matched element. - */ - text(text: boolean): JQuery; + text(text: string|number|boolean): JQuery; /** * Set the content of each element in the set of matched elements to the specified text. * @@ -3441,19 +2738,7 @@ interface JQuery { * * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. */ - wrap(wrappingElement: JQuery): JQuery; - /** - * Wrap an HTML structure around each element in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - */ - wrap(wrappingElement: Element): JQuery; - /** - * Wrap an HTML structure around each element in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - */ - wrap(wrappingElement: string): JQuery; + wrap(wrappingElement: JQuery|Element|string): JQuery; /** * Wrap an HTML structure around each element in the set of matched elements. * @@ -3466,38 +2751,14 @@ interface JQuery { * * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. */ - wrapAll(wrappingElement: JQuery): JQuery; - /** - * Wrap an HTML structure around all elements in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - */ - wrapAll(wrappingElement: Element): JQuery; - /** - * Wrap an HTML structure around all elements in the set of matched elements. - * - * @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements. - */ - wrapAll(wrappingElement: string): JQuery; + wrapAll(wrappingElement: JQuery|Element|string): JQuery; /** * Wrap an HTML structure around the content of each element in the set of matched elements. * * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. */ - wrapInner(wrappingElement: JQuery): JQuery; - /** - * Wrap an HTML structure around the content of each element in the set of matched elements. - * - * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. - */ - wrapInner(wrappingElement: Element): JQuery; - /** - * Wrap an HTML structure around the content of each element in the set of matched elements. - * - * @param wrappingElement An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements. - */ - wrapInner(wrappingElement: string): JQuery; + wrapInner(wrappingElement: JQuery|Element|string): JQuery; /** * Wrap an HTML structure around the content of each element in the set of matched elements. * @@ -3532,19 +2793,7 @@ interface JQuery { * * @param selector A selector representing a jQuery collection in which to look for an element. */ - index(selector: string): number; - /** - * Search for a given element from among the matched elements. - * - * @param element The DOM element or first element within the jQuery object to look for. - */ - index(element: JQuery): number; - /** - * Search for a given element from among the matched elements. - * - * @param element The DOM element or first element within the jQuery object to look for. - */ - index(element: Element): number; + index(selector: string|JQuery|Element): number; /** * The number of elements in the jQuery object. diff --git a/jsdom/jsdom-tests.ts b/jsdom/jsdom-tests.ts new file mode 100644 index 0000000000..cb6992b49a --- /dev/null +++ b/jsdom/jsdom-tests.ts @@ -0,0 +1,51 @@ +import jsdom = require("jsdom"); + +jsdom.defaultDocumentFeatures.FetchExternalResources = ["img"]; + +jsdom.env( + "http://nodejs.org/dist/", + ["http://code.jquery.com/jquery.js"], + function (errors: Error[], window: Window) { + } +); + +jsdom.env( + "http://nodejs.org/dist/", + function (errors: Error[], window: Window) { + } +); + +jsdom.env( + "http://nodejs.org/dist/", + { + scripts: ["http://code.jquery.com/jquery.js"], + }, + function (errors: Error[], window: Window) { + } +); + +jsdom.env( + '

jsdom!

', + ["http://code.jquery.com/jquery.js"], + function (errors: Error[], window: Window) { + } +); + +jsdom.env({ + url: "http://news.ycombinator.com/", + scripts: ["http://code.jquery.com/jquery.js"], + done: function (errors: Error[], window: Window) { + } +}); + +var jquery: string; + +jsdom.env({ + url: "http://news.ycombinator.com/", + src: [jquery], + done: function (errors: Error[], window: Window) { + } +}); + +var window: Window = jsdom.jsdom("
foobar
").parentWindow; +var document: Document = jsdom.jsdom(""); \ No newline at end of file diff --git a/jsdom/jsdom.d.ts b/jsdom/jsdom.d.ts new file mode 100644 index 0000000000..b9864b3b79 --- /dev/null +++ b/jsdom/jsdom.d.ts @@ -0,0 +1,143 @@ +// Type definitions for jsdom 2.0.0 +// Project: https://github.com/tmpvar/jsdom +// Definitions by: Asana +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "jsdom" { + /** + * The do-what-I-mean API. + * + * Example: + * jsdom.env(html, function (errors, window) { + * // free memory associated with the window + * window.close(); + * }); + * + * @param urlOrSource may be a URL, file name, or HTML fragment + * @param scriptUrlsOrSources a string or array of strings, containing file names or URLs that will be inserted as + * @param config Configuration object + * @param callback + */ + export function env(urlOrHtml: string, scripts: string, config: Config, callback?: Callback): void; + export function env(urlOrHtml: string, scripts: string, callback: Callback): void; + export function env(urlOrHtml: string, scripts: string[], config: Config, callback?: Callback): void; + export function env(urlOrHtml: string, scripts: string[], callback: Callback): void; + export function env(urlOrHtml: string, callback: Callback): void; + export function env(urlOrHtml: string, config: Config, callback?: Callback): void; + export function env(config: Config, callback?: Callback): void; + + /** + * The jsdom.jsdom method does less things automatically; it takes in only HTML source, and does not let you to + * separately supply script that it will inject and execute. It just gives you back a document object, + * with usable document.parentWindow, and starts asynchronously executing any