OptionalLazyInject
@tsed/di
Usage
typescript
import { OptionalLazyInject } from "@tsed/di";
Overview
ts
function OptionalLazyInject(resolver: () => Promise<{
default: unknown;
}>): PropertyDecorator;
export function OptionalLazyInject(key: string, resolver: () => Promise<{
default: unknown;
}>): PropertyDecorator;
Description
Optionally Lazy load a provider from his package and invoke only when the provider is used
typescript
import type {PlatformException} from "@tsed/platform-exceptions";
@Injectable()
export class MyService {
@OptionalLazyInject(() => import("@tsed/platform-exceptions"))
exceptions: Promise<PlatformException>;
}
default
ts
default: unknown;
default
ts
default: unknown;