Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/useWatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ function useWatch<TForm extends FormInstance>(
form?: TForm | WatchOptions<TForm>,
): any;

function useWatch<ValueType = Store>(
dependencies: NamePath,
function useWatch<ValueType = Store, Values = any>(
dependencies: NamePath<Values>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NamePath 的范型默认就是any, 需要这样加吗?我看 NamePath 基本都没有加

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你想要单独指定?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参考

image

image

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只有指定 <ValueType>,才能限制 path

第二个是个小优化,增加path提示,但是这个不会限制 path

form?: FormInstance | WatchOptions<FormInstance>,
): ValueType;

Expand Down