Fork from @sinclair/typebox 0.34.49 as @alkdev/typebox
- Rename package from @sinclair/typebox to @alkdev/typebox - Update author, repository, and homepage to alkdev - Remove GitHub workflows, .vscode config, and branding assets - Update all source, test, example, changelog, and task imports - Update tsconfig.json path mappings - Clean up readme header (remove upstream badges/branding)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
## [0.17.1](https://www.npmjs.com/package/@sinclair/typebox/v/0.17.1)
|
||||
## [0.17.1](https://www.npmjs.com/package/@alkdev/typebox/v/0.17.1)
|
||||
|
||||
- Remove default `additionalProperties: false` constraint from all object schemas.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.17.4](https://www.npmjs.com/package/@sinclair/typebox/v/0.17.4)
|
||||
## [0.17.4](https://www.npmjs.com/package/@alkdev/typebox/v/0.17.4)
|
||||
|
||||
Changes:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.17.6](https://www.npmjs.com/package/@sinclair/typebox/v/0.17.6)
|
||||
## [0.17.6](https://www.npmjs.com/package/@alkdev/typebox/v/0.17.6)
|
||||
|
||||
Changes:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.18.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.18.0)
|
||||
## [0.18.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.18.0)
|
||||
|
||||
Changes:
|
||||
|
||||
@@ -14,7 +14,7 @@ TypeBox now targets JSON schema draft `2019-09` for expressing `Type.Intersect(.
|
||||
|
||||
TypeBox has deprecated `Type.Dict(...)` in favor of the more generic `Type.Record(...)`. Where as `Type.Dict(...)` was previously expressed with `additionalProperties: { ... }`, `Type.Record(...)` is expressed with `patternProperties` and supports both `string` and `number` indexer keys. Additionally, `Type.Record(...)` supports string union arguments. This is analogous to TypeScript's utility record type `Record<'a' | 'b' | 'c', T>`.
|
||||
|
||||
## [0.17.7](https://www.npmjs.com/package/@sinclair/typebox/v/0.17.7)
|
||||
## [0.17.7](https://www.npmjs.com/package/@alkdev/typebox/v/0.17.7)
|
||||
|
||||
Changes:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.18.1](https://www.npmjs.com/package/@sinclair/typebox/v/0.18.1)
|
||||
## [0.18.1](https://www.npmjs.com/package/@alkdev/typebox/v/0.18.1)
|
||||
|
||||
- Function `Type.Enum(...)` now expressed with `anyOf`. This to remove the `allowUnionTypes` configuration required to use `enum` with in AJV strict.
|
||||
- Function `Type.Rec(...)` now takes a required `$id` as the first parameter.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.19.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.19.0)
|
||||
## [0.19.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.19.0)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.20.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.20.0)
|
||||
## [0.20.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.20.0)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.20.1](https://www.npmjs.com/package/@sinclair/typebox/v/0.20.1)
|
||||
## [0.20.1](https://www.npmjs.com/package/@alkdev/typebox/v/0.20.1)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.21.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.21.0)
|
||||
## [0.21.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.21.0)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.21.2](https://www.npmjs.com/package/@sinclair/typebox/v/0.21.2)
|
||||
## [0.21.2](https://www.npmjs.com/package/@alkdev/typebox/v/0.21.2)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.22.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.22.0)
|
||||
## [0.22.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.22.0)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.23.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.23.0)
|
||||
## [0.23.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.23.0)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.23.1](https://www.npmjs.com/package/@sinclair/typebox/v/0.23.1)
|
||||
## [0.23.1](https://www.npmjs.com/package/@alkdev/typebox/v/0.23.1)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.23.3](https://www.npmjs.com/package/@sinclair/typebox/v/0.23.3)
|
||||
## [0.23.3](https://www.npmjs.com/package/@alkdev/typebox/v/0.23.3)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.24.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.24.0)
|
||||
## [0.24.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.24.0)
|
||||
|
||||
Changes:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.24.15](https://www.npmjs.com/package/@sinclair/typebox/v/0.24.15)
|
||||
## [0.24.15](https://www.npmjs.com/package/@alkdev/typebox/v/0.24.15)
|
||||
|
||||
Added:
|
||||
- `Conditional.Extends(...)` This enables TypeBox to conditionally map types inline with TypeScripts structural equivalence checks. Tested against TypeScript 4.7.4.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.24.44](https://www.npmjs.com/package/@sinclair/typebox/v/0.24.44)
|
||||
## [0.24.44](https://www.npmjs.com/package/@alkdev/typebox/v/0.24.44)
|
||||
|
||||
Updates:
|
||||
- [189](https://github.com/sinclairzx81/typebox/pull/189) Both `Value.Error(T, value)` and `TypeCheck.Error(value)` now return an iterator for validation errors.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.24.49](https://www.npmjs.com/package/@sinclair/typebox/v/0.24.49)
|
||||
## [0.24.49](https://www.npmjs.com/package/@alkdev/typebox/v/0.24.49)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
## [0.24.6](https://www.npmjs.com/package/@sinclair/typebox/v/0.24.6)
|
||||
## [0.24.6](https://www.npmjs.com/package/@alkdev/typebox/v/0.24.6)
|
||||
|
||||
Added:
|
||||
|
||||
- TypeBox now offers a `TypeGuard` module for structurally checking TypeBox schematics. This module can be used in runtime type reflection scenarios where it's helpful to test a schema is of a particular form. This module can be imported under the `@sinclair/typebox/guard` import path.
|
||||
- TypeBox now offers a `TypeGuard` module for structurally checking TypeBox schematics. This module can be used in runtime type reflection scenarios where it's helpful to test a schema is of a particular form. This module can be imported under the `@alkdev/typebox/guard` import path.
|
||||
|
||||
Example:
|
||||
|
||||
```typescript
|
||||
import { TypeGuard } from '@sinclair/typebox/guard'
|
||||
import { TypeGuard } from '@alkdev/typebox/guard'
|
||||
|
||||
const T: any = {} // T is any
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.24.8](https://www.npmjs.com/package/@sinclair/typebox/v/0.24.8)
|
||||
## [0.24.8](https://www.npmjs.com/package/@alkdev/typebox/v/0.24.8)
|
||||
|
||||
Added:
|
||||
- `Value.Cast(T, value)` structurally casts a value into another form while retaining information within the original value.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.25.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.25.0)
|
||||
## [0.25.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.25.0)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.25.10](https://www.npmjs.com/package/@sinclair/typebox/v/0.25.10)
|
||||
## [0.25.10](https://www.npmjs.com/package/@alkdev/typebox/v/0.25.10)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.25.11](https://www.npmjs.com/package/@sinclair/typebox/v/0.25.11)
|
||||
## [0.25.11](https://www.npmjs.com/package/@alkdev/typebox/v/0.25.11)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.25.18](https://www.npmjs.com/package/@sinclair/typebox/v/0.25.18)
|
||||
## [0.25.18](https://www.npmjs.com/package/@alkdev/typebox/v/0.25.18)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.25.22](https://www.npmjs.com/package/@sinclair/typebox/v/0.25.22)
|
||||
## [0.25.22](https://www.npmjs.com/package/@alkdev/typebox/v/0.25.22)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.25.23](https://www.npmjs.com/package/@sinclair/typebox/v/0.25.23)
|
||||
## [0.25.23](https://www.npmjs.com/package/@alkdev/typebox/v/0.25.23)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.25.24](https://www.npmjs.com/package/@sinclair/typebox/v/0.25.23)
|
||||
## [0.25.24](https://www.npmjs.com/package/@alkdev/typebox/v/0.25.23)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.25.9](https://www.npmjs.com/package/@sinclair/typebox/v/0.25.9)
|
||||
## [0.25.9](https://www.npmjs.com/package/@alkdev/typebox/v/0.25.9)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.26.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.26.0)
|
||||
## [0.26.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.26.0)
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -36,7 +36,7 @@ Revision 0.26.0 is a milestone release for the TypeBox project and requires a mi
|
||||
Revision 0.26.0 exports a new type builder called `StandardType`. This builder only allows for the construction JSON Schema compliant types by omitting all Extended types.
|
||||
|
||||
```typescript
|
||||
import { StandardType as Type, Static } from '@sinclair/typebox'
|
||||
import { StandardType as Type, Static } from '@alkdev/typebox'
|
||||
|
||||
const T = Type.Date() // error: no such function
|
||||
```
|
||||
@@ -172,7 +172,7 @@ const All = [...Value.Errors(T, 'foo')] // const All = [{ path: '',
|
||||
Revision 0.26.0 adds a `.Code()` function to the `TypeCompiler` to enable code generation without JIT evaluation.
|
||||
|
||||
```typescript
|
||||
import { TypeCompiler } from '@sinclair/typebox/compiler'
|
||||
import { TypeCompiler } from '@alkdev/typebox/compiler'
|
||||
|
||||
const T = Type.Object({
|
||||
x: Type.Number(),
|
||||
@@ -361,12 +361,12 @@ const V = Value.Cast(T, Value.Convert(T, '42')) // const V = 42 - 0.26.0
|
||||
|
||||
## Moved TypeGuard Module
|
||||
|
||||
The `TypeGuard` is now imported via the `@sinclair/typebox` module. This move is due to the TypeBox compositor internally using the guard when constructing types.
|
||||
The `TypeGuard` is now imported via the `@alkdev/typebox` module. This move is due to the TypeBox compositor internally using the guard when constructing types.
|
||||
|
||||
```typescript
|
||||
import { TypeGuard } from '@sinclair/typebox/guard' // 0.25.0
|
||||
import { TypeGuard } from '@alkdev/typebox/guard' // 0.25.0
|
||||
|
||||
import { TypeGuard } from '@sinclair/typebox' // 0.26.0
|
||||
import { TypeGuard } from '@alkdev/typebox' // 0.26.0
|
||||
```
|
||||
|
||||
<a name="Format-Renamed-to-FormatRegistry"></a>
|
||||
@@ -376,9 +376,9 @@ import { TypeGuard } from '@sinclair/typebox' // 0.26.0
|
||||
The `Format` module has been renamed to `FormatRegistry` and moved to the `typebox.ts` module.
|
||||
|
||||
```typescript
|
||||
import { Format } from '@sinclair/typebox/format' // 0.25.0
|
||||
import { Format } from '@alkdev/typebox/format' // 0.25.0
|
||||
|
||||
import { FormatRegistry } from '@sinclair/typebox' // 0.26.0
|
||||
import { FormatRegistry } from '@alkdev/typebox' // 0.26.0
|
||||
```
|
||||
|
||||
<a name="Custom-Renamed-to-TypeRegistry"></a>
|
||||
@@ -388,7 +388,7 @@ import { FormatRegistry } from '@sinclair/typebox' // 0.26.0
|
||||
The `Format` module has been renamed to `FormatRegistry` and moved to the `typebox.ts` module.
|
||||
|
||||
```typescript
|
||||
import { Custom } from '@sinclair/typebox/format' // 0.25.0
|
||||
import { Custom } from '@alkdev/typebox/format' // 0.25.0
|
||||
|
||||
import { TypeRegistry } from '@sinclair/typebox' // 0.26.0
|
||||
import { TypeRegistry } from '@alkdev/typebox' // 0.26.0
|
||||
```
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.26.2](https://www.npmjs.com/package/@sinclair/typebox/v/0.26.2)
|
||||
## [0.26.2](https://www.npmjs.com/package/@alkdev/typebox/v/0.26.2)
|
||||
|
||||
Updates:
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.27.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.27.0)
|
||||
## [0.27.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.27.0)
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -75,7 +75,7 @@ The following generates a 8-bit binary sequence for the given expression.
|
||||
|
||||
```typescript
|
||||
|
||||
import { TemplateLiteralParser, TemplateLiteralGenerator, TemplateLiteralFinite } from '@sinclair/typebox'
|
||||
import { TemplateLiteralParser, TemplateLiteralGenerator, TemplateLiteralFinite } from '@alkdev/typebox'
|
||||
|
||||
const Bit = `(0|1)` // bit union
|
||||
const Byte = `${Bit}${Bit}${Bit}${Bit}${Bit}${Bit}${Bit}${Bit}` // byte sequence
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.27.1](https://www.npmjs.com/package/@sinclair/typebox/v/0.27.1)
|
||||
## [0.27.1](https://www.npmjs.com/package/@alkdev/typebox/v/0.27.1)
|
||||
|
||||
## Updates
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.28.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.28.0)
|
||||
## [0.28.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.28.0)
|
||||
|
||||
## Overview
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.28.3](https://www.npmjs.com/package/@sinclair/typebox/v/0.28.3)
|
||||
## [0.28.3](https://www.npmjs.com/package/@alkdev/typebox/v/0.28.3)
|
||||
|
||||
## Overview
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.29.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.29.0)
|
||||
## [0.29.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.29.0)
|
||||
|
||||
## Overview
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.29.2](https://www.npmjs.com/package/@sinclair/typebox/v/0.29.2)
|
||||
## [0.29.2](https://www.npmjs.com/package/@alkdev/typebox/v/0.29.2)
|
||||
|
||||
## Overview
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.30.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.30.0)
|
||||
## [0.30.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.30.0)
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -151,13 +151,13 @@ The top level `Value.*` namespace will remain on all subsequent versions of Type
|
||||
```typescript
|
||||
// Revision 0.29.0
|
||||
//
|
||||
import { Value } from '@sinclair/typebox/value' // Value.* namespace
|
||||
import { Value } from '@alkdev/typebox/value' // Value.* namespace
|
||||
|
||||
const A = Value.Create(Type.String())
|
||||
|
||||
// Revision 0.30.0
|
||||
//
|
||||
import { Create } from '@sinclair/typebox/value/create' // Only Create()
|
||||
import { Create } from '@alkdev/typebox/value/create' // Only Create()
|
||||
|
||||
const A = Create(Type.String())
|
||||
```
|
||||
@@ -246,7 +246,7 @@ Revision 0.30.0 offers an external code generation API tool which can be used to
|
||||
[TypeBox-Code Project](https://github.com/sinclairzx81/typebox-codegen)
|
||||
|
||||
```typescript
|
||||
import * as Codegen from '@sinclair/typebox-codegen'
|
||||
import * as Codegen from '@alkdev/typebox-codegen'
|
||||
|
||||
const Code = Codegen.TypeScriptToTypeBox.Generate(`
|
||||
type T = { x: number, y: number, z: number }
|
||||
@@ -256,7 +256,7 @@ console.log(Code)
|
||||
|
||||
// Output:
|
||||
//
|
||||
// import { Type, Static } from '@sinclair/typebox'
|
||||
// import { Type, Static } from '@alkdev/typebox'
|
||||
//
|
||||
// type T = Static<typeof T>
|
||||
// const T = Type.Object({
|
||||
@@ -272,7 +272,7 @@ console.log(Code)
|
||||
|
||||
Revision 0.30.0 includes a reference implementation for JSON Type Definition (RFC 8927). This specification is currently under consideration for inclusion in the TypeBox library as an alternative schema representation for nominal type systems. The implementation currently contains all types expressed in the JSON Type Definition spec, but omits constraints such and `minimum` and `maximum` values (which are not formally represented in the specification).
|
||||
|
||||
The implementation is offered as a single file which can be copied in to projects with TypeBox installed. This implementation may be enhanced over the next few revisions (with some potential to implement mapping types such as partial, required, omit, pick, keyof). This specification will be considered for inclusion under `@sinclair/typebox/typedef` if there is enough interest.
|
||||
The implementation is offered as a single file which can be copied in to projects with TypeBox installed. This implementation may be enhanced over the next few revisions (with some potential to implement mapping types such as partial, required, omit, pick, keyof). This specification will be considered for inclusion under `@alkdev/typebox/typedef` if there is enough interest.
|
||||
|
||||
```typescript
|
||||
import { Type } from './typedef' // from: examples/typedef/typedef.ts
|
||||
@@ -408,7 +408,7 @@ const T = Type.String({ pattern: /abc/.source }) // Standard Type
|
||||
For Unicode (UTF-16) support on 0.30.0, the recommendation is to continue using user defined formats.
|
||||
|
||||
```typescript
|
||||
import { Type, FormatRegistry } from '@sinclair/typebox'
|
||||
import { Type, FormatRegistry } from '@alkdev/typebox'
|
||||
|
||||
FormatRegistry.Set('emoji', value => /<a?:.+?:\d{18}>|\p{Extended_Pictographic}/gu.test(value))
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## [0.31.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.31.0)
|
||||
## [0.31.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.31.0)
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -30,7 +30,7 @@ Revision 0.31.0 includes a new codec system referred to as Transform types. A Tr
|
||||
The following shows a Transform type which increments and decrements a number.
|
||||
|
||||
```typescript
|
||||
import { Value } from '@sinclair/typebox/value'
|
||||
import { Value } from '@alkdev/typebox/value'
|
||||
|
||||
const T = Type.Transform(Type.Number()) // const T = {
|
||||
.Decode(value => value + 1) // type: 'number',
|
||||
@@ -191,14 +191,14 @@ Revision 0.31.0 updates the inference strategy for Record types and generalizes
|
||||
```typescript
|
||||
// 0.30.0
|
||||
//
|
||||
import { RecordKey, TSchema } from '@sinclair/typebox'
|
||||
import { RecordKey, TSchema } from '@alkdev/typebox'
|
||||
|
||||
function StrictRecord<K extends RecordKey, T extends TSchema>(K: K, T: T) {
|
||||
return Type.Record(K, T, { additionalProperties: false }) // Error: RecordKey unresolvable to overload
|
||||
}
|
||||
// 0.31.0
|
||||
//
|
||||
import { TSchema } from '@sinclair/typebox'
|
||||
import { TSchema } from '@alkdev/typebox'
|
||||
|
||||
function StrictRecord<K extends TSchema, T extends TSchema>(K: K, T: T) {
|
||||
return Type.Record(K, T, { additionalProperties: false }) // Ok: dynamically mapped
|
||||
@@ -218,8 +218,8 @@ const C = StrictRecord(Type.BigInt(), Type.Null()) // const C: TNeve
|
||||
Revision 0.31.0 updates all errors thrown by TypeBox to extend the sub type `TypeBoxError`. This can be used to help narrow down the source of errors in `try/catch` blocks.
|
||||
|
||||
```typescript
|
||||
import { Type, TypeBoxError } from '@sinclair/typebox'
|
||||
import { Value } from '@sinclair/typebox/value'
|
||||
import { Type, TypeBoxError } from '@alkdev/typebox'
|
||||
import { Value } from '@alkdev/typebox/value'
|
||||
|
||||
try {
|
||||
const A = Value.Decode(Type.Number(), 'hello')
|
||||
@@ -237,7 +237,7 @@ try {
|
||||
Revision 0.31.0 adds functionality to remap error messages with the TypeSystemErrorFunction. This function is invoked whenever a validation error is generated in TypeBox. The following is an example of a custom TypeSystemErrorFunction using some of the messages TypeBox generates by default. TypeBox also provides the DefaultErrorFunction which can be used for fallthrough cases.
|
||||
|
||||
```typescript
|
||||
import { TypeSystemErrorFunction, DefaultErrorFunction } from '@sinclair/typebox/system'
|
||||
import { TypeSystemErrorFunction, DefaultErrorFunction } from '@alkdev/typebox/system'
|
||||
|
||||
// Example CustomErrorFunction
|
||||
export function CustomErrorFunction(schema: Types.TSchema, errorType: ValueErrorType) {
|
||||
@@ -317,13 +317,13 @@ Revision 0.31.0 moves the `TypeSystem.Policy` configurations into a new type nam
|
||||
```typescript
|
||||
// Revision 0.30.0
|
||||
//
|
||||
import { TypeSystem } from '@sinclair/typebox/system'
|
||||
import { TypeSystem } from '@alkdev/typebox/system'
|
||||
|
||||
TypeSystem.AllowNaN = true
|
||||
|
||||
// Revision 0.31.0
|
||||
//
|
||||
import { TypeSystemPolicy } from '@sinclair/typebox/system'
|
||||
import { TypeSystemPolicy } from '@alkdev/typebox/system'
|
||||
|
||||
TypeSystemPolicy.AllowNaN = true
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
- [Revision 0.32.1](https://github.com/sinclairzx81/typebox/pull/701) Specify default exports for Web Pack
|
||||
|
||||
|
||||
## [0.32.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.32.0)
|
||||
## [0.32.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.32.0)
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -79,9 +79,9 @@ This revision is a milestone revision for the TypeBox project. It has several br
|
||||
Revision 0.32.0 adds the ability to import types individually.
|
||||
|
||||
```typescript
|
||||
import { Type, type Static } from '@sinclair/typebox' // classic - 37.0 kb minified
|
||||
import { Type, type Static } from '@alkdev/typebox' // classic - 37.0 kb minified
|
||||
|
||||
import { Object, String, Number, type Static } from '@sinclair/typebox' // selective - 6.5 kb minified
|
||||
import { Object, String, Number, type Static } from '@alkdev/typebox' // selective - 6.5 kb minified
|
||||
```
|
||||
|
||||
<a name="Value-Function-Imports"></a>
|
||||
@@ -91,9 +91,9 @@ import { Object, String, Number, type Static } from '@sinclair/typebox' // selec
|
||||
Revision 0.32.0 adds the ability to import value functions from the `/value` module path.
|
||||
|
||||
```typescript
|
||||
import { Value } from '@sinclair/typebox/value' // classic - 61.5 kb minified
|
||||
import { Value } from '@alkdev/typebox/value' // classic - 61.5 kb minified
|
||||
|
||||
import { Check } from '@sinclair/typebox/value' // selective - 18.2 kb minified
|
||||
import { Check } from '@alkdev/typebox/value' // selective - 18.2 kb minified
|
||||
```
|
||||
|
||||
### CommonJS and ESM
|
||||
@@ -383,7 +383,7 @@ The following shows the changes from 0.31.0 to 0.32.0.
|
||||
```typescript
|
||||
// Revision 0.31.0
|
||||
|
||||
import { TypeSystemErrorFunction } from '@sinclair/typebox/system'
|
||||
import { TypeSystemErrorFunction } from '@alkdev/typebox/system'
|
||||
|
||||
TypeSystemErrorFunction.Set((schema, errorType) => {
|
||||
|
||||
@@ -392,7 +392,7 @@ TypeSystemErrorFunction.Set((schema, errorType) => {
|
||||
|
||||
// Revision 0.32.0
|
||||
|
||||
import { SetErrorFunction } from '@sinclair/typebox/errors'
|
||||
import { SetErrorFunction } from '@alkdev/typebox/errors'
|
||||
|
||||
SetErrorFunction(({ schema, errorType, path, value }) => { // as destructured object
|
||||
|
||||
@@ -416,13 +416,13 @@ Revision 0.32.0 renames the `Optional`, `Required` and `Transform` symbols to `O
|
||||
|
||||
```typescript
|
||||
// Revision 0.31.0
|
||||
import { Kind, Hint, Optional, Required, Transform } from '@sinclair/typebox' // these are symbols
|
||||
import { Kind, Hint, Optional, Required, Transform } from '@alkdev/typebox' // these are symbols
|
||||
|
||||
// Revision 0.32.0
|
||||
import {
|
||||
Kind, Hint, OptionalKind, RequiredKind, TransformKind, // these are symbols
|
||||
Optional, Required, Transform // these are type imports
|
||||
} from '@sinclair/typebox'
|
||||
} from '@alkdev/typebox'
|
||||
```
|
||||
|
||||
<a name="Breaking-TypeGuard-Interface-Change"></a>
|
||||
@@ -434,13 +434,13 @@ Revision 0.32.0 has a breaking interface change on the TypeGuard utility where t
|
||||
```typescript
|
||||
// Revision 0.31.0
|
||||
|
||||
import { TypeGuard, Kind } from '@sinclair/typebox'
|
||||
import { TypeGuard, Kind } from '@alkdev/typebox'
|
||||
|
||||
const R = TypeGuard.TString({ ... })
|
||||
|
||||
// Revision 0.32.0
|
||||
|
||||
import { TypeGuard } from '@sinclair/typebox'
|
||||
import { TypeGuard } from '@alkdev/typebox'
|
||||
|
||||
const R = TypeGuard.IsString({ ... })
|
||||
```
|
||||
@@ -454,11 +454,11 @@ The value submodule function import paths are unfortunately no longer supported.
|
||||
```typescript
|
||||
// Revision 0.31.0
|
||||
|
||||
import { Check } from '@sinclair/typebox/value/check'
|
||||
import { Check } from '@alkdev/typebox/value/check'
|
||||
|
||||
// Revision 0.32.0
|
||||
|
||||
import { Check } from '@sinclair/typebox/value'
|
||||
import { Check } from '@alkdev/typebox/value'
|
||||
```
|
||||
|
||||
<a name="Breaking-Error-Function"></a>
|
||||
@@ -470,7 +470,7 @@ The TypeSystemErrorFunction has been replaced with SetErrorFunction which can be
|
||||
```typescript
|
||||
// Revision 0.31.0
|
||||
|
||||
import { TypeSystemErrorFunction, ValueErrorType, DefaultErrorFunction } from '@sinclair/typebox/system'
|
||||
import { TypeSystemErrorFunction, ValueErrorType, DefaultErrorFunction } from '@alkdev/typebox/system'
|
||||
|
||||
TypeSystemErrorFunction.Set((schema, errorType) => { // i18n override
|
||||
switch(errorType) {
|
||||
@@ -483,7 +483,7 @@ TypeSystemErrorFunction.Set((schema, errorType) => { // i18n override
|
||||
|
||||
// Revision 0.32.0
|
||||
|
||||
import { SetErrorFunction, ValueErrorType, DefaultErrorFunction } from '@sinclair/typebox/errors'
|
||||
import { SetErrorFunction, ValueErrorType, DefaultErrorFunction } from '@alkdev/typebox/errors'
|
||||
|
||||
SetErrorFunction((error) => { // i18n override
|
||||
switch(error.errorType) {
|
||||
|
||||
@@ -3,19 +3,21 @@
|
||||
---
|
||||
|
||||
### Revision Updates
|
||||
- [Revision 0.34.48](https://github.com/sinclairzx81/typebox-legacy/pull/6)
|
||||
- [Revision 0.34.49](https://github.com/sinclairzx81/sinclair-typebox/pull/11)
|
||||
- Documentation Update - Link to 1.x. Updates in support of non-legacy 1.x compiler backport.
|
||||
- [Revision 0.34.48](https://github.com/sinclairzx81/sinclair-typebox/pull/6)
|
||||
- Support Sparse Array Validation
|
||||
- [Revision 0.34.47](https://github.com/sinclairzx81/typebox-legacy/pull/5)
|
||||
- [Revision 0.34.47](https://github.com/sinclairzx81/sinclair-typebox/pull/5)
|
||||
- Annual License Update
|
||||
- [Revision 0.34.46](https://github.com/sinclairzx81/typebox-legacy/pull/4)
|
||||
- [Revision 0.34.46](https://github.com/sinclairzx81/sinclair-typebox/pull/4)
|
||||
- Ensure TObject Instances remain Covariant with TObject Types.
|
||||
- [Revision 0.34.45](https://github.com/sinclairzx81/typebox-legacy/pull/2)
|
||||
- Documentation Update - Resolve Readme Assets to TypeBox Legacy Repository.
|
||||
- [Revision 0.34.44](https://github.com/sinclairzx81/typebox-legacy/pull/2)
|
||||
- [Revision 0.34.45](https://github.com/sinclairzx81/sinclair-typebox/pull/2)
|
||||
- Documentation Update - Resolve Readme Assets to Sinclair TypeBox Repository.
|
||||
- [Revision 0.34.44](https://github.com/sinclairzx81/sinclair-typebox/pull/2)
|
||||
- Documentation Update - Rename Project to TypeBox 0.34.x
|
||||
- [Revision 0.34.43](https://github.com/sinclairzx81/typebox-legacy/pull/1)
|
||||
- Configure Package Homepage to refer to TypeBox Legacy Repository.
|
||||
- [Revision 0.34.42](https://github.com/sinclairzx81/typebox-legacy)
|
||||
- [Revision 0.34.43](https://github.com/sinclairzx81/sinclair-typebox/pull/1)
|
||||
- Configure Package Homepage to refer to Sinclair TypeBox Repository.
|
||||
- [Revision 0.34.42](https://github.com/sinclairzx81/sinclair-typebox)
|
||||
- Enable Forward Type Inference Compatibility with TypeBox V1
|
||||
- [Revision 0.34.41](https://github.com/sinclairzx81/typebox/pull/1310)
|
||||
- Disable Node10 Module Resolution | TS7 Deprecation Warning.
|
||||
@@ -105,7 +107,7 @@
|
||||
- [Revision 0.34.1](https://github.com/sinclairzx81/typebox/pull/1080)
|
||||
- Implement Computed Type Deref in Modules
|
||||
|
||||
## [0.34.0](https://www.npmjs.com/package/@sinclair/typebox/v/0.34.0)
|
||||
## [0.34.0](https://www.npmjs.com/package/@alkdev/typebox/v/0.34.0)
|
||||
|
||||
## Overview
|
||||
|
||||
@@ -175,10 +177,10 @@ Revision 0.34.0 introduces a new submodule for parsing TypeScript syntax directl
|
||||
|
||||
As of 0.34.0, Syntax Types are available as an opt-in feature, with the parsing infrastructure adding approximately 10kb (minified) to the existing type builder. With further optimizations, this feature may be elevated to a top-level import in future updates to minimize bundling size.
|
||||
|
||||
To use Syntax Types, import them from the `@sinclair/typebox/syntax` path.
|
||||
To use Syntax Types, import them from the `@alkdev/typebox/syntax` path.
|
||||
|
||||
```typescript
|
||||
import { Parse } from '@sinclair/typebox/syntax'
|
||||
import { Parse } from '@alkdev/typebox/syntax'
|
||||
|
||||
// All primitive types are supported
|
||||
|
||||
|
||||
Reference in New Issue
Block a user