forked from react-hook-form/react-hook-form
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📇 fix type infer with UseFormHandleSubmit (react-hook-form#7405)
* fix type infer with UseFormHandleSubmit * update api extrator * update with test case * fix newlineKind with lf * shift down newlineKind * update type tests * include no-op generic for handleSubmit * Revert "include no-op generic for handleSubmit" This reverts commit 5a2ce64. * adding no-op generic * Revert "adding no-op generic" This reverts commit 46a1295. * Revert "Revert "adding no-op generic"" This reverts commit 3701247. * update api extrator * update test descriptions * fix incorrect generic * ignore eslint with reports * improve isDateObject check * minor code reduce * remove git attribute * Revert "minor code reduce" This reverts commit 05858e8.
- Loading branch information
1 parent
66e7797
commit 70f2902
Showing
6 changed files
with
32 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
/coverage | ||
/src/types/global.d.ts | ||
!.*.js | ||
/reports |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { expectType } from 'tsd'; | ||
|
||
import { useForm } from '../../useForm'; | ||
|
||
/** {@link UseFormHandleSubmit} */ { | ||
/** it should infer the correct defaultValues from useForm */ { | ||
/* eslint-disable react-hooks/rules-of-hooks */ | ||
const { handleSubmit } = useForm({ | ||
defaultValues: { | ||
test: '', | ||
test1: 2, | ||
}, | ||
}); | ||
|
||
handleSubmit((data) => expectType<{ test: string; test1: number }>(data)); | ||
} | ||
|
||
/** it should infer the correct defaultValues from useForm generic */ { | ||
/* eslint-disable react-hooks/rules-of-hooks */ | ||
const { handleSubmit } = useForm<{ | ||
test: string; | ||
test1: number; | ||
}>(); | ||
|
||
handleSubmit((data) => expectType<{ test: string; test1: number }>(data)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters