diff --git a/packages/react/src/hooks/types.ts b/packages/react/src/hooks/types.ts index 5649008d..ae29eea3 100644 --- a/packages/react/src/hooks/types.ts +++ b/packages/react/src/hooks/types.ts @@ -1,9 +1,9 @@ import type { ChainId } from "@reactive-dot/core"; // eslint-disable-next-line @typescript-eslint/ban-types -export type ChainHookOptions = T & { +export type ChainHookOptions = T & { /** * Override default chain ID */ - chainId?: ChainId; + chainId?: TChainId; }; diff --git a/packages/react/src/hooks/useMutation.ts b/packages/react/src/hooks/useMutation.ts index 5a482796..751ab00f 100644 --- a/packages/react/src/hooks/useMutation.ts +++ b/packages/react/src/hooks/useMutation.ts @@ -38,19 +38,22 @@ export function useMutation< >["tx"], ) => // eslint-disable-next-line @typescript-eslint/no-explicit-any Transaction, - TChainId extends ChainId | void = void, + TChainId extends ChainId = ChainId, >( action: TAction, - options?: ChainHookOptions<{ - /** - * Override default signer - */ - signer?: PolkadotSigner; - /** - * Additional transaction options - */ - txOptions?: TxOptions>; - }>, + options?: ChainHookOptions< + TChainId, + { + /** + * Override default signer + */ + signer?: PolkadotSigner; + /** + * Additional transaction options + */ + txOptions?: TxOptions>; + } + >, ) { const chainId = useChainId(options); const contextSigner = useContext(SignerContext); diff --git a/packages/react/src/hooks/useQuery.ts b/packages/react/src/hooks/useQuery.ts index 0e7842f9..15c05cb3 100644 --- a/packages/react/src/hooks/useQuery.ts +++ b/packages/react/src/hooks/useQuery.ts @@ -83,10 +83,10 @@ export function useLazyLoadQueryWithRefresh< TDescriptor extends TChainId extends void ? CommonDescriptor : Chains[Exclude], - TChainId extends ChainId | void = void, + TChainId extends ChainId = ChainId, >( builder: TQuery, - options?: ChainHookOptions, + options?: ChainHookOptions, ): [ data: TQuery extends Falsy ? typeof IDLE @@ -156,10 +156,10 @@ export function useLazyLoadQuery< TDescriptor extends TChainId extends void ? CommonDescriptor : Chains[Exclude], - TChainId extends ChainId | void = void, + TChainId extends ChainId = ChainId, >( builder: TQuery, - options?: ChainHookOptions, + options?: ChainHookOptions, ): TQuery extends Falsy ? typeof IDLE : FalsyGuard< diff --git a/packages/react/src/hooks/useTypedApi.ts b/packages/react/src/hooks/useTypedApi.ts index 8a450dd8..9bec2c14 100644 --- a/packages/react/src/hooks/useTypedApi.ts +++ b/packages/react/src/hooks/useTypedApi.ts @@ -11,8 +11,8 @@ import type { TypedApi } from "polkadot-api"; * @param options - Additional options * @returns Polkadot-API typed API */ -export function useTypedApi( - options?: ChainHookOptions, +export function useTypedApi( + options?: ChainHookOptions, ): TypedApi< TChainId extends void ? CommonDescriptor : Chains[Exclude] > {