Commit Graph

11 Commits

Author SHA1 Message Date
Elmar Athmer
01912ae5e7 add support for angular.element
angular.element augments the JQuery object for the given element with
angular specific methods like e.g. access for the scope.
2013-08-30 18:11:40 +02:00
Elmar Athmer
bd8293d2a5 fix typo 2013-08-30 17:57:59 +02:00
basarat
402fd36440 angularjs: Reverting to using stronger signatures for IPromise. With tests for that. 2013-08-27 22:13:20 +10:00
basarat
f1bdd8b3df added tests for angular promise chain 2013-08-26 22:12:06 +10:00
anchann
135a8579ee Angular: typing promises, deferreds 2013-08-09 16:28:13 +09:00
Georgios Diamantopoulos
25c88427fb Added generics to IHttpPromise and some missing properties/overloads
I know you haven't used generics so far so I hope this is a welcome
change - the only nuisance is that it will "break" current compilation
but will increase type safety by far.

Also added params to ICurrentRoute and inline injection notation to
$provide.decorator as per
https://github.com/borisyankov/DefinitelyTyped/issues/799
2013-08-05 12:06:53 +03:00
James Hudon
1a32cce3e0 AngularJS: give an interface to $http callback functions
- add IHttpPromiseCallback for both `error` and `success` promise calls

use case is if we're passing around the callback, we don't want to be
repeating that entire function declaration every time, and we cannot use
`Function` as that doesn't satisfy the compiler. (see test case)
2013-07-23 23:45:49 -04:00
Basarat Syed
af07ce5360 fixing tests to work with TS0.9 2013-06-20 09:31:14 +10:00
Albert Weinert
558d616fd5 angular.d.t.s ng.IModule use of Object instead of {}, added tests 2013-04-03 16:05:10 +02:00
Anton Zolotkov
26d0c8a757 AngularJS: fixed typing of the ng.IPromise.then function
The type definition for ng.IPromise.then was, in my opinion, incorrect
semantically, and breaking on practical examples in my codebase.

An `IPromise`' `then` function takes a callback which is called with the
value of the promise once it's fulfilled. This could be a number, a
string, some object, an array of strings, anything really. Yet the
typing in angular.d.ts specified `then` as taking a `successCallback` of
type `(response: PromiseCallbackArg) => any`.

The definition of `PromiseCallbackArg` seems very permissive at first
glance, as it is defined to be an object with a bunch of fields, all
optional. Any object, a number, and a string all type check correctly
with such a type, but an array of strings, for example, does not
(`cPromise` in the provided list of test).

Furthermore, it seems to me that the `PromiseCallbackArg` definition was
added specifically to support the response type for promises returned by
the Angular `$http` service, the `ng.IHttpPromise`.

So instead of having an incorrect type on the `ng.IPromise.then` function,
I propose we return it to its generic form, and instead override the
type of the inherited `then` function in the `ng.IHttpPromise` interface.
This would also warrant renaming `PromiseCallbackArg` to
`IHttpPromiseCallbackArg`.
2013-03-20 11:48:15 +09:00
Diullei Gomes
aed0b8aecd bug fix #369 - status property on angularjs response object 2013-03-06 22:47:53 -03:00