Skip to content

Commit

Permalink
Revision 0.32.20 (#810)
Browse files Browse the repository at this point in the history
* Solve TypeScript Compiler Emit Regression

* Version
  • Loading branch information
sinclairzx81 committed Mar 25, 2024
1 parent 3735b34 commit 480ba12
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 28 deletions.
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sinclair/typebox",
"version": "0.32.19",
"version": "0.32.20",
"description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
"keywords": [
"typescript",
Expand Down Expand Up @@ -37,6 +37,6 @@
"ajv-formats": "^2.1.1",
"mocha": "^9.2.2",
"prettier": "^2.7.1",
"typescript": "^5.4.2"
"typescript": "^5.4.3"
}
}
55 changes: 38 additions & 17 deletions src/value/delta/delta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,55 @@ import { ValuePointer } from '../pointer/index'
import { Clone } from '../clone/index'
import { TypeBoxError } from '../../type/error/index'

import { Literal as CreateLiteral } from '../../type/literal/index'
import { Object as CreateObject } from '../../type/object/index'
import { String as CreateString } from '../../type/string/index'
import { Unknown as CreateUnknown } from '../../type/unknown/index'
import { Union as CreateUnion } from '../../type/union/index'
import { Literal, type TLiteral } from '../../type/literal/index'
import { Object, type TObject } from '../../type/object/index'
import { String, type TString } from '../../type/string/index'
import { Unknown, type TUnknown } from '../../type/unknown/index'
import { Union, type TUnion } from '../../type/union/index'

// ------------------------------------------------------------------
// Commands
// ------------------------------------------------------------------

// Note: A TypeScript 5.4.2 compiler regression resulted in the type
// import paths being generated incorrectly. We can resolve this by
// explicitly importing the correct TSchema types above. Note also
// that the left-side annotations are optional, but since the types
// are imported we might as well use them. We should check this
// regression in future. The regression occured between TypeScript
// versions 5.3.3 -> 5.4.2.

export type Insert = Static<typeof Insert>
export const Insert = CreateObject({
type: CreateLiteral('insert'),
path: CreateString(),
value: CreateUnknown(),
export const Insert: TObject<{
type: TLiteral<'insert'>
path: TString
value: TUnknown
}> = Object({
type: Literal('insert'),
path: String(),
value: Unknown(),
})
export type Update = Static<typeof Update>
export const Update = CreateObject({
type: CreateLiteral('update'),
path: CreateString(),
value: CreateUnknown(),
export const Update: TObject<{
type: TLiteral<'update'>
path: TString
value: TUnknown
}> = Object({
type: Literal('update'),
path: String(),
value: Unknown(),
})
export type Delete = Static<typeof Delete>
export const Delete = CreateObject({
type: CreateLiteral('delete'),
path: CreateString(),
export const Delete: TObject<{
type: TLiteral<'delete'>
path: TString
}> = Object({
type: Literal('delete'),
path: String(),
})
export type Edit = Static<typeof Edit>
export const Edit = CreateUnion([Insert, Update, Delete])
export const Edit: TUnion<[typeof Insert, typeof Update, typeof Delete]> = Union([Insert, Update, Delete])

// ------------------------------------------------------------------
// Errors
// ------------------------------------------------------------------
Expand Down

0 comments on commit 480ba12

Please sign in to comment.