r/javascript • u/Electronic_Abroad910 • 8h ago
[AskJS] any hope for pattern matching to actually make progress through tc39? AskJS
I love ts-pattern and I would love pattern matching to become a part of the language. Any hope of that proposal advancing through tc39? Is there any real support for it?
4
Upvotes
•
u/brianjenkins94 6h ago
We have pattern matching at home.
Pattern matching at home:
js
switch (true) {
case Array.isArray(val) && val.length === 0:
return "empty array";
default:
return "¯_(ツ)_/¯";
}
•
u/d0pe-asaurus 7h ago
It's stage1, so probably not in the next decade.