Typescript: infer type of generic after optional first generic
问题 I have a function with two generic types, In and Out : function createTask< In extends Record<string, any> = {}, Out extends Record<string, any>, >(task : TaskFunction<In, Out>) : Task<In, Out> type TaskFunction<In, Out> = (args : TaskWrapper<In>) => Out | Promise<Out>; // TaskWrapper wraps several other types and interfaces, so args is more than just `In` This code currently does not compile, because you cannot have a required generic type ( Out ) after an optional one ( In ). How do I tell