回答編集履歴

1

readonlyのつけ忘れ

2021/08/18 20:10

投稿

ka2obushi
ka2obushi

スコア173

test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  type ToArray<T extends readonly unknown[]> = T extends [] ? []
10
10
 
11
- : T extends [infer U, ...infer V] ? [U[], ...ToArray<V>]
11
+ : T extends readonly [infer U, ...infer V] ? [U[], ...ToArray<V>]
12
12
 
13
13
  : T[];
14
14