tc39/proposal-pattern-matching

Pattern matching syntax for ECMAScript

View on GitHub ↗Jump to charts ↓

Summary Information

Updated 47 minutes ago
Added to GitGenius on September 11th, 2026
Created on July 3rd, 2017
Open Issues & Pull Requests: 24 (+0)
GitHub issues: Enabled
Number of forks: 90
Total Stargazers: 5,792 (+0)
Total Subscribers: 305 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 2.7 hours
Mean response time: 5.5 hours
90th percentile: 15.0 hours
Tracked items: 9

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 4
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 1,030 days
Stale 30+ days: 4
Stale 90+ days: 2

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • question (1)
  • stage process tracking (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

Pattern Matching is a proposed syntax feature for ECMAScript that enables developers to match values against structural patterns and execute different code paths based on those patterns.

The proposal addresses the lack of expressive pattern matching in JavaScript beyond regular expressions for strings. Developers frequently need to take different actions based on patterns in values—such as checking for specific properties or array lengths—but current approaches are inadequate. The switch statement has the right structure for offering multiple match criteria but lacks expressiveness, requires explicit breaks to prevent fallthrough, has ambiguous scoping rules, and can only perform strict equality comparisons. The if/else approach provides the necessary power for complex comparisons but is verbose, requires repeating structural access paths multiple times, and is statement-only without resorting to ternary operators. The proposal seeks to combine the structural clarity of switch with the expressive power of if/else, while eliminating common footguns like accidental fallthrough and scoping ambiguities.

Adoption of this proposal requires understanding that it remains at Stage 1 in the ECMAScript standardization process, meaning the feature is still in early development and not yet part of the language specification. This is appropriate for teams experimenting with future JavaScript syntax or contributing to language evolution discussions, but not for production code. The proposal prioritizes the ergonomics of structural pattern matching over other capabilities, seeks to subsume and replace switch statements entirely, and aims to provide expression semantics so pattern matching can be used in return statements, variable assignments, and arrow functions. Developers interested in this feature should engage with the proposal through the issue tracker if they have feedback or use cases to contribute.