Skip to content

Latest commit

 

History

History
33 lines (31 loc) · 448 Bytes

ts-chainer-infer.md

File metadata and controls

33 lines (31 loc) · 448 Bytes

Ts Chainer Infer

function myChainer<T>(args: T) {
  return {
    map: <R>(innerFuction: (payload: T) => R) => {
      return myChainer(innerFuction(args));
    },
  };
}
const result = myChainer(0)
    .map(arg => {
      // ^?
      return {
        x: arg
      }
    })
    .map((arg)=> {
      // ^?
       return {
        y:1,
        ...arg
       }
    })
    .map(arg =>  {
      // ^?
      arg.x
    })
    ```