Skip to content

Commit d86f4e2

Browse files
committed
[docs] Update readme
1 parent 6829f2c commit d86f4e2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ with smart type inference.
1818
</p>
1919

2020
```ts
21-
import { match } from 'ts-pattern';
21+
import { match, P } from 'ts-pattern';
2222

2323
type Data =
2424
| { type: 'text'; content: string }
@@ -31,9 +31,9 @@ type Result =
3131
const result: Result = ...;
3232

3333
return match(result)
34-
.with({ type: 'error' }, (res) => `<p>Oups! An error occured</p>`)
34+
.with({ type: 'error' }, () => `<p>Oups! An error occured</p>`)
3535
.with({ type: 'ok', data: { type: 'text' } }, (res) => `<p>${res.data.content}</p>`)
36-
.with({ type: 'ok', data: { type: 'img' } }, (res) => `<img src=${res.data.src} />`)
36+
.with({ type: 'ok', data: { type: 'img', src: P.select() } }, (src) => `<img src=${src} />`)
3737
.exhaustive();
3838
```
3939

0 commit comments

Comments
 (0)