Skip to content

Commit

Permalink
refactor(react): use type intersection instead of generic (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
tien authored Jul 23, 2024
1 parent 04c0583 commit 003679a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
3 changes: 1 addition & 2 deletions packages/react/src/hooks/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { ChainId } from "@reactive-dot/core";

// eslint-disable-next-line @typescript-eslint/ban-types
export type ChainHookOptions<TChainId extends ChainId = ChainId, T = {}> = T & {
export type ChainHookOptions<TChainId extends ChainId = ChainId> = {
/**
* Override default chain ID
*/
Expand Down
23 changes: 10 additions & 13 deletions packages/react/src/hooks/use-mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReturnType<TAction>>;
}
>,
options?: ChainHookOptions<TChainId> & {
/**
* Override default signer
*/
signer?: PolkadotSigner;
/**
* Additional transaction options
*/
txOptions?: TxOptions<ReturnType<TAction>>;
},
) {
const chainId = useChainId(options);
const mutationEventSubject = useContext(MutationEventSubjectContext);
Expand Down

0 comments on commit 003679a

Please sign in to comment.