0.1.3 #4

Merged
Thilawyn merged 90 commits from next into master 2025-08-23 03:07:28 +02:00
2 changed files with 21 additions and 9 deletions
Showing only changes of commit 1c1659e82c - Show all commits

View File

@@ -105,14 +105,26 @@ export const makeFromPath = <
(parentValue, value) => Option.getOrThrow(PropertyPath.immutableSet(parentValue, path, value)), (parentValue, value) => Option.getOrThrow(PropertyPath.immutableSet(parentValue, path, value)),
) )
export const makeFromChunkRef = <A, B extends SubscriptionRef.SubscriptionRef<Chunk.Chunk<any> | Chunk.NonEmptyChunk<any>>>( export const makeFromChunkRef: {
<B extends SubscriptionRef.SubscriptionRef<Chunk.NonEmptyChunk<any>>>(
parent: B,
index: number,
): SubscriptionSubRef<
Effect.Effect.Success<B> extends Chunk.NonEmptyChunk<infer A> ? A : never,
B
>
<B extends SubscriptionRef.SubscriptionRef<Chunk.Chunk<any>>>(
parent: B, parent: B,
index: number, index: number,
): SubscriptionSubRef< ): SubscriptionSubRef<
Effect.Effect.Success<B> extends Chunk.Chunk<infer A> ? A : never, Effect.Effect.Success<B> extends Chunk.Chunk<infer A> ? A : never,
B B
> => new SubscriptionSubRefImpl( >
parent as SubscriptionRef.SubscriptionRef<Chunk.Chunk<any>>, } = (
parent: SubscriptionRef.SubscriptionRef<Chunk.Chunk<any>>,
index: number,
) => new SubscriptionSubRefImpl(
parent,
parentValue => Chunk.unsafeGet(parentValue, index), parentValue => Chunk.unsafeGet(parentValue, index),
(parentValue, value) => Chunk.replace(parentValue, index, value), (parentValue, value) => Chunk.replace(parentValue, index, value),
) as any ) as any

View File

@@ -10,8 +10,8 @@ import * as React from "react"
const RouteComponent = Component.make(function* RouteComponent() { const RouteComponent = Component.make(function* RouteComponent() {
const [value, setValue] = React.useState("") const [value, setValue] = React.useState("")
const myRef = yield* SubscriptionRef.make(Chunk.make({ name: "person 1" } as const)) // const myRef = yield* SubscriptionRef.make(Chunk.make({ name: "person 1" } as const))
// const myRef = yield* SubscriptionRef.make(Chunk.empty<{ readonly name: "person 1" }>()) const myRef = yield* SubscriptionRef.make(Chunk.empty<{ readonly name: "person 1" }>())
const mySubRef = SubscriptionSubRef.makeFromChunkRef(myRef, 0) const mySubRef = SubscriptionSubRef.makeFromChunkRef(myRef, 0)
return ( return (