You may add as const to your declaration; const readonlyArray = [1, 2, 3] as const; Furthermore the type typeof readonlyArray[number] would be 1 | 2 | 3.
確定! 回上一頁