File tree 2 files changed +30
-0
lines changed 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ export type OpArgType<OP> = OP extends {
18
18
path ?: infer P
19
19
query ?: infer Q
20
20
body ?: infer B
21
+ header ?: unknown // ignore
22
+ cookie ?: unknown // ignore
21
23
}
22
24
// openapi 3
23
25
requestBody ?: {
Original file line number Diff line number Diff line change @@ -97,6 +97,34 @@ describe('infer', () => {
97
97
expect ( same ) . toBe ( true )
98
98
} )
99
99
100
+ it ( 'only header/cookie parameter with requestBody' , ( ) => {
101
+ type RequestBody = {
102
+ requestBody : {
103
+ content : {
104
+ 'application/json' : { bar : boolean }
105
+ }
106
+ }
107
+ }
108
+
109
+ type HeaderOnly = {
110
+ parameters : {
111
+ header : { foo : string }
112
+ }
113
+ } & RequestBody
114
+
115
+ type CookieOnly = {
116
+ parameters : {
117
+ cookie : { foo : string }
118
+ }
119
+ } & RequestBody
120
+
121
+ const header : Same < OpArgType < HeaderOnly > , { bar : boolean } > = true
122
+ const cookie : Same < OpArgType < CookieOnly > , { bar : boolean } > = true
123
+
124
+ expect ( header ) . toBe ( true )
125
+ expect ( cookie ) . toBe ( true )
126
+ } )
127
+
100
128
const err : Err = { data : { error : { } } } as any
101
129
expect ( err . data . error . charge ) . toBeUndefined ( )
102
130
} )
You can’t perform that action at this time.
0 commit comments