Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
combine functions with varidiac rest parameters types
function combine<T extends any[]>(...args: ((...fnArgs: T) => void)[]) {
return (...a: T) => args.forEach(fn => fn(...a));
function foo(n: number, o: string){
console.log(`string ${n} ${o}`);
function bar(n: number, o: string){
console.log(`string ${n} ${o}`);
combine(foo, bar)(11,"this is very cool :P ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.