Skip to content
Source
Sign inSign up
TanStack/form

fix(form-core): preserve FieldWithValue name string type #2466

OpenPriyeshshrivastav(GitHub profile, opens in a new tab)wants to merge 1 commit intoalpha fromrefs/pull/2466/headopened

Showing 3 changed files with 34 additions and 1 deletion.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/dark-suits-itch.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/form-core': patch
+---
+​
+Fix FieldWithValue name type to preserve string typing
1 addition and 1 deletionpackages/form-core/src/types.public.tsModified
View file
@@ -50,7 +50,7 @@
* @typeParam TFieldValue - The value type preserved across field reads and update methods.
*/
export type FieldWithValue<TFieldValue> = FieldApi<
- any,
+ string,
TFieldValue,
any,
any,
28 additions and 0 deletionspackages/form-core/tests/FieldWithValue.test-d.tsAdded
View file
@@ -0,0 +1,28 @@
+​
+import { describe, expectTypeOf, it } from 'vitest'
+import type { FieldWithValue } from '../src'
+​
+describe('FieldWithValue', () => {
+ it('should preserve string typing for field name', () => {
+ const field = null as unknown as FieldWithValue<boolean>
+​
+ expectTypeOf<typeof field.name>().toEqualTypeOf<string>()