gvergnaud / ts-pattern

🎨 The exhaustive Pattern Matching library for TypeScript, with smart type inference.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Branded type does not work anymore

mohaalak opened this issue · comments

Describe the bug
In the previous version of ts-pattern (prior to v5), the Branded Types feature was working correctly and as intended. However, after updating to v5.0.1, it seems that the Branded Types are no longer functioning as expected.

in (4.0.6) it's working correctly and will narrow type to primitive type when matching but after this version it needs PatternMatcher .

Code Sandbox with a minimal reproduction case
https://codesandbox.io/p/sandbox/modern-tdd-xly9tj

Versions

  • TypeScript version: 5.1.6
  • ts-pattern version: 5.0.3
  • environment: node 18

Closing, is this is a duplicate of #167. Thanks for providing this sandbox link, will take a look at this shortly.