@omnia/fx
Version:
Provide Omnia Fx typings and tooling for clientside Omnia development.
29 lines (28 loc) • 1.48 kB
TypeScript
/**
* Injects an instance of the specifed type. That instance maybe come from higer level relation provide it.
*
* @param classType - Type to inject
* @param constructorArgs - Optional arguments for the constructor, by naming convention an interface should be supplied specifying the expected parameters
* the name of the interface should follow <classType>Constructor i.e.
* Type: HttpClient, if supporting constructor arguments an interface named: "HttpClientConstructor" should be supplied.
*
* E.g.:
* Inject<HttpClientConstructor>(HttpClient,{someConstructorArg1:"",someConstructorArg2})
*/
export declare function Inject<T>(classType: any, constructorArgs?: T): any;
type Class<T> = {
new (...args: any[]): T;
};
/**
* Injects an instance of the specifed type. That instance maybe come from higer level relation provide it.
*
* @param classType - Type to inject
* @param constructorArgs - Optional arguments for the constructor, by naming convention an interface should be supplied specifying the expected parameters
* the name of the interface should follow <classType>Constructor i.e.
* Type: HttpClient, if supporting constructor arguments an interface named: "HttpClientConstructor" should be supplied.
*
* E.g.:
* useInject<HttpClientConstructor>(HttpClient,{someConstructorArg1:"",someConstructorArg2})
*/
export declare function useInject<TClass, TConstructor>(classType: Class<TClass>, constructorArgs?: TConstructor): TClass;
export {};