-
-
Notifications
You must be signed in to change notification settings - Fork 275
feat: refactor useWatch
type
#608
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov Report
@@ Coverage Diff @@
## master #608 +/- ##
=======================================
Coverage 99.82% 99.82%
=======================================
Files 15 15
Lines 1142 1142
Branches 245 245
=======================================
Hits 1140 1140
Misses 2 2
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -13,18 +13,26 @@ export type DeepNamePath< | |||
? ParentNamePath['length'] extends 0 | |||
? Store | BaseNamePath // Return `BaseNamePath` instead of array if `ParentNamePath` is empty | |||
: Store extends any[] | |||
? [...ParentNamePath, number] // Connect path | |||
? readonly [...ParentNamePath, number] // Connect path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里为什么要加 readonly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -271,10 +271,28 @@ describe('useWatch', () => { | |||
const demo3 = Form.useWatch(['demo1', 'demo2', 'demo3'], form); | |||
const demo4 = Form.useWatch(['demo1', 'demo2', 'demo3', 'demo4'], form); | |||
const demo5 = Form.useWatch(['demo1', 'demo2', 'demo3', 'demo4', 'demo5'], form); | |||
const more = Form.useWatch(['age', 'name', 'gender'], form); | |||
const demo6 = Form.useWatch(['demo1', 'demo2', 'demo3', 'demo4', 'demo5', 'demo6'], form); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里测试不会有效果,要加个类型推断做匹配:
const demoX: XXX = Form.useWatch(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
要加ts报错的测试吗
No description provided.