Skip to content

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

Function: PortArray()

PortArray(config): PropertyDecorator

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

PortArray decorator to specify a port configuration for type "array".

This decorator automatically sets the port type to "array". You do not need to provide the type; you only need to pass additional options (for example, an itemConfig to define the configuration for array elements).

IMPORTANT: For array ports you must supply an "itemConfig" property in the configuration. Omission of this property will cause an error during port initialization.

Usage examples:

// With a custom array configuration: @PortArray({ itemConfig: { type: 'number', defaultValue: 0, }, defaultValue: [1, 2, 3], }) public myArray!: number[];

// With default array port configuration (if a default item config is acceptable): @PortArray({ itemConfig: { type: 'string' } }) public myStringArray!: string[];

Parameters

config

Omit<PortDecoratorOptions<"array">, "type">

Optional configuration object for additional array-specific options.

Returns

PropertyDecorator

Licensed under BUSL-1.1