You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
declarefunctionf1(): {a: number;b: string};typeT0=ReturnType<()=>string>;typeT1=ReturnType<(s: string)=>void>;typeT2=ReturnType<<T>()=>T>;typeT3=ReturnType<<TextendsU,Uextendsnumber[]>()=>T>;typeT4=ReturnType<typeoff1>;// reusing return type of function f1 in T4
Extracting and reusing parameter type of a function
constmutateFnc:Client['mutation']=null;// Creating dummy function type of function same as of external lib.typeMutationParams=Parameters<typeofmutateFnc>;// Extracting function parameter types// Reusing function parameter types and return typesconstmutationWithNotify=(successMessage: string)=><Data=any,Variablesextendsobject={}>(a:MutationParams[0],b?:Variables,c?:MutationParams[2]):ReturnType<typeofmutateFnc>=>{returnclient.mutation();}