Skip to content

ChainGraph API Documentation / @badaitech/chaingraph-types / PortArrayNested

Function: PortArrayNested()

PortArrayNested(depth, itemConfig, config?): PropertyDecorator

Defined in: packages/chaingraph-types/src/decorator/array.decorator.ts:155

PortArrayNested decorator creates a nested array port.

This decorator wraps the base

Parameters

depth

number

The number of nested array levels (must be at least 1).

itemConfig

any

The configuration for the innermost port (non-array type) that populates the nested array.

config?

Omit<Omit<ArrayPortConfig<any>, "itemConfig"> & object, "type" | "itemConfig">

Optional additional configuration for the outer array port (excluding type and itemConfig).

Returns

PropertyDecorator

Port Array

decorator and recursively constructs a nested array configuration. The parameter depth defines how many levels of nested arrays should be created.

If depth is 1, the decorator is equivalent to

Port Array

with the supplied itemConfig. For greater depths, it wraps the itemConfig in successive array-port configurations.

Example usage: // Define a 2D array of numbers: @PortArrayNested(2, { type: 'number', defaultValue: 0 }, { defaultValue: [[0, 0]] }) public matrix!: number[][];

// Define a 3D array of strings: @PortArrayNested(3, { type: 'string', defaultValue: '' }) public nestedStrings!: string[][][];

Licensed under BUSL-1.1