jhnns / rewire

Easy monkey-patching for node.js unit tests
MIT License
3.08k stars 128 forks source link

unpexpected : due to type definition in TS #211

Open deepakaggarwal7 opened 1 year ago

deepakaggarwal7 commented 1 year ago

TS file method with datatype in function doesn't work.

myFunction inside somefile.ts, which is rewired Doesn't work

function myFunction(a: number, b: number) {
  return a + b;
}

Error thrown: SyntaxError: Unexpected token ':'

Works

function myFunction(a, b) {
  return a + b;
}
nktnet1 commented 1 year ago

There are some workarounds in #185

dhensby commented 2 months ago

should be fixed in v7 - TS support added here: https://github.com/jhnns/rewire/pull/204