File tree Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Expand file tree Collapse file tree 2 files changed +7
-12
lines changed Original file line number Diff line number Diff line change 1
1
import { t } from 'elysia'
2
2
import { createAccelerator } from '../src/index'
3
3
4
- const v = t . Module ( {
5
- a : t . Object ( {
6
- name : t . String ( ) ,
7
- job : t . Optional ( t . Ref ( 'job' ) ) ,
8
- trait : t . Optional ( t . String ( ) )
9
- } ) ,
10
- job : t . Number ( )
4
+ const shape = t . Object ( {
5
+ name : t . String ( ) ,
6
+ playing : t . Nullable ( t . Integer ( { default : 1 } ) )
11
7
} )
12
8
13
- const shape = v . Import ( 'a' )
9
+ console . log ( t . Optional ( t . String ( ) ) )
14
10
15
11
const value = {
16
- name : 'Jane Doe' ,
17
- job : 'Software Engineer' ,
18
- trait : 'Friendly'
12
+ name : 'saltyaom' ,
13
+ playing : null
19
14
} satisfies typeof shape . static
20
15
21
16
const mirror = createAccelerator ( shape )
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ const isInteger = (schema: TAnySchema) => {
36
36
continue
37
37
}
38
38
39
- if ( ! hasNumberType && type . type === 'number' ) {
39
+ if ( ! hasNumberType && ( type . type === 'number' || type . type === 'integer' ) ) {
40
40
hasNumberType = true
41
41
continue
42
42
}
You can’t perform that action at this time.
0 commit comments