typebox#2
Draft
mmkal wants to merge 4 commits into
Draft
Conversation
commit: |
Add schematch/typebox as a named-match entrypoint so TypeBox Script string overloads only load for consumers who opt into the optional peer dependency.
Remove TypeBox configuration and overloads from the root match export, and update the TypeBox examples/tests to import {match} from schematch/typebox.
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.
Summary
Adds a TypeBox-specific entrypoint for TypeScript-string cases and introduces clearer throwing terminals for matcher chains.
Consumers who install the optional
typeboxpeer can import fromschematch/typeboxand use TypeBoxScript(...)strings directly in.case(...). The rootschematchentrypoint stays TypeBox-free, so projects that do not installtypeboxdo not resolve TypeBox types.TypeBox strings are parsed with
Script(...), compiled lazily with TypeBox's schema compiler, and TypeBox validation errors are surfaced throughMatchError/ Standard Schema issues.API Notes
schematch/typeboxwith a namedmatchexport.schematchentrypoint..case(...)overloads for inline and reusable matchers in the TypeBox entrypoint..orThrow()as the readable equivalent of.default(match.throw)..exhaustive()as the readable equivalent of.default<never>(match.throw)..default(...)available for fallback handlers and values.Verification
pnpm vitest run tests/high-level/typebox.test.ts --typecheckpnpm testpnpm buildpnpm attw