@@ -4,18 +4,19 @@ import {
4
4
SubTypeKey ,
5
5
TupleSchema ,
6
6
} from '../structure' ;
7
- import { DynamicArraySchema } from '../structure/dynamicArray' ;
7
+ import { ArraySchema } from '../structure/array' ;
8
+ import { KeyedSchema } from '../structure/keyed' ;
8
9
import { OptionalSchema } from '../structure/optional' ;
10
+ import { TypedArraySchema } from '../structure/typedArray' ;
11
+ import { DynamicArraySchema } from '../structure/dynamicArray' ;
9
12
import { AnyObjectSchema , GenericObjectSchema } from '../structure/object' ;
10
- import { ArraySchema } from '../structure/array' ;
11
13
import {
12
14
ISchema ,
13
15
Ref ,
14
16
AnySchema ,
15
17
Unwrap ,
16
18
AnySchemaWithProperties ,
17
19
} from '../structure/types' ;
18
- import { KeyedSchema } from '../structure/keyed' ;
19
20
import { MergeRecordUnion } from '../utilityTypes' ;
20
21
21
22
export const chars = < T extends number > ( length : T ) => new CharsSchema ( length ) ;
@@ -56,6 +57,33 @@ export const tupleOf = <TSchema extends [AnySchema, ...AnySchema[]]>(
56
57
schemas : TSchema ,
57
58
) => new TupleSchema ( schemas ) ;
58
59
60
+ export const u8Array = ( length : number ) =>
61
+ new TypedArraySchema ( length , Uint8Array ) ;
62
+
63
+ export const u8ClampedArray = ( length : number ) =>
64
+ new TypedArraySchema ( length , Uint8ClampedArray ) ;
65
+
66
+ export const u16Array = ( length : number ) =>
67
+ new TypedArraySchema ( length , Uint16Array ) ;
68
+
69
+ export const u32Array = ( length : number ) =>
70
+ new TypedArraySchema ( length , Uint32Array ) ;
71
+
72
+ export const i8Array = ( length : number ) =>
73
+ new TypedArraySchema ( length , Int8Array ) ;
74
+
75
+ export const i16Array = ( length : number ) =>
76
+ new TypedArraySchema ( length , Int16Array ) ;
77
+
78
+ export const i32Array = ( length : number ) =>
79
+ new TypedArraySchema ( length , Int32Array ) ;
80
+
81
+ export const f32Array = ( length : number ) =>
82
+ new TypedArraySchema ( length , Float32Array ) ;
83
+
84
+ export const f64Array = ( length : number ) =>
85
+ new TypedArraySchema ( length , Float64Array ) ;
86
+
59
87
export const optional = < TSchema extends AnySchema > ( innerType : TSchema ) =>
60
88
new OptionalSchema ( innerType ) ;
61
89
0 commit comments