Merge remote-tracking branch 'upstream/master'

Conflicts:
	jquery/jquery.d.ts
This commit is contained in:
Daniel Ferreira Monteiro Alves
2013-11-05 04:23:06 -02:00
763 changed files with 246097 additions and 162152 deletions

23
.gitignore vendored
View File

@@ -1,5 +1,6 @@
*.dll
*.exe
*.cmd
*.pdb
*.suo
*.js
@@ -28,3 +29,25 @@ Properties
!_infrastructure/tests/*/*.js
!_infrastructure/tests/*/*/*.js
!_infrastructure/tests/*/*/*/*.js
.idea/.name
.idea/DefinitelyTyped.iml
.idea/encodings.xml
.idea/libraries/Generated_files.xml
.idea/misc.xml
.idea/modules.xml
.idea/scopes/scope_settings.xml
.idea/vcs.xml
.idea/workspace.xml
.idea/watcherTasks.xml
.idea/watcherTasks.xml

View File

@@ -29,6 +29,7 @@ List of Definitions
* [Ace Cloud9 Editor](http://ace.ajax.org/) (by [Diullei Gomes](https://github.com/Diullei))
* [AmCharts](http://www.amcharts.com/) (by [Covobonomo](https://github.com/covobonomo/))
* [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes))
* [AppFramework](http://app-framework-software.intel.com/) (by [Kyo Ago](https://github.com/kyo-ago))
* [Arbiter](http://arbiterjs.com/) (by [Arash Shakery](https://github.com/arash16))
* [async](https://github.com/caolan/async) (by [Boris Yankov](https://github.com/borisyankov))
* [Backbone.js](http://backbonejs.org/) (by [Boris Yankov](https://github.com/borisyankov))
@@ -39,13 +40,18 @@ List of Definitions
* [bootstrap.datepicker](https://github.com/eternicode/bootstrap-datepicker) (by [Boris Yankov](https://github.com/borisyankov))
* [Box2DWeb](http://code.google.com/p/box2dweb/) (by [Josh Baldwin](https://github.com/jbaldwin/))
* [Breeze](http://www.breezejs.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [Browser Harness](https://github.com/scriby/browser-harness) (by [Chris Scribner](https://github.com/scriby))
* [CasperJS](http://casperjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker))
* [Cheerio](https://github.com/MatthewMueller/cheerio) (by [Bret Little](https://github.com/blittle))
* [Chosen](http://harvesthq.github.com/chosen/) (by [Boris Yankov](https://github.com/borisyankov))
* [Chrome](http://developer.chrome.com/extensions/) (by [Matthew Kimber](https://github.com/matthewkimber))
* [Chrome App](http://developer.chrome.com/apps/) (by [Adam Lay](https://github.com/AdamLay))
* [CodeMirror](http://codemirror.net) (by [François de Campredon](https://github.com/fdecampredon))
* [Commander](http://github.com/visionmedia/commander.js) (by [Marcelo Dezem](https://github.com/mdezem))
* [d3.js](http://d3js.org/) (from TypeScript samples)
* [dhtmlxGantt](http://dhtmlx.com/docs/products/dhtmlxGantt) (by [Maksim Kozhukh](http://github.com/mkozhukh))
* [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler) (by [Maksim Kozhukh](http://github.com/mkozhukh))
* [docCookies](https://developer.mozilla.org/en-US/docs/Web/API/document.cookie) (by [Jon Egerton](https://github.com/jonegerton))
* [domo](http://domo-js.com/) (by [Steve Fenton](https://github.com/Steve-Fenton))
* [dust](http://linkedin.github.com/dustjs) (by [Marcelo Dezem](https://github.com/mdezem))
* [EaselJS](http://www.createjs.com/#!/EaselJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
@@ -60,37 +66,52 @@ List of Definitions
* [File API: Writer](http://www.w3.org/TR/file-writer-api/) (by [Kon](http://phyzkit.net/))
* [Finite State Machine](https://github.com/jakesgordon/javascript-state-machine) (by [Boris Yankov](https://github.com/borisyankov))
* [Firebase](https://www.firebase.com/docs/javascript/firebase) (by [Vincent Bortone](https://github.com/vbortone))
* [Firefox](https://developer.mozilla.org/en-US/docs/Web/API) (by [vvakame](https://github.com/vvakame))
* [FlexSlider](http://www.woothemes.com/flexslider/) (by [Diullei Gomes](https://github.com/Diullei))
* [Flight by Twitter](http://flightjs.github.com/flight/) (by [Jonathan Hedrén](https://github.com/jonathanhedren))
* [Foundation](http://foundation.zurb.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [FPSMeter](http://darsa.in/fpsmeter/) (by [Aaron Lampros](https://github.com/alampros))
* [FullCalendar](http://arshaw.com/fullcalendar/) (by [Neil Stalker](https://github.com/nestalk))
* [Gamepad](http://www.w3.org/TR/gamepad/) (by [Kon](http://phyzkit.net/))
* [Giraffe](https://github.com/barc/backbone.giraffe) (by [Matt McCray](https://github.com/darthapo))
* [glDatePicker](http://glad.github.com/glDatePicker/) (by [Dániel Tar](https://github.com/qcz))
* [GoJS](http://gojs.net/) (by [Barbara Duckworth](https://github.com/barbara42))
* [Greasemonkey](http://www.greasespot.net/) (by [Kota Saito](https://github.com/kotas))
* [GreenSock Animation Platform (GSAP)](http://www.greensock.com/get-started-js/) (by [Robert S.](https://github.com/codeBelt))
* [Grunt JS](http://gruntjs.com/) (by [Basarat Ali Syed](https://github.com/basarat))
* [Grunt JS](http://gruntjs.com/) (by [Jeff May](https://github.com/jeffmay) and [Basarat Ali Syed](https://github.com/basarat))
* [Google API Client](https://code.google.com/p/google-api-javascript-client/) (by [Frank M](https://github.com/sgtfrankieboy))
* [Google App Engine Channel API](https://developers.google.com/appengine/docs/java/channel/javascript) (by [vvakame](https://github.com/vvakame))
* [GoogleMaps](https://developers.google.com/maps/) (by [Esben Nepper](https://github.com/eNepper))
* [Google Geolocation](https://code.google.com/p/geo-location-javascript/) (by [Vincent Bortone](https://github.com/vbortone))
* [Google Page Speed Online API](https://developers.google.com/speed/pagespeed/) (by [Frank M](https://github.com/sgtfrankieboy))
* [Google Translate API](https://developers.google.com/translate/) (by [Frank M](https://github.com/sgtfrankieboy))
* [Google Url Shortener](https://developers.google.com/url-shortener/) (by [Frank M](https://github.com/sgtfrankieboy))
* [Hammer.js](http://eightmedia.github.com/hammer.js/) (by [Boris Yankov](https://github.com/borisyankov))
* [Handlebars](http://handlebarsjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [Highcharts](http://www.highcharts.com/) (by [damianog](https://github.com/damianog))
* [History.js](https://github.com/balupton/History.js/) (by [Boris Yankov](https://github.com/borisyankov))
* [highlight.js](https://github.com/isagalaev/highlight.js) (by [Niklas Mollenhauer](https://github.com/nikeee))
* [History.js](https://github.com/browserstate/history.js) (by [Boris Yankov](https://github.com/borisyankov))
* [Humane.js](http://wavded.github.com/humane-js/) (by [John Vrbanac](https://github.com/jmvrbanac))
* [i18next](http://i18next.com/) (by [Maarten Docter](https://github.com/mdocter))
* [iCheck](http://damirfoy.com/iCheck/) (by [Dániel Tar](https://github.com/qcz))
* [Impress.js](https://github.com/bartaz/impress.js) (by [Boris Yankov](https://github.com/borisyankov))
* [iScroll](http://cubiq.org/iscroll-4) (by [Boris Yankov](https://github.com/borisyankov))
* [iScroll](http://cubiq.org/iscroll-4) (by [Boris Yankov](https://github.com/borisyankov) and [Christiaan Rakowski](https://github.com/csrakowski))
* [jake](https://github.com/mde/jake) (by [Kon](http://phyzkit.net/))
* [Jasmine](http://pivotal.github.com/jasmine/) (by [Boris Yankov](https://github.com/borisyankov))
* [Jasmine-jQuery](https://github.com/velesin/jasmine-jquery) (by [Gregor Stamac](https://github.com/gstamac))
* [JointJS](http://www.jointjs.com/) (by [Aidan Reel](http://github.com/areel))
* [jQRangeSlider](http://ghusse.github.com/jQRangeSlider) (by [Dániel Tar](https://github.com/qcz))
* [jQuery](http://jquery.com/) (from TypeScript samples)
* [jQuery Mobile](http://jquerymobile.com) (by [Boris Yankov](https://github.com/borisyankov))
* [jQuery UI](http://jqueryui.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [jQuery.Address](https://github.com/asual/jquery-address) (by [Martin Duparc](https://github.com/martinduparc/))
* [jQuery.areYouSure](https://github.com/codedance/jquery.AreYouSure) (by [Jon Egerton](https://github.com/jonegerton))
* [jQuery.autosize](http://www.jacklmoore.com/autosize/) (by [Jack Moore](http://www.jacklmoore.com/))
* [jQuery.BBQ](http://benalman.com/projects/jquery-bbq-plugin/) (by [Adam R. Smith](https://github.com/sunetos))
* [jQuery.contextMenu](http://medialize.github.com/jQuery-contextMenu/) (by [Natan Vivo](https://github.com/nvivo/))
* [jQuery.CLEditor](http://premiumsoftware.net/CLEditor) (by [Jeffery Grajkowski](https://github.com/pushplay))
* [jQuery.clientSideLogging](https://github.com/remybach/jQuery.clientSideLogging/) (by [Diullei Gomes](https://github.com/diullei/))
* [jQuery.Colorbox](http://www.jacklmoore.com/colorbox/) (by [Gidon Junge](https://github.com/gjunge))
* [jQuery.contextMenu](http://medialize.github.com/jQuery-contextMenu/) (by [Natan Vivo](https://github.com/nvivo/))
* [jQuery.Cookie](https://github.com/carhartl/jquery-cookie) (by [Roy Goode](https://github.com/RoyGoode))
* [jQuery.Cycle](http://jquery.malsup.com/cycle/) (by [François Guillot](http://fguillot.developpez.com/))
* [jQuery.dataTables](http://www.datatables.net) (by [Armin Sander](https://github.com/pragmatrix))
@@ -98,13 +119,17 @@ List of Definitions
* [jQuery.Flot](http://www.flotcharts.org/) (by [Matt Burland](https://github.com/burlandm))
* [jQuery.form](http://malsup.com/jquery/form/) (by [François Guillot](http://fguillot.developpez.com/))
* [jQuery.Globalize](https://github.com/jquery/globalize) (by [Boris Yankov](https://github.com/borisyankov))
* [jQuery.gridster](http://gridster.net) (by [Josh Baldwin](https://github.com/jbaldwin/gridster.d.ts))
* [jQuery.jNotify](http://jnotify.codeplex.com) (by [James Curran](https://github.com/jamescurran/))
* [jQuery.noty](http://needim.github.io/noty/) (by [Aaron King](https://github.com/kingdango/))
* [jQuery.pickadate](https://github.com/amsul/pickadate.js) (by [Theodore Brown](https://github.com/theodorejb))
* [jQuery.payment](http://needim.github.io/noty/) (by [Eric J. Smith](https://github.com/ejsmith/))
* [jQuery.scrollTo](https://github.com/flesler/jquery.scrollTo) (by [Neil Stalker](https://github.com/nestalk/))
* [jQuery.simplePagination](https://github.com/flaviusmatis/simplePagination.js) (by [Natan Vivo](https://github.com/nvivo/))
* [jquery.superLink](http://james.padolsey.com/demos/plugins/jQuery/superLink/superlink.jquery.js) (by [Blake Niemyjski](https://github.com/niemyjski))
* [jQuery.timeago](http://timeago.yarp.com/) (by [François Guillot](http://fguillot.developpez.com/))
* [jQuery.Timepicker](http://fgelinas.com/code/timepicker/) (by [Anwar Javed](https://github.com/anwarjaved))
* [jQuery.Timer](http://jchavannes.com/jquery-timer/demo) (by [Joshua Strobl](https://github.com/JoshStrobl))
* [jQuery.TinyCarousel](http://baijs.nl/tinycarousel/) (by [Christiaan Rakowski](https://github.com/csrakowski))
* [jQuery.TinyScrollbar](http://baijs.nl/tinyscrollbar/) (by [Christiaan Rakowski](https://github.com/csrakowski))
* [jQuery.Transit](http://ricostacruz.com/jquery.transit/) (by [MrBigDog2U](https://github.com/MrBigDog2U))
@@ -118,6 +143,9 @@ List of Definitions
* [KeyboardJS](https://github.com/RobertWHurst/KeyboardJS) (by [Vincent Bortone](https://github.com/vbortone/))
* [Knockback](http://kmalakoff.github.com/knockback/) (by [Marcel Binot](https://github.com/docgit))
* [Knockout.js](http://knockoutjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [Knockout.DeferredUpdates](https://github.com/mbest/knockout-deferred-updates) (by [Sebastián Galiano](https://github.com/sgaliano))
* [Knockout.ES5](https://github.com/SteveSanderson/knockout-es5) (by [Sebastián Galiano](https://github.com/sgaliano))
* [Knockout.Mapper](https://github.com/LucasLorentz/knockout.mapper) (by [Brandon Meyer](https://github.com/BMeyerKC))
* [Knockout.Mapping](https://github.com/SteveSanderson/knockout.mapping) (by [Boris Yankov](https://github.com/borisyankov))
* [Knockout.Postbox](https://github.com/rniemeyer/knockout-postbox) (by [Judah Gabriel](https://github.com/JudahGabriel))
* [Knockout.Validation](https://github.com/ericmbarnard/Knockout-Validation) (by [Dan Ludwig](https://github.com/danludwig))
@@ -127,25 +155,39 @@ List of Definitions
* [Leaflet](https://github.com/Leaflet/Leaflet) (by [Vladimir](https://github.com/rgripper))
* [Libxmljs](https://github.com/polotek/libxmljs) (by [François de Campredon](https://github.com/fdecampredon))
* [ladda](https://github.com/hakimel/Ladda) (by [Danil Flores](https://github.com/dflor003))
* [Levelup](https://github.com/rvagg/node-levelup) (by [Bret Little](https://github.com/blittle))
* [linq.js](http://linqjs.codeplex.com/) (by [Marcin Najder](https://github.com/marcinnajder))
* [Livestamp.js](https://github.com/mattbradley/livestampjs) (by [Vincent Bortone](https://github.com/vbortone))
* [Logg](https://github.com/dpup/node-logg) (by [Bret Little](https://github.com/blittle))
* [Marked](https://github.com/chjj/marked) (by [William Orr](https://github.com/worr))
* [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) (by [Sarah Williams] (https://github.com/flurg))
* [Meteor](https://www.meteor.com) (by [Dave Allen](https://github.com/fullflavedave))
* [Modernizr](http://modernizr.com/) (by [Boris Yankov](https://github.com/borisyankov) and [Theodore Brown](https://github.com/theodorejb/))
* [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield))
* [MongoDB](http://mongodb.github.io/node-mongodb-native/) (from TypeScript samples, updated by [Niklas Mollenhauer](https://github.com/nikeee))
* [Mousetrap](http://craig.is/killing/mice) (by [Dániel Tar](https://github.com/qcz))
* [Mustache.js](https://github.com/janl/mustache.js) (by [Boris Yankov](https://github.com/borisyankov))
* [Node.js](http://nodejs.org/) (from TypeScript samples)
* [node_redis](https://github.com/mranney/node_redis) (by [Boris Yankov](https://github.com/borisyankov))
* [node-ffi](https://github.com/rbranson/node-ffi) (by [Paul Loyd](https://github.com/loyd))
* [node_zeromq](https://github.com/JustinTulloss/zeromq.node) (by [Dave McKeown](https://github.com/davemckeown))
* [node-sqlserver](https://github.com/WindowsAzure/node-sqlserver) (by [Boris Yankov](https://github.com/borisyankov))
* [Numeral.js](https://github.com/adamwdraper/Numeral-js) (by [Vincent Bortone](https://github.com/vbortone/))
* [OpenLayers] (https://github.com/openlayers/openlayers) (by [Ilya Bolkhovsky](https://github.com/bolhovsky/))
* [Parallel.js](https://github.com/adambom/parallel.js) (by [Josh Baldwin](https://github.com/jbaldwin))
* [PDF.js](https://github.com/mozilla/pdf.js) (by [Josh Baldwin](https://github.com/jbaldwin))
* [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto))
* [PhantomJS](http://phantomjs.org) (by [Jed Hunsaker](https://github.com/jedhunsaker))
* [PhoneGap](http://phonegap.com) (by [Boris Yankov](https://github.com/borisyankov))
* [PixiJS](https://github.com/GoodBoyDigital/pixi.js) (by [Pedro Casaubon](https://github.com/xperiments))
* [Platform](https://github.com/bestiejs/platform.js) (by [Jake Hickman](https://github.com/JakeH))
* [PouchDB](http://pouchdb.com) (by [Bill Sears](https://github.com/MrBigDog2U/))
* [PreloadJS](http://www.createjs.com/#!/PreloadJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
* [QUnit](http://qunitjs.com/) (by [Diullei Gomes](https://github.com/Diullei))
* [Raven.js](https://github.com/getsentry/raven-js) (by [Santi Albo](https://github.com/santialbo))
* [Rickshaw](http://code.shutterstock.com/rickshaw/) (by [Blake Niemyjski](https://github.com/niemyjski))
* [Restify](https://github.com/mcavage/node-restify) (by [Bret Little](https://github.com/blittle))
* [Royalslider](http://dimsemenov.com/plugins/royal-slider/) (by [Christiaan Rakowski](https://github.com/csrakowski))
* [Rx.js](http://rx.codeplex.com/) (by [gsino](http://www.codeplex.com/site/users/view/gsino))
* [Raphael](http://raphaeljs.com/) (by [CheCoxshall](https://github.com/CheCoxshall))
* [Restangular](https://github.com/mgonto/restangular/) (by [Boris Yankov](https://github.com/borisyankov))
@@ -153,14 +195,18 @@ List of Definitions
* [Sammy.js](http://sammyjs.org/) (by [Boris Yankov](https://github.com/borisyankov))
* [Select2](http://ivaynberg.github.com/select2/) (by [Boris Yankov](https://github.com/borisyankov))
* [Sencha Touch](http://www.sencha.com/products/touch/) (by [Brian Kotek](https://github.com/brian428))
* [SharePoint](http://sptypescript.codeplex.com) (by [Stanislav Vyshchepan](http://gandjustas.blogspot.ru) and [Andrey Markeev](http://markeev.com))
* [SignalR](http://www.asp.net/signalr) (by [Boris Yankov](https://github.com/borisyankov))
* [Sinon](http://sinonjs.org/) (by [William Sears](https://github.com/mrbigdog2u))
* [SlickGrid](https://github.com/mleibman/SlickGrid) (by [Josh Baldwin](https://github.com/jbaldwin))
* [socket.io](http://socket.io) (by [William Orr](https://github.com/worr))
* [SockJS](https://github.com/sockjs/sockjs-client) (by [Emil Ivanov](https://github.com/vladev))
* [SoundJS](http://www.createjs.com/#!/SoundJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
* [Spin](http://fgnass.github.com/spin.js/) (by [Boris Yankov](https://github.com/borisyankov))
* [stripe](https://stripe.com/) (by [Eric J. Smith](https://github.com/ejsmith/))
* [Store.js](https://github.com/marcuswestin/store.js/) (by [Vincent Bortone](https://github.com/vbortone))
* [Sugar](http://sugarjs.com/) (by [Josh Baldwin](https://github.com/jbaldwin/))
* [Swiper](http://www.idangero.us/sliders/swiper) (by [Sebastián Galiano](https://github.com/sgaliano))
* [SwipeView](http://cubiq.org/swipeview) (by [Boris Yankov](https://github.com/borisyankov))
* [Tags Manager](http://welldonethings.com/tags/manager) (by [Vincent Bortone](https://github.com/vbortone))
* [Teechart](http://www.steema.com) (by [Steema](http://www.steema.com))
@@ -174,17 +220,21 @@ List of Definitions
* [Underscore.js](http://underscorejs.org/) (by [Boris Yankov](https://github.com/borisyankov))
* [Underscore.js (Typed)](http://underscorejs.org/) (by [Josh Baldwin](https://github.com/jbaldwin/))
* [Underscore-ko.js](https://github.com/kamranayub/UnderscoreKO) (by [Maurits Elbers](https://github.com/MagicMau))
* [UUID.js](https://github.com/LiosK/UUID.js) (by [Jason Jarrett](https://github.com/staxmanade))
* [Viewporter](https://github.com/zynga/viewporter) (by [Boris Yankov](https://github.com/borisyankov))
* [Vimeo](http://developer.vimeo.com/player/js-api) (by [Daz Wilkin](https://github.com/DazWilkin/))
* [WebRTC](http://dev.w3.org/2011/webrtc/editor/webrtc.html) (by [Ken Smith](https://github.com/smithkl42))
* [WinJS](http://msdn.microsoft.com/en-us/library/windows/apps/br229773.aspx) (from TypeScript samples)
* [WinRT](http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx) (from TypeScript samples)
* [YouTube](https://developers.google.com/youtube/) (by [Daz Wilkin](https://github.com/DazWilkin/))
* [Zepto.js] (http://zeptojs.com/) (by [Josh Baldwin](https://github.com/jbaldwin))
* [YouTube Analytics API](https://developers.google.com/youtube/analytics/) (by [Frank M](https://github.com/sgtfrankieboy))
* [YouTube Data API](https://developers.google.com/youtube/v3/) (by [Frank M](https://github.com/sgtfrankieboy/))
* [Zepto.js](http://zeptojs.com/) (by [Josh Baldwin](https://github.com/jbaldwin))
* [Zynga Scroller](https://github.com/zynga/scroller) (by [Boris Yankov](https://github.com/borisyankov))
* [ZeroClipboard](https://github.com/jonrohan/ZeroClipboard) (by [Eric J. Smith](https://github.com/ejsmith))
Requested Definitions
---------------------
* [Rickshaw](https://github.com/shutterstock/rickshaw)
* [jQuery ScrollTo](https://github.com/balupton/jquery-scrollto)
* [Crossfilter](https://github.com/square/crossfilter)
* [dc.js](https://github.com/NickQiZhu/dc.js)
@@ -193,3 +243,6 @@ Requested Definitions
* [MooTools](http://mootools.net/)
* [Lo-Dash](http://lodash.com/)
* [java](https://github.com/nearinfinity/node-java)
* [SVG.js](http://www.svgjs.com/)
In addition you can find the [updated open requests that you can contribute here](https://github.com/borisyankov/DefinitelyTyped/issues?labels=request&page=1&state=open)

File diff suppressed because it is too large Load Diff

View File

@@ -28,7 +28,13 @@ module DefinitelyTyped {
class Tsc {
public static run(tsfile: string, callback: Function) {
Exec.exec('node ./_infrastructure/tests/typescript/tsc.js ', [tsfile], (ExecResult) => {
var command = 'node ./_infrastructure/tests/typescript/tsc.js --module commonjs ';
if (IO.fileExists(tsfile + '.tscparams')) {
command += '@' + tsfile + '.tscparams';
} else {
command += '--noImplicitAny';
}
Exec.exec(command, [tsfile], (ExecResult) => {
callback(ExecResult);
});
}
@@ -107,7 +113,7 @@ module DefinitelyTyped {
return;
return <string><any> (day_diff == 0 && (
diff < 60 && (diff + " secconds") ||
diff < 60 && (diff + " seconds") ||
diff < 120 && "1 minute" ||
diff < 3600 && Math.floor( diff / 60 ) + " minutes" ||
diff < 7200 && "1 hour" ||
@@ -141,15 +147,15 @@ module DefinitelyTyped {
public printHeader() {
this.out('=============================================================================\n');
this.out(' \33[36m\33[1mDefinitelyTyped test runner 0.2.0\33[0m\n');
this.out(' \33[36m\33[1mDefinitelyTyped test runner 0.3.0\33[0m\n');
this.out('=============================================================================\n');
this.out(' \33[36m\33[1mTypescript version:\33[0m ' + this.version + '\n');
this.out(' \33[36m\33[1mTypings :\33[0m ' + this.typings + '\n');
this.out(' \33[36m\33[1mTypeScript files :\33[0m ' + this.tsFiles + '\n');
}
public printSyntaxCheking() {
this.out('============================ \33[34m\33[1mSyntax cheking\33[0m =================================\n');
public printSyntaxChecking() {
this.out('============================ \33[34m\33[1mSyntax checking\33[0m ================================\n');
}
public printTypingTests() {
@@ -235,7 +241,7 @@ module DefinitelyTyped {
}
}
class SyntaxCheking {
class SyntaxChecking {
private timer: Timer;
@@ -265,7 +271,7 @@ module DefinitelyTyped {
return list;
}
constructor(public fielHandler: FileHandler, public out: Print) {
constructor(public fileHandler: FileHandler, public out: Print) {
this.timer = new Timer();
}
@@ -286,13 +292,13 @@ module DefinitelyTyped {
for(var i = 0; i < this.getFailedFiles().length; i++) {
var errorFile = this.getFailedFiles()[i];
this.out.printErrorFile(errorFile.formatName(this.fielHandler.path));
this.out.printErrorFile(errorFile.formatName(this.fileHandler.path));
}
}
}
private run(it, file, len, maxLen, callback: Function) {
if (!endsWith(file, '-tests.ts')) {
private run(it, file, len, maxLen, callback: Function) {
if (!endsWith(file.toUpperCase(), '-TESTS.TS') && endsWith(file.toUpperCase(), '.TS') && file.indexOf('../_infrastructure') < 0) {
new Test(file).run((o) => {
var failed = false;
@@ -338,7 +344,7 @@ module DefinitelyTyped {
public start(callback: Function) {
this.timer.start();
var tsFiles = this.fielHandler.allTS();
var tsFiles = this.fileHandler.allTS();
var it = new Iterator(tsFiles);
@@ -381,7 +387,7 @@ module DefinitelyTyped {
return list;
}
constructor(public fielHandler: FileHandler, public out: Print) {
constructor(public fileHandler: FileHandler, public out: Print) {
this.timer = new Timer();
}
@@ -402,13 +408,13 @@ module DefinitelyTyped {
for(var i = 0; i < this.getFailedFiles().length; i++) {
var errorFile = this.getFailedFiles()[i];
this.out.printErrorFile(errorFile.formatName(this.fielHandler.path));
this.out.printErrorFile(errorFile.formatName(this.fileHandler.path));
}
}
}
private run(it, file, len, maxLen, callback: Function) {
if (endsWith(file, '-tests.ts')) {
if (endsWith(file.toUpperCase(), '-TESTS.TS')) {
new Test(file).run((o) => {
var failed = false;
@@ -454,7 +460,7 @@ module DefinitelyTyped {
public start(callback: Function) {
this.timer.start();
var tsFiles = this.fielHandler.allTS();
var tsFiles = this.fileHandler.allTS();
var it = new Iterator(tsFiles);
@@ -470,7 +476,7 @@ module DefinitelyTyped {
export class TestRunner {
private fh: FileHandler;
private out: Print;
private sc: SyntaxCheking;
private sc: SyntaxChecking;
private te: TestEval;
private typings: Typing[] = [];
@@ -504,8 +510,8 @@ module DefinitelyTyped {
constructor(public dtPath: string) {
this.fh = new FileHandler(dtPath, /.\.ts/g);
this.out = new Print('0.9.0.0', this.fh.allTypings().length, this.fh.allTS().length);
this.sc = new SyntaxCheking(this.fh, this.out);
this.out = new Print('0.9.1.1', this.fh.allTypings().length, this.fh.allTS().length);
this.sc = new SyntaxChecking(this.fh, this.out);
this.te = new TestEval(this.fh, this.out);
var tpgs = this.fh.allTypings();
@@ -519,7 +525,7 @@ module DefinitelyTyped {
timer.start();
this.out.printHeader();
this.out.printSyntaxCheking();
this.out.printSyntaxChecking();
this.sc.start((syntaxFailedCount, syntaxTotal) => {
this.out.printTypingTests();

View File

@@ -1,4 +1,18 @@
var ExecResult = (function () {
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
var ExecResult = (function () {
function ExecResult() {
this.stdout = "";
this.stderr = "";

View File

@@ -1,5 +1,20 @@
var IOUtils;
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
var IOUtils;
(function (IOUtils) {
// Creates the directory including its parent if not already present
function createDirectoryStructure(ioHost, dirName) {
if (ioHost.directoryExists(dirName)) {
return;
@@ -12,6 +27,7 @@
ioHost.createDirectory(dirName);
}
// Creates a file including its directory structure if not already present
function createFileAndFolderStructure(ioHost, fileName, useUTF8) {
var path = ioHost.resolvePath(fileName);
var dirName = ioHost.dirName(path);
@@ -31,6 +47,8 @@
})(IOUtils || (IOUtils = {}));
var IO = (function () {
// Create an IO object for use inside WindowsScriptHost hosts
// Depends on WSCript and FileSystemObject
function getWindowsScriptHostIO() {
var fso = new ActiveXObject("Scripting.FileSystemObject");
var streamObjectPool = [];
@@ -68,6 +86,7 @@ var IO = (function () {
streamObj.Charset = 'utf-8';
}
// Read the whole file
var str = streamObj.ReadText(-1);
streamObj.Close();
releaseStreamObject(streamObj);
@@ -99,6 +118,7 @@ var IO = (function () {
var content = this.readFile(path);
return { content: content, path: path };
} catch (err) {
//Tools.CompilerDiagnostics.debugPrint("Could not find " + path + ", trying parent");
}
} else {
rootPath = fso.GetParentFolderName(fso.GetAbsolutePathName(rootPath));
@@ -222,6 +242,8 @@ var IO = (function () {
}
;
// Create an IO object for use inside Node.js hosts
// Depends on 'fs' and 'path' modules
function getNodeIO() {
var _fs = require('fs');
var _path = require('path');
@@ -234,6 +256,8 @@ var IO = (function () {
switch (buffer[0]) {
case 0xFE:
if (buffer[1] == 0xFF) {
// utf16-be. Reading the buffer as big endian is not supported, so convert it to
// Little Endian first
var i = 0;
while ((i + 1) < buffer.length) {
var temp = buffer[i];
@@ -246,15 +270,18 @@ var IO = (function () {
break;
case 0xFF:
if (buffer[1] == 0xFE) {
// utf16-le
return buffer.toString("ucs2", 2);
}
break;
case 0xEF:
if (buffer[1] == 0xBB) {
// utf-8
return buffer.toString("utf8", 3);
}
}
// Default behaviour
return buffer.toString();
} catch (e) {
IOUtils.throwIOError("Error reading file \"" + file + "\".", e);
@@ -354,6 +381,7 @@ var IO = (function () {
var content = this.readFile(path);
return { content: content, path: path };
} catch (err) {
//Tools.CompilerDiagnostics.debugPrint(("Could not find " + path) + ", trying parent");
}
} else {
var parentPath = _path.resolve(rootPath, "..");
@@ -439,7 +467,9 @@ var IO = (function () {
;
if (typeof ActiveXObject === "function")
return getWindowsScriptHostIO(); else if (typeof require === "function")
return getNodeIO(); else
return getWindowsScriptHostIO();
else if (typeof require === "function")
return getNodeIO();
else
return null;
})();

View File

@@ -25,11 +25,11 @@ interface IFileWatcher {
interface IIO {
readFile(path: string): string;
writeFile(path: string, contents: string): void;
createFile(path: string, useUTF8?: bool): ITextWriter;
createFile(path: string, useUTF8?: boolean): ITextWriter;
deleteFile(path: string): void;
dir(path: string, re?: RegExp, options?: { recursive?: bool; deep?: number; }): string[];
fileExists(path: string): bool;
directoryExists(path: string): bool;
dir(path: string, re?: RegExp, options?: { recursive?: boolean; deep?: number; }): string[];
fileExists(path: string): boolean;
directoryExists(path: string): boolean;
createDirectory(path: string): void;
resolvePath(path: string): string;
dirName(path: string): string;
@@ -60,7 +60,7 @@ module IOUtils {
}
// Creates a file including its directory structure if not already present
export function createFileAndFolderStructure(ioHost: IIO, fileName: string, useUTF8?: bool) {
export function createFileAndFolderStructure(ioHost: IIO, fileName: string, useUTF8?: boolean) {
var path = ioHost.resolvePath(fileName);
var dirName = ioHost.dirName(path);
createDirectoryStructure(ioHost, dirName);
@@ -78,7 +78,7 @@ module IOUtils {
// Declare dependencies needed for all supported hosts
declare class Enumerator {
public atEnd(): bool;
public atEnd(): boolean;
public moveNext();
public item(): any;
constructor (o: any);
@@ -160,7 +160,7 @@ var IO = (function() {
file.Close();
},
fileExists: function(path: string): bool {
fileExists: function(path: string): boolean {
return fso.FileExists(path);
},
@@ -236,7 +236,7 @@ var IO = (function() {
},
directoryExists: function(path) {
return <bool>fso.FolderExists(path);
return <boolean>fso.FolderExists(path);
},
createDirectory: function(path) {
@@ -250,7 +250,7 @@ var IO = (function() {
},
dir: function(path, spec?, options?) {
options = options || <{ recursive?: bool; deep?: number; }>{};
options = options || <{ recursive?: boolean; deep?: number; }>{};
function filesInFolder(folder, root): string[]{
var paths = [];
var fc: Enumerator;
@@ -365,7 +365,7 @@ var IO = (function() {
IOUtils.throwIOError("Couldn't delete file '" + path + "'.", e);
}
},
fileExists: function(path): bool {
fileExists: function(path): boolean {
return _fs.existsSync(path);
},
createFile: function(path, useUTF8?) {
@@ -395,7 +395,7 @@ var IO = (function() {
};
},
dir: function dir(path, spec?, options?) {
options = options || <{ recursive?: bool; deep?: number; }>{};
options = options || <{ recursive?: boolean; deep?: number; }>{};
function filesInFolder(folder: string, deep?: number): string[]{
var paths = [];
@@ -427,7 +427,7 @@ var IO = (function() {
}
},
directoryExists: function(path: string): bool {
directoryExists: function(path: string): boolean {
return _fs.existsSync(path) && _fs.lstatSync(path).isDirectory();
},
resolvePath: function(path: string): string {

File diff suppressed because it is too large Load Diff

0
_infrastructure/tests/typescript/tsc Normal file → Executable file
View File

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

18
ace/ace.d.ts vendored
View File

@@ -50,7 +50,7 @@ declare module AceAjax {
export interface TokenInfo {
value: string;
}
}
export interface Position {
@@ -1023,7 +1023,7 @@ declare module AceAjax {
new (text: string[], mode?: string): IEditSession;
}
////////////////////////////////
/// Editor
////////////////////////////////
@@ -1040,7 +1040,7 @@ declare module AceAjax {
selectMoreLines(n: number);
onTextInput(text: string);
onCommandKey(e, hashId, keyCode);
commands: CommandManager;
@@ -1702,7 +1702,7 @@ declare module AceAjax {
}
var Editor: {
var Editor: {
/**
* Creates a new `Editor` object.
* @param renderer Associated `VirtualRenderer` that draws everything
@@ -1773,7 +1773,7 @@ declare module AceAjax {
new (session: Document, length: number, pos: number, others: string, mainClass: string, othersClass: string): PlaceHolder;
new (session: IEditSession, length: number, pos: Position, positions: Position[]): PlaceHolder;
}
}
////////////////
/// RangeList
@@ -1998,7 +1998,7 @@ declare module AceAjax {
var Range: {
fromPoints(pos1: Position, pos2: Position): Range;
new(startRow: number, startColumn: number, endRow: number, endColumn: number): Range;
}
}
////////////////
/// RenderLoop
@@ -2157,7 +2157,7 @@ declare module AceAjax {
/**
* Gets the current position of the cursor.
**/
getCursor(): number;
getCursor(): Position;
/**
* Sets the row and column position of the anchor. This function also emits the `'changeSelection'` event.
@@ -2377,7 +2377,7 @@ declare module AceAjax {
* @param session The session to use
**/
new(session: IEditSession): Selection;
}
}
////////////////
/// Split
@@ -2529,7 +2529,7 @@ declare module AceAjax {
* @param flag Any additional regular expression flags to pass (like "i" for case insensitive)
**/
new(rules: any, flag: string): Tokenizer;
}
}
//////////////////
/// UndoManager

1
ace/ace.d.ts.tscparams Normal file
View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

327
amcharts/AmCharts.d.ts vendored

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1,249 @@
/// <reference path="amplifyjs.d.ts" />
/// <reference path="../jquery/jquery.d.ts" />
// Copied examples directly from AmplifyJs site
// Subscribe and publish with no data
amplify.subscribe("nodataexample", function () {
alert("nodataexample topic published!");
});
// Subscribe and publish with data
amplify.publish("nodataexample");
amplify.subscribe("dataexample", function (data) {
alert(data.foo); // bar
});
amplify.publish("dataexample", { foo: "bar" });
amplify.subscribe("dataexample2", function (param1, param2) {
alert(param1 + param2); // barbaz
});
//...
amplify.publish("dataexample2", "bar", "baz");
// Subscribe and publish with context and data
amplify.subscribe("datacontextexample", $("p:first"), function (data) {
this.text(data.exampleText); // first p element would have "foo bar baz" as text
});
amplify.publish("datacontextexample", { exampleText: "foo bar baz" });
// Subscribe to a topic with high priority
amplify.subscribe("priorityexample", function (data) {
alert(data.foo);
});
amplify.subscribe("priorityexample", function (data) {
if (data.foo === "oops") {
return false;
}
}, 1);
// Store data with amplify storage picking the default storage technology:
amplify.publish("priorityexample", { foo: "bar" });
amplify.publish("priorityexample", { foo: "oops" });
amplify.store("storeExample1", { foo: "bar" });
amplify.store("storeExample2", "baz");
// retrieve the data later via the key
var myStoredValue = amplify.store("storeExample1"),
myStoredValue2 = amplify.store("storeExample2"),
myStoredValues = amplify.store();
myStoredValue.foo; // bar
myStoredValue2; // baz
myStoredValues.storeExample1.foo; // bar
myStoredValues.storeExample2; // baz
// Store data explicitly with session storage
amplify.store.sessionStorage("explicitExample", { foo2: "baz" });
// retrieve the data later via the key
var myStoredValue2 = amplify.store.sessionStorage("explicitExample");
myStoredValue2.foo2; // baz
// REQUEST
// Set up and use a request utilizing Ajax
amplify.request.define("ajaxExample1", "ajax", {
url: "/myApiUrl",
dataType: "json",
type: "GET"
});
// later in code
amplify.request("ajaxExample1", function (data) {
data.foo; // bar
});
// Set up and use a request utilizing Ajax and Caching
amplify.request.define("ajaxExample2", "ajax", {
url: "/myApiUrl",
dataType: "json",
type: "GET",
cache: "persist"
});
// later in code
amplify.request("ajaxExample2", function (data) {
data.foo; // bar
});
// a second call will result in pulling from the cache
amplify.request("ajaxExample2", function (data) {
data.baz; // qux
})
// Set up and use a RESTful request utilizing Ajax
amplify.request.define("ajaxRESTFulExample", "ajax", {
url: "/myRestFulApi/{type}/{id}",
type: "GET"
})
// later in code
amplify.request("ajaxRESTFulExample",
{
type: "foo",
id: "bar"
},
function (data) {
// /myRESTFulApi/foo/bar was the URL used
data.foo; // bar
}
);
// POST data with Ajax
amplify.request.define("ajaxPostExample", "ajax", {
url: "/myRestFulApi",
type: "POST"
})
// later in code
amplify.request("ajaxPostExample",
{
type: "foo",
id: "bar"
},
function (data) {
data.foo; // bar
}
);
// Using data maps
// When searching Twitter, the key for the search phrase is q.If we want a more descriptive name, such as term, we can use a data map:
amplify.request.define("twitter-search", "ajax", {
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
dataMap: {
term: "q"
}
});
amplify.request("twitter-search", { term: "amplifyjs" } );
// Similarly, we can create a request that searches for mentions, by accepting a username:
amplify.request.define("twitter-mentions", "ajax", {
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
dataMap: function (data) {
return {
q: "@" + data.user
};
}
});
amplify.request("twitter-mentions", { user: "amplifyjs" });
// Setting up and using decoders
//Example:
amplify.request.decoders.appEnvelope =
function (data, status, xhr, success, error) {
if (data.status === "success") {
success(data.data);
} else if (data.status === "fail" || data.status === "error") {
error(data.message, data.status);
} else {
error(data.message, "fatal");
}
};
amplify.request.define("decoderExample", "ajax", {
url: "/myAjaxUrl",
type: "POST",
decoder: "appEnvelope"
});
amplify.request({
resourceId: "decoderExample",
success: function (data) {
data.foo; // bar
},
error: function (message, level) {
alert("always handle errors with alerts.");
}
});
// POST with caching and single - use decoder
// Example:
amplify.request.define("decoderSingleExample", "ajax", {
url: "/myAjaxUrl",
type: "POST",
decoder: function (data, status, xhr, success, error) {
if (data.status === "success") {
success(data.data);
} else if (data.status === "fail" || data.status === "error") {
error(data.message, data.status);
} else {
error(data.message, "fatal");
}
}
});
amplify.request({
resourceId: "decoderSingleExample",
success: function (data) {
data.foo; // bar
},
error: function (message, level) {
alert("always handle errors with alerts.");
}
});
// Handling Status
// Status in Success and Error Callbacks
// amplify.request comes with built in support for status.The status parameter appears in the default success or error callbacks when using an ajax definition.
amplify.request.define("statusExample1", "ajax", {
//...
});
amplify.request({
resourceId: "statusExample1",
success: function (data, status) {
},
error: function (data, status) {
}
});

View File

@@ -0,0 +1 @@
""

159
amplifyjs/amplifyjs.d.ts vendored Normal file
View File

@@ -0,0 +1,159 @@
// Type definitions for AmplifyJs 1.1.0
// Project: http://amplifyjs.com/
// Definitions by: Jonas Eriksson <https://github.com/joeriks/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface amplifyRequestSettings {
resourceId: string;
data?: any;
success?: Function;
error?: Function;
}
interface amplifyRequest {
/***
* Request a resource.
* resourceId: Identifier string for the resource.
* data: A set of key/value pairs of data to be sent to the resource.
* callback: A function to invoke if the resource is retrieved successfully.
*/
(resourceId: string, hash?: any, callback?: Function): void;
/***
* Request a resource.
* settings: A set of key/value pairs of settings for the request.
* resourceId: Identifier string for the resource.
* data (optional): Data associated with the request.
* success (optional): Function to invoke on success.
* error (optional): Function to invoke on error.
*/
(settings: amplifyRequestSettings);
/***
* Define a resource.
* resourceId: Identifier string for the resource.
* requestType: The type of data retrieval method from the server. See the request types sections for more information.
* settings: A set of key/value pairs that relate to the server communication technology. The following settings are available:
* Any settings found in jQuery.ajax().
* cache: See the cache section for more details.
* decoder: See the decoder section for more details.
*/
define(resourceId: string, requestType: string, settings?: any): void;
/***
* Define a custom request.
* resourceId: Identifier string for the resource.
* resource: Function to handle requests. Receives a hash with the following properties:
* resourceId: Identifier string for the resource.
* data: Data provided by the user.
* success: Callback to invoke on success.
* error: Callback to invoke on error.
*/
define(resourceId: string, resource: Function): void;
decoders: any;
cache: any;
}
interface amplifySubscribe {
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* callback: Function to invoke when the message is published.
*/
(topic: string, callback: Function): void;
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* context: What this will be when the callback is invoked.
* callback: Function to invoke when the message is published.
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
*/
(topic: string, context: any, callback: Function, priority?: number): void;
/***
* Subscribe to a message.
* topic: Name of the message to subscribe to.
* callback: Function to invoke when the message is published.
* [priority]: Priority relative to other subscriptions for the same message. Lower values have higher priority. Default is 10.
*/
(topic: string, callback: Function, priority?: number): void;
}
interface amplifyStorageTypeStore {
/***
* Stores a value for a given key using the default storage type.
*
* key: Identifier for the value being stored.
* value: The value to store. The value can be anything that can be serialized as JSON.
* [options]: A set of key/value pairs that relate to settings for storing the value.
*/
(key: string, value: any, options?: any): void;
/***
* Gets a stored value based on the key.
*/
(key: string): any;
/***
* Gets a hash of all stored values.
*/
(): any;
}
interface amplifyStore extends amplifyStorageTypeStore{
/***
* IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
localStorage: amplifyStorageTypeStore;
/***
* IE 8+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
*/
sessionStorage: amplifyStorageTypeStore;
/***
* Firefox 2+
*/
globalStorage: amplifyStorageTypeStore;
/***
* IE 5 - 7
*/
userData: amplifyStorageTypeStore;
/***
* An in-memory store is provided as a fallback if none of the other storage types are available.
*/
memory: amplifyStorageTypeStore;
}
interface amplifyStatic {
subscribe: amplifySubscribe;
/***
* Remove a subscription.
* topic: The topic being unsubscribed from.
* callback: The callback that was originally subscribed.
*/
unsubscribe(topic: string, callback: Function): void;
/***
* Publish a message.
* topic: The name of the message to publish.
* Any additional parameters will be passed to the subscriptions.
* amplify.publish returns a boolean indicating whether any subscriptions returned false. The return value is true if none of the subscriptions returned false, and false otherwise. Note that only one subscription can return false because doing so will prevent additional subscriptions from being invoked.
*/
publish(topic: string, ...args: any[]): boolean;
store: amplifyStore;
request: amplifyRequest;
}
declare var amplify: amplifyStatic;

View File

@@ -0,0 +1 @@
""

View File

@@ -35,6 +35,7 @@ To avoid cluttering the list of suggestions as you type in your IDE, all interfa
* `ng.cookies` for **ngCookies**
* `ng.mock` for **ngMock**
* `ng.resource` for **ngResource**
* `ng.route` for **ngRoute**
* `ng.sanitize` for **ngSanitize**
**ngMockE2E** does not define a new namespace, but rather modifies some of **ng**'s interfaces.
@@ -96,7 +97,7 @@ Since you are augmenting the $scope object, you should let the compiler know wha
$scope.title = 'Yabadabadu';
}
## Exemples
## Examples
### Working with $resource
@@ -151,4 +152,4 @@ Since you are augmenting the $scope object, you should let the compiler know wha
article.$save();
article.$publish();
}
}

View File

@@ -0,0 +1,219 @@
/// <reference path="angular-1.0.d.ts" />
// issue: https://github.com/borisyankov/DefinitelyTyped/issues/369
https://github.com/witoldsz/angular-http-auth/blob/master/src/angular-http-auth.js
/**
* @license HTTP Auth Interceptor Module for AngularJS
* (c) 2012 Witold Szczerba
* License: MIT
*/
angular.module('http-auth-interceptor', [])
.provider('authService', function () {
/**
* Holds all the requests which failed due to 401 response,
* so they can be re-requested in future, once login is completed.
*/
var buffer = [];
/**
* Required by HTTP interceptor.
* Function is attached to provider to be invisible for regular users of this service.
*/
this.pushToBuffer = function (config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
buffer.push({
config: config,
deferred: deferred
});
}
this.$get = ['$rootScope', '$injector', <any>function ($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) {
var $http: ng.IHttpService; //initialized later because of circular dependency problem
function retry(config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
$http = $http || $injector.get('$http');
$http(config).then(function (response) {
deferred.resolve(response);
});
}
function retryAll() {
for (var i = 0; i < buffer.length; ++i) {
retry(buffer[i].config, buffer[i].deferred);
}
buffer = [];
}
return {
loginConfirmed: function () {
$rootScope.$broadcast('event:auth-loginConfirmed');
retryAll();
}
}
}]
})
/**
* $http interceptor.
* On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'.
*/
.config(['$httpProvider', 'authServiceProvider', <any>function ($httpProvider: ng.IHttpProvider, authServiceProvider) {
var interceptor = ['$rootScope', '$q', <any>function ($rootScope: ng.IScope, $q: ng.IQService) {
function success(response: ng.IHttpPromiseCallbackArg<any>) {
return response;
}
function error(response: ng.IHttpPromiseCallbackArg<any>) {
if (response.status === 401) {
var deferred = $q.defer();
authServiceProvider.pushToBuffer(response.config, deferred);
$rootScope.$broadcast('event:auth-loginRequired');
return deferred.promise;
}
// otherwise
return $q.reject(response);
}
return function (promise: ng.IHttpPromise<any>) {
return promise.then(success, error);
}
}];
$httpProvider.responseInterceptors.push(interceptor);
}]);
module HttpAndRegularPromiseTests {
interface Person {
firstName: string;
lastName: string;
}
interface ExpectedResponse extends Person { }
interface SomeControllerScope extends ng.IScope {
person: Person;
theAnswer: number;
letters: string[];
}
var someController: Function = ($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) => {
$http.get("http://somewhere/some/resource")
.success((data: ExpectedResponse) => {
$scope.person = data;
});
$http.get("http://somewhere/some/resource")
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
// typing lost, so something like
// var i: number = response.data
// would type check
$scope.person = response.data;
});
$http.get("http://somewhere/some/resource")
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
// typing lost, so something like
// var i: number = response.data
// would NOT type check
$scope.person = response.data;
});
var aPromise: ng.IPromise<Person> = $q.when({ firstName: "Jack", lastName: "Sparrow" });
aPromise.then((person: Person) => {
$scope.person = person;
});
var bPromise: ng.IPromise<number> = $q.when(42);
bPromise.then((answer: number) => {
$scope.theAnswer = answer;
});
var cPromise: ng.IPromise<string[]> = $q.when(["a", "b", "c"]);
cPromise.then((letters: string[]) => {
$scope.letters = letters;
});
}
// Test that we can pass around a type-checked success/error Promise Callback
var anotherController: Function = ($scope: SomeControllerScope, $http:
ng.IHttpService, $q: ng.IQService) => {
var buildFooData: Function = () => 42;
var doFoo: Function = (callback: ng.IHttpPromiseCallback<ExpectedResponse>) => {
$http.get('/foo', buildFooData())
.success(callback);
}
doFoo((data) => console.log(data));
}
}
// Test for AngularJS Syntax
module My.Namespace {
export var x; // need to export something for module to kick in
}
// IModule Registering Test
var mod = angular.module('tests', []);
mod.controller('name', function ($scope: ng.IScope) { })
mod.controller('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.controller(My.Namespace);
mod.directive('name', <any>function ($scope: ng.IScope) { })
mod.directive('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.directive(My.Namespace);
mod.factory('name', function ($scope: ng.IScope) { })
mod.factory('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.factory(My.Namespace);
mod.filter('name', function ($scope: ng.IScope) { })
mod.filter('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.filter(My.Namespace);
mod.provider('name', function ($scope: ng.IScope) { })
mod.provider('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.provider(My.Namespace);
mod.service('name', function ($scope: ng.IScope) { })
mod.service('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.service(My.Namespace);
mod.constant('name', 23);
mod.constant('name', "23");
mod.constant(My.Namespace);
mod.value('name', 23);
mod.value('name', "23");
mod.value(My.Namespace);
// Promise signature tests
var foo: ng.IPromise<number>;
foo.then((x) => {
// x is inferred to be a number
return "asdf";
}).then((x) => {
// x is inferred to be string
x.length;
return 123;
}).then((x) => {
// x is infered to be a number
x.toFixed();
return;
}).then((x) => {
// x is infered to be void
// Typescript will prevent you to actually use x as a local variable
// Try object:
return { a: 123 };
}).then((x) => {
// Object is inferred here
x.a = 123;
//Try a promise
var y: ng.IPromise<number>;
return y;
}).then((x) => {
// x is infered to be a number, which is the resolved value of a promise
x.toFixed();
});
// angular.element() tests
var element = angular.element("div.myApp");
var scope: ng.IScope = element.scope();

View File

@@ -0,0 +1 @@
""

760
angularjs/angular-1.0.d.ts vendored Executable file
View File

@@ -0,0 +1,760 @@
// Type definitions for Angular JS 1.0
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
declare var angular: ng.IAngularStatic;
// Support for painless dependency injection
interface Function {
$inject:string[];
}
///////////////////////////////////////////////////////////////////////////////
// ng module (angular.js)
///////////////////////////////////////////////////////////////////////////////
declare module ng {
// All service providers extend this interface
interface IServiceProvider {
$get(): any;
}
///////////////////////////////////////////////////////////////////////////
// AngularStatic
// see http://docs.angularjs.org/api
///////////////////////////////////////////////////////////////////////////
interface IAngularStatic {
bind(context: any, fn: Function, ...args: any[]): Function;
bootstrap(element: string, modules?: any[]): auto.IInjectorService;
bootstrap(element: JQuery, modules?: any[]): auto.IInjectorService;
bootstrap(element: Element, modules?: any[]): auto.IInjectorService;
bootstrap(element: Document, modules?: any[]): auto.IInjectorService;
copy(source: any, destination?: any): any;
element: IAugmentedJQueryStatic;
equals(value1: any, value2: any): boolean;
extend(destination: any, ...sources: any[]): any;
forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any;
fromJson(json: string): any;
identity(arg?: any): any;
injector(modules?: any[]): auto.IInjectorService;
isArray(value: any): boolean;
isDate(value: any): boolean;
isDefined(value: any): boolean;
isElement(value: any): boolean;
isFunction(value: any): boolean;
isNumber(value: any): boolean;
isObject(value: any): boolean;
isString(value: any): boolean;
isUndefined(value: any): boolean;
lowercase(str: string): string;
/** construct your angular application
official docs: Interface for configuring angular modules.
see: http://docs.angularjs.org/api/angular.Module
*/
module(
/** name of your module you want to create */
name: string,
/** name of modules yours depends on */
requires?: string[],
configFunction?: any): IModule;
noop(...args: any[]): void;
toJson(obj: any, pretty?: boolean): string;
uppercase(str: string): string;
version: {
full: string;
major: number;
minor: number;
dot: number;
codename: string;
};
}
///////////////////////////////////////////////////////////////////////////
// Module
// see http://docs.angularjs.org/api/angular.Module
///////////////////////////////////////////////////////////////////////////
interface IModule {
animation(name: string, animationFactory: Function): IModule;
animation(name: string, inlineAnnotadedFunction: any[]): IModule;
animation(object: Object): IModule;
/** configure existing services.
Use this method to register work which needs to be performed on module loading
*/
config(configFn: Function): IModule;
/** configure existing services.
Use this method to register work which needs to be performed on module loading
*/
config(inlineAnnotadedFunction: any[]): IModule;
constant(name: string, value: any): IModule;
constant(object: Object): IModule;
controller(name: string, controllerConstructor: Function): IModule;
controller(name: string, inlineAnnotadedConstructor: any[]): IModule;
controller(object : Object): IModule;
directive(name: string, directiveFactory: (...params:any[])=> IDirective): IModule;
directive(name: string, inlineAnnotadedFunction: any[]): IModule;
directive(object: Object): IModule;
factory(name: string, serviceFactoryFunction: Function): IModule;
factory(name: string, inlineAnnotadedFunction: any[]): IModule;
factory(object: Object): IModule;
filter(name: string, filterFactoryFunction: Function): IModule;
filter(name: string, inlineAnnotadedFunction: any[]): IModule;
filter(object: Object): IModule;
provider(name: string, serviceProviderConstructor: Function): IModule;
provider(name: string, inlineAnnotadedConstructor: any[]): IModule;
provider(object: Object): IModule;
run(initializationFunction: Function): IModule;
run(inlineAnnotadedFunction: any[]): IModule;
service(name: string, serviceConstructor: Function): IModule;
service(name: string, inlineAnnotadedConstructor: any[]): IModule;
service(object: Object): IModule;
value(name: string, value: any): IModule;
value(object: Object): IModule;
// Properties
name: string;
requires: string[];
}
///////////////////////////////////////////////////////////////////////////
// Attributes
// see http://docs.angularjs.org/api/ng.$compile.directive.Attributes
///////////////////////////////////////////////////////////////////////////
interface IAttributes {
$set(name: string, value: any): void;
$observe(name: string, fn:(value?:any)=>any):void;
$attr: any;
}
///////////////////////////////////////////////////////////////////////////
// FormController
// see http://docs.angularjs.org/api/ng.directive:form.FormController
///////////////////////////////////////////////////////////////////////////
interface IFormController {
$pristine: boolean;
$dirty: boolean;
$valid: boolean;
$invalid: boolean;
$error: any;
$setDirty(): void;
$setPristine(): void;
}
///////////////////////////////////////////////////////////////////////////
// NgModelController
// see http://docs.angularjs.org/api/ng.directive:ngModel.NgModelController
///////////////////////////////////////////////////////////////////////////
interface INgModelController {
$render(): void;
$setValidity(validationErrorKey: string, isValid: boolean): void;
$setViewValue(value: string): void;
// XXX Not sure about the types here. Documentation states it's a string, but
// I've seen it receiving other types throughout the code.
// Falling back to any for now.
$viewValue: any;
// XXX Same as avove
$modelValue: any;
$parsers: IModelParser[];
$formatters: IModelFormatter[];
$error: any;
$pristine: boolean;
$dirty: boolean;
$valid: boolean;
$invalid: boolean;
}
interface IModelParser {
(value: any): any;
}
interface IModelFormatter {
(value: any): any;
}
///////////////////////////////////////////////////////////////////////////
// Scope
// see http://docs.angularjs.org/api/ng.$rootScope.Scope
///////////////////////////////////////////////////////////////////////////
interface IScope {
$apply(): any;
$apply(exp: string): any;
$apply(exp: (scope: IScope) => any): any;
$broadcast(name: string, ...args: any[]): IAngularEvent;
$destroy(): void;
$digest(): void;
$emit(name: string, ...args: any[]): IAngularEvent;
// Documentation says exp is optional, but actual implementaton counts on it
$eval(expression: string): any;
$eval(expression: (scope: IScope) => any): any;
// Documentation says exp is optional, but actual implementaton counts on it
$evalAsync(expression: string): void;
$evalAsync(expression: (scope: IScope) => any): void;
// Defaults to false by the implementation checking strategy
$new(isolate?: boolean): IScope;
$on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function;
$watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function;
$watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function;
$watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): Function;
$watch(watchExpression: (scope: IScope) => any, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function;
$watchCollection(watchExpression: string, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
$watchCollection(watchExpression: (scope: IScope) => any, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
$parent: IScope;
$id: number;
// Hidden members
$$isolateBindings: any;
$$phase: any;
}
interface IAngularEvent {
targetScope: IScope;
currentScope: IScope;
name: string;
preventDefault: Function;
defaultPrevented: boolean;
// Available only events that were $emit-ted
stopPropagation?: Function;
}
///////////////////////////////////////////////////////////////////////////
// WindowService
// see http://docs.angularjs.org/api/ng.$window
///////////////////////////////////////////////////////////////////////////
interface IWindowService extends Window {}
///////////////////////////////////////////////////////////////////////////
// BrowserService
// TODO undocumented, so we need to get it from the source code
///////////////////////////////////////////////////////////////////////////
interface IBrowserService {}
///////////////////////////////////////////////////////////////////////////
// TimeoutService
// see http://docs.angularjs.org/api/ng.$timeout
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
(func: Function, delay?: number, invokeApply?: boolean): IPromise<any>;
cancel(promise: IPromise<any>): boolean;
}
///////////////////////////////////////////////////////////////////////////
// FilterService
// see http://docs.angularjs.org/api/ng.$filter
// see http://docs.angularjs.org/api/ng.$filterProvider
///////////////////////////////////////////////////////////////////////////
interface IFilterService {
(name: string): Function;
}
interface IFilterProvider extends IServiceProvider {
register(name: string, filterFactory: Function): IServiceProvider;
}
///////////////////////////////////////////////////////////////////////////
// LocaleService
// see http://docs.angularjs.org/api/ng.$locale
///////////////////////////////////////////////////////////////////////////
interface ILocaleService {
id: string;
// These are not documented
// Check angular's i18n files for exemples
NUMBER_FORMATS: ILocaleNumberFormatDescriptor;
DATETIME_FORMATS: ILocaleDateTimeFormatDescriptor;
pluralCat: (num: any) => string;
}
interface ILocaleNumberFormatDescriptor {
DECIMAL_SEP: string;
GROUP_SEP: string;
PATTERNS: ILocaleNumberPatternDescriptor[];
CURRENCY_SYM: string;
}
interface ILocaleNumberPatternDescriptor {
minInt: number;
minFrac: number;
maxFrac: number;
posPre: string;
posSuf: string;
negPre: string;
negSuf: string;
gSize: number;
lgSize: number;
}
interface ILocaleDateTimeFormatDescriptor {
MONTH: string[];
SHORTMONTH: string[];
DAY: string[];
SHORTDAY: string[];
AMPMS: string[];
medium: string;
short: string;
fullDate: string;
longDate: string;
mediumDate: string;
shortDate: string;
mediumTime: string;
shortTime: string;
}
///////////////////////////////////////////////////////////////////////////
// LogService
// see http://docs.angularjs.org/api/ng.$log
///////////////////////////////////////////////////////////////////////////
interface ILogService {
debug: ILogCall;
error: ILogCall;
info: ILogCall;
log: ILogCall;
warn: ILogCall;
}
// We define this as separete interface so we can reopen it later for
// the ngMock module.
interface ILogCall {
(...args: any[]): void;
}
///////////////////////////////////////////////////////////////////////////
// ParseService
// see http://docs.angularjs.org/api/ng.$parse
///////////////////////////////////////////////////////////////////////////
interface IParseService {
(expression: string): ICompiledExpression;
}
interface ICompiledExpression {
(context: any, locals?: any): any;
// If value is not provided, undefined is gonna be used since the implementation
// does not check the parameter. Let's force a value for consistency. If consumer
// whants to undefine it, pass the undefined value explicitly.
assign(context: any, value: any): any;
}
///////////////////////////////////////////////////////////////////////////
// LocationService
// see http://docs.angularjs.org/api/ng.$location
// see http://docs.angularjs.org/api/ng.$locationProvider
// see http://docs.angularjs.org/guide/dev_guide.services.$location
///////////////////////////////////////////////////////////////////////////
interface ILocationService {
absUrl(): string;
hash(): string;
hash(newHash: string): ILocationService;
host(): string;
path(): string;
path(newPath: string): ILocationService;
port(): number;
protocol(): string;
replace(): ILocationService;
search(): any;
search(parametersMap: any): ILocationService;
search(parameter: string, parameterValue: any): ILocationService;
url(): string;
url(url: string): ILocationService;
}
interface ILocationProvider extends IServiceProvider {
hashPrefix(): string;
hashPrefix(prefix: string): ILocationProvider;
html5Mode(): boolean;
// Documentation states that parameter is string, but
// implementation tests it as boolean, which makes more sense
// since this is a toggler
html5Mode(active: boolean): ILocationProvider;
}
///////////////////////////////////////////////////////////////////////////
// DocumentService
// see http://docs.angularjs.org/api/ng.$document
///////////////////////////////////////////////////////////////////////////
interface IDocumentService extends Document {}
///////////////////////////////////////////////////////////////////////////
// ExceptionHandlerService
// see http://docs.angularjs.org/api/ng.$exceptionHandler
///////////////////////////////////////////////////////////////////////////
interface IExceptionHandlerService {
(exception: Error, cause?: string): void;
}
///////////////////////////////////////////////////////////////////////////
// RootElementService
// see http://docs.angularjs.org/api/ng.$rootElement
///////////////////////////////////////////////////////////////////////////
interface IRootElementService extends JQuery {}
///////////////////////////////////////////////////////////////////////////
// QService
// see http://docs.angularjs.org/api/ng.$q
///////////////////////////////////////////////////////////////////////////
interface IQService {
all(promises: IPromise<any>[]): IPromise<any[]>;
defer<T>(): IDeferred<T>;
reject(reason?: any): IPromise<void>;
when<T>(value: T): IPromise<T>;
}
interface IPromise<T> {
then<TResult>(successCallback: (promiseValue: T) => IHttpPromise<TResult>, errorCallback?: (reason: any) => any): IPromise<TResult>;
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>, errorCallback?: (reason: any) => any): IPromise<TResult>;
then<TResult>(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult): IPromise<TResult>;
}
interface IDeferred<T> {
resolve(value?: T): void;
reject(reason?: any): void;
promise: IPromise<T>;
}
///////////////////////////////////////////////////////////////////////////
// AnchorScrollService
// see http://docs.angularjs.org/api/ng.$anchorScroll
///////////////////////////////////////////////////////////////////////////
interface IAnchorScrollService {
(): void;
}
interface IAnchorScrollProvider extends IServiceProvider {
disableAutoScrolling(): void;
}
///////////////////////////////////////////////////////////////////////////
// CacheFactoryService
// see http://docs.angularjs.org/api/ng.$cacheFactory
///////////////////////////////////////////////////////////////////////////
interface ICacheFactoryService {
// Lets not foce the optionsMap to have the capacity member. Even though
// it's the ONLY option considered by the implementation today, a consumer
// might find it useful to associate some other options to the cache object.
//(cacheId: string, optionsMap?: { capacity: number; }): CacheObject;
(cacheId: string, optionsMap?: { capacity: number; }): ICacheObject;
// Methods bellow are not documented
info(): any;
get (cacheId: string): ICacheObject;
}
interface ICacheObject {
info(): {
id: string;
size: number;
// Not garanteed to have, since it's a non-mandatory option
//capacity: number;
};
put(key: string, value?: any): void;
get (key: string): any;
remove(key: string): void;
removeAll(): void;
destroy(): void;
}
///////////////////////////////////////////////////////////////////////////
// CompileService
// see http://docs.angularjs.org/api/ng.$compile
// see http://docs.angularjs.org/api/ng.$compileProvider
///////////////////////////////////////////////////////////////////////////
interface ICompileService {
(element: string, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction;
(element: Element, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction;
(element: JQuery, transclude?: ITemplateLinkingFunction, maxPriority?: number): ITemplateLinkingFunction;
}
interface ICompileProvider extends IServiceProvider {
directive(name: string, directiveFactory: Function): ICompileProvider;
// Undocumented, but it is there...
directive(directivesMap: any): ICompileProvider;
}
interface ITemplateLinkingFunction {
// Let's hint but not force cloneAttachFn's signature
(scope: IScope, cloneAttachFn?: (clonedElement?: JQuery, scope?: IScope) => any): JQuery;
}
///////////////////////////////////////////////////////////////////////////
// ControllerService
// see http://docs.angularjs.org/api/ng.$controller
// see http://docs.angularjs.org/api/ng.$controllerProvider
///////////////////////////////////////////////////////////////////////////
interface IControllerService {
// Although the documentation doesn't state this, locals are optional
(controllerConstructor: Function, locals?: any): any;
(controllerName: string, locals?: any): any;
}
interface IControllerProvider extends IServiceProvider {
register(name: string, controllerConstructor: Function): void;
register(name: string, dependencyAnnotadedConstructor: any[]): void;
}
///////////////////////////////////////////////////////////////////////////
// HttpService
// see http://docs.angularjs.org/api/ng.$http
///////////////////////////////////////////////////////////////////////////
interface IHttpService {
// At least moethod and url must be provided...
(config: IRequestConfig): IHttpPromise<any>;
get (url: string, RequestConfig?: any): IHttpPromise<any>;
delete (url: string, RequestConfig?: any): IHttpPromise<any>;
head(url: string, RequestConfig?: any): IHttpPromise<any>;
jsonp(url: string, RequestConfig?: any): IHttpPromise<any>;
post(url: string, data: any, RequestConfig?: any): IHttpPromise<any>;
put(url: string, data: any, RequestConfig?: any): IHttpPromise<any>;
defaults: IRequestConfig;
// For debugging, BUT it is documented as public, so...
pendingRequests: any[];
}
// This is just for hinting.
// Some opetions might not be available depending on the request.
// see http://docs.angularjs.org/api/ng.$http#Usage for options explanations
interface IRequestConfig {
method: string;
url: string;
params?: any;
// XXX it has it's own structure... perhaps we should define it in the future
headers?: any;
cache?: any;
timeout?: number;
withCredentials?: boolean;
// These accept multiple types, so let's defile them as any
data?: any;
transformRequest?: any;
transformResponse?: any;
}
interface IHttpPromiseCallback<T> {
(data: T, status: number, headers: (headerName: string) => string, config: IRequestConfig): void;
}
interface IHttpPromiseCallbackArg<T> {
data?: T;
status?: number;
headers?: (headerName: string) => string;
config?: IRequestConfig;
}
interface IHttpPromise<T> extends IPromise<T> {
success(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
error(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
then<TResult>(successCallback: (response: IHttpPromiseCallbackArg<T>) => TResult, errorCallback?: (response: IHttpPromiseCallbackArg<T>) => any): IPromise<TResult>;
then<TResult>(successCallback: (response: IHttpPromiseCallbackArg<T>) => IPromise<TResult>, errorCallback?: (response: IHttpPromiseCallbackArg<T>) => any): IPromise<TResult>;
}
interface IHttpProvider extends IServiceProvider {
defaults: IRequestConfig;
interceptors: any[];
responseInterceptors: any[];
}
///////////////////////////////////////////////////////////////////////////
// HttpBackendService
// see http://docs.angularjs.org/api/ng.$httpBackend
// You should never need to use this service directly.
///////////////////////////////////////////////////////////////////////////
interface IHttpBackendService {
// XXX Perhaps define callback signature in the future
(method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void;
}
///////////////////////////////////////////////////////////////////////////
// InterpolateService
// see http://docs.angularjs.org/api/ng.$interpolate
// see http://docs.angularjs.org/api/ng.$interpolateProvider
///////////////////////////////////////////////////////////////////////////
interface IInterpolateService {
(text: string, mustHaveExpression?: boolean): IInterpolationFunction;
endSymbol(): string;
startSymbol(): string;
}
interface IInterpolationFunction {
(context: any): string;
}
interface IInterpolateProvider extends IServiceProvider {
startSymbol(): string;
startSymbol(value: string): IInterpolateProvider;
endSymbol(): string;
endSymbol(value: string): IInterpolateProvider;
}
///////////////////////////////////////////////////////////////////////////
// RouteParamsService
// see http://docs.angularjs.org/api/ng.$routeParams
///////////////////////////////////////////////////////////////////////////
interface IRouteParamsService {}
///////////////////////////////////////////////////////////////////////////
// TemplateCacheService
// see http://docs.angularjs.org/api/ng.$templateCache
///////////////////////////////////////////////////////////////////////////
interface ITemplateCacheService extends ICacheObject {}
///////////////////////////////////////////////////////////////////////////
// RootScopeService
// see http://docs.angularjs.org/api/ng.$rootScope
///////////////////////////////////////////////////////////////////////////
interface IRootScopeService extends IScope {}
///////////////////////////////////////////////////////////////////////////
// RouteService
// see http://docs.angularjs.org/api/ng.$route
// see http://docs.angularjs.org/api/ng.$routeProvider
///////////////////////////////////////////////////////////////////////////
interface IRouteService {
reload(): void;
routes: any;
// May not always be available. For instance, current will not be available
// to a controller that was not initialized as a result of a route maching.
current?: ICurrentRoute;
}
// see http://docs.angularjs.org/api/ng.$routeProvider#when for options explanations
interface IRoute {
controller?: any;
name?: string;
template?: string;
templateUrl?: any;
resolve?: any;
redirectTo?: any;
reloadOnSearch?: boolean;
}
// see http://docs.angularjs.org/api/ng.$route#current
interface ICurrentRoute extends IRoute {
locals: {
$scope: IScope;
$template: string;
};
params: any;
}
interface IRouteProvider extends IServiceProvider {
otherwise(params: any): IRouteProvider;
when(path: string, route: IRoute): IRouteProvider;
}
///////////////////////////////////////////////////////////////////////////
// Directive
// see http://docs.angularjs.org/api/ng.$compileProvider#directive
// and http://docs.angularjs.org/guide/directive
///////////////////////////////////////////////////////////////////////////
interface IDirective{
priority?: number;
template?: any;
templateUrl?: any;
replace?: boolean;
transclude?: any;
restrict?: string;
scope?: any;
link?: Function;
compile?: Function;
controller?: any;
}
///////////////////////////////////////////////////////////////////////////
// angular.element
// when calling angular.element, angular returns a jQuery object,
// augmented with additional methods like e.g. scope.
// see: http://docs.angularjs.org/api/angular.element
///////////////////////////////////////////////////////////////////////////
interface IAugmentedJQueryStatic extends JQueryStatic {
(selector: string, context?: any): IAugmentedJQuery;
(element: Element): IAugmentedJQuery;
(object: {}): IAugmentedJQuery;
(elementArray: Element[]): IAugmentedJQuery;
(object: JQuery): IAugmentedJQuery;
(func: Function): IAugmentedJQuery;
(array: any[]): IAugmentedJQuery;
(): IAugmentedJQuery;
}
interface IAugmentedJQuery extends JQuery {
// TODO: events, how to define?
//$destroy
find(selector: string): IAugmentedJQuery;
find(element: any): IAugmentedJQuery;
find(obj: JQuery): IAugmentedJQuery;
controller(name: string): any;
injector(): any;
scope(): IScope;
inheritedData(key: string, value: any): JQuery;
inheritedData(obj: { [key: string]: any; }): JQuery;
inheritedData(key?: string): any;
}
///////////////////////////////////////////////////////////////////////////
// AUTO module (angular.js)
///////////////////////////////////////////////////////////////////////////
export module auto {
///////////////////////////////////////////////////////////////////////
// InjectorService
// see http://docs.angularjs.org/api/AUTO.$injector
///////////////////////////////////////////////////////////////////////
interface IInjectorService {
annotate(fn: Function): string[];
annotate(inlineAnnotadedFunction: any[]): string[];
get (name: string): any;
instantiate(typeConstructor: Function, locals?: any): any;
invoke(func: Function, context?: any, locals?: any): any;
}
///////////////////////////////////////////////////////////////////////
// ProvideService
// see http://docs.angularjs.org/api/AUTO.$provide
///////////////////////////////////////////////////////////////////////
interface IProvideService {
// Documentation says it returns the registered instance, but actual
// implementation does not return anything.
// constant(name: string, value: any): any;
constant(name: string, value: any): void;
decorator(name: string, decorator: Function): void;
decorator(name: string, decoratorInline: any[]): void;
factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider;
provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider;
provider(name: string, serviceProviderConstructor: Function): ng.IServiceProvider;
service(name: string, constructor: Function): ng.IServiceProvider;
value(name: string, value: any): ng.IServiceProvider;
}
}
}

30
angularjs/angular-cookies-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,30 @@
/// Type definitions for Angular JS 1.0 (ngCookies module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="angular.d.ts" />
///////////////////////////////////////////////////////////////////////////////
// ngCookies module (angular-cookies.js)
///////////////////////////////////////////////////////////////////////////////
declare module ng.cookies {
///////////////////////////////////////////////////////////////////////////
// CookieService
// see http://docs.angularjs.org/api/ngCookies.$cookies
///////////////////////////////////////////////////////////////////////////
interface ICookiesService {}
///////////////////////////////////////////////////////////////////////////
// CookieStoreService
// see http://docs.angularjs.org/api/ngCookies.$cookieStore
///////////////////////////////////////////////////////////////////////////
interface ICookieStoreService {
get(key: string): any;
put(key: string, value: any): void;
remove(key: string): void;
}
}

View File

@@ -1,4 +1,4 @@
/// Type definitions for Angular JS 1.0 (ngCookies module)
/// Type definitions for Angular JS 1.2 (ngCookies module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

150
angularjs/angular-mocks-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,150 @@
// Type definitions for Angular JS 1.0 (ngMock, ngMockE2E module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="angular.d.ts" />
///////////////////////////////////////////////////////////////////////////////
// functions attached to global object (window)
///////////////////////////////////////////////////////////////////////////////
declare var module: (...modules: any[]) => any;
declare var inject: (...fns: Function[]) => any;
///////////////////////////////////////////////////////////////////////////////
// ngMock module (angular-mocks.js)
///////////////////////////////////////////////////////////////////////////////
declare module ng {
///////////////////////////////////////////////////////////////////////////
// AngularStatic
// We reopen it to add the MockStatic definition
///////////////////////////////////////////////////////////////////////////
interface IAngularStatic {
mock: IMockStatic;
}
interface IMockStatic {
// see http://docs.angularjs.org/api/angular.mock.debug
debug(obj: any): string;
// see http://docs.angularjs.org/api/angular.mock.inject
inject(...fns: Function[]): any;
// see http://docs.angularjs.org/api/angular.mock.module
module(...modules: any[]): any;
// see http://docs.angularjs.org/api/angular.mock.TzDate
TzDate(offset: number, timestamp: number): Date;
TzDate(offset: number, timestamp: string): Date;
}
///////////////////////////////////////////////////////////////////////////
// ExceptionHandlerService
// see http://docs.angularjs.org/api/ngMock.$exceptionHandler
// see http://docs.angularjs.org/api/ngMock.$exceptionHandlerProvider
///////////////////////////////////////////////////////////////////////////
interface IExceptionHandlerProvider extends IServiceProvider {
mode(mode: string): void;
}
///////////////////////////////////////////////////////////////////////////
// TimeoutService
// see http://docs.angularjs.org/api/ngMock.$timeout
// Augments the original service
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
flush(): void;
}
///////////////////////////////////////////////////////////////////////////
// LogService
// see http://docs.angularjs.org/api/ngMock.$log
// Augments the original service
///////////////////////////////////////////////////////////////////////////
interface ILogService {
assertEmpty(): void;
reset(): void;
}
interface LogCall {
logs: string[];
}
///////////////////////////////////////////////////////////////////////////
// HttpBackendService
// see http://docs.angularjs.org/api/ngMock.$httpBackend
///////////////////////////////////////////////////////////////////////////
interface IHttpBackendService {
flush(count?: number): void;
resetExpectations(): void;
verifyNoOutstandingExpectation(): void;
verifyNoOutstandingRequest(): void;
expect(method: string, url: string, data?: any, headers?: any): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
expect(method: RegExp, url: string, data?: any, headers?: any): mock.IRequestHandler;
expect(method: RegExp, url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
when(method: string, url: string, data?: string, headers?: any): mock.IRequestHandler;
when(method: string, url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
when(method: string, url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
when(method: string, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: string, data?: string, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
expectDELETE(url: string, headers?: any): mock.IRequestHandler;
expectDELETE(url: RegExp, headers?: any): mock.IRequestHandler;
expectGET(url: string, headers?: any): mock.IRequestHandler;
expectGET(url: RegExp, headers?: any): mock.IRequestHandler;
expectHEAD(url: string, headers?: any): mock.IRequestHandler;
expectHEAD(url: RegExp, headers?: any): mock.IRequestHandler;
expectJSONP(url: string): mock.IRequestHandler;
expectJSONP(url: RegExp): mock.IRequestHandler;
expectPATCH(url: string, data?: any, headers?: any): mock.IRequestHandler;
expectPATCH(url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
expectPOST(url: string, data?: any, headers?: any): mock.IRequestHandler;
expectPOST(url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
expectPUT(url: string, data?: any, headers?: any): mock.IRequestHandler;
expectPUT(url: RegExp, data?: any, headers?: any): mock.IRequestHandler;
whenDELETE(url: string, headers?: any): mock.IRequestHandler;
whenDELETE(url: RegExp, headers?: any): mock.IRequestHandler;
whenGET(url: string, headers?: any): mock.IRequestHandler;
whenGET(url: RegExp, headers?: any): mock.IRequestHandler;
whenHEAD(url: string, headers?: any): mock.IRequestHandler;
whenHEAD(url: RegExp, headers?: any): mock.IRequestHandler;
whenJSONP(url: string): mock.IRequestHandler;
whenJSONP(url: RegExp): mock.IRequestHandler;
whenPATCH(url: string, data?: string, headers?: any): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
whenPATCH(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPOST(url: string, data?: string, headers?: any): mock.IRequestHandler;
whenPOST(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
whenPOST(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPOST(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPUT(url: string, data?: string, headers?: any): mock.IRequestHandler;
whenPUT(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
whenPUT(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPUT(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
}
export module mock {
// returned interface by the the mocked HttpBackendService expect/when methods
interface IRequestHandler {
respond(func: Function): void;
respond(status: number, data?: any, headers?: any): void;
respond(data: any, headers?: any): void;
// Available wehn ngMockE2E is loaded
passThrough(): void;
}
}
}

View File

@@ -0,0 +1,288 @@
/// <reference path="angular-mocks.d.ts" />
///////////////////////////////////////
// IAngularStatic
///////////////////////////////////////
var angular: ng.IAngularStatic;
var mock: ng.IMockStatic;
mock = angular.mock;
///////////////////////////////////////
// IMockStatic
///////////////////////////////////////
var date: Date;
mock.dump({ key: 'value' });
mock.inject(
function () { return 1; },
function () { return 2; }
);
mock.module('module1', 'module2');
mock.module(
function () { return 1; },
function () { return 2; }
);
mock.module({ module1: function () { return 1; } });
date = mock.TzDate(-7, '2013-1-1T15:00:00Z');
date = mock.TzDate(-8, 12345678);
///////////////////////////////////////
// IExceptionHandlerProvider
///////////////////////////////////////
var exceptionHandlerProvider: ng.IExceptionHandlerProvider;
exceptionHandlerProvider.mode('log');
///////////////////////////////////////
// IExceptionHandlerProvider
///////////////////////////////////////
var timeoutService: ng.ITimeoutService;
timeoutService.flush();
timeoutService.flush(1234);
timeoutService.flushNext();
timeoutService.flushNext(1234);
timeoutService.verifyNoPendingTasks();
///////////////////////////////////////
// ILogService, ILogCall
///////////////////////////////////////
var logService: ng.ILogService;
var logCall: ng.ILogCall;
var logs: string[];
logService.assertEmpty();
logService.reset();
logCall = logService.debug;
logCall = logService.error;
logCall = logService.info;
logCall = logService.log;
logCall = logService.warn;
logs = logCall.logs;
///////////////////////////////////////
// IHttpBackendService
///////////////////////////////////////
var httpBackendService: ng.IHttpBackendService;
var requestHandler: ng.mock.IRequestHandler;
httpBackendService.flush();
httpBackendService.flush(1234);
httpBackendService.resetExpectations();
httpBackendService.verifyNoOutstandingExpectation();
httpBackendService.verifyNoOutstandingRequest();
requestHandler = httpBackendService.expect('GET', 'http://test.local');
requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data');
requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.expect('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/);
requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.expect('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expect('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' });
requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expect('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', /test.local/);
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data');
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/);
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expect('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.expectDELETE('http://test.local');
requestHandler = httpBackendService.expectDELETE('http://test.local', { header: 'value' });
requestHandler = httpBackendService.expectDELETE(/test.local/, { header: 'value' });
requestHandler = httpBackendService.expectGET('http://test.local');
requestHandler = httpBackendService.expectGET('http://test.local', { header: 'value' });
requestHandler = httpBackendService.expectGET(/test.local/, { header: 'value' });
requestHandler = httpBackendService.expectHEAD('http://test.local');
requestHandler = httpBackendService.expectHEAD('http://test.local', { header: 'value' });
requestHandler = httpBackendService.expectHEAD(/test.local/, { header: 'value' });
requestHandler = httpBackendService.expectJSONP('http://test.local');
requestHandler = httpBackendService.expectJSONP(/test.local/);
requestHandler = httpBackendService.expectPATCH('http://test.local');
requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data');
requestHandler = httpBackendService.expectPATCH('http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/);
requestHandler = httpBackendService.expectPATCH('http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' });
requestHandler = httpBackendService.expectPATCH('http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expectPATCH(/test.local/);
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data');
requestHandler = httpBackendService.expectPATCH(/test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/);
requestHandler = httpBackendService.expectPATCH(/test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' });
requestHandler = httpBackendService.expectPATCH(/test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expectPOST('http://test.local');
requestHandler = httpBackendService.expectPOST('http://test.local', 'response data');
requestHandler = httpBackendService.expectPOST('http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.expectPOST('http://test.local', /response data/);
requestHandler = httpBackendService.expectPOST('http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' });
requestHandler = httpBackendService.expectPOST('http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expectPOST(/test.local/);
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data');
requestHandler = httpBackendService.expectPOST(/test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/);
requestHandler = httpBackendService.expectPOST(/test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' });
requestHandler = httpBackendService.expectPOST(/test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expectPUT('http://test.local');
requestHandler = httpBackendService.expectPUT('http://test.local', 'response data');
requestHandler = httpBackendService.expectPUT('http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.expectPUT('http://test.local', /response data/);
requestHandler = httpBackendService.expectPUT('http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' });
requestHandler = httpBackendService.expectPUT('http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.expectPUT(/test.local/);
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data');
requestHandler = httpBackendService.expectPUT(/test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/);
requestHandler = httpBackendService.expectPUT(/test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.expectPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' });
requestHandler = httpBackendService.expectPUT(/test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.when('GET', 'http://test.local');
requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data');
requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.when('GET', 'http://test.local', 'response data', function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/);
requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.when('GET', 'http://test.local', /response data/, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.when('GET', 'http://test.local', function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' });
requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.when('GET', 'http://test.local', { key: 'value' }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', /test.local/);
requestHandler = httpBackendService.when('GET', /test.local/, 'response data');
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.when('GET', /test.local/, 'response data', function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', /test.local/, /response data/);
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.when('GET', /test.local/, /response data/, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.when('GET', /test.local/, function (data: string): boolean { return true; }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' });
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.when('GET', /test.local/, { key: 'value' }, function (headers: Object): boolean { return true; });
requestHandler = httpBackendService.whenDELETE('http://test.local');
requestHandler = httpBackendService.whenDELETE('http://test.local', { header: 'value' });
requestHandler = httpBackendService.whenDELETE(/test.local/, { header: 'value' });
requestHandler = httpBackendService.whenGET('http://test.local');
requestHandler = httpBackendService.whenGET('http://test.local', { header: 'value' });
requestHandler = httpBackendService.whenGET(/test.local/, { header: 'value' });
requestHandler = httpBackendService.whenHEAD('http://test.local');
requestHandler = httpBackendService.whenHEAD('http://test.local', { header: 'value' });
requestHandler = httpBackendService.whenHEAD(/test.local/, { header: 'value' });
requestHandler = httpBackendService.whenJSONP('http://test.local');
requestHandler = httpBackendService.whenJSONP(/test.local/);
requestHandler = httpBackendService.whenPATCH('http://test.local');
requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data');
requestHandler = httpBackendService.whenPATCH('http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/);
requestHandler = httpBackendService.whenPATCH('http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPATCH('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' });
requestHandler = httpBackendService.whenPATCH('http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.whenPATCH(/test.local/);
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data');
requestHandler = httpBackendService.whenPATCH(/test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/);
requestHandler = httpBackendService.whenPATCH(/test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPATCH(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' });
requestHandler = httpBackendService.whenPATCH(/test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.whenPOST('http://test.local');
requestHandler = httpBackendService.whenPOST('http://test.local', 'response data');
requestHandler = httpBackendService.whenPOST('http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.whenPOST('http://test.local', /response data/);
requestHandler = httpBackendService.whenPOST('http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPOST('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' });
requestHandler = httpBackendService.whenPOST('http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.whenPOST(/test.local/);
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data');
requestHandler = httpBackendService.whenPOST(/test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/);
requestHandler = httpBackendService.whenPOST(/test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPOST(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' });
requestHandler = httpBackendService.whenPOST(/test.local/, { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.whenPUT('http://test.local');
requestHandler = httpBackendService.whenPUT('http://test.local', 'response data');
requestHandler = httpBackendService.whenPUT('http://test.local', 'response data', { header: 'value' });
requestHandler = httpBackendService.whenPUT('http://test.local', /response data/);
requestHandler = httpBackendService.whenPUT('http://test.local', /response data/, { header: 'value' });
requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPUT('http://test.local', function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' });
requestHandler = httpBackendService.whenPUT('http://test.local', { key: 'value' }, { header: 'value' });
requestHandler = httpBackendService.whenPUT(/test.local/);
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data');
requestHandler = httpBackendService.whenPUT(/test.local/, 'response data', { header: 'value' });
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/);
requestHandler = httpBackendService.whenPUT(/test.local/, /response data/, { header: 'value' });
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; });
requestHandler = httpBackendService.whenPUT(/test.local/, function (data: string): boolean { return true; }, { header: 'value' });
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' });
requestHandler = httpBackendService.whenPUT(/test.local/, { key: 'value' }, { header: 'value' });
///////////////////////////////////////
// IRequestHandler
///////////////////////////////////////
requestHandler.passThrough();
requestHandler.respond(function () { });
requestHandler.respond({ key: 'value' });
requestHandler.respond({ key: 'value' }, { header: 'value' });
requestHandler.respond(404);
requestHandler.respond(404, { key: 'value' });
requestHandler.respond(404, { key: 'value' }, { header: 'value' });

View File

@@ -0,0 +1 @@
""

View File

@@ -1,9 +1,8 @@
// Type definitions for Angular JS 1.0 (ngMock, ngMockE2E module)
// Type definitions for Angular JS 1.2 (ngMock, ngMockE2E module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="angular.d.ts" />
///////////////////////////////////////////////////////////////////////////////
@@ -26,14 +25,16 @@ declare module ng {
}
interface IMockStatic {
// see http://docs.angularjs.org/api/angular.mock.debug
debug(obj: any): string;
// see http://docs.angularjs.org/api/angular.mock.dump
dump(obj: any): string;
// see http://docs.angularjs.org/api/angular.mock.inject
inject(...fns: Function[]): any;
// see http://docs.angularjs.org/api/angular.mock.module
module(...modules: any[]): any;
module(...modules: string[]): any;
module(...modules: Function[]): any;
module(modules: Object): any;
// see http://docs.angularjs.org/api/angular.mock.TzDate
TzDate(offset: number, timestamp: number): Date;
@@ -55,7 +56,9 @@ declare module ng {
// Augments the original service
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
flush(): void;
flush(delay?: number): void;
flushNext(expectedDelay?: number): void;
verifyNoPendingTasks(): void;
}
///////////////////////////////////////////////////////////////////////////
@@ -68,7 +71,7 @@ declare module ng {
reset(): void;
}
interface LogCall {
interface ILogCall {
logs: string[];
}
@@ -82,72 +85,127 @@ declare module ng {
verifyNoOutstandingExpectation(): void;
verifyNoOutstandingRequest(): void;
expect(method: string, url: string, data?: string, headers?: any): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
expect(method: string, url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
expect(method: RegExp, url: string, data?: string, headers?: any): mock.IRequestHandler;
expect(method: RegExp, url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
expect(method: RegExp, url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
expect(method: RegExp, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
when(method: string, url: string, data?: string, headers?: any): mock.IRequestHandler;
when(method: string, url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
when(method: string, url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
when(method: string, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: string, data?: string, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
when(method: RegExp, url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
expectDELETE(url: string, headers?: any): mock.IRequestHandler;
expectDELETE(url: RegExp, headers?: any): mock.IRequestHandler;
expectGET(url: string, headers?: any): mock.IRequestHandler;
expectGET(url: RegExp, headers?: any): mock.IRequestHandler;
expectHEAD(url: string, headers?: any): mock.IRequestHandler;
expectHEAD(url: RegExp, headers?: any): mock.IRequestHandler;
expect(method: string, url: string, data?: string, headers?: Object): mock.IRequestHandler;
expect(method: string, url: string, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
expect(method: string, url: string, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expect(method: string, url: string, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: string, data?: Object, headers?: Object): mock.IRequestHandler;
expect(method: string, url: string, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
expect(method: string, url: RegExp, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler;
expectDELETE(url: string, headers?: Object): mock.IRequestHandler;
expectDELETE(url: RegExp, headers?: Object): mock.IRequestHandler;
expectGET(url: string, headers?: Object): mock.IRequestHandler;
expectGET(url: RegExp, headers?: Object): mock.IRequestHandler;
expectHEAD(url: string, headers?: Object): mock.IRequestHandler;
expectHEAD(url: RegExp, headers?: Object): mock.IRequestHandler;
expectJSONP(url: string): mock.IRequestHandler;
expectJSONP(url: RegExp): mock.IRequestHandler;
expectPATCH(url: string, data?: string, headers?: any): mock.IRequestHandler;
expectPATCH(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
expectPATCH(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
expectPATCH(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
expectPOST(url: string, data?: string, headers?: any): mock.IRequestHandler;
expectPOST(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
expectPOST(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
expectPOST(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
expectPUT(url: string, data?: string, headers?: any): mock.IRequestHandler;
expectPUT(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
expectPUT(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
expectPUT(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
whenDELETE(url: string, headers?: any): mock.IRequestHandler;
whenDELETE(url: RegExp, headers?: any): mock.IRequestHandler;
whenGET(url: string, headers?: any): mock.IRequestHandler;
whenGET(url: RegExp, headers?: any): mock.IRequestHandler;
whenHEAD(url: string, headers?: any): mock.IRequestHandler;
whenHEAD(url: RegExp, headers?: any): mock.IRequestHandler;
expectPATCH(url: string, data?: string, headers?: Object): mock.IRequestHandler;
expectPATCH(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
expectPATCH(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expectPATCH(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
expectPATCH(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
expectPATCH(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
expectPATCH(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expectPATCH(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
expectPOST(url: string, data?: string, headers?: Object): mock.IRequestHandler;
expectPOST(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
expectPOST(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expectPOST(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
expectPOST(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
expectPOST(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
expectPOST(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expectPOST(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
expectPUT(url: string, data?: string, headers?: Object): mock.IRequestHandler;
expectPUT(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
expectPUT(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expectPUT(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
expectPUT(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
expectPUT(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
expectPUT(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
expectPUT(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
when(method: string, url: string, data?: string, headers?: Object): mock.IRequestHandler;
when(method: string, url: string, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
when(method: string, url: string, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
when(method: string, url: string, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: string, data?: Object, headers?: Object): mock.IRequestHandler;
when(method: string, url: string, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
when(method: string, url: RegExp, data?: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
when(method: string, url: RegExp, data?: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
when(method: string, url: RegExp, data?: (data: string) => boolean, headers?: (object: Object) => boolean): mock.IRequestHandler;
when(method: string, url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
when(method: string, url: RegExp, data?: Object, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenDELETE(url: string, headers?: Object): mock.IRequestHandler;
whenDELETE(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenDELETE(url: RegExp, headers?: Object): mock.IRequestHandler;
whenDELETE(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenGET(url: string, headers?: Object): mock.IRequestHandler;
whenGET(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenGET(url: RegExp, headers?: Object): mock.IRequestHandler;
whenGET(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenHEAD(url: string, headers?: Object): mock.IRequestHandler;
whenHEAD(url: string, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenHEAD(url: RegExp, headers?: Object): mock.IRequestHandler;
whenHEAD(url: RegExp, headers?: (object: Object) => boolean): mock.IRequestHandler;
whenJSONP(url: string): mock.IRequestHandler;
whenJSONP(url: RegExp): mock.IRequestHandler;
whenPATCH(url: string, data?: string, headers?: any): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
whenPATCH(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPOST(url: string, data?: string, headers?: any): mock.IRequestHandler;
whenPOST(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
whenPOST(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPOST(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPUT(url: string, data?: string, headers?: any): mock.IRequestHandler;
whenPUT(url: RegExp, data?: string, headers?: any): mock.IRequestHandler;
whenPUT(url: string, data?: RegExp, headers?: any): mock.IRequestHandler;
whenPUT(url: RegExp, data?: RegExp, headers?: any): mock.IRequestHandler;
}
whenPATCH(url: string, data?: string, headers?: Object): mock.IRequestHandler;
whenPATCH(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
whenPATCH(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
whenPATCH(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
whenPATCH(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
whenPOST(url: string, data?: string, headers?: Object): mock.IRequestHandler;
whenPOST(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
whenPOST(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
whenPOST(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
whenPOST(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
whenPOST(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
whenPOST(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
whenPOST(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
whenPUT(url: string, data?: string, headers?: Object): mock.IRequestHandler;
whenPUT(url: string, data?: RegExp, headers?: Object): mock.IRequestHandler;
whenPUT(url: string, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
whenPUT(url: string, data?: Object, headers?: Object): mock.IRequestHandler;
whenPUT(url: RegExp, data?: string, headers?: Object): mock.IRequestHandler;
whenPUT(url: RegExp, data?: RegExp, headers?: Object): mock.IRequestHandler;
whenPUT(url: RegExp, data?: (data: string) => boolean, headers?: Object): mock.IRequestHandler;
whenPUT(url: RegExp, data?: Object, headers?: Object): mock.IRequestHandler;
}
export module mock {
// returned interface by the the mocked HttpBackendService expect/when methods
interface IRequestHandler {
respond(func: Function): void;
respond(func: Function): void;
respond(status: number, data?: any, headers?: any): void;
respond(data: any, headers?: any): void;
@@ -155,6 +213,6 @@ declare module ng {
passThrough(): void;
}
}
}
}

View File

@@ -0,0 +1 @@
""

82
angularjs/angular-resource-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,82 @@
// Type definitions for Angular JS 1.0 (ngResource module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="angular.d.ts" />
///////////////////////////////////////////////////////////////////////////////
// ngResource module (angular-resource.js)
///////////////////////////////////////////////////////////////////////////////
declare module ng.resource {
///////////////////////////////////////////////////////////////////////////
// ResourceService
// see http://docs.angularjs.org/api/ngResource.$resource
// Most part of the following definitions were achieved by analyzing the
// actual implementation, since the documentation doesn't seem to cover
// that deeply.
///////////////////////////////////////////////////////////////////////////
interface IResourceService {
(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actionDescriptors?: any): IResourceClass;
}
// Just a reference to facilitate describing new actions
interface IActionDescriptor {
method: string;
isArray?: boolean;
params?: any;
headers?: any;
}
// Baseclass for everyresource with default actions.
// If you define your new actions for the resource, you will need
// to extend this interface and typecast the ResourceClass to it.
interface IResourceClass {
get: IActionCall;
save: IActionCall;
query: IActionCall;
remove: IActionCall;
delete: IActionCall;
}
// In case of passing the first argument as anything but a function,
// it's gonna be considered data if the action method is POST, PUT or
// PATCH (in other words, methods with body). Otherwise, it's going
// to be considered as parameters to the request.
interface IActionCall {
(): IResource;
(dataOrParams: any): IResource;
(dataOrParams: any, success: Function): IResource;
(success: Function, error?: Function): IResource;
(params: any, data: any, success?: Function, error?: Function): IResource;
}
interface IResource {
$save: IActionCall;
$remove: IActionCall;
$delete: IActionCall;
// No documented, but they are there, just as any custom action will be
$query: IActionCall;
$get: IActionCall;
}
/** when creating a resource factory via IModule.factory */
interface IResourceServiceFactoryFunction {
($resource: ng.resource.IResourceService): ng.resource.IResourceClass;
}
}
/** extensions to base ng based on using angular-resource */
declare module ng {
interface IModule {
/** creating a resource service factory */
factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction): IModule;
}
}

View File

@@ -0,0 +1,74 @@
/// <reference path="angular-resource.d.ts" />
///////////////////////////////////////
// IActionDescriptor
///////////////////////////////////////
var actionDescriptor: ng.resource.IActionDescriptor;
actionDescriptor.headers = { header: 'value' };
actionDescriptor.isArray = true;
actionDescriptor.method = 'method action';
actionDescriptor.params = { key: 'value' };
///////////////////////////////////////
// IResourceClass
///////////////////////////////////////
var resourceClass: ng.resource.IResourceClass;
var resource: ng.resource.IResource;
resource = resourceClass.delete();
resource = resourceClass.delete({ key: 'value' });
resource = resourceClass.delete({ key: 'value' }, function () { });
resource = resourceClass.delete(function () { });
resource = resourceClass.delete(function () { }, function () { });
resource = resourceClass.delete({ key: 'value' }, { key: 'value' });
resource = resourceClass.delete({ key: 'value' }, { key: 'value' }, function () { });
resource = resourceClass.delete({ key: 'value' }, { key: 'value' }, function () { }, function () { });
resource = resourceClass.get();
resource = resourceClass.get({ key: 'value' });
resource = resourceClass.get({ key: 'value' }, function () { });
resource = resourceClass.get(function () { });
resource = resourceClass.get(function () { }, function () { });
resource = resourceClass.get({ key: 'value' }, { key: 'value' });
resource = resourceClass.get({ key: 'value' }, { key: 'value' }, function () { });
resource = resourceClass.get({ key: 'value' }, { key: 'value' }, function () { }, function () { });
resource = resourceClass.query();
resource = resourceClass.query({ key: 'value' });
resource = resourceClass.query({ key: 'value' }, function () { });
resource = resourceClass.query(function () { });
resource = resourceClass.query(function () { }, function () { });
resource = resourceClass.query({ key: 'value' }, { key: 'value' });
resource = resourceClass.query({ key: 'value' }, { key: 'value' }, function () { });
resource = resourceClass.query({ key: 'value' }, { key: 'value' }, function () { }, function () { });
resource = resourceClass.remove();
resource = resourceClass.remove({ key: 'value' });
resource = resourceClass.remove({ key: 'value' }, function () { });
resource = resourceClass.remove(function () { });
resource = resourceClass.remove(function () { }, function () { });
resource = resourceClass.remove({ key: 'value' }, { key: 'value' });
resource = resourceClass.remove({ key: 'value' }, { key: 'value' }, function () { });
resource = resourceClass.remove({ key: 'value' }, { key: 'value' }, function () { }, function () { });
resource = resourceClass.save();
resource = resourceClass.save({ key: 'value' });
resource = resourceClass.save({ key: 'value' }, function () { });
resource = resourceClass.save(function () { });
resource = resourceClass.save(function () { }, function () { });
resource = resourceClass.save({ key: 'value' }, { key: 'value' });
resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { });
resource = resourceClass.save({ key: 'value' }, { key: 'value' }, function () { }, function () { });
///////////////////////////////////////
// IModule
///////////////////////////////////////
var mod: ng.IModule;
var resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction;
var resourceService: ng.resource.IResourceService;
resourceServiceFactoryFunction = function (resourceService) { return resourceClass };
mod = mod.factory('factory name', resourceServiceFactoryFunction);

View File

@@ -1,4 +1,4 @@
// Type definitions for Angular JS 1.0 (ngResource module)
// Type definitions for Angular JS 1.2 (ngResource module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -19,16 +19,16 @@ declare module ng.resource {
// that deeply.
///////////////////////////////////////////////////////////////////////////
interface IResourceService {
(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actionDescriptors?: any): IResourceClass;
(url: string, paramDefaults?: any,
/** example: {update: { method: 'PUT' }, delete: deleteDescriptor }
where deleteDescriptor : IActionDescriptor */
actionDescriptors?: any): IResourceClass;
}
// Just a reference to facilitate describing new actions
interface IActionDescriptor {
method: string;
isArray?: bool;
isArray?: boolean;
params?: any;
headers?: any;
}

View File

@@ -0,0 +1,14 @@
/// <reference path="angular-route.d.ts" />
/**
* @license HTTP Auth Interceptor Module for AngularJS
* (c) 2013 Jonathan Park @ Daptiv Solutions Inc
* License: MIT
*/
declare var $routeProvider: ng.route.IRouteProvider;
$routeProvider
.when('/projects/:projectId/dashboard',{
controller: ''
})
.otherwise({redirectTo: '/'});

64
angularjs/angular-route.d.ts vendored Normal file
View File

@@ -0,0 +1,64 @@
// Type definitions for Angular JS 1.2 (ngRoute module)
// Project: http://angularjs.org
// Definitions by: Jonathan Park
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="angular.d.ts" />
///////////////////////////////////////////////////////////////////////////////
// ngRoute module (angular-route.js)
///////////////////////////////////////////////////////////////////////////////
declare module ng.route {
///////////////////////////////////////////////////////////////////////////
// RouteParamsService
// see http://docs.angularjs.org/api/ngRoute.$routeParams
///////////////////////////////////////////////////////////////////////////
interface IRouteParamsService {}
///////////////////////////////////////////////////////////////////////////
// RouteService
// see http://docs.angularjs.org/api/ngRoute.$route
// see http://docs.angularjs.org/api/ngRoute.$routeProvider
///////////////////////////////////////////////////////////////////////////
interface IRouteService {
reload(): void;
routes: any;
// May not always be available. For instance, current will not be available
// to a controller that was not initialized as a result of a route maching.
current?: ICurrentRoute;
}
// see http://docs.angularjs.org/api/ngRoute.$routeProvider#when for options explanations
interface IRoute {
controller?: any;
controllerAs?: any;
name?: string;
template?: string;
templateUrl?: any;
resolve?: any;
redirectTo?: any;
reloadOnSearch?: boolean;
}
// see http://docs.angularjs.org/api/ng.$route#current
interface ICurrentRoute extends IRoute {
locals: {
$scope: IScope;
$template: string;
};
params: any;
}
interface IRouteProvider extends IServiceProvider {
otherwise(params: any): IRouteProvider;
/**
* This is a description
*
*/
when(path: string, route: IRoute): IRouteProvider;
}
}

22
angularjs/angular-sanitize-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
// Type definitions for Angular JS 1.0 (ngSanitize module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="angular.d.ts" />
///////////////////////////////////////////////////////////////////////////////
// ngSanitize module (angular-sanitize.js)
///////////////////////////////////////////////////////////////////////////////
declare module ng.sanitize {
///////////////////////////////////////////////////////////////////////////
// SanitizeService
// see http://docs.angularjs.org/api/ngSanitize.$sanitize
///////////////////////////////////////////////////////////////////////////
interface ISanitizeService {
(html: string): string;
}
}

View File

@@ -1,4 +1,4 @@
// Type definitions for Angular JS 1.0 (ngSanitize module)
// Type definitions for Angular JS 1.2 (ngSanitize module)
// Project: http://angularjs.org
// Definitions by: Diego Vilar <http://github.com/diegovilar>
// Definitions: https://github.com/borisyankov/DefinitelyTyped

155
angularjs/angular-scenario-1.0.d.ts vendored Normal file
View File

@@ -0,0 +1,155 @@
// Type definitions for Angular Scenario Testing
// Project: [http://angularjs.org]
// Definitions by: [RomanoLindano]
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module angularScenario {
export interface AngularModel {
scenario: any;
}
export interface RunFunction {
(functionToRun: any): any;
}
export interface RunFunctionWithDescription {
(description: string, functionToRun: any): any;
}
export interface PauseFunction {
(): any;
}
export interface SleepFunction {
(seconds: number): any;
}
export interface Future {
}
export interface testWindow {
href(): Future;
path(): Future;
search(): Future;
hash(): Future;
}
export interface testLocation {
url(): Future;
path(): Future;
search(): Future;
hash(): Future;
}
export interface Browser {
navigateTo(url: string): void;
navigateTo(urlDescription: string, urlFunction: () => string): void;
reload(): void;
window(): testWindow;
location(): testLocation;
}
export interface Matchers {
toEqual(value: any): void;
toBe(value: any): void;
toBeDefined(): void;
toBeTruthy(): void;
toBeFalsy(): void;
toMatch(regularExpression: any): void;
toBeNull(): void;
toContain(value: any): void;
toBeLessThan(value: any): void;
toBeGreaterThan(value: any): void;
}
export interface CustomMatchers extends Matchers{
}
export interface Expect extends CustomMatchers {
not(): angularScenario.CustomMatchers;
}
export interface UsingFunction {
(selector: string, selectorDescription?: string): void;
}
export interface BindingFunction {
(bracketBindingExpression: string): Future;
}
export interface Input {
enter(value: any);
check(): any;
select(radioButtonValue: any): any;
val(): Future;
}
export interface Repeater {
count(): Future;
row(index: number): Future;
column(ngBindingExpression: string): Future;
}
export interface Select {
option(value: any): any;
option(...listOfValues: any[]): any;
}
export interface Element {
count(): Future;
click(): any;
query(callback: (selectedDOMElements: any[], callbackWhenDone: (objNull: any, futureValue: any) => any) =>any): any;
val(): Future;
text(): Future;
html(): Future;
height(): Future;
innerHeight(): Future;
outerHeight(): Future;
width(): Future;
innerWidth(): Future;
outerWidth(): Future;
position(): Future;
scrollLeft(): Future;
scrollTop(): Future;
offset(): Future;
val(value: any): void;
text(value: any): void;
html(value: any): void;
height(value: any): void;
innerHeight(value: any): void;
outerHeight(value: any): void;
width(value: any): void;
innerWidth(value: any): void;
outerWidth(value: any): void;
position(value: any): void;
scrollLeft(value: any): void;
scrollTop(value: any): void;
offset(value: any): void;
attr(key: any): Future;
prop(key: any): Future;
css(key: any): Future;
attr(key: any, value: any): void;
prop(key: any, value: any): void;
css(key: any, value: any): void;
}
}
declare var describe: angularScenario.RunFunctionWithDescription;
declare var xdescribe: angularScenario.RunFunctionWithDescription;
declare var beforeEach: angularScenario.RunFunction;
declare var afterEach: angularScenario.RunFunction;
declare var it: angularScenario.RunFunctionWithDescription;
declare var xit: angularScenario.RunFunctionWithDescription;
declare var pause: angularScenario.PauseFunction;
declare var sleep: angularScenario.SleepFunction;
declare function browser(): angularScenario.Browser;
declare function expect(expectation: angularScenario.Future): angularScenario.Expect;
declare var using: angularScenario.UsingFunction;
declare var binding: angularScenario.BindingFunction;
declare function input(ngModelBinding: string): angularScenario.Input;
declare function repeater(selector: string, repeaterDescription?: string): angularScenario.Repeater;
declare function select(ngModelBinding: string): angularScenario.Select;
declare function element(selector: string, elementDescription?: string): angularScenario.Element;
declare var angular: angularScenario.AngularModel;

View File

@@ -0,0 +1 @@
""

View File

@@ -1,54 +1,155 @@
// Type definitions for Angular Scenario Testing
// Project: [http://angularjs.org]
// Definitions by: [RomanoLindano]
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module scenario
{
interface ISleep
{
(timeSeconds: number): void;
declare module angularScenario {
export interface AngularModel {
scenario: any;
}
interface IBrowser
{
(): IBrowser;
navigateTo(url: string);
navigateTo(url: string, delegate: (url: string) => string);
reload();
window(): IWindowApi;
location(): ILocationApi;
export interface RunFunction {
(functionToRun: any): any;
}
export interface RunFunctionWithDescription {
(description: string, functionToRun: any): any;
}
interface IWindowApi
{
href(): void;
path(): void;
search(): void;
hash(): void;
export interface PauseFunction {
(): any;
}
interface ILocationApi
{
url(): void;
path(): void;
search(): void;
hash(): void;
export interface SleepFunction {
(seconds: number): any;
}
interface IElement
{
(): IElement;
(selector: string): IElement;
count(): number;
click(): void;
export interface Future {
}
export interface testWindow {
href(): Future;
path(): Future;
search(): Future;
hash(): Future;
}
export interface testLocation {
url(): Future;
path(): Future;
search(): Future;
hash(): Future;
}
export interface Browser {
navigateTo(url: string): void;
navigateTo(urlDescription: string, urlFunction: () => string): void;
reload(): void;
window(): testWindow;
location(): testLocation;
}
export interface Matchers {
toEqual(value: any): void;
toBe(value: any): void;
toBeDefined(): void;
toBeTruthy(): void;
toBeFalsy(): void;
toMatch(regularExpression: any): void;
toBeNull(): void;
toContain(value: any): void;
toBeLessThan(value: any): void;
toBeGreaterThan(value: any): void;
}
export interface CustomMatchers extends Matchers{
}
export interface Expect extends CustomMatchers {
not(): angularScenario.CustomMatchers;
}
export interface UsingFunction {
(selector: string, selectorDescription?: string): void;
}
export interface BindingFunction {
(bracketBindingExpression: string): Future;
}
export interface Input {
enter(value: any);
check(): any;
select(radioButtonValue: any): any;
val(): Future;
}
export interface Repeater {
count(): Future;
row(index: number): Future;
column(ngBindingExpression: string): Future;
}
export interface Select {
option(value: any): any;
option(...listOfValues: any[]): any;
}
export interface Element {
count(): Future;
click(): any;
query(callback: (selectedDOMElements: any[], callbackWhenDone: (objNull: any, futureValue: any) => any) =>any): any;
val(): Future;
text(): Future;
html(): Future;
height(): Future;
innerHeight(): Future;
outerHeight(): Future;
width(): Future;
innerWidth(): Future;
outerWidth(): Future;
position(): Future;
scrollLeft(): Future;
scrollTop(): Future;
offset(): Future;
val(value: any): void;
text(value: any): void;
html(value: any): void;
height(value: any): void;
innerHeight(value: any): void;
outerHeight(value: any): void;
width(value: any): void;
innerWidth(value: any): void;
outerWidth(value: any): void;
position(value: any): void;
scrollLeft(value: any): void;
scrollTop(value: any): void;
offset(value: any): void;
attr(key: any): Future;
prop(key: any): Future;
css(key: any): Future;
attr(key: any, value: any): void;
prop(key: any, value: any): void;
css(key: any, value: any): void;
}
}
declare var browser: scenario.IBrowser;
declare var element: scenario.IElement;
declare var sleep: scenario.ISleep;
declare var describe: angularScenario.RunFunctionWithDescription;
declare var xdescribe: angularScenario.RunFunctionWithDescription;
declare var beforeEach: angularScenario.RunFunction;
declare var afterEach: angularScenario.RunFunction;
declare var it: angularScenario.RunFunctionWithDescription;
declare var xit: angularScenario.RunFunctionWithDescription;
declare var pause: angularScenario.PauseFunction;
declare var sleep: angularScenario.SleepFunction;
declare function browser(): angularScenario.Browser;
declare function expect(expectation: angularScenario.Future): angularScenario.Expect;
declare var using: angularScenario.UsingFunction;
declare var binding: angularScenario.BindingFunction;
declare function input(ngModelBinding: string): angularScenario.Input;
declare function repeater(selector: string, repeaterDescription?: string): angularScenario.Repeater;
declare function select(ngModelBinding: string): angularScenario.Select;
declare function element(selector: string, elementDescription?: string): angularScenario.Element;
declare var angular: angularScenario.AngularModel;

View File

@@ -0,0 +1 @@
""

View File

@@ -9,161 +9,171 @@ https://github.com/witoldsz/angular-http-auth/blob/master/src/angular-http-auth.
*/
angular.module('http-auth-interceptor', [])
.provider('authService', function () {
/**
* Holds all the requests which failed due to 401 response,
* so they can be re-requested in future, once login is completed.
*/
var buffer = [];
.provider('authService', function () {
/**
* Holds all the requests which failed due to 401 response,
* so they can be re-requested in future, once login is completed.
*/
var buffer = [];
/**
* Required by HTTP interceptor.
* Function is attached to provider to be invisible for regular users of this service.
*/
this.pushToBuffer = function (config: ng.IRequestConfig, deferred: ng.IDeferred) {
buffer.push({
config: config,
deferred: deferred
});
}
/**
* Required by HTTP interceptor.
* Function is attached to provider to be invisible for regular users of this service.
*/
this.pushToBuffer = function (config: ng.IRequestConfig, deferred: ng.IDeferred) {
buffer.push({
config: config,
deferred: deferred
});
}
this.$get = ['$rootScope', '$injector', <any>function ($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) {
var $http: ng.IHttpService; //initialized later because of circular dependency problem
function retry(config: ng.IRequestConfig, deferred: ng.IDeferred) {
$http = $http || $injector.get('$http');
$http(config).then(function (response) {
deferred.resolve(response);
});
}
function retryAll() {
for (var i = 0; i < buffer.length; ++i) {
retry(buffer[i].config, buffer[i].deferred);
}
buffer = [];
}
var $http: ng.IHttpService; //initialized later because of circular dependency problem
function retry(config: ng.IRequestConfig, deferred: ng.IDeferred<any>) {
$http = $http || $injector.get('$http');
$http(config).then(function (response) {
deferred.resolve(response);
});
}
function retryAll() {
for (var i = 0; i < buffer.length; ++i) {
retry(buffer[i].config, buffer[i].deferred);
}
buffer = [];
}
return {
loginConfirmed: function () {
$rootScope.$broadcast('event:auth-loginConfirmed');
retryAll();
}
}
loginConfirmed: function () {
$rootScope.$broadcast('event:auth-loginConfirmed');
retryAll();
}
}
}]
})
/**
* $http interceptor.
* On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'.
*/
.config(['$httpProvider', 'authServiceProvider', <any>function ($httpProvider: ng.IHttpProvider, authServiceProvider) {
/**
* $http interceptor.
* On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'.
*/
.config(['$httpProvider', 'authServiceProvider', <any>function ($httpProvider: ng.IHttpProvider, authServiceProvider) {
var interceptor = ['$rootScope', '$q', <any>function ($rootScope: ng.IScope, $q: ng.IQService) {
function success(response: ng.IHttpPromiseCallbackArg) {
return response;
}
var interceptor = ['$rootScope', '$q', <any>function ($rootScope: ng.IScope, $q: ng.IQService) {
function success(response: ng.IHttpPromiseCallbackArg<any>) {
return response;
}
function error(response: ng.IHttpPromiseCallbackArg) {
if (response.status === 401) {
var deferred = $q.defer();
authServiceProvider.pushToBuffer(response.config, deferred);
$rootScope.$broadcast('event:auth-loginRequired');
return deferred.promise;
}
// otherwise
return $q.reject(response);
}
function error(response: ng.IHttpPromiseCallbackArg<any>) {
if (response.status === 401) {
var deferred = $q.defer();
authServiceProvider.pushToBuffer(response.config, deferred);
$rootScope.$broadcast('event:auth-loginRequired');
return deferred.promise;
}
// otherwise
return $q.reject(response);
}
return function (promise: ng.IHttpPromise) {
return promise.then(success, error);
}
return function (promise: ng.IHttpPromise<any>) {
return promise.then(success, error);
}
}];
$httpProvider.responseInterceptors.push(interceptor);
}]);
$httpProvider.responseInterceptors.push(interceptor);
}]);
module HttpAndRegularPromiseTests {
interface Person {
firstName: string;
lastName: string;
}
interface Person {
firstName: string;
lastName: string;
}
interface ExpectedResponse extends Person {}
interface ExpectedResponse extends Person { }
interface SomeControllerScope extends ng.IScope {
person: Person;
theAnswer: number;
letters: string[];
}
interface SomeControllerScope extends ng.IScope {
person: Person;
theAnswer: number;
letters: string[];
}
interface OurApiPromiseCallbackArg extends ng.IHttpPromiseCallbackArg {
data?: ExpectedResponse;
}
var someController: Function = ($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) => {
$http.get("http://somewhere/some/resource")
.success((data: ExpectedResponse) => {
$scope.person = data;
});
var someController: Function = ($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) => {
$http.get("http://somewhere/some/resource")
.success((data: ExpectedResponse) => {
$scope.person = data;
});
$http.get("http://somewhere/some/resource")
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
// typing lost, so something like
// var i: number = response.data
// would type check
$scope.person = response.data;
});
$http.get("http://somewhere/some/resource")
.then((response: ng.IHttpPromiseCallbackArg) => {
// typing lost, so something like
// var i: number = response.data
// would type check
$scope.person = response.data;
});
$http.get("http://somewhere/some/resource")
.then((response: ng.IHttpPromiseCallbackArg<ExpectedResponse>) => {
// typing lost, so something like
// var i: number = response.data
// would NOT type check
$scope.person = response.data;
});
$http.get("http://somewhere/some/resource")
.then((response: OurApiPromiseCallbackArg) => {
// typing lost, so something like
// var i: number = response.data
// would NOT type check
$scope.person = response.data;
});
var aPromise: ng.IPromise<Person> = $q.when({ firstName: "Jack", lastName: "Sparrow" });
aPromise.then((person: Person) => {
$scope.person = person;
});
var aPromise: ng.IPromise = $q.when({firstName: "Jack", lastName: "Sparrow"});
aPromise.then((person: Person) => {
$scope.person = person;
});
var bPromise: ng.IPromise<number> = $q.when(42);
bPromise.then((answer: number) => {
$scope.theAnswer = answer;
});
var bPromise: ng.IPromise = $q.when(42);
bPromise.then((answer: number) => {
$scope.theAnswer = answer;
});
var cPromise: ng.IPromise<string[]> = $q.when(["a", "b", "c"]);
cPromise.then((letters: string[]) => {
$scope.letters = letters;
});
}
var cPromise: ng.IPromise = $q.when(["a", "b", "c"]);
cPromise.then((letters: string[]) => {
$scope.letters = letters;
});
}
// Test that we can pass around a type-checked success/error Promise Callback
var anotherController: Function = ($scope: SomeControllerScope, $http:
ng.IHttpService, $q: ng.IQService) => {
var buildFooData: Function = () => 42;
var doFoo: Function = (callback: ng.IHttpPromiseCallback<ExpectedResponse>) => {
$http.get('/foo', buildFooData())
.success(callback);
}
doFoo((data) => console.log(data));
}
}
// Test for AngularJS Syntac
// Test for AngularJS Syntax
module My.Namespace {
export var x; // need to export something for module to kick in
}
// IModule Registering Test
var mod = angular.module('tests',[]);
mod.controller('name', function($scope : ng.IScope) {})
mod.controller('name', ['$scope', <any>function($scope : ng.IScope) {}])
var mod = angular.module('tests', []);
mod.controller('name', function ($scope: ng.IScope) { })
mod.controller('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.controller(My.Namespace);
mod.directive('name', <any>function ($scope: ng.IScope) {})
mod.directive('name', ['$scope', <any>function($scope : ng.IScope) {}])
mod.directive('name', <any>function ($scope: ng.IScope) { })
mod.directive('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.directive(My.Namespace);
mod.factory('name', function($scope : ng.IScope) {})
mod.factory('name', ['$scope', <any>function($scope : ng.IScope) {}])
mod.factory('name', function ($scope: ng.IScope) { })
mod.factory('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.factory(My.Namespace);
mod.filter('name', function($scope : ng.IScope) {})
mod.filter('name', ['$scope', <any>function($scope : ng.IScope) {}])
mod.filter('name', function ($scope: ng.IScope) { })
mod.filter('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.filter(My.Namespace);
mod.provider('name', function($scope : ng.IScope) {})
mod.provider('name', ['$scope', <any>function($scope : ng.IScope) {}])
mod.provider('name', function ($scope: ng.IScope) { })
mod.provider('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.provider(My.Namespace);
mod.service('name', function($scope : ng.IScope) {})
mod.service('name', ['$scope', <any>function($scope : ng.IScope) {}])
mod.service('name', function ($scope: ng.IScope) { })
mod.service('name', ['$scope', <any>function ($scope: ng.IScope) { }])
mod.service(My.Namespace);
mod.constant('name', 23);
mod.constant('name', "23");
@@ -171,3 +181,54 @@ mod.constant(My.Namespace);
mod.value('name', 23);
mod.value('name', "23");
mod.value(My.Namespace);
// Promise signature tests
var foo: ng.IPromise<number>;
foo.then((x) => {
// x is inferred to be a number
return "asdf";
}).then((x) => {
// x is inferred to be string
x.length;
return 123;
}).then((x) => {
// x is infered to be a number
x.toFixed();
return;
}).then((x) => {
// x is infered to be void
// Typescript will prevent you to actually use x as a local variable
// Try object:
return { a: 123 };
}).then((x) => {
// Object is inferred here
x.a = 123;
//Try a promise
var y: ng.IPromise<number>;
return y;
}).then((x) => {
// x is infered to be a number, which is the resolved value of a promise
x.toFixed();
});
// angular.element() tests
var element = angular.element("div.myApp");
var scope: ng.IScope = element.scope();
function test_IAttributes(attributes: ng.IAttributes){
return attributes;
}
test_IAttributes({
$addClass: function (classVal){},
$removeClass: function(classVal){},
$set: function(key, value){},
$observe: function(name, fn){
return fn;
},
$attr: {}
});

View File

@@ -0,0 +1 @@
""

317
angularjs/angular.d.ts vendored Normal file → Executable file
View File

@@ -8,6 +8,11 @@
declare var angular: ng.IAngularStatic;
// Support for painless dependency injection
interface Function {
$inject:string[];
}
///////////////////////////////////////////////////////////////////////////////
// ng module (angular.js)
///////////////////////////////////////////////////////////////////////////////
@@ -27,23 +32,24 @@ declare module ng {
bootstrap(element: string, modules?: any[]): auto.IInjectorService;
bootstrap(element: JQuery, modules?: any[]): auto.IInjectorService;
bootstrap(element: Element, modules?: any[]): auto.IInjectorService;
bootstrap(element: Document, modules?: any[]): auto.IInjectorService;
copy(source: any, destination?: any): any;
element: JQueryStatic;
equals(value1: any, value2: any): bool;
element: IAugmentedJQueryStatic;
equals(value1: any, value2: any): boolean;
extend(destination: any, ...sources: any[]): any;
forEach(obj: any, iterator: (value, key) => any, context?: any): any;
forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any;
fromJson(json: string): any;
identity(arg?: any): any;
injector(modules?: any[]): auto.IInjectorService;
isArray(value: any): bool;
isDate(value: any): bool;
isDefined(value: any): bool;
isElement(value: any): bool;
isFunction(value: any): bool;
isNumber(value: any): bool;
isObject(value: any): bool;
isString(value: any): bool;
isUndefined(value: any): bool;
isArray(value: any): boolean;
isDate(value: any): boolean;
isDefined(value: any): boolean;
isElement(value: any): boolean;
isFunction(value: any): boolean;
isNumber(value: any): boolean;
isObject(value: any): boolean;
isString(value: any): boolean;
isUndefined(value: any): boolean;
lowercase(str: string): string;
/** construct your angular application
official docs: Interface for configuring angular modules.
@@ -54,9 +60,9 @@ declare module ng {
name: string,
/** name of modules yours depends on */
requires?: string[],
configFunction?: Function): IModule;
configFunction?: any): IModule;
noop(...args: any[]): void;
toJson(obj: any, pretty?: bool): string;
toJson(obj: any, pretty?: boolean): string;
uppercase(str: string): string;
version: {
full: string;
@@ -75,11 +81,11 @@ declare module ng {
animation(name: string, animationFactory: Function): IModule;
animation(name: string, inlineAnnotadedFunction: any[]): IModule;
animation(object: Object): IModule;
/** configure existing services.
/** configure existing services.
Use this method to register work which needs to be performed on module loading
*/
config(configFn: Function): IModule;
/** configure existing services.
/** configure existing services.
Use this method to register work which needs to be performed on module loading
*/
config(inlineAnnotadedFunction: any[]): IModule;
@@ -88,9 +94,9 @@ declare module ng {
controller(name: string, controllerConstructor: Function): IModule;
controller(name: string, inlineAnnotadedConstructor: any[]): IModule;
controller(object : Object): IModule;
directive(name: string, directiveFactory: (...params:any[])=> IDirective): IModule;
directive(name: string, directiveFactory: Function): IModule;
directive(name: string, inlineAnnotadedFunction: any[]): IModule;
directive(object: Object): IModule;
directive(object: Object): IModule;
factory(name: string, serviceFactoryFunction: Function): IModule;
factory(name: string, inlineAnnotadedFunction: any[]): IModule;
factory(object: Object): IModule;
@@ -118,8 +124,33 @@ declare module ng {
// see http://docs.angularjs.org/api/ng.$compile.directive.Attributes
///////////////////////////////////////////////////////////////////////////
interface IAttributes {
$set(name: string, value: any): void;
$attr: any;
// 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.
$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.
$removeClass(classVal: string): void;
// 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.
$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.
$attr: Object;
}
///////////////////////////////////////////////////////////////////////////
@@ -127,11 +158,15 @@ declare module ng {
// see http://docs.angularjs.org/api/ng.directive:form.FormController
///////////////////////////////////////////////////////////////////////////
interface IFormController {
$pristine: bool;
$dirty: bool;
$valid: bool;
$invalid: bool;
$pristine: boolean;
$dirty: boolean;
$valid: boolean;
$invalid: boolean;
$error: any;
$addControl(control: ng.INgModelController): void;
$removeControl(control: ng.INgModelController): void;
$setDirty(): void;
$setPristine(): void;
}
///////////////////////////////////////////////////////////////////////////
@@ -140,24 +175,21 @@ declare module ng {
///////////////////////////////////////////////////////////////////////////
interface INgModelController {
$render(): void;
$setValidity(validationErrorKey: string, isValid: bool): void;
$setViewValue(value: string): void;
// XXX Not sure about the types here. Documentation states it's a string, but
// I've seen it receiving other types throughout the code.
// Falling back to any for now.
$setValidity(validationErrorKey: string, isValid: boolean): void;
// Documentation states viewValue and modelValue to be a string but other
// types do work and it's common to use them.
$setViewValue(value: any): void;
$viewValue: any;
// XXX Same as avove
$modelValue: any;
$parsers: IModelParser[];
$formatters: IModelFormatter[];
$error: any;
$pristine: bool;
$dirty: bool;
$valid: bool;
$invalid: bool;
$pristine: boolean;
$dirty: boolean;
$valid: boolean;
$invalid: boolean;
}
interface IModelParser {
@@ -183,24 +215,33 @@ declare module ng {
$emit(name: string, ...args: any[]): IAngularEvent;
// Documentation says exp is optional, but actual implementaton counts on it
$eval(expression: string): any;
$eval(expression: (scope: IScope) => any): any;
$eval(expression: string, args?: Object): any;
$eval(expression: (scope: IScope) => any, args?: Object): any;
// Documentation says exp is optional, but actual implementaton counts on it
$evalAsync(expression: string): void;
$evalAsync(expression: (scope: IScope) => any): void;
// Defaults to false by the implementation checking strategy
$new(isolate?: bool): IScope;
$new(isolate?: boolean): IScope;
$on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function;
$watch(watchExpression: string, listener?: string, objectEquality?: bool): Function;
$watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: bool): Function;
$watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: bool): Function;
$watch(watchExpression: (scope: IScope) => any, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: bool): Function;
$watch(watchExpression: string, listener?: string, objectEquality?: boolean): Function;
$watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function;
$watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: boolean): Function;
$watch(watchExpression: (scope: IScope) => any, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: boolean): Function;
$watchCollection(watchExpression: string, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
$watchCollection(watchExpression: (scope: IScope) => any, listener: (newValue: any, oldValue: any, scope: IScope) => any): Function;
$parent: IScope;
$id: number;
// Hidden members
$$isolateBindings: any;
$$phase: any;
}
interface IAngularEvent {
@@ -208,7 +249,7 @@ declare module ng {
currentScope: IScope;
name: string;
preventDefault: Function;
defaultPrevented: bool;
defaultPrevented: boolean;
// Available only events that were $emit-ted
stopPropagation?: Function;
@@ -231,8 +272,17 @@ declare module ng {
// see http://docs.angularjs.org/api/ng.$timeout
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
(func: Function, delay?: number, invokeApply?: bool): IPromise;
cancel(promise: IPromise): bool;
(func: Function, delay?: number, invokeApply?: boolean): IPromise<any>;
cancel(promise: IPromise<any>): boolean;
}
///////////////////////////////////////////////////////////////////////////
// IntervalService
// see http://docs.angularjs.org/api/ng.$interval
///////////////////////////////////////////////////////////////////////////
interface IIntervalService {
(func: Function, delay: number, count?: number, invokeApply?: boolean): IPromise<any>;
cancel(promise: IPromise<any>): boolean;
}
///////////////////////////////////////////////////////////////////////////
@@ -302,6 +352,7 @@ declare module ng {
// see http://docs.angularjs.org/api/ng.$log
///////////////////////////////////////////////////////////////////////////
interface ILogService {
debug: ILogCall;
error: ILogCall;
info: ILogCall;
log: ILogCall;
@@ -347,7 +398,7 @@ declare module ng {
port(): number;
protocol(): string;
replace(): ILocationService;
search(): string;
search(): any;
search(parametersMap: any): ILocationService;
search(parameter: string, parameterValue: any): ILocationService;
url(): string;
@@ -357,12 +408,12 @@ declare module ng {
interface ILocationProvider extends IServiceProvider {
hashPrefix(): string;
hashPrefix(prefix: string): ILocationProvider;
html5Mode(): bool;
html5Mode(): boolean;
// Documentation states that parameter is string, but
// implementation tests it as boolean, which makes more sense
// since this is a toggler
html5Mode(active: bool): ILocationProvider;
html5Mode(active: boolean): ILocationProvider;
}
///////////////////////////////////////////////////////////////////////////
@@ -390,20 +441,22 @@ declare module ng {
// see http://docs.angularjs.org/api/ng.$q
///////////////////////////////////////////////////////////////////////////
interface IQService {
all(promises: IPromise[]): IPromise;
defer(): IDeferred;
reject(reason?: any): IPromise;
when(value: any): IPromise;
all(promises: IPromise<any>[]): IPromise<any[]>;
defer<T>(): IDeferred<T>;
reject(reason?: any): IPromise<void>;
when<T>(value: T): IPromise<T>;
}
interface IPromise {
then(successCallback: (promiseValue: any) => any, errorCallback?: (reason: any) => any): IPromise;
interface IPromise<T> {
then<TResult>(successCallback: (promiseValue: T) => IHttpPromise<TResult>, errorCallback?: (reason: any) => any): IPromise<TResult>;
then<TResult>(successCallback: (promiseValue: T) => IPromise<TResult>, errorCallback?: (reason: any) => any): IPromise<TResult>;
then<TResult>(successCallback: (promiseValue: T) => TResult, errorCallback?: (reason: any) => TResult): IPromise<TResult>;
}
interface IDeferred {
resolve(value?: any): void;
interface IDeferred<T> {
resolve(value?: T): void;
reject(reason?: any): void;
promise: IPromise;
promise: IPromise<T>;
}
///////////////////////////////////////////////////////////////////////////
@@ -483,7 +536,7 @@ declare module ng {
(controllerName: string, locals?: any): any;
}
interface IControlerProvider extends IServiceProvider {
interface IControllerProvider extends IServiceProvider {
register(name: string, controllerConstructor: Function): void;
register(name: string, dependencyAnnotadedConstructor: any[]): void;
}
@@ -494,21 +547,21 @@ declare module ng {
///////////////////////////////////////////////////////////////////////////
interface IHttpService {
// At least moethod and url must be provided...
(config: IRequestConfig): IHttpPromise;
get (url: string, RequestConfig?: any): IHttpPromise;
delete (url: string, RequestConfig?: any): IHttpPromise;
head(url: string, RequestConfig?: any): IHttpPromise;
jsonp(url: string, RequestConfig?: any): IHttpPromise;
post(url: string, data: any, RequestConfig?: any): IHttpPromise;
put(url: string, data: any, RequestConfig?: any): IHttpPromise;
(config: IRequestConfig): IHttpPromise<any>;
get (url: string, RequestConfig?: any): IHttpPromise<any>;
delete (url: string, RequestConfig?: any): IHttpPromise<any>;
head(url: string, RequestConfig?: any): IHttpPromise<any>;
jsonp(url: string, RequestConfig?: any): IHttpPromise<any>;
post(url: string, data: any, RequestConfig?: any): IHttpPromise<any>;
put(url: string, data: any, RequestConfig?: any): IHttpPromise<any>;
defaults: IRequestConfig;
// For debugging, BUT it is documented as public, so...
pendingRequests: any[];
}
// This is just for hinting.
// Some opetions might not be available depending on the request.
// This is just for hinting.
// Some opetions might not be available depending on the request.
// see http://docs.angularjs.org/api/ng.$http#Usage for options explanations
interface IRequestConfig {
method: string;
@@ -520,7 +573,7 @@ declare module ng {
cache?: any;
timeout?: number;
withCredentials?: bool;
withCredentials?: boolean;
// These accept multiple types, so let's defile them as any
data?: any;
@@ -528,21 +581,27 @@ declare module ng {
transformResponse?: any;
}
interface IHttpPromiseCallbackArg {
data?: any;
interface IHttpPromiseCallback<T> {
(data: T, status: number, headers: (headerName: string) => string, config: IRequestConfig): void;
}
interface IHttpPromiseCallbackArg<T> {
data?: T;
status?: number;
headers?: (headerName: string) => string;
config?: IRequestConfig;
}
interface IHttpPromise extends IPromise {
success(callback: (data: any, status: number, headers: (headerName: string) => string, config: IRequestConfig) => any): IHttpPromise;
error(callback: (data: any, status: number, headers: (headerName: string) => string, config: IRequestConfig) => any): IHttpPromise;
then(successCallback: (response: IHttpPromiseCallbackArg) => any, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise;
interface IHttpPromise<T> extends IPromise<T> {
success(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
error(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
then<TResult>(successCallback: (response: IHttpPromiseCallbackArg<T>) => TResult, errorCallback?: (response: IHttpPromiseCallbackArg<T>) => any): IPromise<TResult>;
then<TResult>(successCallback: (response: IHttpPromiseCallbackArg<T>) => IPromise<TResult>, errorCallback?: (response: IHttpPromiseCallbackArg<T>) => any): IPromise<TResult>;
}
interface IHttpProvider extends IServiceProvider {
defaults: IRequestConfig;
interceptors: any[];
responseInterceptors: any[];
}
@@ -553,7 +612,7 @@ declare module ng {
///////////////////////////////////////////////////////////////////////////
interface IHttpBackendService {
// XXX Perhaps define callback signature in the future
(method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: bool): void;
(method: string, url: string, post?: any, callback?: Function, headers?: any, timeout?: number, withCredentials?: boolean): void;
}
///////////////////////////////////////////////////////////////////////////
@@ -562,7 +621,7 @@ declare module ng {
// see http://docs.angularjs.org/api/ng.$interpolateProvider
///////////////////////////////////////////////////////////////////////////
interface IInterpolateService {
(text: string, mustHaveExpression?: bool): IInterpolationFunction;
(text: string, mustHaveExpression?: boolean): IInterpolationFunction;
endSymbol(): string;
startSymbol(): string;
}
@@ -578,12 +637,6 @@ declare module ng {
endSymbol(value: string): IInterpolateProvider;
}
///////////////////////////////////////////////////////////////////////////
// RouteParamsService
// see http://docs.angularjs.org/api/ng.$routeParams
///////////////////////////////////////////////////////////////////////////
interface IRouteParamsService {}
///////////////////////////////////////////////////////////////////////////
// TemplateCacheService
// see http://docs.angularjs.org/api/ng.$templateCache
@@ -596,43 +649,6 @@ declare module ng {
///////////////////////////////////////////////////////////////////////////
interface IRootScopeService extends IScope {}
///////////////////////////////////////////////////////////////////////////
// RouteService
// see http://docs.angularjs.org/api/ng.$route
// see http://docs.angularjs.org/api/ng.$routeProvider
///////////////////////////////////////////////////////////////////////////
interface IRouteService {
reload(): void;
routes: any;
// May not always be available. For instance, current will not be available
// to a controller that was not initialized as a result of a route maching.
current?: ICurrentRoute;
}
// see http://docs.angularjs.org/api/ng.$routeProvider#when for options explanations
interface IRoute {
controller?: any;
template?: string;
templateUrl?: string;
resolve?: any;
redirectTo?: any;
reloadOnSearch?: bool;
}
// see http://docs.angularjs.org/api/ng.$route#current
interface ICurrentRoute extends IRoute {
locals: {
$scope: IScope;
$template: string;
};
}
interface IRouteProvider extends IServiceProvider {
otherwise(params: any): IRouteProvider;
when(path: string, route: IRoute): IRouteProvider;
}
///////////////////////////////////////////////////////////////////////////
// Directive
// see http://docs.angularjs.org/api/ng.$compileProvider#directive
@@ -640,15 +656,65 @@ declare module ng {
///////////////////////////////////////////////////////////////////////////
interface IDirective{
compile?:
(templateElement: any,
templateAttributes: IAttributes,
transclude: (scope: IScope, cloneLinkingFn: Function) => void
) => any;
controller?: any;
controllerAs?: string;
link?:
(scope: IScope,
instanceElement: any,
instanceAttributes: IAttributes,
controller: any
) => void;
name?: string;
priority?: number;
template?: string;
templateUrl?: string;
replace?: bool;
transclude?: bool;
replace?: boolean;
require?: any;
restrict?: string;
scope?: any;
link?: Function;
compile?: Function;
template?: any;
templateUrl?: any;
terminal?: boolean;
transclude?: any;
}
///////////////////////////////////////////////////////////////////////////
// angular.element
// when calling angular.element, angular returns a jQuery object,
// augmented with additional methods like e.g. scope.
// see: http://docs.angularjs.org/api/angular.element
///////////////////////////////////////////////////////////////////////////
interface IAugmentedJQueryStatic extends JQueryStatic {
(selector: string, context?: any): IAugmentedJQuery;
(element: Element): IAugmentedJQuery;
(object: {}): IAugmentedJQuery;
(elementArray: Element[]): IAugmentedJQuery;
(object: JQuery): IAugmentedJQuery;
(func: Function): IAugmentedJQuery;
(array: any[]): IAugmentedJQuery;
(): IAugmentedJQuery;
}
interface IAugmentedJQuery extends JQuery {
// TODO: events, how to define?
//$destroy
find(selector: string): IAugmentedJQuery;
find(element: any): IAugmentedJQuery;
find(obj: JQuery): IAugmentedJQuery;
controller(name: string): any;
injector(): any;
scope(): IScope;
inheritedData(key: string, value: any): JQuery;
inheritedData(obj: { [key: string]: any; }): JQuery;
inheritedData(key?: string): any;
}
@@ -680,6 +746,7 @@ declare module ng {
constant(name: string, value: any): void;
decorator(name: string, decorator: Function): void;
decorator(name: string, decoratorInline: any[]): void;
factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider;
provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider;
provider(name: string, serviceProviderConstructor: Function): ng.IServiceProvider;

View File

@@ -0,0 +1,630 @@
/// <reference path="appframework.d.ts" />
af(($: appFrameworkStatic) => {});
((): appFrameworkCollection => {
return $('div'); //=> all DIV elements on the page
})();
((): appFrameworkCollection => {
return $("<p />", {}); // context
})();
((): appFrameworkCollection => {
return $($('')); // appFrameworkCollection
})();
((): appFrameworkCollection => {
return $(document.createElement('div')); // HTMLElement
})();
((): appFrameworkCollection => {
return $({}); // Object(any)
})();
((): boolean => {
return $.is$($(''));
})();
((): boolean[] => {
return $.map([], (item: any, index: number): boolean => {
return true;
});
})();
$.each([], (index: number, item: any) => { });
$.each({}, (key: string, value: any) => { });
((): Object => {
return $.extend({ one: 'patridge' }, { two: 'turtle doves' });
})();
((): boolean => {
return $.isArray({});
})();
((): boolean => {
return $.isFunction({});
})();
((): boolean => {
return $.isObject({});
})();
((): Object => {
return $.fn;
})();
((): Object => {
return $.ajaxSettings;
})();
$.jsonP({});
((): XMLHttpRequest => {
return $.ajax({});
})();
((): XMLHttpRequest => {
return $.get('', (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): XMLHttpRequest => {
return $.post('', (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): XMLHttpRequest => {
return $.post('', {}, (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): XMLHttpRequest => {
return $.getJSON('', (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): XMLHttpRequest => {
return $.getJSON('', {}, (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): string => {
return $.param({});
})();
((): string => {
return $.param({}, '');
})();
((): Object => {
return $.parseJSON('');
})();
((): Object => {
return $.parseXML('');
})();
((): string => {
return $.uuid();
})();
((): Object => {
return $.getCssMatrix(document.createElement('div'));
})();
((): Object => {
return $.getCssMatrix($(''));
})();
((): appFrameworkCollection => {
return $.create('');
})();
((): appFrameworkCollection => {
return $.create('', {});
})();
((): appFrameworkCollection => {
return $.query('');
})();
((): appFrameworkCollection => {
return $.query('', {});
})();
((): Object => {
return $.Event('', {});
})();
((): void => {
return $.bind({}, '', () => {});
})();
((): void => {
return $.trigger({}, '');
})();
((): void => {
return $.trigger({}, '', []);
})();
((): void => {
return $.unbind({}, '', () => {});
})();
((): void => {
return $.proxy(() => {}, {});
})();
((): void => {
return $.cleanUpContent(document.createElement('div'), false, false);
})();
((): void => {
return $.asap(() => {});
})();
((): void => {
return $.asap(() => {}, {});
})();
((): void => {
return $.asap(() => {}, {}, []);
})();
((): void => {
return $.parseJS('');
})();
((): void => {
return $.parseJS(document.createElement('div'));
})();
$.os.webkit;
$.os.android;
$.os.androidICS;
$.os.ipad;
$.os.iphone;
$.os.ios7;
$.os.webos;
$.os.touchpad;
$.os.ios;
$.os.playbook;
$.os.blackberry;
$.os.blackberry10;
$.os.chrome;
$.os.opera;
$.os.fennec;
$.os.ie;
$.os.ieTouch;
$.os.supportsTouch;
$.feat.nativeTouchScroll;
$.feat.cssPrefix;
$.feat.cssTransformStart;
$.feat.cssTransformEnd;
((): appFrameworkCollection => {
return $('').reduce((hoge) => { return hoge; });
})();
((): number => {
return $('').push($(''));
})();
((): number => {
return $('').indexOf($(''));
})();
((): appFrameworkCollection[] => {
return $('').concat($(''));
})();
((): appFrameworkCollection[] => {
return $('').slice(0);
})();
((): number => {
return $('').length;
})();
((): appFrameworkCollection => {
return $('').map(() => {});
})();
((): appFrameworkCollection => {
return $('').each(() => {});
})();
((): void => {
return $('').forEach(() => {});
})();
((): appFrameworkStatic => {
return $('').ready(() => {});
})();
((): appFrameworkCollection => {
return $('').find('');
})();
((): string => {
return $('').html();
})();
((): appFrameworkCollection => {
return $('').html('');
})();
((): appFrameworkCollection => {
return $('').html('', false);
})();
((): string => {
return $('').text();
})();
((): appFrameworkCollection => {
return $('').text('');
})();
(() => {
return $('').css('');
})();
((): appFrameworkCollection => {
return $('').css('', '');
})();
((): appFrameworkCollection => {
return $('').css({});
})();
((): appFrameworkCollection => {
return $('').vendorCss('');
})();
((): appFrameworkCollection => {
return $('').computedStyle('');
})();
((): appFrameworkCollection => {
return $('').empty();
})();
((): appFrameworkCollection => {
return $('').hide();
})();
((): appFrameworkCollection => {
return $('').show();
})();
((): appFrameworkCollection => {
return $('').toggle();
})();
((): string => {
return $('').val();
})();
((): appFrameworkCollection => {
return $('').val('');
})();
((): string => {
return $('').attr('');
})();
((): appFrameworkCollection => {
return $('').attr({});
})();
((): appFrameworkCollection => {
return $('').attr('', '');
})();
((): appFrameworkCollection => {
return $('').attr('', {});
})();
((): appFrameworkCollection => {
return $('').removeAttr('');
})();
((): string => {
return $('').prop('');
})();
((): appFrameworkCollection => {
return $('').prop({});
})();
((): appFrameworkCollection => {
return $('').prop('', '');
})();
((): appFrameworkCollection => {
return $('').prop('', {});
})();
((): appFrameworkCollection => {
return $('').removeProp('');
})();
((): appFrameworkCollection => {
return $('').remove();
})();
((): appFrameworkCollection => {
return $('').remove('');
})();
((): appFrameworkCollection => {
return $('').remove(document.createElement('div'));
})();
((): appFrameworkCollection => {
return $('').remove($(''));
})();
((): appFrameworkCollection => {
return $('').addClass('');
})();
((): appFrameworkCollection => {
return $('').removeClass('');
})();
((): appFrameworkCollection => {
return $('').toggleClass('');
})();
((): appFrameworkCollection => {
return $('').replaceClass('', '');
})();
((): boolean => {
return $('').hasClass('', document.createElement('div'));
})();
((): appFrameworkCollection => {
return $('').append('');
})();
((): appFrameworkCollection => {
return $('').appendTo('');
})();
((): appFrameworkCollection => {
return $('').prependTo('');
})();
((): appFrameworkCollection => {
return $('').prepend('');
})();
((): appFrameworkCollection => {
return $('').insertBefore('');
})();
((): void => {
return $('').insertAfter('');
})();
((): HTMLElement[] => {
return $('').get();
})();
((): HTMLElement => {
return $('').get(0);
})();
((): {
left: number;
top: number;
right: number;
bottom: number;
width: number;
height: number;
} => {
return $('').offset();
})();
((): string => {
return $('').height();
})();
((): string => {
return $('').width();
})();
((): appFrameworkCollection => {
return $('').parent();
})();
((): appFrameworkCollection => {
return $('').parents();
})();
((): appFrameworkCollection => {
return $('').children();
})();
((): appFrameworkCollection => {
return $('').siblings();
})();
((): appFrameworkCollection => {
return $('').closest();
})();
((): appFrameworkCollection => {
return $('').filter();
})();
((): appFrameworkCollection => {
return $('').not();
})();
((): any => {
return $('').data('');
})();
((): appFrameworkCollection => {
return $('').data('', '');
})();
((): appFrameworkCollection => {
return $('').data('', {});
})();
((): appFrameworkCollection => {
return $('').end();
})();
((): appFrameworkCollection => {
return $('').clone();
})();
((): number => {
return $('').size();
})();
((): string => {
return $('').serialize();
})();
((): appFrameworkCollection => {
return $('').eq(0);
})();
((): number => {
return $('').index();
})();
((): number => {
return $('').index('');
})();
((): number => {
return $('').is('');
})();
((): appFrameworkCollection => {
return $('').bind({});
})();
((): appFrameworkCollection => {
return $('').bind('', () => {});
})();
((): appFrameworkCollection => {
return $('').unbind({});
})();
((): appFrameworkCollection => {
return $('').unbind();
})();
((): appFrameworkCollection => {
return $('').unbind('', () => {});
})();
((): appFrameworkCollection => {
return $('').one({});
})();
((): appFrameworkCollection => {
return $('').one('', () => {});
})();
((): appFrameworkCollection => {
return $('').delegate('', {});
})();
((): appFrameworkCollection => {
return $('').delegate('', '', () => {});
})();
((): appFrameworkCollection => {
return $('').undelegate('', {});
})();
((): appFrameworkCollection => {
return $('').undelegate('', '', () => {});
})();
((): appFrameworkCollection => {
return $('').on({});
})();
((): appFrameworkCollection => {
return $('').on('', () => {});
})();
((): appFrameworkCollection => {
return $('').on('', '', () => {});
})();
((): appFrameworkCollection => {
return $('').off({});
})();
((): appFrameworkCollection => {
return $('').off('', () => {});
})();
((): appFrameworkCollection => {
return $('').off('', '', () => {});
})();
((): appFrameworkCollection => {
return $('').trigger('');
})();
((): appFrameworkCollection => {
return $('').trigger({});
})();
((): appFrameworkCollection => {
return $('').click();
})();
((): appFrameworkCollection => {
return $('').click(() => {});
})();
((): appFrameworkCollection => {
return $('').keydown();
})();
((): appFrameworkCollection => {
return $('').keydown(() => {});
})();
((): appFrameworkCollection => {
return $('').keyup();
})();
((): appFrameworkCollection => {
return $('').keyup(() => {});
})();
((): appFrameworkCollection => {
return $('').keypress();
})();
((): appFrameworkCollection => {
return $('').keypress(() => {});
})();
((): appFrameworkCollection => {
return $('').submit();
})();
((): appFrameworkCollection => {
return $('').submit(() => {});
})();
((): appFrameworkCollection => {
return $('').load();
})();
((): appFrameworkCollection => {
return $('').load(() => {});
})();
((): appFrameworkCollection => {
return $('').resize();
})();
((): appFrameworkCollection => {
return $('').resize(() => {});
})();
((): appFrameworkCollection => {
return $('').change();
})();
((): appFrameworkCollection => {
return $('').change(() => {});
})();
((): appFrameworkCollection => {
return $('').select();
})();
((): appFrameworkCollection => {
return $('').select(() => {});
})();
((): appFrameworkCollection => {
return $('').error();
})();
((): appFrameworkCollection => {
return $('').error(() => {});
})();
((): appFrameworkCollection => {
return $('').focus();
})();
((): appFrameworkCollection => {
return $('').focus(() => {});
})();
((): appFrameworkCollection => {
return $('').blur();
})();
((): appFrameworkCollection => {
return $('').blur(() => {});
})();

1318
appframework/appframework.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

8
async/async.d.ts vendored
View File

@@ -13,7 +13,7 @@ interface AsyncWorker<T> { (task: T, callback: Function): void; }
interface AsyncQueue<T> {
length(): number;
concurrency: number;
push(task: T, callback: AsyncMultipleResultsCallback<T>): void;
push(task: T, callback?: AsyncMultipleResultsCallback<T>): void;
saturated: AsyncMultipleResultsCallback<T>;
empty: AsyncMultipleResultsCallback<T>;
drain: AsyncMultipleResultsCallback<T>;
@@ -75,4 +75,8 @@ interface Async {
noConflict(): Async;
}
declare var async: Async;
declare var async: Async;
declare module "async" {
export = async;
}

View File

@@ -0,0 +1 @@
""

3
async/asyncamd-tests.ts Normal file
View File

@@ -0,0 +1,3 @@
import async = require("async");
async.map(["a", "b", "c"], (item, cb) => cb(null, [item.toUpperCase()]), (err, results) => { });

View File

@@ -0,0 +1 @@
""

View File

@@ -17,7 +17,7 @@ if (client.currentUser === null) {
//define an interface that map to server side Table data
interface TodoItem { id?: number; text?: string; complete?: bool; }
interface TodoItem { id?: number; text?: string; complete?: boolean; }
var data: TodoItem[];
var tableTodoItems = client.getTable('todoitem');

View File

@@ -75,7 +75,7 @@ declare module Microsoft.WindowsAzure {
select(...propNameSelected: string[]): IQuery;
select(funcProjectionFromThis: () => any): IQuery;
where(mapObjFilterCriteria: any): IQuery;
where(funcPredicateOnThis: (...qParams: any[]) => bool, ...qValues: any[]): IQuery;
where(funcPredicateOnThis: (...qParams: any[]) => boolean, ...qValues: any[]): IQuery;
skip(n: number): IQuery;
take(n: number): IQuery;
includeTotalCount(): IQuery;

View File

@@ -0,0 +1 @@
""

View File

@@ -28,7 +28,7 @@ declare module Backbone {
getRelations():Relation[];
fetchRelated(key:string, options?:any, update?:bool):any;
fetchRelated(key:string, options?:any, update?:boolean):any;
toJSON():any;
@@ -54,7 +54,7 @@ declare module Backbone {
reverseRelation:any;
related:any;
checkPreconditions():bool;
checkPreconditions():boolean;
setRelated(related:Model):void;
@@ -135,9 +135,9 @@ declare module Backbone {
processOrphanRelations():void;
retroFitRelation(relation:RelationalModel, create:bool):Collection;
retroFitRelation(relation:RelationalModel, create:boolean):Collection;
getCollection(type:RelationalModel, create:bool):Collection;
getCollection(type:RelationalModel, create:boolean):Collection;
getObjectByName(name:string):any;

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -67,16 +67,16 @@ declare module Backbone {
}
class Events {
on(eventName: string, callback: (...args: any[]) => void , context?: any): any;
off(eventName?: string, callback?: (...args: any[]) => void , context?: any): any;
on(eventName: any, callback?: Function, context?: any): any;
off(eventName?: string, callback?: Function, context?: any): any;
trigger(eventName: string, ...args: any[]): any;
bind(eventName: string, callback: (...args: any[]) => void , context?: any): any;
unbind(eventName?: string, callback?: (...args: any[]) => void , context?: any): any;
bind(eventName: string, callback: Function, context?: any): any;
unbind(eventName?: string, callback?: Function, context?: any): any;
once(events: string, callback: (...args: any[]) => void , context?: any): any;
listenTo(object: any, events: string, callback: (...args: any[]) => void ): any;
listenToOnce(object: any, events: string, callback: (...args: any[]) => void ): any;
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void ): any;
once(events: string, callback: Function, context?: any): any;
listenTo(object: any, events: string, callback: Function): any;
listenToOnce(object: any, events: string, callback: Function): any;
stopListening(object?: any, events?: string, callback?: Function): any;
}
class ModelBase extends Events {
@@ -86,7 +86,11 @@ declare module Backbone {
sync(...arg: any[]): JQueryXHR;
}
class Model extends ModelBase {
interface OptionalDefaults {
defaults?(): any;
}
class Model extends ModelBase implements OptionalDefaults {
static extend(properties: any, classProperties?: any): any; // do not use, prefer TypeScript's extend functionality
@@ -111,7 +115,6 @@ declare module Backbone {
changedAttributes(attributes?: any): any[];
clear(options?: Silenceable);
clone(): Model;
defaults(): any;
destroy(options?: ModelDestroyOptions);
escape(attribute: string);
has(attribute: string): boolean;
@@ -151,9 +154,8 @@ declare module Backbone {
fetch(options?: CollectionFetchOptions): JQueryXHR;
comparator(element: Model): number;
comparator(element: Model): string;
comparator(compare: Model, to?: Model): number;
comparator(element: Model): any;
comparator(compare: Model, to?: Model): any;
add(model: Model, options?: AddOptions);
add(models: Model[], options?: AddOptions);
@@ -236,15 +238,17 @@ declare module Backbone {
zip(...model: Model[]): Model[];
}
class Router extends Events {
interface OptionalRoutes {
routes?(): any;
}
class Router extends Events implements OptionalRoutes {
static extend(properties: any, classProperties?: any): any; // do not use, prefer TypeScript's extend functionality
routes: any;
constructor(options?: RouterOptions);
initialize(options?: RouterOptions);
route(route: string, name: string, callback?: (...parameter: any[]) => void );
route(route: string, name: string, callback?: Function);
navigate(fragment: string, options?: NavigateOptions);
navigate(fragment: string, trigger?: boolean);
@@ -265,13 +269,13 @@ declare module Backbone {
getHash(window?: Window): string;
getFragment(fragment?: string, forcePushState?: boolean): string;
stop(): void;
route(route: string, callback: (...args: any[]) => void );
route(route: string, callback: Function);
checkUrl(e?: any): void;
loadUrl(fragmentOverride: string): boolean;
navigate(fragment: string, options?: any);
started: boolean;
_updateHash(location: Location, fragment: string, replace: bool);
_updateHash(location: Location, fragment: string, replace: boolean);
}
interface ViewOptions {
@@ -284,7 +288,11 @@ declare module Backbone {
attributes?: any[];
}
class View extends Events {
interface OptionalEvents {
events?(): any;
}
class View extends Events implements OptionalEvents {
static extend(properties: any, classProperties?: any): any; // do not use, prefer TypeScript's extend functionality
@@ -295,11 +303,12 @@ declare module Backbone {
collection: Collection;
make(tagName: string, attrs?, opts?): View;
setElement(element: HTMLElement, delegate?: boolean);
setElement(element: JQuery, delegate?: boolean);
id: string;
cid: string;
className: string;
tagName: string;
events: any;
options: any;
el: any;
$el: JQuery;
@@ -330,4 +339,3 @@ declare module Backbone {
function setDomLibrary(jQueryNew);
}

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1,78 @@
/// <reference path="backgrid.d.ts" />
/// <reference path="../backbone/backbone.d.ts" />
/// <reference path="../jquery/jquery.d.ts" />
/*
Uses getters and setters and requires ES >= 5
$ tsc --target ES5 backgrid-tests.ts
*/
class TestModel extends Backbone.Model {
get Id(): number { return this.get('id'); }
set Id(value: number) { this.set('id', value); }
get FirstName(): string { return this.get('FirstName'); }
set FirstName(value: string) { this.set('FirstName', value); }
set LastName(value: string) { this.set('LastName', value); }
get LastName(): string { return this.get('LastName'); }
set EMail(value: string) { this.set('EMail', value); }
get EMail(): string { return this.get('EMail'); }
}
class TestCollection extends Backbone.Collection {
constructor(models?: any, options?: any) {
this.model = TestModel;
super(models, options);
}
initialize() {
this.on("change", this.modelChanged, this)
}
modelChanged(model: Backbone.Model, val: any, options: any){
model.save();
}
}
class TestView extends Backbone.View {
gridView: Backgrid.Grid;
testCollection: TestCollection;
constructor(viewOptions?: Backbone.ViewOptions) {
this.testCollection = new TestCollection();
this.gridView = new Backgrid.Grid({
columns: [new Backgrid.Column({name: "FirstName", cell: "string", label: "First Name"}),
new Backgrid.Column({name: "LastName", cell: "string", label: "Last Name"}),
new Backgrid.Column({name: "EMail", cell: "string", label: "E-Mail"})],
collection:this.testCollection,
});
super(viewOptions);
}
initialize() {
}
render() {
this.$el.empty();
this.$el.append(this.gridView.render().$el);
//this.testCollection.fetch();
return this;
}
}
function test_grid() {
var view = new TestView();
view.render();
}

View File

@@ -0,0 +1 @@
--target ES5

85
backgrid/backgrid.d.ts vendored Normal file
View File

@@ -0,0 +1,85 @@
// Type definitions for Backgrid 0.2.6
// Project: http://backgridjs.com/
// Definitions by: Jeremy Lujan <https://github.com/jlujan/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../backbone/backbone.d.ts" />
declare module Backgrid {
interface GridOptions {
columns: Column[];
collection: Backbone.Collection;
header: Header;
body: Body;
row: Row;
footer: Footer;
}
class Header extends Backbone.View {
}
class Footer extends Backbone.View {
}
class Row extends Backbone.View {
}
class Command {
cancel();
moveDown();
moveLeft();
moveRight();
moveUp();
passThru();
save();
}
interface ColumnAttr {
name: string;
cell: string;
headerCell: string;
label: string;
sortable: boolean;
editable: boolean;
renderable: boolean;
formater: string;
}
class Column extends Backbone.Model {
initialize(options?: any);
}
class Body extends Backbone.View {
tagName: string;
initialize(options?: any);
insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any);
moveToNextCell(model: Backbone.Model, cell: Column, command: Command);
refresh(): Body;
remove(): Body;
removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any);
render(): Body;
}
class Grid extends Backbone.View {
body: Backgrid.Body;
className: string;
footer: any;
header: any;
tagName: string;
initialize(options: any);
getSelectedModels(): Backbone.Model[];
insertColumn(...options: any[]): Grid;
insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any);
remove():Grid;
removeColumn(...options: any[]): Grid;
removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any);
render():Grid;
}
}

View File

@@ -0,0 +1 @@
""

View File

@@ -12,15 +12,15 @@
* Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
*/
module BgiFrame {
declare module BgiFrame {
interface ISettings {
top: string;
left: string;
width: string;
height: string;
opacity: bool;
opacity: boolean;
src: string;
conditional: bool;
conditional: boolean;
}
interface IBgiframe {

View File

@@ -23,21 +23,21 @@ interface BootboxHandler {
interface BootboxOption {
header: string;
headerCloseButton: bool;
headerCloseButton: boolean;
}
interface BootboxStatic {
alert(message: string, callback: () => void): void;
alert(message: string, customButtonText?: string, callback?: () => void): void;
confirm(message: string, callback: (result: bool) => void): void;
confirm(message: string, cancelButtonText?: string, confirmButtonText?: string, callback?: (result: bool) => void): void;
confirm(message: string, callback: (result: boolean) => void): void;
confirm(message: string, cancelButtonText?: string, confirmButtonText?: string, callback?: (result: boolean) => void): void;
prompt(message: string, callback: (result: string) => void, defaultValue?: string): void;
prompt(message: string, cancelButtonText?: string, confirmButtonText?: string, callback?: (result: string) => void, defaultValue?: string): void;
dialog(message: string, handlers: BootboxHandler[], options?: any): void;
dialog(message: string, handler: BootboxHandler): void;
dialog(message: string): void;
hideAll(): void;
animate(shouldAnimate: bool): void;
animate(shouldAnimate: boolean): void;
backdrop(backdropValue: string): void;
classes(customCssClasses: string): void;
setIcons(icons: BootboxIcons): void;

View File

@@ -13,9 +13,9 @@ interface NotifyOptions {
type?: string;
/**
Allow alert to be closable through a close icon.
@param {bool} closable
@param {boolean} closable
*/
closable?: bool;
closable?: boolean;
/**
Alert transition, pretty sure only fade is supported, you can try others if you wish.
@param {string} transition
@@ -44,7 +44,7 @@ interface NotifyOptions {
}
interface NotifyFadeOutSettings {
enabled?: bool;
enabled?: boolean;
delay?: number;
}

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1 @@
""

View File

@@ -1,4 +1,4 @@
// Type definitions for bootstrap.datepicker
// Type definitions for bootstrap.datepicker
// Project: https://github.com/eternicode/bootstrap-datepicker
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -11,11 +11,11 @@ interface DatepickerOptions {
weekStart?: number;
startDate?: Date;
endDate?: Date;
autoclose?: bool;
autoclose?: boolean;
startView?: number;
todayBtn?: bool;
todayHighlight?: bool;
keyboardNavigation?: bool;
todayBtn?: boolean;
todayHighlight?: boolean;
keyboardNavigation?: boolean;
language?: string;
}
@@ -24,4 +24,10 @@ interface JQuery {
datepicker(methodName: string): JQuery;
datepicker(methodName: string, params: any): JQuery;
datepicker(options: DatepickerOptions): JQuery;
}
off(events?: "changeDate", selector?: any, handler?: (eventObject: any) => any): JQuery;
on(events: "changeDate", selector?: string, data?: any, handler?: (eventObject: any) => any): JQuery;
on(events: "changeDate", selector?: string, handler?: (eventObject: any) => any): JQuery;
on(events: "changeDate", handler?: (eventObject: any) => any): JQuery;
}

View File

@@ -0,0 +1,23 @@
/// <reference path="../jquery/jquery.d.ts"/>
interface PaginatorOptions{
alignment?: string;
size?: string;
itemContainerClass?: (type, page, current) => string;
currentPage?: number;
numberOfPages?: number;
totalPages?: number;
pageUrl?: (type, page, current) => string;
shouldShowPage?: boolean;
itemText?: (type, page, current) => any;
tooltipTitles?: (type, page, current) => string;
useBootstrapTooltip?: boolean;
bootstrapTooltipOptions?: {};
onPageClicked?: (event, originalEvent, type, page) => void;
onPageChanged?: (event, originalEvent, type, page) => void;
}
interface JQuery {
bootstrapPaginator(): JQuery;
bootstrapPaginator(options: PaginatorOptions): JQuery;
}

View File

@@ -0,0 +1 @@
""

View File

@@ -0,0 +1,24 @@
/// <reference path="../jquery/jquery.d.ts"/>
interface TimeickerOptions {
defaultTime?: string;
disableFocus?: boolean;
isOpen?: boolean;
minuteStep?: number;
modalBackdrop?: boolean;
secondStep?: number;
showSeconds?: boolean;
showInputs?: boolean;
showMeridian?: boolean;
template?: string;
appendWidgetTo?: string;
}
interface JQuery {
timepicker(): JQuery;
timepicker(methodName: string): JQuery;
timepicker(methodName: string, params: any): JQuery;
timepicker(options: TimeickerOptions): JQuery;
}

View File

@@ -35,6 +35,11 @@ $('#myCollapsible').collapse({ toggle: false });
$('.carousel').carousel();
$('.carousel').carousel({ interval: 2000 });
$('.typeahead').typeahead();
$('.typeahead').typeahead({
matcher: item => true,
sorter: (items: any[]) => items,
updater: item => item,
highlighter: item => ""
});
$('#navbar').affix();

View File

@@ -0,0 +1 @@
""

View File

@@ -7,16 +7,16 @@
/// <reference path="../jquery/jquery.d.ts"/>
interface ModalOptions {
backdrop?: bool;
keyboard?: bool;
show?: bool;
backdrop?: boolean;
keyboard?: boolean;
show?: boolean;
remote?: string;
}
interface ModalOptionsBackdropString {
backdrop?: string; // for "static"
keyboard?: bool;
show?: bool;
keyboard?: boolean;
show?: boolean;
remote?: string;
}
@@ -25,29 +25,31 @@ interface ScrollSpyOptions {
}
interface TooltipOptions {
animation?: bool;
html?: bool;
animation?: boolean;
html?: boolean;
placement?: any;
selector?: string;
title?: any;
trigger?: string;
delay?: any;
container?: any;
}
interface PopoverOptions {
animation?: bool;
html?: bool;
animation?: boolean;
html?: boolean;
placement?: any;
selector?: string;
trigger?: string;
title?: any;
content?: any;
delay?: any;
delay?: any;
container?: any;
}
interface CollapseOptions {
parent?: any;
toggle?: bool;
toggle?: boolean;
}
interface CarouselOptions {
@@ -59,9 +61,10 @@ interface TypeaheadOptions {
source?: any;
items?: number;
minLength?: number;
matcher?: () => any;
sorter?: () => any;
highlighter?: () => any;
matcher?: (item: any) => boolean;
sorter?: (items: any[]) => any[];
updater?: (item: any) => any;
highlighter?: (item: any) => string;
}
interface AffixOptions {

95
box2d/README.md Normal file
View File

@@ -0,0 +1,95 @@
box2dweb.d.ts
===========
This is a derived work of the original Box2D C++ located here: http://box2d.org/
This is a typescript definitions file for box2dweb.js located here: http://code.google.com/p/box2dweb/
There are a few ports of Box2D to javascript, I have specifically picked box2dweb.js since it has zero dependencies and can be linked to your project via a single file. It also appears to be the most up to date with box2d and is a direct automated port from Box2DFlash (http://www.box2dflash.org/)
Basic Usage
==========
Import Statements
-----------------
Reference the box2dweb.d.ts file in your project and in an appropriate location include the following import statements to reduce the amount of typing you will need to do to acccess deeply nested modules.
```typescript
/// <reference path="box2dweb.d.ts" />
// Include the following imports, or add more/less, to reduce the module nesting.
import b2Common = Box2D.Common;
import b2Math = Box2D.Common.Math;
import b2Collision = Box2D.Collision;
import b2Shapes = Box2D.Collision.Shapes;
import b2Dynamics = Box2D.Dynamics;
import b2Contacts = Box2D.Dynamics.Contacts;
import b2Controllers = Box2D.Dynamics.Controllers;
import b2Joints = Box2D.Dynamics.Joints;
```
Debug Drawing
-------------
Notes from Box2DWeb
Although Box2D is a physics engine and therefore has nothing to do with drawing, Box2dFlash provides such methods for debugging which are defined in the b2DebugDraw class. In Box2dWeb, a b2DebugDraw takes a canvas-context instead of a Sprite:
```typescript
var debugDraw = new Box2D.Dynamics.b2DebugDraw();
debugDraw.SetSprite(document.getElementsByTagName("canvas")[0].getContext("2d"));
```
Events
------
Notes from Box2DWeb
You have to implement event-interfaces in Box2dFlash. Since Javascript doesn't support classical inheritance natively, I show you how to deal with events in Box2dWeb:
```typescript
var world = new Box2D.Dynamics.b2World(new Box2D.Common.Math.b2Vec2(0, 10), true);
/* ... add bodies, etc. ... */
var myListener = new Box2D.Dynamics.b2DestructionListener;
myListener.SayGoodbyeFixture = function(fixture) {
alert("goodbye fixture ...");
}
world.SetDestructionListener(myListener);
```
Change Log
==========
2.1a 2013/06/28
---------------
* Upgraded to TypeScript v0.9
* Removed import statements so the user can now declare the smaller namespaces in their code. Before the import statements were not 'exported', so they appeared as 'any' objects.
License
=======
Box2DWeb-2.1.d.ts Copyright (c) 2012 Josh Baldwin http://github.com/jbaldwin/box2dweb.d.ts
There are a few competing javascript Box2D ports.
This definitions file is for Box2dWeb.js ->
http://code.google.com/p/box2dweb/
Box2D C++ Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

16
box2d/box2dweb-test.ts Normal file
View File

@@ -0,0 +1,16 @@
/// <reference path="box2dweb.d.ts" />
import b2Common = Box2D.Common;
import b2Math = Box2D.Common.Math;
import b2Collision = Box2D.Collision;
import b2Shapes = Box2D.Collision.Shapes;
import b2Dynamics = Box2D.Dynamics;
import b2Contacts = Box2D.Dynamics.Contacts;
import b2Controllers = Box2D.Dynamics.Controllers;
import b2Joints = Box2D.Dynamics.Joints;
var w1 = new Box2D.Dynamics.b2World(new Box2D.Common.Math.b2Vec2(0, 10), true);
var w2 = new b2Dynamics.b2World(new b2Math.b2Vec2(0, 10), true);
var debugDraw = new Box2D.Dynamics.b2DebugDraw();
debugDraw.SetSprite((<HTMLCanvasElement>document.getElementsByTagName("canvas")[0]).getContext("2d"));

View File

@@ -0,0 +1 @@
""

723
box2d/box2dweb.d.ts vendored

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More