跳至主要內容

2257. ⚡Minusone

鸭梨小于 1 分钟

2257. ⚡Minusone

<题目描述>

::: playground#ts 2257. Minusone

@file index.ts

// ============= Test Cases =============
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>>,
  Expect<Equal<MinusOne<0>, -1>>,
  Expect<Equal<MinusOne<9_007_199_254_740_992>, 9_007_199_254_740_991>>,
]

// ============= Your Code Here =============
type MinusOne<T extends number> = any

:::

点击查看答案
// 你的答案