Closed jacobfike closed 1 year ago
It's not possible to use functions for prop types, because Pastel staticly analyzes your source code and scans for PropTypes.string
, PropTypes.number
and others.
Pastel 2.0 just shipped which now uses Zod for options/arguments validation and parsing. It'll now definitely fail if input doesn't match the schema you defined.
When using the functional form of propTypes to do some conditional prop checking, errors result in a warning printed but do not prevent rendering like when a
.isRequired
prop is missing.As an example, I want the
serviceName
andnewSchema
props to be linked such that if you provide neither it is ok, but if you provide one of them, you MUST provide both. I tried the following:But this results only in a warning being displayed and does not prevent the command from running. The warning looks like this:
I would expect this to act like a required prop being omitted, resulting in the help text for the command being displayed with a message about which required prop is missing.