@@ -17,7 +17,6 @@ Table of contents
17
17
- [ Implemented types / combinators] ( #implemented-types--combinators )
18
18
- [ Recursive types] ( #recursive-types )
19
19
- [ Mutually recursive types] ( #mutually-recursive-types )
20
- - [ Tagged unions] ( #tagged-unions )
21
20
- [ Branded types / Refinements] ( #branded-types--refinements )
22
21
- [ Exact types] ( #exact-types )
23
22
- [ Mixing required and optional props] ( #mixing-required-and-optional-props )
@@ -250,7 +249,7 @@ type User = {
250
249
| readonly array | ` ReadonlyArray <A >` | ` t .readonlyArray (A )` |
251
250
| type alias | ` type T = { name: A }` | ` t .type ({ name: A })` |
252
251
| tuple | ` [ A , B ]` | ` t .tuple ([ A , B ])` |
253
- | union | ` A \| B ` | ` t .union ([ A , B ])` or ` t . taggedUnion ( tag , [ A , B ]) ` |
252
+ | union | ` A \| B ` | ` t .union ([ A , B ])` |
254
253
| intersection | ` A & B ` | ` t .intersection ([ A , B ])` |
255
254
| keyof | ` keyof M ` | ` t .keyof (M )` (**only supports string keys**) |
256
255
| recursive types | ✘ | ` t .recursion (name , definition )` |
@@ -305,26 +304,6 @@ const Bar: t.Type<Bar> = t.recursion('Bar', () =>
305
304
)
306
305
```
307
306
308
- # Tagged unions
309
-
310
- If you are encoding tagged unions, instead of the general purpose ` union ` combinator, you may want to use the
311
- ` taggedUnion ` combinator in order to get better performances
312
-
313
- ``` ts
314
- const A = t .type ({
315
- tag: t .literal (' A' ),
316
- foo: t .string
317
- })
318
-
319
- const B = t .type ({
320
- tag: t .literal (' B' ),
321
- bar: t .number
322
- })
323
-
324
- // the actual presence of the tag is statically checked
325
- const U = t .taggedUnion (' tag' , [A , B ])
326
- ```
327
-
328
307
# Branded types / Refinements
329
308
330
309
You can brand / refine a codec (_ any_ codec) using the ` brand ` combinator
0 commit comments