Skip to content

Commit 826a7d1

Browse files
authored
fix: watch ts (#427)
1 parent dcb5cf5 commit 826a7d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/useWatch.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import type { InternalFormInstance, NamePath, Store } from './interface';
66
import { useState, useContext, useEffect, useRef } from 'react';
77
import { getNamePath, getValue } from './utils/valueUtil';
88

9-
type GetGeneric<Type> = Type extends FormInstance<infer ValueType> ? ValueType : never;
9+
type ReturnPromise<T> = T extends Promise<infer ValueType> ? ValueType : never;
10+
type GetGeneric<TForm extends FormInstance> = ReturnPromise<ReturnType<TForm['validateFields']>>;
1011

1112
function useWatch<
1213
TDependencies1 extends keyof GetGeneric<TForm>,

0 commit comments

Comments
 (0)