Skip to content

Instantly share code, notes, and snippets.

@lifeiscontent
Last active October 30, 2020 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lifeiscontent/6696dce07d2da474fc6b9fcc48288bbe to your computer and use it in GitHub Desktop.
Save lifeiscontent/6696dce07d2da474fc6b9fcc48288bbe to your computer and use it in GitHub Desktop.
Typescript callAll function
const callAll = <Args extends readonly unknown[]>(
...fns: readonly (((...args: Args) => void) | undefined)[]
) => (...args: Args): void => fns.forEach((fn) => fn?.(...args));
export default callAll;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment