docs(core): surface the fluent combinators in the API reference via the guide#66
Merged
Merged
Conversation
The method surface (map, flatMap, bind, match, unwrap, …) was authored on an internal ResultMethods type marked @internal and excluded via intentionallyNotExported, so TypeDoc dropped it. Because Result/AsyncResult are discriminated-union aliases (which can't carry a method list), the combinators appeared nowhere in the generated API reference. - Export ResultMethods<T, E> and a new parallel AsyncResultMethods<T, E> as the single documented home for the combinators (@category Types); Result/AsyncResult type docs {@link} them. - Set an explicit categoryOrder in the core typedoc.json (Facade → Types → Constructors → … then Aggregate, Errors) so the core surface leads the API reference instead of the default alphabetical order. - Add a "Why this matters more with AI in the loop" section to the Why unthrown? guide: explicit errors move failure detection to author-time type checking, shortening the LLM feedback loop; the defect channel keeps E a precise contract. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes a documentation gap in the @unthrown/core generated API reference by giving the Result/AsyncResult fluent combinator method surface a dedicated, exportable TypeDoc “home”, and by reordering categories so the core surface is easier to find.
Changes:
- Export and document
ResultMethods<T, E>and introduce/exportAsyncResultMethods<T, E>so TypeDoc can render the fluent combinator tables. - Configure TypeDoc category ordering to prioritize core API sections (Facade/Types/Constructors/Interop/…).
- Extend the “Why unthrown?” guide and contributor docs, and add a changeset for the new public type exports.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/typedoc.json | Adds explicit categoryOrder and stops excluding ResultMethods from generated docs. |
| packages/core/src/types.ts | Makes ResultMethods public and factors async combinators into AsyncResultMethods for documentation. |
| packages/core/src/index.ts | Re-exports ResultMethods and AsyncResultMethods as public type exports. |
| packages/core/src/facade.ts | Cross-links Result/AsyncResult docs to the new method-surface types. |
| docs/guide/why-unthrown.md | Adds a new guide section explaining the value of explicit errors with AI-assisted development. |
| CLAUDE.md | Updates contributor documentation to reflect the new TypeDoc structure and exported method-surface types. |
| .changeset/document-combinator-surface.md | Adds a minor changeset documenting the new public type exports and doc improvements. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
btravers
added a commit
that referenced
this pull request
Jul 6, 2026
Address Copilot review on #67: the changeset said "no type changes", but the diff removes the ResultMethods / AsyncResultMethods exports #66 added. Reword to state that plainly and note the exports were never released, so the published type surface is unaffected (patch bump stands). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
btravers
added a commit
that referenced
this pull request
Jul 6, 2026
…hod type Follow-up to #66. That PR exposed ResultMethods + AsyncResultMethods as public types so the combinators would render in the generated API reference — but since Result/AsyncResult are discriminated-union aliases, TypeDoc can't hang a method list off the type, so this split the surface into two near-duplicate method blocks a hop away from the type you landed on. Instead, keep the method surface internal and point at the guide: - Revert the ResultMethods/AsyncResultMethods exports (ResultMethods back to @internal + intentionallyNotExported; AsyncResult's methods inline again). - The Result/AsyncResult type docs link to the intent-organized "Choosing a combinator" guide, which already covers both in one shared table. The categoryOrder reordering and the "AI in the loop" guide section from #66 are unchanged. No runtime or public-type surface changes beyond removing the two type exports #66 added; changeset downgraded minor -> patch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
btravers
added a commit
that referenced
this pull request
Jul 6, 2026
Address Copilot review on #67: the changeset said "no type changes", but the diff removes the ResultMethods / AsyncResultMethods exports #66 added. Reword to state that plainly and note the exports were never released, so the published type surface is unaffected (patch bump stands). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Why
Someone looking for
flatMap(or any combinator) in the generated API reference found nothing.Result/AsyncResultare discriminated-union aliases, and TypeDoc can't list a method surface on a union alias — so the combinators (map,flatMap,bind,match,unwrap, …) rendered nowhere.Approach
The fix is not to expose a standalone method type. Doing so would split and double the surface — a near-identical
ResultMethodsandAsyncResultMethodsblock, each a hop away from the type you actually landed on — when the mental model (and the guide) is that there's one shared method surface. Instead:Result/AsyncResulttype docs now point at the intent-organized Choosing a combinator guide, which already documents both in one table.ResultMethodsstays@internal.typedoc.jsonsets an explicitcategoryOrder(Facade→Types→Constructors→ … thenAggregate,Errors). Default alphabetical order had putAggregate(all/allFromDict) first, burying the core surface.Ea precise contract worth checking.No runtime or public-type changes —
index.tsis net-unchanged;types.tsis a one-line doc tweak. Changeset ispatch.Verification
All gates green:
format --check,lint,typecheck,knip,test,build.build:docsis warning-free and the VitePress site builds cleanly (the API→guide dead-link check passes).🤖 Generated with Claude Code