Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

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 görüntüleme • 3 yıl önce •via X (Twitter)

9 Yorum

Gabriel Vergnaud profil fotoğrafı
Gabriel Vergnaud3 yıl önce

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 😅

Gabriel Vergnaud profil fotoğrafı
Gabriel Vergnaud3 yıl önce

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

Gabriel Vergnaud profil fotoğrafı
Gabriel Vergnaud3 yıl önce

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

Gabriel Vergnaud profil fotoğrafı
Gabriel Vergnaud3 yıl önce

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

Gabriel Vergnaud profil fotoğrafı
Gabriel Vergnaud3 yıl önce

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

Gabriel Vergnaud profil fotoğrafı
Gabriel Vergnaud3 yıl önce

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 👇

Luke Czyszczonik profil fotoğrafı
Luke Czyszczonik3 yıl önce

I hope to give it a try soon🤞

Mark Ledwich profil fotoğrafı
Mark Ledwich3 yıl önce

👏

qingyuano profil fotoğrafı
qingyuano3 yıl önce

this library is awesome

Benzer Videolar