diff --git a/index.d.ts b/index.d.ts
index 663b9c5..25c8fc6 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -1,11 +1,8 @@
///
import {
- FastifyRequest,
- RawServerBase,
FastifyPlugin,
- FastifyError,
- FastifyReply
+ preHandlerHookHandler
} from "fastify";
export interface FastifyHttpProxyOptions {
@@ -14,16 +11,8 @@ export interface FastifyHttpProxyOptions {
rewritePrefix?: string;
http2?: boolean;
proxyPayloads?: boolean;
- preHandler?: (
- request: FastifyRequest,
- reply: FastifyReply,
- next: (err?: FastifyError | undefined) => void
- ) => void;
- beforeHandler?: (
- request: FastifyRequest,
- reply: FastifyReply,
- next: (err?: FastifyError | undefined) => void
- ) => void;
+ preHandler?: preHandlerHookHandler;
+ beforeHandler?: preHandlerHookHandler;
config?: Object;
replyOptions?: Object;
}
diff --git a/package.json b/package.json
index 1b99a04..b9ddca6 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"description": "proxy http requests, for Fastify",
"main": "index.js",
"scripts": {
- "test": "standard | snazzy && tap test/*.js",
+ "test": "standard | snazzy && tap test/*.js && npm run typescript",
"lint:typescript": "standard --fix --parser @typescript-eslint/parser --plugin typescript test/types/*.ts",
"typescript": "tsd"
},
diff --git a/test/index.test-d.ts b/test/index.test-d.ts
index eab0c07..e652a19 100644
--- a/test/index.test-d.ts
+++ b/test/index.test-d.ts
@@ -1,8 +1,6 @@
-import fastify from "fastify";
+import fastify, { RawReplyDefaultExpression, RawRequestDefaultExpression } from "fastify";
import fastifyHttpProxy from "..";
import { expectType } from "tsd";
-import { IncomingMessage, ServerResponse } from "http";
-import { Http2ServerRequest, Http2ServerResponse } from "http2";
const app = fastify();
@@ -18,11 +16,11 @@ app.register(fastifyHttpProxy, {
config: { key: 1 },
replyOptions: { opt: "a" },
preHandler: (request, reply) => {
- expectType(request.raw);
- expectType(reply.raw);
+ expectType(request.raw);
+ expectType(reply.raw);
},
beforeHandler: (request, reply) => {
- expectType(request.raw);
- expectType(reply.raw);
+ expectType(request.raw);
+ expectType(reply.raw);
}
});