@@ -20,7 +20,7 @@ import type { KeqQueryValue } from './types/keq-query-value.js'
20
20
import type { KeqResolveMethod } from './types/keq-resolve-with-mode.js'
21
21
import type { CommonContentType , ShorthandContentType } from './types/content-type.js'
22
22
import type { KeqContextOptions } from './types/keq-context.js'
23
- import type { ExtractFields , ExtractFiles , ExtractHeaders , ExtractParams , ExtractQuery , KeqBaseOperation , KeqOperation } from './types/keq-operation.js'
23
+ import type { ExtractFields , ExtractFiles , KeqBaseOperation , KeqOperation } from './types/keq-operation.js'
24
24
import type { KeqContextRequestBody } from './types/keq-context-request.js'
25
25
import { isValidHeaderValue } from './util/is-valid-header-value.js'
26
26
import { isReadableStream } from './is/is-readable-stream.js'
@@ -58,14 +58,14 @@ export class Keq<
58
58
*
59
59
* @description 设置请求头
60
60
*/
61
- set ( headers : ExtractHeaders < OPERATION > ) : this
62
- set < T extends keyof ExtractHeaders < OPERATION > > ( name : T , value : ExtractHeaders < OPERATION > [ T ] ) : this
61
+ set ( headers : OPERATION [ 'requestHeaders' ] ) : this
62
+ set < T extends keyof OPERATION [ 'requestHeaders' ] > ( name : T , value : OPERATION [ 'requestHeaders' ] [ T ] ) : this
63
63
set < T extends keyof KeqBaseOperation [ 'requestHeaders' ] > ( name : T , value : KeqBaseOperation [ 'requestHeaders' ] [ T ] ) : this
64
64
set ( headers : Headers ) : this
65
65
set ( headers : Record < string , string > ) : this
66
66
set ( name : string , value : string | number ) : this
67
67
set (
68
- headersOrName : ExtractHeaders < OPERATION > | KeqOperation [ 'requestHeaders' ] | string | Record < string , string > | Headers ,
68
+ headersOrName : OPERATION [ 'requestHeaders' ] | KeqOperation [ 'requestHeaders' ] | string | Record < string , string > | Headers ,
69
69
value ?: string | number ,
70
70
) : this {
71
71
if ( isHeaders ( headersOrName ) ) {
@@ -94,11 +94,11 @@ export class Keq<
94
94
/**
95
95
* Set request query/searchParams
96
96
*/
97
- query ( key : ExtractQuery < OPERATION > ) : this
98
- query < T extends keyof ExtractQuery < OPERATION > > ( key : T , value : ExtractQuery < OPERATION > [ T ] ) : this
97
+ query ( key : OPERATION [ 'requestQuery' ] ) : this
98
+ query < T extends keyof OPERATION [ 'requestQuery' ] > ( key : T , value : OPERATION [ 'requestQuery' ] [ T ] ) : this
99
99
query ( key : Record < string , KeqQueryValue | KeqQueryValue [ ] > ) : this
100
100
query ( key : string , value : KeqQueryValue | KeqQueryValue [ ] ) : this
101
- query ( key : string | ExtractQuery < OPERATION > | Record < string , KeqQueryValue | KeqQueryValue [ ] > , value ?: KeqQueryValue | KeqQueryValue [ ] ) : this {
101
+ query ( key : string | OPERATION [ 'requestQuery' ] | Record < string , KeqQueryValue | KeqQueryValue [ ] > , value ?: KeqQueryValue | KeqQueryValue [ ] ) : this {
102
102
if ( typeof key === 'object' ) {
103
103
for ( const [ k , v ] of Object . entries ( key ) ) {
104
104
if ( v === undefined ) continue
@@ -129,11 +129,11 @@ export class Keq<
129
129
/**
130
130
* Set request route params
131
131
*/
132
- params ( key : ExtractParams < OPERATION > ) : this
133
- params < T extends keyof ExtractParams < OPERATION > > ( key : T , value : ExtractParams < OPERATION > [ T ] ) : this
132
+ params ( key : OPERATION [ 'requestParams' ] ) : this
133
+ params < T extends keyof OPERATION [ 'requestParams' ] > ( key : T , value : OPERATION [ 'requestParams' ] [ T ] ) : this
134
134
params ( key : Record < string , string | number > ) : this
135
135
params ( key : string , value : string | number ) : this
136
- params ( key : string | ExtractParams < OPERATION > | Record < string , string | number > , value ?: string | number ) : this {
136
+ params ( key : string | OPERATION [ 'requestParams' ] | Record < string , string | number > , value ?: string | number ) : this {
137
137
if ( typeof key === 'string' ) {
138
138
this . requestContext . routeParams [ key ] = String ( value )
139
139
} else if ( typeof key === 'object' ) {
0 commit comments