Skip to content

Commit 30ba1f0

Browse files
committed
docs: Update readme
1 parent 1b7a36b commit 30ba1f0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,25 +663,27 @@ With a single argument:
663663
import { isMatching, P } from 'ts-pattern';
664664

665665
const isBlogPost = isMatching({
666+
type: 'blogpost',
666667
title: P.string,
667668
description: P.string,
668669
});
669670

670671
if (isBlogPost(value)) {
671-
// value: { title: string, description: string }
672+
// value: { type: 'blogpost', title: string, description: string }
672673
}
673674
```
674675

675676
With two arguments:
676677

677678
```ts
678679
const blogPostPattern = {
680+
type: 'blogpost',
679681
title: P.string,
680682
description: P.string,
681683
} as const;
682684

683685
if (isMatching(blogPostPattern, value)) {
684-
// value: { title: string, description: string }
686+
// value: { type: 'blogpost', title: string, description: string }
685687
}
686688
```
687689

0 commit comments

Comments
 (0)