From 267ab03a0ddc1d2cb75980e1019b6b95c808aac1 Mon Sep 17 00:00:00 2001 From: apsk Date: Wed, 5 Feb 2014 20:53:50 +0200 Subject: [PATCH 01/30] Ember: Add Application.Router, Router.map, RouterDSL methods. --- ember/ember.d.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ember/ember.d.ts b/ember/ember.d.ts index 4657ac5cb..9bde2eca6 100644 --- a/ember/ember.d.ts +++ b/ember/ember.d.ts @@ -346,6 +346,10 @@ declare module Ember { The call will be delayed until the DOM has become ready. **/ ready: Function; + /** + Application's router. + **/ + Router: Router; } /** This module implements Observer-friendly Array-like behavior. This mixin is picked up by the @@ -1569,8 +1573,13 @@ declare module Ember { static metaForProperty(key: string): {}; static isClass: boolean; static isMethod: boolean; + map(callback: Function): Router; + } + class RouterDSL { + resource(name: string, options?: {}, callback?: Function): void; + resource(name: string, callback: Function): void; + route(name: string, options?: {}): void; } - var RouterDSL: Function; var SHIM_ES5: boolean; var STRINGS: boolean; class Select extends View { @@ -2261,7 +2270,7 @@ declare module Em { class RenderBuffer extends Ember.RenderBuffer { } class Route extends Ember.Route { } class Router extends Ember.Router { } - var RouterDSL: typeof Ember.RouterDSL; + class RouterDSL extends Ember.RouterDSL { } var SHIM_ES5: typeof Ember.SHIM_ES5; var STRINGS: typeof Ember.STRINGS; class Select extends Ember.Select { } From 454666515419b8e0ddb8a0eefa4c50040ed2f904 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9nes=20Harmath?= Date: Tue, 11 Feb 2014 01:23:26 +0100 Subject: [PATCH 02/30] Preliminary version of AngularFire definition --- angularfire/angularfire.d.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 angularfire/angularfire.d.ts diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts new file mode 100644 index 000000000..9a5cefcae --- /dev/null +++ b/angularfire/angularfire.d.ts @@ -0,0 +1,29 @@ +interface AngularFireService { + (firebase: Firebase): AngularFire; +} + +interface AngularFire { + $add(value: any): void; + $remove(key?: string): void; + $save(key?: string): void; + $child(key: string): AngularFire; + $set(value: any): void; + $getIndex(): number; + $priority: number; + $on(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void; + $off(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void; + $bind($scope: ng.IScope, modelName: string): ng.IPromise; +} + +interface AngularFireAuthService { + (firebase: Firebase): AngularFireAuth; +} + +interface AngularFireAuth { + $getCurrentUser(): ng.IPromise; + $logout(): void; + $createUser(email: string, password: string, noLogin?: boolean): ng.IPromise; + $changePassword(email: string, oldPassword: string, newPassword: string): ng.IPromise; + $removeUser(email: string, password: string): ng.IPromise; + $sendPasswordResetEmail(email: string): ng.IPromise; +} From eb7e941bd8df2f8389cc7fe8f6f373bc452b0e4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9nes=20Harmath?= Date: Tue, 11 Feb 2014 01:27:23 +0100 Subject: [PATCH 03/30] Add library reference --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 251263010..317c27f0c 100755 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ List of Definitions * [Ace Cloud9 Editor](http://ace.ajax.org/) (by [Diullei Gomes](https://github.com/Diullei)) * [Add To Home Screen] (http://cubiq.org/add-to-home-screen) (by [James Wilkins] (http://www.codeplex.com/site/users/view/jamesnw)) * [AmCharts](http://www.amcharts.com/) (by [Covobonomo](https://github.com/covobonomo/)) +* [AngularFire](https://www.firebase.com/docs/angular/reference.html) (by [Dénes Harmath](https://github.com/thSoft)) * [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes)) * [AngularUI](http://angular-ui.github.io/) (by [Michel Salib](https://github.com/michelsalib)) * [Angular Protractor](https://github.com/angular/protractor) (by [Bill Armstrong](https://github.com/BillArmstrong)) From 1f12c5faaa5cf085a2b91b605d5c8e8e6b54a6e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A9nes=20Harmath?= Date: Tue, 11 Feb 2014 01:33:29 +0100 Subject: [PATCH 04/30] Provide missing method --- angularfire/angularfire.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index 9a5cefcae..3cb409fd0 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -21,6 +21,7 @@ interface AngularFireAuthService { interface AngularFireAuth { $getCurrentUser(): ng.IPromise; + $login(provider: string, options?: Object): ng.IPromise; $logout(): void; $createUser(email: string, password: string, noLogin?: boolean): ng.IPromise; $changePassword(email: string, oldPassword: string, newPassword: string): ng.IPromise; From dc8b0911bdb3aae953217b7acf2116d886bb9500 Mon Sep 17 00:00:00 2001 From: Matthew James Davis Date: Wed, 12 Feb 2014 21:08:59 +0900 Subject: [PATCH 05/30] Update to latest mapsjs definition file --- mapsjs/mapsjs.d.ts | 123 +++++++++++++++++++++++++++++++++------------ 1 file changed, 92 insertions(+), 31 deletions(-) diff --git a/mapsjs/mapsjs.d.ts b/mapsjs/mapsjs.d.ts index 29627eae9..2a8ed3f07 100644 --- a/mapsjs/mapsjs.d.ts +++ b/mapsjs/mapsjs.d.ts @@ -423,7 +423,7 @@ declare module 'mapsjs' { * @param {number} [idx] Index of the line for which to compute the distance. * @returns {number} Distance in meters of the line. */ - getActualDistance(idx: number): number; + getActualDistance(idx?: number): number; /** * Determines whether this polyline intersects a given geometry. @@ -504,7 +504,7 @@ declare module 'mapsjs' { * @param {number} [idx] Index of the ring for which to compute the area. * @returns {number} Area in square meters of the ring. */ - getActualArea(idx: number): number; + getActualArea(idx?: number): number; /** * Calculates perimeter of a ring in a polygon by index according @@ -513,7 +513,7 @@ declare module 'mapsjs' { * @param {number} [idx] Index of the ring for which to compute the perimeter. * @returns {number} Length in meters of the perimeter of the ring. */ - getActualPerimeter(idx: number): number; + getActualPerimeter(idx?: number): number; /** * Determines whether this polygon intersects a given geometry. @@ -543,7 +543,7 @@ declare module 'mapsjs' { * @class geometryStyle */ export class geometryStyle { - constructor(); + constructor(options?: styleObj); /** * Gets path outline thickness in pixels. @@ -894,8 +894,14 @@ declare module 'mapsjs' { * @class styledGeometry */ export class styledGeometry { - constructor(geom: geometry, gStyle: geometryStyle); + constructor(geom: geometry, gStyle?: geometryStyle); + /** + * Set this styledGeometry's geometry. + * @param {geometry} g A new Geometry. + */ + setGeometry(g: geometry): void; + /** * Set this styledGeometry's geometryStyle. * @param {geometryStyle} gs A new styledGeometry. @@ -907,6 +913,12 @@ declare module 'mapsjs' { * @returns {geometry} The underlying geometry. */ getGeometry(): geometry; + + /** + * Gets the styledGeometry's underlying geometryStyle object. + * @returns {geometryStyle} The underlying geometry style. + */ + getGeometryStyle(): geometryStyle; /** * Gets path outline thickness in pixels. @@ -928,7 +940,7 @@ declare module 'mapsjs' { /** * Gets path outline opacity in decimal format. - * @returns {number} Outline opacity. + * @param {number} Outline opacity. */ setOutlineColor(c: string): void; @@ -1317,6 +1329,11 @@ declare module 'mapsjs' { ulX: number; ulY: number; }; + + /** + * Unbind all associations with this tile layer to facilitate garbage collection + */ + dispose(): void; } /** @@ -2216,8 +2233,53 @@ declare module 'mapsjs' { * @returns {number} maxY coord as integer */ maxY: number; - } - + } + + interface extentChangeStatsObj { + + centerX: number; + centerY: number; + centerLat: number; + centerLon: number; + zoomLevel: number; + mapScale: number; + mapScaleProjected: number; + mapUnitsPerPixel: number; + extents: envelope; + } + + interface repositionStatsObj { + + centerX: number; + centerY: number; + zoomLevel: number; + mapUnitsPerPixel: number; + } + + interface beginDigitizeOptions { + key?: string; + shapeType: string; + geometryStyle?: geometryStyle; + styledGeometry?: styledGeometry; + nodeTapAndHoldAction?: (setIdx: number, idx: number) => boolean; + nodeMoveAction?: (x: number, y: number, actionType: string) => any; + shapeChangeAction?: () => void; + envelopeEndAction?: (env: envelope) => void; + circleEndAction?: (circle: geometry.polygon) => void; + suppressNodeAdd?: boolean; + leavePath?: boolean; + } + + + interface styleObj { + fillColor?: string; + fillOpacity?: number; + outlineColor?: string; + outlineOpacity?: number; + outlineThicknessPix?: number + dashArray?: string; + } + interface mapsjsWidget { /** @@ -2507,12 +2569,18 @@ declare module 'mapsjs' { * content area DOM. If an attempt to add a geometry is made with the same * key, the geometry is swapped out. You must remove using removePathGeometry * for resource cleanup. - * @param {styleGeometry} styledGeom THe styledGeometry to render. - * @param {string} key String used to tie a geometry to its SVG + * @param {styleGeometry} styledGeom The styledGeometry to render. + * @param {string} key String used to tie a geometry to its SVG + * @param {function} addAction optional function that is called when mapsjs adds an svg element to the DOM representing this styledGeometry. + * @param {function} removeAction optional function that is called when mapsjs adds an svg element to the DOM representing this styledGeometry. * rendering in the DOM. * @returns {element} The SVG element which was added to the DOM. */ - addPathGeometry(styledGeom: styledGeometry, key: string): void; + addPathGeometry( + styledGeom: styledGeometry, + key: string, + addAction?: (svg: SVGElement) => void, + removeAction?: (svg: SVGElement) => void): SVGElement; /** * Updates an existing path geometry to reflect a style change. @@ -2524,41 +2592,34 @@ declare module 'mapsjs' { /** * Removes a styledGeometry from display. * @param {string} key The key of the geometry to remove. + * @returns {element} The SVG element which was removed from the DOM. */ - removePathGeometry(key: string): void; + removePathGeometry(key?: string): SVGElement; /** * Initiates digitization on the map control. This creates a new * geometry and adds verticies to the geometry accord to mouse * click locations. * @param {object} options JavaScript object of the form { key, - * shapeType, geometryStyle, nodeTapAndHoldAction, nodeMoveAction, - * shapeChangeAction, envelopeEndAction, supressNodeAdd, leavePath } + * shapeType, geometryStyle, styledGeometry, nodeTapAndHoldAction, nodeMoveAction, + * shapeChangeAction, envelopeEndAction, circleEndAction, supressNodeAdd, leavePath } * where key is a a string associated with this geometry, shapeType - * is the type of shape this geometry is, one of 'point', 'path', or - * 'polygon', geometryStyle is a geometryStyle which should be applied - * to the digitized geometry, nodeTapAndHoldAction is a callback invoked + * is the type of shape this geometry is, one of 'polygon', 'polyline', 'multipoint', 'envelope' or 'circle', + * geometryStyle is a geometryStyle which should be applied + * to the digitized geometry, styledGeometry is an optional styledGeometry for existing paths to edit, set this to enter edit mode, + * nodeTapAndHoldAction is a callback invoked * when any point in the geometry is clicked and held and has the * signature nodeTapAndHoldAction(setIdx, idx), nodeMoveAction is a * callback invoked after any node is dragged to a new location and * has signature nodeMoveAction(x, y, actionType), shapeChangeAction * is a callback that is invoked after the geometry shape changes and, - * has signature shapeChangeAction(), envelopeEndAction is a callback + * has signature shapeChangeAction(shape), envelopeEndAction is a callback * invoked after an envelope is created and has signature envelopeEndAction(envelope), + * circleEndAction is similar to envelopeEndAction but takes a geometry.polygon representing the circle, * and leavePath is a flag that indicates whether the digitized shape * should be left on the map after digitization is complete. */ - beginDigitize(options: { - key?: string; - shapeType: string; - geometryStyle?: geometryStyle; - nodeTapAndHoldAction?: (setIdx: number, idx: number) => boolean; - nodeMoveAction?: (x: number, y: number, actionType: string) => any; - shapeChangeAction?: () => void; - envelopeEndAction?: (env: envelope) => void; - suppressNodeAdd?: boolean; - leavePath?: boolean; - }): void; + beginDigitize(options: beginDigitizeOptions): void; endDigitize(): void; /** @@ -2601,7 +2662,7 @@ declare module 'mapsjs' { * the form { centerX, centerY, centerLat, centerLon, zoomLevel, mapScale, * mapScaleProjected, mapUnitsPerPixel, extents }. */ - setExtentChangeCompleteAction(action: (vals: {}) => void): void; + setExtentChangeCompleteAction(action: (vals: extentChangeStatsObj) => void): void; /** * Set the function called when map content (map tiles and fixed elements) are @@ -2611,7 +2672,7 @@ declare module 'mapsjs' { * completes repositioning with signature action(object) where object * is of the form { centerX, centerY, zoomLevel, mapUnitsPerPixel }. */ - setContentRepositionAction(action: (vals: {}) => void): void; + setContentRepositionAction(action: (vals: repositionStatsObj) => void): void; /** * Sets function called when map is clicked or tapped. From 62f9fa8fdab21bcf8797fffb4f8bec81ba2c8ddd Mon Sep 17 00:00:00 2001 From: Michel Salib Date: Wed, 12 Feb 2014 14:49:25 +0100 Subject: [PATCH 06/30] Adding angular $animate definition --- angularjs/angular-animate.d.ts | 21 +++++++++++++++++++++ angularjs/angular-tests.ts | 2 +- angularjs/angular.d.ts | 13 +++++++++++-- 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 angularjs/angular-animate.d.ts diff --git a/angularjs/angular-animate.d.ts b/angularjs/angular-animate.d.ts new file mode 100644 index 000000000..696e6f834 --- /dev/null +++ b/angularjs/angular-animate.d.ts @@ -0,0 +1,21 @@ +// Type definitions for Angular JS 1.2+ (ngAnimate module) +// Project: http://angularjs.org +// Definitions by: Michel Salib +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + + +/////////////////////////////////////////////////////////////////////////////// +// ngAnimate module (angular-animate.js) +/////////////////////////////////////////////////////////////////////////////// +declare module ng.animate { + + /////////////////////////////////////////////////////////////////////////// + // AnimateService + // see http://docs.angularjs.org/api/ngAnimate.$animate + /////////////////////////////////////////////////////////////////////////// + interface IAnimateService extends ng.IAnimateService { + enabled(value?: boolean, element?: JQuery): boolean; + } +} diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index 18f5ccb4e..4ce311698 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -1,7 +1,7 @@ /// // issue: https://github.com/borisyankov/DefinitelyTyped/issues/369 -https://github.com/witoldsz/angular-http-auth/blob/master/src/angular-http-auth.js +// https://github.com/witoldsz/angular-http-auth/blob/master/src/angular-http-auth.js /** * @license HTTP Auth Interceptor Module for AngularJS * (c) 2012 Witold Szczerba diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index a8c1d991d..3a8bca7a0 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -799,10 +799,19 @@ declare module ng { inheritedData(key: string, value: any): JQuery; inheritedData(obj: { [key: string]: any; }): JQuery; inheritedData(key?: string): any; - - } + /////////////////////////////////////////////////////////////////////// + // AnimateService + // see http://docs.angularjs.org/api/ng.$animate + /////////////////////////////////////////////////////////////////////// + interface IAnimateService { + addClass(element: JQuery, className: string, done?: Function); + enter(element: JQuery, parent: JQuery, after: JQuery, done?: Function); + leave(element: JQuery, done?: Function); + move(element: JQuery, parent: JQuery, after: JQuery, done?: Function); + removeClass(element: JQuery, className: string, done?: Function); + } /////////////////////////////////////////////////////////////////////////// // AUTO module (angular.js) From 59263e826bfa09aa97b9cfd9624094801965cb8b Mon Sep 17 00:00:00 2001 From: Michel Salib Date: Wed, 12 Feb 2014 15:55:41 +0100 Subject: [PATCH 07/30] Add missing return types --- angularjs/angular.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 3a8bca7a0..0fee89840 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -806,11 +806,11 @@ declare module ng { // see http://docs.angularjs.org/api/ng.$animate /////////////////////////////////////////////////////////////////////// interface IAnimateService { - addClass(element: JQuery, className: string, done?: Function); - enter(element: JQuery, parent: JQuery, after: JQuery, done?: Function); - leave(element: JQuery, done?: Function); - move(element: JQuery, parent: JQuery, after: JQuery, done?: Function); - removeClass(element: JQuery, className: string, done?: Function); + addClass(element: JQuery, className: string, done?: Function): void; + enter(element: JQuery, parent: JQuery, after: JQuery, done?: Function): void; + leave(element: JQuery, done?: Function): void; + move(element: JQuery, parent: JQuery, after: JQuery, done?: Function): void; + removeClass(element: JQuery, className: string, done?: Function): void; } /////////////////////////////////////////////////////////////////////////// From 5a9a727fa1ebba95f678d6e725bb552c5b143a4d Mon Sep 17 00:00:00 2001 From: John Reilly Date: Wed, 12 Feb 2014 16:04:30 +0000 Subject: [PATCH 08/30] jQuery: removed redundant interface --- jquery/jquery.d.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index 0d26a8253..ea9d327f9 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -485,14 +485,6 @@ interface JQueryAnimationOptions { specialEasing?: Object; } -/** - * The interface used to specify easing functions. - */ -interface JQueryEasing { - linear(p: number): number; - swing(p: number): number; -} - /** * Static members of jQuery (those on $ and jQuery themselves) */ From b3fa44db17b4f7db21177df73f5ac445194d72f9 Mon Sep 17 00:00:00 2001 From: Sven Date: Wed, 12 Feb 2014 21:55:43 +0100 Subject: [PATCH 09/30] Added closeRegions to Marionette.Application --- marionette/marionette.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index dca2915c5..75bae47f2 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -288,6 +288,7 @@ declare module Marionette { addInitializer(initializer); start(options?); addRegions(regions); + closeRegions(): void; removeRegion(region: Region); getRegion(regionName: string): Region; module(moduleNames, moduleDefinition); From 6667394125c2d14fa67dc57492aaae0a6bf54db9 Mon Sep 17 00:00:00 2001 From: Sven Date: Wed, 12 Feb 2014 22:11:31 +0100 Subject: [PATCH 10/30] Improvment on AppRouter Added appRoute to Marionette.AppRouter Removed Controller type on processAppRoutes controller arg Added AppRouterOptions --- marionette/marionette.d.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index 75bae47f2..6c18b8906 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -269,11 +269,18 @@ declare module Marionette { render(): Layout; removeRegion(name: string); } + + interface AppRouterOptions extends Backbone.RouterOptions { + appRoutes: any; + controller: any; + } class AppRouter extends Backbone.Router { - constructor(options?: any); - processAppRoutes(controller: Controller, appRoutes: any); + constructor(options?: AppRouterOptions); + processAppRoutes(controller: any, appRoutes: any); + appRoute(route:string, methodName:string):void; + } class Application extends Backbone.Events { From e496efed374d76c60d5585f3e1a7d7a01396a9c4 Mon Sep 17 00:00:00 2001 From: Sven Date: Wed, 12 Feb 2014 22:22:50 +0100 Subject: [PATCH 11/30] Typed callback arg to Marionette.Callbacks.add as a Function --- marionette/marionette.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index 6c18b8906..3427d6de4 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -112,8 +112,8 @@ declare module Marionette { function unbindEntityEvents(target, entity, bindings); class Callbacks { - add(callback, contextOverride): void; - run(options, context): void; + add(callback:Function, contextOverride:any): void; + run(options:any, context:any): void; reset(): void; } From 2bd68070e93979c115f4d906838cdea8084cc7ce Mon Sep 17 00:00:00 2001 From: John Reilly Date: Thu, 13 Feb 2014 09:14:40 +0000 Subject: [PATCH 12/30] jQuery: added cr to retrigger CI build --- jquery/jquery.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index ea9d327f9..bc7886e44 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -18,6 +18,7 @@ See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ + /** * Interface for the AJAX setting that will configure the AJAX request */ From 1cbc6388ea0813c2d5e2fa8847975fbcd289ae0c Mon Sep 17 00:00:00 2001 From: scottmcarthur Date: Thu, 13 Feb 2014 09:47:35 +0000 Subject: [PATCH 13/30] Resolves KeyCode - Type reference cannot refer to a property The interface of the property `$.ui.keyCode` uses a non-standard name `keyCode` which clashes with the property name, giving error `Type reference cannot refer to a property`. Changing the interface name from `keyCode` to `KeyCode` follows the interface naming convention and resolves this issue. --- jqueryui/jqueryui.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jqueryui/jqueryui.d.ts b/jqueryui/jqueryui.d.ts index 3a1823a92..41cc3214d 100644 --- a/jqueryui/jqueryui.d.ts +++ b/jqueryui/jqueryui.d.ts @@ -714,7 +714,7 @@ declare module JQueryUI { distance?: number; } - interface keyCode { + interface KeyCode { BACKSPACE: number; COMMA: number; DELETE: number; @@ -751,7 +751,7 @@ declare module JQueryUI { buttonset: Button; datepicker: Datepicker; dialog: Dialog; - keyCode: keyCode; + keyCode: KeyCode; menu: Menu; progressbar: Progressbar; slider: Slider; From 7699097b96225ac9d607d115b113cd5119e3f567 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20B=C3=BChler?= Date: Thu, 13 Feb 2014 16:47:29 +0100 Subject: [PATCH 14/30] Added definitions for doT (https://github.com/olado/doT) --- README.md | 1 + dot/dot-tests.ts | 32 +++++++++++++++++++++++++++++++ dot/dot.d.ts | 50 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 dot/dot-tests.ts create mode 100644 dot/dot.d.ts diff --git a/README.md b/README.md index 251263010..157d9ab30 100755 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ List of Definitions * [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler) (by [Maksim Kozhukh](http://github.com/mkozhukh)) * [docCookies](https://developer.mozilla.org/en-US/docs/Web/API/document.cookie) (by [Jon Egerton](https://github.com/jonegerton)) * [domo](http://domo-js.com/) (by [Steve Fenton](https://github.com/Steve-Fenton)) +* [doT](https://github.com/olado/doT) (by [ZombieHunter](https://github.com/ZombieHunter)) * [dust](http://linkedin.github.com/dustjs) (by [Marcelo Dezem](https://github.com/mdezem)) * [EaselJS](http://www.createjs.com/#!/EaselJS) (by [Pedro Ferreira](https://bitbucket.org/drk4)) * [EasyStar](http://easystarjs.com/) (by [Magnus Gustafsson](https://github.com/Borundin)) diff --git a/dot/dot-tests.ts b/dot/dot-tests.ts new file mode 100644 index 000000000..59e6cff75 --- /dev/null +++ b/dot/dot-tests.ts @@ -0,0 +1,32 @@ +/// + +var headertmpl = "

{{=it.title}}

"; + +var pagetmpl = "

Here is the page using a header template< / h2 >\n" + + "{{#def.header}}\n" + + "{{=it.name}}"; + +var customizableheadertmpl = "{{#def.header}}" + + "\n{{#def.mycustominjectionintoheader || ''} }"; + +var pagetmplwithcustomizableheader = "

Here is the page with customized header template

\n" + + "{{##def.mycustominjectionintoheader:\n" + + "
{{=it.title}} is not {{=it.name}}
\n" + + "#}}\n" + + "{{#def.customheader}}\n" + + "{{=it.name}}"; + +var def = { + header: headertmpl, + customheader: customizableheadertmpl +}; +var data = { + title: "My title", + name: "My name" +}; + +var pagefn = doT.template(pagetmpl, undefined, def); +var content = pagefn(data); + +pagefn = doT.template(pagetmplwithcustomizableheader, undefined, def); +var contentcustom = pagefn(data); diff --git a/dot/dot.d.ts b/dot/dot.d.ts new file mode 100644 index 000000000..2ab677c26 --- /dev/null +++ b/dot/dot.d.ts @@ -0,0 +1,50 @@ +// Type definitions for doT v1.0.1 +// Project: https://github.com/olado/doT +// Definitions by: ZombieHunter +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare var doT: doT.doTStatic; + +declare module doT { + + interface doTStatic { + /** + * Version number + */ + version: string; + /** + * Default template settings + */ + templateSettings: TemplateSettings; + + /** + * Compile template + */ + template(tmpl: string, c?: TemplateSettings, def?: Object): Function; + + /** + * For express + */ + compile(tmpl: string, def?: Object): Function; + } + + interface TemplateSettings { + evaluate: RegExp; + interpolate: RegExp; + encode: RegExp; + use: RegExp; + useParams: RegExp; + define: RegExp; + defineParams: RegExp; + conditional: RegExp; + iterate: RegExp; + varname: string; + strip: boolean; + append: boolean; + selfcontained: boolean; + } +} + +interface String { + encodeHTML(): string; +} \ No newline at end of file From 72997bd71995c635447ff809f285feb26b2c5ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Farzat?= Date: Thu, 13 Feb 2014 17:43:48 -0200 Subject: [PATCH 15/30] Fixing Set interface method from 'Add' to 'add' --- d3/d3.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/d3/d3.d.ts b/d3/d3.d.ts index ec3f94147..4bce47e2b 100644 --- a/d3/d3.d.ts +++ b/d3/d3.d.ts @@ -847,7 +847,7 @@ declare module D3 { export interface Set{ has(value: any): boolean; - Add(value: any): any; + add(value: any): any; remove(value: any): boolean; values(): Array; forEach(func: (value: any) => void ): void; From 68ebedc9b7f7e8a00e147cad00a8f91518fba26d Mon Sep 17 00:00:00 2001 From: Michel Salib Date: Fri, 14 Feb 2014 15:42:11 +0100 Subject: [PATCH 16/30] Add more flexibility sugar.js calls Add some optional parameters ad return types. --- sugar/sugar.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sugar/sugar.d.ts b/sugar/sugar.d.ts index ca21b3e7c..e5f9c97d7 100644 --- a/sugar/sugar.d.ts +++ b/sugar/sugar.d.ts @@ -2133,7 +2133,7 @@ interface Array { * }, 2, true); **/ each( - fn: (element: T, index: number, array: T[]) => boolean, + fn: (element: T, index?: number, array?: T[]) => any, index?: number, loop?: boolean): T[]; @@ -3386,7 +3386,7 @@ interface ObjectStatic { * }); * **/ - watch(obj: any, prop: string, fn: (prop: string, oldVal: any, newVal: any) => any): void; + watch(obj: any, prop: string, fn: (prop?: string, oldVal?: any, newVal?: any) => any): void; } interface Object { @@ -3836,7 +3836,7 @@ interface Object { * }); * **/ - watch(prop: string, fn: (prop: string, oldVal: any, newVal: any) => any): void; + watch(prop: string, fn: (prop?: string, oldVal?: any, newVal?: any) => any): void; } interface Function { From 122ff1fb4c1551da6fd522cdaa42b9548ae29913 Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 14 Feb 2014 16:36:27 +0000 Subject: [PATCH 17/30] jQuery: trigger now JSDoc'd and typings brought in line with documentation. Also added test suite. --- jquery/jquery-tests.ts | 55 ++++++++++++++++++++++++++++++++++++++++++ jquery/jquery.d.ts | 30 +++++++++++++++++++++-- 2 files changed, 83 insertions(+), 2 deletions(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index c3fc3032f..a6249b9f3 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -754,6 +754,61 @@ function test_submit() { $("#target").submit(); } +function test_trigger() { + + $("#foo").on("click", function () { + alert($(this).text()); + }); + $("#foo").trigger("click"); + + //$("#foo").on("custom", function (event, param1, param2) { + // alert(param1 + "\n" + param2); + //}); + $("#foo").trigger("custom", ["Custom", "Event"]); + + $("button:first").click(function () { + update($("span:first")); + }); + + $("button:last").click(function () { + $("button:first").trigger("click"); + update($("span:last")); + }); + + function update(j) { + var n = parseInt(j.text(), 10); + j.text(n + 1); + } + + $("form:first").trigger("submit"); + + var event = jQuery.Event("submit"); + $("form:first").trigger(event); + if (event.isDefaultPrevented()) { + // Perform an action... + } + + $("p") + .click(function (event, a, b) { + // When a normal click fires, a and b are undefined + // for a trigger like below a refers to "foo" and b refers to "bar" + }) + .trigger("click", ["foo", "bar"]); + + var event = jQuery.Event("logged"); + (event).user = "foo"; + (event).pass = "bar"; + $("body").trigger(event); + + // Adapted from jQuery documentation which may be wrong on this occasion + var event2 = jQuery.Event("logged"); + $("body").trigger(event2, { + type: "logged", + user: "foo", + pass: "bar" + }); +} + function test_clone() { $('.hello').clone().appendTo('.goodbye'); var $elem = $('#elem').data({ "arr": [1] }), diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index bc7886e44..235022bf9 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -2531,8 +2531,34 @@ interface JQuery { */ submit(eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; - trigger(eventType: string, ...extraParameters: any[]): JQuery; - trigger(event: JQueryEventObject): JQuery; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(eventType: string, extraParameters?: any[]): JQuery; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param eventType A string containing a JavaScript event type, such as click or submit. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(eventType: string, extraParameters?: Object): JQuery; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param event A jQuery.Event object. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(event: JQueryEventObject, extraParameters?: any[]): JQuery; + /** + * Execute all handlers and behaviors attached to the matched elements for the given event type. + * + * @param event A jQuery.Event object. + * @param extraParameters Additional parameters to pass along to the event handler. + */ + trigger(event: JQueryEventObject, extraParameters?: Object): JQuery; triggerHandler(eventType: string, ...extraParameters: any[]): Object; From fede925bfecb64ed78eb77406c17a226584aa6da Mon Sep 17 00:00:00 2001 From: timbow574521 Date: Fri, 14 Feb 2014 11:43:13 -0500 Subject: [PATCH 18/30] Add getValue in DataTable in google.visualization.d.ts. --- google.visualization/google.visualization.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/google.visualization/google.visualization.d.ts b/google.visualization/google.visualization.d.ts index d478cf9aa..553c8e654 100644 --- a/google.visualization/google.visualization.d.ts +++ b/google.visualization/google.visualization.d.ts @@ -76,6 +76,7 @@ declare module google { addRows(array: any[]): number; getFilteredRows(filters: DataTableCellFilter[]): number[]; getFormattedValue(rowIndex: number, columnIndex: number): string; + getValue(rowIndex: number, columnIndex: number): any; getNumberOfColumns(): number; getNumberOfRows(): number; removeRow(rowIndex: number): void; From 4c2d50af485fbe47178284ed7291fa4c57110e3c Mon Sep 17 00:00:00 2001 From: John Reilly Date: Fri, 14 Feb 2014 16:48:11 +0000 Subject: [PATCH 19/30] jQuery: uncommented tests realised they could be used as long as param1 and param2 made optional --- jquery/jquery-tests.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index a6249b9f3..57ba838ee 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -761,9 +761,9 @@ function test_trigger() { }); $("#foo").trigger("click"); - //$("#foo").on("custom", function (event, param1, param2) { - // alert(param1 + "\n" + param2); - //}); + $("#foo").on("custom", function (event, param1?, param2?) { + alert(param1 + "\n" + param2); + }); $("#foo").trigger("custom", ["Custom", "Event"]); $("button:first").click(function () { From 18c992059db0e1bbabb2c81a407490ccd531fd0a Mon Sep 17 00:00:00 2001 From: vagrant Date: Fri, 14 Feb 2014 16:52:45 +0000 Subject: [PATCH 20/30] add missing export function basicAuth(callback: (user: string, pass: string) => boolean, realm?: string): Handler; --- express/express.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/express/express.d.ts b/express/express.d.ts index b97888998..6d87249cd 100644 --- a/express/express.d.ts +++ b/express/express.d.ts @@ -1451,6 +1451,8 @@ declare module "express" { * @param callback or username * @param realm */ + export function basicAuth(callback: (user: string, pass: string, fn : Function) => void, realm?: string): Handler; + export function basicAuth(callback: (user: string, pass: string) => boolean, realm?: string): Handler; export function basicAuth(user: string, pass: string, realm?: string): Handler; From 1195fc6b5eb88872af95850521ea54babac2407c Mon Sep 17 00:00:00 2001 From: scottmcarthur Date: Sat, 15 Feb 2014 09:06:02 +0000 Subject: [PATCH 21/30] Added $promise & $resolved properties [ngResource.$resource](http://docs.angularjs.org/api/ngResource.$resource) defines a `$promise` property and a `$resolve` property on the Resource. --- angularjs/angular-resource.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/angularjs/angular-resource.d.ts b/angularjs/angular-resource.d.ts index eebed96c3..c26bc9fe8 100644 --- a/angularjs/angular-resource.d.ts +++ b/angularjs/angular-resource.d.ts @@ -105,6 +105,10 @@ declare module ng.resource { $delete(dataOrParams: any, success: Function): T; $delete(success: Function, error?: Function): T; $delete(params: any, data: any, success?: Function, error?: Function): T; + + /** the promise of the original server interaction that created this instance. **/ + $promise : ng.IPromise; + $resolved : boolean; } /** when creating a resource factory via IModule.factory */ @@ -122,3 +126,10 @@ declare module ng { factory(name: string, resourceServiceFactoryFunction: ng.resource.IResourceServiceFactoryFunction): IModule; } } + +interface Array> +{ + /** the promise of the original server interaction that created this collection. **/ + $promise : ng.IPromise>; + $resolved : boolean; +} From 4d64913cdbf438a6ab8cdf812c4e75cfae1ccf7b Mon Sep 17 00:00:00 2001 From: Scott McArthur Date: Sat, 15 Feb 2014 20:37:05 +0000 Subject: [PATCH 22/30] angular.d.ts Annotated spelt incorrectly Fixed spelling mistake in parameter names. Changed all occurrences of `Annotaded` to `Annotated` --- angularjs/angular.d.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index a8c1d991d..a2a335d0f 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -79,7 +79,7 @@ declare module ng { /////////////////////////////////////////////////////////////////////////// interface IModule { animation(name: string, animationFactory: Function): IModule; - animation(name: string, inlineAnnotadedFunction: any[]): IModule; + animation(name: string, inlineAnnotatedFunction: any[]): IModule; animation(object: Object): IModule; /** configure existing services. Use this method to register work which needs to be performed on module loading @@ -88,29 +88,29 @@ declare module ng { /** configure existing services. Use this method to register work which needs to be performed on module loading */ - config(inlineAnnotadedFunction: any[]): IModule; + config(inlineAnnotatedFunction: any[]): IModule; constant(name: string, value: any): IModule; constant(object: Object): IModule; controller(name: string, controllerConstructor: Function): IModule; - controller(name: string, inlineAnnotadedConstructor: any[]): IModule; + controller(name: string, inlineAnnotatedConstructor: any[]): IModule; controller(object : Object): IModule; directive(name: string, directiveFactory: Function): IModule; - directive(name: string, inlineAnnotadedFunction: any[]): IModule; + directive(name: string, inlineAnnotatedFunction: any[]): IModule; directive(object: Object): IModule; factory(name: string, serviceFactoryFunction: Function): IModule; - factory(name: string, inlineAnnotadedFunction: any[]): IModule; + factory(name: string, inlineAnnotatedFunction: any[]): IModule; factory(object: Object): IModule; filter(name: string, filterFactoryFunction: Function): IModule; - filter(name: string, inlineAnnotadedFunction: any[]): IModule; + filter(name: string, inlineAnnotatedFunction: any[]): IModule; filter(object: Object): IModule; provider(name: string, serviceProviderConstructor: Function): IModule; - provider(name: string, inlineAnnotadedConstructor: any[]): IModule; + provider(name: string, inlineAnnotatedConstructor: any[]): IModule; provider(name: string, providerObject: auto.IProvider): IModule; provider(object: Object): IModule; run(initializationFunction: Function): IModule; - run(inlineAnnotadedFunction: any[]): IModule; + run(inlineAnnotatedFunction: any[]): IModule; service(name: string, serviceConstructor: Function): IModule; - service(name: string, inlineAnnotadedConstructor: any[]): IModule; + service(name: string, inlineAnnotatedConstructor: any[]): IModule; service(object: Object): IModule; value(name: string, value: any): IModule; value(object: Object): IModule; @@ -570,7 +570,7 @@ declare module ng { interface IControllerProvider extends IServiceProvider { register(name: string, controllerConstructor: Function): void; - register(name: string, dependencyAnnotadedConstructor: any[]): void; + register(name: string, dependencyAnnotatedConstructor: any[]): void; } /////////////////////////////////////////////////////////////////////////// @@ -818,11 +818,11 @@ declare module ng { /////////////////////////////////////////////////////////////////////// interface IInjectorService { annotate(fn: Function): string[]; - annotate(inlineAnnotadedFunction: any[]): string[]; + annotate(inlineAnnotatedFunction: any[]): string[]; get(name: string): any; has(name: string): boolean; instantiate(typeConstructor: Function, locals?: any): any; - invoke(inlineAnnotadedFunction: any[]): any; + invoke(inlineAnnotatedFunction: any[]): any; invoke(func: Function, context?: any, locals?: any): any; } @@ -839,7 +839,7 @@ declare module ng { decorator(name: string, decorator: Function): void; decorator(name: string, decoratorInline: any[]): void; factory(name: string, serviceFactoryFunction: Function): ng.IServiceProvider; - factory(name: string, inlineAnnotadedFunction: any[]): ng.IServiceProvider; + factory(name: string, inlineAnnotatedFunction: any[]): ng.IServiceProvider; provider(name: string, provider: ng.IServiceProvider): ng.IServiceProvider; provider(name: string, serviceProviderConstructor: Function): ng.IServiceProvider; service(name: string, constructor: Function): ng.IServiceProvider; From f300bab55704471a4eefeb2288164a9af58f7e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?De=CC=81nes=20Harmath?= Date: Sat, 15 Feb 2014 21:54:35 +0100 Subject: [PATCH 23/30] Add header & tests --- angularfire/angularfire-tests.ts | 79 ++++++++++++++++++++++++++++++++ angularfire/angularfire.d.ts | 5 ++ 2 files changed, 84 insertions(+) create mode 100644 angularfire/angularfire-tests.ts diff --git a/angularfire/angularfire-tests.ts b/angularfire/angularfire-tests.ts new file mode 100644 index 000000000..672252729 --- /dev/null +++ b/angularfire/angularfire-tests.ts @@ -0,0 +1,79 @@ +/// + +// Based on https://www.firebase.com/docs/angular/index.html + +var myapp = angular.module("myapp", ["firebase"]); + +interface AngularFireScope { + items: AngularFire; +} + +myapp.controller("MyController", ["$scope", "$firebase", + function($scope: AngularFireScope, $firebase: AngularFireService) { + $scope.items = $firebase(new Firebase(URL)); + $scope.items.$add({ foo: "bar" }); + $scope.items.$remove("foo"); // Removes child named "foo". + $scope.items.$remove(); // Removes the entire object. + $scope.items.foo = "baz"; + $scope.items.$save("foo"); // new Firebase(URL + "/foo") now contains "baz". + var child = $scope.items.$child("foo"); + child.$remove(); // Same as calling $scope.items.$remove("foo"); + $scope.items.$set({ bar: "baz" }); // new Firebase(URL + "/foo") is now null. + var keys = $scope.items.$getIndex(); + keys.forEach(function(key, i) { + console.log(i, $scope.items[key]); // prints items in order they appear in Firebase + }); + $scope.items.foo.$priority = 20; + $scope.items.$save("foo"); // new Firebase(URL + "foo")'s priority is now 20. + $scope.items.$on("loaded", function() { + console.log("Initial data received!"); + }); + $scope.items.$on("change", function() { + console.log("A remote change was applied locally!"); + }); + // Detaches all `loaded` event handlers. + $scope.items.$off('loaded'); + // Stops synchronization on `$scope.items` completely. + function stopSync() { + $scope.items.$off(); + } + $scope.items.$bind($scope, "remoteItems"); + $scope.remoteItems.bar = "foo"; // new Firebase(URL + "/bar") is now "foo". + $scope.items.$bind($scope, "remote").then(function(unbind) { + unbind(); + $scope.remote.bar = "foo"; // No changes have been made to the remote data. + }); + } +]); + +interface AngularFireAuthScope { + loginObj: AngularFireAuth; +} + +myapp.controller("MyAuthController", ["$scope", "$firebaseSimpleLogin", + function($scope: AngularFireAuthScope, $firebaseSimpleLogin) { + var dataRef = new Firebase("https://myapp.firebaseio.com"); + $scope.loginObj = $firebaseSimpleLogin(dataRef); + $scope.loginObj.$getCurrentUser().then(_ => { + }); + var email = 'my@email.com'; + var password = 'mypassword'; + $scope.loginObj.$login('password', { + email: email, + password: password + }).then(function(user) { + console.log('Logged in as: ', user.uid); + }, function(error) { + console.error('Login failed: ', error); + }); + $scope.loginObj.$logout(); + $scope.loginObj.$createUser(email, password).then(_ => { + }); + $scope.loginObj.$changePassword(email, password, password).then(_ => { + }); + $scope.loginObj.$removeUser(email, password).then(_ => { + }); + $scope.loginObj.$sendPasswordResetEmail(email).then(_ => { + }); + } +]); \ No newline at end of file diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index 3cb409fd0..25f44332c 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -1,3 +1,8 @@ +// Type definitions for AngularFire 0.6.0 +// Project: http://angularfire.com +// Definitions by: Dénes Harmath +// Definitions: https://github.com/borisyankov/DefinitelyTyped + interface AngularFireService { (firebase: Firebase): AngularFire; } From 4238c803afcb92b1a17fb3c6b9bf0de6fb7ec1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?De=CC=81nes=20Harmath?= Date: Sat, 15 Feb 2014 23:53:59 +0100 Subject: [PATCH 24/30] Fix compile errors --- angularfire/angularfire-tests.ts | 44 +++++++++++++++++--------------- angularfire/angularfire.d.ts | 12 ++++++--- firebase/firebase.d.ts | 2 +- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/angularfire/angularfire-tests.ts b/angularfire/angularfire-tests.ts index 672252729..e3a04712c 100644 --- a/angularfire/angularfire-tests.ts +++ b/angularfire/angularfire-tests.ts @@ -1,58 +1,62 @@ /// -// Based on https://www.firebase.com/docs/angular/index.html - var myapp = angular.module("myapp", ["firebase"]); -interface AngularFireScope { +interface AngularFireScope extends ng.IScope { items: AngularFire; + remoteItems: RemoteItems; } +interface RemoteItems { + bar: string; +} + +var url = "https://myapp.firebaseio.com"; + myapp.controller("MyController", ["$scope", "$firebase", function($scope: AngularFireScope, $firebase: AngularFireService) { - $scope.items = $firebase(new Firebase(URL)); + $scope.items = $firebase(new Firebase(url)); $scope.items.$add({ foo: "bar" }); - $scope.items.$remove("foo"); // Removes child named "foo". - $scope.items.$remove(); // Removes the entire object. - $scope.items.foo = "baz"; - $scope.items.$save("foo"); // new Firebase(URL + "/foo") now contains "baz". + $scope.items.$remove("foo"); + $scope.items.$remove(); + $scope.items.$save(); var child = $scope.items.$child("foo"); - child.$remove(); // Same as calling $scope.items.$remove("foo"); - $scope.items.$set({ bar: "baz" }); // new Firebase(URL + "/foo") is now null. + child.$remove(); + $scope.items.$set({ bar: "baz" }); var keys = $scope.items.$getIndex(); keys.forEach(function(key, i) { - console.log(i, $scope.items[key]); // prints items in order they appear in Firebase + console.log(i, $scope.items[key]); }); - $scope.items.foo.$priority = 20; - $scope.items.$save("foo"); // new Firebase(URL + "foo")'s priority is now 20. $scope.items.$on("loaded", function() { console.log("Initial data received!"); }); $scope.items.$on("change", function() { console.log("A remote change was applied locally!"); }); - // Detaches all `loaded` event handlers. $scope.items.$off('loaded'); - // Stops synchronization on `$scope.items` completely. function stopSync() { $scope.items.$off(); } $scope.items.$bind($scope, "remoteItems"); - $scope.remoteItems.bar = "foo"; // new Firebase(URL + "/bar") is now "foo". + $scope.remoteItems.bar = "foo"; $scope.items.$bind($scope, "remote").then(function(unbind) { unbind(); - $scope.remote.bar = "foo"; // No changes have been made to the remote data. + $scope.remoteItems.bar = "foo"; }); } ]); -interface AngularFireAuthScope { +var foo: AngularFireObject = { + $priority: 0 +}; + +interface AngularFireAuthScope extends ng.IScope { loginObj: AngularFireAuth; } myapp.controller("MyAuthController", ["$scope", "$firebaseSimpleLogin", - function($scope: AngularFireAuthScope, $firebaseSimpleLogin) { - var dataRef = new Firebase("https://myapp.firebaseio.com"); + function($scope: AngularFireAuthScope, $firebaseSimpleLogin: AngularFireAuthService) { + var dataRef = new Firebase(url); $scope.loginObj = $firebaseSimpleLogin(dataRef); $scope.loginObj.$getCurrentUser().then(_ => { }); diff --git a/angularfire/angularfire.d.ts b/angularfire/angularfire.d.ts index 25f44332c..3f2b0aa10 100644 --- a/angularfire/angularfire.d.ts +++ b/angularfire/angularfire.d.ts @@ -3,6 +3,9 @@ // Definitions by: Dénes Harmath // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// +/// + interface AngularFireService { (firebase: Firebase): AngularFire; } @@ -13,13 +16,16 @@ interface AngularFire { $save(key?: string): void; $child(key: string): AngularFire; $set(value: any): void; - $getIndex(): number; - $priority: number; + $getIndex(): string[]; $on(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void; - $off(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void; + $off(eventType?: string, callback?: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void; $bind($scope: ng.IScope, modelName: string): ng.IPromise; } +interface AngularFireObject { + $priority: number; +} + interface AngularFireAuthService { (firebase: Firebase): AngularFireAuth; } diff --git a/firebase/firebase.d.ts b/firebase/firebase.d.ts index 83f9ca84b..bac32fbc6 100644 --- a/firebase/firebase.d.ts +++ b/firebase/firebase.d.ts @@ -53,7 +53,7 @@ declare class Firebase implements IFirebaseQuery { toString(): string; set(value: any, onComplete?: (error: any) => void): void; update(value: any, onComplete?: (error: any) => void): void; - remove(onComplete?: (error: any) => void); + remove(onComplete?: (error: any) => void): void; push(value: any, onComplete?: (error: any) => void): Firebase; setWithPriority(value: any, priority: string, onComplete?: (error: any) => void): void; setWithPriority(value: any, priority: number, onComplete?: (error: any) => void): void; From 8265a175698b41774b3b467292856f5de3719e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maido=20Ka=CC=88a=CC=88ra?= Date: Sun, 16 Feb 2014 13:51:13 +0000 Subject: [PATCH 25/30] Type definitions for server side nodejs socket.io client. --- README.md | 1 + socket.io-client/socket.io-client-tests.ts | 10 +++++++ socket.io-client/socket.io-client.d.ts | 33 ++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 socket.io-client/socket.io-client-tests.ts create mode 100644 socket.io-client/socket.io-client.d.ts diff --git a/README.md b/README.md index 251263010..4ce7c2ca1 100755 --- a/README.md +++ b/README.md @@ -233,6 +233,7 @@ List of Definitions * [SlickGrid](https://github.com/mleibman/SlickGrid) (by [Josh Baldwin](https://github.com/jbaldwin)) * [smoothie](https://github.com/joewalnes/smoothie) (by [Mike H. Hawley](https://github.com/mikehhawley)) * [socket.io](http://socket.io) (by [William Orr](https://github.com/worr)) +* [socket.io-client](http://socket.io) (by [Maido Kaara](https://github.com/v3rm0n)) * [SockJS](https://github.com/sockjs/sockjs-client) (by [Emil Ivanov](https://github.com/vladev)) * [SoundJS](http://www.createjs.com/#!/SoundJS) (by [Pedro Ferreira](https://bitbucket.org/drk4)) * [Spin](http://fgnass.github.com/spin.js/) (by [Boris Yankov](https://github.com/borisyankov)) diff --git a/socket.io-client/socket.io-client-tests.ts b/socket.io-client/socket.io-client-tests.ts new file mode 100644 index 000000000..9c6018a19 --- /dev/null +++ b/socket.io-client/socket.io-client-tests.ts @@ -0,0 +1,10 @@ +import io = require('socket.io-client'); + +var socket = io('http://localhost:80'); + +socket.on('connect', function () { + console.log('Connected!'); + socket.send('some test data', function () { + console.log('Sent some data.'); + }); +}); \ No newline at end of file diff --git a/socket.io-client/socket.io-client.d.ts b/socket.io-client/socket.io-client.d.ts new file mode 100644 index 000000000..0bef47c58 --- /dev/null +++ b/socket.io-client/socket.io-client.d.ts @@ -0,0 +1,33 @@ +// Type definitions for socket.io nodejs client +// Project: http://socket.io/ +// Definitions by: Maido Kaara +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +declare module "socket.io-client" { + + export function connect(host: string, details?: any): Socket; + + interface EventEmitter { + emit(name: string, ...data: any[]): any; + on(ns: string, fn: Function): EventEmitter; + addListener(ns: string, fn: Function): EventEmitter; + removeListener(ns: string, fn: Function): EventEmitter; + removeAllListeners(ns: string): EventEmitter; + once(ns: string, fn: Function): EventEmitter; + listeners(ns: string): Function[]; + } + + interface SocketNamespace extends EventEmitter { + of(name: string): SocketNamespace; + send(data: any, fn: Function): SocketNamespace; + emit(name: string): SocketNamespace; + } + + interface Socket extends EventEmitter { + of(name: string): SocketNamespace; + connect(fn: Function): Socket; + packet(data: any): Socket; + flushBuffer(): void; + disconnect(): Socket; + } +} \ No newline at end of file From d20a2330b88f5c31f19ef0cca9e165df0702d5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maido=20Ka=CC=88a=CC=88ra?= Date: Sun, 16 Feb 2014 13:53:26 +0000 Subject: [PATCH 26/30] Added newlines to the end of the files --- socket.io-client/socket.io-client-tests.ts | 2 +- socket.io-client/socket.io-client.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/socket.io-client/socket.io-client-tests.ts b/socket.io-client/socket.io-client-tests.ts index 9c6018a19..f4171fe15 100644 --- a/socket.io-client/socket.io-client-tests.ts +++ b/socket.io-client/socket.io-client-tests.ts @@ -7,4 +7,4 @@ socket.on('connect', function () { socket.send('some test data', function () { console.log('Sent some data.'); }); -}); \ No newline at end of file +}); diff --git a/socket.io-client/socket.io-client.d.ts b/socket.io-client/socket.io-client.d.ts index 0bef47c58..e4c6e0e38 100644 --- a/socket.io-client/socket.io-client.d.ts +++ b/socket.io-client/socket.io-client.d.ts @@ -30,4 +30,4 @@ declare module "socket.io-client" { flushBuffer(): void; disconnect(): Socket; } -} \ No newline at end of file +} From 511cde8b917ed0b0b4830c773676e4a3cd0ba4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maido=20Ka=CC=88a=CC=88ra?= Date: Sun, 16 Feb 2014 15:21:15 +0000 Subject: [PATCH 27/30] Fixed test --- socket.io-client/socket.io-client-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/socket.io-client/socket.io-client-tests.ts b/socket.io-client/socket.io-client-tests.ts index f4171fe15..7b5f96747 100644 --- a/socket.io-client/socket.io-client-tests.ts +++ b/socket.io-client/socket.io-client-tests.ts @@ -1,10 +1,10 @@ import io = require('socket.io-client'); -var socket = io('http://localhost:80'); +var socket = io.connect('http://localhost:80'); socket.on('connect', function () { console.log('Connected!'); - socket.send('some test data', function () { + socket.emit('event', 'some test data', function () { console.log('Sent some data.'); }); }); From 0db96af9995078fa79915e203f1b5d1760f5b99b Mon Sep 17 00:00:00 2001 From: Zach Nation Date: Mon, 17 Feb 2014 14:07:20 -0800 Subject: [PATCH 28/30] Add module declaration to bootstrap so it can be required as an AMD module --- bootstrap/bootstrap.d.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bootstrap/bootstrap.d.ts b/bootstrap/bootstrap.d.ts index c14bf61d4..b9fe9cd59 100644 --- a/bootstrap/bootstrap.d.ts +++ b/bootstrap/bootstrap.d.ts @@ -107,3 +107,6 @@ interface JQuery { affix(options?: AffixOptions): JQuery; } + +declare module "bootstrap" { +} From e509a3dd61b188663f3d9a1e410f2eaba3e4734d Mon Sep 17 00:00:00 2001 From: Bart van der Schoor Date: Tue, 18 Feb 2014 00:09:13 +0100 Subject: [PATCH 29/30] added module declaration to underscore.string.d.ts --- underscore.string/underscore.string.d.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/underscore.string/underscore.string.d.ts b/underscore.string/underscore.string.d.ts index d016dc908..db9ec042d 100644 --- a/underscore.string/underscore.string.d.ts +++ b/underscore.string/underscore.string.d.ts @@ -562,5 +562,7 @@ interface UnderscoreStringStaticExports { toBoolean(str: string, trueValues?: any[], falseValues?: any[]): boolean; } - +declare module "underscore.string" { +export = UnderscoreStringStatic; +} // TODO interface UnderscoreString extends Underscore From acf9de177a5107c212fd610eb090a5cafa1f3a0a Mon Sep 17 00:00:00 2001 From: Johan Nilsson Date: Mon, 17 Feb 2014 21:59:39 -0400 Subject: [PATCH 30/30] StreetView : bool => StreetViewControl:bool Added StreetView: StreetViewPanorama --- googlemaps/google.maps.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/googlemaps/google.maps.d.ts b/googlemaps/google.maps.d.ts index ebe11fda9..4589e09f0 100644 --- a/googlemaps/google.maps.d.ts +++ b/googlemaps/google.maps.d.ts @@ -113,7 +113,8 @@ declare module google.maps { scaleControl?: boolean; scaleControlOptions?: ScaleControlOptions; scrollwheel?: boolean; - streetView?: boolean; + streetView?: StreetViewPanorama; + streetViewControl?: boolean; streetViewControlOptions?: StreetViewControlOptions; styles?: MapTypeStyle[]; tilt?: number;