@primno/core
Version:
Front-end framework for Model-Driven Apps of Power Apps and Dynamics 365.
24 lines (23 loc) • 837 B
TypeScript
/**
* Decorator that marks an optional dependency.
* Null will be injected if the dependency is not found.
*
* @example Mark `MyService` as an optional dependency.
* ```ts
* @MnComponent({
* scope: {
* pageType: "record"
* }
* })
* export class MyComponent {
* // Search for a dependency with the identifier "ServiceIdentifier" and inject it into this property.
* // If the dependency is not found, null will be injected.
* @Optional()
* @Inject("ServiceIdentifier")
* myService: Service;
* }
* ```
*
* @category Dependency Injection
*/
export declare function Optional(): <T>(target: import("inversify/lib/annotation/decorator_utils").DecoratorTarget<unknown>, targetKey?: string | symbol | undefined, indexOrPropertyDescriptor?: number | TypedPropertyDescriptor<T> | undefined) => void;