Skip to content

Commit 55f96e3

Browse files
committed
[README] Add section about TS-Pattern v4 RC
1 parent e45c923 commit 55f96e3

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

README.md

+14-7
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Via yarn
7373
yarn add ts-pattern
7474
```
7575

76-
### compatibility with different TypeScript versions
76+
### Compatibility with different TypeScript versions
7777

7878
Note: TS-Pattern assumes [Strict Mode](https://www.typescriptlang.org/tsconfig#strict) is enabled in your `tsconfig.json` file.
7979

@@ -83,11 +83,18 @@ Note: TS-Pattern assumes [Strict Mode](https://www.typescriptlang.org/tsconfig#s
8383
| v2.x ||||
8484
| v1.x ||||
8585

86-
✅ Full support
86+
- ✅ Full support
87+
- ⚠️ Partial support, All features except passing multiple patterns to `.with()`.
88+
- ❌ No support
8789

88-
⚠️ Partial support, everything works except passing more than 2 patterns to `.with()`
90+
## Trying TS-Pattern v4 RC ✨
8991

90-
❌ No support
92+
TS-Pattern v4 will soon be released. If you are using **TypeScript v4.5+** and you want to try the latest release candidate, you can install `ts-pattern@next` and give feedback either by [opening an issue](https://github.com/gvergnaud/ts-pattern/issues/new/choose) on the repo or by [commenting on the PR](https://github.com/gvergnaud/ts-pattern/pull/70).
93+
94+
Useful links:
95+
96+
- [TS-Pattern v4 Documentation](https://github.com/gvergnaud/ts-pattern/tree/v4-wip#documentation)
97+
- [TS-Pattern v3 to v4 Migration Guide](https://github.com/gvergnaud/ts-pattern/tree/v4-wip/docs/v3-to-v4-migration-guide.md) detailing all breaking changes.
9198

9299
# Documentation
93100

@@ -233,8 +240,8 @@ Then we add a first `with` clause:
233240

234241
```ts
235242
.with([{ status: 'loading' }, { type: 'success' }], ([state, event]) => ({
236-
// `state` is infered as { status: 'loading' }
237-
// `event` is infered as { type: 'success', data: string }
243+
// `state` is inferred as { status: 'loading' }
244+
// `event` is inferred as { type: 'success', data: string }
238245
status: 'success',
239246
data: event.data,
240247
}))
@@ -940,7 +947,7 @@ const output = match<Input>({ score: 10 })
940947
{
941948
score: when((score): score is 5 => score === 5),
942949
},
943-
(input) => '😐' // input is infered as { score: 5 }
950+
(input) => '😐' // input is inferred as { score: 5 }
944951
)
945952
.with({ score: when((score) => score < 5) }, () => '😞')
946953
.with({ score: when((score) => score > 5) }, () => '🙂')

0 commit comments

Comments
 (0)