From 0de3256692a6fa6b8be06f2e6a683239ac4a4311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Mon, 30 Mar 2026 17:00:38 +0200 Subject: [PATCH] Apply dual API --- packages/effect-fc/src/Form.ts | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/packages/effect-fc/src/Form.ts b/packages/effect-fc/src/Form.ts index 1a2196e..5c37310 100644 --- a/packages/effect-fc/src/Form.ts +++ b/packages/effect-fc/src/Form.ts @@ -1,4 +1,4 @@ -import { Array, Cause, Chunk, type Context, type Duration, Effect, Equal, Exit, Fiber, identity, Option, ParseResult, Pipeable, Predicate, Schema, type Scope, Stream } from "effect" +import { Array, Cause, Chunk, type Context, type Duration, Effect, Equal, Exit, Fiber, Function, identity, Option, ParseResult, Pipeable, Predicate, Schema, type Scope, Stream } from "effect" import type * as React from "react" import * as Component from "./Component.js" import * as Lens from "./Lens.js" @@ -246,7 +246,15 @@ const filterIssuesByPath = ( issue.path.length >= path.length && Array.every(path, (p, i) => p === issue.path[i]) ) -export const focusObjectField =

( +export const focusObjectField: { +

( + self: Form, + key: K, + ): Form +

( + key: K, + ): (self: Form) => Form +} = Function.dual(2,

( self: Form, key: K, ): Form => { @@ -262,9 +270,17 @@ export const focusObjectField =

( +export const focusArrayAt: { +

( + self: Form, + index: number, + ): Form +

( + index: number, + ): (self: Form) => Form +} = Function.dual(2,

( self: Form, index: number, ): Form => { @@ -280,7 +296,7 @@ export const focusArrayAt =