Slide 29
Slide 29 text
type A1 = T extends (a1: infer I, ...rest: any[]) => any ? I : never
type A2 = T extends (a1: any, a2: infer I, ...rest: any[]) => any ? I : never
type MT = (state: A1) => A1
type MTPL = (state: A1, payload: A2) => A1
type CR = () => { type: string }
type CRPL = (payload: A2) => { type: string; payload: A2 }
type Mutation = MT | MTPL
type Creator = T extends MT ? CR : CRPL
推論マッピング型(redux-aggregate 抜粋)