Загрузка видео...

Не удалось загрузить видео

На главную

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 просмотров • 3 лет назад •via X (Twitter)

Комментарии: 9

Фото профиля Gabriel Vergnaud
Gabriel Vergnaud3 лет назад

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
Gabriel Vergnaud3 лет назад

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

Фото профиля Gabriel Vergnaud
Gabriel Vergnaud3 лет назад

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

Фото профиля Gabriel Vergnaud
Gabriel Vergnaud3 лет назад

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

Фото профиля Gabriel Vergnaud
Gabriel Vergnaud3 лет назад

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

Фото профиля Gabriel Vergnaud
Gabriel Vergnaud3 лет назад

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
Luke Czyszczonik3 лет назад

I hope to give it a try soon🤞

Фото профиля Mark Ledwich
Mark Ledwich3 лет назад

👏

Фото профиля qingyuano
qingyuano3 лет назад

this library is awesome

Похожие видео