File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
packages/superagent-wrapper/src Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -51,12 +51,12 @@ type SuperagentLike<Req> = {
5151 [ K in h . Method ] : ( url : string ) => Req ;
5252} ;
5353
54- type Response = {
54+ export type Response = {
5555 body : unknown ;
5656 status : number ;
5757} ;
5858
59- interface SuperagentRequest < Res extends Response > extends Promise < Res > {
59+ export interface SuperagentRequest < Res extends Response > extends Promise < Res > {
6060 ok ( callback : ( response : Res ) => boolean ) : this;
6161 query ( params : Record < string , string | string [ ] > ) : this;
6262 set ( name : string , value : string ) : this;
Original file line number Diff line number Diff line change 11import * as h from '@api-ts/io-ts-http' ;
2- import type { SuperAgentRequest } from 'superagent ' ;
2+ import type { SuperagentRequest , Response } from './request ' ;
33
44import { requestForRoute , BoundRequestFactory , RequestFactory } from './request' ;
55
6- export type ApiClient < Req extends SuperAgentRequest , Spec extends h . ApiSpec > = {
6+ export type ApiClient <
7+ Req extends SuperagentRequest < Response > ,
8+ Spec extends h . ApiSpec ,
9+ > = {
710 [ A in keyof Spec ] : {
811 [ B in keyof Spec [ A ] & h . Method ] : BoundRequestFactory < Req , NonNullable < Spec [ A ] [ B ] > > ;
912 } ;
1013} ;
1114
12- export const buildApiClient = < Req extends SuperAgentRequest , Spec extends h . ApiSpec > (
15+ export const buildApiClient = <
16+ Req extends SuperagentRequest < Response > ,
17+ Spec extends h . ApiSpec ,
18+ > (
1319 requestFactory : RequestFactory < Req > ,
1420 spec : Spec ,
1521) : ApiClient < Req , Spec > => {
You can’t perform that action at this time.
0 commit comments