Facebook
From Whipped Pig, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 269
  1. function f1(res: string) {
  2.   console.log("F1: " + res);
  3.   return 1;
  4. }
  5.  
  6. function f2(res: number) {
  7.   console.log("F1: " + res);
  8.   return { hoho: "xd" };
  9. }
  10.  
  11. function f3(abc: { hoho: string }) {
  12.   return { uu: "XD" };
  13. }
  14.  
  15. declare function compose<TResult, TArg, TResult1>(f2: (arg: TResult1) => TResult, f1: (arg: TArg) => TResult1): (arg: TArg) => TResult;
  16. declare function compose<TResult, TArg, TResult1, TResult2>(f3: (arg: TResult2) => TResult, f2: (arg: TResult1) => TResult2, f1: (arg: TArg) => TResult1): (arg: TArg) => TResult;
  17.  
  18.  
  19. const xd = compose(f2, f1);
  20. const xd2 = compose(f3, f2, f1);