From 2e5e54995794fe02139140fb9e41bbf05471bd1a Mon Sep 17 00:00:00 2001 From: Mikko Aspiala Date: Wed, 17 Nov 2021 14:34:47 +0200 Subject: [PATCH] Update version of injectable for disambiguous typing Signed-off-by: Mikko Aspiala Co-authored-by: Janne Savolainen --- package.json | 4 ++-- types/ogre-tools-injectable-react.d.ts | 9 +++------ types/ogre-tools-injectable.d.ts | 17 +++++++++-------- yarn.lock | 18 +++++++++--------- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 10e4d8acae..09fa5f212a 100644 --- a/package.json +++ b/package.json @@ -188,8 +188,8 @@ "@kubernetes/client-node": "^0.15.1", "@sentry/electron": "^2.5.4", "@sentry/integrations": "^6.15.0", - "@ogre-tools/injectable": "^1.0.2", - "@ogre-tools/injectable-react": "^1.0.3", + "@ogre-tools/injectable": "^1.1.0", + "@ogre-tools/injectable-react": "^1.1.0", "abort-controller": "^3.0.0", "auto-bind": "^4.0.0", "autobind-decorator": "^2.4.0", diff --git a/types/ogre-tools-injectable-react.d.ts b/types/ogre-tools-injectable-react.d.ts index 3624dec706..38599d909d 100644 --- a/types/ogre-tools-injectable-react.d.ts +++ b/types/ogre-tools-injectable-react.d.ts @@ -20,7 +20,7 @@ */ /// 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; export const Inject: < - TComponentInjectable extends IComponentInjectable, + TComponentInjectable extends IInjectable, >({ Component, injectableKey, getPlaceholder, ...props - }: Omit< - React.ComponentProps, - keyof ReturnType - > & { + }: Parameters[1] & { injectableKey: TComponentInjectable; getPlaceholder?: () => JSX.Element | null; }) => JSX.Element; diff --git a/types/ogre-tools-injectable.d.ts b/types/ogre-tools-injectable.d.ts index b04cf02740..2f22e592e3 100644 --- a/types/ogre-tools-injectable.d.ts +++ b/types/ogre-tools-injectable.d.ts @@ -48,14 +48,15 @@ declare module "@ogre-tools/injectable" { lifecycle?: lifecycleEnum; } - export interface IInjectable - extends ICommonInjectable { - instantiate: (dependencies: TDependencies) => TInstance; - } - - export interface IComponentInjectable - extends ICommonInjectable { - instantiate: TInstance; + export interface IInjectable< + TInstance, + TDependencies extends object = {}, + TInstantiationParameter extends object = {}, + > extends ICommonInjectable { + instantiate: ( + dependencies: TDependencies, + instantiationParameter: TInstantiationParameter, + ) => TInstance; } export enum lifecycleEnum { diff --git a/yarn.lock b/yarn.lock index c78e8fed10..0b0eda05b4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -953,19 +953,19 @@ dependencies: lodash "^4.17.21" -"@ogre-tools/injectable-react@^1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@ogre-tools/injectable-react/-/injectable-react-1.0.3.tgz#e30ea455cc4ccf24fbad831b460023492832c2f9" - integrity sha512-CFJeuezdJIZD0o0rp1MnahzItzZ7eSixSo0v0+002kq8T7HZb1ycD8d/zvXOBnkEF34K6GGibXicEw1q46SZzw== +"@ogre-tools/injectable-react@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@ogre-tools/injectable-react/-/injectable-react-1.1.0.tgz#32757e250b5701c9b467331e99baf9702984106a" + integrity sha512-qsC1Igi55SSiH0/oVuH1QcMFhUouEjhfZG5924PG+hqk2Hzsgi3gN1cnPMTpH8vXJiskNQ0tSrgklPb4w5J8KA== dependencies: "@ogre-tools/fp" "^1.0.2" - "@ogre-tools/injectable" "^1.0.2" + "@ogre-tools/injectable" "^1.1.0" lodash "^4.17.21" -"@ogre-tools/injectable@^1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@ogre-tools/injectable/-/injectable-1.0.2.tgz#b081fefb2026c57fe47e27c268efa73d43934546" - integrity sha512-NZ7FHxKLfr+8o4aL51UQ212w1wD3QIsEN/JNtjtEq0TgLjd2Qo3zSniL4hCEj5M49K2qe3CxEb6ezyf2vFTb5g== +"@ogre-tools/injectable@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@ogre-tools/injectable/-/injectable-1.1.0.tgz#095c9d12001d03dd96c98d8986392b0fee05262c" + integrity sha512-ViuFC2iHM86os87W2qubUCAlPYzdxmZwtPBAExb2SLNMHk8Z8dRx9BGDk8AcfCd8aPUw5GHIgf7wxCAMWcyvlw== dependencies: "@ogre-tools/fp" "^1.0.2" lodash "^4.17.21"