Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loosen the is check for optionalized #737

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

bitgopatmcl
Copy link
Contributor

The breaking change at 06eddbb introduced a codec that bahaves like partial but strips explicit undefined properties when decoding and encoding. This is only used by optionalized, and it turns out it is broken at runtime, particularly in codebases that don't set exactOptionalPropertyTypes. It defaults to off, and much code treats "key not present" and "key set to undefined" interchangeably. Some combinators in io-ts such as union rely on is to determine which codec to use when encoding, so when an optionalized codec is used in a union, and is passed an object with defined-undefined properties to encode, it results in an exception. This change fixes that by loosening up the runtime is check.

BREAKING CHANGE: explicit undefined properties are now accepted by optionalized.is

BREAKING CHANGE: explicit undefined properties are now accepted when encoding
@bitgopatmcl bitgopatmcl marked this pull request as ready for review April 12, 2024 16:26
@bitgopatmcl bitgopatmcl requested a review from a team as a code owner April 12, 2024 16:26
@bitgopatmcl bitgopatmcl merged commit 4d3e641 into BitGo:master Apr 12, 2024
10 checks passed
@bitgopatmcl bitgopatmcl deleted the looser-exact-optional-check branch April 12, 2024 17:44
Copy link

🎉 This PR is included in version @api-ts/[email protected] 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version @api-ts/[email protected] 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version @api-ts/[email protected] 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version @api-ts/[email protected] 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Copy link

🎉 This PR is included in version @api-ts/[email protected] 🎉

The release is available on npm package (@latest dist-tag)

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants