Skip to content

form.fields.set should accept Partial data #15328

@Stadly

Description

@Stadly

Describe the problem

I think it would make sense to be able to set partial data on form.fields. For example with this form:

export const editData = form(
	v.object({ name: v.string(), id: v.string(), confirmationName: v.string() }),
	async (data) => {
		// ...
	}
);

editData.fields.set({ name: "foo", id: "123" }) should then set name and id, and leave confirmationName alone. Today, TypeScript yells at me that confirmationName is missing.

Describe the proposed solution

form.fields.set should accept Partial<T> instead of T. Maybe also for nested fields, such as form.fields.my.nested.field.set?

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions