如何理解以下的 typescript 类型推导?

type Ref2 = { name: string, age: number }
interface Ref {
  name: string,
  age: number,
}

type BRef2 =  Ref2 extends Record<string, unknown> ? string : number // type BRef2 = string

type BRef3 = Ref extends Record<string, unknown> ? string : number  // type BRef3 = number
阅读 2.8k
1 个回答
logo
Microsoft
子站问答
访问
宣传栏