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:
2026-04-23 13:22:31 +00:00
parent 11f18ac6e9
commit bd758c2342
981 changed files with 1676 additions and 2054 deletions

View File

@@ -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