Repository navigation
Conversation
sinclairzx81
force-pushed
the
main
branch
2 times, most recently
from
October 17, 2026 10:45
ea3655a to
54ab51d
Compare
This branch has not been deployed
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.
Value.EncodeandEncodeUnsafenow try union members that accept the unencoded value first (src/value/codec/from_union.ts).For
Union([Codec, Null]), anullinput returnsnullwithout a call to the codec's encoder.Previously, a strict codec could throw, while a JSON codec could return the string
"null".Each member attempt receives a clone and must produce output that passes that member's check.
The fallback handles decoded Date and object values that do not match a member before encoding.
The fallback skips members already attempted in the first pass.
Union([Codec(String), Number])now encodes numeric5as5when the codec decodes to numbers.Previously, that codec could return
"5"first.The extra input checks can increase validation cost.
The strict Date and JSON null regressions in
test/typebox/runtime/value/codec/union.tsfail with the merge-base source and pass with this change.Fixes #1706.