You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The trick is to wrap your bigIntRuntype function with the runtype constructor.
Using plain functions that throw errors is too slow. So simple-runtypes internal return type is a wrapped value. runtype allows you to construct functions that follow that pattern.
Have you tried the example from the README? It shows how to implement a basic BigInt runtype.
How can I use custom runtimes (that transform a value into another type) with other runtypes?
For example, if I wanted to verify an optional BigInt type:
This would fail because
bigIntRuntype()
returnsbigint
whereasst.optional()
expectsRuntype<unknown>
as a parameter.With the built-in runtypes, it works. Example:
The text was updated successfully, but these errors were encountered: