MinusOne
提出詳細
type TupleOfLength<N extends number, Tuple extends any[] = []> = Tuple['length'] extends N ? Tuple : TupleOfLength<N, [...Tuple, 0]> type MinusOne<T extends number> = TupleOfLength<T> extends [infer _, ...infer Rest] ? Rest['length'] : never;
提出日時 | 2023-08-12 12:47:08 |
---|---|
問題 | MinusOne |
ユーザー | tekihei2317 |
ステータス | Wrong Answer |
import type { Equal, Expect } from '@type-challenges/utils' type cases = [ Expect<Equal<MinusOne<1>, 0>>, Expect<Equal<MinusOne<55>, 54>>, Expect<Equal<MinusOne<3>, 2>>, Expect<Equal<MinusOne<100>, 99>>, Expect<Equal<MinusOne<1101>, 1100>>, ]