From c4b75e1918b7ffed2637fbd00ce929341a509cbb Mon Sep 17 00:00:00 2001 From: Daniele Belardi Date: Tue, 28 Sep 2021 17:28:27 +0200 Subject: [PATCH] feat: add undici types definitions (#199) * feat: add undici types definitions * test: add undici options types test --- index.d.ts | 4 ++-- test/index.test-d.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index 083bbe4e..b791bbd3 100644 --- a/index.d.ts +++ b/index.d.ts @@ -28,7 +28,7 @@ import { ClientSessionOptions, SecureClientSessionOptions, } from "http2"; - +import { Pool } from 'undici' export interface FastifyReplyFromHooks { queryString?: { [key: string]: unknown }; contentType?: string; @@ -83,7 +83,7 @@ export interface FastifyReplyFromOptions { disableCache?: boolean; http?: HttpOptions; http2?: Http2Options | boolean; - undici?: unknown; // undici has no TS declarations yet + undici?: Pool.Options; keepAliveMsecs?: number; maxFreeSockets?: number; maxSockets?: number; diff --git a/test/index.test-d.ts b/test/index.test-d.ts index e9e3ff66..bba461b3 100644 --- a/test/index.test-d.ts +++ b/test/index.test-d.ts @@ -113,6 +113,16 @@ async function main() { }); await instance.listen(0); + const undiciInstance = fastify() + undiciInstance.register(replyFrom, { + base: "http://example2.com", + undici: { + pipelining: 10, + connections: 10 + } + }); + await undiciInstance.ready(); + tap.pass('done'); tap.end(); }