File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,7 @@ 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
21+ [ k : string ] : any
2322 }
2423 // openapi 3
2524 requestBody ?: {
Original file line number Diff line number Diff line change 1+ import { OpArgType } from '../src'
2+
3+ import { components , paths } from './examples/stations'
4+ type Op = paths [ '/stations' ] [ 'post' ]
5+ type Argument = components [ 'schemas' ] [ 'CreateStation' ]
6+
7+ type InferredArgument = OpArgType < Op >
8+
9+ type Same < A , B > = A extends B ? ( B extends A ? true : false ) : false
10+
11+ describe ( 'infer' , ( ) => {
12+ it ( 'argument' , ( ) => {
13+ const same : Same < Argument , InferredArgument > = true
14+ expect ( same ) . toBe ( true )
15+ } )
16+ } )
You can’t perform that action at this time.
0 commit comments