awesome-repositories.com
Blog
MCP
awesome-repositories.com

Discover the best open-source repositories with AI-powered search.

ExploreCurated searchesOpen-source alternativesSelf-hosted softwareBlogSitemap
ProjectMCP serverAboutHow we rankPress
LegalPrivacyTerms
© 2026 Bringes Technology SRL·VAT RO45896025·hello@awesome-repositories.com
gvergnaud avatar

gvergnaud/ts-pattern

0
View on GitHub↗
15,034 stars·168 forks·TypeScript·MIT·26 views

Ts Pattern

This library provides a declarative approach to conditional logic in TypeScript, replacing imperative branching with structural pattern matching. It functions as a tool for decomposing complex data structures and mapping them to specific execution branches, ensuring that all possible states are accounted for during development.

The library distinguishes itself by enforcing exhaustive logic, which requires developers to address every possible branch of a data structure to prevent runtime errors. By leveraging compile-time type narrowing and recursive evaluation, it allows for the validation and transformation of deeply nested objects while maintaining strict type safety throughout the control flow.

Beyond its core matching capabilities, the library supports complex data validation and functional state transformation. It provides a framework for evaluating incoming data against defined structural requirements, ensuring that variations in input are processed in a predictable and type-safe manner.

Features

  • Pattern Matching - Provides a type-safe utility for exhaustive pattern matching and data structure decomposition in TypeScript.
  • Pattern Matching Libraries - Maps input data to specific execution branches using a declarative syntax that replaces traditional imperative conditional logic blocks.
  • Type Narrowing - Refines variable types within conditional branches based on structural pattern matching.
  • Exhaustiveness Checkers - Require every possible branch of a data structure to be addressed during development to prevent unexpected runtime errors when processing incomplete or missing state information.
  • Functional Utility Libraries - Exhaustive pattern matching library for TypeScript.
  • Type-Level Conditional Logic - Implements robust branching logic that guarantees type safety and exhaustive coverage at compile time.
  • Data Validation - Enforces structural rules and type requirements on incoming data to ensure safe processing.
  • Structural Data Validators - Evaluate incoming data against specific structural requirements and execute the corresponding logic to ensure every variation of the input is processed safely and predictably throughout the application.
  • Recursive Validation Engines - Handles nested data structures by dynamically dispatching validation logic across type hierarchies.
  • Type-Safe Data Handling - Ensures all possible data states are covered at compile time through type-safe control flow mechanisms.
  • Functional State Management - Processes complex nested objects by mapping patterns to functional logic for reliable state transformation.

Star history

Star history chart for gvergnaud/ts-patternStar history chart for gvergnaud/ts-pattern

How this analysis was created: This summary and feature list are AI-generated from collected project material and can contain mistakes. Stars, license and language are imported from GitHub. Inclusion does not mean that we have tested or audited this project. Check the source documentation for any feature you depend on. Learn more on our About page.

AI search

Explore more awesome repositories

Describe what you need in plain English — the AI ranks thousands of curated open-source projects by relevance.

Start searching with AI

Projects sharing features with Ts Pattern

These projects share indexed features with Ts Pattern. Shared tags can include platform or build tooling; verify the primary use case before treating a result as a replacement.
  • crystal-lang/crystalcrystal-lang avatar

    crystal-lang/crystal

    20,299View on GitHub↗

    Crystal is a statically typed, compiled programming language designed for high performance and memory safety. It leverages an LLVM-based compiler to translate source code into optimized machine-executable binaries, while its type-inference-based static analysis enforces strict safety rules during the build process. The language distinguishes itself through a fiber-based concurrent runtime that manages lightweight execution units for asynchronous input and output without blocking the main process. It also features a powerful compile-time macro system that allows for the inspection and transfor

    Crystalcompilercrystalcrystal-language
    View on GitHub↗20,299
  • python/mypypython avatar

    python/mypy

    20,489View on GitHub↗

    mypy is a static type checker for Python that analyzes source code to detect type errors and inconsistencies without executing the program. It functions as a static analysis tool and type inference engine, providing a gradual typing system that allows type hints to be added to a codebase incrementally while maintaining compatibility with dynamic typing. The project distinguishes itself through a combination of performance and precision features. It utilizes a daemon-based incremental checking system and multi-process parallel analysis to manage large codebases, supported by binary cache persi

    Pythonlinterpythontypechecker
    View on GitHub↗20,489
  • elm/compilerelm avatar

    elm/compiler

    7,794View on GitHub↗

    This project is a functional programming compiler and JavaScript transpiler that transforms a statically typed language into optimized JavaScript for web browsers. It serves as a frontend architecture framework, providing a static type system and a package manager that enforces semantic versioning. The compiler uses a type-checking engine with automatic type inference to prevent runtime errors and guide code refactoring. It implements a structural pattern for managing application state and rendering user interfaces through a virtual DOM, utilizing immutable data and purity-based state transit

    Haskellcompilerelm
    View on GitHub↗7,794
  • evhub/coconutevhub avatar

    evhub/coconut

    4,338View on GitHub↗

    Coconut is a functional programming language that compiles to Python. It functions as a source-to-source compiler, translating high-level functional syntax into compatible Python code to maintain runtime compatibility. The language introduces a logic system for pattern matching and destructuring complex data structures. It provides a mechanism for tail call optimization to prevent stack overflow errors during deep recursive function calls and employs a lazy evaluation engine to defer computations until results are explicitly required. The project includes support for algebraic data types, pi

    Python
    View on GitHub↗4,338
Compare all 30 related projects→

Frequently asked questions

What does gvergnaud/ts-pattern do?

This library provides a declarative approach to conditional logic in TypeScript, replacing imperative branching with structural pattern matching. It functions as a tool for decomposing complex data structures and mapping them to specific execution branches, ensuring that all possible states are accounted for during development.

What are the main features of gvergnaud/ts-pattern?

The main features of gvergnaud/ts-pattern are: Pattern Matching, Pattern Matching Libraries, Type Narrowing, Exhaustiveness Checkers, Functional Utility Libraries, Type-Level Conditional Logic, Data Validation, Structural Data Validators.

Which projects share features with gvergnaud/ts-pattern?

Projects with overlapping indexed features include: crystal-lang/crystal — Crystal is a statically typed, compiled programming language designed for high performance and memory safety. It… python/mypy — mypy is a static type checker for Python that analyzes source code to detect type errors and inconsistencies without… evhub/coconut — Coconut is a functional programming language that compiles to Python. It functions as a source-to-source compiler,… elm/compiler — This project is a functional programming compiler and JavaScript transpiler that transforms a statically typed… go-ozzo/ozzo-validation — ozzo-validation is a programmable data validation library for Go that verifies structs, maps, and primitive types… ianstormtaylor/superstruct — Superstruct is a JavaScript and TypeScript data validation library used to verify that data structures match defined…