From 003679a1bdc8aee3d2a939cb62977533ca4cf370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ti=E1=BA=BFn=20Nguy=E1=BB=85n=20Kh=E1=BA=AFc?= Date: Tue, 23 Jul 2024 23:30:57 +1200 Subject: [PATCH] refactor(react): use type intersection instead of generic (#40) --- packages/react/src/hooks/types.ts | 3 +-- packages/react/src/hooks/use-mutation.ts | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/packages/react/src/hooks/types.ts b/packages/react/src/hooks/types.ts index ae29eea3..e41f1daa 100644 --- a/packages/react/src/hooks/types.ts +++ b/packages/react/src/hooks/types.ts @@ -1,7 +1,6 @@ import type { ChainId } from "@reactive-dot/core"; -// eslint-disable-next-line @typescript-eslint/ban-types -export type ChainHookOptions = T & { +export type ChainHookOptions = { /** * Override default chain ID */ diff --git a/packages/react/src/hooks/use-mutation.ts b/packages/react/src/hooks/use-mutation.ts index 6311d18a..682e26aa 100644 --- a/packages/react/src/hooks/use-mutation.ts +++ b/packages/react/src/hooks/use-mutation.ts @@ -43,19 +43,16 @@ export function useMutation< TChainId extends ChainId, >( action: TAction, - options?: ChainHookOptions< - TChainId, - { - /** - * Override default signer - */ - signer?: PolkadotSigner; - /** - * Additional transaction options - */ - txOptions?: TxOptions>; - } - >, + options?: ChainHookOptions & { + /** + * Override default signer + */ + signer?: PolkadotSigner; + /** + * Additional transaction options + */ + txOptions?: TxOptions>; + }, ) { const chainId = useChainId(options); const mutationEventSubject = useContext(MutationEventSubjectContext);