Releases: RateGravity/type-shift
v0.4.0
What's Changed
- Update 'none' converter types to be more explicit by @RoboCafaz in #55
Full Changelog: v0.3.1...v0.4.0
v0.3.1
No changes, retriggering the release after switch to GitHub actions/NPM
v0.3.0
What's Changed
- Proposal: Do not allow
shape
orstrict
converters to omit optional fields. by @RoboCafaz in #45
Full Changelog: v0.2.3...v0.3.0
Allow readonly arrays to be used for `t.oneOf`
What's Changed
- Allow readonly arrays to be used for
t.oneOf
by @RoboCafaz in #46
New Contributors
- @RoboCafaz made their first contribution in #46
Full Changelog: v0.2.2...v0.2.3
Fix ConverterError not setting a name
Thrown converter errors will now have their error name as "ConverterError".
Fix Relative Parent Path
When using t.forPath
with only parent paths we jumped to the root object, this is both wrong and non-intuitive. Now we go up the number of steps that are requested.
Create generic functionality for coercing values
To handle empty values (null
/undefined
) there is now a None
data type, which is exposed as a primitive t.none
. When creating an optional parameter that can take null
or undefined
you can use t.noneable(t.string)
. If you would like to coerce that value to null
or undefined
you can use t.noneableAsNull
and t.noneableAsUndefined
respectively.
Improvements to Or Joined Errors
Errors with or
joins now try to select which branch to report an error from.
Where possible using a tagged union is still preferred.
Updates to Optional to make Errors Better
Optionals are no longer backed by an or
join which was hiding the real error.
Fixes to Exported Typing
Fixes the export of the Null Converter.