Union Types (anyOf)
Members that accept more than one type, via anyOf.
id: { any, anyOf: [string, int] }
---
~ 42 # ✓ matches int
~ abc # ✓ matches stringflag: { any, anyOf: [bool, int] }
---
~ T # ✓
~ hello # ✗ matches neitherConstrained and structured alternatives
value: { any, anyOf: [ { int, multipleOf: 5 }, { int, multipleOf: 3 } ] }
---
~ 10 # ✓ multiple of 5
~ 9 # ✓ multiple of 3Guidance
See Also
Last updated
Was this helpful?
