Skip to content

Commit

Permalink
assert type for configOrName and infer it automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 committed Dec 17, 2024
1 parent a7ce04b commit 3bef682
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ export function useScaffoldWriteContract<TContractName extends ContractName>(
configOrName: UseScaffoldWriteConfig<TContractName> | TContractName,
writeContractParams?: UseWriteContractParameters,
): ScaffoldWriteContractReturnType<TContractName> {
const finalConfig: UseScaffoldWriteConfig<TContractName> =
const finalConfig =
typeof configOrName === "string"
? { contractName: configOrName, writeContractParams, chainId: undefined }
: (configOrName as any);
: (configOrName as UseScaffoldWriteConfig<TContractName>);
const { contractName, chainId, writeContractParams: finalWriteContractParams } = finalConfig;

const { chain: accountChain } = useAccount();
Expand Down

0 comments on commit 3bef682

Please sign in to comment.