mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Update version of injectable for disambiguous typing
Signed-off-by: Mikko Aspiala <mikko.aspiala@gmail.com> Co-authored-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
1 parent
0af1d08299
commit
2e5e549957
4 files changed
+23
-25
No files matched your search
+3
-6
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
/// <reference types="react" />
|
||||
declare module "@ogre-tools/injectable-react" {
|
||||
import type { IDependencyInjectionContainer } from "@ogre-tools/injectable";
|
||||
import type { IDependencyInjectionContainer, IInjectable } from "@ogre-tools/injectable";
|
||||
|
||||
interface IDependencyInjectionContainerProviderProps {
|
||||
di: IDependencyInjectionContainer;
|
||||
@@ -29,16 +29,13 @@ declare module "@ogre-tools/injectable-react" {
|
||||
export const DiContextProvider: React.Provider<IDependencyInjectionContainerProviderProps>;
|
||||
|
||||
export const Inject: <
|
||||
TComponentInjectable extends IComponentInjectable<any, {}>,
|
||||
TComponentInjectable extends IInjectable<any>,
|
||||
>({
|
||||
Component,
|
||||
injectableKey,
|
||||
getPlaceholder,
|
||||
...props
|
||||
}: Omit<
|
||||
React.ComponentProps<TComponentInjectable["instantiate"]>,
|
||||
keyof ReturnType<TComponentInjectable["getDependencies"]>
|
||||
> & {
|
||||
}: Parameters<TComponentInjectable["instantiate"]>[1] & {
|
||||
injectableKey: TComponentInjectable;
|
||||
getPlaceholder?: () => JSX.Element | null;
|
||||
}) => JSX.Element;
|
||||
|
||||
Vendored
+9
-8
@@ -48,14 +48,15 @@ declare module "@ogre-tools/injectable" {
|
||||
lifecycle?: lifecycleEnum;
|
||||
}
|
||||
|
||||
export interface IInjectable<TInstance, TDependencies = {}>
|
||||
extends ICommonInjectable<TDependencies> {
|
||||
instantiate: (dependencies: TDependencies) => TInstance;
|
||||
}
|
||||
|
||||
export interface IComponentInjectable<TInstance, TDependencies = {}>
|
||||
extends ICommonInjectable<TDependencies> {
|
||||
instantiate: TInstance;
|
||||
export interface IInjectable<
|
||||
TInstance,
|
||||
TDependencies extends object = {},
|
||||
TInstantiationParameter extends object = {},
|
||||
> extends ICommonInjectable<TDependencies> {
|
||||
instantiate: (
|
||||
dependencies: TDependencies,
|
||||
instantiationParameter: TInstantiationParameter,
|
||||
) => TInstance;
|
||||
}
|
||||
|
||||
export enum lifecycleEnum {
|
||||
|
||||
Reference in new issue
Block a user