Skip to content

docs: document all 19 modules + fix(types): make documented patterns compile - #8

Merged
senrecep merged 2 commits into
mainfrom
docs/modules-and-type-fixes
Aug 3, 2026
Merged

docs: document all 19 modules + fix(types): make documented patterns compile#8
senrecep merged 2 commits into
mainfrom
docs/modules-and-type-fixes

Conversation

@senrecep

@senrecep senrecep commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Summary

Two commits:

fix(types) — type-only, zero runtime change, 1079/1079 tests pass

  • Union.match/is/get/partition/groupBy now infer from the union value (U extends { tag; value }) instead of Union<T>, which the compiler cannot invert. The documented destructuring match pattern previously did not compile against the published d.ts under strict mode.
  • These.isLeft/isRight/isBoth are now narrowing type guards.
  • Eq.struct / Ord.struct accept interfaces (A extends object).
  • tsconfig.test.json: the inherited exclude: ["tests"] nullified its include, so tests were never typechecked. Fixed, plus vitest/globals types. (~67 pre-existing test type errors are now visible; tracked as follow-up, runtime tests unaffected.)
  • JSDoc examples in function/record/these/union corrected to versions that compile.

docs — all four docs updated, every example verified

  • CLAUDE.md: adds the 8 previously undocumented modules (function, eq, ord, predicate, array, these, tree, record).
  • README.md: full API coverage for the fp modules; fixes the These, Union.of, fromAsync, and bindIfAsync examples; documents the as Shape literal pattern (assignment narrowing breaks exhaustive match).
  • AGENTS.md: string module, HttpCodes, Result.traverse, Union.partition/groupBy, pattern sections for the fp modules, new pitfall rows.
  • docs/index.html: tsentials/string card + example, self-contained snippets, Context7 chat widget.
  • Prose pass: dash-spliced sentences and clipped fragments rewritten as plain sentences.

Verification

Every example was extracted into a scratch project, installed from the npm pack tarball, typechecked with strict + exactOptionalPropertyTypes + noUncheckedIndexedAccess, and executed with runtime assertions. Repo: build, 1079 tests, biome, and src typecheck all green.

Note: npm's 0.1.10 still ships the old (broken) Union typings — a 0.1.11 release is needed for consumers to get the fix.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com

senrecep and others added 2 commits August 3, 2026 14:36
Type-only changes — zero runtime behavior change, all 1079 tests pass.

- Union.match/is/get/partition/groupBy: infer from the union value
  (U extends { tag; value }) instead of Union<T>, which the compiler
  cannot invert — the documented destructuring match pattern previously
  failed to compile against the published d.ts under strict mode
- These.isLeft/isRight/isBoth: now type guards that narrow to the
  Left/Right/Both member
- Eq.struct / Ord.struct: constraint relaxed to A extends object so
  interfaces are accepted (Record<string, unknown> rejected them)
- tsconfig.test.json: inherited exclude nullified the tests include, so
  tests were never typechecked; add explicit exclude + vitest/globals
- tests: adapt union tests to as-Shape literals (assignment narrowing),
  fix noUncheckedIndexedAccess access in these tests
- JSDoc examples in function/record/these/union corrected to versions
  that actually compile (verified against the packaged build)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
All code examples were extracted, typechecked (strict +
exactOptionalPropertyTypes + noUncheckedIndexedAccess) and executed
against the npm-packed build.

- CLAUDE.md: add the 8 previously undocumented modules (function, eq,
  ord, predicate, array, these, tree, record) with API reference
- README.md: expand fp module sections to full API; fix These example
  (toResult needs These<AppError[], A>), Union.of example, and the
  fromAsync/bindIfAsync signatures shown; document the as-Shape
  literal pattern for exhaustive Union.match
- AGENTS.md: add string module, HttpCodes, Result.traverse,
  Union.partition/groupBy, pattern sections for the 8 fp modules, and
  new naming-pitfall rows (assignment narrowing, These error arrays,
  fromAsync takes Promise<Result<T>>)
- docs/index.html: add tsentials/string module card and case-conversion
  example, make snippets self-contained, fix the These/Ord/Maybe/Rules
  examples, embed the Context7 chat widget
- prose pass: rewrite dash-spliced sentences and clipped fragments into
  plain sentences across all four files

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@senrecep
senrecep merged commit 77a2c87 into main Aug 3, 2026
7 checks passed
@senrecep
senrecep deleted the docs/modules-and-type-fixes branch August 3, 2026 11:39
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@senrecep senrecep mentioned this pull request Aug 3, 2026
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.

1 participant