gvergnaud/ts-pattern

Feature: return the value directly

gideaoms opened this issue · 2 comments

Hi, congratulations for the lib.

I would like to know if there is a possibility to return the value directly when I don't need to use it.

How it works today:

match(5)
  .when(1, () => "one")
  .when(2, () => "two")
  .otherwise(() => "three or greater")

How I would like it to work:

match(5)
  .when(1, "one")
  .when(2, "two")
  .otherwise("three or greater")

Duplicate of #100.

Duplicate of #100.

Thanks for letting me know, I'll close it.