Skip to main content

Members Interface

Members for classes created by createSchema(types, inputSchemaFactory, name).

This API is provided as a beta preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

interface Members<T>

Type Parameters

ParameterDescription
T

Properties

PropertyAlertsModifiersTypeDescription
unionBetareadonlyT | undefinedThe child wrapped by this node has one of the types allowed by the union, or undefined if the type is one which was added to the union by a future version of this schema.

Methods

MethodAlertsReturn TypeDescription
isValid()BetabooleanReturns true, unless this node is in an invalid state.

Property Details

union

The child wrapped by this node has one of the types allowed by the union, or undefined if the type is one which was added to the union by a future version of this schema.

This API is provided as a beta preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

readonly union: T | undefined;

Type: T | undefined

Error Handling

if isValid() is false.

Method Details

isValid

Returns true, unless this node is in an invalid state.

This API is provided as a beta preview and may change without notice.

For more information about our API support guarantees, see here.

Signature

isValid(): boolean;

Remarks

A well behaved application should not need this API. If an application is hitting errors when accessing union, this API can be used to help detect and recover from the invalid state which causes those errors (for example by replacing the invalid nodes with new ones).

In this context "invalid" means that the internal implementation details of this node have had their invariants violated. This can happen when: - Using weakly typed construction APIs like importConcise(schema, data) or importVerbose(schema, data, options) to construct an invalid state directly. Using such APIs, even when not creating invalid nodes, is not supported for this schema, since doing so requires knowing the implementation details of this node which are subject to change. - By editing a document using a different client using a different schema for this node. - Violating the TypeScript types to directly manipulate the node internals. - A bug in this node's implementation (possibly in a different client) corrupted the node. - Corruption of the document this node is contained in.

Returns

Return type: boolean