( $injector: IInjectorService, downgradedModule: string, injectionKey: string, attemptedAction: string, )
| 108 | } |
| 109 | |
| 110 | export function validateInjectionKey( |
| 111 | $injector: IInjectorService, |
| 112 | downgradedModule: string, |
| 113 | injectionKey: string, |
| 114 | attemptedAction: string, |
| 115 | ): void { |
| 116 | const upgradeAppType = getUpgradeAppType($injector); |
| 117 | const downgradedModuleCount = getDowngradedModuleCount($injector); |
| 118 | |
| 119 | // Check for common errors. |
| 120 | switch (upgradeAppType) { |
| 121 | case UpgradeAppType.Dynamic: |
| 122 | case UpgradeAppType.Static: |
| 123 | if (downgradedModule) { |
| 124 | throw new Error( |
| 125 | `Error while ${attemptedAction}: 'downgradedModule' unexpectedly specified.\n` + |
| 126 | "You should not specify a value for 'downgradedModule', unless you are downgrading " + |
| 127 | "more than one Angular module (via 'downgradeModule()').", |
| 128 | ); |
| 129 | } |
| 130 | break; |
| 131 | case UpgradeAppType.Lite: |
| 132 | if (!downgradedModule && downgradedModuleCount >= 2) { |
| 133 | throw new Error( |
| 134 | `Error while ${attemptedAction}: 'downgradedModule' not specified.\n` + |
| 135 | 'This application contains more than one downgraded Angular module, thus you need to ' + |
| 136 | "always specify 'downgradedModule' when downgrading components and injectables.", |
| 137 | ); |
| 138 | } |
| 139 | |
| 140 | if (!$injector.has(injectionKey)) { |
| 141 | throw new Error( |
| 142 | `Error while ${attemptedAction}: Unable to find the specified downgraded module.\n` + |
| 143 | 'Did you forget to downgrade an Angular module or include it in the AngularJS ' + |
| 144 | 'application?', |
| 145 | ); |
| 146 | } |
| 147 | |
| 148 | break; |
| 149 | default: |
| 150 | throw new Error( |
| 151 | `Error while ${attemptedAction}: Not a valid '@angular/upgrade' application.\n` + |
| 152 | 'Did you forget to downgrade an Angular module or include it in the AngularJS ' + |
| 153 | 'application?', |
| 154 | ); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | export class Deferred<R> { |
| 159 | promise: Promise<R>; |
no test coverage detected
searching dependent graphs…