From d86f4e258a01019186d93df8fc1d5f3d756aa8b1 Mon Sep 17 00:00:00 2001
From: gvergnaud
Date: Tue, 29 Mar 2022 11:24:59 +0200
Subject: [PATCH] [docs] Update readme
---
README.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 8672dc0f..dbb2cbc0 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@ with smart type inference.
```ts
-import { match } from 'ts-pattern';
+import { match, P } from 'ts-pattern';
type Data =
| { type: 'text'; content: string }
@@ -31,9 +31,9 @@ type Result =
const result: Result = ...;
return match(result)
- .with({ type: 'error' }, (res) => `Oups! An error occured
`)
+ .with({ type: 'error' }, () => `Oups! An error occured
`)
.with({ type: 'ok', data: { type: 'text' } }, (res) => `${res.data.content}
`)
- .with({ type: 'ok', data: { type: 'img' } }, (res) => ``)
+ .with({ type: 'ok', data: { type: 'img', src: P.select() } }, (src) => ``)
.exhaustive();
```