simple-runtypes
Advanced tools
Changelog
6.0.0
useRuntype
to return a ValidationResult
to support using runtypes
without relying on exceptions and win in benchmarksfail
to createError
isFail
private, use ValidationResult.ok
insteadChangelog
5.0.2
fail
to not return any
but Fail
Now, custom runtypes will result in the correct inferred type of
Runtype<T>
instead of Runtype<any>
for custom runtypes that might return
a failure.Changelog
5.0.0
useRuntype
to call other runtypes in custom runtypesenumValue
to enum
discriminatedUnion
- use the normal union
instead.
The discriminant key
gets inferrred automatically by union
now.Changelog
4.1.0
sloppyRecord
(props to @pabra)undefined
and null
runtypes (props to @pabra)Changelog
4.0.1
string
and integer
due to missing return type annotationsChangelog
4.0.0
stringIndex
and numberIndex
now err on "__proto__"
and Symbol
keysChangelog
3.0.0
string
, number
, integer
, stringAsInteger
and array
runtypesstringAsInteger
to accept '-0'
and '+123'
(leading plus) as valid integer stringsChangelog
2.0.0
.check
and make user invocations of runtypes throw exceptions
(using .check
turned out to be a major annoyance and I forgot it in almost
half of my code bc typescript does not warn me)runtype
to create custom runtypesRuntypeUsageError
, thrown when the api is misusedgetFormattedError
, getFormattedErrorPath
and
getFormattedErrorValue
functions to extract information from
RuntypeError