Skip to content

Commit 084099c

Browse files
authored
chore: tidying up types (#1013)
1 parent 11ec751 commit 084099c

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

documentation/docs/04-hooks.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ type Response = {
9595
body?: any;
9696
};
9797

98-
type Handle<Context = any> = (
98+
type Handle<Context = any> = ({
9999
request: Request<Context>,
100100
render: (request: Request<Context>) => Promise<Response>
101-
) => Response | Promise<Response>;
101+
}) => Response | Promise<Response>;
102102
```
103103
104104
```js

packages/kit/types.d.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,18 @@ interface ReadOnlyFormData extends Iterator<[string, string]> {
6161
values: () => Iterator<string>;
6262
}
6363

64+
type BaseBody = string | Buffer | ReadOnlyFormData;
65+
type ParameterizedBody<Body = unknown> = BaseBody & Body;
66+
6467
export type Incoming = {
6568
method: string;
6669
host: string;
6770
headers: Headers;
6871
path: string;
6972
query: URLSearchParams;
70-
body: string | Buffer | ReadOnlyFormData;
73+
body: BaseBody;
7174
};
7275

73-
type BaseBody = string | Buffer | ReadOnlyFormData;
74-
type ParameterizedBody<Body = unknown> = BaseBody & Body;
75-
7676
export type Request<Context = any, Body = unknown> = {
7777
method: string;
7878
host: string;
@@ -104,10 +104,7 @@ export type GetSession<Context = any, Session = any> = {
104104
({ context }: { context: Context }): Session | Promise<Session>;
105105
};
106106

107-
export type Handle<Context = any> = ({
108-
request,
109-
render
110-
}: {
107+
export type Handle<Context = any> = (input: {
111108
request: Request<Context>;
112109
render: (request: Request<Context>) => Response | Promise<Response>;
113110
}) => Response | Promise<Response>;

packages/kit/types.internal.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
Response as SSRResponse
1111
} from './types';
1212
import { UserConfig as ViteConfig } from 'vite';
13-
import { Response as NodeFetchResponse } from 'node-fetch';
1413

1514
declare global {
1615
interface ImportMeta {

0 commit comments

Comments
 (0)