Skip to content

docs: fix foldWeightedDecompose example to type-check and terminate#6290

Open
Nicoreia wants to merge 1 commit into
Effect-TS:mainfrom
Nicoreia:docs/fix-foldweighteddecompose-example
Open

docs: fix foldWeightedDecompose example to type-check and terminate#6290
Nicoreia wants to merge 1 commit into
Effect-TS:mainfrom
Nicoreia:docs/fix-foldweighteddecompose-example

Conversation

@Nicoreia

Copy link
Copy Markdown

Summary

The JSDoc example for Sink.foldWeightedDecompose used the old positional-argument
API (hidden behind ```ts skip-type-checking) together with a decompose function
that 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 removes skip-type-checking so @effect/docgen validates the
example going forward. The documented output — Chunk(1), Chunk(4), Chunk(1, 1)
is unchanged.

Changes

  • packages/effect/src/Sink.ts — replace the foldWeightedDecompose doc example
    (comment-only; no runtime/behaviour code touched).

Tests

Verified the corrected example in isolation against the published effect package:

  • tsc --noEmit --strict → passes (equivalent to docgen's example type-check)
  • runtime via tsx → terminates and prints [[1],[4],[1,1]], i.e.
    Chunk(1), Chunk(4), Chunk(1, 1) as documented

@effect/docgen could 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.

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).
@Nicoreia Nicoreia requested a review from mikearnaldi as a code owner June 27, 2026 00:18
@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Jun 27, 2026
@changeset-bot

changeset-bot Bot commented Jun 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2f186a7

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

foldWeightedDecompose example in docs is not working.

1 participant