type ArrayAssign<Target, Source> = _ArrayAssign<Target, Source>;Assign the elements of Source into Target.
It's like ObjectAssign but for Array only.
- If
Targetis readonly, it returnsTargetas is. In order to follow the actual result of Object.assign. - If either
TargetorSourceis not anArrayorTuple, it returnsTargetas is.
| Type Parameter | Default type | Description |
|---|---|---|
|
|
‐ |
The target |
|
|
[] |
The |
A new Array or Tuple combining elements from both Target and Source.
// [0, 1, 2]
type Result1 = ArrayAssign<[1, 2], [0, 1, 2]>;
// (string | number)[]
type Result2 = ArrayAssign<string[], number[]>;
// readonly [1, 2]
type Result3 = ArrayAssign<readonly [1, 2], [0, 1, 2]>;