diff --git a/packages/effect-fc/src/Form.ts b/packages/effect-fc/src/Form.ts index cebe80a..c5a02d0 100644 --- a/packages/effect-fc/src/Form.ts +++ b/packages/effect-fc/src/Form.ts @@ -15,7 +15,9 @@ extends Pipeable.Pipeable { readonly encodedValueRef: SubscriptionRef.SubscriptionRef, readonly errorRef: SubscriptionRef.SubscriptionRef>, - makeFieldIssuesSubscribable

>(path: P): Subscribable.Subscribable + makeFieldIssuesSubscribable>( + path: P + ): Subscribable.Subscribable } @@ -32,7 +34,7 @@ extends Pipeable.Class() implements Form { super() } - makeFieldIssuesSubscribable

>(path: P) { + makeFieldIssuesSubscribable>(path: P) { const filter = Option.match({ onSome: (v: ParseResult.ParseError) => Effect.andThen( ParseResult.ArrayFormatter.formatError(v), @@ -82,7 +84,7 @@ export namespace useInput { } export const useInput: { - >( + >>( self: Form, path: P, options?: useInput.Options, diff --git a/packages/effect-fc/src/types/PropertyPath.ts b/packages/effect-fc/src/types/PropertyPath.ts index af47a8c..b73d24d 100644 --- a/packages/effect-fc/src/types/PropertyPath.ts +++ b/packages/effect-fc/src/types/PropertyPath.ts @@ -28,7 +28,7 @@ export type Paths = readonly [] | ( never ) -export type ValueFromPath = P extends [infer Head, ...infer Tail] +export type ValueFromPath = P extends readonly [infer Head, ...infer Tail] ? Head extends keyof T ? ValueFromPath : T extends readonly any[] diff --git a/packages/example/src/routes/form.tsx b/packages/example/src/routes/form.tsx index d2307b3..4e65251 100644 --- a/packages/example/src/routes/form.tsx +++ b/packages/example/src/routes/form.tsx @@ -20,8 +20,8 @@ class RegisterForm extends Effect.Service()("RegisterForm", { class RegisterPage extends Component.makeUntraced(function* RegisterPage() { const form = yield* RegisterForm - const emailInput = yield* Form.useInput(form, ["email"]) - const passwordInput = yield* Form.useInput(form, ["password"]) + const emailInput = yield* Form.useInput(form, ["email"], { debounce: "200 millis" }) + const passwordInput = yield* Form.useInput(form, ["password"], { debounce: "200 millis" }) yield* useFork(() => Stream.runForEach(form.valueRef.changes, Console.log), [])