I am defining a array in a slice state with Redux Toolkit below:
export const initialState = {
dice: [] as DieDTO[],
loading: false,
error: null,
}
I actually want to restrict this DieDTO[]
array to be of ten die exactly, no more, no less:
dice: [] as DieDTO[
Die, Die, Die, Die, Die, Die, Die, Die, Die, Die
],
It will force me to feed the array at initialize, but I'll fix that later.
The problem with the last answer is, that it's pretty difficult to read.
How can I achieve that more elegantly?