Removing `Failure` / `Success` Wrapper in TypeScript
How can I flatten this and remove the
Failure / Success wrapper?FailureSuccess return Effect.runPromiseExit(runnable).then(
Exit.mapBoth({
onFailure: (responseError) => {
return typedjson({ok: false as const, errors: ['']}, {status: 401});
},
onSuccess: matchHttpResponse<T>()({
Ok: ({data}) => {
return typedjson({ok: true as const, data});
},
Redirect: ({to, init}) => {
return redirect(to, init);
},
}),
})
);