Skip to content

Commit 44e84ae

Browse files
committed
regenerated types
1 parent b3ce426 commit 44e84ae

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

packages/kit/types/index.d.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
declare module '@sveltejs/kit' {
55
import type { CompileOptions } from 'svelte/compiler';
66
import type { PluginOptions } from '@sveltejs/vite-plugin-svelte';
7+
import type { IncomingMessage } from 'node:http';
8+
import type { Duplex } from 'node:stream';
79
/**
810
* [Adapters](https://svelte.dev/docs/kit/adapters) are responsible for taking the production build and turning it into something that can be deployed to a platform of your choosing.
911
*/
@@ -667,8 +669,8 @@ declare module '@sveltejs/kit' {
667669
*/
668670
export type Handle = (input: {
669671
event: RequestEvent;
670-
resolve(event: RequestEvent, opts?: ResolveOptions): MaybePromise<Response>;
671-
}) => MaybePromise<Response>;
672+
resolve(event: RequestEvent, opts?: ResolveOptions): MaybePromise<void | Response>;
673+
}) => MaybePromise<void | Response>;
672674

673675
/**
674676
* The server-side [`handleError`](https://svelte.dev/docs/kit/hooks#shared-hooks-handleError) hook runs when an unexpected error is thrown while responding to a request.
@@ -1058,6 +1060,10 @@ declare module '@sveltejs/kit' {
10581060
* The original request object
10591061
*/
10601062
request: Request;
1063+
/**
1064+
* The upgrade request object
1065+
*/
1066+
upgrade: { request: IncomingMessage; socket: Duplex; head: Buffer } | null;
10611067
/**
10621068
* Info about the current route
10631069
*/
@@ -1115,6 +1121,16 @@ declare module '@sveltejs/kit' {
11151121
RouteId extends string | null = string | null
11161122
> = (event: RequestEvent<Params, RouteId>) => MaybePromise<Response>;
11171123

1124+
/**
1125+
* A `(event: UpgradeEvent) => void` function exported from a `+server.js` file with the name UPGRADE and handles server upgrade requests.
1126+
*
1127+
* It receives `Params` as the first generic argument, which you can skip by using [generated types](https://svelte.dev/docs/kit/types#Generated-types) instead.
1128+
*/
1129+
export type UpgradeHandler<
1130+
Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
1131+
RouteId extends string | null = string | null
1132+
> = (event: RequestEvent<Params, RouteId>) => MaybePromise<void>;
1133+
11181134
export interface ResolveOptions {
11191135
/**
11201136
* Applies custom transforms to HTML. If `done` is true, it's the final chunk. Chunks are not guaranteed to be well-formed HTML
@@ -1734,6 +1750,7 @@ declare module '@sveltejs/kit' {
17341750
type PrerenderEntryGenerator = () => MaybePromise<Array<Record<string, string>>>;
17351751

17361752
type SSREndpoint = Partial<Record<HttpMethod, RequestHandler>> & {
1753+
UPGRADE?: UpgradeHandler;
17371754
prerender?: PrerenderOption;
17381755
trailingSlash?: TrailingSlash;
17391756
config?: any;

0 commit comments

Comments
 (0)