// lets say we have some function typetypeSomeF=(a:number,b:string)=>number;// and we have our utility typetypeAppendArgument<F,A>=Fextends(...[a,b,...oth]:[inferArgA,inferArgB,inferArgOth])=>inferFReturn?(x:A,...[a,b,...oth]:[ArgA,ArgB,ArgOth])=>FReturn:unknown;typeFinalF=AppendArgument<SomeF,boolean>// FinalF should be (x: boolean, a: number, b: string) => number
I wasn't able to figure out myself how to dynamically take the pair arg:type out from a generic type function :(
UPDATE: palmface
// lets say we have some function typetypeSomeF=(a:number,b:string)=>number;// and we have our utility typetypeAppendArgument<F,A>=Fextends(...args:inferArgs)=>inferFReturn?(x:A,...args:Args)=>FReturn:unknown;typeFinalF=AppendArgument<SomeF,boolean>// FinalF should be (x: boolean, a: number, b: string) => number
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I wasn't able to figure out myself how to dynamically take the pair
arg:type
out from a generic type function :(UPDATE: palmface