Last active
October 30, 2020 21:35
-
-
Save lifeiscontent/6696dce07d2da474fc6b9fcc48288bbe to your computer and use it in GitHub Desktop.
Typescript callAll function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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