Video wird geladen...
Video konnte nicht geladen werden
I just published TS-Pattern v5! 🙌 👉 [_, …P.array()] variadic tuple patterns 👉 Builtin predicates for string and number patterns 👉 Chain `.optional`, `.or`, `.and`, and `.select` methods 👉 Improved type narrowing And more! 🧵👇
33,309 Aufrufe • vor 3 Jahren •via X (Twitter)
9 Kommentare

Variadic tuple patterns can take as many subpatterns as you want, both on the left side and the right side of ...P.array()! It was really challenging to implement 😅

Built-in predicates are super handy when creating zod-like schemas, especially coupled with `isMatching`:

Being able to chain `select` and `optional` modifiers is a very neat DX improvement because you get auto complete suggestions ✨

Type narrowing is even better! You no longer have to use `as const` anywhere:

If you want to upgrade from TS-Pattern v4, read this guide that goes through all breaking changes and new features:

Hope you’ll enjoy this new version! I started working on it back in January 2022, I'm sooo glad to finally release it 😅 Find TS-Pattern on GitHub 👇

I hope to give it a try soon🤞

👏

this library is awesome
Ähnliche Videos
Sensitive content
Subscribe to my Paid Instagram Private Id 👉 SURJITSAHAOFFICIAL👈 or 👉SurjitSaha👈 for Chats and more 😊
surjit saha
39,401 Aufrufe • vor 1 Jahr
