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
Optional runtype (which is generated by .optional() shorthand) doesn't work like that. As described in the error message, your tuple corresponds to [string, string | undefined] in TS's notation, that obviously doesn't accept ['Hello']. In such case you must use Union around two Tuples:
We've noticed recently that the naming of Optional is somewhat misleading, so we're planning to have it reporting a static error to the user when misused.
Hi!
i try to type arrays items
I use tuple record
const tuple = t.Tuple(t.String, t.String.optional())
And when i try to check array like:
tuple.check(['Hello'])
I get error
Failed constraint check for [string, string | undefined]: Expected length 2, but was 1
I expect optional parameters to be ignored
The text was updated successfully, but these errors were encountered: