ICollectionPromise<T> should extend ng.IPromise with an array of T

ICollectionPromise<T> extends ng.IPromise<T> is the equivalent of
interface IPromise<T> extends ng.IPromise<T> for arrays of T. Therefore
it makes no sense to extend ng.IPromise with just T. Instead it has to
be an array of T.

The consequence of this bug can be observed when calling

Restangular.all('someEntity').getList<SomeEntity>().then((entities) =>
{...})

In this case the TypeScript compiler handles entities as SomeEntity, not
SomeEntity[].
This commit is contained in:
Marvin Luchs
2015-04-29 10:09:09 +02:00
parent cc0537a0ac
commit b9e995eb9b
+1 -1
View File
@@ -15,7 +15,7 @@ declare module restangular {
$object: T;
}
interface ICollectionPromise<T> extends ng.IPromise<T> {
interface ICollectionPromise<T> extends ng.IPromise<T[]> {
push(object: any): ICollectionPromise<T>;
call(methodName: string, params?: any): ICollectionPromise<T>;
get(fieldName: string): ICollectionPromise<T>;