AllowedTypes TypeAlias
Types for use in fields.
For more information about our API support guarantees, see here.
Signature
export type AllowedTypes = readonly LazyItem<TreeNodeSchema>[];
Remarks
Type constraint used in schema declaration APIs.
The order of types in the array is not significant. Additionally, it is legal for users of this type to have the runtime and compile time order of items within this array not match. Therefor to ensure type safety, these arrays should not be indexed, and instead just be iterated.
Ideally this restriction would be modeled in the type itself, but it is not ergonomic to do so as there is no easy (when compared to arrays) way to declare and manipulate unordered sets of types in TypeScript.
Duplicate entries in this array are not allowed and will produce runtime errors. Duplicate types are allowed, but this must only be reflected in the type and not the runtime values. This duplication can be used to encode the typing when the number of items in the array is not known at compile time but some of the items are known to be present unconditionally. For example, typing [typeof A] | [typeof A, typeof B]
as [typeof A, typeof B | typeof A]
is allowed, and can produce more useful Input types.