Skip to content

Commit a67e380

Browse files
authored
Revision 0.34.28 (#1187)
* Add Cast to Parse Pipeline * Version * ChangeLog
1 parent 713fd48 commit a67e380

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

changelog/0.34.0.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
---
44

55
### Revision Updates
6+
- [Revision 0.34.28](https://github.com/sinclairzx81/typebox/pull/1187)
7+
- Add Cast to Configurable Parse Pipeline
68
- [Revision 0.34.27](https://github.com/sinclairzx81/typebox/pull/1182)
79
- [1178](https://github.com/sinclairzx81/typebox/issues/1178) Support Deep Referential Transform Inference Inside Modules
810
- [Revision 0.34.26](https://github.com/sinclairzx81/typebox/pull/1181)

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sinclair/typebox",
3-
"version": "0.34.27",
3+
"version": "0.34.28",
44
"description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
55
"keywords": [
66
"typescript",

src/value/parse/parse.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ import { TransformDecode, TransformEncode, HasTransform } from '../transform/ind
3131
import { TSchema } from '../../type/schema/index'
3232
import { StaticDecode } from '../../type/static/index'
3333
import { Assert } from '../assert/index'
34-
import { Default } from '../default/index'
35-
import { Convert } from '../convert/index'
34+
import { Cast } from '../cast/index'
3635
import { Clean } from '../clean/index'
3736
import { Clone } from '../clone/index'
37+
import { Convert } from '../convert/index'
38+
import { Default } from '../default/index'
3839

3940
// ------------------------------------------------------------------
4041
// Guards
@@ -53,18 +54,19 @@ export class ParseError extends TypeBoxError {
5354
// ------------------------------------------------------------------
5455
// ParseRegistry
5556
// ------------------------------------------------------------------
56-
export type TParseOperation = 'Clone' | 'Clean' | 'Default' | 'Convert' | 'Assert' | 'Decode' | 'Encode' | ({} & string)
57+
export type TParseOperation = 'Assert' | 'Cast' | 'Clean' | 'Clone' | 'Convert' | 'Decode' | 'Default' | 'Encode' | ({} & string)
5758
export type TParseFunction = (type: TSchema, references: TSchema[], value: unknown) => unknown
5859

5960
// prettier-ignore
6061
export namespace ParseRegistry {
6162
const registry = new Map<string, TParseFunction>([
62-
['Clone', (_type, _references, value: unknown) => Clone(value)],
63+
['Assert', (type, references, value: unknown) => { Assert(type, references, value); return value }],
64+
['Cast', (type, references, value: unknown) => Cast(type, references, value)],
6365
['Clean', (type, references, value: unknown) => Clean(type, references, value)],
64-
['Default', (type, references, value: unknown) => Default(type, references, value)],
66+
['Clone', (_type, _references, value: unknown) => Clone(value)],
6567
['Convert', (type, references, value: unknown) => Convert(type, references, value)],
66-
['Assert', (type, references, value: unknown) => { Assert(type, references, value); return value }],
6768
['Decode', (type, references, value: unknown) => (HasTransform(type, references) ? TransformDecode(type, references, value) : value)],
69+
['Default', (type, references, value: unknown) => Default(type, references, value)],
6870
['Encode', (type, references, value: unknown) => (HasTransform(type, references) ? TransformEncode(type, references, value) : value)],
6971
])
7072
// Deletes an entry from the registry
@@ -81,7 +83,7 @@ export namespace ParseRegistry {
8183
}
8284
}
8385
// ------------------------------------------------------------------
84-
// Default Parse Sequence
86+
// Default Parse Pipeline
8587
// ------------------------------------------------------------------
8688
// prettier-ignore
8789
export const ParseDefault = [

0 commit comments

Comments
 (0)