File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed
runtimes/server-interface Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ interface BaseSchema {
66 $id ?: string
77 $schema ?: string
88 definitions ?: Record < string , JSONSchema >
9+ [ extensionProperties : string ] : any
910}
1011
1112interface StringSchema extends BaseSchema {
@@ -74,9 +75,20 @@ type InferArray<T extends { type: 'array'; items: any }> = T['items'] extends {
7475 ? InferSchema < T [ 'items' ] > [ ]
7576 : never
7677
77- type InferObject < T extends { type : 'object' ; properties : Record < string , any > } > = {
78- [ K in keyof T [ 'properties' ] ] ?: InferSchema < T [ 'properties' ] [ K ] >
79- } & ( T extends { required : string [ ] } ? { [ K in T [ 'required' ] [ number ] ] : InferSchema < T [ 'properties' ] [ K ] > } : unknown )
78+ type InferObject <
79+ T extends {
80+ type : 'object'
81+ properties : Record < string , any >
82+ } ,
83+ > = T extends { required : readonly string [ ] }
84+ ? {
85+ [ K in keyof T [ 'properties' ] as K extends T [ 'required' ] [ number ] ? K : never ] : InferSchema < T [ 'properties' ] [ K ] >
86+ } & {
87+ [ K in keyof T [ 'properties' ] as K extends T [ 'required' ] [ number ] ? never : K ] ?: InferSchema < T [ 'properties' ] [ K ] >
88+ }
89+ : {
90+ [ K in keyof T [ 'properties' ] ] ?: InferSchema < T [ 'properties' ] [ K ] >
91+ }
8092
8193export type InferSchema < T > = T extends { type : 'array' ; items : any }
8294 ? InferArray < T >
You can’t perform that action at this time.
0 commit comments