Skip to content

Commit 541b37a

Browse files
committed
docs: add TS debug steps
1 parent 5139799 commit 541b37a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/framework/react/guides/debugging.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,29 @@ Warning: A component is changing an uncontrolled input to be controlled. This is
1515

1616
It's likely you forgot the `defaultValues` in your `useForm` Hook or `form.Field` component usage. This is occurring
1717
because the input is being rendered before the form value is initialized and is therefore changing from `undefined` to `""` when a text input is made.
18+
19+
# Field value is of type `unknown`
20+
21+
If you're using `form.Field` and, upon inspecting the value of `field.state.value`, you see that the value of a field is of type `unknown`, it's likely that your form's type was too large for us to safely evaluate.
22+
23+
This typically is a sign that you should break down your form into smaller forms or use a more specific type for your form.
24+
25+
A workaround to this problem is to cast `field.state.value` using TypeScript's `as` keyword:
26+
27+
```tsx
28+
const value = field.state.value as string;
29+
```
30+
31+
# `Type instantiation is excessively deep and possibly infinite`
32+
33+
If you see this error in the console when running `tsc`:
34+
35+
```
36+
Type instantiation is excessively deep and possibly infinite
37+
```
38+
39+
You've ran into a bug that we didn't catch in our type definitions. While we've done our best to make sure our types are as accurate as possible, there are some edge cases where TypeScript struggled with the complexity of our types.
40+
41+
Please [report this issue to us on GitHub](https://github.com/TanStack/form/issues) so we can fix it. Just make sure to include a minimal reproduction so that we're able to help you debug.
42+
43+
> Keep in mind that this error is a TypeScript error and not a runtime error. This means that your code will still run on the user's machine as expected.

0 commit comments

Comments
 (0)