From 4fdaca297349f8a744581dd5602bcb0d6db57b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Sat, 28 Mar 2026 21:42:11 +0100 Subject: [PATCH] Refactor Form --- packages/effect-fc/src/Form.ts | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/packages/effect-fc/src/Form.ts b/packages/effect-fc/src/Form.ts index fee273c..b134e62 100644 --- a/packages/effect-fc/src/Form.ts +++ b/packages/effect-fc/src/Form.ts @@ -23,13 +23,9 @@ extends Pipeable.Pipeable { readonly canSubmit: Subscribable.Subscribable } -export const FormImplTypeId: unique symbol = Symbol.for("@effect-fc/Form/FormImpl") -export type FormImplTypeId = typeof FormImplTypeId - export class FormImpl extends Pipeable.Class() implements Form { readonly [FormTypeId]: FormTypeId = FormTypeId - readonly [FormImplTypeId]: FormImplTypeId = FormImplTypeId constructor( readonly path: P, @@ -64,9 +60,12 @@ extends Form { } export class RootFormImpl -extends FormImpl implements RootForm { +extends Pipeable.Class() implements RootForm { + readonly [FormTypeId]: FormTypeId = FormTypeId readonly [RootFormTypeId]: RootFormTypeId = RootFormTypeId + readonly path = [] as const + constructor( readonly schema: Schema.Schema, readonly context: Context.Context, @@ -85,14 +84,7 @@ extends FormImpl implements RootForm readonly runSemaphore: Effect.Semaphore, ) { - super( - [], - value, - encodedValue, - error, - isValidating, - canSubmit, - ) + super() } get run(): Effect.Effect { @@ -166,7 +158,6 @@ extends FormImpl implements RootForm export const isForm = (u: unknown): u is Form => Predicate.hasProperty(u, FormTypeId) -export const isFormImpl = (u: unknown): u is FormImpl => Predicate.hasProperty(u, FormImplTypeId) export const isRootForm = (u: unknown): u is RootForm => Predicate.hasProperty(u, RootFormTypeId)