ChatiumFor developersPlaygroundPricing
Sign in

Heap.Undefined

Declares a field of type undefined.

The practical application is very limited and not recommended, as undefined cannot be serialized to JSON. In most cases, it is more appropriate to use Heap.Null or Heap.Optional instead of Heap.Undefined.

You can declare an array with elements of type Heap.Union that includes Heap.Undefined as one of the alternatives. In this scenario, if Heap.Null is not among the alternatives, the serialized value null will be deserialized to undefined.

Usage/Signature

import { Heap } from '@app/heap'
Heap.Undefined()
  • Return Value:
    • An "empty" JSON schema with type=undefined (undefined is not a type supported by the standard JSON schema).

Examples


An array of 9 integers, where some cells are undefined.

const sudokus = Heap.Table('sudokus', {
  row1: Heap.Array(
    Heap.Union([
      Heap.Integer({ minimum: 1, maximum: 9 }),
      Heap.Undefined(),
    ]),
    { minItems: 9, maxItems: 9 },
  ),
})