docs: fix foldWeightedDecompose example to type-check and terminate#6290
Open
Nicoreia wants to merge 1 commit into
Open
docs: fix foldWeightedDecompose example to type-check and terminate#6290Nicoreia wants to merge 1 commit into
Nicoreia wants to merge 1 commit into
Conversation
The JSDoc example for `Sink.foldWeightedDecompose` used the old positional-argument API (hidden behind `skip-type-checking`) and a `decompose` function that never produced indivisible values, so the example failed to type-check and hung at runtime (reported in Effect-TS#5055). Rewrite it using the current object-style API and a terminating `decompose`, and drop `skip-type-checking` so docgen validates the example going forward. It still emits Chunk(1), Chunk(4), Chunk(1, 1).
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The JSDoc example for
Sink.foldWeightedDecomposeused the old positional-argumentAPI (hidden behind
```ts skip-type-checking) together with adecomposefunctionthat never produced indivisible values. As a result the example failed to type-check
and hung at runtime — the behaviour reported in #5055.
This rewrites the example using the current object-style API and a terminating
decompose, and removesskip-type-checkingso@effect/docgenvalidates theexample going forward. The documented output —
Chunk(1), Chunk(4), Chunk(1, 1)—is unchanged.
Changes
packages/effect/src/Sink.ts— replace thefoldWeightedDecomposedoc example(comment-only; no runtime/behaviour code touched).
Tests
Verified the corrected example in isolation against the published
effectpackage:tsc --noEmit --strict→ passes (equivalent to docgen's example type-check)tsx→ terminates and prints[[1],[4],[1,1]], i.e.Chunk(1), Chunk(4), Chunk(1, 1)as documented@effect/docgencould not be run locally in my environment; it will run in CI.Happy to add a changeset if the project requires one for doc-only changes.
Resolves #5055
🤖 This PR was prepared with the assistance of AI tooling (Claude) and reviewed by a
human before submission.