mirror of
https://github.com/Effect-TS/effect.git
synced 2026-11-30 02:55:45 +08:00
4.5 KiB
4.5 KiB
Overview
Improve the JSDoc for packages/effect/src/Stream.ts so it is concise, consistent,
and accurate for Effect 4.x. This is a documentation-only pass focused on
summary clarity, category taxonomy, and example correctness.
Goals
- Standardize
@categorytags with a Stream-specific naming + casing scheme. - Tighten summaries to be clear and concise while preserving intent.
- Ensure one example per runtime export. Use discretion for type only exports.
- Do not change
@sincetags - Keep documentation consistent with current Stream idioms.
- Ensure
**Previously Known As:**notes are present where applicable. - Ensure usage of
Chunkin examples is replaced withArray, as the new version of effect Stream usesArrayas the collection type. APIs like Stream.runCollect already return Array, so you do not need to convert them with Array.from etc
Non-goals
- No runtime behavior or API changes.
- No changes outside
packages/effect/src/Stream.ts(other than this spec link). - No new features, refactors, or type-level changes.
Constraints
- Do not edit barrel files (
index.ts) or runpnpm codegen. - Keep existing section markers (
// =====) unchanged. - Not all exports require examples. Some type-only exports may only need a summary and tags.
- Focus on the exports that developers will use directly.
- Treat any
exported symbol inStream.tsas in scope. Ignore non-exported helpers. For re-exports or aliases, update docs at the declaration site inStream.tsonly.
Current Issues (Observed)
- Inconsistent
@categorycasing and naming (for example,modelsvsModels,type-levelvsType-Level,De-duplicationvsDeduplication). - Some summaries are verbose or redundant for well-known combinators.
- Examples vary in style (for example,
console.logvsConsole.log, or usingEffect.runPromisewhen no output is shown).
Documentation Approach
Category taxonomy
- Canonical list (Title Case):
- Accumulation
- Aggregation
- Broadcast
- Constants
- Constructors
- Deduplication
- Destructors
- Do Notation
- Encoding
- Error Handling
- Finalization
- Filtering
- Grouping
- Guards
- Interruption
- Mapping
- Merging
- Models
- Pipe
- Racing
- Rate Limiting
- Sequencing
- Services
- Tracing
- Type Lambdas
- Type-Level
- Zipping
- Normalize duplicates to the canonical name (for example,
type-leveltoType-Level,Do notationtoDo Notation). - If a new category is required, add it to this canonical list (Title Case) and normalize all usages to match.
Summary + detail format
- First line: one-sentence summary of the behavior.
- Second paragraph (if needed): key behavioral nuance or common usage pattern.
- Avoid repeating obvious type information already expressed in the signature.
Examples
- Before writing any examples, first understand the export's behavior and intended usage by consulting existing tests, docs, and source code.
- Prefer short, runnable snippets that compile with docgen.
- Include comments that clarify how the exported api is used / works.
- There should only be one example per export.
- Use
Effect.genfor sequencing, and only useEffect.runPromisewhen needed to demonstrate runtime behavior. - Prefer
Console.logoverconsole.logwhen demonstrating effectful logging. Important: Any log statements should have a comment indicating expected output. - Any output shown in comments should match actual runtime output (use the
scratchpad/for running examples as needed). - If you are not showing any output comments, do not use any Effect.run* calls in the example.
Tags
- Preserve existing
@sincevalues unless clearly incorrect. - When missing, align
@sincewith the nearest related export in the same section or operator family. If a section mixes versions, use the earliest version in that group unless the docs or tests indicate otherwise. - Ensure
@categoryis present and normalized. - Avoid adding
@param/@returnsunless the behavior is non-obvious.
Acceptance Criteria
- All
@categorytags inStream.tsuse a consistent naming and casing scheme. - Each public export has a concise summary and appropriate tags.
- Examples are consistent in style and compile via
pnpm docgen. - No API or runtime behavior changes.
- Section markers and barrel files remain untouched.
Validation
pnpm lint-fixpnpm test packages/effect/test/Stream.test.tspnpm check(if it fails, runpnpm cleanthen re-runpnpm check)pnpm buildpnpm docgen