Arrays
Arrays are forged by generating the element type arrayLength times — 3 by default.
Both array syntaxes
T[] and Array<T> are equivalent:
const tags = Forger.create<string[]>()!;
// ['vOBZl5/IJX', 'xLRVT,U){I', "'^4gIzTf!H"]
const same = Forger.create<Array<string>>()!;
Every element is fresh
Each element is generated independently — not the same reference repeated:
const students = Forger.create<Student[]>()!;
// three distinct fully-populated students
The exception is deterministic member sets: an array of a literal union rolls each element separately, so ('a' | 'b')[] may produce ['a', 'b', 'a'].
Nested arrays
Multi-dimensional arrays apply the length per level:
const matrix = Forger.create<number[][]>()!;
// [[466, 355, 339], [488, 581, 611], [90, 941, 593]] — a 3×3 matrix
Length control
The arrayLength setting sets the size of every generated array — including nested ones — for that call:
const five = Forger.create<string[]>({ arrayLength: 5 })!;
// five random strings
const bigMatrix = Forger.create<number[][]>({ arrayLength: 5 })!;
// 5×5 matrix
Details and defaults: Array settings.
Arrays of complex types
Any element type is supported — objects, enums, tuples, unions:
const boards = Forger.create<Board[]>()!; // full objects inside
const rolls = Forger.create<Status[]>()!; // enum members
const pairs = Forger.create<[string, number][]>()!; // tuples as elements
08 September 2026