variant
ts-pattern
variant | ts-pattern | |
---|---|---|
5 | 38 | |
178 | 10,907 | |
- | - | |
0.0 | 8.6 | |
2 months ago | 19 days ago | |
TypeScript | TypeScript | |
Mozilla Public License 2.0 | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
variant
-
Building React Components Using Unions in TypeScript
Variant
-
ADTs in Typescript
When working in a TS codebase I'll lean on this variant library, which works pretty well as far as simple sum types go (v3 is great but not stable yet).
-
disc-union - (yet another) library for working with discriminated union types
About half-way through writing this library I discovered that Variant existed... and does a great job at doing the exact same things (and more). I might not have started if I knew about that, but I'm glad I did because it has been a great learning experience!
-
ts-pattern: pattern matching library for TypeScript, with smart type inference
Oddly enough, this feature alone has been a a big draw to Rust, Haskell and functional programming in general for me... so it's nice that there's libs filling the gap for TypeScript. Here's another one I haven't gotten around to trying yet either.
-
Tool to normalize types (specifically intersections)?
I had to solve this for a project of mine.
ts-pattern
-
You Don't Need React
ts-pattern has been a decent band-aid for the lack of native pattern matching, but obviously has downsides that could be avoided if it was built into the language.
https://github.com/gvergnaud/ts-pattern
- Stop nesting ternaries
-
Building React Components Using Unions in TypeScript
ts-pattern
- Pattern Matching Library for TypeScript
-
TypeScript Is Surprisingly OK for Compilers
With how powerful the type system is you can implement pattern matching via a library pretty convincingly, https://github.com/gvergnaud/ts-pattern is definitely the go-to. That being said pattern matching is hardly a requirement for being ok for implementing compilers.
-
How to achieve type safety here possible without "type hacks"?
https://github.com/gvergnaud/ts-pattern might help
- ts-pattern v5
-
[AskJS] C# in every Node.js job posting?
There's a proposal to add something like that to JavaScript but it's been stuck in limbo since 2017 although there are libraries like ts-pattern which implement it already.
- Simplifying Dynamic Classes in Vue with the class-variance-authority library | cdruc.com
- Rust Appreciation Thread
What are some alternatives?
type-fest - A collection of essential TypeScript types
pattern-grab - 🤛🏻 Regular Expression Data Grabber
boxed - Essential building-blocks for functional & safe TypeScript code
ts-adt - Generate Algebraic Data Types and pattern matchers
TypeScript - TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
await-to-js - Async await wrapper for easy error handling without try-catch
union-types - A Typescript library for creating discriminating union types.
ts-option
typescript-coverage-report - Node command tool to generate TypeScript coverage report
proposal-pattern-matching - Pattern matching syntax for ECMAScript
Index - ⚡ Pattern Matching in Typescript
zod - TypeScript-first schema validation with static type inference