We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1b7a36b commit 30ba1f0Copy full SHA for 30ba1f0
1 file changed
README.md
@@ -663,25 +663,27 @@ With a single argument:
663
import { isMatching, P } from 'ts-pattern';
664
665
const isBlogPost = isMatching({
666
+ type: 'blogpost',
667
title: P.string,
668
description: P.string,
669
});
670
671
if (isBlogPost(value)) {
- // value: { title: string, description: string }
672
+ // value: { type: 'blogpost', title: string, description: string }
673
}
674
```
675
676
With two arguments:
677
678
```ts
679
const blogPostPattern = {
680
681
682
683
} as const;
684
685
if (isMatching(blogPostPattern, value)) {
686
687
688
689
0 commit comments