@@ -135,7 +135,9 @@ export class Gaxios implements FetchCompliance {
135135 * Perform an HTTP request with the given options.
136136 * @param opts Set of HTTP options that will be used for this HTTP request.
137137 */
138- async request < T = any > ( opts : GaxiosOptions = { } ) : GaxiosPromise < T > {
138+ async request < T = ReturnType < JSON [ 'parse' ] > > (
139+ opts : GaxiosOptions = { } ,
140+ ) : GaxiosPromise < T > {
139141 let prepared = await this . #prepareRequest( opts ) ;
140142 prepared = await this . #applyRequestInterceptors( prepared ) ;
141143 return this . #applyResponseInterceptors( this . _request ( prepared ) ) ;
@@ -177,7 +179,7 @@ export class Gaxios implements FetchCompliance {
177179 * Internal, retryable version of the `request` method.
178180 * @param opts Set of HTTP options that will be used for this HTTP request.
179181 */
180- protected async _request < T = any > (
182+ protected async _request < T = ReturnType < JSON [ 'parse' ] > > (
181183 opts : GaxiosOptionsPrepared ,
182184 ) : GaxiosPromise < T > {
183185 try {
@@ -252,7 +254,7 @@ export class Gaxios implements FetchCompliance {
252254 private async getResponseData (
253255 opts : GaxiosOptionsPrepared ,
254256 res : Response ,
255- ) : Promise < any > {
257+ ) : Promise < ReturnType < JSON [ 'parse' ] > > {
256258 if (
257259 opts . maxContentLength &&
258260 res . headers . has ( 'content-length' ) &&
@@ -572,11 +574,11 @@ export class Gaxios implements FetchCompliance {
572574 /**
573575 * Attempts to parse a response by looking at the Content-Type header.
574576 * @param {Response } response the HTTP response.
575- * @returns { Promise<any> } a promise that resolves to the response data.
577+ * @returns a promise that resolves to the response data.
576578 */
577579 private async getResponseDataFromContentType (
578580 response : Response ,
579- ) : Promise < any > {
581+ ) : Promise < ReturnType < JSON [ 'parse' ] > > {
580582 let contentType = response . headers . get ( 'Content-Type' ) ;
581583 if ( contentType === null ) {
582584 // Maintain existing functionality by calling text()
0 commit comments