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.

Signature

/** @sealed */
class Array extends _APIExtractorWorkaroundArrayBase

Extends: _APIExtractorWorkaroundArrayBase

Remarks

This can be imported using TreeAlpha.importConcise.

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];