From f1ab8a1af21082f03b15f58cd0c065a2aec9690e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Thu, 30 Apr 2026 01:41:46 +0200 Subject: [PATCH] Fix --- packages/effect-lens/README.md | 16 ++++++++-------- packages/effect-lens/package.json | 6 +----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/packages/effect-lens/README.md b/packages/effect-lens/README.md index 605da81..e7a7bad 100644 --- a/packages/effect-lens/README.md +++ b/packages/effect-lens/README.md @@ -36,13 +36,13 @@ Lens< ### Creating a Lens -#### From an exisiting type +#### From an existing type We provide a few helpers to create Lenses from some Effect types: ```typescript // The ref is the data source const ref = yield* SubscriptionRef.make([12, 87, 69]) -// The lens acts as a proxy that allows reading, subscribing from and writing to that +// The lens acts as a proxy that allows reading, subscribing to and writing to that // data source with a similar API to Effect's SubscriptionRef const lens = Lens.fromSubscriptionRef(ref) // ^ Lens.Lens @@ -54,7 +54,7 @@ yield* Lens.update(lens, Array.replace(1, 1664)) Currently available: - `fromSubscriptionRef` -- `fromSynchronizedRef` (note: since `SynchronizedRef` is not reactive (does not produces a stream of value changes), the resulting Lens' `changes` stream will only emit the current value of the lens when evaluated, and nothing else) +- `fromSynchronizedRef` (note: since `SynchronizedRef` is not reactive (does not produce a stream of value changes), the resulting Lens' `changes` stream will only emit the current value of the lens when evaluated, and nothing else) More to come! @@ -110,7 +110,7 @@ Lens<{ readonly a: string, readonly b: number }, never, never, never, never> Lens ``` -Focuses Lenses work just the same as a Lens that points directly to a data source and can be read, subscribed to or written to. +Focused Lenses work just the same as a Lens that points directly to a data source and can be read, subscribed to or written to. Writing to them will properly update parent Lenses or data sources. Such updates can be performed in both a mutable or an immutable manner depending on your choice. @@ -141,7 +141,7 @@ const jeanDupontLens = ref.pipe( Lens.focusObjectOn("users"), // Creates a focused lens that points to the users field Lens.focusArrayAt(0), // Creates a focused lens that points to the first entry of the user array ) -// Reading or writing from this lense can fail with NoSuchElementException +// Reading or writing from this lens can fail with NoSuchElementException // This is because of Lens.focusArrayAt(0), as reading and writing to an array is an unsafe operation const jeanDupont = yield* Lens.get(jeanDupontLens) @@ -211,7 +211,7 @@ const someFunctionThatShouldOnlyHaveReadonlyAccessToTheState = ( // Do whatever const usersCountSub = Subscribable.map(usersSub, a => a.length) const users = yield* usersSub.get - yield* Effect.forkScoped(Stream.runForEach(users.changes, ...)) + yield* Effect.forkScoped(Stream.runForEach(usersSub.changes, ...)) }) const lens = ref.pipe( @@ -226,9 +226,9 @@ This library re-exports Effect's `Subscribable` module and adds a few transforms ```typescript import { Subscribable } from "effect-lens" -declare const sub: Subscribabe.Subscribable +declare const sub: Subscribable.Subscribable -// \/ Subscribabe.Subscribable +// \/ Subscribable.Subscribable const nameSub = sub.pipe( Subscribable.focusArrayAt(1), Subscribable.focusObjectOn("name"), diff --git a/packages/effect-lens/package.json b/packages/effect-lens/package.json index 5e3a238..098c20b 100644 --- a/packages/effect-lens/package.json +++ b/packages/effect-lens/package.json @@ -1,7 +1,7 @@ { "name": "effect-lens", "description": "An effectful Lens type to easily manage nested state", - "version": "0.1.4", + "version": "0.1.5", "type": "module", "files": [ "./README.md", @@ -21,10 +21,6 @@ "types": "./dist/Lens.d.ts", "default": "./dist/Lens.js" }, - "./PropertyPath": { - "types": "./dist/PropertyPath.d.ts", - "default": "./dist/PropertyPath.js" - }, "./Subscribable": { "types": "./dist/Subscribable.d.ts", "default": "./dist/Subscribable.js"