diff --git a/README.md b/README.md index 8672dc0f..779348ca 100644 --- a/README.md +++ b/README.md @@ -7,18 +7,18 @@ 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(); ```