@@ -6,12 +6,18 @@ import {
6
6
type ContextDelegation as EggCoreContextDelegation ,
7
7
} from '@eggjs/core' ;
8
8
import type { Cookies as ContextCookies } from '@eggjs/cookies' ;
9
+ import { EggLogger } from 'egg-logger' ;
9
10
import type { Application } from '../../lib/application.js' ;
11
+ import type {
12
+ HttpClientRequestURL , HttpClientRequestOptions , HttpClient ,
13
+ } from '../../lib/core/httpclient.js' ;
10
14
import type { ContextHttpClient } from '../../lib/core/context_httpclient.js' ;
11
15
import type { BaseContextClass } from '../../lib//core/base_context_class.js' ;
12
16
import Request from './request.js' ;
13
17
import Response from './response.js' ;
14
- import { EggLogger } from 'egg-logger' ;
18
+ import type Helper from './helper.js' ;
19
+
20
+ import './context.types.js' ;
15
21
16
22
const HELPER = Symbol ( 'ctx helper' ) ;
17
23
const LOCALS = Symbol ( 'ctx locals' ) ;
@@ -79,7 +85,7 @@ export default class Context extends EggCoreContext {
79
85
* @param {Object } [options] - options for request.
80
86
* @return {Object } see {@link ContextHttpClient#curl}
81
87
*/
82
- async curl ( url : string , options ?: object ) : ReturnType < ContextHttpClient [ 'curl '] > {
88
+ async curl ( url : HttpClientRequestURL , options ?: HttpClientRequestOptions ) : ReturnType < HttpClient [ 'request '] > {
83
89
return await this . httpclient . curl ( url , options ) ;
84
90
}
85
91
@@ -114,11 +120,11 @@ export default class Context extends EggCoreContext {
114
120
* @member {Helper} Context#helper
115
121
* @since 1.0.0
116
122
*/
117
- get helper ( ) {
123
+ get helper ( ) : Helper {
118
124
if ( ! this [ HELPER ] ) {
119
125
this [ HELPER ] = new this . app . Helper ( this as any ) ;
120
126
}
121
- return this [ HELPER ] ;
127
+ return this [ HELPER ] as Helper ;
122
128
}
123
129
124
130
/**
0 commit comments