Skip to content

Commit bb72cad

Browse files
committed
Refine ActionParameters type
1 parent 6bbb0dd commit bb72cad

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/types/Actions.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { Address } from 'viem';
22
import { Prettify } from './utils';
33

4-
type RemoveUndefinedArgs<T> = T extends { args?: undefined } ? Omit<T, 'args'> : T;
5-
64
/**
75
* Actions require contract address, but as part of decorators, the address might have been passed already to the decorator.
86
*
@@ -11,8 +9,8 @@ type RemoveUndefinedArgs<T> = T extends { args?: undefined } ? Omit<T, 'args'> :
119
*/
1210
export type ActionParameters<Args, ContractName extends string, Curried extends boolean> = Prettify<
1311
Curried extends false
14-
? RemoveUndefinedArgs<Args & { [key in ContractName]: Address }>
15-
: Args extends { args?: undefined }
12+
? Args & { [key in ContractName]: Address }
13+
: Args extends Record<string, never>
1614
?
1715
| {
1816
[key in ContractName]: Address;

0 commit comments

Comments
 (0)