Add Subscribable.focusTupleAt
All checks were successful
Lint / lint (push) Successful in 11s

This commit is contained in:
Julien Valverdé
2026-03-27 14:21:30 +01:00
parent d2e4875b8a
commit 9f5b65c2c2

View File

@@ -36,6 +36,22 @@ export const focusArrayAt: {
index: number,
): Subscribable.Subscribable<A[number], E | NoSuchElementException, R> => Subscribable.mapEffect(self, Array.get(index)))
/**
* Narrows the focus to an indexed element of a readonly tuple.
*/
export const focusTupleAt: {
<T extends readonly [any, ...any[]], I extends number, E, R>(
self: Subscribable.Subscribable<T, E, R>,
index: I,
): Subscribable.Subscribable<T[I], E, R>
<T extends readonly [any, ...any[]], I extends number, E, R>(
index: I
): (self: Subscribable.Subscribable<T, E, R>) => Subscribable.Subscribable<T[I], E, R>
} = Function.dual(2, <T extends readonly [any, ...any[]], I extends number, E, R>(
self: Subscribable.Subscribable<T, E, R>,
index: I,
): Subscribable.Subscribable<T[I], E, R> => Subscribable.map(self, Array.unsafeGet(index)))
/**
* Narrows the focus to an indexed element of `Chunk`.
*/