From 5c0f7336fb79252d48c02d9fa7b5a7e110c550fa Mon Sep 17 00:00:00 2001 From: Kasper Guldmann Nielsen Date: Sun, 18 Jun 2017 22:20:49 +0200 Subject: [PATCH 1/4] angular: gave a more precise return type for IQService.all() --- types/angular/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index d0e2d978dc..f748ee9c50 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -1029,8 +1029,7 @@ declare namespace angular { * * @param promises A hash of promises. */ - all(promises: { [id: string]: IPromise; }): IPromise<{ [id: string]: any; }>; - all(promises: { [id: string]: IPromise; }): IPromise; + all(promises: { [K in keyof T]: IPromise; }): IPromise; /** * Creates a Deferred object which represents a task which will finish in the future. */ From 2effeac8f05074ca068e94ec11f9afd930db9e05 Mon Sep 17 00:00:00 2001 From: Kasper Guldmann Nielsen Date: Wed, 21 Jun 2017 18:15:00 +0200 Subject: [PATCH 2/4] angular: gave a more precise return type to $q.all() --- types/angular-block-ui/angular-block-ui-tests.ts | 3 +++ types/angular-block-ui/index.d.ts | 1 + types/angular-gridster/angular-gridster-tests.ts | 3 +++ types/angular-gridster/index.d.ts | 1 + types/angular-oauth2/angular-oauth2-tests.ts | 2 ++ types/angular-oauth2/index.d.ts | 1 + types/angular/angular-tests.ts | 10 ++++++++++ types/angular/index.d.ts | 2 +- types/ng-stomp/index.d.ts | 1 + types/ng-stomp/ng-stomp-tests.ts | 2 ++ types/qlik-visualizationextensions/index.d.ts | 1 + .../qlik-visualizationextensions-tests.ts | 2 ++ types/ui-router-extras/index.d.ts | 1 + types/ui-router-extras/ui-router-extras-tests.ts | 2 ++ 14 files changed, 31 insertions(+), 1 deletion(-) diff --git a/types/angular-block-ui/angular-block-ui-tests.ts b/types/angular-block-ui/angular-block-ui-tests.ts index 4b3903f9cc..89539c93fb 100644 --- a/types/angular-block-ui/angular-block-ui-tests.ts +++ b/types/angular-block-ui/angular-block-ui-tests.ts @@ -1,3 +1,6 @@ +// TypeScript Version: 2.3 + + let app: angular.IModule = angular.module('at', ['blockUI']); app.config((blockUIConfig: angular.blockUI.BlockUIConfig) => { diff --git a/types/angular-block-ui/index.d.ts b/types/angular-block-ui/index.d.ts index bf311b04a1..7733bc72f7 100644 --- a/types/angular-block-ui/index.d.ts +++ b/types/angular-block-ui/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/McNull/angular-block-ui // Definitions by: Lasse Nørregaard , Stephan Classen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as angular from "angular"; diff --git a/types/angular-gridster/angular-gridster-tests.ts b/types/angular-gridster/angular-gridster-tests.ts index f8c5a93c81..deb01f8982 100644 --- a/types/angular-gridster/angular-gridster-tests.ts +++ b/types/angular-gridster/angular-gridster-tests.ts @@ -1,3 +1,6 @@ +// TypeScript Version: 2.3 + + import * as ng from "angular"; import * as angular from "angular"; diff --git a/types/angular-gridster/index.d.ts b/types/angular-gridster/index.d.ts index 272470bc6f..3d4fbbe799 100644 --- a/types/angular-gridster/index.d.ts +++ b/types/angular-gridster/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/ManifestWebDesign/angular-gridster // Definitions by: Joao Monteiro // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as angular from "angular"; diff --git a/types/angular-oauth2/angular-oauth2-tests.ts b/types/angular-oauth2/angular-oauth2-tests.ts index 89dd51b4aa..9c744ee92f 100644 --- a/types/angular-oauth2/angular-oauth2-tests.ts +++ b/types/angular-oauth2/angular-oauth2-tests.ts @@ -1,3 +1,5 @@ +// TypeScript Version: 2.3 + import * as angular from 'angular'; angular.module('angular-oauth2-test', ['angular-oauth2']) diff --git a/types/angular-oauth2/index.d.ts b/types/angular-oauth2/index.d.ts index 23df762df1..1c5e3ac6ed 100644 --- a/types/angular-oauth2/index.d.ts +++ b/types/angular-oauth2/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/oauthjs/angular-oauth2 // Definitions by: Antério Vieira // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as angular from 'angular'; diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index d77c18fa37..2343252da7 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -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 { diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index f748ee9c50..d139a1e63e 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -1029,7 +1029,7 @@ declare namespace angular { * * @param promises A hash of promises. */ - all(promises: { [K in keyof T]: IPromise; }): IPromise; + all(promises: { [K in keyof T]: (IPromise | T[K]); }): IPromise; /** * Creates a Deferred object which represents a task which will finish in the future. */ diff --git a/types/ng-stomp/index.d.ts b/types/ng-stomp/index.d.ts index 3a91a64844..2a2e9c2496 100644 --- a/types/ng-stomp/index.d.ts +++ b/types/ng-stomp/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/beevelop/ng-stomp // Definitions by: Lukasz Potapczuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/ng-stomp/ng-stomp-tests.ts b/types/ng-stomp/ng-stomp-tests.ts index 436fe901ea..6ea53804c1 100644 --- a/types/ng-stomp/ng-stomp-tests.ts +++ b/types/ng-stomp/ng-stomp-tests.ts @@ -1,3 +1,5 @@ +// TypeScript Version: 2.3 + class test { constructor(private ngstomp: ngStomp) { const connectHeaders = { diff --git a/types/qlik-visualizationextensions/index.d.ts b/types/qlik-visualizationextensions/index.d.ts index d4296fca5b..741e9db805 100644 --- a/types/qlik-visualizationextensions/index.d.ts +++ b/types/qlik-visualizationextensions/index.d.ts @@ -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 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts b/types/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts index 0afce187e4..c30c72adfb 100644 --- a/types/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts +++ b/types/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts @@ -1,3 +1,5 @@ +// TypeScript Version: 2.3 + import qlik = require("qlik"); const t = qlik.currApp(); diff --git a/types/ui-router-extras/index.d.ts b/types/ui-router-extras/index.d.ts index 647263c912..ad3c76d101 100644 --- a/types/ui-router-extras/index.d.ts +++ b/types/ui-router-extras/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/christopherthielen/ui-router-extras // Definitions by: Michael Putters , Marcel van de Kamp , Viktor Smirnov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// diff --git a/types/ui-router-extras/ui-router-extras-tests.ts b/types/ui-router-extras/ui-router-extras-tests.ts index 5cc3ed122a..045feb4024 100644 --- a/types/ui-router-extras/ui-router-extras-tests.ts +++ b/types/ui-router-extras/ui-router-extras-tests.ts @@ -1,3 +1,5 @@ +// TypeScript Version: 2.3 + import * as angular from 'angular'; const myApp = angular.module('testModule'); From c0bb38207da8b2527d51e4e1f714fe28ce8b3d6c Mon Sep 17 00:00:00 2001 From: Kasper Guldmann Nielsen Date: Wed, 21 Jun 2017 21:24:16 +0200 Subject: [PATCH 3/4] angular: fixed a misunderstanding in how test system is set up --- types/angular-block-ui/angular-block-ui-tests.ts | 3 --- types/angular-gridster/angular-gridster-tests.ts | 3 --- types/angular-oauth2/angular-oauth2-tests.ts | 2 -- types/ng-stomp/ng-stomp-tests.ts | 2 -- .../qlik-visualizationextensions-tests.ts | 2 -- types/ui-router-extras/ui-router-extras-tests.ts | 2 -- 6 files changed, 14 deletions(-) diff --git a/types/angular-block-ui/angular-block-ui-tests.ts b/types/angular-block-ui/angular-block-ui-tests.ts index 89539c93fb..4b3903f9cc 100644 --- a/types/angular-block-ui/angular-block-ui-tests.ts +++ b/types/angular-block-ui/angular-block-ui-tests.ts @@ -1,6 +1,3 @@ -// TypeScript Version: 2.3 - - let app: angular.IModule = angular.module('at', ['blockUI']); app.config((blockUIConfig: angular.blockUI.BlockUIConfig) => { diff --git a/types/angular-gridster/angular-gridster-tests.ts b/types/angular-gridster/angular-gridster-tests.ts index deb01f8982..f8c5a93c81 100644 --- a/types/angular-gridster/angular-gridster-tests.ts +++ b/types/angular-gridster/angular-gridster-tests.ts @@ -1,6 +1,3 @@ -// TypeScript Version: 2.3 - - import * as ng from "angular"; import * as angular from "angular"; diff --git a/types/angular-oauth2/angular-oauth2-tests.ts b/types/angular-oauth2/angular-oauth2-tests.ts index 9c744ee92f..89dd51b4aa 100644 --- a/types/angular-oauth2/angular-oauth2-tests.ts +++ b/types/angular-oauth2/angular-oauth2-tests.ts @@ -1,5 +1,3 @@ -// TypeScript Version: 2.3 - import * as angular from 'angular'; angular.module('angular-oauth2-test', ['angular-oauth2']) diff --git a/types/ng-stomp/ng-stomp-tests.ts b/types/ng-stomp/ng-stomp-tests.ts index 6ea53804c1..436fe901ea 100644 --- a/types/ng-stomp/ng-stomp-tests.ts +++ b/types/ng-stomp/ng-stomp-tests.ts @@ -1,5 +1,3 @@ -// TypeScript Version: 2.3 - class test { constructor(private ngstomp: ngStomp) { const connectHeaders = { diff --git a/types/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts b/types/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts index c30c72adfb..0afce187e4 100644 --- a/types/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts +++ b/types/qlik-visualizationextensions/qlik-visualizationextensions-tests.ts @@ -1,5 +1,3 @@ -// TypeScript Version: 2.3 - import qlik = require("qlik"); const t = qlik.currApp(); diff --git a/types/ui-router-extras/ui-router-extras-tests.ts b/types/ui-router-extras/ui-router-extras-tests.ts index 045feb4024..5cc3ed122a 100644 --- a/types/ui-router-extras/ui-router-extras-tests.ts +++ b/types/ui-router-extras/ui-router-extras-tests.ts @@ -1,5 +1,3 @@ -// TypeScript Version: 2.3 - import * as angular from 'angular'; const myApp = angular.module('testModule'); From f349dfe15923d40e540f2bb7d7739625398461ff Mon Sep 17 00:00:00 2001 From: Kasper Guldmann Nielsen Date: Wed, 21 Jun 2017 22:26:47 +0200 Subject: [PATCH 4/4] added a further dependency on typescript 2.3 --- types/ngstorage/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/ngstorage/index.d.ts b/types/ngstorage/index.d.ts index 83c740ff0e..ca86f3d1a8 100644 --- a/types/ngstorage/index.d.ts +++ b/types/ngstorage/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/gsklee/ngStorage // Definitions by: Jakub Pistek // Definitions: https://github.com/kubiq/DefinitelyTyped +// TypeScript Version: 2.3 export namespace ngStorage { interface StorageService {