diff --git a/lib/build/framework/fastify/framework.d.ts b/lib/build/framework/fastify/framework.d.ts
index 4030dd63e..f699fc2a2 100644
--- a/lib/build/framework/fastify/framework.d.ts
+++ b/lib/build/framework/fastify/framework.d.ts
@@ -1,5 +1,5 @@
// @ts-nocheck
-import type { FastifyRequest as OriginalFastifyRequest, FastifyReply, FastifyPluginCallback } from "fastify";
+import { FastifyRequest as OriginalFastifyRequest, FastifyReply, FastifyPluginCallback } from "./types";
import type { HTTPMethod } from "../../types";
import { BaseRequest } from "../request";
import { BaseResponse } from "../response";
diff --git a/lib/build/framework/fastify/framework.js b/lib/build/framework/fastify/framework.js
index 461863d63..5bce10130 100644
--- a/lib/build/framework/fastify/framework.js
+++ b/lib/build/framework/fastify/framework.js
@@ -111,7 +111,7 @@ class FastifyResponse extends response_1.BaseResponse {
);
let oldHeaders = this.response.getHeader(constants_1.COOKIE_HEADER);
if (oldHeaders === undefined) oldHeaders = [];
- else if (!(oldHeaders instanceof Array)) oldHeaders = [oldHeaders];
+ else if (!(oldHeaders instanceof Array)) oldHeaders = [oldHeaders.toString()];
this.response.removeHeader(constants_1.COOKIE_HEADER);
this.response.header(constants_1.COOKIE_HEADER, [
...oldHeaders.filter((h) => !h.startsWith(key + "=")),
diff --git a/lib/build/framework/fastify/index.d.ts b/lib/build/framework/fastify/index.d.ts
index fb2d3fe21..b8cc44a0e 100644
--- a/lib/build/framework/fastify/index.d.ts
+++ b/lib/build/framework/fastify/index.d.ts
@@ -1,24 +1,10 @@
// @ts-nocheck
-///
export type { SessionRequest } from "./framework";
-export declare const plugin: import("fastify").FastifyPluginCallback<
- Record,
- import("fastify").RawServerDefault
->;
+export declare const plugin: import("./types").FastifyPluginCallback;
export declare const errorHandler: () => (
err: any,
- req: import("fastify").FastifyRequest<
- import("fastify/types/route").RouteGenericInterface,
- import("fastify").RawServerDefault,
- import("http").IncomingMessage
- >,
- res: import("fastify").FastifyReply<
- import("fastify").RawServerDefault,
- import("http").IncomingMessage,
- import("http").ServerResponse,
- import("fastify/types/route").RouteGenericInterface,
- unknown
- >
+ req: import("./types").FastifyRequest,
+ res: import("./types").FastifyReply
) => Promise;
export declare const wrapRequest: (unwrapped: any) => import("..").BaseRequest;
export declare const wrapResponse: (unwrapped: any) => import("..").BaseResponse;
diff --git a/lib/build/framework/fastify/types.d.ts b/lib/build/framework/fastify/types.d.ts
new file mode 100644
index 000000000..1fa2157e4
--- /dev/null
+++ b/lib/build/framework/fastify/types.d.ts
@@ -0,0 +1,25 @@
+// @ts-nocheck
+/**
+ * Define fastify types based on the parts that are used in the codebase.
+ */
+export interface FastifyRequest {
+ body: any;
+ query: Record;
+ headers: Record;
+ method: string;
+ url: string;
+}
+export interface FastifyReply {
+ sent: boolean;
+ statusCode: number;
+ getHeaders(): Record;
+ send(payload?: any): FastifyReply;
+ header(key: any, value: any): FastifyReply;
+ removeHeader(key: any): FastifyReply;
+ getHeader(key: any): number | string | string[] | undefined;
+ type(contentType: string): FastifyReply;
+}
+export interface FastifyInstance {
+ addHook(name: string, hook: (req: FastifyRequest, reply: FastifyReply) => void): FastifyInstance;
+}
+export declare type FastifyPluginCallback = (instance: FastifyInstance, opts: any, done: (err?: Error) => void) => void;
diff --git a/lib/build/framework/fastify/types.js b/lib/build/framework/fastify/types.js
new file mode 100644
index 000000000..cec7da4ed
--- /dev/null
+++ b/lib/build/framework/fastify/types.js
@@ -0,0 +1,5 @@
+"use strict";
+/**
+ * Define fastify types based on the parts that are used in the codebase.
+ */
+Object.defineProperty(exports, "__esModule", { value: true });
diff --git a/lib/build/recipe/session/framework/fastify.d.ts b/lib/build/recipe/session/framework/fastify.d.ts
index fbfbe3780..74724d38d 100644
--- a/lib/build/recipe/session/framework/fastify.d.ts
+++ b/lib/build/recipe/session/framework/fastify.d.ts
@@ -1,7 +1,7 @@
// @ts-nocheck
import { VerifySessionOptions } from "..";
import { SessionRequest } from "../../../framework/fastify/framework";
-import { FastifyReply, FastifyRequest as OriginalFastifyRequest } from "fastify";
+import { FastifyReply, FastifyRequest as OriginalFastifyRequest } from "../../../framework/fastify/types";
export declare function verifySession(
options?: VerifySessionOptions
): (req: SessionRequest, res: FastifyReply) => Promise;