| ▲ | domlebo70 2 days ago |
| We do this via run in TS: export const run = <T>(f: () => T): T => {
return f();
};
|
|
| ▲ | notpushkin 2 days ago | parent [-] |
| Can you clarify why do you prefer this over an IIFE `(() => {...})()`? |
| |
| ▲ | deredede 2 days ago | parent [-] | | I like it. IIFEs always make me nervous because they look like they beg to be removed if you don't know why they are used. Using an explicit function such as `run` looks much more intentional, and provide a single intuitive place (the documentation of the `run` function) to explain the pattern. |
|