Skip to content

Commit a41fe83

Browse files
committed
docs: describe JSDoc for generics of the field function
1 parent 518c21d commit a41fe83

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docs/api/field.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Since `validateSync()` is used internally, Async tests are not available.
8080
- Pass the type of `$value` explicitly like `ref<T>()`.
8181

8282
### `U` <Badge type="info" text="Optional" />
83-
- Pass the preferred type as the result of [`toObject()`](/api/toObject).
83+
- Pass the preferred type to be the result of [`toObject()`](/api/toObject).
8484

8585
## Details of `Field` object
8686
### `$value` property

src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,18 @@ export function defineForm<T extends Form>(form: T): T {
212212
return form;
213213
}
214214

215+
/**
216+
* @template T Pass the type of `$value` explicitly like `ref<T>()`.
217+
*/
215218
export function field<T>(
216219
value: T | Ref<T>,
217220
schema?: FieldSchema,
218221
validateOptions?: ValidateOptions
219222
): Field<T>;
223+
/**
224+
* @template T Pass the type of `$value` explicitly like `ref<T>()`.
225+
* @template U Pass the preferred type to be the result of `toObject()`.
226+
*/
220227
export function field<T, U extends T>(
221228
value: T | Ref<T>,
222229
schema?: FieldSchema,

0 commit comments

Comments
 (0)