Skip to content

Commit

Permalink
avoid coupling with the FieldElement type
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundhung committed Dec 13, 2024
1 parent 5e8eb8c commit 1286246
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/conform-dom/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export function requestSubmit(
* Synchronizes the field elements with the provided state
*/
export function syncFieldValue(
element: FieldElement,
element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement,
value: unknown,
defaultValue: unknown,
): void {
Expand Down Expand Up @@ -183,7 +183,7 @@ export function syncFieldValue(
}

export function syncFieldConstraint(
element: FieldElement,
element: HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement,
constraint: {
required?: boolean;
minLength?: number;
Expand All @@ -200,7 +200,7 @@ export function syncFieldConstraint(
// If the element is a part of the checkbox group, it is unclear whether all checkboxes are required or only one.
!(
element.type === 'checkbox' &&
element.form.elements.namedItem(element.name) instanceof RadioNodeList
element.form?.elements.namedItem(element.name) instanceof RadioNodeList
)
) {
element.required = constraint.required;
Expand Down

0 comments on commit 1286246

Please sign in to comment.