Type Offsets

Edit pageLast modified: 02 February 2025

To specify a reference to a specific shape or array element, the offset access syntax is used.

A description of this type consists of two parts: Arbitrary type description; The type of specific element, enclosed in square [] brackets.

tip

Type with string key "offset".

T['offset']

tip

Type with dependent key.

T[U]

tip

Shape type with numeric key.

array{int, string}[0]

tip

Complex example using shape types and generics.

T<U>[object{key: int, ...}]