unassert-js / unassert

Encourages programming with assertions by providing tools to compile them away.
MIT License
192 stars 13 forks source link

assertions in return statements and in void operations aren't stripped #47

Open RebeccaStevens opened 1 year ago

RebeccaStevens commented 1 year ago

The following should be transformed from:

export function assertNever(msg = "never reached") {
  return void assert(false, msg);
}

to:

export function assertNever(msg = "never reached") {
  return void undefined;
}

But the presence of with void or return stops this.