mockdeep / typewiz

Automatically discover and add missing types in your TypeScript code
https://medium.com/@urish/manual-typing-is-no-fun-introducing-typewiz-58e3e8813f4c
1.1k stars 46 forks source link

Arrow functions with concise body not instrumented correctly #82

Closed urish closed 5 years ago

urish commented 5 years ago

For instance, a function that reads x => 5 will be transformed to x => { $_$twiz(/*...*/); 5 }, which returns undefined and not 5.

Failing integration test case:

it('should correctly transform arrow functions that return arrow functions', () => {
  const input = `(x=>y=>x+y)(10)(5)`;
  expect(typeWiz(input)).toBe(`((x: number)=>(y: number)=>x+y)(10)(5)`);
});