TypeScript类型推断本页总览类型推断条件类型 Conditional Types export function joinTimestamp<T extends boolean>( join: boolean, restful: T,): T extends true ? string : object; 当 restful 传入 true,函数返回值为 string 类型。传入 false 返回值为 object 类型。