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
2013-02-20 17:41:07 -05:00
2013-02-01 18:26:32 -02:00
2013-01-18 16:05:44 -05:00
2013-01-17 20:03:30 +02:00
2013-02-24 23:35:23 -07:00
2013-03-14 11:34:28 +02:00
2013-02-16 18:19:07 -02:00
2013-01-17 20:03:30 +02:00
2013-01-17 20:03:30 +02:00
2013-03-02 21:07:47 +01:00
2013-02-25 20:18:28 +00:00
2013-02-24 17:09:46 -05:00
2013-01-17 20:03:30 +02:00
2013-02-13 21:17:02 -02:00
2013-01-17 20:03:30 +02:00
2013-02-24 13:35:48 -03:00
2013-02-22 09:05:43 +09:00
2013-03-01 10:36:58 +01:00
2013-03-07 21:27:00 +09:00
2013-01-20 16:16:58 +01:00
2013-01-25 12:15:30 -05:00
2013-02-07 21:45:59 -06:00
2012-12-04 00:21:45 -06:00
2013-01-17 20:03:30 +02:00
2013-01-17 20:03:30 +02:00
2013-01-17 20:03:30 +02:00
2013-01-17 20:03:30 +02:00
2013-01-17 20:03:30 +02:00
2013-01-17 20:03:30 +02:00
2013-01-17 20:03:30 +02:00
2013-02-26 09:43:33 +09:00
2013-02-22 12:19:05 -03:00
2013-01-17 20:03:30 +02:00
2013-02-01 23:49:23 +01:00
2013-01-17 20:03:30 +02:00
2013-01-17 20:03:30 +02:00
2013-02-24 13:31:08 -03:00
2013-01-17 20:03:30 +02:00
2013-02-22 18:17:59 -03:00
2013-03-07 13:35:14 +09:00
2013-01-17 20:03:30 +02:00
2013-01-17 20:03:30 +02:00
2013-02-01 17:46:40 +04:00
2013-02-16 18:36:18 -02:00
2013-01-17 20:03:30 +02:00
2013-01-20 16:16:58 +01:00
2013-01-17 20:03:30 +02:00
2013-02-15 20:14:54 -07:00
2013-02-25 22:53:37 -03:00
2013-02-06 23:52:55 -02:00
2013-01-17 20:03:30 +02:00
2013-01-17 20:03:30 +02:00
2013-02-21 09:14:42 -07:00
2013-01-17 20:03:30 +02:00
2013-01-17 20:03:30 +02:00
2013-02-24 13:25:49 -03:00
2013-01-17 20:03:30 +02:00
2013-01-17 20:03:30 +02:00
2013-02-05 13:18:13 -08:00
2013-02-03 09:06:48 +01:00
2013-01-17 20:03:30 +02:00
2013-01-25 02:53:31 -05:00
2013-02-28 21:32:03 -03:00
2013-02-24 13:42:15 -03:00
2013-03-15 13:39:21 -05:00
2013-01-17 20:03:30 +02:00
2013-02-09 03:59:40 -06:00
2013-02-25 23:06:10 -03:00
2013-01-17 09:48:27 -08:00
2012-12-20 00:49:17 -06:00

DefinitelyTyped Build Status

The repository for high quality TypeScript type definitions.

Use a definition file like this:

/// <reference path="jquery.d.ts" />

Contributor Guidelines

See the section: How to contribute

Other means to get the definitions

List of Definitions

Requested Definitions

S
Description
The repository for high quality TypeScript type definitions.
Readme MIT
98 MiB
Languages
TypeScript 100%