Answer the question
In order to leave comments, you need to log in
How to type a function that returns a function with parameters?
export const getAnalytic = (action: Action) => {
try {
const operations = new Operations();
const analyticsLog = {
action,
total: 1,
};
return (isSuccess: boolean, param: string = '') =>
operations .track({
...analyticsLog,
type: param,
itemsSuccess: Number(isSuccess),
itemsError: Number(!isSuccess),
});
} catch (error) {
return error;
}
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question