type IssueExcludeAssigneesField = {
id: number
project_id: number
title: string
due_date: string | null
}
type Assignee = {
name: string
}
type Issue = IssueExcludeAssigneesField & ({ assignees: [Assignee] } | { assignees: [] })
type Issue2 = IssueExcludeAssigneesField & { assignees: [Assignee] | [] }
declare function map<T1, T2>(_: (_: T1) => T2): T2
declare function pick<T>(_: T): Pick<T, keyof T>
map<Issue, Issue>(pick) // Type '[Assignee]' is not assignable to type '[]'.
map<Issue2, Issue2>(pick) // OK
declare function mapIssue(_: Issue): Issue2
map<Issue, Issue>(mapIssue) // OK
type assignees1 = Issue['assignees']
type assignees2 = Issue2['assignees']
declare function mapAssignee(_: assignees1): assignees2
map<assignees1, assignees1>(mapAssignee) // OK
上面的这段代码为啥第一个 pick 会报错
后面的两个 map 应该能证明两个 issue 和 assignees 都是可以互相赋值的等价的类型吧