Included Types


A simple string => string type. Useful for option and positional arguments


A simple boolean => boolean type. Useful for flag


A string => number type. Checks that the input is indeed a number or fails with a descriptive error message.


Takes a type and makes it nullable by providing a default value of undefined


Tries to decode the types provided until it succeeds, or throws all the errors combined. There's an optional configuration to this function:

  • combineErrors: function that takes a list of strings (the error messages) and returns a string which is the combined error message. The default value for it is to join with a newline: xs => xs.join("\n").

oneOf(["string1", "string2", ...])

Takes a closed set of string values to decode from. An exact enum.