Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 329x 329x 329x 2916x 265x | import { InjectionToken } from '@angular/core';
import { environment } from '../../../environments/environment';
import { Environment } from '../../../environments/environment.model';
/**
* Wrapper for type safe injection of injection tokens supplied WITHOUT `multi: true`
*/
export type InjectSingle<T> = T extends InjectionToken<infer U> ? U : never;
/**
* Wrapper for type safe injection of injection tokens supplied WITH `multi: true`
*/
export type InjectMultiple<T> = T extends InjectionToken<infer U> ? U[] : never;
/**
* Create an injection token for environment.ts properties
*/
export function createEnvironmentInjectionToken<K extends keyof Environment>(key: K) {
return new InjectionToken<Environment[K]>(key, {
factory: () => environment[key],
});
}
|