Publish
This commit is contained in:
26
changelog/0.21.2.md
Normal file
26
changelog/0.21.2.md
Normal file
@@ -0,0 +1,26 @@
|
||||
## [0.21.2](https://www.npmjs.com/package/@sinclair/typebox/v/0.21.2)
|
||||
|
||||
Updates:
|
||||
|
||||
- TypeBox now correctly infers for nested union and intersect types.
|
||||
|
||||
Before
|
||||
|
||||
```typescript
|
||||
const A = Type.Object({ a: Type.String() })
|
||||
const B = Type.Object({ b: Type.String() })
|
||||
const C = Type.Object({ c: Type.String() })
|
||||
const T = Type.Intersect([A, Type.Union([B, C])])
|
||||
|
||||
// type T = { a: string } & { b: string } & { c: string }
|
||||
```
|
||||
After
|
||||
|
||||
```typescript
|
||||
const A = Type.Object({ a: Type.String() })
|
||||
const B = Type.Object({ b: Type.String() })
|
||||
const C = Type.Object({ c: Type.String() })
|
||||
const T = Type.Intersect([A, Type.Union([B, C])])
|
||||
|
||||
// type T = { a: string } & ({ b: string } | { c: string })
|
||||
```
|
||||
Reference in New Issue
Block a user