hono 3.2.2 → 3.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Hono } from '../hono';
|
|
2
2
|
import type { UnionToIntersection } from '../utils/types';
|
|
3
|
-
import type { Client,
|
|
4
|
-
export declare const hc: <T extends Hono<any, any, any>>(baseUrl: string, options?:
|
|
3
|
+
import type { Client, ClientRequestOptions } from './types';
|
|
4
|
+
export declare const hc: <T extends Hono<any, any, any>>(baseUrl: string, options?: ClientRequestOptions) => UnionToIntersection<Client<T>>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { hc } from './client';
|
|
2
|
-
export type { InferResponseType, InferRequestType, Fetch } from './types';
|
|
2
|
+
export type { InferResponseType, InferRequestType, Fetch, ClientRequestOptions } from './types';
|
|
@@ -9,7 +9,7 @@ declare type Data = {
|
|
|
9
9
|
};
|
|
10
10
|
output: {};
|
|
11
11
|
};
|
|
12
|
-
export declare type
|
|
12
|
+
export declare type ClientRequestOptions = {
|
|
13
13
|
headers?: Record<string, string>;
|
|
14
14
|
fetch?: typeof fetch;
|
|
15
15
|
};
|
|
@@ -17,12 +17,12 @@ declare type ClientRequest<S extends Data> = {
|
|
|
17
17
|
[M in keyof S]: S[M] extends {
|
|
18
18
|
input: infer R;
|
|
19
19
|
output: infer O;
|
|
20
|
-
} ? RemoveBlankRecord<R> extends never ? (args?: {}, options?:
|
|
20
|
+
} ? RemoveBlankRecord<R> extends never ? (args?: {}, options?: ClientRequestOptions) => Promise<ClientResponse<O>> : (args: R, options?: ClientRequestOptions) => Promise<ClientResponse<O>> : never;
|
|
21
21
|
};
|
|
22
22
|
export interface ClientResponse<T> extends Response {
|
|
23
23
|
json(): Promise<T>;
|
|
24
24
|
}
|
|
25
|
-
export declare type Fetch<T> = (args?: InferRequestType<T>, opt?:
|
|
25
|
+
export declare type Fetch<T> = (args?: InferRequestType<T>, opt?: ClientRequestOptions) => Promise<ClientResponse<InferResponseType<T>>>;
|
|
26
26
|
export declare type InferResponseType<T> = T extends (args: any | undefined) => Promise<ClientResponse<infer O>> ? O : never;
|
|
27
27
|
export declare type InferRequestType<T> = T extends (args: infer R) => Promise<ClientResponse<unknown>> ? NonNullable<R> : never;
|
|
28
28
|
declare type PathToChain<Path extends string, E extends Endpoint, Original extends string = ''> = Path extends `/${infer P}` ? PathToChain<P, E, Path> : Path extends `${infer P}/${infer R}` ? {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Hono } from './hono';
|
|
2
|
-
export type { Env, ErrorHandler, Handler, MiddlewareHandler, Next, NotFoundHandler, ValidationTargets, Input, } from './types';
|
|
2
|
+
export type { Env, ErrorHandler, Handler, MiddlewareHandler, Next, NotFoundHandler, ValidationTargets, Input, TypedResponse, } from './types';
|
|
3
3
|
export type { Context, ContextVariableMap } from './context';
|
|
4
4
|
export type { HonoRequest } from './request';
|
|
5
|
+
export type { InferRequestType, InferResponseType, ClientRequestOptions } from './client';
|
|
5
6
|
export { Hono };
|