File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 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 {
1818 path ?: infer P
1919 query ?: infer Q
2020 body ?: infer B
21+ header ?: unknown // ignore
22+ cookie ?: unknown // ignore
2123 }
2224 // openapi 3
2325 requestBody ?: {
Original file line number Diff line number Diff line change @@ -97,6 +97,34 @@ describe('infer', () => {
9797 expect ( same ) . toBe ( true )
9898 } )
9999
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+
100128 const err : Err = { data : { error : { } } } as any
101129 expect ( err . data . error . charge ) . toBeUndefined ( )
102130 } )
You can’t perform that action at this time.
0 commit comments