typebox 1.1.30 → 1.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/type/action/awaited.d.mts +5 -1
- package/build/type/action/awaited.mjs +5 -1
- package/build/type/types/async-iterator.d.mts +5 -1
- package/build/type/types/async-iterator.mjs +5 -1
- package/build/type/types/iterator.d.mts +5 -1
- package/build/type/types/iterator.mjs +5 -1
- package/build/type/types/promise.d.mts +5 -1
- package/build/type/types/promise.mjs +5 -1
- package/package.json +1 -1
- package/readme.md +0 -7
|
@@ -7,5 +7,9 @@ export type TAwaitedDeferred<Type extends TSchema> = (TDeferred<'Awaited', [Type
|
|
|
7
7
|
export declare function AwaitedDeferred<Type extends TSchema>(type: Type, options?: TSchemaOptions): TAwaitedDeferred<Type>;
|
|
8
8
|
/** Applies an Awaited action to a type. */
|
|
9
9
|
export type TAwaited<Type extends TSchema> = (TAwaitedAction<Type>);
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Applies an Awaited action to a type.
|
|
12
|
+
*
|
|
13
|
+
* @deprecated This action is being removed in the next version of TypeBox.
|
|
14
|
+
*/
|
|
11
15
|
export declare function Awaited<Type extends TSchema>(type: Type, options?: TSchemaOptions): TAwaited<Type>;
|
|
@@ -5,7 +5,11 @@ import { AwaitedAction } from '../engine/awaited/instantiate.mjs';
|
|
|
5
5
|
export function AwaitedDeferred(type, options = {}) {
|
|
6
6
|
return Deferred('Awaited', [type], options);
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Applies an Awaited action to a type.
|
|
10
|
+
*
|
|
11
|
+
* @deprecated This action is being removed in the next version of TypeBox.
|
|
12
|
+
*/
|
|
9
13
|
export function Awaited(type, options = {}) {
|
|
10
14
|
return AwaitedAction(type, options);
|
|
11
15
|
}
|
|
@@ -8,7 +8,11 @@ export interface TAsyncIterator<Type extends TSchema = TSchema> extends TSchema
|
|
|
8
8
|
type: 'asyncIterator';
|
|
9
9
|
iteratorItems: Type;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Creates a AsyncIterator type.
|
|
13
|
+
*
|
|
14
|
+
* @deprecated This type is being removed in the next version of TypeBox. A fallback will be provided under examples.
|
|
15
|
+
*/
|
|
12
16
|
export declare function AsyncIterator<Type extends TSchema>(iteratorItems: Type, options?: TSchemaOptions): TAsyncIterator<Type>;
|
|
13
17
|
/** Returns true if the given value is a TAsyncIterator */
|
|
14
18
|
export declare function IsAsyncIterator(value: unknown): value is TAsyncIterator;
|
|
@@ -4,7 +4,11 @@ import { IsKind } from './schema.mjs';
|
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Factory
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Creates a AsyncIterator type.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated This type is being removed in the next version of TypeBox. A fallback will be provided under examples.
|
|
11
|
+
*/
|
|
8
12
|
export function AsyncIterator(iteratorItems, options) {
|
|
9
13
|
return Memory.Create({ '~kind': 'AsyncIterator' }, { type: 'asyncIterator', iteratorItems }, options);
|
|
10
14
|
}
|
|
@@ -8,7 +8,11 @@ export interface TIterator<Type extends TSchema = TSchema> extends TSchema {
|
|
|
8
8
|
type: 'iterator';
|
|
9
9
|
iteratorItems: Type;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Creates a Iterator type.
|
|
13
|
+
*
|
|
14
|
+
* @deprecated This type is being removed in the next version of TypeBox. A fallback will be provided under examples.
|
|
15
|
+
*/
|
|
12
16
|
export declare function Iterator<Type extends TSchema>(iteratorItems: Type, options?: TSchemaOptions): TIterator<Type>;
|
|
13
17
|
/** Returns true if the given value is TIterator. */
|
|
14
18
|
export declare function IsIterator(value: unknown): value is TIterator;
|
|
@@ -4,7 +4,11 @@ import { IsKind } from './schema.mjs';
|
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Factory
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Creates a Iterator type.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated This type is being removed in the next version of TypeBox. A fallback will be provided under examples.
|
|
11
|
+
*/
|
|
8
12
|
export function Iterator(iteratorItems, options) {
|
|
9
13
|
return Memory.Create({ '~kind': 'Iterator' }, { type: 'iterator', iteratorItems }, options);
|
|
10
14
|
}
|
|
@@ -8,7 +8,11 @@ export interface TPromise<Type extends TSchema = TSchema> extends TSchema {
|
|
|
8
8
|
type: 'promise';
|
|
9
9
|
item: Type;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Creates a Promise type.
|
|
13
|
+
*
|
|
14
|
+
* @deprecated This type is being removed in the next version of TypeBox. A fallback will be provided under examples.
|
|
15
|
+
*/
|
|
12
16
|
export declare function _Promise_<Type extends TSchema>(item: Type, options?: TSchemaOptions): TPromise<Type>;
|
|
13
17
|
export { _Promise_ as Promise };
|
|
14
18
|
/** Returns true if the given type is TPromise. */
|
|
@@ -4,7 +4,11 @@ import { IsKind } from './schema.mjs';
|
|
|
4
4
|
// ------------------------------------------------------------------
|
|
5
5
|
// Factory
|
|
6
6
|
// ------------------------------------------------------------------
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Creates a Promise type.
|
|
9
|
+
*
|
|
10
|
+
* @deprecated This type is being removed in the next version of TypeBox. A fallback will be provided under examples.
|
|
11
|
+
*/
|
|
8
12
|
export function _Promise_(item, options) {
|
|
9
13
|
return Memory.Create({ ['~kind']: 'Promise' }, { type: 'promise', item }, options);
|
|
10
14
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -80,7 +80,6 @@ The following creates a User type and infers with Static.
|
|
|
80
80
|
```typescript
|
|
81
81
|
import Type from 'typebox'
|
|
82
82
|
|
|
83
|
-
|
|
84
83
|
// Type
|
|
85
84
|
|
|
86
85
|
const User = Type.Object({ // const User = {
|
|
@@ -100,7 +99,6 @@ const User = Type.Object({ // const User = {
|
|
|
100
99
|
// ]
|
|
101
100
|
// }
|
|
102
101
|
|
|
103
|
-
|
|
104
102
|
// Static
|
|
105
103
|
|
|
106
104
|
type User = Type.Static<typeof User> // type User = {
|
|
@@ -124,7 +122,6 @@ The following uses the Script function to parse TypeScript interfaces into JSON
|
|
|
124
122
|
```typescript
|
|
125
123
|
import Type from 'typebox'
|
|
126
124
|
|
|
127
|
-
|
|
128
125
|
// Script
|
|
129
126
|
|
|
130
127
|
const { User, UserUpdate } = Type.Script(`
|
|
@@ -145,7 +142,6 @@ const { User, UserUpdate } = Type.Script(`
|
|
|
145
142
|
|
|
146
143
|
`)
|
|
147
144
|
|
|
148
|
-
|
|
149
145
|
// Reflect
|
|
150
146
|
|
|
151
147
|
console.log(User) // {
|
|
@@ -172,7 +168,6 @@ console.log(UserUpdate) // {
|
|
|
172
168
|
// required: ['id']
|
|
173
169
|
// }
|
|
174
170
|
|
|
175
|
-
|
|
176
171
|
// Static
|
|
177
172
|
|
|
178
173
|
type User = Type.Static<typeof User> // type User = {
|
|
@@ -205,7 +200,6 @@ The following uses the Schema submodule to compile a TypeBox type.
|
|
|
205
200
|
```typescript
|
|
206
201
|
import Schema from 'typebox/schema'
|
|
207
202
|
|
|
208
|
-
|
|
209
203
|
// Compile
|
|
210
204
|
|
|
211
205
|
const User = Schema.Compile(Type.Object({ // const User = Validator<Type.TObject<{
|
|
@@ -214,7 +208,6 @@ const User = Schema.Compile(Type.Object({ // const User = Validator<Type.
|
|
|
214
208
|
email: Type.String({ format: 'email' }) // email: Type.TString;
|
|
215
209
|
})) // }>, { ... }>
|
|
216
210
|
|
|
217
|
-
|
|
218
211
|
// Parse
|
|
219
212
|
|
|
220
213
|
const user = User.Parse({ // const user: {
|