Skip to content
Discussion options

You must be logged in to vote

@free-mana Hi,

I've looked through the documentation, and found types that convert to JSON Schema's anyOf and allOf keywords, but so far I have not been able to find a type that converts to the oneOf keyword. Has such a thing been implemented?

TypeBox doesn't provide a Type.* function to create oneOf schematics by default because TypeScript has no concept of XOR. TypeScript only supports OR (Union) and AND (Intersect) logical type expressions. This said, it is still technically possible to create oneOf schematics in the following way...

TypeScript Link Here

import Type from 'typebox'

// ------------------------------------------------------------------
// UnionExclusiveOr
// ----------…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@free-mana
Comment options

Answer selected by free-mana
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants