Merge pull request #17281 from kalleguld/master

angular: gave a more precise return type for IQService.all()
This commit is contained in:
Nathan Shively-Sanders 2017-06-22 14:28:29 -07:00 committed by GitHub
commit fcb37f9fe0
9 changed files with 18 additions and 2 deletions

View File

@ -2,6 +2,7 @@
// Project: https://github.com/McNull/angular-block-ui
// Definitions by: Lasse Nørregaard <https://github.com/lassebn>, Stephan Classen <https://github.com/sclassen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as angular from "angular";

View File

@ -2,6 +2,7 @@
// Project: https://github.com/ManifestWebDesign/angular-gridster
// Definitions by: Joao Monteiro <https://github.com/jpmnteiro>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as angular from "angular";

View File

@ -2,6 +2,7 @@
// Project: https://github.com/oauthjs/angular-oauth2
// Definitions by: Antério Vieira <https://github.com/anteriovieira>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as angular from 'angular';

View File

@ -337,6 +337,16 @@ namespace TestQ {
let result: angular.IPromise<{a: number; b: string; }>;
result = $q.all<{a: number; b: string; }>({a: promiseAny, b: promiseAny});
}
{
let result = $q.all({ num: $q.when(2), str: $q.when('test') });
// TS should infer that num is a number and str is a string
result.then(r => (r.num * 2) + r.str.indexOf('s'));
}
{
let result = $q.all({ num: $q.when(2), str: 'test' });
// TS should infer that num is a number and str is a string
result.then(r => (r.num * 2) + r.str.indexOf('s'));
}
// $q.defer
{

View File

@ -1029,8 +1029,7 @@ declare namespace angular {
*
* @param promises A hash of promises.
*/
all(promises: { [id: string]: IPromise<any>; }): IPromise<{ [id: string]: any; }>;
all<T extends {}>(promises: { [id: string]: IPromise<any>; }): IPromise<T>;
all<T>(promises: { [K in keyof T]: (IPromise<T[K]> | T[K]); }): IPromise<T>;
/**
* Creates a Deferred object which represents a task which will finish in the future.
*/

View File

@ -2,6 +2,7 @@
// Project: https://github.com/beevelop/ng-stomp
// Definitions by: Lukasz Potapczuk <https://github.com/lpotapczuk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular" />

View File

@ -2,6 +2,7 @@
// Project: https://github.com/gsklee/ngStorage
// Definitions by: Jakub Pistek <https://github.com/kubiq>
// Definitions: https://github.com/kubiq/DefinitelyTyped
// TypeScript Version: 2.3
export namespace ngStorage {
interface StorageService {

View File

@ -2,6 +2,7 @@
// Project: http://help.qlik.com/en-US/sense-developer/3.2/Subsystems/Extensions/Content/extensions-introduction.htm
// Definitions by: Konrad Mattheis <https://github.com/konne>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular" />

View File

@ -2,6 +2,7 @@
// Project: https://github.com/christopherthielen/ui-router-extras
// Definitions by: Michael Putters <https://github.com/mputters/>, Marcel van de Kamp <https://github.com/marcel-k/>, Viktor Smirnov <https://github.com/LaserUnicorns/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="angular-ui-router" />