diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 801a1d07a..347857633 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -83,10 +83,12 @@ All definitions files include a header with the author and editors, so at some p * [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)) +* [flipsnap.js](http://pxgrid.github.io/js-flipsnap/) (by [kubosho_](https://github.com/kubosho), [gsino](https://github.com/gsino), [Mayuki Sawatari](https://github.com/mayuki)) * [Foundation](http://foundation.zurb.com/) (by [Boris Yankov](https://github.com/borisyankov)) * [FPSMeter](http://darsa.in/fpsmeter/) (by [Aaron Lampros](https://github.com/alampros)) * [fs-extra](https://github.com/jprichardson/node-fs-extra) (by [midknight41](https://github.com/midknight41)) * [FullCalendar](http://arshaw.com/fullcalendar/) (by [Neil Stalker](https://github.com/nestalk)) +* [Fuse.js](https://github.com/krisk/Fuse) (by [Greg Smith](https://github.com/smrq)) * [Gamepad](http://www.w3.org/TR/gamepad/) (by [Kon](http://phyzkit.net/)) * [GeoJSON](http://geojson.org/) (by [Jake Bruun](https://github.com/cobster)) * [Giraffe](https://github.com/barc/backbone.giraffe) (by [Matt McCray](https://github.com/darthapo)) @@ -155,9 +157,11 @@ All definitions files include a header with the author and editors, so at some p * [jQuery.joyride](http://zurb.com/playground/jquery-joyride-feature-tour-plugin) (by [Vincent Bortone](https://github.com/vbortone)) * [jQuery.jSignature](https://github.com/willowsystems/jSignature) (by [Patrick Magee](https://github.com/pjmagee)) * [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.pickadate](https://github.com/amsul/pickadate.js) (by [Theodore Brown](https://github.com/theodorejb)) +* [jQuery.pjax](https://github.com/defunkt/jquery-pjax) (by [Junle Li](https://github.com/lijunle)) * [jQuery.pnotify](http://sciactive.github.io/pnotify/) (by [David Sichau](https://github.com/DavidSichau/)) +* [jQuery.postMessage](http://benalman.com/projects/jquery-postmessage-plugin/) (by [Junle Li](https://github.com/lijunle)) * [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)) @@ -210,6 +214,7 @@ All definitions files include a header with the author and editors, so at some p * [Logg](https://github.com/dpup/node-logg) (by [Bret Little](https://github.com/blittle)) * [Long.js](https://github.com/dcodeIO/Long.js) (by [Toshihide Hara](https://github.com/kerug)) * [lz-string](https://github.com/pieroxy/lz-string) (by [Roman Nikitin](https://github.com/M0ns1gn0r)) +* [Mapbox](https://github.com/mapbox/mapbox.js/) (by [Maxime Fabre](https://github.com/anahkiasen)) * [Marked](https://github.com/chjj/marked) (by [William Orr](https://github.com/worr)) * [MathJax](https://github.com/mathjax/MathJax) (by [Roland Zwaga](https://github.com/rolandzwaga)) * [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) (by [Sarah Williams](https://github.com/flurg)) @@ -218,6 +223,7 @@ All definitions files include a header with the author and editors, so at some p * [Microsoft Live Connect](http://msdn.microsoft.com/en-us/library/live/hh243643.aspx) (by [John Vilk](https://github.com/jvilk)) * [Minimatch](https://github.com/isaacs/minimatch) (by [vvakame](https://github.com/vvakame)) * [minimist](https://github.com/substack/minimist) (by [Bart van der Schoor](https://github.com/Bartvds)) +* [Mixpanel](https://github.com/mixpanel/mixpanel-js) (by [Knut Eirik Leira Hjelle](https://github.com/hjellek)) * [mixto](https://github.com/atom/mixto) (by [vvakame](https://github.com/vvakame)) * [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)) @@ -300,6 +306,7 @@ All definitions files include a header with the author and editors, so at some p * [Teechart](http://www.steema.com) (by [Steema](http://www.steema.com)) * [text-buffer](https://github.com/atom/text-buffer) (by [vvakame](https://github.com/vvakame)) * [three.js](http://mrdoob.github.com/three.js/) (by [Kon](http://phyzkit.net/)) +* [TimelineJS](https://github.com/NUKnightLab/TimelineJS) (by [Roland Zwaga](https://github.com/rolandzwaga)) * [Toastr](https://github.com/CodeSeven/toastr) (by [Boris Yankov](https://github.com/borisyankov)) * [trunk8](https://github.com/rviscomi/trunk8) (by [Blake Niemyjski](https://github.com/niemyjski)) * [TweenJS](http://www.createjs.com/#!/TweenJS) (by [Pedro Ferreira](https://bitbucket.org/drk4)) @@ -316,6 +323,7 @@ All definitions files include a header with the author and editors, so at some p * [urlrouter](https://github.com/fengmk2/urlrouter) (by [Carlos Ballesteros Velasco](https://github.com/soywiz)) * [UUID.js](https://github.com/LiosK/UUID.js) (by [Jason Jarrett](https://github.com/staxmanade)) * [Valerie](https://github.com/davewatts/valerie) (by [Howard Richards](https://github.com/conficient)) +* [Velocity](http://velocityjs.org/) (by [Greg Smith](https://github.com/smrq)) * [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/)) * [vinyl](https://github.com/wearefractal/vinyl) (by [vvakame](https://github.com/vvakame/)) @@ -326,6 +334,7 @@ All definitions files include a header with the author and editors, so at some p * [WinRT](http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx) (from TypeScript samples) * [ws](http://einaros.github.io/ws/) (by [Paul Loyd](https://github.com/loyd)) * [x2js](https://code.google.com/p/x2js/) (by [Hiroki Horiuchi](https://github.com/horiuchi/)) +* [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) (by [Michel Salib](https://github.com/michelsalib)) * [XRegExp](http://xregexp.com/) (by [Bart van der Schoor](https://github.com/Bartvds)) * [YouTube](https://developers.google.com/youtube/) (by [Daz Wilkin](https://github.com/DazWilkin/)) * [YouTube Analytics API](https://developers.google.com/youtube/analytics/) (by [Frank M](https://github.com/sgtfrankieboy)) diff --git a/Finch/Finch.d.ts b/Finch/Finch.d.ts index e23e97ef5..e3dd86c70 100644 --- a/Finch/Finch.d.ts +++ b/Finch/Finch.d.ts @@ -1,6 +1,6 @@ // Type definitions for Finch 0.5.13 -// Project: https://github.com/stoodder/finchjs -// Definitions by: https://github.com/DavidSichau +// Project: https://github.com/stoodder/finchjs +// Definitions by: David Sichau // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/amplifyjs/amplifyjs-tests.ts b/amplifyjs/amplifyjs-tests.ts index c26955348..a104d4a7c 100644 --- a/amplifyjs/amplifyjs-tests.ts +++ b/amplifyjs/amplifyjs-tests.ts @@ -176,8 +176,7 @@ amplify.request("twitter-mentions", { user: "amplifyjs" }); //Example: -amplify.request.decoders.appEnvelope = -function (data, status, xhr, success, error) { +var appEnvelopeDecoder: amplifyDecoder = function (data, status, xhr, success, error) { if (data.status === "success") { success(data.data); } else if (data.status === "fail" || data.status === "error") { @@ -187,6 +186,17 @@ function (data, status, xhr, success, error) { } }; +//a new decoder can be added to the amplifyDecoders interface +interface amplifyDecoders { + appEnvelope: amplifyDecoder; +} + +amplify.request.decoders.appEnvelope = appEnvelopeDecoder; + +//but you can also just add it via an index +amplify.request.decoders['appEnvelopeStr'] = appEnvelopeDecoder; + + amplify.request.define("decoderExample", "ajax", { url: "/myAjaxUrl", type: "POST", diff --git a/amplifyjs/amplifyjs.d.ts b/amplifyjs/amplifyjs.d.ts index c8de7260a..364845f3c 100644 --- a/amplifyjs/amplifyjs.d.ts +++ b/amplifyjs/amplifyjs.d.ts @@ -3,11 +3,33 @@ // Definitions by: Jonas Eriksson // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + interface amplifyRequestSettings { resourceId: string; data?: any; - success?: Function; - error?: Function; + success?: (...args: any[]) => void; + error?: (...args: any[]) => void; +} + +interface amplifyDecoder { + ( + data?: any, + status?: string, + xhr?: JQueryXHR, + success?: (...args: any[]) => void, + error?: (...args: any[]) => void + ): void +} + +interface amplifyDecoders { + [decoderName: string]: amplifyDecoder; + jsSend: amplifyDecoder; +} + +interface amplifyAjaxSettings extends JQueryAjaxSettings { + cache?: any; + decoder?: any /* string or amplifyDecoder */; } interface amplifyRequest { @@ -39,7 +61,7 @@ interface amplifyRequest { * 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(resourceId: string, requestType: string, settings?: amplifyAjaxSettings): void; /*** * Define a custom request. @@ -50,9 +72,9 @@ interface amplifyRequest { * success: Callback to invoke on success. * error: Callback to invoke on error. */ - define(resourceId: string, resource: Function): void; - - decoders: any; + define(resourceId: string, resource: (settings: amplifyRequestSettings) => void): void; + + decoders: amplifyDecoders; cache: any; } diff --git a/angular-translate/angular-translate.d.ts b/angular-translate/angular-translate.d.ts index 6b6071102..47dfa63a5 100644 --- a/angular-translate/angular-translate.d.ts +++ b/angular-translate/angular-translate.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular Translate (pascalprecht.translate module) // Project: https://github.com/PascalPrecht/angular-translate -// Definitions by: Michel Salib +// Definitions by: Michel Salib // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/angular-ui/angular-ui-router-tests.ts b/angular-ui/angular-ui-router-tests.ts index 4804ad297..5b0dec0ff 100644 --- a/angular-ui/angular-ui-router-tests.ts +++ b/angular-ui/angular-ui-router-tests.ts @@ -78,12 +78,13 @@ interface IUrlLocatorTestService { // Service for determining who the currently logged on user is. class UrlLocatorTestService implements IUrlLocatorTestService { - static $inject = ["$http", "$rootScope", "$urlRouter"]; + static $inject = ["$http", "$rootScope", "$urlRouter", "$state"]; constructor( private $http: ng.IHttpService, private $rootScope: ng.IRootScopeService, - private $urlRouter: ng.ui.IUrlRouterService + private $urlRouter: ng.ui.IUrlRouterService, + private $state: ng.ui.IStateService ) { $rootScope.$on("$locationChangeSuccess", (event: ng.IAngularEvent) => this.onLocationChangeSuccess(event)); } @@ -107,6 +108,23 @@ class UrlLocatorTestService implements IUrlLocatorTestService { }); } } + + private stateServiceTest() { + this.$state.go("myState"); + this.$state.transitionTo("myState"); + if (this.$state.includes("myState") === true) { + // + } + if (this.$state.is("myState") === true) { + // + } + if (this.$state.href("myState") === "/myState") { + // + } + this.$state.get("myState"); + this.$state.get(); + this.$state.reload(); + } } myApp.service("urlLocatorTest", UrlLocatorTestService); @@ -124,4 +142,3 @@ module UiViewScrollProviderTests { $uiViewScrollProvider.useAnchorScroll(); }]); } - diff --git a/angular-ui/angular-ui-router.d.ts b/angular-ui/angular-ui-router.d.ts index 499f1c474..6327719b5 100644 --- a/angular-ui/angular-ui-router.d.ts +++ b/angular-ui/angular-ui-router.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.1.5+ (ui.router module) // Project: https://github.com/angular-ui/ui-router -// Definitions by: Michel Salib +// Definitions by: Michel Salib // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -86,6 +86,7 @@ declare module ng.ui { get(): IState[]; current: IState; params: IStateParamsService; + reload(): void; } interface IStateParamsService { diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts index 696e6f834..9503e36d7 100644 --- a/angularjs/angular-animate.d.ts +++ b/angularjs/angular-animate.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.2+ (ngAnimate module) // Project: http://angularjs.org -// Definitions by: Michel Salib +// Definitions by: Michel Salib // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/angularjs/angular-cookies.d.ts b/angularjs/angular-cookies.d.ts index 60eebbacb..622221675 100644 --- a/angularjs/angular-cookies.d.ts +++ b/angularjs/angular-cookies.d.ts @@ -1,4 +1,4 @@ -/// Type definitions for Angular JS 1.2 (ngCookies module) +// Type definitions for Angular JS 1.2 (ngCookies module) // Project: http://angularjs.org // Definitions by: Diego Vilar // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index 51b93091f..597a58e40 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.2 (ngResource module) // Project: http://angularjs.org -// Definitions by: Diego Vilar , Michael Jess (minor enhancements) +// Definitions by: Diego Vilar , Michael Jess // Definitions: https://github.com/daptiv/DefinitelyTyped /// diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index 4e2aa7607..ba6d0aac9 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular JS 1.2 (ngRoute module) // Project: http://angularjs.org -// Definitions by: Jonathan Park +// Definitions by: Jonathan Park // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -15,7 +15,9 @@ declare module ng.route { // RouteParamsService // see http://docs.angularjs.org/api/ngRoute.$routeParams /////////////////////////////////////////////////////////////////////////// - interface IRouteParamsService {} + interface IRouteParamsService { + [key: string]: any; + } /////////////////////////////////////////////////////////////////////////// // RouteService diff --git a/angularjs/angular-scenario.d.ts b/angularjs/angular-scenario.d.ts index ec3efd9f9..ee71ffbea 100644 --- a/angularjs/angular-scenario.d.ts +++ b/angularjs/angular-scenario.d.ts @@ -1,6 +1,6 @@ // Type definitions for Angular Scenario Testing // Project: http://angularjs.org -// Definitions by: RomanoLindano +// Definitions by: RomanoLindano // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index ec8c5cb5b..92a02eef8 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -203,6 +203,7 @@ declare module ng { $error: any; $addControl(control: ng.INgModelController): void; $removeControl(control: ng.INgModelController): void; + $setValidity(validationErrorKey: string, isValid: boolean, control: ng.INgModelController): void; $setDirty(): void; $setPristine(): void; } @@ -302,13 +303,17 @@ declare module ng { // WindowService // see http://docs.angularjs.org/api/ng.$window /////////////////////////////////////////////////////////////////////////// - interface IWindowService extends Window {} + interface IWindowService extends Window { + [key: string]: any; + } /////////////////////////////////////////////////////////////////////////// // BrowserService // TODO undocumented, so we need to get it from the source code /////////////////////////////////////////////////////////////////////////// - interface IBrowserService {} + interface IBrowserService { + [key: string]: any; + } /////////////////////////////////////////////////////////////////////////// // TimeoutService diff --git a/ansicolors/ansicolors.d.ts b/ansicolors/ansicolors.d.ts index 0ffc99910..2f61b0435 100644 --- a/ansicolors/ansicolors.d.ts +++ b/ansicolors/ansicolors.d.ts @@ -1,4 +1,9 @@ +// Type definitions for ansicolors +// Project: https://github.com/thlorenz/ansicolors +// Definitions by: rogierschouten +// Definitions: https://github.com/borisyankov/DefinitelyTyped + declare module "ansicolors" { var colors: {[index: string]: (s: string) => string;}; - export = colors; + export = colors; } diff --git a/asciify/asciify.d.ts b/asciify/asciify.d.ts index 4dc47cd3a..33f82019b 100644 --- a/asciify/asciify.d.ts +++ b/asciify/asciify.d.ts @@ -1,6 +1,6 @@ // Type definitions for asciify 1.3.5 // Project: https://www.npmjs.org/package/asciify -// Definitions by: Alan Norbauer http://alan.norbauer.com +// Definitions by: Alan Norbauer // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -26,4 +26,4 @@ declare module "asciify" { } export = asciify -} \ No newline at end of file +} diff --git a/async/async-tests.ts b/async/async-tests.ts index ae92bbff9..169bc9cb1 100644 --- a/async/async-tests.ts +++ b/async/async-tests.ts @@ -156,6 +156,22 @@ q.push([{ name: 'baz' }, { name: 'bay' }, { name: 'bax' }], function (err) { console.log('finished processing bar'); }); +// tests for strongly typed tasks +var q2 = async.queue(function (task: string, callback) { + console.log('Task: ' + task); + callback(); +}, 1); + +q2.push('task1'); + +q2.push('task2', function (error, results: string[]) { + console.log('Finished tasks: ' + results.join(', ')); +}); + +q2.push(['task3', 'task4', 'task5'], function (error, results: string[]) { + console.log('Finished tasks: ' + results.join(', ')); +}); + var filename = ''; async.auto({ get_data: function (callback) { }, diff --git a/async/async.d.ts b/async/async.d.ts index d85679b68..25736941f 100644 --- a/async/async.d.ts +++ b/async/async.d.ts @@ -16,6 +16,7 @@ interface AsyncQueue { length(): number; concurrency: number; push(task: T, callback?: AsyncMultipleResultsCallback): void; + push(task: T[], callback?: AsyncMultipleResultsCallback): void; saturated: AsyncMultipleResultsCallback; empty: AsyncMultipleResultsCallback; drain: AsyncMultipleResultsCallback; diff --git a/async/async.d.ts.tscparams b/async/async.d.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/async/async.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/async/asyncamd-tests.ts.tscparams b/async/asyncamd-tests.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/async/asyncamd-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/auth0.widget/auth0.widget.d.ts b/auth0.widget/auth0.widget.d.ts index 932d79c94..d45c3a212 100644 --- a/auth0.widget/auth0.widget.d.ts +++ b/auth0.widget/auth0.widget.d.ts @@ -1,5 +1,5 @@ // Type definitions for Auth0Widget.js -// Project: Auth0.com +// Project: http://auth0.com // Definitions by: Robert McLaws // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -45,4 +45,4 @@ declare var Auth0Widget: Auth0WidgetStatic; declare module "Auth0Widget" { export = Auth0Widget -} \ No newline at end of file +} diff --git a/auth0/auth0.d.ts b/auth0/auth0.d.ts index 02b8e0196..5d3149ead 100644 --- a/auth0/auth0.d.ts +++ b/auth0/auth0.d.ts @@ -1,5 +1,5 @@ // Type definitions for Auth0.js -// Project: Auth0.com +// Project: http://auth0.com // Definitions by: Robert McLaws // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -130,4 +130,4 @@ declare var Auth0: Auth0Static; declare module "Auth0" { export = Auth0 -} \ No newline at end of file +} diff --git a/backbone/backbone.d.ts b/backbone/backbone.d.ts index 6fa7e6d60..b58c4652f 100644 --- a/backbone/backbone.d.ts +++ b/backbone/backbone.d.ts @@ -1,10 +1,8 @@ // Type definitions for Backbone 1.0.0 // Project: http://backbonejs.org/ -// Definitions by: Boris Yankov -// Definitions by: Natan Vivo +// Definitions by: Boris Yankov , Natan Vivo // Definitions: https://github.com/borisyankov/DefinitelyTyped - /// /// diff --git a/bootstrap.v3.datetimepicker/boostrap.v3.datetimepicker-tests.ts b/bootstrap.v3.datetimepicker/boostrap.v3.datetimepicker-tests.ts new file mode 100644 index 000000000..6abf38f94 --- /dev/null +++ b/bootstrap.v3.datetimepicker/boostrap.v3.datetimepicker-tests.ts @@ -0,0 +1,31 @@ +/// +/// + +function test_cases() { + $('#datetimepicker').datetimepicker(); + $('#datetimepicker').datetimepicker({ + pickDate: false + }); + $('#datetimepicker').datetimepicker({ + pickTime: false + }); + $('#datetimepicker').datetimepicker({ + minDate: '2012-12-31' + }); + + $('#datetimepicker').data("DateTimePicker").setMaxDate('2012-12-31'); + + var startDate = new Date(2012, 1, 20); + var endDate = new Date(2012, 1, 25); + $('#datetimepicker2') + .datetimepicker() + .on("dp.change", function (ev) { + if (ev.date.valueOf() > endDate.valueOf()) { + $('#alert').show().find('strong').text('The start date must be before the end date.'); + } else { + $('#alert').hide(); + startDate = ev.date; + $('#date-start-display').text($('#date-start').data('date')); + } + }); +} \ No newline at end of file diff --git a/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts new file mode 100644 index 000000000..6f1147cc1 --- /dev/null +++ b/bootstrap.v3.datetimepicker/bootstrap.v3.datetimepicker.d.ts @@ -0,0 +1,100 @@ +// Type definitions for Bootstrap datetimepicker v3 +// Project: http://eonasdan.github.io/bootstrap-datetimepicker +// Definitions by: Jesica N. Fera +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/** + * bootstrap-datetimepicker.js 3.0.0 Copyright (c) 2014 Jonathan Peterson + * Available via the MIT license. + * see: http://eonasdan.github.io/bootstrap-datetimepicker or https://github.com/Eonasdan/bootstrap-datetimepicker for details. + */ + +/// + +declare module BootstrapV3DatetimePicker { + interface DatetimepickerChangeEventObject extends JQueryEventObject { + date: any; + oldDate: any; + } + + interface DatetimepickerEventObject extends JQueryEventObject { + date: any; + } + + interface DatetimepickerIcons { + time?: string; + date?: string; + up?: string; + down?: string; + } + + interface DatetimepickerOptions { + pickDate?: boolean; + pickTime?: boolean; + useMinutes?: boolean; + useSeconds?: boolean; + useCurrent?: boolean; + minuteStepping?: number; + minDate?: any; + maxDate?: any; + showToday?: boolean; + collapse?: boolean; + language?: string; + defaultDate?: string; + disabledDates?: Array; + enabledDates?: Array; + icons?: DatetimepickerIcons; + useStrict?: boolean; + direction?: string; + sideBySide?: boolean; + daysOfWeekDisabled?: Array; + } + + interface Datetimepicker { + setDate(date: any): void; + setMinDate(date: any): void; + setMaxDate(date: any): void; + show(): void; + disable(): void; + enable(): void; + getDate(): void; + } + +} + + +interface JQuery { + + datetimepicker(): JQuery; + datetimepicker(options: BootstrapV3DatetimePicker.DatetimepickerOptions): JQuery; + + off(events: "dp.change", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + off(events: "dp.change", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + + on(events: "dp.change", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + on(events: "dp.change", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + on(events: 'dp.change', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerChangeEventObject) => any): JQuery; + + off(events: "dp.show", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + off(events: "dp.show", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + on(events: "dp.show", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: "dp.show", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: 'dp.show', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + off(events: "dp.hide", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + off(events: "dp.hide", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + on(events: "dp.hide", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: "dp.hide", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: 'dp.hide', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + off(events: "dp.error", selector?: string, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + off(events: "dp.error", handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + on(events: "dp.error", selector: string, data: any, handler?: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: "dp.error", selector: string, handler: (eventobject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + on(events: 'dp.error', handler: (eventObject: BootstrapV3DatetimePicker.DatetimepickerEventObject) => any): JQuery; + + data(key: 'DateTimePicker'): BootstrapV3DatetimePicker.Datetimepicker; +} \ No newline at end of file diff --git a/chai-datetime/chai-datetime.d.ts b/chai-datetime/chai-datetime.d.ts index 263034361..bce063443 100644 --- a/chai-datetime/chai-datetime.d.ts +++ b/chai-datetime/chai-datetime.d.ts @@ -1,7 +1,7 @@ // Type definitions for chai-datetime // Project: https://github.com/gaslight/chai-datetime.git // Definitions by: Cliff Burger -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/chai-jquery/chai-jquery.d.ts b/chai-jquery/chai-jquery.d.ts index 52fd4f3f5..826e66579 100644 --- a/chai-jquery/chai-jquery.d.ts +++ b/chai-jquery/chai-jquery.d.ts @@ -1,7 +1,7 @@ // Type definitions for chai-jquery 1.1.1 // Project: https://github.com/chaijs/chai-jquery // Definitions by: Kazi Manzur Rashid -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/chai/chai-assert-tests.ts.tscparams b/chai/chai-assert-tests.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/chai/chai-assert-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/chai/chai.d.ts b/chai/chai.d.ts index d840aba96..54d5770c9 100644 --- a/chai/chai.d.ts +++ b/chai/chai.d.ts @@ -1,8 +1,7 @@ // Type definitions for chai 1.7.2 // Project: http://chaijs.com/ // Definitions by: Jed Hunsaker -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped - +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare module chai { diff --git a/chrome/chrome-app.d.ts b/chrome/chrome-app.d.ts index c8dd2e6d4..ad319394f 100644 --- a/chrome/chrome-app.d.ts +++ b/chrome/chrome-app.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Chrome packaged application development. +// Type definitions for Chrome packaged application development // Project: http://developer.chrome.com/apps/ // Definitions by: Adam Lay // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -92,4 +92,4 @@ declare module chrome.app.window { var onMaximized: WindowEvent; var onMinimized: WindowEvent; var onRestored: WindowEvent; -} \ No newline at end of file +} diff --git a/chrome/chrome.d.ts b/chrome/chrome.d.ts index e8e0f0639..796635c27 100755 --- a/chrome/chrome.d.ts +++ b/chrome/chrome.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Chrome extension development. +// Type definitions for Chrome extension development // Project: http://developer.chrome.com/extensions/ -// Definitions by: Matthew Kimber and otiai10 +// Definitions by: Matthew Kimber , otiai10 // Definitions: https://github.com/borisyankov/DefinitelyTyped //////////////////// @@ -1232,6 +1232,68 @@ declare module chrome.management { var onEnabled: ManagementEnabledEvent; } +//////////////////// +// Notifications +// https://developer.chrome.com/extensions/notifications +//////////////////// +declare module chrome.notifications { + interface ButtonOptions { + title: string; + iconUrl?: string; + } + + interface ItemOptions { + title: string; + message: string; + } + + interface NotificationOptions { + type?: string; + iconUrl?: string; + title?: string; + message?: string; + contextMessage?: string; + priority?: number; + eventTime?: number; + buttons?: Array; + items?: Array; + progress?: number; + isClickable?: boolean; + } + + interface OnClosed { + addListener(callback: (notificationId: string, byUser: boolean) => void): void; + } + + interface OnClicked { + addListener(callback: (notificationId: string) => void): void; + } + + interface OnButtonClicked { + addListener(callback: (notificationId: string, buttonIndex: number) => void): void; + } + + interface OnPermissionLevelChanged { + addListener(callback: (level: string) => void): void; + } + + interface OnShowSettings { + addListener(callback: Function): void; + } + + export var onClosed: OnClosed; + export var onClicked: OnClicked; + export var onButtonClicked: OnButtonClicked; + export var onPermissionLevelChanged: OnPermissionLevelChanged; + export var onShowSettings: OnShowSettings; + + export function create(notificationId: string, options: NotificationOptions, callback: (notificationId: string) => void): void; + export function update(notificationId: string, options: NotificationOptions, callback: (wasUpdated: boolean) => void): void; + export function clear(notificationId: string, callback: (wasCleared: boolean) => void): void; + export function getAll(callback: (notifications: any) => void): void; + export function getPermissionLevel(callback: (level: string) => void): void; +} + //////////////////// // Omnibox //////////////////// diff --git a/cordova/cordova.d.ts b/cordova/cordova.d.ts index 95be38882..9377912b0 100644 --- a/cordova/cordova.d.ts +++ b/cordova/cordova.d.ts @@ -1,6 +1,6 @@ -// Type definitions for Apache Cordova. +// Type definitions for Apache Cordova // Project: http://cordova.apache.org -// Definitions by: Microsoft Open Technologies, Inc. +// Definitions by: Microsoft Open Technologies Inc. // Definitions: https://github.com/borisyankov/DefinitelyTyped // // Copyright (c) Microsoft Open Technologies, Inc. @@ -57,4 +57,4 @@ interface UrlUtil { } /** Apache Cordova instance */ -declare var cordova: Cordova; \ No newline at end of file +declare var cordova: Cordova; diff --git a/createjs-lib/createjs-lib.d.ts b/createjs-lib/createjs-lib.d.ts index 048fde92d..a61679aa7 100644 --- a/createjs-lib/createjs-lib.d.ts +++ b/createjs-lib/createjs-lib.d.ts @@ -1,5 +1,5 @@ -// Type definitions for EaselJS 0.7.1, TweenJS 0.5.1, SoundJS 0.5.2, PreloadJS 0.4.1 -// Project: http://www.createjs.com/#!/EaselJS +// Type definitions for CreateJS +// Project: http://www.createjs.com/ // Definitions by: Pedro Ferreira , Chris Smith , Satoru Kimura // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/createjs/createjs.d.ts b/createjs/createjs.d.ts index 7be29abbe..f064d07f6 100644 --- a/createjs/createjs.d.ts +++ b/createjs/createjs.d.ts @@ -1,5 +1,5 @@ -// Type definitions for EaselJS 0.7.1, TweenJS 0.5.1, SoundJS 0.5.2, PreloadJS 0.4.1 -// Project: http://www.createjs.com/#!/EaselJS +// Type definitions for CreateJS +// Project: http://www.createjs.com/ // Definitions by: Pedro Ferreira , Chris Smith , Satoru Kimura // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/crossroads/crossroads.d.ts b/crossroads/crossroads.d.ts index 76fad217a..e86e3154d 100644 --- a/crossroads/crossroads.d.ts +++ b/crossroads/crossroads.d.ts @@ -1,7 +1,7 @@ // Type definitions for Crossroads.js // Project: http://millermedeiros.github.io/crossroads.js/ // Definitions by: Diullei Gomes -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/d3/d3.d.ts b/d3/d3.d.ts index 41fc04dff..b2f0bf1c9 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -751,8 +751,8 @@ declare module D3 { empty: () => boolean; data: { - (values: (data: any, index?: number) => any[], key?: (data: any, index?: number) => string): UpdateSelection; - (values: any[], key?: (data: any, index?: number) => string): UpdateSelection; + (values: (data: any, index?: number) => any[], key?: (data: any, index?: number) => any): UpdateSelection; + (values: any[], key?: (data: any, index?: number) => any): UpdateSelection; (): any[]; }; diff --git a/date.format.js/date.format-tests.ts b/date.format.js/date.format-tests.ts new file mode 100644 index 000000000..d06e78cb7 --- /dev/null +++ b/date.format.js/date.format-tests.ts @@ -0,0 +1,10 @@ +/// + +// test dateFormat +var now : string = dateFormat(); +var nowFullDate : string = dateFormat( dateFormat.masks.fullDate ); + +// test format() (on the prototype of Date) +var then : Date = new Date( 2014, 1, 1 ); +var thenDefaultFormat : string = then.format(); +var thenCustomFormat : string = then.format('yyyy/m/d HH:MM'); diff --git a/date.format.js/date.format.d.ts b/date.format.js/date.format.d.ts new file mode 100644 index 000000000..6e4ef4ea6 --- /dev/null +++ b/date.format.js/date.format.d.ts @@ -0,0 +1,244 @@ +// Type definitions for Date Format 1.2.3 +// Project: http://blog.stevenlevithan.com/archives/date-time-format +// Definitions by: Rob Stutton +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/***************************************************************************** + Portions 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 + + THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED + WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, + MERCHANTABLITY OR NON-INFRINGEMENT. + + See the Apache Version 2.0 License for specific language governing permissions + and limitations under the License. + ***************************************************************************** */ + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): void; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): void; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): void; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): void; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): void; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): void; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): void; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): void; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): void; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): void; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): void; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): void; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): void; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): void; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): void; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; + /** + * This is a convenience addition to the Date prototype + * Returns a formatted version of the date. + * The mask defaults to dateFormat.masks.default. + * @param {string=} mask + * @param {boolean=} utc + */ + format(mask?: string, utc?: boolean) : string; +} + +declare var Date: { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +}; + +// Some common format strings +interface DateFormatMasks { + "default": string; + shortDate: string; + mediumDate: string; + longDate: string; + fullDate: string; + shortTime: string; + mediumTime: string; + longTime: string; + isoDate: string; + isoTime: string; + isoDateTime: string; + isoUtcDateTime: string; +} + +// Internationalization strings +interface DateFormatI18n { + dayNames: string[]; + monthNames: string[]; +} + +/** + * Accepts a date, a mask, or a date and a mask. + * Returns a formatted version of the given date. + * The date defaults to the current date/time. + * The mask defaults to dateFormat.masks.default. + * @param {Date=} date + * @param {string=} mask + * @param {boolean=} utc + */ +declare var dateFormat: { + (date?: any, mask?: string, utc?: boolean ): string; + masks : DateFormatMasks; + i18n : DateFormatI18n; +}; diff --git a/dcjs/dc.d.ts b/dcjs/dc.d.ts index 0391d2502..2b06c34dd 100644 --- a/dcjs/dc.d.ts +++ b/dcjs/dc.d.ts @@ -1,7 +1,8 @@ // Type definitions for DCJS // Project: https://github.com/dc-js -// Definitions by: hans windhoff +// Definitions by: hans windhoff // Definitions: https://github.com/borisyankov/DefinitelyTyped + // this makes only sense together with d3 and crossfilter so you need the d3.d.ts and crossfilter.d.ts files /// @@ -195,4 +196,4 @@ export interface ILegendwidget { export function rowChart(cssSel: string): IRowchart; -} \ No newline at end of file +} diff --git a/domready/domready.d.ts b/domready/domready.d.ts index 14ba14011..7dc9c7749 100644 --- a/domready/domready.d.ts +++ b/domready/domready.d.ts @@ -1,6 +1,6 @@ // Type definitions for domready // Project: https://github.com/ded/domready -// Definitions by: Christian Holm Nielsen +// Definitions by: Christian Holm Nielsen // Definitions: https://github.com/borisyankov/DefinitelyTyped declare function domready(callback: () => any) : void; diff --git a/expect.js/expect.js.d.ts b/expect.js/expect.js.d.ts index 64c5871b0..8e5cfe142 100644 --- a/expect.js/expect.js.d.ts +++ b/expect.js/expect.js.d.ts @@ -1,7 +1,7 @@ // Type definitions for expect.js 0.2.0 // Project: https://github.com/LearnBoost/expect.js // Definitions by: Teppei Sato -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare function expect(target?: any): Expect.Root; @@ -17,7 +17,7 @@ declare module Expect { * * @param fn callback to match error string against */ - throwError(fn?: (exception: any) => void): void; + throwError(fn?: (exception: any) => void): void; /** * Assert that the function throws. diff --git a/expectations/expectations.d.ts b/expectations/expectations.d.ts index 4b02e1c0c..8e2750583 100644 --- a/expectations/expectations.d.ts +++ b/expectations/expectations.d.ts @@ -1,7 +1,7 @@ // Type definitions for expectations.js 0.2.5 // Project: https://github.com/spmason/expectations // Definitions by: vvakame -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare var expect:Expectations.IExpectations; @@ -57,4 +57,4 @@ declare module Expectations { fail(why?:string, what?:any):any; } -} \ No newline at end of file +} diff --git a/express-validator/express-validator.d.ts b/express-validator/express-validator.d.ts index 5a1ba31b7..b18b17e96 100644 --- a/express-validator/express-validator.d.ts +++ b/express-validator/express-validator.d.ts @@ -1,7 +1,7 @@ // Type definitions for express-validator // Project: https://github.com/ctavan/express-validator // Definitions by: Nathan Ridley -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare module ExpressValidator { export interface ValidationError { diff --git a/express/express.d.ts b/express/express.d.ts index eafc4c596..40be7e4ec 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -1,7 +1,7 @@ // Type definitions for Express 3.1 // Project: http://expressjs.com // Definitions by: Boris Yankov -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /* =================== USAGE =================== diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index 813782047..eec70c8f6 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -1,7 +1,7 @@ // Type definitions for FabricJS // Project: http://fabricjs.com/ // Definitions by: Oliver Klemencic -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare module fabric { diff --git a/filesystem/filesystem.d.ts b/filesystem/filesystem.d.ts index 11fb48dd0..8b20b113c 100644 --- a/filesystem/filesystem.d.ts +++ b/filesystem/filesystem.d.ts @@ -1,4 +1,4 @@ -// Type Definitions for File System API +// Type definitions for File System API // Project: http://www.w3.org/TR/file-system-api/ // Definitions by: Kon // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/filewriter/filewriter.d.ts b/filewriter/filewriter.d.ts index f0d958afa..a4910d0b1 100644 --- a/filewriter/filewriter.d.ts +++ b/filewriter/filewriter.d.ts @@ -1,4 +1,4 @@ -// Type Definitions for File API: Writer +// Type definitions for File API: Writer // Project: http://www.w3.org/TR/file-writer-api/ // Definitions by: Kon // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/flipsnap/flipsnap-tests.ts b/flipsnap/flipsnap-tests.ts new file mode 100644 index 000000000..a6b2f4fe8 --- /dev/null +++ b/flipsnap/flipsnap-tests.ts @@ -0,0 +1,13 @@ +/** + * Created by kubosho_ on 6/16/2014. + */ +/// + +Flipsnap('', { + maxPoint: 3, + distance: 230, + transitionDuration: 500, + disableTouch: true, + disable3d: false +}); + diff --git a/flipsnap/flipsnap.d.ts b/flipsnap/flipsnap.d.ts new file mode 100644 index 000000000..55e601704 --- /dev/null +++ b/flipsnap/flipsnap.d.ts @@ -0,0 +1,93 @@ +// Type definitions for flipsnap.js +// Project: http://pxgrid.github.io/js-flipsnap/ +// Definitions by: kubosho_ , gsino , Mayuki Sawatari +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface IFlipsnap { + /** + * Return true or false. true is returned when there is previous element. + */ + hasPrev(): boolean; + + /** + * Return true or false. true is returned when there is next element. + */ + hasNext(): boolean; + + /** + * Move to previous item. + */ + toPrev(transitionDuration?: number): void; + + /** + * Move to next item. + */ + toNext(transitionDuration?: number): void; + + /** + * Move to item of number. + */ + moveToPoint(point: number, transitionDuration?: number): void; + + /** + * Recalculate values + */ + refresh(): void; + + element: HTMLElement; +} + +interface FlipsnapStatic { + /** + * @param element The element + */ + (element: HTMLElement, opts?: FlipsnapOptions): IFlipsnap; + + /** + * @param selector The parameter must be CSS Selector. When set string, to get first element of result. Not all element. + */ + (selector: string, opts?: FlipsnapOptions): IFlipsnap; +} + +interface FlipsnapOptions { + /** + * Stop point count. default is auto calculate from element item count. + */ + maxPoint?: number; + /** + * Move distance. default is auto calculate from element width and maxPont. + */ + distance?: number; + /** + * Transition duration (millisecond). default is 350. + */ + transitionDuration?: number; + /** + * When set true, touch event is disabled. Only handling button or etc interface. default is false. + */ + disableTouch?: boolean; + /** + * When support 3D transform browser and this option set true, it is not used 3D transform and use 2D transform. You should set true, when it is a device which has a bug in 3D transform(old Android or BlackBerry etc). default is false. + */ + disable3d?: boolean; +} + +interface HTMLElement { + addEventListener(type: "fstouchstart", listener: (ev: Event) => any, useCapture?: boolean): void; + addEventListener(type: "fstouchmove", listener: (ev: FlipsnapTouchMoveEvent) => any, useCapture?: boolean): void; + addEventListener(type: "fstouchend", listener: (ev: FlipsnapTouchEndEvent) => any, useCapture?: boolean): void; +} + +interface FlipsnapTouchMoveEvent extends Event { + delta: number; + direction: number; +} + +interface FlipsnapTouchEndEvent extends Event { + moved: boolean; + cancelled: boolean; + newPoint: number; + originalPoint: number; +} + +declare var Flipsnap: FlipsnapStatic; diff --git a/ftdomdelegate/ftdomdelegate.d.ts b/ftdomdelegate/ftdomdelegate.d.ts index 04766bd26..905bef706 100644 --- a/ftdomdelegate/ftdomdelegate.d.ts +++ b/ftdomdelegate/ftdomdelegate.d.ts @@ -1,6 +1,6 @@ // Type definitions for ftdomdelegate // Project: https://github.com/ftlabs/ftdomdelegate -// Definitions by: Christian Holm Nielsen +// Definitions by: Christian Holm Nielsen // Definitions: https://github.com/borisyankov/DefinitelyTyped declare class Delegate @@ -19,4 +19,4 @@ declare class Delegate root(element? : Element) : void; destroy() : void; -} \ No newline at end of file +} diff --git a/fuse/fuse-tests.ts b/fuse/fuse-tests.ts new file mode 100644 index 000000000..3aa5576fe --- /dev/null +++ b/fuse/fuse-tests.ts @@ -0,0 +1,73 @@ +/// + +function test_fuse_find_identifiers() { + var books = [{ + id: 1, + title: 'The Great Gatsby', + author: 'F. Scott Fitzgerald' + }, { + id: 2, + title: 'The DaVinci Code', + author: 'Dan Brown' + }, { + id: 3, + title: 'Angels & Demons', + author: 'Dan Brown' + }]; + var options = { + keys: ['author', 'title'], // keys to search in + id: 'id' // return a list of identifiers only + }; + var f = new Fuse(books, options); + var result = f.search('brwn'); // Fuzzy-search for pattern 'brwn' +} + +function test_fuse_find_records() { + var books = [{ + id: 1, + title: 'The Great Gatsby', + author: 'F. Scott Fitzgerald' + }, { + id: 2, + title: 'The DaVinci Code', + author: 'Dan Brown' + }, { + id: 3, + title: 'Angels & Demons', + author: 'Dan Brown' + }]; + var options = { + keys: ['author', 'title'] + }; + var f = new Fuse(books, options); + var result = f.search('brwn'); +} + +function test_fuse_flat_array() { + var books = ["Old Man's War", "The Lock Artist", "HTML5", "Right Ho Jeeves", "The Code of the Wooster", "Thank You Jeeves", "The DaVinci Code", "Angels & Demons", "The Silmarillion", "Syrup", "The Lost Symbol", "The Book of Lies", "Lamb", "Fool", "Incompetence", "Fat", "Colony", "Backwards, Red Dwarf", "The Grand Design", "The Book of Samson", "The Preservationist", "Fallen", "Monster 1959"]; + var f = new Fuse(books); + var result = f.search('Falen'); +} + +function test_fuse_deep_key_search() { + var books = [{ + id: 1, + title: 'The Great Gatsby', + author: { + firstName: 'F. Scott', + lastName: 'Fitzgerald' + } + }, { + title: 'The DaVinci Code', + author: { + firstName: 'Dan', + lastName: 'Brown' + } + }]; + + var options = { + keys: ['author.firstName'] + } + var f = new Fuse(books, options); + var result = f.search('brwn'); +} diff --git a/fuse/fuse.d.ts b/fuse/fuse.d.ts new file mode 100644 index 000000000..bf175bff6 --- /dev/null +++ b/fuse/fuse.d.ts @@ -0,0 +1,28 @@ +// Type definitions for Fuse.js 1.1.5 +// Project: https://github.com/krisk/Fuse +// Definitions by: Greg Smith +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare class Fuse { + constructor(list: any[], options?: fuse.IFuseOptions); + search(pattern: string): any[]; +} + +declare module fuse { + interface IFuseOptions extends ISearchOptions { + caseSensitive?: boolean; + includeScore?: boolean; + shouldSort?: boolean; + searchFn?: any; + sortFn?: (a: {score: number}, b: {score: number}) => number; + getFn?: (obj: any, path: string) => any; + keys?: string[]; + } + + interface ISearchOptions { + location?: number; + distance?: number; + threshold?: number; + maxPatternLength?: number; + } +} diff --git a/gldatepicker/gldatepicker.d.ts b/gldatepicker/gldatepicker.d.ts index 3ed84c219..0e517057e 100644 --- a/gldatepicker/gldatepicker.d.ts +++ b/gldatepicker/gldatepicker.d.ts @@ -1,6 +1,6 @@ // Type definitions for glDatePicker 2.0 // Project: http://glad.github.com/glDatePicker/ -// Definitions by: Dániel Tar https://github.com/qcz +// Definitions by: Dániel Tar // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -66,4 +66,4 @@ interface GlDatePicker { interface JQuery { glDatePicker(ret: boolean): GlDatePicker; glDatePicker(options?: GlDatePickerOptions): JQuery; -} \ No newline at end of file +} diff --git a/google.visualization/google.visualization.d.ts b/google.visualization/google.visualization.d.ts index 62b2a72d1..38a08ef55 100644 --- a/google.visualization/google.visualization.d.ts +++ b/google.visualization/google.visualization.d.ts @@ -159,40 +159,19 @@ declare module google { enableRegionInteractivity?: boolean; height?: number; keepAspectRatio?: boolean; - legend?: GeoChartLegend; + legend?: ChartLegend; region?: string; magnifyingGlass?: GeoChartMagnifyingGlass; markerOpacity?: number; resolution?: string; - sizeAxis?: GeoChartAxis; - tooltip?: GeoChartTooltip; + sizeAxis?: ChartSizeAxis; + tooltip?: ChartTooltip; width?: number; } - export interface GeoChartAxis { - maxSize?: number; - maxValue?: number; - minSize?: number; - minValue?: number; - } - export interface GeoChartTextStyle { - color?: string; - fontName?: string; - fontSize?: number; - bold?: boolean; - italic?: boolean; - } - export interface GeoChartLegend { - numberFormat?: string; - textStyle?: GeoChartTextStyle; - } export interface GeoChartMagnifyingGlass { enable?: boolean; zoomFactor?: number; } - export interface GeoChartTooltip { - textStyle?: GeoChartTextStyle; - trigger?: string; - } export interface GeoChartRegionClickEvent { region: string; } @@ -276,6 +255,7 @@ declare module google { maxLines?: number; position?: string; textStyle?: ChartTextStyle; + numberFormat?: string; } // https://google-developers.appspot.com/chart/interactive/docs/animation @@ -766,10 +746,10 @@ declare module google { } export interface ChartSizeAxis { - maxSize: number; - maxValue: number; - minSize: number; - minValue: number; + maxSize?: number; + maxValue?: number; + minSize?: number; + minValue?: number; } //#endregion @@ -864,7 +844,7 @@ declare module google { // https://google-developers.appspot.com/chart/interactive/docs/gallery/timeline#Configuration_Options export interface TimelineOptions { avoidOverlappingGridLines?: boolean; - backgroundColor?: string; + backgroundColor?: any; colors?: string[]; enableInteractivity?: boolean; forceIFrame?: boolean; diff --git a/googlemaps.infobubble/google.maps.infobubble.d.ts b/googlemaps.infobubble/google.maps.infobubble.d.ts index 2d88d8645..e8d4d438c 100644 --- a/googlemaps.infobubble/google.maps.infobubble.d.ts +++ b/googlemaps.infobubble/google.maps.infobubble.d.ts @@ -1,10 +1,10 @@ -/// - // Type definitions for CSS3 InfoBubble with tabs for Google Maps API V3 // Project: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobubble/src/ -// Definitions by: Johan Nilsson https://github.com/Dashue +// Definitions by: Johan Nilsson // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + /** * @name CSS3 InfoBubble with tabs for Google Maps API V3 * @version 0.8 @@ -105,4 +105,4 @@ declare module google.maps.infobubble { */ shadowStyle?: number; } -} \ No newline at end of file +} diff --git a/hammerjs/hammerjs.d.ts b/hammerjs/hammerjs.d.ts index 72f09a5e0..f2dff3046 100644 --- a/hammerjs/hammerjs.d.ts +++ b/hammerjs/hammerjs.d.ts @@ -1,6 +1,7 @@ -// Type definitions for Hammer.js 1.0.10 +// Type definitions for Hammer.js 1.1.3 // Project: http://eightmedia.github.com/hammer.js/ // Definitions by: Boris Yankov +// Drew Noakes // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -31,8 +32,6 @@ interface HammerStatic { plugins: any; gestures: any; READY: boolean; - - } declare class HammerInstance { @@ -42,40 +41,51 @@ declare class HammerInstance { off(gesture: string, handler: (event: HammerEvent) => void): HammerInstance; enable(toggle: boolean): HammerInstance; - // You shouldn't use this, this is an internally method use by the gestures. Only use it when you know what you're doing! You can read the sourcecode about how to use this. + // You shouldn't normally use this internal method. Only use it when you know what you're doing! You can read the sourcecode for information about how to use this. trigger(gesture: string, eventData: HammerGestureEventData): HammerInstance; } // Gesture Options : https://github.com/EightMedia/hammer.js/wiki/Getting-Started#gesture-options interface HammerOptions { + behavior?: { + contentZooming?: string; + tapHighlightColor?: string; + touchAction?: string; + touchCallout?: string; + userDrag?: string; + userSelect?: string; + }; + doubleTapDistance?: number; + doubleTapInterval?: number; drag?: boolean; - drag_block_horizontal?: boolean; - drag_block_vertical?: boolean; - drag_lock_to_axis?: boolean; - drag_max_touches?: number; - drag_min_distance?: number; + dragBlockHorizontal?: boolean; + dragBlockVertical?: boolean; + dragDistanceCorrection?: boolean; + dragLockMinDistance?: number; + dragLockToAxis?: boolean; + dragMaxTouches?: number; + dragMinDistance?: number; + gesture?: boolean; hold?: boolean; - hold_threshold?: number; - hold_timeout?: number; - prevent_default?: boolean; - prevent_mouseevents?: boolean; + holdThreshold?: number; + holdTimeout?: number; + preventDefault?: boolean; + preventMouse?: boolean; release?: boolean; - show_touches?: boolean; - stop_browser_behavior?: any; + showTouches?: boolean; swipe?: boolean; - swipe_max_touches?: number; - swipe_velocity?: number; + swipeMaxTouches?: number; + swipeMinTouches?: number; + swipeVelocityX?: number; + swipeVelocityY?: number; tap?: boolean; - tap_always?: boolean; - tap_max_distance?: number; - tap_max_touchtime?: number; - doubletap_distance?: number; - doubletap_interval?: number; + tapAlways?: boolean; + tapMaxDistance?: number; + tapMaxTime?: number; touch?: boolean; transform?: boolean; - transform_always_block?: boolean; - transform_min_rotation?: number; - transform_min_scale?: number; + transformMinRotation?: number; + transformMinScale?: number; } interface HammerGestureEventData { @@ -106,6 +116,8 @@ interface HammerGestureEventData { } interface HammerPoint { + clientX: number; + clientY: number; pageX: number; pageY: number; } diff --git a/highlightjs/highlightjs.d.ts b/highlightjs/highlightjs.d.ts index 9e3567cdb..d730029b5 100644 --- a/highlightjs/highlightjs.d.ts +++ b/highlightjs/highlightjs.d.ts @@ -1,7 +1,8 @@ // Type definitions for highlight.js // Project: https://github.com/isagalaev/highlight.js -// Definitions by: Niklas Mollenhauer +// Definitions by: Niklas Mollenhauer // Definitions: https://github.com/borisyankov/DefinitelyTyped + declare module "highlight.js" { module hljs diff --git a/humane/humane.d.ts b/humane/humane.d.ts index 06f865636..3be0a1d48 100644 --- a/humane/humane.d.ts +++ b/humane/humane.d.ts @@ -1,7 +1,7 @@ // Type definitions for Humane 3.0 // Project: http://wavded.github.com/humane-js/ // Definitions by: jmvrbanac -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped interface HumaneOptions { diff --git a/i18next/i18next.d.ts b/i18next/i18next.d.ts index 6fabcce44..e9083c4d5 100644 --- a/i18next/i18next.d.ts +++ b/i18next/i18next.d.ts @@ -1,6 +1,6 @@ -// Type definitions for i18next (v1.5.10 incl. jQuery) +// Type definitions for i18next v1.5.10 // Project: http://i18next.com -// Definitions by: Maarten Docter - Blog: http://www.maartendocter.nl +// Definitions by: Maarten Docter // Definitions: https://github.com/borisyankov/DefinitelyTyped // Sources: https://github.com/jamuhl/i18next/ diff --git a/iscroll/iscroll-lite.d.ts b/iscroll/iscroll-lite.d.ts index 1cd83b1dd..85d1a6934 100644 --- a/iscroll/iscroll-lite.d.ts +++ b/iscroll/iscroll-lite.d.ts @@ -1,6 +1,6 @@ // Type definitions for iScroll Lite 4.1 // Project: http://cubiq.org/iscroll-4 -// Definitions by: Boris Yankov and Christiaan Rakowski +// Definitions by: Boris Yankov , Christiaan Rakowski // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/iscroll/iscroll.d.ts b/iscroll/iscroll.d.ts index 34234c00a..ff615a5f8 100644 --- a/iscroll/iscroll.d.ts +++ b/iscroll/iscroll.d.ts @@ -1,6 +1,6 @@ // Type definitions for iScroll 4.2 // Project: http://cubiq.org/iscroll-4 -// Definitions by: Boris Yankov and Christiaan Rakowski +// Definitions by: Boris Yankov , Christiaan Rakowski // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/ix.js/l2o.d.ts b/ix.js/l2o.d.ts index 209c9b675..f50d3369d 100644 --- a/ix.js/l2o.d.ts +++ b/ix.js/l2o.d.ts @@ -54,8 +54,10 @@ declare module Ix { some(predicate?: EnumerablePredicate, thisArg?: any): boolean; // alias average(selector?: EnumerableFunc): number; - max(selector?: EnumerableFunc): number; - min(selector?: EnumerableFunc): number; + max(): T; + max(selector: EnumerableFunc): TResult; + min(): T; + min(selector: EnumerableFunc): TResult; sum(selector?: EnumerableFunc): number; concat(...sources: Enumerable[]): Enumerable; @@ -91,16 +93,16 @@ declare module Ix { comparer?: EqualityComparer): Enumerable; groupBy( keySelector: (item: T) => TKey, - elementSelector: (item: T) => TElement): Grouping; + elementSelector: (item: T) => TElement): Enumerable>; groupBy( - keySelector: (item: T) => TKey): Grouping; + keySelector: (item: T) => TKey): Enumerable>; // if need to set comparer without resultSelector groupBy( keySelector: (item: T) => TKey, elementSelector: (item: T) => TElement, _: boolean, - comparer: EqualityComparer): Grouping; + comparer: EqualityComparer): Enumerable>; // if need to set resultSelector without elementSelector groupBy( keySelector: (item: T) => TKey, @@ -112,7 +114,7 @@ declare module Ix { keySelector: (item: T) => TKey, _: boolean, __: boolean, - comparer: EqualityComparer): Grouping; + comparer: EqualityComparer): Enumerable>; groupJoin( inner: Enumerable, diff --git a/jasmine-fixture/jasmine-fixture.d.ts b/jasmine-fixture/jasmine-fixture.d.ts index 4c11fe94f..10da424f7 100644 --- a/jasmine-fixture/jasmine-fixture.d.ts +++ b/jasmine-fixture/jasmine-fixture.d.ts @@ -1,7 +1,7 @@ // Type definitions for Jasmine-fixture 1.0.7 // Project: https://github.com/searls/jasmine-fixture // Definitions by: Craig Brett -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /** Affixes the given jquery selectors into the body and will be removed after each spec * @param {string} selector The JQuery selector to be added to the dom @@ -13,4 +13,4 @@ interface JQuery { * @param {string} selector The JQuery selector to be added to the dom */ affix(selector: string): JQuery; -} \ No newline at end of file +} diff --git a/jasmine-jquery/jasmine-jquery.d.ts b/jasmine-jquery/jasmine-jquery.d.ts index 1d3c30cda..e1ed6c3c0 100644 --- a/jasmine-jquery/jasmine-jquery.d.ts +++ b/jasmine-jquery/jasmine-jquery.d.ts @@ -1,7 +1,7 @@ // Type definitions for Jasmine-JQuery 1.5.8 // Project: https://github.com/velesin/jasmine-jquery // Definitions by: Gregor Stamac -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// /// diff --git a/jasmine/jasmine.d.ts b/jasmine/jasmine.d.ts index d8132b4bc..63d7bde37 100644 --- a/jasmine/jasmine.d.ts +++ b/jasmine/jasmine.d.ts @@ -1,7 +1,7 @@ // Type definitions for Jasmine 2.0 // Project: http://pivotal.github.com/jasmine/ // Definitions by: Boris Yankov , Theodore Brown -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare function describe(description: string, specDefinitions: () => void): void; diff --git a/jasmine/legacy/jasmine-1.3.d.ts b/jasmine/legacy/jasmine-1.3.d.ts index b380959d0..c50621085 100644 --- a/jasmine/legacy/jasmine-1.3.d.ts +++ b/jasmine/legacy/jasmine-1.3.d.ts @@ -1,7 +1,7 @@ // Type definitions for Jasmine 1.3 // Project: http://pivotal.github.com/jasmine/ // Definitions by: Boris Yankov -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare function describe(description: string, specDefinitions: () => void): void; diff --git a/joi/joi-tests.ts b/joi/joi-tests.ts index 45a46dcd0..26048a9dc 100644 --- a/joi/joi-tests.ts +++ b/joi/joi-tests.ts @@ -29,27 +29,6 @@ var funcArr: Function[] = []; // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- -var validOpts: Joi.ValidationOptions = null; - -validOpts = {abortEarly: bool}; -validOpts = {convert: bool}; -validOpts = {allowUnknown: bool}; -validOpts = {skipFunctions: bool}; -validOpts = {stripUnknown: bool}; -validOpts = {language: bool}; - -// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- - -var renOpts: Joi.RenameOptions = null; - -renOpts = {alias: bool}; -renOpts = {multiple: bool}; -renOpts = {override: bool}; - -var validErr: Joi.ValidationError = null; - -// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- - var schema: Joi.Schema = null; var anySchema: Joi.AnySchema = null; @@ -61,9 +40,66 @@ var binSchema: Joi.BinarySchema = null; var dateSchema: Joi.DateSchema = null; var funcSchema: Joi.FunctionSchema = null; var objSchema: Joi.ObjectSchema = null; +var altSchema: Joi.AlternativesSchema = null; var schemaArr: Joi.Schema[] = []; +var ref: Joi.Reference = null; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + +var validOpts: Joi.ValidationOptions = null; + +validOpts = {abortEarly: bool}; +validOpts = {convert: bool}; +validOpts = {allowUnknown: bool}; +validOpts = {skipFunctions: bool}; +validOpts = {stripUnknown: bool}; +validOpts = {language: bool}; +validOpts = {context: obj}; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + +var renOpts: Joi.RenameOptions = null; + +renOpts = {alias: bool}; +renOpts = {multiple: bool}; +renOpts = {override: bool}; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + +var whenOpts: Joi.WhenOptions = null; + +whenOpts = {is: schema}; +whenOpts = {is: schema, then: schema}; +whenOpts = {is: schema, otherwise: schema}; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + +var refOpts: Joi.ReferenceOptions = null; + +refOpts = {alias: bool}; +refOpts = {multiple: bool}; +refOpts = {override: bool}; + +// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- + +var validErr: Joi.ValidationError = null; +var validErrItem: Joi.ValidationErrorItem; + +validErrItem= { + message: str, + type: str, + path: str +}; + +validErrItem = { + message: str, + type: str, + path: str, + options: validOpts +}; + // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- schema = anySchema; @@ -76,6 +112,8 @@ schema = dateSchema; schema = funcSchema; schema = objSchema; +schema = ref; + anySchema = anySchema; anySchema = numSchema; anySchema = strSchema; @@ -99,18 +137,22 @@ schemaMap = { anySchema = Joi.any(); -anySchema.validate(x, (err: Joi.ValidationError, value: any) => { - -}); - module common { anySchema = anySchema.allow(x); + anySchema = anySchema.allow(x, x); + anySchema = anySchema.allow([x, x, x]); anySchema = anySchema.valid(x); + anySchema = anySchema.valid(x, x); + anySchema = anySchema.valid([x, x, x]); anySchema = anySchema.invalid(x); + anySchema = anySchema.invalid(x, x); + anySchema = anySchema.invalid([x, x, x]); + anySchema = anySchema.default(x); anySchema = anySchema.required(); anySchema = anySchema.optional(); + anySchema = anySchema.forbidden(); anySchema = anySchema.description(str); anySchema = anySchema.notes(str); @@ -118,8 +160,16 @@ module common { anySchema = anySchema.tags(str); anySchema = anySchema.tags(strArr); + anySchema = anySchema.meta(obj); + anySchema = anySchema.example(obj); + anySchema = anySchema.unit(str); + anySchema = anySchema.options(validOpts); anySchema = anySchema.strict(); + anySchema = anySchema.concat(x); + + altSchema = anySchema.when(str, whenOpts); + altSchema = anySchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -140,14 +190,23 @@ arrSchema = arrSchema.excludes([numSchema, strSchema]); // - - - - - - - - -module common { - arrSchema = arrSchema.allow(anyArr); - arrSchema = arrSchema.valid(anyArr); - arrSchema = arrSchema.invalid(anyArr); - arrSchema = arrSchema.default(anyArr); +module common_copy_paste { + // use search & replace from any + anySchema = anySchema.allow(x); + anySchema = anySchema.allow(x, x); + anySchema = anySchema.allow([x, x, x]); + anySchema = anySchema.valid(x); + anySchema = anySchema.valid(x, x); + anySchema = anySchema.valid([x, x, x]); + anySchema = anySchema.invalid(x); + anySchema = anySchema.invalid(x, x); + anySchema = anySchema.invalid([x, x, x]); + + anySchema = anySchema.default(x); arrSchema = arrSchema.required(); arrSchema = arrSchema.optional(); + arrSchema = arrSchema.forbidden(); arrSchema = arrSchema.description(str); arrSchema = arrSchema.notes(str); @@ -155,8 +214,16 @@ module common { arrSchema = arrSchema.tags(str); arrSchema = arrSchema.tags(strArr); + arrSchema = arrSchema.meta(obj); + arrSchema = arrSchema.example(obj); + arrSchema = arrSchema.unit(str); + arrSchema = arrSchema.options(validOpts); arrSchema = arrSchema.strict(); + arrSchema = arrSchema.concat(x); + + altSchema = arrSchema.when(str, whenOpts); + altSchema = arrSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -164,14 +231,22 @@ module common { boolSchema = Joi.bool(); boolSchema = Joi.boolean(); -module common { - boolSchema = boolSchema.allow(bool); - boolSchema = boolSchema.valid(bool); - boolSchema = boolSchema.invalid(bool); - boolSchema = boolSchema.default(bool); +module common_copy_paste { + boolSchema = boolSchema.allow(x); + boolSchema = boolSchema.allow(x, x); + boolSchema = boolSchema.allow([x, x, x]); + boolSchema = boolSchema.valid(x); + boolSchema = boolSchema.valid(x, x); + boolSchema = boolSchema.valid([x, x, x]); + boolSchema = boolSchema.invalid(x); + boolSchema = boolSchema.invalid(x, x); + boolSchema = boolSchema.invalid([x, x, x]); + + boolSchema = boolSchema.default(x); boolSchema = boolSchema.required(); boolSchema = boolSchema.optional(); + boolSchema = boolSchema.forbidden(); boolSchema = boolSchema.description(str); boolSchema = boolSchema.notes(str); @@ -179,8 +254,16 @@ module common { boolSchema = boolSchema.tags(str); boolSchema = boolSchema.tags(strArr); + boolSchema = boolSchema.meta(obj); + boolSchema = boolSchema.example(obj); + boolSchema = boolSchema.unit(str); + boolSchema = boolSchema.options(validOpts); boolSchema = boolSchema.strict(); + boolSchema = boolSchema.concat(x); + + altSchema = boolSchema.when(str, whenOpts); + altSchema = boolSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -192,13 +275,21 @@ binSchema = binSchema.max(num); binSchema = binSchema.length(num); module common { - binSchema = binSchema.allow(bin); - binSchema = binSchema.valid(bin); - binSchema = binSchema.invalid(bin); - binSchema = binSchema.default(bin); + binSchema = binSchema.allow(x); + binSchema = binSchema.allow(x, x); + binSchema = binSchema.allow([x, x, x]); + binSchema = binSchema.valid(x); + binSchema = binSchema.valid(x, x); + binSchema = binSchema.valid([x, x, x]); + binSchema = binSchema.invalid(x); + binSchema = binSchema.invalid(x, x); + binSchema = binSchema.invalid([x, x, x]); + + binSchema = binSchema.default(x); binSchema = binSchema.required(); binSchema = binSchema.optional(); + binSchema = binSchema.forbidden(); binSchema = binSchema.description(str); binSchema = binSchema.notes(str); @@ -206,8 +297,16 @@ module common { binSchema = binSchema.tags(str); binSchema = binSchema.tags(strArr); + binSchema = binSchema.meta(obj); + binSchema = binSchema.example(obj); + binSchema = binSchema.unit(str); + binSchema = binSchema.options(validOpts); binSchema = binSchema.strict(); + binSchema = binSchema.concat(x); + + altSchema = binSchema.when(str, whenOpts); + altSchema = binSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -224,23 +323,21 @@ dateSchema = dateSchema.min(num); dateSchema = dateSchema.max(num); module common { - dateSchema = dateSchema.allow(date); - dateSchema = dateSchema.valid(date); - dateSchema = dateSchema.invalid(date); - dateSchema = dateSchema.default(date); - - dateSchema = dateSchema.allow(num); - dateSchema = dateSchema.valid(num); - dateSchema = dateSchema.invalid(num); - dateSchema = dateSchema.default(num); - - dateSchema = dateSchema.allow(str); - dateSchema = dateSchema.valid(str); - dateSchema = dateSchema.invalid(str); - dateSchema = dateSchema.default(str); + dateSchema = dateSchema.allow(x); + dateSchema = dateSchema.allow(x, x); + dateSchema = dateSchema.allow([x, x, x]); + dateSchema = dateSchema.valid(x); + dateSchema = dateSchema.valid(x, x); + dateSchema = dateSchema.valid([x, x, x]); + dateSchema = dateSchema.invalid(x); + dateSchema = dateSchema.invalid(x, x); + dateSchema = dateSchema.invalid([x, x, x]); + + dateSchema = dateSchema.default(x); dateSchema = dateSchema.required(); dateSchema = dateSchema.optional(); + dateSchema = dateSchema.forbidden(); dateSchema = dateSchema.description(str); dateSchema = dateSchema.notes(str); @@ -248,8 +345,16 @@ module common { dateSchema = dateSchema.tags(str); dateSchema = dateSchema.tags(strArr); + dateSchema = dateSchema.meta(obj); + dateSchema = dateSchema.example(obj); + dateSchema = dateSchema.unit(str); + dateSchema = dateSchema.options(validOpts); dateSchema = dateSchema.strict(); + dateSchema = dateSchema.concat(x); + + altSchema = dateSchema.when(str, whenOpts); + altSchema = dateSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -265,13 +370,21 @@ numSchema = numSchema.max(num); numSchema = numSchema.integer(); module common { - numSchema = numSchema.allow(num); - numSchema = numSchema.valid(num); - numSchema = numSchema.invalid(num); - numSchema = numSchema.default(num); + numSchema = numSchema.allow(x); + numSchema = numSchema.allow(x, x); + numSchema = numSchema.allow([x, x, x]); + numSchema = numSchema.valid(x); + numSchema = numSchema.valid(x, x); + numSchema = numSchema.valid([x, x, x]); + numSchema = numSchema.invalid(x); + numSchema = numSchema.invalid(x, x); + numSchema = numSchema.invalid([x, x, x]); + + numSchema = numSchema.default(x); numSchema = numSchema.required(); numSchema = numSchema.optional(); + numSchema = numSchema.forbidden(); numSchema = numSchema.description(str); numSchema = numSchema.notes(str); @@ -279,8 +392,16 @@ module common { numSchema = numSchema.tags(str); numSchema = numSchema.tags(strArr); + numSchema = numSchema.meta(obj); + numSchema = numSchema.example(obj); + numSchema = numSchema.unit(str); + numSchema = numSchema.options(validOpts); numSchema = numSchema.strict(); + numSchema = numSchema.concat(x); + + altSchema = numSchema.when(str, whenOpts); + altSchema = numSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -295,29 +416,48 @@ objSchema = objSchema.min(num); objSchema = objSchema.max(num); objSchema = objSchema.length(num); +objSchema = objSchema.pattern(exp, schema); + +objSchema = objSchema.and(str, str, str); +objSchema = objSchema.and(strArr); + +objSchema = objSchema.or(str, str, str); +objSchema = objSchema.or(strArr); + +objSchema = objSchema.xor(str, str, str); +objSchema = objSchema.xor(strArr); + objSchema = objSchema.with(str, str); objSchema = objSchema.with(str, strArr); objSchema = objSchema.without(str, str); objSchema = objSchema.without(str, strArr); -objSchema = objSchema.xor(str, str, str); -objSchema = objSchema.xor(strArr); - -objSchema = objSchema.or(str, str, str); -objSchema = objSchema.or(strArr); - objSchema = objSchema.rename(str, str); objSchema = objSchema.rename(str, str, renOpts); +objSchema = objSchema.assert(str, schema, str); +objSchema = objSchema.assert(ref, schema, str); + +objSchema = objSchema.unknown(); +objSchema = objSchema.unknown(bool); + module common { - objSchema = objSchema.allow(obj); - objSchema = objSchema.valid(obj); - objSchema = objSchema.invalid(obj); - objSchema = objSchema.default(obj); + objSchema = objSchema.allow(x); + objSchema = objSchema.allow(x, x); + objSchema = objSchema.allow([x, x, x]); + objSchema = objSchema.valid(x); + objSchema = objSchema.valid(x, x); + objSchema = objSchema.valid([x, x, x]); + objSchema = objSchema.invalid(x); + objSchema = objSchema.invalid(x, x); + objSchema = objSchema.invalid([x, x, x]); + + objSchema = objSchema.default(x); objSchema = objSchema.required(); objSchema = objSchema.optional(); + objSchema = objSchema.forbidden(); objSchema = objSchema.description(str); objSchema = objSchema.notes(str); @@ -325,8 +465,16 @@ module common { objSchema = objSchema.tags(str); objSchema = objSchema.tags(strArr); + objSchema = objSchema.meta(obj); + objSchema = objSchema.example(obj); + objSchema = objSchema.unit(str); + objSchema = objSchema.options(validOpts); objSchema = objSchema.strict(); + objSchema = objSchema.concat(x); + + altSchema = objSchema.when(str, whenOpts); + altSchema = objSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -343,35 +491,43 @@ strSchema = strSchema.token(); strSchema = strSchema.email(); strSchema = strSchema.guid(); strSchema = strSchema.isoDate(); +strSchema = strSchema.lowercase(); +strSchema = strSchema.uppercase(); +strSchema = strSchema.trim(); module common { strSchema = strSchema.allow(x); strSchema = strSchema.allow(x, x); - strSchema = strSchema.allow(anyArr); - + strSchema = strSchema.allow([x, x, x]); strSchema = strSchema.valid(x); strSchema = strSchema.valid(x, x); - strSchema = strSchema.valid(anyArr); - + strSchema = strSchema.valid([x, x, x]); strSchema = strSchema.invalid(x); strSchema = strSchema.invalid(x, x); - strSchema = strSchema.invalid(anyArr); + strSchema = strSchema.invalid([x, x, x]); + + strSchema = strSchema.default(x); strSchema = strSchema.required(); - strSchema = strSchema.optional(); + strSchema = strSchema.forbidden(); strSchema = strSchema.description(str); - strSchema = strSchema.notes(str); strSchema = strSchema.notes(strArr); - strSchema = strSchema.tags(str); strSchema = strSchema.tags(strArr); + strSchema = strSchema.meta(obj); + strSchema = strSchema.example(obj); + strSchema = strSchema.unit(str); + strSchema = strSchema.options(validOpts); strSchema = strSchema.strict(); - strSchema = strSchema.default(x); + strSchema = strSchema.concat(x); + + altSchema = strSchema.when(str, whenOpts); + altSchema = strSchema.when(ref, whenOpts); } // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- @@ -390,6 +546,13 @@ Joi.validate(value, schema, validOpts, (err, value) => { str = err.details[0].message; str = err.details[0].type; }); +Joi.validate(value, schema, (err, value) => { + x = value; + str = err.message; + str = err.details[0].path; + str = err.details[0].message; + str = err.details[0].type; +}); // variant Joi.validate(num, schema, validOpts, (err, value) => { num = value; @@ -401,3 +564,8 @@ Joi.validate(value, {}); // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- schema = Joi.compile(obj); + +Joi.assert(obj, schema); + +ref = Joi.ref(str, refOpts); +ref = Joi.ref(str); diff --git a/joi/joi.d.ts b/joi/joi.d.ts index 10bc7225e..57e48a023 100644 --- a/joi/joi.d.ts +++ b/joi/joi.d.ts @@ -1,8 +1,10 @@ -// Type definitions for joi v4.0.0 +// Type definitions for joi v4.6.0 // Project: https://github.com/spumko/joi // Definitions by: Bart van der Schoor // Definitions: https://github.com/borisyankov/DefinitelyTyped +// TODO express type of Schema in a type-parameter (.default, .valid, .example etc) + declare module 'joi' { export interface ValidationOptions { @@ -18,6 +20,8 @@ declare module 'joi' { stripUnknown?: boolean; // overrides individual error messages. Defaults to no override ({}). language?: Object + // provides an external data set to be used in references + context?: Object; } export interface RenameOptions { @@ -29,6 +33,20 @@ declare module 'joi' { override?: boolean; } + export interface WhenOptions { + // the required condition joi type. + is: Schema; + // the alternative schema type if the condition is true. Required if otherwise is missing. + then?: Schema; + // the alternative schema type if the condition is false. Required if then is missing + otherwise?: Schema; + } + + export interface ReferenceOptions { + separator?: string; + contextPrefix?: string; + } + export interface ValidationError { message: string; details: ValidationErrorItem[]; @@ -48,12 +66,14 @@ declare module 'joi' { } export interface Schema extends AnySchema { + + } + + export interface Reference extends Schema { + } export interface AnySchema> { - - validate(value: U, options?: ValidationOptions, callback?: (err: ValidationError, value: U) => void): void; - /** * Whitelists a value */ @@ -82,6 +102,11 @@ declare module 'joi' { */ optional(): T; + /** + * Marks a key as forbidden which will not allow any value except undefined. Used to explicitly forbid keys. + */ + forbidden(): T; + /** * Annotates the key */ @@ -100,7 +125,22 @@ declare module 'joi' { tags(notes: string[]): T; /** - * Overrides the global validate() options for the current key and any sub-key + * Attaches metadata to the key. + */ + meta(meta: Object): T; + + /** + * Annotates the key with an example value, must be valid. + */ + example(value: any): T; + + /** + * Annotates the key with an unit name. + */ + unit(name: string): T; + + /** + * Overrides the global validate() options for the current key and any sub-key. */ options(options: ValidationOptions): T; @@ -110,9 +150,20 @@ declare module 'joi' { strict(): T; /** - * Sets a default value if the original value is undefined + * Sets a default value if the original value is undefined. */ default(value: any): T; + + /** + * Returns a new type that is the result of adding the rules of one type to another. + */ + concat(schema: T): T; + + /** + * Converts the type into an alternatives type where the conditions are merged into the type definition where: + */ + when(ref: string, options: WhenOptions): AlternativesSchema; + when(ref: Reference, options: WhenOptions): AlternativesSchema; } export interface BooleanSchema extends AnySchema { @@ -187,6 +238,20 @@ declare module 'joi' { */ isoDate(): StringSchema; + /** + * Requires the string value to be all lowercase. If the validation convert option is on (enabled by default), the string will be forced to lowercase. + */ + lowercase(): StringSchema; + + /** + * Requires the string value to be all uppercase. If the validation convert option is on (enabled by default), the string will be forced to uppercase. + */ + uppercase(): StringSchema; + + /** + * Requires the string value to contain no whitespace before or after. If the validation convert option is on (enabled by default), the string will be trimmed. + */ + trim(): StringSchema; } export interface ArraySchema extends AnySchema { @@ -240,6 +305,29 @@ declare module 'joi' { */ length(limit: number): ObjectSchema; + /** + * Specify validation rules for unknown keys matching a pattern. + */ + pattern(regex: RegExp, schema: Schema): ObjectSchema; + + /** + * Defines an all-or-nothing relationship between keys where if one of the peers is present, all of them are required as well. + */ + and(peer1: string, peer2: string, ...peers: string[]): ObjectSchema; + and(peers: string[]): ObjectSchema; + + /** + * Defines a relationship between keys where one of the peers is required (and more than one is allowed). + */ + or(peer1: string, peer2: string, ...peers: string[]): ObjectSchema; + or(peers: string[]): ObjectSchema; + + /** + * Defines an exclusive relationship between a set of keys. one of them is required but not at the same time where: + */ + xor(peer1: string, peer2: string, ...peers: string[]): ObjectSchema; + xor(peers: string[]): ObjectSchema; + /** * Requires the presence of other keys whenever the specified key is present. */ @@ -252,22 +340,21 @@ declare module 'joi' { without(key: string, peers: string): ObjectSchema; without(key: string, peers: string[]): ObjectSchema; - /** - * Defines an exclusive relationship between a set of keys. one of them is required but not at the same time where: - */ - xor(peer1: string, peer2: string, ...peers: string[]): ObjectSchema; - xor(peers: string[]): ObjectSchema; - - /** - * Defines a relationship between keys where one of the peers is required (and more than one is allowed). - */ - or(peer1: string, peer2: string, ...peers: string[]): ObjectSchema; - or(peers: string[]): ObjectSchema; - /** * Renames a key to another name (deletes the renamed key). */ rename(from: string, to: string, options?: RenameOptions): ObjectSchema; + + /** + * Verifies an assertion where. + */ + assert(ref: string, schema: Schema, message: string): ObjectSchema; + assert(ref: Reference, schema: Schema, message: string): ObjectSchema; + + /** + * Overrides the handling of unknown keys for the scope of the current object only (does not apply to children). + */ + unknown(allow?:boolean): ObjectSchema; } export interface BinarySchema extends AnySchema { @@ -308,6 +395,12 @@ declare module 'joi' { } + export interface AlternativesSchema extends AnySchema { + try(schemas: Schema[]): AlternativesSchema; + when(ref: string, options: WhenOptions): AlternativesSchema; + when(ref: Reference, options: WhenOptions): AlternativesSchema; + } + // --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- /** @@ -368,10 +461,21 @@ declare module 'joi' { */ export function validate(value: T, schema: Schema, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void; export function validate(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void; + export function validate(value: T, schema: Schema, callback: (err: ValidationError, value: T) => void): void; + export function validate(value: T, schema: Object, callback: (err: ValidationError, value: T) => void): void; /** * Converts literal schema definition to joi schema object (or returns the same back if already a joi schema object). */ export function compile(schema: Object): Schema; + /** + * Validates a value against a schema and throws if validation fails. + */ + export function assert(value: any, schema: Schema): void; + + /** + * Generates a reference to the value of the named key. + */ + export function ref(key:string, options?: ReferenceOptions): Reference; } diff --git a/jqrangeslider/jqrangeslider.d.ts b/jqrangeslider/jqrangeslider.d.ts index ef688e5d9..b41df43c0 100644 --- a/jqrangeslider/jqrangeslider.d.ts +++ b/jqrangeslider/jqrangeslider.d.ts @@ -1,6 +1,6 @@ // Type definitions for jQRangeSlider 4.2.8 // Project: http://ghusse.github.com/jQRangeSlider -// Definitions by: Dániel Tar https://github.com/qcz +// Definitions by: Dániel Tar // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/jquery.address/jquery.address.d.ts b/jquery.address/jquery.address.d.ts index bbf91d84a..59f534eff 100644 --- a/jquery.address/jquery.address.d.ts +++ b/jquery.address/jquery.address.d.ts @@ -1,6 +1,6 @@ // Type definitions for jQuery.Address 1.5 // Project: https://github.com/asual/jquery-address -// Definitions by: Martin Duparc <@martinduparc> +// Definitions by: Martin Duparc // Definitions: https://github.com/borisyankov/DefinitelyTyped/ /// diff --git a/jquery.clientSideLogging/jquery.clientSideLogging.d.ts b/jquery.clientSideLogging/jquery.clientSideLogging.d.ts index b52f41be1..4f1318a1f 100644 --- a/jquery.clientSideLogging/jquery.clientSideLogging.d.ts +++ b/jquery.clientSideLogging/jquery.clientSideLogging.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jquery.clientSideLogging. +// Type definitions for jquery.clientSideLogging // Project: https://github.com/remybach/jQuery.clientSideLogging // Definitions by: Diullei Gomes // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/jquery.colorbox/jquery.colorbox.d.ts b/jquery.colorbox/jquery.colorbox.d.ts index d28422346..e13b0bbd5 100644 --- a/jquery.colorbox/jquery.colorbox.d.ts +++ b/jquery.colorbox/jquery.colorbox.d.ts @@ -1,6 +1,6 @@ // Type definitions for jQuery.Colorbox 1.4.15 // Project: http://www.jacklmoore.com/colorbox/ -// Definitions by: Gidon Junge <@gjunge> +// Definitions by: Gidon Junge // Definitions: https://github.com/borisyankov/DefinitelyTyped/ /// diff --git a/jquery.cycle/jquery.cycle.d.ts b/jquery.cycle/jquery.cycle.d.ts index dfe8e1c5c..b482eda80 100644 --- a/jquery.cycle/jquery.cycle.d.ts +++ b/jquery.cycle/jquery.cycle.d.ts @@ -1,6 +1,6 @@ -// Type definitions for jQuery.cycle.js 2.9999.81 (15-JAN-2013) +// Type definitions for jQuery.cycle.js // Project: http://jquery.malsup.com/cycle/ -// Definitions by: Franois Guillot +// Definitions by: François Guillot // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -90,4 +90,4 @@ interface Cycle { interface JQuery { cycle: Cycle; -} \ No newline at end of file +} diff --git a/jquery.cycle2/jquery.cycle2.d.ts b/jquery.cycle2/jquery.cycle2.d.ts index 699d2aff8..d27fbf1c8 100644 --- a/jquery.cycle2/jquery.cycle2.d.ts +++ b/jquery.cycle2/jquery.cycle2.d.ts @@ -1,5 +1,6 @@ // Type definitions for jQuery Cycle2 version 2.1.2 (build 20140216) -// Project: http://jquery.malsup.com/cycle2/ (also https://github.com/malsup/cycle2) +// Project: http://jquery.malsup.com/cycle2/ +// https://github.com/malsup/cycle2 // Definitions by: Donny Nadolny // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -140,4 +141,4 @@ declare module JQueryCycle2 { interface Transition { before(opts: Options, curr: Element, next: Element, fwd: boolean): void; } -} \ No newline at end of file +} diff --git a/jquery.dynatree/jquery.dynatree.d.ts b/jquery.dynatree/jquery.dynatree.d.ts index 91425644d..c2dc0f928 100644 --- a/jquery.dynatree/jquery.dynatree.d.ts +++ b/jquery.dynatree/jquery.dynatree.d.ts @@ -1,22 +1,23 @@ -// Type definitions for jquery.dynatree 1.2 +// Type definitions for jquery.dynatree 1.2.5 // Project: http://code.google.com/p/dynatree/ -// Definitions by: https://github.com/fdecampredon +// Definitions by: François de Campredon // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// + +declare module JQueryUI { + interface UI { + dynatree: DynatreeNamespace + } +} interface JQuery { dynatree(options?: DynatreeOptions): DynaTree; dynatree(option?: string, ...rest: any[]): any; } -interface JQueryStatic { - ui: { - dynatree: DynatreeNamespace; - }; -} - interface DynaTree { activateKey(key: string): DynaTreeNode; count(): number; @@ -39,7 +40,7 @@ interface DynaTree { renderInvisibleNodes(): void; selectKey(key: string, flag: string): DynaTreeNode; serializeArray(stopOnParents: boolean): any[]; - toDict(): any; + toDict(includeRoot?: boolean): any; visit(fn: (node: DynaTreeNode) =>boolean, includeRoot: boolean): void; } @@ -77,6 +78,7 @@ interface DynaTreeNode { makeVisible(): boolean; move(targetNode: DynaTreeNode, mode: string): boolean; reload(force: boolean): void; + reloadChildren(callback?: (node: DynaTreeNode, isOk: boolean) => any): void; remove(): void; removeChildren(): void; render(useEffects: boolean, includeInvisible: boolean): void; @@ -177,7 +179,7 @@ interface DynaTreeDataModel { interface DynaTreeDNDOptions { autoExpandMS?: number; // Expand nodes after n milliseconds of hovering. preventVoidMoves?: boolean; // Prevent dropping nodes 'before self', etc. - + revert: boolean; // true: slide helper back to source if drop is rejected // Make tree nodes draggable: onDragStart?: (sourceNode: any) =>void; // Callback(sourceNode), return true, to enable dnd diff --git a/jquery.menuaim/jquery.menuaim.d.ts b/jquery.menuaim/jquery.menuaim.d.ts index 54215620a..86000419f 100644 --- a/jquery.menuaim/jquery.menuaim.d.ts +++ b/jquery.menuaim/jquery.menuaim.d.ts @@ -1,6 +1,6 @@ // Type definitions for jQuery-menu-aim // Project: https://github.com/kamens/jQuery-menu-aim -// Definitions by: Robert Fonseca-Ensor +// Definitions by: Robert Fonseca-Ensor // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/jquery.pjax/jquery.pjax-tests.ts b/jquery.pjax/jquery.pjax-tests.ts new file mode 100644 index 000000000..214bb3922 --- /dev/null +++ b/jquery.pjax/jquery.pjax-tests.ts @@ -0,0 +1,60 @@ +/// +/// + +function test_fn_pjax() { + $(document).pjax("a"); + $(document).pjax("a", "#pjax-container"); + $(document).pjax("a", { push: true }); + $(document).pjax("a", "#pjax-container", { push: true }); +} + +function test_pjax() { + $.pjax(); + $.pjax({ + url: "hello.html", + container: "#main" + }); +} + +function test_click() { + var event = $.Event("click"); + $.pjax.click(event, "#pjax-container"); + $.pjax.click(event, { container: "#pjax-container" }); + $.pjax.click(event, "#pjax-container", { push: true }); +} + +function test_submit() { + var event = $.Event("submit"); + $.pjax.submit(event, "#pjax-container"); + $.pjax.submit(event, { container: "#pjax-container" }); + $.pjax.submit(event, "#pjax-container", { push: true }); +} + +function test_enable() { + $.pjax.enable(); +} + +function test_disable() { + $.pjax.disable(); +} + +function test_reload() { + $.pjax.reload(); +} + +function test_defauluts() { + $.pjax.defaults = { + timeout: 650, + push: true, + replace: false, + type: 'GET', + dataType: 'html', + scrollTo: 0, + maxCacheLength: 20, + version: $.noop + }; +} + +function test_support() { + console.log($.support.pjax); +} diff --git a/jquery.pjax/jquery.pjax.d.ts b/jquery.pjax/jquery.pjax.d.ts new file mode 100644 index 000000000..621d87d21 --- /dev/null +++ b/jquery.pjax/jquery.pjax.d.ts @@ -0,0 +1,142 @@ +// Type definitions for jquery-pjax +// Project: https://github.com/defunkt/jquery-pjax +// Definitions by: Junle Li +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface PjaxSettings extends JQueryAjaxSettings { + /** + * A jQuery selector indicates where to stick the response body. E.g., $(container).html(xhr.responseBody). + * If it is not defined, the `data-pjax` attribute of the link will be treated as container. + * If such an attribute is not defined too, the context will be treated as container. + */ + container?: string; + + /** + * Whether to pushState the URL. Defaults to true. + */ + push?: boolean; + + /** + * Whether to replaceState the URL. Defaults to false. + */ + replace?: boolean; +} + +interface JQuery { + /** + * Tell PJAX to listen links with delegation selector that, when click on them, fetches the href with ajax into the container. + * Tries to make sure the back button and ctrl+click work the way you'd expect. + * If `options.container` is not defined, the `data-pjax` attribute of the link will be treated as container. + * If such an attribute is not defined too, the context runs with this statement will be treated as container. + * @param delegationSelector The selector to limit which links PJAX should listen on. + * @param options PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options: + * - container: a jQuery selector indicates where to stick the response body. E.g., $(container).html(xhr.responseBody). + * - push: a boolean indicates whether to pushState the URL. Default is true. + * - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false. + * @return Returns the jQuery object + */ + pjax(delegationSelector: string, options?: PjaxSettings): JQuery; + + /** + * Tell PJAX to listen links with delegation selector that, when click on them, fetches the href with ajax into the container. + * Tries to make sure the back button and ctrl+click work the way you'd expect. + * If `options.container` is not defined, the `data-pjax` attribute of the link will be treated as container. + * If such an attribute is not defined too, the context runs with this statement will be treated as container. + * @param delegationSelector The selector to limit which links PJAX should listen on. + * @param containerSelector A jQuery selector indicates where to stick the response body. E.g., $(containerSelector).html(xhr.responseBody). + * @param options PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options: + * - container: a jQuery selector indicates where to stick the response body. The `containerSelector` parameter has priority. + * - push: a boolean indicates whether to pushState the URL. Default is true. + * - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false. + * @return Returns the jQuery object + */ + pjax(delegationSelector: string, containerSelector?: string, options?: PjaxSettings): JQuery; +} + +interface JQueryStatic { + pjax: PjaxStatic; +} + +interface PjaxStatic { + /** + * PJAX default settings. + */ + defaults: PjaxSettings; + + /** + * Loads a URL with ajax, puts the response body inside a container, then pushState()'s the loaded URL. + * Works just like $.ajax in that it accepts a jQuery ajax settings object (with keys like url, type, data, etc). + * @param options PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options: + * - container: a jQuery selector indicates where to stick the response body. E.g., $(container).html(xhr.responseBody). + * - push: a boolean indicates whether to pushState the URL. Default is true. + * - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false. + */ + (options?: PjaxSettings): JQueryXHR; + + /** + * PJAX on click handler. + * @param event A jQuery click event. + * @param options PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options: + * - container: a jQuery selector indicates where to stick the response body. E.g., $(container).html(xhr.responseBody). + * - push: a boolean indicates whether to pushState the URL. Default is true. + * - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false. + */ + click(event: JQueryEventObject, options?: PjaxSettings): void; + + /** + * PJAX on click handler. + * @param event A jQuery click event. + * @param containerSelector A jQuery selector indicates where to stick the response body. E.g., $(containerSelector).html(xhr.responseBody). + * @param options PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options: + * - container: a jQuery selector indicates where to stick the response body. The `containerSelector` parameter has priority. + * - push: a boolean indicates whether to pushState the URL. Default is true. + * - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false. + */ + click(event: JQueryEventObject, containerSelector?: string, options?: PjaxSettings): void; + + /** + * PJAX on form submit handler + * @param event A jQuery click event. + * @param options PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options: + * - container: a jQuery selector indicates where to stick the response body. E.g., $(container).html(xhr.responseBody). + * - push: a boolean indicates whether to pushState the URL. Default is true. + * - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false. + */ + submit(event: JQueryEventObject, options?: PjaxSettings): void; + + /** + * PJAX on form submit handler + * @param event A jQuery click event. + * @param containerSelector A jQuery selector indicates where to stick the response body. E.g., $(containerSelector).html(xhr.responseBody). + * @param options PJAX settings, which is a superset of jQuery AJAX settings. It includes the following specific options: + * - container: a jQuery selector indicates where to stick the response body. The `containerSelector` parameter has priority. + * - push: a boolean indicates whether to pushState the URL. Default is true. + * - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false. + */ + submit(event: JQueryEventObject, containerSelector?: string, options?: PjaxSettings): void; + + /** + * Install pjax functions on $.pjax to enable pushState behavior. Does nothing if already enabled. + */ + enable(): void; + + /** + * Disable pushState behavior. + * This is the case when a browser doesn't support pushState. It is sometimes useful to disable pushState for debugging on a modern browser. + */ + disable(): void; + + /** + * Reload current page with pjax. + */ + reload(): JQueryXHR; +} + +interface JQuerySupport { + /** + * A boolean value indicates if pjax is supported by the browser. + */ + pjax: boolean; +} diff --git a/jquery.pnotify/jquery.pnotify.d.ts b/jquery.pnotify/jquery.pnotify.d.ts index d467a9999..73d0411d5 100644 --- a/jquery.pnotify/jquery.pnotify.d.ts +++ b/jquery.pnotify/jquery.pnotify.d.ts @@ -1,6 +1,6 @@ // Type definitions for jquery.pnotify 1.3.1 -// Project: https://github.com/sciactive/pnotify -// Definitions by: https://github.com/DavidSichau +// Project: https://github.com/sciactive/pnotify +// Definitions by: David Sichau // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/jquery.tagsmanager/jquery.tagsmanager.d.ts b/jquery.tagsmanager/jquery.tagsmanager.d.ts index ce03f2dab..4523751c4 100644 --- a/jquery.tagsmanager/jquery.tagsmanager.d.ts +++ b/jquery.tagsmanager/jquery.tagsmanager.d.ts @@ -1,6 +1,6 @@ // Type definitions for jQuery Tags Manager // Project: http://welldonethings.com/tags/manager -// Definitions by: https://github.com/vbortone +// Definitions by: Vincent Bortone // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/jquery.timepicker/jquery.timepicker.d.ts b/jquery.timepicker/jquery.timepicker.d.ts index a63e073bb..13a6d2e69 100644 --- a/jquery.timepicker/jquery.timepicker.d.ts +++ b/jquery.timepicker/jquery.timepicker.d.ts @@ -1,6 +1,6 @@ // Type definitions for jQuery UI Timepicker 0.3 // Project: http://fgelinas.com/code/timepicker/ -// Definitions by: https://github.com/anwarjaved +// Definitions by: Anwar Javed // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/jquery.ui.datetimepicker/jquery.ui.datetimepicker.d.ts b/jquery.ui.datetimepicker/jquery.ui.datetimepicker.d.ts index 9d452332b..4e592e728 100644 --- a/jquery.ui.datetimepicker/jquery.ui.datetimepicker.d.ts +++ b/jquery.ui.datetimepicker/jquery.ui.datetimepicker.d.ts @@ -1,7 +1,6 @@ -// Type definitions for jQuery UI DateTimePicker 0.3 Addon -// +// Type definitions for jQuery UI DateTimePicker 0.3 // Project: http://trentrichardson.com/examples/timepicker/ -// Definitions by: https://github.com/dougajmcdonald +// Definitions by: dougajmcdonald // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/jquery.validation/jquery.validation.d.ts b/jquery.validation/jquery.validation.d.ts index 585fb484f..f66edadab 100644 --- a/jquery.validation/jquery.validation.d.ts +++ b/jquery.validation/jquery.validation.d.ts @@ -1,6 +1,6 @@ // Type definitions for jquery.validation 1.11.1 // Project: http://jqueryvalidation.org/ -// Definitions by: https://github.com/fdecampredon , https://github.com/johnnyreilly +// Definitions by: François de Campredon , Johj Reilly // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/jquery.watermark/jquery.watermark.d.ts b/jquery.watermark/jquery.watermark.d.ts index fd233ee67..cb746bee6 100644 --- a/jquery.watermark/jquery.watermark.d.ts +++ b/jquery.watermark/jquery.watermark.d.ts @@ -1,6 +1,6 @@ // Type definitions for Watermark plugin for jQuery 3.1 // Project: http://jquery-watermark.googlecode.com -// Definitions by: https://github.com/anwarjaved +// Definitions by: Anwar Javed // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -27,4 +27,4 @@ interface JQuery { interface JQueryStatic { watermark: Watermark; -} \ No newline at end of file +} diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 79dda3e54..62c237b47 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -6,7 +6,7 @@ function test_add() { $('li').add('p').css('background-color', 'red'); $('li').add(document.getElementsByTagName('p')[0]) - .css('background-color', 'red'); + .css('background-coailor', 'red'); $('li').add('

new paragraph

') .css('background-color', 'red'); $("div").css("border", "2px solid red") @@ -86,6 +86,9 @@ function test_ajax() { success: function (data) { $('.result').html(data); alert('Load was performed.'); + }, + error: function (jqXHR, textStatus, errorThrown) { + alert('Load failed. responseJSON=' + jqXHR.responseJSON); } }); var _super = jQuery.ajaxSettings.xhr; diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index d6a6a792e..6b4ebb68a 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -1,6 +1,6 @@ // Type definitions for jQuery 1.10.x / 2.0.x // Project: http://jquery.com/ -// Definitions by: Boris Yankov , Christian Hoffmeister , Steve Fenton, Diullei Gomes , Tass Iliopoulos , Jason Swearingen, Sean Hill , Guus Goossens , Kelly Summerlin , Basarat Ali Syed , Nicholas Wolverson , Derek Cicerone , Andrew Gaspar , James Harrison Fisher , Seikichi Kondo , Benjamin Jackman , Poul Sorensen , Josh Strobl , John Reilly +// Definitions by: Boris Yankov , Christian Hoffmeister , Steve Fenton , Diullei Gomes , Tass Iliopoulos , Jason Swearingen , Sean Hill , Guus Goossens , Kelly Summerlin , Basarat Ali Syed , Nicholas Wolverson , Derek Cicerone , Andrew Gaspar , James Harrison Fisher , Seikichi Kondo , Benjamin Jackman , Poul Sorensen , Josh Strobl , John Reilly // Definitions: https://github.com/borisyankov/DefinitelyTyped /* ***************************************************************************** @@ -80,7 +80,7 @@ interface JQueryAjaxSettings { /** * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event. */ - error? (jqXHR: JQueryXHR, textStatus: string, errorThrow: string): any; + error? (jqXHR: JQueryXHR, textStatus: string, errorThrown: string): any; /** * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events. */ @@ -168,6 +168,10 @@ interface JQueryXHR extends XMLHttpRequest, JQueryPromise { */ overrideMimeType(mimeType: string): any; abort(statusText?: string): void; + /** + * Property containing the parsed response if the response Content-Type is json + */ + responseJSON?: any; } /** diff --git a/js-fixtures/fixtures.d.ts b/js-fixtures/fixtures.d.ts index 92bd548e0..4adb6f378 100644 --- a/js-fixtures/fixtures.d.ts +++ b/js-fixtures/fixtures.d.ts @@ -1,7 +1,7 @@ // Type definitions for js-fixtures 1.2.0 // Project: https://github.com/badunk/js-fixtures // Definitions by: Kazi Manzur Rashid -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped interface Fixtures { path: string; @@ -18,4 +18,4 @@ interface Fixtures { cleanUp(): void; } -declare var fixtures: Fixtures; \ No newline at end of file +declare var fixtures: Fixtures; diff --git a/js-signals/js-signals.d.ts b/js-signals/js-signals.d.ts index 4d7d33344..c64c6db2a 100644 --- a/js-signals/js-signals.d.ts +++ b/js-signals/js-signals.d.ts @@ -1,7 +1,7 @@ // Type definitions for JS-Signals // Project: http://millermedeiros.github.io/js-signals/ // Definitions by: Diullei Gomes -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped interface SignalBinding { active: boolean; diff --git a/js-url/js-url.d.ts b/js-url/js-url.d.ts index ff974f15e..e5df9c246 100644 --- a/js-url/js-url.d.ts +++ b/js-url/js-url.d.ts @@ -1,4 +1,4 @@ -// Type definitions for url() v1.8.6 +// Type definitions for url v1.8.6 // Project: https://github.com/websanova/js-url // Definitions by: MIZUNE Pine // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/jsplumb/jquery.jsPlumb.d.ts b/jsplumb/jquery.jsPlumb.d.ts index ffa26eea8..39d5bf869 100644 --- a/jsplumb/jquery.jsPlumb.d.ts +++ b/jsplumb/jquery.jsPlumb.d.ts @@ -1,4 +1,4 @@ -// Type definitions for jsPlumb 1.3.16 jQuery adapter. +// Type definitions for jsPlumb 1.3.16 jQuery adapter // Project: http://jsplumb.org // Definitions by: Steve Shearn // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -19,26 +19,26 @@ interface jsPlumbInstance { addEndpoint(ep: string): any; removeClass(el: any, clazz: string): void; hasClass(el: any, clazz: string): void; - draggable(el: string, options?: DragOptions): jsPlumbInstance; - draggable(ids: string[], options?: DragOptions): jsPlumbInstance; + draggable(el: string, options?: DragOptions): jsPlumbInstance; + draggable(ids: string[], options?: DragOptions): jsPlumbInstance; connect(connection: ConnectParams, referenceParams?: ConnectParams): Connection; makeSource(el: string, options: SourceOptions): void; makeTarget(el: string, options: TargetOptions): void; repaintEverything(): void; detachEveryConnection(): void; detachAllConnections(el: string): void; - removeAllEndpoints(el: string, recurse?: boolean): jsPlumbInstance; - removeAllEndpoints(el: Element, recurse?: boolean): jsPlumbInstance; + removeAllEndpoints(el: string, recurse?: boolean): jsPlumbInstance; + removeAllEndpoints(el: Element, recurse?: boolean): jsPlumbInstance; select(params: SelectParams): Connections; getConnections(options?: any, flat?: any): any[]; - deleteEndpoint(uuid: string, doNotRepaintAfterwards?: boolean): jsPlumbInstance; - deleteEndpoint(endpoint: Endpoint, doNotRepaintAfterwards?: boolean): jsPlumbInstance; - repaint(el: string): jsPlumbInstance; - repaint(el: Element): jsPlumbInstance; - - SVG: string; - CANVAS: string; - VML: string; + deleteEndpoint(uuid: string, doNotRepaintAfterwards?: boolean): jsPlumbInstance; + deleteEndpoint(endpoint: Endpoint, doNotRepaintAfterwards?: boolean): jsPlumbInstance; + repaint(el: string): jsPlumbInstance; + repaint(el: Element): jsPlumbInstance; + + SVG: string; + CANVAS: string; + VML: string; } interface Defaults { @@ -48,8 +48,8 @@ interface Defaults { ConnectionsDetachable?: boolean; ReattachConnections?: boolean; ConnectionOverlays?: any[][]; - Container?: any; // string(selector or id) or element - DragOptions?: DragOptions; + Container?: any; // string(selector or id) or element + DragOptions?: DragOptions; } interface PaintStyle { @@ -76,8 +76,8 @@ interface Connections { } interface ConnectParams { - source?: any; // string, element or endpoint - target?: any; // string, element or endpoint + source?: any; // string, element or endpoint + target?: any; // string, element or endpoint detachable?: boolean; deleteEndpointsOnDetach?: boolean; endPoint?: string; @@ -118,11 +118,11 @@ interface SelectParams { target: string; } -interface Connection { - setDetachable(detachable: boolean): void; - setParameter(name: string, value: T): void; - endpoints: Endpoint[]; -} - -interface Endpoint { -} \ No newline at end of file +interface Connection { + setDetachable(detachable: boolean): void; + setParameter(name: string, value: T): void; + endpoints: Endpoint[]; +} + +interface Endpoint { +} diff --git a/jsrender/jsrender.d.ts b/jsrender/jsrender.d.ts index 8cdfa13a1..755b17f93 100644 --- a/jsrender/jsrender.d.ts +++ b/jsrender/jsrender.d.ts @@ -1,6 +1,6 @@ // Type definitions for JsRender // Project: http://www.jsviews.com/#jsrender -// Definitions by: https://github.com/zakki +// Definitions by: Kensuke Matsuzaki // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/karma-jasmine/karma-jasmine.d.ts b/karma-jasmine/karma-jasmine.d.ts index 92b5e962d..e4cdc5a81 100644 --- a/karma-jasmine/karma-jasmine.d.ts +++ b/karma-jasmine/karma-jasmine.d.ts @@ -1,6 +1,6 @@ // Type definitions for karma-jasmine plugin // Project: https://github.com/karma-runner/karma-jasmine -// Definitions by: Michel Salib +// Definitions by: Michel Salib // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/kineticjs/kineticjs.d.ts b/kineticjs/kineticjs.d.ts index bbe2d68e8..ecfbbae1f 100644 --- a/kineticjs/kineticjs.d.ts +++ b/kineticjs/kineticjs.d.ts @@ -1,7 +1,7 @@ // Type definitions for KineticJS // Project: http://kineticjs.com/ // Definitions by: Basarat Ali Syed , Ralph de Ruijter -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare module Kinetic { @@ -544,4 +544,4 @@ declare module Kinetic { width: number; height: number; } -} \ No newline at end of file +} diff --git a/knockout.editables/ko.editables.d.ts b/knockout.editables/ko.editables.d.ts index b6da1f13f..8167b3eaf 100644 --- a/knockout.editables/ko.editables.d.ts +++ b/knockout.editables/ko.editables.d.ts @@ -1,5 +1,5 @@ // Type definitions for knockout-editables 0.9 -// Project:http://romanych.github.com/ko.editables/ +// Project: http://romanych.github.com/ko.editables/ // Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/knockout.mapper/knockout.mapper.d.ts b/knockout.mapper/knockout.mapper.d.ts index 8052e4cc7..30476f746 100644 --- a/knockout.mapper/knockout.mapper.d.ts +++ b/knockout.mapper/knockout.mapper.d.ts @@ -1,7 +1,7 @@ // Type definitions for Knockout.Mapper // Project: https://github.com/LucasLorentz/knockout.mapper // Definitions by: Brandon Meyer -// Definitions https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -12,4 +12,4 @@ interface KnockoutMapper { interface KnockoutStatic { mapper: KnockoutMapper; -} \ No newline at end of file +} diff --git a/knockout.mapping/knockout.mapping.d.ts b/knockout.mapping/knockout.mapping.d.ts index e8ffc807e..2c8af4785 100644 --- a/knockout.mapping/knockout.mapping.d.ts +++ b/knockout.mapping/knockout.mapping.d.ts @@ -1,7 +1,7 @@ // Type definitions for Knockout.Mapping 2.0 // Project: https://github.com/SteveSanderson/knockout.mapping // Definitions by: Boris Yankov -// Definitions https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/kolite/kolite.d.ts b/kolite/kolite.d.ts index 4aa55fd81..6310fcad4 100644 --- a/kolite/kolite.d.ts +++ b/kolite/kolite.d.ts @@ -1,7 +1,7 @@ // Type definitions for KoLite 1.1 // Project: https://github.com/CodeSeven/kolite // Definitions by: Boris Yankov -// Definitions https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -78,4 +78,4 @@ interface KnockoutUtils { interface KnockoutBindingHandlers { command: KnockoutBindingHandler; -} \ No newline at end of file +} diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index a2d91032a..54f0fe4f0 100644 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -474,7 +474,7 @@ declare module L { * positions. * Default value: 'topright'. */ - position: string; + position?: string; } } @@ -773,20 +773,20 @@ declare module L { /** * Create a layer group, optionally given an initial set of layers. */ - function featureGroup(layers?: ILayer[]): FeatureGroup; + function featureGroup(layers?: T[]): FeatureGroup; - export class FeatureGroup extends LayerGroup implements ILayer, IEventPowered { + export class FeatureGroup extends LayerGroup implements ILayer, IEventPowered> { /** * Create a layer group, optionally given an initial set of layers. */ - constructor(layers?: ILayer[]); + constructor(layers?: T[]); /** * Binds a popup with a particular HTML content to a click on any layer from the * group that has a bindPopup method. */ - bindPopup(htmlContent: string, options?: PopupOptions): FeatureGroup; + bindPopup(htmlContent: string, options?: PopupOptions): FeatureGroup; /** * Returns the LatLngBounds of the Feature Group (created from bounds and coordinates @@ -797,17 +797,17 @@ declare module L { /** * Sets the given path options to each layer of the group that has a setStyle method. */ - setStyle(style: PathOptions): FeatureGroup; + setStyle(style: PathOptions): FeatureGroup; /** * Brings the layer group to the top of all other layers. */ - bringToFront(): FeatureGroup; + bringToFront(): FeatureGroup; /** * Brings the layer group to the bottom of all other layers. */ - bringToBack(): FeatureGroup; + bringToBack(): FeatureGroup; //////////// //////////// @@ -826,20 +826,20 @@ declare module L { //////////////// //////////////// - addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; - addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; - removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup; + addEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; + addOneTimeEventListener(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; + removeEventListener(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup; hasEventListeners(type: string): boolean; - fireEvent(type: string, data?: any): FeatureGroup; - on(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; - once(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; - off(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup; - fire(type: string, data?: any): FeatureGroup; - addEventListener(eventMap: any, context?: any): FeatureGroup; - removeEventListener(eventMap?: any, context?: any): FeatureGroup; - clearAllEventListeners(): FeatureGroup; - on(eventMap: any, context?: any): FeatureGroup; - off(eventMap?: any, context?: any): FeatureGroup; + fireEvent(type: string, data?: any): FeatureGroup; + on(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; + once(type: string, fn: (e: LeafletEvent) => void, context?: any): FeatureGroup; + off(type: string, fn?: (e: LeafletEvent) => void, context?: any): FeatureGroup; + fire(type: string, data?: any): FeatureGroup; + addEventListener(eventMap: any, context?: any): FeatureGroup; + removeEventListener(eventMap?: any, context?: any): FeatureGroup; + clearAllEventListeners(): FeatureGroup; + on(eventMap: any, context?: any): FeatureGroup; + off(eventMap?: any, context?: any): FeatureGroup; } } @@ -882,7 +882,7 @@ declare module L { */ function geoJson(geojson?: any, options?: GeoJSONOptions): GeoJSON; - export class GeoJSON extends FeatureGroup { + export class GeoJSON extends FeatureGroup { /** * Creates a GeoJSON layer. Optionally accepts an object in GeoJSON format @@ -1539,60 +1539,60 @@ declare module L { /** * Create a layer group, optionally given an initial set of layers. */ - function layerGroup(layers?: ILayer[]): LayerGroup; + function layerGroup(layers?: T[]): LayerGroup; - export class LayerGroup extends Class implements ILayer { + export class LayerGroup extends Class implements ILayer { /** * Create a layer group, optionally given an initial set of layers. */ - constructor(layers?: ILayer[]); + constructor(layers?: T[]); /** * Adds the group of layers to the map. */ - addTo(map: Map): LayerGroup; + addTo(map: Map): LayerGroup; /** * Adds a given layer to the group. */ - addLayer(layer: ILayer): LayerGroup; + addLayer(layer: T): LayerGroup; /** * Removes a given layer from the group. */ - removeLayer(layer: ILayer): LayerGroup; + removeLayer(layer: T): LayerGroup; /** * Removes a given layer of the given id from the group. */ - removeLayer(id: string): LayerGroup; + removeLayer(id: string): LayerGroup; /** * Returns true if the given layer is currently added to the group. */ - hasLayer(layer: ILayer): boolean; + hasLayer(layer: T): boolean; /** * Returns the layer with the given id. */ - getLayer(id: string): ILayer; + getLayer(id: string): T; /** * Returns an array of all the layers added to the group. */ - getLayers(): ILayer[]; + getLayers(): T[]; /** * Removes all the layers from the group. */ - clearLayers(): LayerGroup; + clearLayers(): LayerGroup; /** * Iterates over the layers of the group, optionally specifying context of * the iterator function. */ - eachLayer(fn: (layer: ILayer) => void, context?: any): LayerGroup; + eachLayer(fn: (layer: T) => void, context?: any): LayerGroup; /** * Returns a GeoJSON representation of the layer group (GeoJSON FeatureCollection). @@ -2794,7 +2794,7 @@ declare module L { */ function multiPolygon(latlngs: LatLng[][], options?: PolylineOptions): MultiPolygon; - export class MultiPolygon extends FeatureGroup { + export class MultiPolygon extends FeatureGroup { /** * Instantiates a multi-polyline object given an array of latlngs arrays (one @@ -2829,7 +2829,7 @@ declare module L { */ function multiPolyline(latlngs: LatLng[][], options?: PolylineOptions): MultiPolyline; - export class MultiPolyline extends FeatureGroup { + export class MultiPolyline extends FeatureGroup { /** * Instantiates a multi-polyline object given an array of arrays of geographical @@ -3655,27 +3655,27 @@ declare module L { } } - export interface TileLayerFactory { + export interface TileLayerFactory { /** * Instantiates a tile layer object given a URL template and optionally an options * object. */ - (urlTemplate: string, options?: TileLayerOptions): TileLayer; + (urlTemplate: string, options?: TileLayerOptions): TileLayer; /** * Instantiates a WMS tile layer object given a base URL of the WMS service and * a WMS parameters/options object. */ - wms(baseUrl: string, options: WMSOptions): L.TileLayer.WMS; + wms(baseUrl: string, options: WMSOptions): L.TileLayer.WMS; /** * Instantiates a Canvas tile layer object given an options object (optionally). */ - canvas(options?: TileLayerOptions): L.TileLayer.Canvas; + canvas(options?: TileLayerOptions): L.TileLayer.Canvas; } - - export var tileLayer: TileLayerFactory; + + export var tileLayer: TileLayerFactory; } declare module L { diff --git a/linq/linq.3.0.3-Beta4.d.ts b/linq/linq.3.0.3-Beta4.d.ts index d75d0982b..ff550d675 100755 --- a/linq/linq.3.0.3-Beta4.d.ts +++ b/linq/linq.3.0.3-Beta4.d.ts @@ -1,6 +1,6 @@ -// Type definitions for linq.js, ver 3.0.3-Beta4 +// Type definitions for linq.js v3.0.3-Beta4 // Project: http://linqjs.codeplex.com/ -// Definitions by: neuecc (http://www.codeplex.com/site/users/view/neuecc) +// Definitions by: neuecc // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module linqjs { diff --git a/linq/linq.d.ts b/linq/linq.d.ts index 960b20a90..d155ba806 100644 --- a/linq/linq.d.ts +++ b/linq/linq.d.ts @@ -1,6 +1,6 @@ // Type definitions for linq.js 2.2 // Project: http://linqjs.codeplex.com/ -// Definitions by: Marcin Najder +// Definitions by: Marcin Najder // Definitions: https://github.com/borisyankov/DefinitelyTyped // todo: jQuery plugin, RxJS Binding diff --git a/linq/linq.jquery.d.ts b/linq/linq.jquery.d.ts index c4b874bae..c79708f66 100755 --- a/linq/linq.jquery.d.ts +++ b/linq/linq.jquery.d.ts @@ -1,6 +1,6 @@ // Type definitions for linq.jquery (from linq.js) // Project: http://linqjs.codeplex.com/ -// Definitions by: neuecc (http://www.codeplex.com/site/users/view/neuecc) +// Definitions by: neuecc // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d58368b79..cc4ab4408 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -425,9 +425,17 @@ result = <_.Dictionary>_.groupBy([4.2, 6.1, 6.4], function (num) { ret result = <_.Dictionary>_.groupBy([4.2, 6.1, 6.4], function (num) { return this.floor(num); }, Math); result = <_.Dictionary>_.groupBy(['one', 'two', 'three'], 'length'); -result = <_.LoDashObjectWrapper<_.Dictionary>>_([4.2, 6.1, 6.4]).groupBy(function (num) { return Math.floor(num); }); -result = <_.LoDashObjectWrapper<_.Dictionary>>_([4.2, 6.1, 6.4]).groupBy(function (num) { return this.floor(num); }, Math); -result = <_.LoDashObjectWrapper<_.Dictionary>>_(['one', 'two', 'three']).groupBy('length'); +result = <_.Dictionary>_.groupBy({ prop1: 4.2, prop2: 6.1, prop3: 6.4}, function (num) { return Math.floor(num); }); +result = <_.Dictionary>_.groupBy({ prop1: 4.2, prop2: 6.1, prop3: 6.4}, function (num) { return this.floor(num); }, Math); +result = <_.Dictionary>_.groupBy({ prop1: 'one', prop2: 'two', prop3: 'three'}, 'length'); + +result = <_.Dictionary>_([4.2, 6.1, 6.4]).groupBy(function (num) { return Math.floor(num); }).value(); +result = <_.Dictionary>_([4.2, 6.1, 6.4]).groupBy(function (num) { return this.floor(num); }, Math).value(); +result = <_.Dictionary>_(['one', 'two', 'three']).groupBy('length').value(); + +result = <_.Dictionary>_({ prop1: 4.2, prop2: 6.1, prop3: 6.4}).groupBy(function (num) { return Math.floor(num); }).value(); +result = <_.Dictionary>_({ prop1: 4.2, prop2: 6.1, prop3: 6.4}).groupBy(function (num) { return this.floor(num); }, Math).value(); +result = <_.Dictionary>_({ prop1: 'one', prop2: 'two', prop3: 'three'}).groupBy('length').value(); result = <_.Dictionary>_.indexBy(keys, 'dir'); result = <_.Dictionary>_.indexBy(keys, function (key) { return String.fromCharCode(key.code); }); @@ -556,7 +564,11 @@ result = _([1, 2, 3]).sortBy(function (num) { return Math.sin(num); }) result = _([1, 2, 3]).sortBy(function (num) { return this.sin(num); }, Math).value(); result = _(['banana', 'strawberry', 'apple']).sortBy('length').value(); -(function (a: number, b: number, c: number, d: number) { return _.toArray(arguments).slice(1); })(1, 2, 3, 4); +(function (a: number, b: number, c: number, d: number): Array { return _.toArray(arguments).slice(1); })(1, 2, 3, 4); +result = _.toArray([1, 2, 3, 4]); +(function (a: number, b: number, c: number, d: number): Array { return _(arguments).toArray().slice(1).value(); })(1, 2, 3, 4); +result = _([1,2,3,4]).toArray().value(); + result = _.where(stoogesCombined, { 'age': 40 }); result = _.where(stoogesCombined, { 'quotes': ['Poifect!'] }); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e51a59825..24e55836a 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -3169,6 +3169,30 @@ declare module _ { groupBy( collection: List, whereValue: W): Dictionary; + + /** + * @see _.groupBy + **/ + groupBy( + collection: Dictionary, + callback?: ListIterator, + thisArg?: any): Dictionary; + + /** + * @see _.groupBy + * @param pluckValue _.pluck style callback + **/ + groupBy( + collection: Dictionary, + pluckValue: string): Dictionary; + + /** + * @see _.groupBy + * @param whereValue _.where style callback + **/ + groupBy( + collection: Dictionary, + whereValue: W): Dictionary; } interface LoDashArrayWrapper { @@ -3177,19 +3201,40 @@ declare module _ { **/ groupBy( callback: ListIterator, - thisArg?: any): _.LoDashObjectWrapper>; + thisArg?: any): _.LoDashObjectWrapper<_.Dictionary>; /** * @see _.groupBy **/ groupBy( - pluckValue: string): _.LoDashObjectWrapper>; + pluckValue: string): _.LoDashObjectWrapper<_.Dictionary>; /** * @see _.groupBy **/ groupBy( - whereValue: W): _.LoDashObjectWrapper>; + whereValue: W): _.LoDashObjectWrapper<_.Dictionary>; + } + + interface LoDashObjectWrapper { + /** + * @see _.groupBy + **/ + groupBy( + callback: ListIterator, + thisArg?: any): _.LoDashObjectWrapper<_.Dictionary>; + + /** + * @see _.groupBy + **/ + groupBy( + pluckValue: string): _.LoDashObjectWrapper<_.Dictionary>; + + /** + * @see _.groupBy + **/ + groupBy( + whereValue: W): _.LoDashObjectWrapper<_.Dictionary>; } //_.indexBy @@ -4520,6 +4565,20 @@ declare module _ { toArray(collection: Dictionary): T[]; } + interface LoDashArrayWrapper { + /** + * @see _.toArray + **/ + toArray(): LoDashArrayWrapper; + } + + interface LoDashObjectWrapper { + /** + * @see _.toArray + **/ + toArray(): LoDashArrayWrapper; + } + //_.where interface LoDashStatic { /** diff --git a/mapbox/mapbox-tests.ts b/mapbox/mapbox-tests.ts new file mode 100644 index 000000000..0caebb042 --- /dev/null +++ b/mapbox/mapbox-tests.ts @@ -0,0 +1,41 @@ +/// + +var mapboxTiles = L.tileLayer('https://{s}.tiles.mapbox.com/v3/examples.map-i87786ca/{z}/{x}/{y}.png', { + attribution: 'Terms & Feedback' +}); + +var map = L.map('map').addLayer(mapboxTiles).setView(new L.LatLng([42.3610, -71.0587]), 15); + +var coordinates = document.getElementById('coordinates'); + +var marker = L.marker(new L.LatLng([0, 0]), { + icon: L.mapbox.marker.icon({ + 'marker-color': '#f86767' + }), + draggable: true +}).addTo(map); + +// every time the marker is dragged, update the coordinates container +marker.on('dragend', function() { + var m = marker.getLatLng(); + coordinates.innerHTML = 'Latitude: ' + m.lat + '
Longitude: ' + m.lng; +}); + +// Build a marker from a simple GeoJSON object: +var marker2 = L.mapbox.featureLayer({ + type: 'Feature', + geometry: { + type: 'Point', + coordinates: [-73.9840, 40.7271] + }, + properties: { + title: 'Hello world!', + 'marker-color': '#f86767' + } +}).addTo(map); + +// Iterate over the featureLayer we've called "marker" +// and open its popup instead of clicking to trigger it. +marker2.eachLayer(function(marker: L.Marker) { + marker.openPopup(); +}); \ No newline at end of file diff --git a/mapbox/mapbox.d.ts b/mapbox/mapbox.d.ts new file mode 100644 index 000000000..cf2da20b5 --- /dev/null +++ b/mapbox/mapbox.d.ts @@ -0,0 +1,452 @@ +// Type definitions for Mapbox 1.6.3 +// Project: https://www.mapbox.com/mapbox.js/ +// Definitions by: Maxime Fabre +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +////////////////////////////////////////////////////////////////////// +///////////////////////////// MAP OBJECT ///////////////////////////// +////////////////////////////////////////////////////////////////////// + +// Map +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox { + + /** + * Create and automatically configure a map with layers, markers, and interactivity. + */ + function map(element: string, id: string, options?: MapOptions): L.mapbox.Map; + function map(element: string, tilejson: any, options?: MapOptions): L.mapbox.Map; + + interface MapOptions extends L.MapOptions { + featureLayer? : FeatureLayerOptions; + gridLayer? : any; + tileLayer? : TileLayerOptions; + infoControl? : ControlOptions; + legendControl? : ControlOptions; + shareControl? : ShareControlOptions; + } + + interface FilterFunction { + (feature: any): boolean; + } + + interface Map extends L.Map { + tileLayer : L.mapbox.TileLayer; + gridLayer : L.mapbox.GridLayer; + featureLayer : L.mapbox.FeatureLayer; + + gridControl : L.mapbox.GridControl; + infoControl : L.mapbox.InfoControl; + legendControl : L.mapbox.LegendControl; + shareControl : L.mapbox.ShareControl; + + addLayer(layer: any): any; + getTileJSON(): any; + + } + +} + +////////////////////////////////////////////////////////////////////// +/////////////////////////////// LAYERS /////////////////////////////// +////////////////////////////////////////////////////////////////////// + +// TileLayer +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox { + + /** + * You can add a tiled layer to your map with L.mapbox.tileLayer(), a simple interface to layers from Mapbox and elsewhere. + */ + function tileLayer(id: string, options?: TileLayerOptions): L.mapbox.TileLayer; + function tileLayer(tilejson: any, options?: TileLayerOptions): L.mapbox.TileLayer; + + interface TileLayerOptions extends L.TileLayerOptions { + retinaVersion?: string; + } + + interface TileLayer extends L.TileLayer { + + /** + * Returns this layer's TileJSON object which determines its tile source, zoom bounds and other metadata. + */ + getTileJSON(): any; + + /** + * Set the image format of tiles in this layer. You can use lower-quality tiles in order to load maps faster + */ + setFormat(format: string): TileLayer; + + } + +} + +// GridLayer +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox { + + /** + * An L.mapbox.gridLayer loads UTFGrid tiles of interactivity into your map, which you can easily access with L.mapbox.gridControl. + */ + function gridLayer(id: string): L.mapbox.GridLayer; + function gridLayer(tilejson: any): L.mapbox.GridLayer; + + interface GridLayer { + + active(): boolean; + addTo(map: L.mapbox.Map): any; + onAdd(map: L.mapbox.Map): any; + onRemove(): any; + + /** + * Bind an event handler to a given event on this L.mapbox.gridLayer instance. GridLayers expose a number of useful events that give you access to UTFGrid data as the user interacts with the map. + */ + on(event: string, handler: Function, context?: any): any; + + /** + * Returns this layer's TileJSON object which determines its tile source, zoom bounds and other metadata. + */ + getTileJSON(): any; + + /** + * Load data for a given latitude, longitude point on the map, and call the callback function with that data, if any. + */ + getData(latlng: L.LatLng, callback: Function): any; + + } + +} + +// FeatureLayer +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox { + + /** + * L.mapbox.featureLayer provides an easy way to integrate GeoJSON from Mapbox and elsewhere into your map. + */ + function featureLayer(): L.mapbox.FeatureLayer; + function featureLayer(id: string, options?: FeatureLayerOptions): L.mapbox.FeatureLayer; + function featureLayer(geojson: any, options?: FeatureLayerOptions): L.mapbox.FeatureLayer; + + interface FeatureLayerOptions { + filter? : FilterFunction; + sanitizer? : (template: string) => string; + } + + interface FeatureLayer extends L.FeatureGroup { + + /** + * Load GeoJSON data for this layer from the URL given by url. + */ + loadURL(url: string): any; + + /** + * Load marker GeoJSON data from a map with the given id on Mapbox. + */ + loadID(id: string): any; + + /** + * Sets the filter function for this data layer. + */ + setFilter(filter: FilterFunction): any; + + /** + * Gets the filter function for this data layer. + */ + getFilter(): FilterFunction; + + /** + * Set the contents of a markers layer: run the provided features through + * the filter function and then through the factory function to create + * elements for the map. If the layer already has features, they are + * replaced with the new features. An empty array will clear the + * layer of all features. + */ + setGeoJSON(geojson: any): L.mapbox.FeatureLayer; + + /** + * Get the contents of this layer as GeoJSON data. + */ + getGeoJSON(): any; + + } + +} + +////////////////////////////////////////////////////////////////////// +////////////////////////////// GEOCODING ///////////////////////////// +////////////////////////////////////////////////////////////////////// + +// Geocoder +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox { + + /** + * A low-level interface to geocoding, useful for more complex uses and reverse-geocoding. + */ + function geocoder(id: string): L.mapbox.Geocoder; + + interface Geocoder { + + getURL(): string; + setURL(url: string): any; + setID(id: string): any; + setTileJSON(tilejson: any): any; + queryURL(url: string): string; + + /** + * Queries the geocoder with a query string, and returns its result, if any. + */ + query(queryString: string, callback: Function): any; + + /** + * Queries the geocoder with a location, and returns its result, if any. + */ + reverseQuery(location: any, callback: Function): any; + + } +} + +////////////////////////////////////////////////////////////////////// +//////////////////////////////// CONTROLS //////////////////////////// +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox { + interface ControlOptions extends L.ControlOptions { + sanitizer?: (template: string) => string; + } +} + +// InfoControl +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox { + + /** + * A map control that shows a toggleable info container. If set, attribution is auto-detected from active layers and added to the info container. + */ + function infoControl(options?: ControlOptions): InfoControl; + + interface InfoControl extends L.Control { + + onAdd(map: L.mapbox.Map): any; + onRemove(map: L.mapbox.Map): any; + + /** + * Adds an info string to infoControl. + */ + addInfo(info: string): any; + + /** + * Removes an info string from infoControl + */ + removeInfo(info: string): any; + + } + +} + +// LegendControl +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox { + + /** + * A map control that shows legends added to maps in Mapbox. + * Legends are auto-detected from active layers. + */ + function legendControl(options?: ControlOptions): LegendControl; + + interface LegendControl extends L.Control { + + onAdd(map: L.mapbox.Map): any; + + /** + * Adds a legend to the legendControl. + */ + addLegend(legend: string): any; + + /** + * Removes a legend from the legendControl. + */ + removeLegend(legend: string): any; + + } + +} + +// GridControl +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox { + + /** + * Interaction is what we call interactive parts of maps that are created with + * the powerful tooltips & regions system in TileMill. Under the hood, it's powered by the open UTFGrid specification. + */ + function gridControl(layer: string, options?: GridControlOptions): GridControl; + + interface GridControlOptions extends ControlOptions { + template? : string; + follow? : boolean; + pinnable? : boolean; + touchTeaser? : boolean; + location? : boolean; + } + + interface GridControl extends L.Control { + + onAdd(map: L.mapbox.Map): any; + onRemove(map: L.mapbox.Map): any; + + /** + * If a tooltip is currently shown by the gridControl, hide and close it. + */ + hide(): any; + + /** + * Change the Mustache template used to transform the UTFGrid data in the map's interactivity into HTML for display. + */ + setTemplate(template: string): any; + + } + +} + +// GeocoderControl +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox { + + /** + * Adds geocoder functionality as well as a UI element to a map. This uses the Mapbox Geocoding API. + */ + function geocoderControl(id: string, options?: GeocoderControlOptions): GeocoderControl; + + interface GeocoderControlOptions extends L.ControlOptions { + keepOpen?: boolean; + } + + interface GeocoderControl { + + getURL(): string; + onAdd(map: L.mapbox.Map): any; + + + /** + * Set the url used for geocoding. + */ + setURL(url: string): any; + + /** + * Set the map id used for geocoding. + */ + setID(id: string): any; + + /** + * Set the TileJSON used for geocoding. + */ + setTileJSON(tilejson: any): any; + + /** + * Bind a listener to an event emitted by the geocoder control. Supported additional events are + */ + on(event: string, callback: Function): any; + + } + +} + +// ShareControl +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox { + + /** + * Adds a "Share" button to the map, which can be used to share the map to Twitter or Facebook, or generate HTML for a map embed. + */ + function shareControl(id: string, options?: ShareControlOptions): ShareControl; + + interface ShareControlOptions extends L.ControlOptions { + url?: string; + } + + interface ShareControl extends L.Control { + + onAdd(map: L.mapbox.Map): any; + + } + +} + +////////////////////////////////////////////////////////////////////// +////////////////////////////// MARKERS /////////////////////////////// +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox.marker { + + /** + * A core icon generator used in L.mapbox.marker.style + */ + function icon(feature: any): L.Icon; + + /** + * An icon generator for use in conjunction with pointToLayer to generate markers from the Mapbox Markers API and support the simplestyle-spec for features. + */ + function style(feature: any, latlng: any): L.Marker; + +} + +////////////////////////////////////////////////////////////////////// +////////////////////////////// SIMPLESTYLE /////////////////////////// +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox.simplestyle { + + /** + * Given a GeoJSON Feature with optional simplestyle-spec properties, return an options object formatted to be used as Leaflet Path options. + */ + function style(feature: any): L.PathOptions; + +} + +////////////////////////////////////////////////////////////////////// +/////////////////////////////// UTILITY ////////////////////////////// +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox { + + /** + * A HTML sanitization function, with the same effect as the default value of the sanitizer option of L.mapbox.featureLayer, L.mapbox.gridControl, and L.mapbox.legendControl. + */ + function sanitize(text: string): string; + + /** + * A mustache template rendering function, as used by the templating feature provided by L.mapbox.gridControl. + */ + function template(template: string, data?: any): string; + +} + +////////////////////////////////////////////////////////////////////// +///////////////////////////// CONFIGURATION ////////////////////////// +////////////////////////////////////////////////////////////////////// + +declare module L.mapbox { + export class config { + + static FORCE_HTTPS: boolean; + + static HTTP_URLS: string[]; + + static HTTPS_URLS: string[]; + + } +} diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index 7a52d7453..96672ca3f 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -1,8 +1,6 @@ // Type definitions for Marionette // Project: https://github.com/marionettejs/ -// Definitions by: Zeeshan Hamid -// Definitions by: Natan Vivo -// Definitions by: Sven Tschui +// Definitions by: Zeeshan Hamid , Natan Vivo , Sven Tschui // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/mathjax/mathjax.d.ts b/mathjax/mathjax.d.ts index 08b1950bf..65c10e3ad 100644 --- a/mathjax/mathjax.d.ts +++ b/mathjax/mathjax.d.ts @@ -1,7 +1,7 @@ // Type definitions for MathJax // Project: https://github.com/mathjax/MathJax // Definitions by: Roland Zwaga -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped // These are slightly preliminary and can use some more strong typing here and there. Please feel free to improve. declare var MathJax:jax.IMathJax; @@ -1697,4 +1697,4 @@ declare module jax { /*Indicates whether the mathematics has changed so that its output needs to be updated.*/ needsUpdate():boolean; } -} \ No newline at end of file +} diff --git a/microsoft-live-connect/microsoft-live-connect.d.ts b/microsoft-live-connect/microsoft-live-connect.d.ts index 04ff3ef79..d012f3195 100644 --- a/microsoft-live-connect/microsoft-live-connect.d.ts +++ b/microsoft-live-connect/microsoft-live-connect.d.ts @@ -1,9 +1,11 @@ -/// -// Type definitions for Microsoft Live Connect v5.0. +// Type definitions for Microsoft Live Connect v5.0 // Project: http://msdn.microsoft.com/en-us/library/live/hh243643.aspx // Definitions by: John Vilk // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// +/// + declare module Microsoft.Live { //#region REST Object Information @@ -632,8 +634,8 @@ declare module Microsoft.Live { /** * A value that specifies whether the event is publicly visible. Valid * values are: - * - publicthe event is visible to anyone who can view the calendar. - * - private"the event is visible only to the event owner. + * - public�the event is visible to anyone who can view the calendar. + * - private"�the event is visible only to the event owner. * @default "public" */ visibility: string; @@ -694,8 +696,8 @@ declare module Microsoft.Live { /** * A value that specifies whether the event is publicly visible. Valid * values are: - * - publicthe event is visible to anyone who can view the calendar. - * - private"the event is visible only to the event owner. + * - public�the event is visible to anyone who can view the calendar. + * - private"�the event is visible only to the event owner. * @default "public" */ visibility?: string; @@ -766,8 +768,8 @@ declare module Microsoft.Live { /** * A value that specifies whether the event is publicly visible. Valid * values are: - * - publicthe event is visible to anyone who can view the calendar. - * - private"the event is visible only to the event owner. + * - public�the event is visible to anyone who can view the calendar. + * - private"�the event is visible only to the event owner. * @default "public" */ visibility: string; @@ -1040,10 +1042,10 @@ declare module Microsoft.Live { source: string; /** * The type of this image of this particular size. Valid values are: - * full (maximum size: 2048 2048 pixels) - * - normal (maximum size 800 800 pixels) - * - album (maximum size 176 176 pixels) - * - small (maximum size 96 96 pixels) + * full (maximum size: 2048 � 2048 pixels) + * - normal (maximum size 800 � 800 pixels) + * - album (maximum size 176 � 176 pixels) + * - small (maximum size 96 � 96 pixels) */ type: string; } diff --git a/mixpanel/mixpanel-tests.ts b/mixpanel/mixpanel-tests.ts new file mode 100644 index 000000000..a9cf296c3 --- /dev/null +++ b/mixpanel/mixpanel-tests.ts @@ -0,0 +1,70 @@ +/// +function mixpanel_base() +{ + mixpanel.init("new token", { your: "config" }, "library_name"); + + mixpanel.push(['register', { a: 'b' }]); + + mixpanel.disable(['my_event']); + + mixpanel.track("Registered", {"Gender": "Male", "Age": 21}); + + mixpanel.track_links("#nav", "Clicked Nav Link"); + + mixpanel.track_forms("#register", "Created Account"); + + mixpanel.register({device: 'android', version: '4.0.1'}); + + mixpanel.register_once({device: 'android', version: '4.0.1'}); + + mixpanel.unregister('device'); + + mixpanel.identify('234234sdfdsf'); + + mixpanel.get_distinct_id(); + + mixpanel.alias('w3erwfsdf', '234234sdfdsf'); + + mixpanel.set_config({test: true}); + + mixpanel.get_config(); + + mixpanel.get_property('device'); +} + +function mixpanel_people() +{ + mixpanel.people.set('gender', 'm'); + mixpanel.people.set({ + 'Company': 'Acme', + 'Plan': 'Premium', + 'Upgrade date': new Date() + }); + + mixpanel.people.set_once('First Login Date', new Date()); + mixpanel.people.set_once({ + 'First Login Date': new Date(), + 'Starting Plan': 'Premium' + }); + + mixpanel.people.increment('page_views', 1); + mixpanel.people.increment('page_views'); + mixpanel.people.increment('credits_left', -1); + mixpanel.people.increment({ + counter1: 1, + counter2: 1 + }); + + mixpanel.people.append('pages_visited', 'homepage'); + mixpanel.people.append({ + list1: 'bob', + list2: 123 + }); + + mixpanel.people.track_charge(50); + mixpanel.people.track_charge(30.50, {'$time': new Date('jan 1 2012')}); + + mixpanel.people.clear_charges(); + + mixpanel.people.delete_user(); +} diff --git a/mixpanel/mixpanel.d.ts b/mixpanel/mixpanel.d.ts new file mode 100644 index 000000000..03596a8aa --- /dev/null +++ b/mixpanel/mixpanel.d.ts @@ -0,0 +1,72 @@ +// Type definitions for Mixpanel +// Project: https://mixpanel.com/ +// https://github.com/mixpanel/mixpanel-js +// Definitions by: Knut Eirik Leira Hjelle +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface Mixpanel +{ + people:Mixpanel.People; + + init(token:string, config:{[index:string]:any}, libraryName:string):Mixpanel; + + push(item:any[]):void; + + disable(events?:string[]):void; + + track(eventName:string, params?:{[index:string]:any}, callback?:() => void):void; + + track_links(querySelector:string, eventName:string, params?:{[index:string]:any}):void; + + track_forms(querySelector:string, eventName:string, params?:{[index:string]:any}):void; + + register(params:{[index:string]:any}, days?:number):void; + + register_once(params:{[index:string]:any}, defaultValue?:string, days?:number):void; + + unregister(propertyName:string):void; + + identify(id:string):void; + + get_distinct_id():string; + + alias(alias:string, currentId?:string):void; + + set_config(config:{[index:string]:any}):void; + + get_config():{[index:string]:any}; + + get_property(propertyName:string):any; +} + +declare module Mixpanel +{ + interface People + { + set(keys:{[index:string]:any}, callback?:() => void):void; + + set(key:string, value:any, callback?:() => void):void; + + set_once(keys:{[index:string]:any}, callback?:() => void):void; + + set_once(key:string, value:any, callback?:() => void):void; + + increment(key:string):void; + + increment(keys:{[index:string]:number}):void; + + increment(key:string, value:number):void; + + append(keys:{[index:string]:any}):void; + + append(key:string, value:any):void; + + track_charge(amount:number, params?:{[index:string]:any}, callback?:() => void):void; + + clear_charges():void; + + delete_user():void; + } +} + +declare var mixpanel:Mixpanel; diff --git a/mocha/mocha.d.ts b/mocha/mocha.d.ts index ce0f15b38..64255a7ba 100644 --- a/mocha/mocha.d.ts +++ b/mocha/mocha.d.ts @@ -1,7 +1,7 @@ // Type definitions for mocha 1.17.1 // Project: http://visionmedia.github.io/mocha/ -// Definitions by: Kazi Manzur Rashid and otiai10 -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: Kazi Manzur Rashid , otiai10 +// Definitions: https://github.com/borisyankov/DefinitelyTyped interface Mocha { // Setup mocha with the given setting options. diff --git a/modernizr/modernizr.d.ts b/modernizr/modernizr.d.ts index 686f40e71..5827bbf9e 100644 --- a/modernizr/modernizr.d.ts +++ b/modernizr/modernizr.d.ts @@ -1,6 +1,6 @@ // Type definitions for Modernizr 2.6.2 // Project: http://modernizr.com/ -// Definitions by: Boris Yankov and Theodore Brown +// Definitions by: Boris Yankov , Theodore Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/moment/moment.d.ts b/moment/moment.d.ts index f997026fd..879bf6eae 100644 --- a/moment/moment.d.ts +++ b/moment/moment.d.ts @@ -1,9 +1,7 @@ // Type definitions for Moment.js 2.5.0 // Project: https://github.com/timrwood/moment -// Definitions by: Michael Lakerveld -// Definitions by: Aaron King (2.4.0) -// Definitions by: Hiroki Horiuchi (2.5.0) -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: Michael Lakerveld , Aaron King , Hiroki Horiuchi +// Definitions: https://github.com/borisyankov/DefinitelyTyped interface MomentInput { years?: number; diff --git a/mousetrap/mousetrap.d.ts b/mousetrap/mousetrap.d.ts index d2ae42aa6..dee352b42 100644 --- a/mousetrap/mousetrap.d.ts +++ b/mousetrap/mousetrap.d.ts @@ -1,6 +1,6 @@ // Type definitions for Mousetrap 1.2.2 // Project: http://craig.is/killing/mice -// Definitions by: Dániel Tar https://github.com/qcz +// Definitions by: Dániel Tar // Definitions: https://github.com/borisyankov/DefinitelyTyped interface ExtendedKeyboardEvent extends KeyboardEvent { diff --git a/ng-grid/ng-grid.d.ts b/ng-grid/ng-grid.d.ts index 7aa8f8716..3bb3b2daa 100644 --- a/ng-grid/ng-grid.d.ts +++ b/ng-grid/ng-grid.d.ts @@ -1,7 +1,7 @@ // Type definitions for ng-grid // Project: http://angular-ui.github.io/ng-grid/ -// Definitions by: Ken Smith and Roland Zwaga and Kent Cooper -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: Ken Smith , Roland Zwaga , Kent Cooper +// Definitions: https://github.com/borisyankov/DefinitelyTyped // These are very definitely preliminary. Please feel free to improve. diff --git a/nock/nock-tests.ts b/nock/nock-tests.ts index b3b68dd20..f3c166aa1 100644 --- a/nock/nock-tests.ts +++ b/nock/nock-tests.ts @@ -7,6 +7,7 @@ var str: string; var bool: boolean; var data: string; var num: number; +var obj: {}; var value: any; var regex: RegExp; var options: nock.Options; @@ -29,7 +30,9 @@ inst = inst.intercept(str, str, str, value); inst = inst.reply(num); inst = inst.reply(num, str); + inst = inst.reply(num, str, headers); +inst = inst.reply(num, obj, headers); inst = inst.reply(num, (uri: string, body: string) => { return str; }); diff --git a/nock/nock.d.ts b/nock/nock.d.ts index 9c8aaac2e..40b728d49 100644 --- a/nock/nock.d.ts +++ b/nock/nock.d.ts @@ -23,6 +23,7 @@ declare module "nock" { intercept(path: string, verb: string, body?: string, options?: any): Scope; reply(responseCode: number, body?: string, headers?: Object): Scope; + reply(responseCode: number, body?: Object, headers?: Object): Scope; reply(responseCode: number, callback: (uri: string, body: string) => string, headers?: Object): Scope; replyWithFile(responseCode: number, fileName: string): Scope; diff --git a/node-ffi/node-ffi-buffer.d.ts b/node-ffi/node-ffi-buffer.d.ts new file mode 100644 index 000000000..5203a2d9e --- /dev/null +++ b/node-ffi/node-ffi-buffer.d.ts @@ -0,0 +1,59 @@ +// DefinitelyTyped: partial + +interface Buffer { + /** Shorthand for `ref.address`. */ + address(): number; + /** Shorthand for `ref.deref`. */ + deref(): any; + /** Shorthand for `ref.isNull`. */ + isNull(): boolean; + /** Shorthand for `ref.readCString`. */ + readCString(offset?: number): string; + /** Shorthand for `ref.readInt64BE`. */ + readInt64BE(offset?: number): string; + /** Shorthand for `ref.readInt64LE`. */ + readInt64LE(offset?: number): string; + /** Shorthand for `ref.readObject`. */ + readObject(offset?: number): string; + /** Shorthand for `ref.readPointer`. */ + readPointer(offset?: number): string; + /** Shorthand for `ref.readUInt64BE`. */ + readUInt64BE(offset?: number): string; + /** Shorthand for `ref.readUInt64LE`. */ + readUInt64LE(offset?: number): string; + /** Shorthand for `ref.ref`. */ + ref(): Buffer; + /** Shorthand for `ref.reinterpret`. */ + reinterpret(size: number, offset?: number): Buffer; + /** Shorthand for `ref.reinterpretUntilZeros`. */ + reinterpretUntilZeros(size: number, offset?: number): Buffer; + /** Shorthand for `ref.writeCString`. */ + writeCString(offset: number, string: string, encoding?: string): void; + /** Shorthand for `ref.writeInt64BE`. */ + writeInt64BE(offset: number, input: number): any; + /** Shorthand for `ref.writeInt64BE`. */ + writeInt64BE(offset: number, input: string): any; + /** Shorthand for `ref.writeInt64LE`. */ + writeInt64LE(offset: number, input: number): any; + /** Shorthand for `ref.writeInt64LE`. */ + writeInt64LE(offset: number, input: string): any; + /** Shorthand for `ref.writeObject`. */ + writeObject(offset: number, object: Object): void; + /** Shorthand for `ref.writePointer`. */ + writePointer(offset: number, pointer: Buffer): void; + /** Shorthand for `ref.writeUInt64BE`. */ + writeUInt64BE(offset: number, input: number): any; + /** Shorthand for `ref.writeUInt64BE`. */ + writeUInt64BE(offset: number, input: string): any; + /** Shorthand for `ref.writeUInt64LE`. */ + writeUInt64LE(offset: number, input: number): any; + /** Shorthand for `ref.writeUInt64LE`. */ + writeUInt64LE(offset: number, input: string): any; + + /** + * Generate string for inspecting. + * String includes the hex-encoded memory address of the Buffer instance. + * @override + */ + inspect(): string; +} diff --git a/node-ffi/node-ffi-tests.ts b/node-ffi/node-ffi-tests.ts index 383470503..ff9698bfd 100644 --- a/node-ffi/node-ffi-tests.ts +++ b/node-ffi/node-ffi-tests.ts @@ -1,5 +1,10 @@ /// +/// +/// +/// +/// + import ffi = require('ffi'); import ref = require('ref'); import Struct = require('ref-struct'); diff --git a/node-ffi/node-ffi.d.ts b/node-ffi/node-ffi.d.ts index e5ee74621..49d6069d4 100644 --- a/node-ffi/node-ffi.d.ts +++ b/node-ffi/node-ffi.d.ts @@ -1,9 +1,12 @@ -// Type definitions for node-ffi, ref, ref-array, ref-struct and ref-union +// Type definitions for node-ffi // Project: https://github.com/rbranson/node-ffi // Definitions by: Paul Loyd // Definitions: https://github.com/borisyankov/DefinitelyTyped /// +/// +/// +/// declare module "ffi" { import ref = require('ref'); @@ -190,405 +193,3 @@ declare module "ffi" { uint32: ref.Type; short: ref.Type; }; } - -declare module "ref" { - export interface Type { - /** The size in bytes required to hold this datatype. */ - size: number; - /** The current level of indirection of the buffer. */ - indirection: number; - /** To invoke when `ref.get` is invoked on a buffer of this type. */ - get(buffer: Buffer, offset: number): any; - /** To invoke when `ref.set` is invoked on a buffer of this type. */ - set(buffer: Buffer, offset: number, value: any): void; - /** The name to use during debugging for this datatype. */ - name?: string; - /** The alignment of this datatype when placed inside a struct. */ - alignment?: number; - } - - /** A Buffer that references the C NULL pointer. */ - export var NULL: Buffer; - /** A pointer-sized buffer pointing to NULL. */ - export var NULL_POINTER: Buffer; - /** Get the memory address of buffer. */ - export function address(buffer: Buffer): number; - /** Allocate the memory with the given value written to it. */ - export function alloc(type: Type, value?: any): Buffer; - /** Allocate the memory with the given value written to it. */ - export function alloc(type: string, value?: any): Buffer; - - /** - * Allocate the memory with the given string written to it with the given - * encoding (defaults to utf8). The buffer is 1 byte longer than the - * string itself, and is NULL terminated. - */ - export function allocCString(string: string, encoding?: string): Buffer; - - /** Coerce a type.*/ - export function coerceType(type: Type): Type; - /** Coerce a type. String are looked up from the ref.types object. */ - export function coerceType(type: string): Type; - - /** - * Get value after dereferencing buffer. - * That is, first it checks the indirection count of buffer's type, and - * if it's greater than 1 then it merely returns another Buffer, but with - * one level less indirection. - */ - export function deref(buffer: Buffer): any; - - /** Create clone of the type, with decremented indirection level by 1. */ - export function derefType(type: Type): Type; - /** Create clone of the type, with decremented indirection level by 1. */ - export function derefType(type: string): Type; - /** Represents the native endianness of the processor ("LE" or "BE"). */ - export var endianness: string; - /** Check the indirection level and return a dereferenced when necessary. */ - export function get(buffer: Buffer, offset?: number, type?: Type): any; - /** Check the indirection level and return a dereferenced when necessary. */ - export function get(buffer: Buffer, offset?: number, type?: string): any; - /** Get type of the buffer. Create a default type when none exists. */ - export function getType(buffer: Buffer): Type; - /** Check the NULL. */ - export function isNull(buffer: Buffer): boolean; - /** Read C string until the first NULL. */ - export function readCString(buffer: Buffer, offset?: number): string; - - /** - * Read a big-endian signed 64-bit int. - * If there is losing precision, then return a string, otherwise a number. - * @return {number|string} - */ - export function readInt64BE(buffer: Buffer, offset?: number): any; - - /** - * Read a little-endian signed 64-bit int. - * If there is losing precision, then return a string, otherwise a number. - * @return {number|string} - */ - export function readInt64LE(buffer: Buffer, offset?: number): any; - - /** Read a JS Object that has previously been written. */ - export function readObject(buffer: Buffer, offset?: number): Object; - /** Read data from the pointer. */ - export function readPointer(buffer: Buffer, offset?: number, - length?: number): Buffer; - /** - * Read a big-endian unsigned 64-bit int. - * If there is losing precision, then return a string, otherwise a number. - * @return {number|string} - */ - export function readUInt64BE(buffer: Buffer, offset?: number): any; - - /** - * Read a little-endian unsigned 64-bit int. - * If there is losing precision, then return a string, otherwise a number. - * @return {number|string} - */ - export function readUInt64LE(buffer: Buffer, offset?: number): any; - - /** Create pointer to buffer. */ - export function ref(buffer: Buffer): Buffer; - /** Create clone of the type, with incremented indirection level by 1. */ - export function refType(type: Type): Type; - /** Create clone of the type, with incremented indirection level by 1. */ - export function refType(type: string): Type; - - /** - * Create buffer with the specified size, with the same address as source. - * This function "attaches" source to the returned buffer to prevent it from - * being garbage collected. - */ - export function reinterpret(buffer: Buffer, size: number, - offset?: number): Buffer; - /** - * Scan past the boundary of the buffer's length until it finds size number - * of aligned NULL bytes. - */ - export function reinterpretUntilZeros(buffer: Buffer, size: number, - offset?: number): Buffer; - - /** Write pointer if the indirection is 1, otherwise write value. */ - export function set(buffer: Buffer, offset: number, value: any, type?: Type): void; - /** Write pointer if the indirection is 1, otherwise write value. */ - export function set(buffer: Buffer, offset: number, value: any, type?: string): void; - /** Write the string as a NULL terminated. Default encoding is utf8. */ - export function writeCString(buffer: Buffer, offset: number, - string: string, encoding?: string): void; - /** Write a big-endian signed 64-bit int. */ - export function writeInt64BE(buffer: Buffer, offset: number, input: number): void; - /** Write a big-endian signed 64-bit int. */ - export function writeInt64BE(buffer: Buffer, offset: number, input: string): void; - /** Write a little-endian signed 64-bit int. */ - export function writeInt64LE(buffer: Buffer, offset: number, input: number): void; - /** Write a little-endian signed 64-bit int. */ - export function writeInt64LE(buffer: Buffer, offset: number, input: string): void; - - /** - * Write the JS Object. This function "attaches" object to buffer to prevent - * it from being garbage collected. - */ - export function writeObject(buffer: Buffer, offset: number, object: Object): void; - - /** - * Write the memory address of pointer to buffer at the specified offset. This - * function "attaches" object to buffer to prevent it from being garbage collected. - */ - export function writePointer(buffer: Buffer, offset: number, - pointer: Buffer): void; - - /** Write a little-endian unsigned 64-bit int. */ - export function writeUInt64BE(buffer: Buffer, offset: number, input: number): void; - /** Write a little-endian unsigned 64-bit int. */ - export function writeUInt64BE(buffer: Buffer, offset: number, input: string): void; - - /** - * Attach object to buffer such. - * It prevents object from being garbage collected until buffer does. - */ - export function _attach(buffer: Buffer, object: Object): void; - - /** Same as ref.reinterpret, except that this version does not attach buffer. */ - export function _reinterpret(buffer: Buffer, size: number, - offset?: number): Buffer; - /** Same as ref.reinterpretUntilZeros, except that this version does not attach buffer. */ - export function _reinterpretUntilZeros(buffer: Buffer, size: number, - offset?: number): Buffer; - /** Same as ref.writePointer, except that this version does not attach pointer. */ - export function _writePointer(buffer: Buffer, offset: number, - pointer: Buffer): void; - /** Same as ref.writeObject, except that this version does not attach object. */ - export function _writeObject(buffer: Buffer, offset: number, object: Object): void; - - /** Default types. */ - export var types: { - void: Type; int64: Type; ushort: Type; - int: Type; uint64: Type; float: Type; - uint: Type; long: Type; double: Type; - int8: Type; ulong: Type; Object: Type; - uint8: Type; longlong: Type; CString: Type; - int16: Type; ulonglong: Type; bool: Type; - uint16: Type; char: Type; byte: Type; - int32: Type; uchar: Type; size_t: Type; - uint32: Type; short: Type; - }; -} - -interface Buffer { - /** Shorthand for `ref.address`. */ - address(): number; - /** Shorthand for `ref.deref`. */ - deref(): any; - /** Shorthand for `ref.isNull`. */ - isNull(): boolean; - /** Shorthand for `ref.readCString`. */ - readCString(offset?: number): string; - /** Shorthand for `ref.readInt64BE`. */ - readInt64BE(offset?: number): string; - /** Shorthand for `ref.readInt64LE`. */ - readInt64LE(offset?: number): string; - /** Shorthand for `ref.readObject`. */ - readObject(offset?: number): string; - /** Shorthand for `ref.readPointer`. */ - readPointer(offset?: number): string; - /** Shorthand for `ref.readUInt64BE`. */ - readUInt64BE(offset?: number): string; - /** Shorthand for `ref.readUInt64LE`. */ - readUInt64LE(offset?: number): string; - /** Shorthand for `ref.ref`. */ - ref(): Buffer; - /** Shorthand for `ref.reinterpret`. */ - reinterpret(size: number, offset?: number): Buffer; - /** Shorthand for `ref.reinterpretUntilZeros`. */ - reinterpretUntilZeros(size: number, offset?: number): Buffer; - /** Shorthand for `ref.writeCString`. */ - writeCString(offset: number, string: string, encoding?: string): void; - /** Shorthand for `ref.writeInt64BE`. */ - writeInt64BE(offset: number, input: number): any; - /** Shorthand for `ref.writeInt64BE`. */ - writeInt64BE(offset: number, input: string): any; - /** Shorthand for `ref.writeInt64LE`. */ - writeInt64LE(offset: number, input: number): any; - /** Shorthand for `ref.writeInt64LE`. */ - writeInt64LE(offset: number, input: string): any; - /** Shorthand for `ref.writeObject`. */ - writeObject(offset: number, object: Object): void; - /** Shorthand for `ref.writePointer`. */ - writePointer(offset: number, pointer: Buffer): void; - /** Shorthand for `ref.writeUInt64BE`. */ - writeUInt64BE(offset: number, input: number): any; - /** Shorthand for `ref.writeUInt64BE`. */ - writeUInt64BE(offset: number, input: string): any; - /** Shorthand for `ref.writeUInt64LE`. */ - writeUInt64LE(offset: number, input: number): any; - /** Shorthand for `ref.writeUInt64LE`. */ - writeUInt64LE(offset: number, input: string): any; - - /** - * Generate string for inspecting. - * String includes the hex-encoded memory address of the Buffer instance. - * @override - */ - inspect(): string; -} - -declare module "ref-array" { - import ref = require('ref'); - - interface ArrayType extends ref.Type { - BYTES_PER_ELEMENT: number; - fixedLength: number; - /** The reference to the base type. */ - type: ref.Type; - - /** - * Accepts a Buffer instance that should be an already-populated with data - * for the ArrayType. The "length" of the Array is determined by searching - * through the buffer's contents until an aligned NULL pointer is encountered. - */ - untilZeros(buffer: Buffer): { [i: number]: T; length: number; toArray(): T[]; - toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; - - new (length?: number): { [i: number]: T; length: number; toArray(): T[]; - toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; - new (data: number[], length?: number): { [i: number]: T; length: number; toArray(): T[]; - toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; - new (data: Buffer, length?: number): { [i: number]: T; length: number; toArray(): T[]; - toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; - (length?: number): { [i: number]: T; length: number; toArray(): T[]; - toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; - (data: number[], length?: number): { [i: number]: T; length: number; toArray(): T[]; - toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; - (data: Buffer, length?: number): { [i: number]: T; length: number; toArray(): T[]; - toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; - } - - /** - * The array type meta-constructor. - * The returned constructor's API is highly influenced by the WebGL - * TypedArray API. - */ - var ArrayType: { - new (type: ref.Type, length?: number): ArrayType; - new (type: string, length?: number): ArrayType; - (type: ref.Type, length?: number): ArrayType; - (type: string, length?: number): ArrayType; - }; - - export = ArrayType; -} - -declare module "ref-struct" { - import ref = require('ref'); - - /** - * This is the `constructor` of the Struct type that gets returned. - * - * Invoke it with `new` to create a new Buffer instance backing the struct. - * Pass it an existing Buffer instance to use that as the backing buffer. - * Pass in an Object containing the struct fields to auto-populate the - * struct with the data. - * - * @constructor - */ - interface StructType extends ref.Type { - /** Pass it an existing Buffer instance to use that as the backing buffer. */ - new (arg: Buffer, data?: {}): any; - new (data?: {}): any; - /** Pass it an existing Buffer instance to use that as the backing buffer. */ - (arg: Buffer, data?: {}): any; - (data?: {}): any; - - fields: {[key: string]: {type: ref.Type}}; - - /** - * Adds a new field to the struct instance with the given name and type. - * Note that this function will throw an Error if any instances of the struct - * type have already been created, therefore this function must be called at the - * beginning, before any instances are created. - */ - defineProperty(name: string, type: ref.Type): void; - - /** - * Adds a new field to the struct instance with the given name and type. - * Note that this function will throw an Error if any instances of the struct - * type have already been created, therefore this function must be called at the - * beginning, before any instances are created. - */ - defineProperty(name: string, type: string): void; - - /** - * Custom for struct type instances. - * @override - */ - toString(): string; - } - - /** The struct type meta-constructor. */ - var StructType: { - new (fields?: {}): StructType; - new (fields?: any[]): StructType; - (fields?: {}): StructType; - (fields?: any[]): StructType; - } - - export = StructType; -} - -declare module "ref-union" { - import ref = require('ref'); - - /** - * This is the `constructor` of the Struct type that gets returned. - * - * Invoke it with `new` to create a new Buffer instance backing the union. - * Pass it an existing Buffer instance to use that as the backing buffer. - * Pass in an Object containing the union fields to auto-populate the - * union with the data. - * - * @constructor - */ - interface UnionType extends ref.Type { - /** Pass it an existing Buffer instance to use that as the backing buffer. */ - new (arg: Buffer, data?: {}): any; - new (data?: {}): any; - /** Pass it an existing Buffer instance to use that as the backing buffer. */ - (arg: Buffer, data?: {}): any; - (data?: {}): any; - - fields: {[key: string]: {type: ref.Type}}; - - /** - * Adds a new field to the union instance with the given name and type. - * Note that this function will throw an Error if any instances of the union - * type have already been created, therefore this function must be called at the - * beginning, before any instances are created. - */ - defineProperty(name: string, type: ref.Type): void; - - /** - * Adds a new field to the union instance with the given name and type. - * Note that this function will throw an Error if any instances of the union - * type have already been created, therefore this function must be called at the - * beginning, before any instances are created. - */ - defineProperty(name: string, type: string): void; - - /** - * Custom for union type instances. - * @override - */ - toString(): string; - } - - /** The union type meta-constructor. */ - var UnionType: { - new (fields?: {}): UnionType; - new (fields?: any[]): UnionType; - (fields?: {}): UnionType; - (fields?: any[]): UnionType; - } - - export = UnionType; -} diff --git a/node/node-0.8.8.d.ts b/node/node-0.8.8.d.ts index 7a1abbae3..f236faa89 100644 --- a/node/node-0.8.8.d.ts +++ b/node/node-0.8.8.d.ts @@ -1,5 +1,6 @@ // Type definitions for Node.js v0.8.8 // Project: http://nodejs.org/ +// Definitions by: Microsoft TypeScript // Definitions: https://github.com/borisyankov/DefinitelyTyped /************************************************ diff --git a/node/node.d.ts b/node/node.d.ts index bd4ef8879..bd0429ad1 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1,5 +1,6 @@ // Type definitions for Node.js v0.10.1 // Project: http://nodejs.org/ +// Definitions by: Microsoft TypeScript , DefinitelyTyped // Definitions: https://github.com/borisyankov/DefinitelyTyped /************************************************ @@ -868,9 +869,13 @@ declare module "fs" { export function openSync(path: string, flags: string, mode?: number): number; export function openSync(path: string, flags: string, mode?: string): number; export function utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; export function utimesSync(path: string, atime: number, mtime: number): void; + export function utimesSync(path: string, atime: Date, mtime: Date): void; export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; export function futimesSync(fd: number, atime: number, mtime: number): void; + export function futimesSync(fd: number, atime: Date, mtime: Date): void; export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; export function fsyncSync(fd: number): void; export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; diff --git a/parsimmon/parsimmon-tests.ts b/parsimmon/parsimmon-tests.ts index 16d1510b5..3f8019891 100644 --- a/parsimmon/parsimmon-tests.ts +++ b/parsimmon/parsimmon-tests.ts @@ -3,6 +3,7 @@ import P = require('parsimmon'); import Parser = P.Parser; import Mark = P.Mark; +import Result = P.Result; // -- -- -- -- -- -- -- -- -- -- -- -- -- @@ -17,6 +18,7 @@ class Bar { // -- -- -- -- -- -- -- -- -- -- -- -- -- var str: string; +var bool: boolean; var num: number; var regex: RegExp; @@ -50,11 +52,25 @@ var fooMarkPar: Parser>; // -- -- -- -- -- -- -- -- -- -- -- -- -- -foo = fooPar.parse(str); +var fooResult: Result; + +bool = fooResult.status; +foo = fooResult.value; +str = fooResult.expected; +num = fooResult.index; + +// -- -- -- -- -- -- -- -- -- -- -- -- -- + +fooResult = fooPar.parse(str); fooPar = fooPar.or(fooPar); anyPar = fooPar.or(barPar); +barPar = fooPar.chain((f) => { + foo = f; + return barPar; +}); + barPar = fooPar.then((f) => { foo = f; return barPar; @@ -82,6 +98,8 @@ fooArrPar = fooPar.atLeast(num); fooMarkPar = fooPar.mark(); +fooPar = fooPar.desc(str); + // -- -- -- -- -- -- -- -- -- -- -- -- -- strPar = P.string(str); @@ -92,6 +110,10 @@ fooPar = P.succeed(foo); fooArrPar = P.seq(fooPar, fooPar); anyArrPar = P.seq(barPar, fooPar, numPar); +fooPar = P.alt(fooPar, fooPar); +anyPar = P.alt(barPar, fooPar, numPar); + + fooPar = P.lazy(() => { return fooPar; }); @@ -112,5 +134,5 @@ strPar = P.optWhitespace; strPar = P.any; strPar = P.all; -strPar = P.eof; -numPar = P.index; \ No newline at end of file +voidPar = P.eof; +numPar = P.index; diff --git a/parsimmon/parsimmon.d.ts b/parsimmon/parsimmon.d.ts index 435ea285a..719e9c937 100644 --- a/parsimmon/parsimmon.d.ts +++ b/parsimmon/parsimmon.d.ts @@ -1,5 +1,5 @@ -// Type definitions for Parsimmon 0.3.0 -// Project: https://github.com/jayferd/parsimmon +// Type definitions for Parsimmon 0.5.0 +// Project: https://github.com/jneen/parsimmon // Definitions by: Bart van der Schoor // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -14,16 +14,27 @@ declare module 'parsimmon' { value: T; } + export interface Result { + status: boolean; + value?: T; + expected?: string; + index?: number; + } + export interface Parser { /* parse the string */ - parse(input: string): T; + parse(input: string): Result; /* returns a new parser which tries parser, and if it fails uses otherParser. */ or(otherParser: Parser): Parser; or(otherParser: Parser): Parser; + /* + returns a new parser which tries parser, and on success calls the given function with the result of the parse, which is expected to return another parser, which will be tried next + */ + chain(next: (result: T) => Parser): Parser; /* returns a new parser which tries parser, and on success calls the given function with the result of the parse, which is expected to return another parser. */ @@ -65,9 +76,11 @@ declare module 'parsimmon' { */ atLeast(n: number): Parser; /* - yields an object with start, value, and end keys, where value is the original value yielded by the parser, and start and end are the indices in the stream that contain the parsed text. + returns a new parser whose failure message is the passed description. */ mark(): Parser>; + + desc(description: string): Parser; } /* is a parser that expects to find "my-string", and will yield the same. @@ -87,12 +100,20 @@ declare module 'parsimmon' { /* accepts a variable number of parsers that it expects to find in order, yielding an array of the results. */ + export function seq(...parsers: Parser[]): Parser; export function seq(...parsers: Parser[]): Parser; + /* + accepts a variable number of parsers, and yields the value of the first one that succeeds, backtracking in between. + */ + export function alt(...parsers: Parser[]): Parser; + export function alt(...parsers: Parser[]): Parser; + /* accepts a function that returns a parser, which is evaluated the first time the parser is used. This is useful for referencing parsers that haven't yet been defined. */ export function lazy(f: () => Parser): Parser; + export function lazy(description: string, f: () => Parser): Parser; /* fail paring with a message @@ -135,7 +156,7 @@ declare module 'parsimmon' { /* expects the end of the stream. */ - export var eof: Parser; + export var eof: Parser; /* is a parser that yields the current index of the parse. */ diff --git a/passport-facebook/passport-facebook.d.ts b/passport-facebook/passport-facebook.d.ts index 47c9b68bb..76a3041a9 100644 --- a/passport-facebook/passport-facebook.d.ts +++ b/passport-facebook/passport-facebook.d.ts @@ -1,5 +1,5 @@ // Type definitions for passport-facebook 1.0.3 -// Project: https://github.com/jaredhanson/passport-facebook +// Project: https://github.com/jaredhanson/passport-facebook // Definitions by: James Roland Cabresos // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -24,4 +24,4 @@ declare module 'passport-facebook' { name: string; authenticate:(req: express.Request, options?: Object) => void; } -} \ No newline at end of file +} diff --git a/passport/passport.d.ts b/passport/passport.d.ts index cd86228f6..6ce6089b7 100644 --- a/passport/passport.d.ts +++ b/passport/passport.d.ts @@ -1,7 +1,7 @@ // Type definitions for Passport v0.2.0 // Project: http://passportjs.org // Definitions by: Horiuchi_H -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/phantomjs/phantomjs.d.ts b/phantomjs/phantomjs.d.ts index 58e202ac8..3682024b6 100644 --- a/phantomjs/phantomjs.d.ts +++ b/phantomjs/phantomjs.d.ts @@ -1,6 +1,6 @@ // Type definitions for PhantomJS v1.9.0 API // Project: https://github.com/ariya/phantomjs/wiki/API-Reference -// Definitions by: Jed Hunsaker and Mike Keesey +// Definitions by: Jed Hunsaker , Mike Keesey // Definitions: https://github.com/borisyankov/DefinitelyTyped declare function require(module: string): any; diff --git a/promises-a-plus/promises-a-plus.d.ts b/promises-a-plus/promises-a-plus.d.ts index 7a3bee776..808995dc9 100644 --- a/promises-a-plus/promises-a-plus.d.ts +++ b/promises-a-plus/promises-a-plus.d.ts @@ -1,3 +1,8 @@ +// Type definitions for promises-a-plus +// Project: http://promisesaplus.com/ +// Definitions by: Igor Oleinikov +// Definitions: https://github.com/borisyankov/DefinitelyTyped + declare module PromisesAPlus { interface PromiseCtor { (resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): Thenable; diff --git a/pubsubjs/pubsub.d.ts b/pubsubjs/pubsub.d.ts index 40158c79b..e24c901a4 100644 --- a/pubsubjs/pubsub.d.ts +++ b/pubsubjs/pubsub.d.ts @@ -1,4 +1,4 @@ -// Type definitions for PubSubJS 1.3.5 +// Type definitions for PubSubJS 1.3.5 // Project: https://github.com/mroderick/PubSubJS // Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/purl/purl.d.ts b/purl/purl.d.ts index e937a68f4..00312595e 100644 --- a/purl/purl.d.ts +++ b/purl/purl.d.ts @@ -48,3 +48,7 @@ declare function purl(): purl.Url; * @param someUrl the url to be parsed */ declare function purl(someUrl: string): purl.Url; + +declare module "purl" { + export = purl; +} diff --git a/q-io/Q-io.d.ts b/q-io/Q-io.d.ts index 9c3963376..1e16e3c33 100644 --- a/q-io/Q-io.d.ts +++ b/q-io/Q-io.d.ts @@ -1,7 +1,7 @@ // Type definitions for Q-io -// Project:https://github.com/kriskowal/q-io -// Definitions by:Bart van der Schoor -// Definitions:https://github.com/borisyankov/DefinitelyTyped +// Project: https://github.com/kriskowal/q-io +// Definitions by: Bart van der Schoor +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// /// diff --git a/q/Q-tests.ts b/q/Q-tests.ts index 6b69fb228..56ce130f0 100644 --- a/q/Q-tests.ts +++ b/q/Q-tests.ts @@ -26,7 +26,7 @@ Q.delay("asdf", 1000).then(x => x.length); var eventualAdd = Q.promised((a?: number, b?: number) => a + b); eventualAdd(Q(1), Q(2)).then(x => x.toExponential()); -var eventually = function (eventually) { +var eventually = function (eventually: any) { return Q.delay(eventually, 1000); }; @@ -38,7 +38,7 @@ Q.when(x, function (x) { Q.all([ eventually(10), eventually(20) -]).spread(function (x, y) { +]).spread(function (x: any, y: any) { console.log(x, y); }); @@ -97,7 +97,7 @@ Q.when(Q(8), num => num + "!").then(str => str.split(',')); declare function saveToDisk(): Q.Promise; declare function saveToCloud(): Q.Promise; -Q.allSettled([saveToDisk(), saveToCloud()]).spread(function (disk, cloud) { +Q.allSettled([saveToDisk(), saveToCloud()]).spread(function (disk: any, cloud: any) { console.log("saved to disk:", disk.state === "fulfilled"); console.log("saved to cloud:", cloud.state === "fulfilled"); @@ -115,3 +115,5 @@ var nodeStyle = (input: string, cb: Function) => { Q.nfapply(nodeStyle, ["foo"]).done((result: string) => {}); Q.nfcall(nodeStyle, "foo").done((result: string) => {}); +Q.denodeify(nodeStyle)('foo').done((result: string) => {}); +Q.nfbind(nodeStyle)('foo').done((result: string) => {}); \ No newline at end of file diff --git a/q/Q-tests.ts.tscparams b/q/Q-tests.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/q/Q-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/q/Q.d.ts b/q/Q.d.ts index 65b2b8223..1d76edd1d 100644 --- a/q/Q.d.ts +++ b/q/Q.d.ts @@ -1,6 +1,6 @@ // Type definitions for Q // Project: https://github.com/kriskowal/q -// Definitions by: Barrie Nemetchek, Andrew Gaspar, John Reilly +// Definitions by: Barrie Nemetchek , Andrew Gaspar , John Reilly // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -207,6 +207,7 @@ declare module Q { export function invoke(obj: any, functionName: string, ...args: any[]): Promise; export function mcall(obj: any, functionName: string, ...args: any[]): Promise; + export function denodeify(nodeFunction: Function, ...args: any[]): (...args: any[]) => Promise; export function nfbind(nodeFunction: Function, ...args: any[]): (...args: any[]) => Promise; export function nfcall(nodeFunction: Function, ...args: any[]): Promise; export function nfapply(nodeFunction: Function, args: any[]): Promise; diff --git a/qunit/qunit.d.ts b/qunit/qunit.d.ts index 68d0163b6..5628feaa6 100644 --- a/qunit/qunit.d.ts +++ b/qunit/qunit.d.ts @@ -1,7 +1,7 @@ // Type definitions for QUnit 1.10 // Project: http://qunitjs.com/ // Definitions by: Diullei Gomes -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped interface DoneCallbackObject { @@ -720,4 +720,4 @@ declare function equiv(a: any, b: any): any; declare var raises: any; /* QUNIT */ -declare var QUnit: QUnitStatic; \ No newline at end of file +declare var QUnit: QUnitStatic; diff --git a/raphael/raphael.d.ts b/raphael/raphael.d.ts index fc0b26292..e57aa3954 100644 --- a/raphael/raphael.d.ts +++ b/raphael/raphael.d.ts @@ -1,7 +1,7 @@ // Type definitions for Raphael 2.1 // Project: http://raphaeljs.com -// Definitions by: https://github.com/CheCoxshall -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: CheCoxshall +// Definitions: https://github.com/borisyankov/DefinitelyTyped interface BoundingBox { diff --git a/ref-array/ref-array.d.ts b/ref-array/ref-array.d.ts new file mode 100644 index 000000000..4066e0d65 --- /dev/null +++ b/ref-array/ref-array.d.ts @@ -0,0 +1,53 @@ +// Type definitions for ref-array +// Project: https://github.com/TooTallNate/ref-array +// Definitions by: Paul Loyd +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "ref-array" { + import ref = require('ref'); + + interface ArrayType extends ref.Type { + BYTES_PER_ELEMENT: number; + fixedLength: number; + /** The reference to the base type. */ + type: ref.Type; + + /** + * Accepts a Buffer instance that should be an already-populated with data + * for the ArrayType. The "length" of the Array is determined by searching + * through the buffer's contents until an aligned NULL pointer is encountered. + */ + untilZeros(buffer: Buffer): { [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; + + new (length?: number): { [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; + new (data: number[], length?: number): { [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; + new (data: Buffer, length?: number): { [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; + (length?: number): { [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; + (data: number[], length?: number): { [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; + (data: Buffer, length?: number): { [i: number]: T; length: number; toArray(): T[]; + toJSON(): T[]; inspect(): string; buffer: Buffer; ref(): Buffer; }; + } + + /** + * The array type meta-constructor. + * The returned constructor's API is highly influenced by the WebGL + * TypedArray API. + */ + var ArrayType: { + new (type: ref.Type, length?: number): ArrayType; + new (type: string, length?: number): ArrayType; + (type: ref.Type, length?: number): ArrayType; + (type: string, length?: number): ArrayType; + }; + +export = ArrayType; +} diff --git a/ref-struct/ref-struct.d.ts b/ref-struct/ref-struct.d.ts new file mode 100644 index 000000000..7c2019655 --- /dev/null +++ b/ref-struct/ref-struct.d.ts @@ -0,0 +1,64 @@ +// Type definitions for ref-union +// Project: https://github.com/TooTallNate/ref-struct +// Definitions by: Paul Loyd +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "ref-struct" { + import ref = require('ref'); + + /** + * This is the `constructor` of the Struct type that gets returned. + * + * Invoke it with `new` to create a new Buffer instance backing the struct. + * Pass it an existing Buffer instance to use that as the backing buffer. + * Pass in an Object containing the struct fields to auto-populate the + * struct with the data. + * + * @constructor + */ + interface StructType extends ref.Type { + /** Pass it an existing Buffer instance to use that as the backing buffer. */ + new (arg: Buffer, data?: {}): any; + new (data?: {}): any; + /** Pass it an existing Buffer instance to use that as the backing buffer. */ + (arg: Buffer, data?: {}): any; + (data?: {}): any; + + fields: {[key: string]: {type: ref.Type}}; + + /** + * Adds a new field to the struct instance with the given name and type. + * Note that this function will throw an Error if any instances of the struct + * type have already been created, therefore this function must be called at the + * beginning, before any instances are created. + */ + defineProperty(name: string, type: ref.Type): void; + + /** + * Adds a new field to the struct instance with the given name and type. + * Note that this function will throw an Error if any instances of the struct + * type have already been created, therefore this function must be called at the + * beginning, before any instances are created. + */ + defineProperty(name: string, type: string): void; + + /** + * Custom for struct type instances. + * @override + */ + toString(): string; + } + + /** The struct type meta-constructor. */ + var StructType: { + new (fields?: {}): StructType; + new (fields?: any[]): StructType; + (fields?: {}): StructType; + (fields?: any[]): StructType; + } + +export = StructType; +} diff --git a/ref-union/ref-union.d.ts b/ref-union/ref-union.d.ts new file mode 100644 index 000000000..23dbdae39 --- /dev/null +++ b/ref-union/ref-union.d.ts @@ -0,0 +1,64 @@ +// Type definitions for ref-union +// Project: https://github.com/TooTallNate/ref-union +// Definitions by: Paul Loyd +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module "ref-union" { + import ref = require('ref'); + + /** + * This is the `constructor` of the Struct type that gets returned. + * + * Invoke it with `new` to create a new Buffer instance backing the union. + * Pass it an existing Buffer instance to use that as the backing buffer. + * Pass in an Object containing the union fields to auto-populate the + * union with the data. + * + * @constructor + */ + interface UnionType extends ref.Type { + /** Pass it an existing Buffer instance to use that as the backing buffer. */ + new (arg: Buffer, data?: {}): any; + new (data?: {}): any; + /** Pass it an existing Buffer instance to use that as the backing buffer. */ + (arg: Buffer, data?: {}): any; + (data?: {}): any; + + fields: {[key: string]: {type: ref.Type}}; + + /** + * Adds a new field to the union instance with the given name and type. + * Note that this function will throw an Error if any instances of the union + * type have already been created, therefore this function must be called at the + * beginning, before any instances are created. + */ + defineProperty(name: string, type: ref.Type): void; + + /** + * Adds a new field to the union instance with the given name and type. + * Note that this function will throw an Error if any instances of the union + * type have already been created, therefore this function must be called at the + * beginning, before any instances are created. + */ + defineProperty(name: string, type: string): void; + + /** + * Custom for union type instances. + * @override + */ + toString(): string; + } + + /** The union type meta-constructor. */ + var UnionType: { + new (fields?: {}): UnionType; + new (fields?: any[]): UnionType; + (fields?: {}): UnionType; + (fields?: any[]): UnionType; + } + +export = UnionType; +} diff --git a/ref/ref.d.ts b/ref/ref.d.ts new file mode 100644 index 000000000..86e7840be --- /dev/null +++ b/ref/ref.d.ts @@ -0,0 +1,190 @@ +// Type definitions for ref-union +// Project: https://github.com/TooTallNate/ref +// Definitions by: Paul Loyd +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module "ref" { + export interface Type { + /** The size in bytes required to hold this datatype. */ + size: number; + /** The current level of indirection of the buffer. */ + indirection: number; + /** To invoke when `ref.get` is invoked on a buffer of this type. */ + get(buffer: Buffer, offset: number): any; + /** To invoke when `ref.set` is invoked on a buffer of this type. */ + set(buffer: Buffer, offset: number, value: any): void; + /** The name to use during debugging for this datatype. */ + name?: string; + /** The alignment of this datatype when placed inside a struct. */ + alignment?: number; + } + + /** A Buffer that references the C NULL pointer. */ + export var NULL: Buffer; + /** A pointer-sized buffer pointing to NULL. */ + export var NULL_POINTER: Buffer; + /** Get the memory address of buffer. */ + export function address(buffer: Buffer): number; + /** Allocate the memory with the given value written to it. */ + export function alloc(type: Type, value?: any): Buffer; + /** Allocate the memory with the given value written to it. */ + export function alloc(type: string, value?: any): Buffer; + + /** + * Allocate the memory with the given string written to it with the given + * encoding (defaults to utf8). The buffer is 1 byte longer than the + * string itself, and is NULL terminated. + */ + export function allocCString(string: string, encoding?: string): Buffer; + + /** Coerce a type.*/ + export function coerceType(type: Type): Type; + /** Coerce a type. String are looked up from the ref.types object. */ + export function coerceType(type: string): Type; + + /** + * Get value after dereferencing buffer. + * That is, first it checks the indirection count of buffer's type, and + * if it's greater than 1 then it merely returns another Buffer, but with + * one level less indirection. + */ + export function deref(buffer: Buffer): any; + + /** Create clone of the type, with decremented indirection level by 1. */ + export function derefType(type: Type): Type; + /** Create clone of the type, with decremented indirection level by 1. */ + export function derefType(type: string): Type; + /** Represents the native endianness of the processor ("LE" or "BE"). */ + export var endianness: string; + /** Check the indirection level and return a dereferenced when necessary. */ + export function get(buffer: Buffer, offset?: number, type?: Type): any; + /** Check the indirection level and return a dereferenced when necessary. */ + export function get(buffer: Buffer, offset?: number, type?: string): any; + /** Get type of the buffer. Create a default type when none exists. */ + export function getType(buffer: Buffer): Type; + /** Check the NULL. */ + export function isNull(buffer: Buffer): boolean; + /** Read C string until the first NULL. */ + export function readCString(buffer: Buffer, offset?: number): string; + + /** + * Read a big-endian signed 64-bit int. + * If there is losing precision, then return a string, otherwise a number. + * @return {number|string} + */ + export function readInt64BE(buffer: Buffer, offset?: number): any; + + /** + * Read a little-endian signed 64-bit int. + * If there is losing precision, then return a string, otherwise a number. + * @return {number|string} + */ + export function readInt64LE(buffer: Buffer, offset?: number): any; + + /** Read a JS Object that has previously been written. */ + export function readObject(buffer: Buffer, offset?: number): Object; + /** Read data from the pointer. */ + export function readPointer(buffer: Buffer, offset?: number, + length?: number): Buffer; + /** + * Read a big-endian unsigned 64-bit int. + * If there is losing precision, then return a string, otherwise a number. + * @return {number|string} + */ + export function readUInt64BE(buffer: Buffer, offset?: number): any; + + /** + * Read a little-endian unsigned 64-bit int. + * If there is losing precision, then return a string, otherwise a number. + * @return {number|string} + */ + export function readUInt64LE(buffer: Buffer, offset?: number): any; + + /** Create pointer to buffer. */ + export function ref(buffer: Buffer): Buffer; + /** Create clone of the type, with incremented indirection level by 1. */ + export function refType(type: Type): Type; + /** Create clone of the type, with incremented indirection level by 1. */ + export function refType(type: string): Type; + + /** + * Create buffer with the specified size, with the same address as source. + * This function "attaches" source to the returned buffer to prevent it from + * being garbage collected. + */ + export function reinterpret(buffer: Buffer, size: number, + offset?: number): Buffer; + /** + * Scan past the boundary of the buffer's length until it finds size number + * of aligned NULL bytes. + */ + export function reinterpretUntilZeros(buffer: Buffer, size: number, + offset?: number): Buffer; + + /** Write pointer if the indirection is 1, otherwise write value. */ + export function set(buffer: Buffer, offset: number, value: any, type?: Type): void; + /** Write pointer if the indirection is 1, otherwise write value. */ + export function set(buffer: Buffer, offset: number, value: any, type?: string): void; + /** Write the string as a NULL terminated. Default encoding is utf8. */ + export function writeCString(buffer: Buffer, offset: number, + string: string, encoding?: string): void; + /** Write a big-endian signed 64-bit int. */ + export function writeInt64BE(buffer: Buffer, offset: number, input: number): void; + /** Write a big-endian signed 64-bit int. */ + export function writeInt64BE(buffer: Buffer, offset: number, input: string): void; + /** Write a little-endian signed 64-bit int. */ + export function writeInt64LE(buffer: Buffer, offset: number, input: number): void; + /** Write a little-endian signed 64-bit int. */ + export function writeInt64LE(buffer: Buffer, offset: number, input: string): void; + + /** + * Write the JS Object. This function "attaches" object to buffer to prevent + * it from being garbage collected. + */ + export function writeObject(buffer: Buffer, offset: number, object: Object): void; + + /** + * Write the memory address of pointer to buffer at the specified offset. This + * function "attaches" object to buffer to prevent it from being garbage collected. + */ + export function writePointer(buffer: Buffer, offset: number, + pointer: Buffer): void; + + /** Write a little-endian unsigned 64-bit int. */ + export function writeUInt64BE(buffer: Buffer, offset: number, input: number): void; + /** Write a little-endian unsigned 64-bit int. */ + export function writeUInt64BE(buffer: Buffer, offset: number, input: string): void; + + /** + * Attach object to buffer such. + * It prevents object from being garbage collected until buffer does. + */ + export function _attach(buffer: Buffer, object: Object): void; + + /** Same as ref.reinterpret, except that this version does not attach buffer. */ + export function _reinterpret(buffer: Buffer, size: number, + offset?: number): Buffer; + /** Same as ref.reinterpretUntilZeros, except that this version does not attach buffer. */ + export function _reinterpretUntilZeros(buffer: Buffer, size: number, + offset?: number): Buffer; + /** Same as ref.writePointer, except that this version does not attach pointer. */ + export function _writePointer(buffer: Buffer, offset: number, + pointer: Buffer): void; + /** Same as ref.writeObject, except that this version does not attach object. */ + export function _writeObject(buffer: Buffer, offset: number, object: Object): void; + + /** Default types. */ + export var types: { + void: Type; int64: Type; ushort: Type; + int: Type; uint64: Type; float: Type; + uint: Type; long: Type; double: Type; + int8: Type; ulong: Type; Object: Type; + uint8: Type; longlong: Type; CString: Type; + int16: Type; ulonglong: Type; bool: Type; + uint16: Type; char: Type; byte: Type; + int32: Type; uchar: Type; size_t: Type; + uint32: Type; short: Type; + }; +} diff --git a/reveal/reveal-tests.ts.tscparams b/reveal/reveal-tests.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/reveal/reveal-tests.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/reveal/reveal.d.ts b/reveal/reveal.d.ts index bfe56bf0b..14393d650 100644 --- a/reveal/reveal.d.ts +++ b/reveal/reveal.d.ts @@ -10,7 +10,7 @@ interface RevealStatic { configure:(diff:RevealOptions)=>void; // Navigation - slide(h:number, v:number, f?:number, o?:number); + slide(h:number, v:number, f?:number, o?:number):void; left():void; right():void; up():void; diff --git a/reveal/reveal.d.ts.tscparams b/reveal/reveal.d.ts.tscparams deleted file mode 100644 index e16c76dff..000000000 --- a/reveal/reveal.d.ts.tscparams +++ /dev/null @@ -1 +0,0 @@ -"" diff --git a/riotjs/riotjs-render.d.ts b/riotjs/riotjs-render.d.ts index fe6cf84dc..b2b044d93 100644 --- a/riotjs/riotjs-render.d.ts +++ b/riotjs/riotjs-render.d.ts @@ -1,4 +1,4 @@ -// Type definitions for riot.js (ext/render.js) +// Type definitions for riot.js // Project: https://github.com/moot/riotjs // Definitions by: vvakame // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/rx.js/rx-lite.d.ts b/rx.js/rx-lite.d.ts index dfae2289d..9b9506676 100644 --- a/rx.js/rx-lite.d.ts +++ b/rx.js/rx-lite.d.ts @@ -1,4 +1,6 @@ -// This file contains common part of defintions for rx.d.ts and rx.lite.d.ts +// DefinitelyTyped: partial + +// This file contains common part of defintions for rx.d.ts and rx.lite.d.ts // Do not include the file separately. declare module Rx { diff --git a/rx.js/rx.aggregates.d.ts b/rx.js/rx.aggregates.d.ts index 1305c18db..3c942a8af 100644 --- a/rx.js/rx.aggregates.d.ts +++ b/rx.js/rx.aggregates.d.ts @@ -1,7 +1,6 @@ // Type definitions for RxJS-Aggregates v2.2.25 // Project: http://rx.codeplex.com/ -// Definitions by: Carl de Billy -// Definitions by: Igor Oleinikov +// Definitions by: Carl de Billy , Igor Oleinikov // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/rx.js/rx.all.ts b/rx.js/rx.all.ts index 800baddef..f0d9eeb0b 100644 --- a/rx.js/rx.all.ts +++ b/rx.js/rx.all.ts @@ -1,7 +1,6 @@ // Type definitions for RxJS-All v2.2.25 // Project: http://rx.codeplex.com/ -// Definitions by: Carl de Billy -// Definitions by: Igor Oleinikov +// Definitions by: Carl de Billy , Igor Oleinikov // Definitions: https://github.com/borisyankov/DefinitelyTyped /// @@ -14,4 +13,4 @@ /// /// /// -/// \ No newline at end of file +/// diff --git a/rx.js/rx.async-lite.d.ts b/rx.js/rx.async-lite.d.ts index ce0f96778..be13320c2 100644 --- a/rx.js/rx.async-lite.d.ts +++ b/rx.js/rx.async-lite.d.ts @@ -1,3 +1,5 @@ +// DefinitelyTyped: partial + // This file contains common part of defintions for rx.async.d.ts and rx.lite.d.ts // Do not include the file separately. diff --git a/rx.js/rx.async.d.ts b/rx.js/rx.async.d.ts index 582b60f43..4c8aaa798 100644 --- a/rx.js/rx.async.d.ts +++ b/rx.js/rx.async.d.ts @@ -1,7 +1,6 @@ // Type definitions for RxJS-Async v2.2.25 // Project: http://rx.codeplex.com/ -// Definitions by: zoetrope -// Definitions by: Igor Oleinikov +// Definitions by: zoetrope , Igor Oleinikov // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/rx.js/rx.backpressure-lite.d.ts b/rx.js/rx.backpressure-lite.d.ts index 420a568f3..d1c244195 100644 --- a/rx.js/rx.backpressure-lite.d.ts +++ b/rx.js/rx.backpressure-lite.d.ts @@ -1,4 +1,6 @@ -// This file contains common part of defintions for rx.backpressure.d.ts and rx.lite.d.ts +// DefinitelyTyped: partial + +// This file contains common part of defintions for rx.backpressure.d.ts and rx.lite.d.ts // Do not include the file separately. /// diff --git a/rx.js/rx.binding-lite.d.ts b/rx.js/rx.binding-lite.d.ts index 1e5d95eaf..e1120e109 100644 --- a/rx.js/rx.binding-lite.d.ts +++ b/rx.js/rx.binding-lite.d.ts @@ -1,3 +1,5 @@ +// DefinitelyTyped: partial + // This file contains common part of defintions for rx.binding.d.ts and rx.lite.d.ts // Do not include the file separately. diff --git a/rx.js/rx.binding.d.ts b/rx.js/rx.binding.d.ts index b9ea37fe6..08a989f4b 100644 --- a/rx.js/rx.binding.d.ts +++ b/rx.js/rx.binding.d.ts @@ -1,7 +1,6 @@ // Type definitions for RxJS-Binding v2.2.25 // Project: http://rx.codeplex.com/ -// Definitions by: Carl de Billy -// Definitions by: Igor Oleinikov +// Definitions by: Carl de Billy , Igor Oleinikov // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/rx.js/rx.coincidence-lite.d.ts b/rx.js/rx.coincidence-lite.d.ts index 8dee43a0c..801e42168 100644 --- a/rx.js/rx.coincidence-lite.d.ts +++ b/rx.js/rx.coincidence-lite.d.ts @@ -1,3 +1,5 @@ +// DefinitelyTyped: partial + // This file contains common part of defintions for rx.time.d.ts and rx.lite.d.ts // Do not include the file separately. diff --git a/rx.js/rx.coincidence.d.ts b/rx.js/rx.coincidence.d.ts index 1fc45a2c6..e21712bfe 100644 --- a/rx.js/rx.coincidence.d.ts +++ b/rx.js/rx.coincidence.d.ts @@ -1,7 +1,6 @@ // Type definitions for RxJS-Coincidence v2.2.25 // Project: http://rx.codeplex.com/ -// Definitions by: Carl de Billy -// Definitions by: Igor Oleinikov +// Definitions by: Carl de Billy , Igor Oleinikov // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/rx.js/rx.d.ts b/rx.js/rx.d.ts index e88480f95..967b5aefa 100644 --- a/rx.js/rx.d.ts +++ b/rx.js/rx.d.ts @@ -1,7 +1,6 @@ // Type definitions for RxJS v2.2.25 // Project: http://rx.codeplex.com/ -// Definitions by: gsino -// Definitions by: Igor Oleinikov +// Definitions by: gsino , Igor Oleinikov // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/rx.js/rx.jquery.d.ts b/rx.js/rx.jquery.d.ts index f2dcb284a..75202142e 100644 --- a/rx.js/rx.jquery.d.ts +++ b/rx.js/rx.jquery.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bridging RxJS with jQuery. +// Type definitions for RxJS-jQuery // Project: https://github.com/Reactive-Extensions/RxJS-jQuery/ // Definitions by: Igor Oleinikov // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/rx.js/rx.lite.d.ts b/rx.js/rx.lite.d.ts index 20d8a3179..801a89bbd 100644 --- a/rx.js/rx.lite.d.ts +++ b/rx.js/rx.lite.d.ts @@ -1,7 +1,6 @@ // Type definitions for RxJS-Lite v2.2.25 // Project: http://rx.codeplex.com/ -// Definitions by: gsino -// Definitions by: Igor Oleinikov +// Definitions by: gsino , Igor Oleinikov // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/rx.js/rx.time-lite.d.ts b/rx.js/rx.time-lite.d.ts index 36a07a825..a5b102827 100644 --- a/rx.js/rx.time-lite.d.ts +++ b/rx.js/rx.time-lite.d.ts @@ -1,3 +1,5 @@ +// DefinitelyTyped: partial + // This file contains common part of defintions for rx.time.d.ts and rx.lite.d.ts // Do not include the file separately. diff --git a/rx.js/rx.time.d.ts b/rx.js/rx.time.d.ts index 49b2f6b5e..010de369e 100644 --- a/rx.js/rx.time.d.ts +++ b/rx.js/rx.time.d.ts @@ -1,7 +1,6 @@ // Type definitions for RxJS-Time v2.2.25 // Project: http://rx.codeplex.com/ -// Definitions by: Carl de Billy -// Definitions by: Igor Oleinikov +// Definitions by: Carl de Billy , Igor Oleinikov // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/rx.js/rx.virtualtime.d.ts b/rx.js/rx.virtualtime.d.ts index 25835e3ad..1b729a781 100644 --- a/rx.js/rx.virtualtime.d.ts +++ b/rx.js/rx.virtualtime.d.ts @@ -1,7 +1,6 @@ // Type definitions for RxJS-VirtualTime v2.2.25 // Project: http://rx.codeplex.com/ -// Definitions by: gsino -// Definitions by: Igor Oleinikov +// Definitions by: gsino , Igor Oleinikov // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/sammyjs/sammyjs.d.ts b/sammyjs/sammyjs.d.ts index 136362fbf..dc41cbf6f 100644 --- a/sammyjs/sammyjs.d.ts +++ b/sammyjs/sammyjs.d.ts @@ -1,7 +1,6 @@ // Type definitions for Sammy.js // Project: http://sammyjs.org/ -// Definitions by: Boris Yankov -// Definitions by: Oisin Grehan +// Definitions by: Boris Yankov , Oisin Grehan // Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/scroller/easyscroller.d.ts b/scroller/easyscroller.d.ts index edc3c55d6..fc0418a57 100644 --- a/scroller/easyscroller.d.ts +++ b/scroller/easyscroller.d.ts @@ -1,6 +1,6 @@ // Type definitions for Zynga EasyScroller // Project: https://github.com/zynga/scroller -// Definitions by: Boris Yankov https://github.com/borisyankov +// Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -12,4 +12,4 @@ declare class EasyScroller { render(): void; reflow(): void; bindEvents(): void; -} \ No newline at end of file +} diff --git a/scroller/scroller.d.ts b/scroller/scroller.d.ts index 842aa8ee0..09cbbc291 100644 --- a/scroller/scroller.d.ts +++ b/scroller/scroller.d.ts @@ -1,6 +1,6 @@ // Type definitions for Zynga Scroller // Project: https://github.com/zynga/scroller -// Definitions by: Boris Yankov https://github.com/borisyankov +// Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -47,4 +47,4 @@ declare class Scroller { doTouchStart(touches: any[], timeStamp: number): void; doTouchMove(touches: any[], timeStamp: number, scale?: number): void; doTouchEnd(timeStamp: number): void; -} \ No newline at end of file +} diff --git a/sharepoint/SharePoint.d.ts b/sharepoint/SharePoint.d.ts index b0417fd33..1f7a2feaf 100644 --- a/sharepoint/SharePoint.d.ts +++ b/sharepoint/SharePoint.d.ts @@ -3,8 +3,6 @@ // Definitions by: Stanislav Vyshchepan , Andrey Markeev // Definitions: https://github.com/borisyankov/DefinitelyTyped - - declare module Sys { export class EventArgs { static Empty: Sys.EventArgs; @@ -154,6 +152,7 @@ declare var $get: { (id: string): HTMLElement; }; declare var $addHandler: { (element: HTMLElement, eventName: string, handler: (e: Event) => void): void; }; declare var $removeHandler: { (element: HTMLElement, eventName: string, handler: (e: Event) => void): void; }; + declare module SP { export class SOD { static execute(fileName: string, functionName: string, ...args: any[]): void; @@ -172,9 +171,108 @@ declare module SP { static get_ribbonImagePrefetchEnabled(): boolean; static set_ribbonImagePrefetchEnabled(value: boolean): void; - - } + + export enum ListLevelPermissionMask { + viewListItems,//: 1, + insertListItems,//: 2, + editListItems,//: 4, + deleteListItems,//: 8, + approveItems,//: 16, + openItems,//: 32, + viewVersions,//: 64, + deleteVersions,//: 128, + breakCheckout,//: 256, + managePersonalViews,//: 512, + manageLists//: 2048 + } + + export class HtmlBuilder { + constructor(); + addAttribute(name: string, value: string): void; + addCssClass(cssClassName: string): void; + addCommunitiesCssClass(cssClassName: string): void; + renderBeginTag(tagName: string): void; + renderEndTag(): void; + write(s: string): void; + writeEncoded(s: string): void; + toString(): string; + } + + export class ScriptHelpers { + static disableWebpartSelection(context: SPClientTemplates.RenderContext): void; + static getDocumentQueryPairs(): { [index: string]: string; }; + static getFieldFromSchema(schema: SPClientTemplates.ListSchema, fieldName: string): SPClientTemplates.FieldSchema; + static getLayoutsPageUrl(pageName: string, webServerRelativeUrl: string): string; + static getListLevelPermissionMask(jsonItem: string): number; + static getTextAreaElementValue(textAreaElement: HTMLTextAreaElement): string; + static getUrlQueryPairs(docUrl: string): { [index: string]: string; }; + static getUserFieldProperty(item: ListItem, fieldName: string, propertyName: string): any; + static hasPermission(listPermissionMask: number, listPermission: ListLevelPermissionMask): boolean; + static newGuid(): SP.Guid; + static isNullOrEmptyString(str: string): boolean; + static isNullOrUndefined(obj: any): boolean; + static isNullOrUndefinedOrEmpty(str: string): boolean; + static isUndefined(obj: any): boolean; + static replaceOrAddQueryString(url: string, key: string, value: string): string; + static removeHtml(str: string): string; + static removeStyleChildren(element: HTMLElement); + static removeHtmlAndTrimStringWithEllipsis(str: string, maxLength: number): string; + static setTextAreaElementValue(textAreaElement: HTMLTextAreaElement, newValue: string): void; + static truncateToInt(n: number): number; + static urlCombine(path1: string, path2: string): string; + static resizeImageToSquareLength(imgElement: HTMLImageElement, squareLength: number): void; + } + + + export class PageContextInfo { + static get_siteServerRelativeUrl(): string; + static get_webServerRelativeUrl(): string; + static get_webAbsoluteUrl(): string; + static get_serverRequestPath(): string; + static get_siteAbsoluteUrl(): string; + static get_webTitle(): string; + static get_tenantAppVersion(): string; + static get_webLogoUrl(): string; + static get_webLanguage(): number; + static get_currentLanguage(): number; + static get_pageItemId(): number; + static get_pageListId(): string; + static get_webPermMasks(): { High: number; Low: number; }; + static get_currentCultureName(): string; + static get_currentUICultureName(): string; + static get_clientServerTimeDelta(): number; + static get_userLoginName(): string; + static get_webTemplate(): string; + get_pagePersonalizationScope(): string; + } + + export class ContextPermissions { + has(perm: number): boolean; + hasPermissions(high: number, low: number): boolean; + fromJson(json: { High: number; Low: number; }): void; + } + + export module ListOperation { + export module ViewOperation { + export function getSelectedView(): string; + export function navigateUp(viewId: string): void; + export function refreshView(viewId: string): void; + } + export module Selection { + export function selectListItem(iid: string, bSelect: boolean); + export function getSelectedItems(): { id: number; fsObjType: FileSystemObjectType; }[]; + export function getSelectedList(): string; + export function getSelectedView(): string; + export function navigateUp(viewId: string): void; + export function deselectAllListItems(iid: string); + } + export module Overrides { + export function overrideDeleteConfirmation(listId: string, overrideText:string):void; + } + } + + } /** Register function to rerun on partial update in MDS-enabled site.*/ @@ -229,6 +327,143 @@ declare function AddEvtHandler(element: HTMLElement, event: string, func: EventL /** Gets query string parameter */ declare function GetUrlKeyValue(key: string): string; + +declare class AjaxNavigate { + update(url:string, updateParts:Object, fullNavigate:boolean, anchorName:string):void; + add_navigate(handler: Function): void; + remove_navigate(handler:Function):void; + submit(formToSubmit:HTMLFormElement):void; + getParam(paramName:string):string; + getSavedFormAction():string; + get_href(): string; + get_hash(): string; + get_search():string; + convertMDSURLtoRegularURL(mdsPath:string):string; +} + +declare var ajaxNavigate: AjaxNavigate; + +declare class Browseris { + firefox: boolean; + firefox36up: boolean; + firefox3up: boolean; + firefox4up: boolean; + ie: boolean; + ie55up: boolean; + ie5up: boolean; + ie7down: boolean; + ie8down: boolean; + ie9down: boolean; + ie8standard: boolean; + ie8standardUp: boolean; + ie9standardUp: boolean; + ipad: boolean; + windowsphone: boolean; + chrome: boolean; + chrome7up: boolean; + chrome8up: boolean; + chrome9up: boolean; + iever: boolean; + mac: boolean; + major: boolean; + msTouch: boolean; + isTouch: boolean; + nav: boolean; + nav6: boolean; + nav6up: boolean; + nav7up: boolean; + osver: boolean; + safari: boolean; + safari125up: boolean; + safari3up: boolean; + verIEFull: boolean; + w3c: boolean; + webKit: boolean; + win: boolean; + win8AppHost: boolean; + win32: boolean; + win64bit: boolean; + winnt: boolean; + armProcessor: boolean +} + +declare var browseris: Browseris; + +interface ContextInfo extends SPClientTemplates.RenderContext { + AllowGridMode: boolean; + BasePermissions: any; + BaseViewID: any; + CascadeDeleteWarningMessage: string; + ContentTypesEnabled: boolean; + CurrentSelectedItems: boolean; + CurrentUserId: number; + EnableMinorVersions: boolean; + ExternalDataList: boolean; + HasRelatedCascadeLists: boolean; + HttpPath: string; + HttpRoot: string; + LastSelectableRowIdx: number; + LastSelectedItemIID: number; + LastRowIndexSelected: number; + RowFocusTimerID: number; + ListData: any;// SPClientTemplates.ListData_InView | SPClientTemplates.ListData_InForm + ListSchema: SPClientTemplates.ListSchema; + ModerationStatus: number; + PortalUrl: string; + RecycleBinEnabled: number; + SelectAllCbx: HTMLElement; + SendToLocationName: string; + SendToLocationUrl: string; + StateInitDone: boolean; + TableCbxFocusHandler: Function; + TableMouseoverHandler: Function; + TotalListItems: number; + WorkflowsAssociated: boolean; + clvp: any; + ctxId: number; + ctxType: any; + dictSel: any; + displayFormUrl: string; + editFormUrl: string; + imagesPath: string; + inGridMode: boolean; + inGridFullRender: boolean; + isForceCheckout: boolean; + isModerated: boolean; + isPortalTemplate: boolean; + isVersions: boolean; + isWebEditorPreview: boolean; + leavingGridMode: boolean; + loadingAsyncData: boolean; + listBaseType: number; + listName: string; + listTemplate: string; + listUrlDir: string; + newFormUrl: string; + onRefreshFailed: Function; + overrideDeleteConfirmation: string; + overrideFilterQstring: string; + recursiveView: boolean; + rootFolderForDisplay: string; + serverUrl: string; + verEnabled: boolean; + view: string; + queryString: string; + IsClientRendering: boolean; + wpq: string; + rootFolder: string; + IsAppWeb: boolean; + NewWOPIDocumentEnabled: boolean; + NewWOPIDocumentUrl: string; + AllowCreateFolder: boolean; + CanShareLinkForNewDocument: boolean; + noGroupCollapse: boolean; + SiteTemplateId: number; + ExcludeFromOfflineClient: boolean; + +} + +declare function GetCurrentCtx():ContextInfo; declare module SP { export enum RequestExecutorErrors { requestAbortedOrTimedout, @@ -246,8 +481,8 @@ declare module SP { set_formDigestHandlingEnabled(value: boolean): void; get_iFrameSourceUrl(): string; set_iFrameSourceUrl(value: string): void; - executeAsync(requestInfo: RequestInfo): void; - attemptLogin(returnUrl: string, success: (response: ResponseInfo) => void, error?: (response: ResponseInfo, error: RequestExecutorErrors, statusText: string) => void): void; + executeAsync(requestInfo:RequestInfo): void; + attemptLogin(returnUrl:string, success: (response: ResponseInfo) => void , error?: (response: ResponseInfo, error: RequestExecutorErrors, statusText: string) => void): void; } export interface RequestInfo { @@ -287,12 +522,13 @@ declare module SP { createWebRequestExecutor(): ProxyWebRequestExecutor; } } -interface MQuery { +interface MQuery +{ (selector: string, context?: any): MQueryResultSetElements; (element: HTMLElement): MQueryResultSetElements; (object: MQueryResultSetElements): MQueryResultSetElements; (object: MQueryResultSet): MQueryResultSet; - (object: T): MQueryResultSet; + (object: T): MQueryResultSet; (elementArray: HTMLElement[]): MQueryResultSetElements; (array: T[]): MQueryResultSet; (): MQueryResultSet; @@ -321,7 +557,7 @@ interface MQuery { isObject(obj: any): boolean; isEmptyObject(obj: any): boolean; - ready(callback: () => void): void; + ready(callback: () => void ): void; contains(container: HTMLElement, contained: HTMLElement): boolean; proxy(fn: (...args: any[]) => any, context: any, ...args: any[]): Function; @@ -363,7 +599,7 @@ interface MQuery { hasData(element: HTMLElement): boolean; } -interface MQueryResultSetElements extends MQueryResultSet { +interface MQueryResultSetElements extends MQueryResultSet{ append(node: HTMLElement): MQueryResultSetElements; append(mQuerySet: MQueryResultSetElements): MQueryResultSetElements; append(html: string): MQueryResultSetElements; @@ -471,26 +707,26 @@ interface MQueryResultSetElements extends MQueryResultSet { submit(): MQueryResultSetElements; submit(handler: (eventObject: MQueryEvent) => any): MQueryResultSetElements; unload(): MQueryResultSetElements; - unload(handler: (eventObject: MQueryEvent) => any): MQueryResultSetElements; + unload(handler: (eventObject: MQueryEvent) => any): MQueryResultSetElements; } -interface MQueryResultSet { +interface MQueryResultSet { [index: number]: T; contains(contained: T): boolean; - + filter(fn: (elementOfArray: T, indexInArray: number) => boolean, context?: any): MQueryResultSet; - filter(fn: (elementOfArray: T) => boolean, context?: any): MQueryResultSet; + filter(fn: (elementOfArray: T) => boolean, context?: any): MQueryResultSet; every(fn: (elementOfArray: T, indexInArray: number) => boolean, context?: any): boolean; every(fn: (elementOfArray: T) => boolean, context?: any): boolean; - + some(fn: (elementOfArray: T, indexInArray: number) => boolean, context?: any): boolean; some(fn: (elementOfArray: T) => boolean, context?: any): boolean; - + map(callback: (elementOfArray: T, indexInArray: number) => any): MQueryResultSet; map(callback: (elementOfArray: T) => any): MQueryResultSet; - + forEach(fn: (elementOfArray: T, indexInArray: number) => void, context?: any): void; forEach(fn: (elementOfArray: T) => void, context?: any): void; @@ -579,12 +815,12 @@ declare class CalloutAction { render(): void; isEnabled(): boolean; isVisible(): boolean; - set(options: CalloutActionOptions): void; + set (options: CalloutActionOptions): void; } declare class Callout { /** Sets options for the callout. Not all options can be changed for the callout after its creation. */ - set(options: CalloutOptions); + set (options: CalloutOptions); /** Adds event handler to the callout. @param eventName one of the following: "opened", "opening", "closing", "closed" */ addEventCallback(eventName: string, callback: (callout: Callout) => void); @@ -867,17 +1103,26 @@ declare module SPClientTemplates { PictureOnly: boolean; PictureSize: string; } - /** Represents field schema in Grid mode and on list forms. - Consider casting objects of this type to more specific field types, e.g. FieldSchemaInForm_Lookup */ - export interface FieldSchema_InForm { + + export interface FieldSchema { /** Specifies if the field can be edited while list view is in the Grid mode */ AllowGridEditing: boolean; + /** String representation of the field type, e.g. "Lookup". Same as SPField.TypeAsString */ + FieldType: string; + /** Internal name of the field */ + Name: string; + /** For OOTB fields, returns the type of field. For "UserMulti" returns "User", for "LookupMulti" returns "Lookup". + For custom field types, returns base type of the field. */ + Type: string; + } + +/** Represents field schema in Grid mode and on list forms. + Consider casting objects of this type to more specific field types, e.g. FieldSchemaInForm_Lookup */ + export interface FieldSchema_InForm extends FieldSchema { /** Description for this field. */ Description: string; /** Direction of the reading order for the field. */ Direction: string; - /** String representation of the field type, e.g. "Lookup". Same as SPField.TypeAsString */ - FieldType: string; /** Indicates whether the field is hidden */ Hidden: boolean; /** Guid of the field */ @@ -885,8 +1130,6 @@ declare module SPClientTemplates { /** Specifies Input Method Editor (IME) mode bias to use for the field. The IME enables conversion of keystrokes between languages when one writing system has more characters than can be encoded for the given keyboard. */ IMEMode: any; - /** Internal name of the field */ - Name: string; /** Specifies if the field is read only */ ReadOnlyField: boolean; /** Specifies wherever field requires values */ @@ -894,13 +1137,16 @@ declare module SPClientTemplates { RestrictedMode: boolean; /** Title of the field */ Title: string; - /** For OOTB fields, returns the type of field. For "UserMulti" returns "User", for "LookupMulti" returns "Lookup". - For custom field types, returns base type of the field. */ - Type: string; /** If SPFarm.Local.UseMinWidthForHtmlPicker is true, UseMinWidth will be set to true. Undefined in other cases. */ UseMinWidth: boolean; } - export interface ListSchema_InForm { + + export interface ListSchema { + Field: FieldSchema[]; + } + + + export interface ListSchema_InForm extends ListSchema { Field: FieldSchema_InForm[]; } export interface ListData_InForm { @@ -945,9 +1191,7 @@ declare module SPClientTemplates { DefaultRender: string; } /** Represents field schema in a list view. */ - export interface FieldSchema_InView { - /** Either "TRUE" or "FALSE" */ - AllowGridEditing: string; + export interface FieldSchema_InView extends FieldSchema { /** Either "TRUE" or "FALSE" */ CalloutMenu: string; ClassInfo: string; // e.g. "Menu" @@ -957,8 +1201,6 @@ declare module SPClientTemplates { Explicit: string; fieldRenderer: any; FieldTitle: string; - /** Represents SPField.TypeAsString, e.g. "Computed", "UserMulti", etc. */ - FieldType: string; /** Indicates whether the field can be filtered. Either "TRUE" or "FALSE" */ Filterable: string; /** Set to "TRUE" for fields that comply to the following Xpath query: @@ -971,16 +1213,14 @@ declare module SPClientTemplates { /** Specifies if the field contains list item menu. Corresponds to ViewFields/FieldRef/@ListItemMenu attribute. Either "TRUE" or "FALSE" and might be missing. */ listItemMenu: string; - Name: string; RealFieldName: string; /** Either "TRUE" or "FALSE" */ ReadOnly: string; ResultType: string; /** Indicates whether the field can be sorted. Either "TRUE" or "FALSE" */ Sortable: string; - Type: string; } - export interface ListSchema_InView { + export interface ListSchema_InView extends ListSchema { /** Key-value object that represents all aggregations defined for the view. Key specifies the field internal name, and value specifies the type of the aggregation. */ Aggregate: { [name: string]: string; }; @@ -992,7 +1232,6 @@ declare module SPClientTemplates { /** Either "0" or "1" */ EffectivePresenceEnabled: string; /** If in grid mode (context.inGridMode == true), cast to FieldSchema_InForm[], otherwise cast to FieldSchema_InView[] */ - Field: any[]; FieldSortParam: string; Filter: any; /** Either "0" or "1" */ @@ -1180,26 +1419,26 @@ declare module SPClientTemplates { } export interface RenderContext { - BaseViewID: number; - ControlMode: ClientControlMode; - CurrentCultureName: string; - CurrentLanguage: number; - CurrentSelectedItems: any; - CurrentUICultureName: string; - ListTemplateType: number; - OnPostRender: any; - OnPreRender: any; - onRefreshFailed: any; - RenderBody: (renderContext: RenderContext) => string; - RenderFieldByName: (renderContext: RenderContext, fieldName: string) => string; - RenderFields: (renderContext: RenderContext) => string; - RenderFooter: (renderContext: RenderContext) => string; - RenderGroups: (renderContext: RenderContext) => string; - RenderHeader: (renderContext: RenderContext) => string; - RenderItems: (renderContext: RenderContext) => string; - RenderView: (renderContext: RenderContext) => string; - SiteClientTag: string; - Templates: TemplateOverrides; + BaseViewID?: number; + ControlMode?: ClientControlMode; + CurrentCultureName?: string; + CurrentLanguage?: number; + CurrentSelectedItems?: any; + CurrentUICultureName?: string; + ListTemplateType?: number; + OnPostRender?: any; + OnPreRender?: any; + onRefreshFailed?: any; + RenderBody?: (renderContext: RenderContext) => string; + RenderFieldByName?: (renderContext: RenderContext, fieldName: string) => string; + RenderFields?: (renderContext: RenderContext) => string; + RenderFooter?: (renderContext: RenderContext) => string; + RenderGroups?: (renderContext: RenderContext) => string; + RenderHeader?: (renderContext: RenderContext) => string; + RenderItems?: (renderContext: RenderContext) => string; + RenderView?: (renderContext: RenderContext) => string; + SiteClientTag?: string; + Templates?: Templates; } export interface SingleTemplateCallback { @@ -1214,6 +1453,12 @@ declare module SPClientTemplates { /** Must return null in order to fall back to a more common template or to a system default template */ (renderContext: RenderContext): string; } + + export interface FieldCallback { + /** Must return null in order to fall back to a more common template or to a system default template */ + (renderContext: RenderContext): string; + } + export interface FieldInFormCallback { /** Must return null in order to fall back to a more common template or to a system default template */ (renderContext: RenderContext_FieldInForm): string; @@ -1234,6 +1479,27 @@ declare module SPClientTemplates { View?: FieldInViewCallback; } + export interface FieldTemplates { + [fieldInternalName: string]: FieldCallback; + } + + export interface Templates { + View?: (renderContext: any) => string; // TODO: determine appropriate context type and purpose of this template + Body?: (renderContext: any) => string; // TODO: determine appropriate context type and purpose of this template + /** Defines templates for rendering groups (aggregations). */ + Group?: GroupCallback; + /** Defines templates for list items rendering. */ + Item?: ItemCallback; + /** Defines template for rendering list view header. + Can be either string or SingleTemplateCallback */ + Header?: SingleTemplateCallback; + /** Defines template for rendering list view footer. + Can be either string or SingleTemplateCallback */ + Footer?: SingleTemplateCallback; + /** Defines templates for fields rendering. The field is specified by it's internal name. */ + Fields?: FieldTemplates; + } + export interface FieldTemplateMap { [fieldInternalName: string]: FieldTemplateOverrides; } @@ -1276,6 +1542,7 @@ declare module SPClientTemplates { } export class TemplateManager { static RegisterTemplateOverrides(renderCtx: TemplateOverridesOptions): void; + static GetTemplates(renderCtx: any): Templates; } export interface ClientUserValue { @@ -1349,13 +1616,13 @@ declare module SPClientTemplates { EnableVesioning: boolean; Id: string; }; - registerInitCallback(fieldname: string, callback: () => void): void; - registerFocusCallback(fieldname: string, callback: () => void): void; - registerValidationErrorCallback(fieldname: string, callback: (error: any) => void): void; + registerInitCallback(fieldname: string, callback: () => void ): void; + registerFocusCallback(fieldname: string, callback: () => void ): void; + registerValidationErrorCallback(fieldname: string, callback: (error: any) => void ): void; registerGetValueCallback(fieldname: string, callback: () => any): void; updateControlValue(fieldname: string, value: any): void; registerClientValidator(fieldname: string, validator: SPClientForms.ClientValidation.ValidatorSet): void; - registerHasValueChangedCallback(fieldname: string, callback: (eventArg?: any) => void); + registerHasValueChangedCallback(fieldname: string, callback: (eventArg?: any) => void ); } } @@ -1434,23 +1701,23 @@ declare module SPAnimation { GetDataIndex(attributeId: Attribute): number } - export class Object { - constructor(animationID: ID, delay: number, element: HTMLElement, finalState: State, finishFunc?: (data: any) => void, data?: any); - constructor(animationID: ID, delay: number, element: HTMLElement[], finalState: State, finishFunc?: (data: any) => void, data?: any); + export class Object{ + constructor(animationID: ID, delay: number, element: HTMLElement, finalState: State, finishFunc?: (data: any) => void , data?: any); + constructor(animationID: ID, delay: number, element: HTMLElement[], finalState: State, finishFunc?: (data: any) => void , data?: any); RunAnimation(): void; } } -declare module SPAnimationUtility { +declare module SPAnimationUtility{ export class BasicAnimator { - static FadeIn(element: HTMLElement, finishFunc?: (data: any) => void, data?: any): void; - static FadeOut(element: HTMLElement, finishFunc?: (data: any) => void, data?: any): void; - static Move(element: HTMLElement, posX: number, posY: number, finishFunc?: (data: any) => void, data?: any): void; - static StrikeThrough(element: HTMLElement, strikeThroughWidth: number, finishFunc?: (data: any) => void, data?: any): void; - static Resize(element: HTMLElement, newHeight: number, newWidth: number, finishFunc?: (data: any) => void, data?: any): void; - static CommonResize(element: HTMLElement, newHeight: number, newWidth: number, finishFunc: (data: any) => void, data: any, animationId: SPAnimation.ID): void; - static QuickResize(element: HTMLElement, newHeight: number, newWidth: number, finishFunc?: (data: any) => void, data?: any): void; - static ResizeContainerAndFillContent(element: HTMLElement, newHeight: number, newWidth: number, finishFunc: () => void, fAddToEnd: boolean): void; + static FadeIn(element: HTMLElement, finishFunc?: (data: any) => void , data?: any): void; + static FadeOut (element: HTMLElement, finishFunc?: (data: any) => void , data?: any): void; + static Move(element: HTMLElement, posX:number, posY:number, finishFunc?: (data: any) => void , data?: any): void; + static StrikeThrough(element: HTMLElement, strikeThroughWidth: number, finishFunc?: (data: any) => void , data?: any): void; + static Resize(element: HTMLElement, newHeight: number, newWidth: number, finishFunc?: (data: any) => void , data?: any): void; + static CommonResize(element: HTMLElement, newHeight: number, newWidth: number, finishFunc: (data: any) => void , data: any, animationId:SPAnimation.ID): void; + static QuickResize(element: HTMLElement, newHeight: number, newWidth: number, finishFunc?: (data: any) => void , data?: any): void; + static ResizeContainerAndFillContent(element: HTMLElement, newHeight: number, newWidth: number, finishFunc: () => void , fAddToEnd: boolean): void; static GetWindowScrollPosition(): { x: number; y: number; }; static GetLeftOffset(element: HTMLElement): number; static GetTopOffset(element: HTMLElement): number; @@ -1702,13 +1969,13 @@ declare module SP { get_expectedContentType(): string; set_expectedContentType(value: string): void; post(body: string): void; - get(): void; - static doPost(url: string, body: string, expectedContentType: string, succeededHandler: (sender: any, args: SP.PageRequestSucceededEventArgs) => void, failedHandler: (sender: any, args: SP.PageRequestFailedEventArgs) => void): void; - static doGet(url: string, expectedContentType: string, succeededHandler: (sender: any, args: SP.PageRequestSucceededEventArgs) => void, failedHandler: (sender: any, args: SP.PageRequestFailedEventArgs) => void): void; - add_succeeded(value: (sender: any, args: SP.PageRequestSucceededEventArgs) => void): void; - remove_succeeded(value: (sender: any, args: SP.PageRequestSucceededEventArgs) => void): void; - add_failed(value: (sender: any, args: SP.PageRequestFailedEventArgs) => void): void; - remove_failed(value: (sender: any, args: SP.PageRequestFailedEventArgs) => void): void; + get (): void; + static doPost(url: string, body: string, expectedContentType: string, succeededHandler: (sender: any, args: SP.PageRequestSucceededEventArgs) => void , failedHandler: (sender: any, args: SP.PageRequestFailedEventArgs) => void ): void; + static doGet(url: string, expectedContentType: string, succeededHandler: (sender: any, args: SP.PageRequestSucceededEventArgs) => void , failedHandler: (sender: any, args: SP.PageRequestFailedEventArgs) => void ): void; + add_succeeded(value: (sender: any, args: SP.PageRequestSucceededEventArgs) => void ): void; + remove_succeeded(value: (sender: any, args: SP.PageRequestSucceededEventArgs) => void ): void; + add_failed(value: (sender: any, args: SP.PageRequestFailedEventArgs) => void ): void; + remove_failed(value: (sender: any, args: SP.PageRequestFailedEventArgs) => void ): void; constructor(); } export class ResResources { @@ -1962,10 +2229,10 @@ declare module SP { export class ClientRequest { static get_nextSequenceId(): number; get_webRequest(): Sys.Net.WebRequest; - add_requestSucceeded(value: (sender: any, args: SP.ClientRequestSucceededEventArgs) => void): void; - remove_requestSucceeded(value: (sender: any, args: SP.ClientRequestSucceededEventArgs) => void): void; - add_requestFailed(value: (sender: any, args: SP.ClientRequestFailedEventArgs) => void): void; - remove_requestFailed(value: (sender: any, args: SP.ClientRequestFailedEventArgs) => void): void; + add_requestSucceeded(value: (sender: any, args: SP.ClientRequestSucceededEventArgs) => void ): void; + remove_requestSucceeded(value: (sender: any, args: SP.ClientRequestSucceededEventArgs) => void ): void; + add_requestFailed(value: (sender: any, args: SP.ClientRequestFailedEventArgs) => void ): void; + remove_requestFailed(value: (sender: any, args: SP.ClientRequestFailedEventArgs) => void ): void; get_navigateWhenServerRedirect(): boolean; set_navigateWhenServerRedirect(value: boolean): void; } @@ -2000,18 +2267,18 @@ declare module SP { set_webRequestExecutorFactory(value: SP.IWebRequestExecutorFactory): void; get_pendingRequest(): SP.ClientRequest; get_hasPendingRequest(): boolean; - add_executingWebRequest(value: (sender: any, args: SP.WebRequestEventArgs) => void): void; - remove_executingWebRequest(value: (sender: any, args: SP.WebRequestEventArgs) => void): void; - add_requestSucceeded(value: (sender: any, args: SP.ClientRequestSucceededEventArgs) => void): void; - remove_requestSucceeded(value: (sender: any, args: SP.ClientRequestSucceededEventArgs) => void): void; - add_requestFailed(value: (sender: any, args: SP.ClientRequestFailedEventArgs) => void): void; - remove_requestFailed(value: (sender: any, args: SP.ClientRequestFailedEventArgs) => void): void; - add_beginningRequest(value: (sender: any, args: SP.ClientRequestEventArgs) => void): void; - remove_beginningRequest(value: (sender: any, args: SP.ClientRequestEventArgs) => void): void; + add_executingWebRequest(value: (sender: any, args: SP.WebRequestEventArgs) => void ): void; + remove_executingWebRequest(value: (sender: any, args: SP.WebRequestEventArgs) => void ): void; + add_requestSucceeded(value: (sender: any, args: SP.ClientRequestSucceededEventArgs) => void ): void; + remove_requestSucceeded(value: (sender: any, args: SP.ClientRequestSucceededEventArgs) => void ): void; + add_requestFailed(value: (sender: any, args: SP.ClientRequestFailedEventArgs) => void ): void; + remove_requestFailed(value: (sender: any, args: SP.ClientRequestFailedEventArgs) => void ): void; + add_beginningRequest(value: (sender: any, args: SP.ClientRequestEventArgs) => void ): void; + remove_beginningRequest(value: (sender: any, args: SP.ClientRequestEventArgs) => void ): void; get_requestTimeout(): number; set_requestTimeout(value: number): void; - executeQueryAsync(succeededCallback: (sender: any, args: SP.ClientRequestSucceededEventArgs) => void, failedCallback: (sender: any, args: SP.ClientRequestFailedEventArgs) => void): void; - executeQueryAsync(succeededCallback: (sender: any, args: SP.ClientRequestSucceededEventArgs) => void): void; + executeQueryAsync(succeededCallback: (sender: any, args: SP.ClientRequestSucceededEventArgs) => void , failedCallback: (sender: any, args: SP.ClientRequestFailedEventArgs) => void ): void; + executeQueryAsync(succeededCallback: (sender: any, args: SP.ClientRequestSucceededEventArgs) => void ): void; executeQueryAsync(): void; get_staticObjects(): any; castTo(obj: SP.ClientObject, type: any): SP.ClientObject; @@ -2390,7 +2657,7 @@ declare module SP { constructor(); } export class BasePermissions extends SP.ClientValueObject { - set(perm: SP.PermissionKind): void; + set (perm: SP.PermissionKind): void; clear(perm: SP.PermissionKind): void; clearAll(): void; has(perm: SP.PermissionKind): boolean; @@ -3719,7 +3986,7 @@ declare module SP { choiceField, minMaxField, textField, - } + } /** Represents an item or row in a list. */ export class ListItem extends SP.SecurableObject { get_fieldValues(): any; @@ -4153,7 +4420,7 @@ declare module SP { get_value(): string; static newObject(context: SP.ClientRuntimeContext): SP.RequestVariable; append(value: string): void; - set(value: string): void; + set (value: string): void; } export class RoleAssignment extends SP.ClientObject { get_member(): SP.Principal; @@ -4846,8 +5113,8 @@ declare module SP { set_moreColorsPicker(value: SP.Application.UI.MoreColorsPicker): void; } export class ThemeWebPage extends Sys.UI.Control { - add_themeDisplayUpdated(value: (sender: any, e: Sys.EventArgs) => void): void; - remove_themeDisplayUpdated(value: (sender: any, e: Sys.EventArgs) => void): void; + add_themeDisplayUpdated(value: (sender: any, e: Sys.EventArgs) => void ): void; + remove_themeDisplayUpdated(value: (sender: any, e: Sys.EventArgs) => void ): void; constructor(e: HTMLElement); initialize(): void; dispose(): void; @@ -5033,11 +5300,11 @@ declare module Microsoft.SharePoint.Client.Search { getQuerySuggestionsWithResults: (iNumberOfQuerySuggestions: number, - iNumberOfResultSuggestions: number, - fPreQuerySuggestions: boolean, - fHitHighlighting: boolean, - fCapitalizeFirstLetters: boolean, - fPrefixMatchAllTerms: boolean) => QuerySuggestionResults; + iNumberOfResultSuggestions: number, + fPreQuerySuggestions: boolean, + fHitHighlighting: boolean, + fCapitalizeFirstLetters: boolean, + fPrefixMatchAllTerms: boolean) => QuerySuggestionResults; } @@ -5083,15 +5350,15 @@ declare module Microsoft.SharePoint.Client.Search { executeQuery: (query: Query) => SP.JsonObjectResult; executeQueries: (queryIds: string[], queries: Query[], handleExceptions: boolean) => SP.JsonObjectResult; recordPageClick: ( - pageInfo: string, - clickType: string, - blockType: number, - clickedResultId: string, - subResultIndex: number, - immediacySourceId: string, - immediacyQueryString: string, - immediacyTitle: string, - immediacyUrl: string) => void; + pageInfo: string, + clickType: string, + blockType: number, + clickedResultId: string, + subResultIndex: number, + immediacySourceId: string, + immediacyQueryString: string, + immediacyTitle: string, + immediacyUrl: string) => void; exportPopularQueries: (web: SP.Web, sourceId: SP.Guid) => SP.JsonObjectResult; } @@ -5212,7 +5479,7 @@ declare module Microsoft.SharePoint.Client.Search { itemAt: (index: number) => Sort; get_item: (index: number) => Sort; get_childItemType: () => Object; - add: (property: Sort) => void; + add: (strProperty: string, sortDirection: SortDirection) => void; clear: () => void; } @@ -5397,14 +5664,14 @@ declare module Microsoft.SharePoint.Client.Search { export class DocumentCrawlLog extends SP.ClientObject { constructor(context: SP.ClientContext, site: SP.Site); getCrawledUrls: (getCountOnly: boolean, - maxRows: { High: number; Low: number; }, - queryString: string, - isLike: boolean, - contentSourceID: number, - errorLevel: number, - errorID: number, - startDateTime: Date, - endDateTime: Date) => SP.JsonObjectResult; + maxRows: { High: number; Low: number; }, + queryString: string, + isLike: boolean, + contentSourceID: number, + errorLevel: number, + errorID: number, + startDateTime: Date, + endDateTime: Date) => SP.JsonObjectResult; } export class SearchObjectOwner extends SP.ClientObject { @@ -6062,7 +6329,7 @@ declare module SP { /** Provides access to social feeds. It provides methods to create posts, delete posts, read posts, and perform other operations on posts. */ export class SocialFeedManager extends SP.ClientObject { - constructor(); + constructor(context: SP.ClientRuntimeContext); /** Returns the current user */ get_owner(): SocialActor; /** Specifies the URI of the personal site portal. */ @@ -6138,7 +6405,7 @@ declare module SP { set_newerThan(value: string): string; get_olderThan(): string; set_olderThan(value: string): string; - get_sortOrder(): SocialFeedSortOrder; + get_sortOrder():SocialFeedSortOrder; set_sortOrder(value: SocialFeedSortOrder): SocialFeedSortOrder; } @@ -6547,7 +6814,7 @@ declare module SP { get_isReused(): boolean; get_isRoot(): boolean; get_isSourceTerm(): boolean; - get_labels: LabelCollection; + get_labels(): LabelCollection; get_localCustomProperties(): { [key: string]: string; }; get_mergedTermIds(): SP.Guid[]; get_parent(): Term; @@ -6807,7 +7074,7 @@ declare module SP { get_selectedEntities(): any; set_selectedEntities(value: any): void; get_callback(): (sender: any, e: Sys.EventArgs) => void; - set_callback(value: (sender: any, e: Sys.EventArgs) => void): void; + set_callback(value: (sender: any, e: Sys.EventArgs) => void ): void; get_scopeKey(): string; get_componentType(): SP.UI.ApplicationPages.SelectorType; revertTo(ent: SP.UI.ApplicationPages.ResolveEntity): void; @@ -6825,7 +7092,7 @@ declare module SP { static instance(): SP.UI.ApplicationPages.CalendarSelector; registerSelector(selector: SP.UI.ApplicationPages.ISelectorComponent): void; getSelector(type: SP.UI.ApplicationPages.SelectorType, scopeKey: string): SP.UI.ApplicationPages.ISelectorComponent; - addHandler(scopeKey: string, people: boolean, resource: boolean, handler: (sender: any, selection: SP.UI.ApplicationPages.SelectorSelectionEventArgs) => void): void; + addHandler(scopeKey: string, people: boolean, resource: boolean, handler: (sender: any, selection: SP.UI.ApplicationPages.SelectorSelectionEventArgs) => void ): void; revertTo(scopeKey: string, ent: SP.UI.ApplicationPages.ResolveEntity): void; removeEntity(scopeKey: string, ent: SP.UI.ApplicationPages.ResolveEntity): void; constructor(); @@ -6837,7 +7104,7 @@ declare module SP { get_selectedEntities(): any; set_selectedEntities(value: any): void; get_callback(): (sender: any, e: Sys.EventArgs) => void; - set_callback(value: (sender: any, e: Sys.EventArgs) => void): void; + set_callback(value: (sender: any, e: Sys.EventArgs) => void ): void; revertTo(ent: SP.UI.ApplicationPages.ResolveEntity): void; removeEntity(ent: SP.UI.ApplicationPages.ResolveEntity): void; setEntity(ent: SP.UI.ApplicationPages.ResolveEntity): void; @@ -6952,39 +7219,27 @@ declare module SP { get_textElement(): HTMLElement; constructor(); } - export class Notify { - static addNotification(strHtml: string, bSticky: boolean): string; - static removeNotification(nid: string): void; - constructor(); - } - export enum ContainerID { - Basic, - Status, - } - export enum EventID { - OnShow, - OnHide, - OnDisplayNotification, - OnRemoveNotification, - OnNotificationCountChanged, - } - export class SPNotification { - constructor(containerId: SP.UI.ContainerID, strHtml: string, bSticky: boolean, strTooltip: string, onclickHandler: () => void, extraData: any); - constructor(containerId: SP.UI.ContainerID, strHtml: string, bSticky: boolean, strTooltip: string, onclickHandler: () => void); - constructor(containerId: SP.UI.ContainerID, strHtml: string, bSticky: boolean, strTooltip: string); - constructor(containerId: SP.UI.ContainerID, strHtml: string, bSticky: boolean); - constructor(containerId: SP.UI.ContainerID, strHtml: string); - get_id(): string; - Show(bNoAnimate: boolean): void; - Hide(bNoAnimate: boolean): void; - } - export class SPNotificationContainer { - constructor(id: number, element: any, layer: number, notificationLimit: number); - constructor(id: number, element: any, layer: number); - Clear(): void; - GetCount(): number; - SetEventHandler(eventId: SP.UI.EventID, eventHandler: any): void; + + export module Notify { + export function addNotification(strHtml: string, bSticky: boolean): string; + export function removeNotification(nid: string): void; + export function showLoadingNotification(bSticky: boolean): string; + + + export class Notification { + constructor(containerId: SPNotifications.ContainerID, strHtml: string, bSticky?: boolean, strTooltip?: string, onclickHandler?: () => void, extraData?: SPStatusNotificationData); + get_id(): string; + Show(bNoAnimate: boolean): void; + Hide(bNoAnimate: boolean): void; + } + export class NotificationContainer { + constructor(id: number, element: any, layer: number, notificationLimit?: number); + Clear(): void; + GetCount(): number; + SetEventHandler(eventId: SPNotifications.EventID, eventHandler: any): void; + } } + export class Status { static addStatus(strTitle: string, strHtml: string, atBegining: boolean): string; static appendStatus(sid: string, strTitle: string, strHtml: string): string; @@ -6994,9 +7249,10 @@ declare module SP { static removeAllStatus(hide: boolean): void; constructor(); } - export class Workspace { - static add_resized(handler: () => void): void; - static remove_resized(handler: () => void): void; + + export module Workspace { + export function add_resized(handler: () => void): void; + export function remove_resized(handler: () => void): void; } export class Menu { static create(id: string): SP.UI.Menu; @@ -7139,9 +7395,122 @@ declare module SP { close(dialogResult: SP.UI.DialogResult): void; } + + export class Command { + constructor(name: string, displayName: string); + get_displayName(): string; + set_displayName(value: string): string; + + get_tooltip(): string; + set_tooltip(value: string): string; + + get_isEnabled(): boolean; + set_isEnabled(value: boolean): boolean; + + get_href(): string; + get_name(): string; + get_elementIDPrefix(): string; + set_elementIDPrefix(value: string): string; + + get_linkElement():HTMLAnchorElement; + + get_isDropDownCommand(): boolean; + set_isDropDownCommand(value: boolean): boolean; + + attachEvents(): void; + render(builder: HtmlBuilder): void; + + + /**Should override*/ + onClick(): void; + + } + + + export class CommandBar { + constructor(); + get_commands():Command[]; + get_dropDownThreshold(): number; + set_dropDownThreshold(value: number): number; + get_elementID(): string; + get_overrideClass(): string; + set_overrideClass(value: string): string; + addCommand(action:Command):void; + insertCommand(action: Command, position:number): void; + render(builder: HtmlBuilder): void; + attachEvents(): void; + findCommandByName(name:string):Command; + } + + + export class PagingControl { + constructor(id: string); + render(innerContent:string): string; + postRender():void; + get_innerContent():HTMLSpanElement; + get_innerContentClass():string; + setButtonState(buttonId:number, state:number):void; + getButtonState(buttonId: number): number; + onWindowResized(): void; + + /**Should override*/ + onPrev(): void; + onNext(): void; + + static ButtonIDs: { + prev: number; + next: number; + } + + static ButtonState: { + hidden: number + disabled: number; + enabled: number; + } + } + + export module UIUtility { + export function generateRandomElementId(): string; + export function cancelEvent(evt: Event): void; + export function clearChildNodes(elem: HTMLElement): void; + export function hideElement(elem: HTMLElement): void; + export function showElement(elem: HTMLElement): void; + export function insertBefore(elem: HTMLElement, targetElement: HTMLElement): void; + export function insertAfter(elem: HTMLElement, targetElement: HTMLElement): void; + export function removeNode(elem: HTMLElement): void; + export function calculateOffsetLeft(elem: HTMLElement): number; + export function calculateOffsetTop(elem: HTMLElement): number; + export function createHtmlInputText(text: string): HTMLInputElement; + export function createHtmlInputCheck(isChecked: boolean): HTMLInputElement; + export function setInnerText(elem: HTMLElement, value: string): void; + export function getInnerText(elem: HTMLElement): string; + export function isTextNode(elem: HTMLElement): boolean; + export function isSvgNode(elem: HTMLElement): boolean; + export function isNodeOfType(elem: HTMLElement, tagNames: string[]): boolean; + export function focusValidOnThisNode(elem: HTMLElement): boolean; + } } } +declare module SPNotifications { + + export enum ContainerID { + Basic, + Status, + } + export enum EventID { + OnShow, + OnHide, + OnDisplayNotification, + OnRemoveNotification, + OnNotificationCountChanged, + } +} + +declare class SPStatusNotificationData { + constructor(text: string, subText: string, imageUrl: string, sip: string); +} + declare module SP { export module UI { export module Controls { @@ -7804,8 +8173,20 @@ declare module SP { /** Same as get_url() */ toString(): string; } - } + export class LocUtility { + static getLocalizedCountValue(locText:string, intervals:string, count:number):string; + } + + export class VersionUtility { + static get_layoutsLatestVersionRelativeUrl():string; + static get_layoutsLatestVersionUrl(): string; + static getLayoutsPageUrl(pageName:string): string; + static getImageUrl(imageName:string): string; + } + + } + export module DateTimeUtil { export class SimpleDate { construction(year: number, month: number, day: number, era: number); @@ -8684,12 +9065,338 @@ declare module SP { } } } -declare class SPClientAutoFill { - static MenuOptionType: { + +declare module SP { + export module CompliancePolicy { + export enum SPContainerType { + site,//: 0, + web,//: 1, + list//: 2 + } + + export class SPContainerId extends ClientObject { + constructor(context: ClientRuntimeContext, objectPath: ObjectPath); + static createFromList(context: ClientRuntimeContext, list: List): SPContainerId; + static createFromWeb(context: ClientRuntimeContext, web: Web): SPContainerId; + static createFromSite(context: ClientRuntimeContext, site: Site): SPContainerId; + static create(context: ClientRuntimeContext, containerId): SPContainerId; + + get_containerType(): ContentType; + set_containerType(value: ContentType): ContentType; + + get_listId(): SP.Guid; + set_listId(value: SP.Guid): SP.Guid; + + get_siteId(): SP.Guid; + set_siteId(value: SP.Guid): SP.Guid; + + get_siteUrl(): string; + set_siteUrl(value: string): string; + + get_tenantId(): SP.Guid; + set_tenantId(value: SP.Guid): SP.Guid; + + get_title(): string; + set_title(value: string): string; + + get_version(): any; + set_version(value: any): any; + + get_webId(): SP.Guid; + set_webId(value: SP.Guid): SP.Guid; + + serialize(): SP.StringResult; + } + + export class SPPolicyAssociation extends ClientObject { + constructor(context: ClientRuntimeContext, objectPath: ObjectPath); + + get_allowOverride(): boolean; + set_allowOverride(value: boolean): boolean; + + get_comment(): string; + set_comment(value: string): string; + + get_defaultPolicyDefinitionConfigId(): any[]; + set_defaultPolicyDefinitionConfigId(value: any[]): any[]; + + get_description(): string; + set_description(value: string): string; + + get_identity(): boolean; + set_identity(value: boolean): boolean; + + get_name(): string; + set_name(value: string): string; + + get_policyApplyStatus(): any; + set_policyApplyStatus(value: any): any; + + get_policyDefinitionConfigIds(): any[]; + set_policyDefinitionConfigIds(value: any[]): any[]; + + get_scope(): any; + set_scope(value: any): any; + + get_source(): any; + set_source(value: any): any; + + get_version(): any; + set_version(value: any): any; + + get_whenAppliedUTC(): Date; + set_whenAppliedUTC(value: Date): Date; + + get_whenChangedUTC(): Date; + set_whenChangedUTC(value: Date): Date; + + get_whenCreatedUTC(): Date; + set_whenCreatedUTC(value: Date): Date; + } + + export class SPPolicyBinding extends ClientObject { + constructor(context: ClientRuntimeContext, objectPath: ObjectPath); + + get_identity(): any; + set_identity(value: any): any; + + get_isExempt(): boolean; + set_isExempt(value: boolean): boolean; + + get_mode(): any; + set_mode(value: any): any; + + get_name(): string; + set_name(value: string): string; + + get_policyApplyStatus(): any; + set_policyApplyStatus(value: any): any; + + get_policyAssociationConfigId(): any; + set_policyAssociationConfigId(value: any): any; + + get_policyDefinitionConfigId(): any; + set_policyDefinitionConfigId(value: any): any; + + get_policyRuleConfigId(): any; + set_policyRuleConfigId(value: any): any; + + get_scope(): any; + set_scope(value: any): any; + + get_source(): any; + set_source(value: any): any; + + get_version(): any; + set_version(value: any): any; + + get_whenAppliedUTC(): Date; + set_whenAppliedUTC(value: Date): Date; + + get_whenChangedUTC(): Date; + set_whenChangedUTC(value: Date): Date; + + get_whenCreatedUTC(): Date; + set_whenCreatedUTC(value: Date): Date; + } + + export class SPPolicyDefinition extends ClientObject { + constructor(context: ClientRuntimeContext, objectPath: ObjectPath); + + get_comment(): string; + set_comment(value: string): string; + + get_createdBy(): any; + set_createdBy(value: any): any; + + get_defaultPolicyRuleConfigId + set_defaultPolicyRuleConfigId + + get_description(): string; + set_description(value: string): string; + + get_enabled(): boolean; + set_enabled(value: boolean): boolean; + + get_identity(): any; + set_identity(value: any): any; + + get_lastModifiedBy(): any; + set_lastModifiedBy(value: any): any; + + get_name(): string; + set_name(value: string): string; + + get_mode(): any; + set_mode(value: any): any; + + get_scenario(): any; + set_scenario(value: any): any; + + get_source(): any; + set_source(value: any): any; + + get_version(): any; + set_version(value: any): any; + + get_whenChangedUTC(): Date; + set_whenChangedUTC(value: Date): Date; + + get_whenCreatedUTC(): Date; + set_whenCreatedUTC(value: Date): Date; + + + } + + export class SPPolicyRule extends ClientObject { + constructor(context: ClientRuntimeContext, objectPath: ObjectPath); + + get_comment(): string; + set_comment(value: string): string; + + get_createdBy(): any; + set_createdBy(value: any): any; + + get_description(): string; + set_description(value: string): string; + + get_enabled(): boolean; + set_enabled(value: boolean): boolean; + get_identity(): any; + set_identity(value: any): any; + + get_lastModifiedBy(): any; + set_lastModifiedBy(value: any): any; + + get_mode(): any; + set_mode(value: any): any; + + get_name(): string; + set_name(value: string): string; + + get_policyDefinitionConfigId(): any; + set_policyDefinitionConfigId(value: any): any; + + get_priority(): any; + set_priority(value: any): any; + + get_ruleBlob(): any; + set_ruleBlob(value: any): any; + + get_whenChangedUTC(): Date; + set_whenChangedUTC(value: Date): Date; + + get_whenCreatedUTC(): Date; + set_whenCreatedUTC(value: Date): Date; + } + + export class SPPolicyStore extends ClientObject { + constructor(context: ClientRuntimeContext, web: Web); + + static createPolicyDefinition(context: ClientRuntimeContext): SPPolicyDefinition; + static createPolicyBinding(context: ClientRuntimeContext):SPPolicyBinding; + static createPolicyAssociation(context: ClientRuntimeContext):SPPolicyAssociation; + static createPolicyRule(context: ClientRuntimeContext): SPPolicyRule; + + + updatePolicyRule(policyRule:SPPolicyRule):void; + + getPolicyRule(policyRuleId:any, throwIfNull:boolean):SPPolicyRule; + + deletePolicyRule(policyRuleId: any);void; + + notifyUnifiedPolicySync(notificationId, syncSvcUrl:string, changeInfos, syncNow:boolean, fullSyncForTenant):void; + + updatePolicyDefinition(policyDefinition:SPPolicyDefinition):void; + + getPolicyDefinition(policyDefinitionId):SPPolicyDefinition; + + deletePolicyDefinition(policyDefinitionId):void; + + getPolicyDefinitions(scenario): ClientObjectList; + + updatePolicyBinding(policyBinding:SPPolicyBinding):void; + + getPolicyBinding(policyBindingId): SPPolicyBinding; + + deletePolicyBinding(policyBindingId): void; + + updatePolicyAssociation(policyAssociation: SPPolicyAssociation): void; + + getPolicyAssociation(policyAssociationId): SPPolicyAssociation; + + getPolicyAssociationForContainer(containerId: SPContainerId): SPPolicyAssociation; + + deletePolicyAssociation(policyAssociationId): void; + } + + export class SPPolicyStoreProxy extends ClientObject { + constructor(context: ClientRuntimeContext, web: Web); + + get_policyStoreUrl(): string; + } + + } + + export module Discovery { + + export enum ExportStatus { + notStarted,//: 0, + started,//: 1, + complete,//: 2, + failed//: 3 + } + + export class Case extends ClientObject { + constructor(context: ClientRuntimeContext, web: Web); + getExportContent(sourceIds: number[]): SP.StringResult; + } + export class Export extends ClientObject { + constructor(context: ClientRuntimeContext, item: ListItem); + get_status(): ExportStatus; + set_status(value: ExportStatus): ExportStatus; + update(): void; + getExportContent(): SP.StringResult; + } + } + + export module InformationPolicy { + export class ProjectPolicy extends SP.ClientObject { + constructor(context: ClientRuntimeContext, objectPath: ObjectPath); + get_description(): string; + + get_emailBody(): string; + set_emailBody(value: string): string; + + get_emailBodyWithTeamMailbox(): string; + set_emailBodyWithTeamMailbox(value: string): string; + + get_emailSubject(): string; + set_emailSubject(value: string): string; + + get_name(): string; + savePolicy(): void; + + + static getProjectPolicies(context: ClientRuntimeContext, web: Web): ClientObjectList; + static getCurrentlyAppliedProject(context: ClientRuntimeContext, web: Web): ProjectPolicy; + static applyProjectPolicy(context: ClientRuntimeContext, web: Web, projectPolicy: ProjectPolicy): void; + static openProject(context: ClientRuntimeContext, web: Web): void; + static closeProject(context: ClientRuntimeContext, web: Web): void; + static postponeProject(context: ClientRuntimeContext, web: Web): void; + static doesProjectHavePolicy(context: ClientRuntimeContext, web: Web): SP.BooleanResult; + static isProjectClosed(context: ClientRuntimeContext, web: Web): SP.BooleanResult; + static getProjectCloseDate(context: ClientRuntimeContext, web: Web): SP.DateTimeResult; + static getProjectExpirationDate(context: ClientRuntimeContext, web: Web): SP.DateTimeResult; + } + } +} +declare class SPClientAutoFill{ + static MenuOptionType : { Option: number; Footer: number; Separator: number; - Loading: number; + Loading:number; } static KeyProperty: string; //= 'AutoFillKey'; @@ -8702,7 +9409,7 @@ declare class SPClientAutoFill { static GetAutoFillObjFromContainer(elmChild: HTMLElement): SPClientAutoFill; static GetAutoFillMenuItemFromOption(elmChild: HTMLElement): HTMLElement; - constructor(elmTextId: string, elmContainerId: string, fnPopulateAutoFill: (targetElement: HTMLInputElement) => void); + constructor(elmTextId: string, elmContainerId: string, fnPopulateAutoFill: (targetElement: HTMLInputElement) => void ); public TextElementId: string; public AutoFillContainerId: string; public AutoFillMenuId: string; @@ -8713,16 +9420,16 @@ declare class SPClientAutoFill { public AutoFillCallbackTimeoutID: string; public FuncOnAutoFillClose: (elmTextId: string, ojData: ISPClientAutoFillData) => void; public FuncPopulateAutoFill: (targetElement: HTMLElement) => void; - public AllOptionData: { [key: string]: ISPClientAutoFillData }; + public AllOptionData: { [key:string]: ISPClientAutoFillData }; - PopulateAutoFill(jsonObjSuggestions: ISPClientAutoFillData[], fnOnAutoFillCloseFuncName: (elmTextId: string, objData: ISPClientAutoFillData) => void): void; + PopulateAutoFill(jsonObjSuggestions: ISPClientAutoFillData[], fnOnAutoFillCloseFuncName: (elmTextId: string, objData:ISPClientAutoFillData) => void ): void; IsAutoFillOpen(): boolean; SetAutoFillHeight(): void; - SelectAutoFillOption(elemOption: HTMLElement): void; - FocusAutoFill(): void; + SelectAutoFillOption(elemOption:HTMLElement): void; + FocusAutoFill() :void; BlurAutoFill(): void; CloseAutoFill(ojData: ISPClientAutoFillData): void; - UpdateAutoFillMenuFocus(bMoveNextLink: boolean): void; + UpdateAutoFillMenuFocus(bMoveNextLink:boolean): void; UpdateAutoFillPosition(): void; } @@ -8894,4 +9601,160 @@ declare module Microsoft { } } } +/** Available only in SharePoint Online*/ +declare module Define { + export function loadScript(url: string, successCallback: () => void, errCallback: () => void); + /** Loads script from _layouts/15/[req].js */ + export function require(req: string, callback: Function): void; + /** Loads script from _layouts/15/[req].js */ + export function require(req: string[], callback: Function): void; + export function define(name: string, deps: string[], def: Function): void; +} + +/** Available only in SharePoint Online*/ +declare module Verify { + export function ArgumentType(arg: string, expected: any); +} + + +/** Available only in SharePoint Online*/ +declare module BrowserStorage { + export var local: CachedStorage; + export var session: CachedStorage; + + /** Available only in SharePoint Online*/ + interface CachedStorage { + getItem(key: string): string; + setItem(key: string, value: string); + removeItem(key: string): void; + clead(): void; + length: number; + } +} + +/** Available only in SharePoint Online*/ +declare module BrowserDetection { + export var browseris: Browseris; +} + +/** Available only in SharePoint Online*/ +declare module CSSUtil { + export function HasClass(elem: HTMLElement, className: string): boolean; + export function AddClass(elem: HTMLElement, className: string): void; + export function RemoveClass(elem: HTMLElement, className: string): void; + export function pxToFloat(pxString: string): number; + export function pxToNum(px: string): number; + export function numToPx(n: number): string; + export function getCurrentEltStyleByNames(elem: HTMLElement, styleNames: string[]): string; + export function getCurrentStyle(elem: HTMLElement, cssStyle: string): string; + export function getCurrentStyleCorrect(element: HTMLElement, camelStyleName: string, dashStyleName: string): string; + export function getOpacity(element: HTMLElement): number; + export function setOpacity(element: HTMLElement, value: number): void; +} + +/** Available only in SharePoint Online*/ +declare module DOM { + export var rightToLeft: boolean; + export function cancelDefault(evt: Event): void; + export function AbsLeft(el: HTMLElement): number; + export function AbsTop(el: HTMLElement): number; + export function CancelEvent(evt: Event): void; + export function GetElementsByName(nae: string): NodeList; + export function GetEventCoords(evt: Event): { x: number; y: number; }; + export function GetEventSrcElement(evt: Event): HTMLElement; + export function GetInnerText(el: HTMLElement): string; + export function PreventDefaultNavigation(evt: Event): void; + export function SetEvent(eventName: string, eventFunc: Function, el: HTMLElement); +} + +/** Available only in SharePoint Online*/ +declare module Encoding { + export function EncodeScriptQuote(str: string): string; + export function HtmlEncode(str: string): string; + export function HtmlDecode(str: string): string; + export function AttrQuote(str: string): string; + export function ScriptEncode(str: string): string; + export function ScriptEncodeWithQuote(str: string): string; + export function CanonicalizeUrlEncodingCase(str: string): string; +} + +/** Available only in SharePoint Online*/ +declare module IE8Support { + export function arrayIndexOf(array: T[], item: T, startIdx?: number): number; + export function attachDOMContentLoaded(handler: Function): void; + export function getComputedStyle(domObj: HTMLElement, camelStyleName: string, dashStyleName: string): string; + export function stopPropagation(evt: Event): void; +} + +/** Available only in SharePoint Online*/ +declare module StringUtil { + export function BuildParam(stPattern: string, ...params: any[]); + export function ApplyStringTemplate(str: string, ...params: any[]); +} + +/** Available only in SharePoint Online*/ +declare module TypeUtil { + export function IsArray(value: any): boolean; + export function IsNullOrUndefined(value: any): boolean; +} + +/** Available only in SharePoint Online*/ +declare module Nav { + export var ajaxNavigate: AjaxNavigate; + export function convertRegularURLtoMDSURL(webUrl: string, fullPath: string): string; + export function isMDSUrl(url: string): boolean; + export function isPageUrlValid(url: string): boolean; + export function isPortalTemplatePage(url: string): boolean; + export function getAjaxLocationWindow(): string; + export function getSource(defaultSource?: string): string; + export function getUrlKeyValue(keyName: string, bNoDecode: boolean, url: string, bCaseInsensitive: boolean): string; + export function getWindowLocationNoHash(hre: string): string; + export function goToHistoryLink(el: HTMLAnchorElement, strVersion: string): void; + export function getGoToLinkUrl(el: HTMLAnchorElement): string; + export function goToLink(el: HTMLAnchorElement): void; + export function goToLinkOrDialogNewWindow(el: HTMLAnchorElement): void; + export function goToDiscussion(url: string): void; + export function onClickHook(evt: Event, topElm: HTMLElement): void; + export function pageUrlValidation(url: string, alertString: string): string; + export function parseHash(hash: string): Object; + export function navigate(url: string): void; + export function removeMDSQueryParametersFromUrl(url: string): string; + export function urlFromHashBag(hashObject: Object): string; + export function wantsNewTab(evt: Event): boolean; +} + +/** Available only in SharePoint Online*/ +declare module URI_Encoding { + export function encodeURIComponent(str: string, bAsUrl?: boolean, bForFilterQuery?: boolean, bForCallback?: boolean): string; + export function escapeUrlForCallback(str: string): string; +} + +interface IListItem { + ID: number; + ContentTypeId: string; +} + +/** Available only in SharePoint Online*/ +declare module ListModule { + export module Util { + export function createViewEditUrl(renderCtx: SPClientTemplates.RenderContext, listItem: IListItem, useEditFormUrl?: boolean, appendSource?: boolean): string; + export function createItemPropertiesTitle(renderCtx: SPClientTemplates.RenderContext, listItem: IListItem): string; + export function clearSelectedItemsDict(context: any): void; + export function ctxInitItemState(context: any): void; + export function getAttributeFromItemTable(itemTableParam: HTMLElement, strAttributeName: string, strAttributeOldName: string): string + export function getSelectedItemsDict(context: any): any; + export function removeOnlyPagingArgs(url: string): string; + export function removePagingArgs(url: string): string; + export function showAttachmentRows(): void; + } +} + +/** Available only in SharePoint Online*/ +declare module SPThemeUtils { + export function ApplyCurrentTheme(): void; + export function WithCurrentTheme(resultCallback: Function): void; + export function UseClientSideTheming(): boolean; + export function Suspend(): void; +} + diff --git a/should/should.d.ts b/should/should.d.ts index 13eca9ccf..8b4c21fc1 100644 --- a/should/should.d.ts +++ b/should/should.d.ts @@ -1,6 +1,6 @@ // Type definitions for should.js 3.1.2 // Project: https://github.com/visionmedia/should.js -// Definitions by: Alex Varju and Maxime LUCE (1.3+) +// Definitions by: Alex Varju , Maxime LUCE // Definitions: https://github.com/borisyankov/DefinitelyTyped interface Object { diff --git a/signalr/signalr.d.ts b/signalr/signalr.d.ts index 6519f7051..2c6b0f266 100644 --- a/signalr/signalr.d.ts +++ b/signalr/signalr.d.ts @@ -1,7 +1,6 @@ // Type definitions for SignalR 1.0 // Project: http://www.asp.net/signalr -// Definitions by: Boris Yankov -// Modified by: T. Michael Keesey +// Definitions by: Boris Yankov , T. Michael Keesey // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/sinon-chai/sinon-chai.d.ts b/sinon-chai/sinon-chai.d.ts index fefeb1af6..f8166d4d6 100644 --- a/sinon-chai/sinon-chai.d.ts +++ b/sinon-chai/sinon-chai.d.ts @@ -1,7 +1,7 @@ // Type definitions for sinon-chai 2.4.0 // Project: https://github.com/domenic/sinon-chai // Definitions by: Kazi Manzur Rashid -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped /// diff --git a/sinon/sinon.d.ts b/sinon/sinon.d.ts index eb62a286e..f8bed61b0 100644 --- a/sinon/sinon.d.ts +++ b/sinon/sinon.d.ts @@ -1,7 +1,7 @@ // Type definitions for Sinon 1.8.1 // Project: http://sinonjs.org/ // Definitions by: William Sears -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped interface SinonSpyCallApi { // Properties diff --git a/slickgrid/SlickGrid.d.ts b/slickgrid/SlickGrid.d.ts index b7810f467..9e66b9647 100644 --- a/slickgrid/SlickGrid.d.ts +++ b/slickgrid/SlickGrid.d.ts @@ -689,8 +689,8 @@ declare module Slick { topPanelHeight?: number; } - export interface DataProvider { - getItem(index: number): SlickData; + export interface DataProvider { + getItem(index: number): T; getLength(): number; } @@ -705,7 +705,7 @@ declare module Slick { * The grid also provides two helper methods to simplify development - getSelectedRows() and setSelectedRows(rowsArray), as well as an onSelectedRowsChanged event. * SlickGrid includes two pre-made selection models - Slick.CellSelectionModel and Slick.RowSelectionModel, but you can easily write a custom one. **/ - export class SelectionModel { + export class SelectionModel { /** * An initializer function that will be called with an instance of the grid whenever a selection model is registered with setSelectionModel. The selection model can use this to initialize its state and subscribe to grid events. **/ @@ -740,12 +740,12 @@ declare module Slick { options: GridOptions); constructor( container: string, - data: DataProvider, + data: DataProvider, columns: Column[], options: GridOptions); constructor( container: HTMLElement, - data: DataProvider, + data: DataProvider, columns: Column[], options: GridOptions); @@ -779,11 +779,18 @@ declare module Slick { /** * Sets a new source for databinding and removes all rendered rows. Note that this doesn't render the new rows - you can follow it with a call to render() to do that. - * @param newData New databinding source. This can either be a regular JavaScript array or a custom object exposing getItem(index) and getLength() functions. + * @param newData New databinding source using a regular JavaScript array.. * @param scrollToTop If true, the grid will reset the vertical scroll position to the top of the grid. **/ public setData(newData: T[], scrollToTop: boolean): void; + /** + * Sets a new source for databinding and removes all rendered rows. Note that this doesn't render the new rows - you can follow it with a call to render() to do that. + * @param newData New databinding source using a custom object exposing getItem(index) and getLength() functions. + * @param scrollToTop If true, the grid will reset the vertical scroll position to the top of the grid. + **/ + public setData(newData: DataProvider, scrollToTop: boolean): void; + /** * Returns the size of the databinding source. * @return @@ -1478,7 +1485,7 @@ declare module Slick { * Item -> Data by index * Row -> Data by row **/ - export class DataView implements DataProvider { + export class DataView implements DataProvider { constructor(options?: DataViewOptions); @@ -1548,7 +1555,7 @@ declare module Slick { public syncGridCellCssStyles(grid: Grid, key: string): void; public getLength(): number; - public getItem(index: number): SlickData; + public getItem(index: number): T; public getItemMetadata(): void; public onRowCountChanged: Slick.Event; diff --git a/smoothie/smoothie.d.ts b/smoothie/smoothie.d.ts index aae781d51..18f0cc0a5 100644 --- a/smoothie/smoothie.d.ts +++ b/smoothie/smoothie.d.ts @@ -1,7 +1,6 @@ // Type definitions for Smoothie Charts 1.21 // Project: https://github.com/joewalnes/smoothie -// Definitions by: Drew Noakes -// Mike H. Hawley +// Definitions by: Drew Noakes , Mike H. Hawley // Definitions: https://github.com/borisyankov/DefinitelyTyped/smoothie // NOTE this reference is here to make the DefinitelyTyped `npm test` suite pass and diff --git a/sockjs/sockjs.d.ts b/sockjs/sockjs.d.ts index 7a4316ad6..3f823a5ee 100644 --- a/sockjs/sockjs.d.ts +++ b/sockjs/sockjs.d.ts @@ -1,7 +1,7 @@ // Type definitions for SockJS 0.3.x // Project: https://github.com/sockjs/sockjs-client // Definitions by: Emil Ivanov -// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped interface SockJSSimpleEvent { type: string; @@ -36,10 +36,17 @@ interface SockJS extends EventTarget { declare var SockJS: { prototype: SockJS; - new (url: string, options?: { - debug: boolean; - devel: boolean; - protocols_whitelist: string[]; - }): SockJS; - -} \ No newline at end of file + new (url: string, _reserved: any, options?: { + debug?: boolean; + devel?: boolean; + protocols_whitelist?: string[]; + server?: string; + rtt?: number; + rto?: number; + info?: { + websocket?: boolean; + cookie_needed?: boolean; + null_origin?: boolean; + }; + }): SockJS; +}; \ No newline at end of file diff --git a/spin/spin.d.ts b/spin/spin.d.ts index c7ceac2b6..02a0e7cd2 100644 --- a/spin/spin.d.ts +++ b/spin/spin.d.ts @@ -1,6 +1,6 @@ // Type definitions for Spin.js 1.3.1 // Project: http://fgnass.github.com/spin.js/ -// Definitions by: Boris Yankov and Theodore Brown +// Definitions by: Boris Yankov , Theodore Brown // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/state-machine/state-machine.d.ts b/state-machine/state-machine.d.ts index c5c9c83bf..67f7012b1 100644 --- a/state-machine/state-machine.d.ts +++ b/state-machine/state-machine.d.ts @@ -1,8 +1,6 @@ // Type definitions for Finite State Machine 2.2 // Project: https://github.com/jakesgordon/javascript-state-machine -// Definitions by: Boris Yankov -// Definitions by: Maarten Docter (2013/01/22) -// Definitions by: William Sears (2013/01/25) +// Definitions by: Boris Yankov , Maarten Docter , William Sears // Definitions: https://github.com/borisyankov/DefinitelyTyped interface StateMachineErrorCallback { diff --git a/stream-to-array/stream-to-array.d.ts b/stream-to-array/stream-to-array.d.ts index 4fd48acdf..45239bbb1 100644 --- a/stream-to-array/stream-to-array.d.ts +++ b/stream-to-array/stream-to-array.d.ts @@ -1,3 +1,9 @@ +// Type definitions for stream-to-array +// Project: https://github.com/stream-utils/stream-to-array +// Definitions by: Bart van der Schoor +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + /// declare module 'stream-to-array' { diff --git a/svgjs.draggable/svgjs.draggable.d.ts b/svgjs.draggable/svgjs.draggable.d.ts index 76837f58e..8a64868c5 100644 --- a/svgjs.draggable/svgjs.draggable.d.ts +++ b/svgjs.draggable/svgjs.draggable.d.ts @@ -1,3 +1,9 @@ +// Type definitions for svgjs.draggable +// Project: http://www.svgjs.com/ +// Definitions by: Luigi Trabacchin +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + declare module svgjs { export module draggable { export interface DragDelta { diff --git a/test-module/test-addon.ts b/test-module/test-addon.ts deleted file mode 100644 index 14c5ba0d6..000000000 --- a/test-module/test-addon.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// - -declare module 'test-addon' { - export function addon(): Such; -} diff --git a/test-module/test-module.d.ts b/test-module/test-module.d.ts deleted file mode 100644 index 294e7ea43..000000000 --- a/test-module/test-module.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -interface Such { - amaze(): void; - much(): void; -} -declare module 'test-module' { - export function wow(): Such; -} diff --git a/threejs/three.d.ts b/threejs/three.d.ts index 906774181..748900166 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1,4 +1,4 @@ -// Type definitions for three.js -- r67 +// Type definitions for three.js r67 // Project: http://mrdoob.github.com/three.js/ // Definitions by: Kon , Satoru Kimura // Definitions: https://github.com/borisyankov/DefinitelyTyped diff --git a/timelinejs/timelinejs-tests.ts b/timelinejs/timelinejs-tests.ts new file mode 100644 index 000000000..da6aef966 --- /dev/null +++ b/timelinejs/timelinejs-tests.ts @@ -0,0 +1,41 @@ +/** + * Created by Roland on 6/15/2014. + */ +/// + +var timelineSource:knightlab.ITimelineModel = { + timeline: { + headline: 'Test Headline', + type: 'default', + text: 'Test Text', + asset: { + media: 'http://www.vertex42.com/ExcelArticles/Images/timeline/Timeline-for-Benjamin-Franklin.gif', + credit: 'http://www.vertex42.com', + caption: 'Test Caption' + }, + date: [ + { + startDate: '2011,12,09', + endDate: '2011,12,10', + headline: 'Test Date Headline', + text: 'Test test test test' + }, + { + startDate: '2012,12,09', + endDate: '2012,12,10', + headline: 'Test Date Headline 2', + text: 'Test2 test2 test2 test2' + } + ] + } +}; + +var source:knightlab.ITimeLineConfiguration = { + width: '100%', + height: '100%', + type: 'timeline', + embed_id: 'test', + source: timelineSource +}; + +createStoryJS(source); \ No newline at end of file diff --git a/timelinejs/timelinejs.d.ts b/timelinejs/timelinejs.d.ts new file mode 100644 index 000000000..6101b93aa --- /dev/null +++ b/timelinejs/timelinejs.d.ts @@ -0,0 +1,136 @@ +// Type definitions for timelinejs +// Project: https://github.com/NUKnightLab/TimelineJS +// Definitions by: Roland Zwaga +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare function createStoryJS(config:knightlab.ITimeLineConfiguration):void; + +declare module knightlab { + + export interface ITimeLineConfiguration { + width: string; + height: string; + /* + * path to json/ or link to googlespreadsheet + * source Should be either the path to the JSON resource to load, or a JavaScript object corresponding to the + * Timeline model. + * + * Here is an example using a data object: + * + * var dataObject = {timeline: {headline: "Headline", type: ... }} + * createStoryJS({ + * type: 'timeline', + * width: '800', + * height: '600', + * source: dataObject, + * embed_id: 'my-timeline' + * }); + * If source is a string, we will try to automatically recognize resources that are Twitter searches, Google + * Spreadsheets or Storify stories. Failing that, we assume the source is either JSON or JSONP. If string + * matches on .jsonp, we will treat it as JSONP, otherwise, we will append ?callback=onJSONP_Data. + */ + source: any; + type?: string; + /* + * Optional use a different div id for embed + */ + embed_id?: string; + /* + * Optional start at latest date + */ + start_at_end?: boolean; + /* + * Optional start at specific slide + */ + start_at_slide?: string; + /* + * Optional tweak the default zoom level + */ + start_zoom_adjust?: string; + /* + * Optional location bar hashes + */ + hash_bookmark?: boolean; + /* + * Optional font + */ + font?: string; + /* + * Optional debug to console + */ + debug?: boolean; + /* + * Optional language + */ + lang?: string; + /* + * Optional path to css + */ + css?: string; + /* + * Optional path to js + */ + js?: string; + /* + * required in order to use maptype + */ + gmap_key?: string; + /* + * Stamen Maps: + * toner + * toner-lines + * toner-labels + * watercolor + * sterrain + * + * Google Maps: + * ROADMAP + * TERRAIN + * HYBRID + * SATELLITE + * + * OpenStreetMap: + * osm + */ + maptype?: string; + } + + export interface ITimelineModel { + timeline:ITimeLine; + } + + export interface ITimeLine { + headline?:string; + type?:string; + text?:string; + asset?:ITimeLineAsset; + date?:ITimelineDate[]; + era?:ITimelineEra[]; + } + + export interface ITimeLineAsset { + media:string; + thumbnail?:string; + credit:string; + caption:string; + } + + export interface ITimelineDate extends ITimelineEra { + classname?:string; + asset?:ITimeLineAsset; + } + + export interface ITimelineEra { + /* + * format example: 2011,12,10 + */ + startDate:string; + /* + * format example: 2011,12,10 + */ + endDate:string; + headline:string; + text:string; + tag?:string; + } +} \ No newline at end of file diff --git a/underscore/underscore.d.ts b/underscore/underscore.d.ts index 5fa693b00..c9c699326 100644 --- a/underscore/underscore.d.ts +++ b/underscore/underscore.d.ts @@ -1,7 +1,6 @@ // Type definitions for Underscore 1.6.0 // Project: http://underscorejs.org/ -// Definitions by: Boris Yankov -// Definitions by: Josh Baldwin +// Definitions by: Boris Yankov , Josh Baldwin // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module _ { diff --git a/velocity-animate/velocity-animate-tests.ts b/velocity-animate/velocity-animate-tests.ts new file mode 100644 index 000000000..96400d365 --- /dev/null +++ b/velocity-animate/velocity-animate-tests.ts @@ -0,0 +1,295 @@ +/// + +function basics_arguments() { + var $el: JQuery; + $el.velocity({ + top: 10, + left: 10 + }, { + /* Velocity's default options: */ + duration: 400, + easing: "swing", + queue: "", + begin: null, + progress: null, + complete: null, + loop: false, + delay: false, + display: false, + mobileHA: true + }); + + $el.velocity({ top: 50 }, 1000); + $el.velocity({ top: 50 }, 1000, "swing"); + $el.velocity({ top: 50 }, "swing"); + $el.velocity({ top: 50 }, 1000, function() { alert("Hi"); }); + + $el.velocity({ + properties: { opacity: 1 }, + options: { duration: 500 } + }); +} + +function basics_values() { + var $el: JQuery; + $el.velocity({ + top: 50, // Defaults to the px unit type + left: "50%", + width: "+=5rem", // Add 5rem to the current rem value + height: "*=2" // Double the current height + }); +} + +function options_duration() { + var $el: JQuery; + $el.velocity({ opacity: 1 }, { duration: 1000 }); + $el.velocity({ opacity: 1 }, { duration: "slow" }); +} + +function options_easing() { + var $el: JQuery; + /* Use one of the jQuery UI easings. */ + $el.velocity({ width: 50 }, "easeInSine"); + /* Use a custom bezier curve. */ + $el.velocity({ width: 50 }, [ 0.17, 0.67, 0.83, 0.67 ]); + /* Use spring physics. */ + $el.velocity({ width: 50 }, [ 250, 15 ]); + + $el.velocity({ + borderBottomWidth: [ "2px", "spring" ], // Uses "spring" + width: [ "100px", [ 250, 15 ] ], // Uses custom spring physics + height: "100px" // Defaults to easeInSine + }, { + easing: "easeInSine" // The call's default easing + }); +} + +function options_queue() { + var $el: JQuery; + /* Trigger the first animation: Animate width. */ + $el.velocity({ width: "500px" }, { duration: 10000 }); + /* Trigger the second animation: Animate height. */ + setTimeout(function() { + /* Will run in parallel starting at the 5000ms mark. */ + $el.velocity({ height: "500px" }, { queue: false }); + }, 5000); +} + +function options_complete() { + var $el: JQuery; + $el.velocity({ + opacity: 0 + }, { + /* Logs all the animated divs. */ + complete: function(elements) { console.log(elements); } + }); +} + +function options_begin() { + var $el: JQuery; + $el.velocity({ + opacity: 0 + }, { + /* Logs all the animated divs. */ + begin: function(elements) { console.log(elements); } + }); +} + +function options_progress() { + var $el: JQuery; + var $percentComplete: JQuery; + var $timeRemaining: JQuery; + $el.velocity({ + opacity: 0 + }, { + progress: function(elements, percentComplete, timeRemaining, timeStart) { + $percentComplete.html((percentComplete * 100) + "%"); + $timeRemaining.html(timeRemaining + "ms remaining!"); + } + }); +} + +function options_mobileHA() { + var $el: JQuery; + $el.velocity({ height: "10em" }, { mobileHA: false }); +} + +function options_loop() { + var $el: JQuery; + $el.velocity({ height: "10em" }, { loop: 2 }); +} + +function options_delay() { + var $el: JQuery; + $el.velocity({ + height: "+=10em" + }, { + loop: 4, + /* Wait 100ms before alternating. */ + delay: 100 + }); +} + +function options_display() { + var $el: JQuery; + /* Animate down to zero then set display to "none". */ + $el.velocity({ opacity: 0 }, { display: "none" }); + /* Set display to "block" then animate from opacity:0. */ + $el.velocity({ opacity: 1 }, { display: "block" }); +} + +function command_scroll() { + var $el: JQuery; + $el + .velocity("scroll", { duration: 1500, easing: "spring" }) + .velocity({ opacity: 1 }); + + /* Scroll container to the top of the targeted div. */ + $el.velocity("scroll", { container: $("#container") }); + + /* Scroll the browser to the LEFT edge of the targeted div. */ + $el.velocity("scroll", { axis: "x" }); + + /* Scroll to a position 50 pixels above the div. */ + $el + .velocity("scroll", { duration: 750, offset: -50 }) + /* Then scroll to a position 250 pixels beyond the div. */ + .velocity("scroll", { duration: 750, offset: 250 }); +} + +function command_stop() { + var $el: JQuery; + $el.velocity("stop"); +} + +function command_reverse() { + var $el: JQuery; + $el.velocity("reverse"); + $el.velocity("reverse", { duration: 2000 }); +} + +function command_fadeIn_fadeOut() { + var $el: JQuery; + $el + .velocity("fadeIn", { duration: 1500 }) + .velocity("fadeOut", { delay: 500, duration: 1500 }); +} + +function command_slideDown_slideUp() { + var $el: JQuery; + $el + .velocity("slideDown", { duration: 1500 }) + .velocity("slideUp", { delay: 500, duration: 1500 }); +} + +function feature_transforms() { + var $el: JQuery; + /* Translate to the right and rotate clockwise. */ + $el.velocity({ + translateX: "200px", + rotateZ: "45deg" + }); + + /* Translate to the right and rotate clockwise. */ + $el.velocity({ + translateZ: 0, // Force HA by animating a 3D property + translateX: "200px", + rotateZ: "45deg" + }); +} + +function feature_hooks() { + var $el: JQuery; + $el.velocity({ textShadowBlur: "10px" }); +} + +function feature_colors() { + var $el: JQuery; + $el.velocity({ + /* Animate red to 50% (0.5 * 255). */ + colorRed: "50%", + /* Concurrently animate to a richer blue. */ + colorBlue: "+=50", + /* Fade the text down to 85% opacity. */ + colorAlpha: 0.85 + }); +} + +function feature_sequences() { + var $el: JQuery; + $.Velocity.Sequences.hover = function (element: HTMLElement, options: {duration?: number}) { + var duration = options.duration || 750; + $.Velocity.animate(element, + { + translateY: "-=10px", + }, { + /* Delay is relative to user-adjustable duration. */ + delay: duration * 0.033, + duration: duration, + loop: 3, + easing: "easeInOutSine" + }); + }; + + /* Later on in your code, trigger the sequence: */ + /* Note: As normal, you may optionally pass in options. */ + $el.velocity("hover", { duration: 450 }); + + $.Velocity.Sequences.hover = function (element: HTMLElement, options: {duration?: number}) { + var duration = options.duration || 750; + /* Pre-construct animation maps before chaining. */ + var calls = [ + { + properties: { translateY: "-10px" }, + options: { + delay: duration * 0.033, + duration: duration, + loop: 3, + easing: "easeInOutSine" + } + } + ]; + /* Iteratively chain the calls. */ + $.each(calls, function(i, call) { + $.Velocity.animate( + element, + call.properties, + call.options + ); + }); + }; +} + +function advanced_value_functions() { + var $el: JQuery; + $el.velocity({ + opacity: function() { return Math.random() } + }); + $el.velocity({ + translateX: function(i: number, total: number) { + /* Generate translateX's end value. */ + return (i * 10) + "px"; + } + }); +} + +function advanced_forcefeeding() { + var $el: JQuery; + $el.velocity({ + translateX: [ 500, 0 ], + opacity: [ 0, "easeInSine", 1 ] + }); + $el + .velocity({ translateX: [ 500, 0 ] }) + .velocity({ translateX: 1000 }); +} + +function advanced_utility_function () { + var divs = document.getElementsByTagName("div"); + $.Velocity.animate(divs, { opacity: 0 }, { duration: 1500 }); + $.Velocity.animate({ + elements: divs, + properties: { opacity: 0 }, + options: { duration: 1500 } + }); +} diff --git a/velocity-animate/velocity-animate.d.ts b/velocity-animate/velocity-animate.d.ts new file mode 100644 index 000000000..00c421896 --- /dev/null +++ b/velocity-animate/velocity-animate.d.ts @@ -0,0 +1,52 @@ +// Type definitions for Velocity 0.0.22 +// Project: http://velocityjs.org/ +// Definitions by: Greg Smith +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +interface JQuery { + velocity(options: {properties: Object; options: jquery.velocity.VelocityOptions}): JQuery; + velocity(properties: Object, options: jquery.velocity.VelocityOptions): JQuery; + velocity(properties: Object, duration?: number, easing?: string, complete?: jquery.velocity.ElementCallback): JQuery; + velocity(properties: Object, duration?: number, easing?: number[], complete?: jquery.velocity.ElementCallback): JQuery; + velocity(properties: Object, duration?: number, complete?: jquery.velocity.ElementCallback): JQuery; + velocity(properties: Object, easing?: string, complete?: jquery.velocity.ElementCallback): JQuery; + velocity(properties: Object, easing?: number[], complete?: jquery.velocity.ElementCallback): JQuery; + velocity(properties: Object, complete?: jquery.velocity.ElementCallback): JQuery; +} + +interface JQueryStatic { + Velocity: jquery.velocity.VelocityStatic; +} + +declare module jquery.velocity { + interface ElementCallback { + (elements: NodeListOf): void; + } + + interface ProgressCallback { + (elements: NodeListOf, percentComplete: number, timeRemaining: number, timeStart: number): void; + } + + interface VelocityStatic { + Sequences: any; + animate(options: {elements: NodeListOf; properties: Object; options: VelocityOptions}): void; + animate(elements: NodeListOf, properties: Object, options: VelocityOptions): void; + animate(element: HTMLElement, properties: Object, options: VelocityOptions): void; + } + + interface VelocityOptions { + queue?: any; + duration?: any; + easing?: any; + begin?: ElementCallback; + complete?: ElementCallback; + progress?: ProgressCallback; + display?: any; + loop?: any; + delay?: any; + mobileHA?: boolean; + _cacheValues?: boolean; + } +} diff --git a/viewporter/viewporter.d.ts b/viewporter/viewporter.d.ts index c0f441c03..1e85cc5f6 100644 --- a/viewporter/viewporter.d.ts +++ b/viewporter/viewporter.d.ts @@ -1,6 +1,6 @@ // Type definitions for Zynga Viewporter v2.1 // Project: https://github.com/zynga/viewporter -// Definitions by: Boris Yankov https://github.com/borisyankov +// Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped interface Viewporter { @@ -15,4 +15,4 @@ interface Viewporter { refresh(): void; } -declare var viewporter: Viewporter; \ No newline at end of file +declare var viewporter: Viewporter; diff --git a/webaudioapi/waa-20120802.d.ts b/webaudioapi/waa-20120802.d.ts index 64dc65876..a2039bf61 100644 --- a/webaudioapi/waa-20120802.d.ts +++ b/webaudioapi/waa-20120802.d.ts @@ -1,6 +1,6 @@ // Type definitions for Web Audio API // Project: http://www.w3.org/TR/2012/WD-webaudio-20120802/ -// Definitions by: Baruch Berger (https://github.com/bbss) +// Definitions by: Baruch Berger // Definitions: https://github.com/borisyankov/DefinitelyTyped // Conforms to the: http://www.w3.org/TR/2012/WD-webaudio-20120802/ specification diff --git a/webaudioapi/waa-nightly.d.ts b/webaudioapi/waa-nightly.d.ts index 79566f939..0d83c2533 100644 --- a/webaudioapi/waa-nightly.d.ts +++ b/webaudioapi/waa-nightly.d.ts @@ -1,6 +1,6 @@ // Type definitions for Web Audio API (nightly) // Project: http://www.w3.org/TR/2012/WD-webaudio-20120802/ -// Definitions by: Baruch Berger (https://github.com/bbss) +// Definitions by: Baruch Berger // Definitions: https://github.com/borisyankov/DefinitelyTyped // Conforms to the: http://www.w3.org/TR/2012/WD-webaudio-20120802/ specification diff --git a/winjs/winjs.d.ts b/winjs/winjs.d.ts index 2b8e95c35..8bf65f2e7 100644 --- a/winjs/winjs.d.ts +++ b/winjs/winjs.d.ts @@ -18,8 +18,6 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ -/// - /** * Defines an Element object. **/ @@ -31,11 +29,6 @@ interface Element { * Utility class for easy access to operations on application folders **/ interface IOHelper { - /** - * Instance of the currently wrapped application folder - **/ - folder: Windows.Storage.StorageFolder; - /** * Determines whether the specified file exists in the folder. * @param filename The name of the file. @@ -1219,7 +1212,7 @@ declare module WinJS { /** * Provides a mechanism to schedule work to be done on a value that has not yet been computed. It is an abstraction for managing interactions with asynchronous APIs. For more information about asynchronous programming, see Asynchronous programming. For more information about promises in JavaScript, see Asynchronous programming in JavaScript. For more information about using promises, see the WinJS Promise sample. **/ - class Promise implements Windows.Foundation.IPromise { + class Promise { //#region Constructors /** @@ -1316,7 +1309,7 @@ declare module WinJS { * @param onProgress The function to be called if the promise reports progress. Data about the progress is passed as the single argument. Promises are not required to support progress. * @returns The promise whose value is the result of executing the onComplete function. **/ - then(onComplete?: (value: T) => Windows.Foundation.IPromise, onError?: (error: any) => Windows.Foundation.IPromise, onProgress?: (progress: any) => void): Windows.Foundation.IPromise; + then(onComplete?: (value: T) => Promise, onError?: (error: any) => Promise, onProgress?: (progress: any) => void): Promise; /** * Allows you to specify the work to be done on the fulfillment of the promised value, the error handling to be performed if the promise fails to fulfill a value, and the handling of progress notifications along the way. For more information about the differences between then and done, see the following topics: Quickstart: using promises in JavaScript How to handle errors when using promises in JavaScript Chaining promises in JavaScript. @@ -1325,7 +1318,7 @@ declare module WinJS { * @param onProgress The function to be called if the promise reports progress. Data about the progress is passed as the single argument. Promises are not required to support progress. * @returns The promise whose value is the result of executing the onComplete function. **/ - then(onComplete?: (value: T) => Windows.Foundation.IPromise, onError?: (error: any) => U, onProgress?: (progress: any) => void): Windows.Foundation.IPromise; + then(onComplete?: (value: T) => Promise, onError?: (error: any) => U, onProgress?: (progress: any) => void): Promise; /** * Allows you to specify the work to be done on the fulfillment of the promised value, the error handling to be performed if the promise fails to fulfill a value, and the handling of progress notifications along the way. For more information about the differences between then and done, see the following topics: Quickstart: using promises in JavaScript How to handle errors when using promises in JavaScript Chaining promises in JavaScript. @@ -1334,7 +1327,7 @@ declare module WinJS { * @param onProgress The function to be called if the promise reports progress. Data about the progress is passed as the single argument. Promises are not required to support progress. * @returns The promise whose value is the result of executing the onComplete function. **/ - then(onComplete?: (value: T) => U, onError?: (error: any) => Windows.Foundation.IPromise, onProgress?: (progress: any) => void): Windows.Foundation.IPromise; + then(onComplete?: (value: T) => U, onError?: (error: any) => Promise, onProgress?: (progress: any) => void): Promise; /** * Allows you to specify the work to be done on the fulfillment of the promised value, the error handling to be performed if the promise fails to fulfill a value, and the handling of progress notifications along the way. For more information about the differences between then and done, see the following topics: Quickstart: using promises in JavaScript How to handle errors when using promises in JavaScript Chaining promises in JavaScript. @@ -1343,7 +1336,7 @@ declare module WinJS { * @param onProgress The function to be called if the promise reports progress. Data about the progress is passed as the single argument. Promises are not required to support progress. * @returns The promise whose value is the result of executing the onComplete function. **/ - then(onComplete?: (value: T) => U, onError?: (error: any) => U, onProgress?: (progress: any) => void): Windows.Foundation.IPromise; + then(onComplete?: (value: T) => U, onError?: (error: any) => U, onProgress?: (progress: any) => void): Promise; /** * Performs an operation on all the input promises and returns a promise that has the shape of the input and contains the result of the operation that has been performed on each input. @@ -6379,7 +6372,7 @@ declare module WinJS.UI { * Specifies whether suggestions based on local files are automatically displayed in the search pane, and defines the criteria that Windows uses to locate and filter these suggestions. * @param settings The new settings for local content suggestions. **/ - setLocalContentSuggestionSettings(settings: Windows.ApplicationModel.Search.LocalContentSuggestionSettings): void; + setLocalContentSuggestionSettings(settings: any): void; //#endregion Methods @@ -6672,7 +6665,7 @@ declare module WinJS.UI { * @param query The IStorageQueryResultBase that the StorageDataSource obtains its items from. Instead of IStorageQueryResultBase, you can also pass one of these string values: Music, Pictures, Videos, Documents. * @param options The set of properties and values to apply to the new StorageDataSource. Properties on this object may include: mode , requestedThumbnailSize , thumbnailOptions , synchronous . **/ - constructor(query: Windows.Storage.Search.IStorageQueryResultBase, options?: any); + constructor(query: any, options?: any); //#endregion Constructors diff --git a/ws/ws.d.ts b/ws/ws.d.ts index b0b590b92..ef7acc3ba 100644 --- a/ws/ws.d.ts +++ b/ws/ws.d.ts @@ -110,7 +110,7 @@ declare module "ws" { constructor(options?: IServerOptions, callback?: Function); close(): void; - handleUpgrade(request: http.ClientRequest, socket: net.Socket, + handleUpgrade(request: http.ServerRequest, socket: net.Socket, upgradeHead: Buffer, callback: (client: WebSocket) => void): void; // Events diff --git a/x2js/xml2json.d.ts b/x2js/xml2json.d.ts index c202eface..1b55262f2 100644 --- a/x2js/xml2json.d.ts +++ b/x2js/xml2json.d.ts @@ -1,3 +1,7 @@ +// Type definitions for x2js +// Project: https://code.google.com/p/x2js/ +// Definitions by: Horiuchi_H +// Definitions: https://github.com/borisyankov/DefinitelyTyped interface IX2JS { new (config?: IX2JSOption): IX2JS; diff --git a/xml2js/xml2js-tests.ts b/xml2js/xml2js-tests.ts new file mode 100644 index 000000000..3e3fbb661 --- /dev/null +++ b/xml2js/xml2js-tests.ts @@ -0,0 +1,7 @@ +/// + +import xml2js = require('xml2js'); + +xml2js.parseString("Hello xml2js!", (err: any, result: any) => { }); + +xml2js.parseString("Hello xml2js!", {trim: true}, (err: any, result: any) => { }); diff --git a/xml2js/xml2js.d.ts b/xml2js/xml2js.d.ts new file mode 100644 index 000000000..30aa64a87 --- /dev/null +++ b/xml2js/xml2js.d.ts @@ -0,0 +1,36 @@ +// Type definitions for node-xml2js +// Project: https://github.com/Leonidas-from-XIV/node-xml2js +// Definitions by: Michel Salib +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module 'xml2js' { + + export = xml2js; + + module xml2js { + function parseString(xml:string, callback: (err: any, result:any) => void): void; + function parseString(xml:string, options: Options, callback: (err: any, result:any) => void): void; + + interface Options { + attrkey?: string; + charkey?: string; + explicitCharkey?: boolean; + trim?: boolean; + normalizeTags?: boolean; + normalize?: boolean; + explicitRoot?: boolean; + emptyTag?: any; + explicitArray?: boolean; + ignoreAttrs?: boolean; + mergeAttrs?: boolean; + validator?: Function; + xmlns?: boolean; + explicitChildren?: boolean; + charsAsChildren?: boolean; + async?: boolean; + strict?: boolean; + attrNameProcessors?: (name: string) => string; + tagNameProcessors?: (name: string) => string; + } + } +} diff --git a/youtube/youtube.d.ts b/youtube/youtube.d.ts index efb4ba344..3f21dcb86 100644 --- a/youtube/youtube.d.ts +++ b/youtube/youtube.d.ts @@ -1,7 +1,6 @@ // Type definitions for YouTube // Project: https://developers.google.com/youtube/ -// Definitions by: Daz Wilkin -// Definitions by: Ian Obermiller +// Definitions by: Daz Wilkin , Ian Obermiller // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module YT { diff --git a/yui/yui-test.d.ts b/yui/yui-test.d.ts index f72784ffa..a9df72232 100644 --- a/yui/yui-test.d.ts +++ b/yui/yui-test.d.ts @@ -1,7 +1,7 @@ // Type definitions for yui 3.14.0 // Project: https://github.com/yui/yui3/blob/release-3.14.0/src/test/js -// Definitions by: -// Gia Bảo @ Sân Đình +// Definitions by: Gia Bảo @ Sân Đình +// Definitions: https://github.com/borisyankov/DefinitelyTyped declare module YUITest { interface YUITestStatic{ diff --git a/zeroclipboard/zeroclipboard.d.ts b/zeroclipboard/zeroclipboard.d.ts index 76086f5bd..6db1ba180 100644 --- a/zeroclipboard/zeroclipboard.d.ts +++ b/zeroclipboard/zeroclipboard.d.ts @@ -1,8 +1,6 @@ // Type definitions for ZeroClipboard // Project: https://github.com/jonrohan/ZeroClipboard -// Definitions by: Eric J. Smith -// Definitions by: Blake Niemyjski -// Definitions by: György Balássy +// Definitions by: Eric J. Smith , Blake Niemyjski , György Balássy // Definitions: https://github.com/borisyankov/DefinitelyTyped declare class ZeroClipboard {