Loading video...

Video Failed to Load

Go Home

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,311 views โ€ข 3 years ago โ€ขvia X (Twitter)

9 Comments

Gabriel Vergnaud's profile picture
Gabriel Vergnaud3 years ago

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's profile picture
Gabriel Vergnaud3 years ago

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

Gabriel Vergnaud's profile picture
Gabriel Vergnaud3 years ago

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

Gabriel Vergnaud's profile picture
Gabriel Vergnaud3 years ago

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

Gabriel Vergnaud's profile picture
Gabriel Vergnaud3 years ago

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

Gabriel Vergnaud's profile picture
Gabriel Vergnaud3 years ago

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's profile picture
Luke Czyszczonik3 years ago

I hope to give it a try soon๐Ÿคž

Mark Ledwich's profile picture
Mark Ledwich3 years ago

๐Ÿ‘

qingyuano's profile picture
qingyuano3 years ago

this library is awesome

Related Videos