From 275ebfe6496a70b91d4adbb456dee9ba357c81c7 Mon Sep 17 00:00:00 2001 From: Steve Mayes Date: Sun, 28 Feb 2016 14:19:49 -0500 Subject: [PATCH 1/2] Fixed inject function return type Per oclazyload's source code and on the suggestion of @MarkusKramer in DefinitelyTyped's Issue #7477, updated the return type of the inject function to be ng.IPromise instead of boolean. --- oclazyload/oclazyload.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oclazyload/oclazyload.d.ts b/oclazyload/oclazyload.d.ts index 1acf7e7819..56cd2850f4 100644 --- a/oclazyload/oclazyload.d.ts +++ b/oclazyload/oclazyload.d.ts @@ -43,7 +43,7 @@ declare module oc { * Injects a module with the associated name into Angular. Useful for manual injection when loading through RequireJS, SystemJS, etc. Useful in * conjunction with the toggleWatch() method. */ - inject(moduleName: string|string[]): boolean; + inject(moduleName: string|string[]): ng.IPromise; /** * Enables or disables watching Angular for new modules. Useful in conjunction with the inject() method. Make sure to not keep the watch enabled @@ -146,4 +146,4 @@ declare module angular { */ module(name: string, requires?: (string|oc.IModuleConfig)[], configFn?: Function): IModule; } -} \ No newline at end of file +} From 5c6d87567261849d13b6af17772ed144597f6a38 Mon Sep 17 00:00:00 2001 From: Steve Mayes Date: Sun, 28 Feb 2016 14:22:16 -0500 Subject: [PATCH 2/2] Updated test for the inject function Updated the test for the inject function to assign it to a variable typed to ng.IPromise to test/verify that method's return type. --- oclazyload/oclazyload-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oclazyload/oclazyload-tests.ts b/oclazyload/oclazyload-tests.ts index 3a436b14ac..e9c4661e29 100644 --- a/oclazyload/oclazyload-tests.ts +++ b/oclazyload/oclazyload-tests.ts @@ -89,7 +89,7 @@ angular.module('app').controller(['$ocLazyLoadProvider', function ($ocLazyLoad: 'testModule2.js' ]); - $ocLazyLoad.inject('testModule'); + var promise: ng.IPromise = $ocLazyLoad.inject('testModule'); $ocLazyLoad.toggleWatch(true); -}]); \ No newline at end of file +}]);