Publish
This commit is contained in:
20
changelog/0.19.0.md
Normal file
20
changelog/0.19.0.md
Normal file
@@ -0,0 +1,20 @@
|
||||
## [0.19.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.19.0)
|
||||
|
||||
Updates:
|
||||
|
||||
- Function `Type.Box(...)` removes `$id` parameter as first argument.
|
||||
- Function `Type.Ref(...)` is now overloaded to support referencing `Type.Box(...)` and `TSchema`.
|
||||
|
||||
Notes:
|
||||
|
||||
This update changes the signature of `Type.Box(...)` and removes the explicit `$id` passing on the first parameter. The `$id` must be passed as an option if the caller wants to reference that type.
|
||||
|
||||
```typescript
|
||||
const T = Type.String({ $id: 'T' })
|
||||
|
||||
const B = Type.Box({ T }, { $id: 'B' })
|
||||
|
||||
const R1 = Type.Ref(T) // const R1 = { $ref: 'T' }
|
||||
|
||||
const R2 = Type.Ref(B, 'T') // const R2 = { $ref: 'B#/definitions/T' }
|
||||
```
|
||||
Reference in New Issue
Block a user