Skip to main content

Array Class

Arbitrary JSON array as a TreeNode.

This API is provided as an alpha preview and may change without notice.

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

Sealed

This type is "sealed," meaning that code outside of the library defining it should not implement or extend it. Future versions of this type may add members or make typing of readonly members more specific.

Signature

/** @sealed */
class Array extends _APIExtractorWorkaroundArrayBase

Extends: _APIExtractorWorkaroundArrayBase

Remarks

This can be imported using importConcise(schema, data).

Example

// Due to TypeScript restrictions on recursive types, the constructor can be somewhat limiting.
const usingConstructor = new JsonAsTree.Array(["a", 0, new JsonAsTree.Array([1])]);
// Using `importConcise` can work better for JSON data:
const imported = TreeAlpha.importConcise(JsonAsTree.Array, ["a", 0, [1]]);
// Node API is like an Array:
const inner: JsonAsTree.Tree = imported[2];
assert(Tree.is(inner, JsonAsTree.Array));
const leaf = inner[0];