From fafd00f5c2871f481c55273fcc9431f53aea58bb Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Wed, 17 Aug 2022 17:42:08 +0200 Subject: [PATCH] fix types --- packages/kit/src/runtime/server/endpoint.js | 4 +++- packages/kit/src/runtime/server/page/render.js | 2 +- packages/kit/src/runtime/server/page/types.d.ts | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/kit/src/runtime/server/endpoint.js b/packages/kit/src/runtime/server/endpoint.js index ab6cbfc027e6..338791b4d0b1 100644 --- a/packages/kit/src/runtime/server/endpoint.js +++ b/packages/kit/src/runtime/server/endpoint.js @@ -29,7 +29,9 @@ export async function render_endpoint(event, route) { return method_not_allowed(mod, method); } - const response = await handler(event); + const response = await handler( + /** @type {import('types').RequestEvent>} */ (event) + ); if (!(response instanceof Response)) { return new Response( diff --git a/packages/kit/src/runtime/server/page/render.js b/packages/kit/src/runtime/server/page/render.js index 835b0b7b0986..31d9f494a8dd 100644 --- a/packages/kit/src/runtime/server/page/render.js +++ b/packages/kit/src/runtime/server/page/render.js @@ -86,7 +86,7 @@ export async function render_response({ /** @type {import('types').Page} */ page: { error, - params: event.params, + params: /** @type {Record} */ (event.params), routeId: event.routeId, status, url: state.prerendering ? new PrerenderingURL(event.url) : event.url, diff --git a/packages/kit/src/runtime/server/page/types.d.ts b/packages/kit/src/runtime/server/page/types.d.ts index 556496ee3486..c3230ddf995a 100644 --- a/packages/kit/src/runtime/server/page/types.d.ts +++ b/packages/kit/src/runtime/server/page/types.d.ts @@ -1,4 +1,4 @@ -import { JSONValue, ResponseHeaders, SSRNode, CspDirectives } from 'types'; +import { ResponseHeaders, SSRNode, CspDirectives } from 'types'; import { HttpError } from '../../../index/private'; export interface Fetched { @@ -21,7 +21,7 @@ export interface FetchState { export type Loaded = { node: SSRNode; data: Record | null; - server_data: JSONValue; + server_data: any; }; type CspMode = 'hash' | 'nonce' | 'auto';