Skip to content

docs(core): surface the fluent combinators in the API reference via the guide#66

Merged
btravers merged 1 commit into
mainfrom
docs/document-combinator-surface
Jul 6, 2026
Merged

docs(core): surface the fluent combinators in the API reference via the guide#66
btravers merged 1 commit into
mainfrom
docs/document-combinator-surface

Conversation

@btravers

@btravers btravers commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Why

Someone looking for flatMap (or any combinator) in the generated API reference found nothing. Result / AsyncResult are 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 ResultMethods and AsyncResultMethods block, 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:

  • Link to the guide. The Result / AsyncResult type docs now point at the intent-organized Choosing a combinator guide, which already documents both in one table. ResultMethods stays @internal.
  • Reorder the reference. The core typedoc.json sets an explicit categoryOrder (FacadeTypesConstructors → … then Aggregate, Errors). Default alphabetical order had put Aggregate (all/allFromDict) first, burying the core surface.
  • New guide section. Why unthrown? gains "Why this matters more with AI in the loop": explicit errors move failure detection to author-time type checking (shortening the LLM generate→run→retry loop), and the defect channel keeps E a precise contract worth checking.

No runtime or public-type changes — index.ts is net-unchanged; types.ts is a one-line doc tweak. Changeset is patch.

Verification

All gates green: format --check, lint, typecheck, knip, test, build. build:docs is warning-free and the VitePress site builds cleanly (the API→guide dead-link check passes).

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings July 6, 2026 16:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/export AsyncResultMethods<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 btravers merged commit 3fb471b into main Jul 6, 2026
12 checks passed
@btravers btravers deleted the docs/document-combinator-surface branch July 6, 2026 16:51
@btravers btravers changed the title feat(core): document the fluent combinator surface in the API reference docs(core): surface the fluent combinators in the API reference via the guide Jul 6, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants