Skip to content

Commit

Permalink
feat: add undici types definitions (#199)
Browse files Browse the repository at this point in the history
* feat: add undici types definitions

* test: add undici options types test
  • Loading branch information
dnlup authored Sep 28, 2021
1 parent d4f57c3 commit c4b75e1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
ClientSessionOptions,
SecureClientSessionOptions,
} from "http2";

import { Pool } from 'undici'
export interface FastifyReplyFromHooks {
queryString?: { [key: string]: unknown };
contentType?: string;
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 10 additions & 0 deletions test/index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit c4b75e1

Please sign in to comment.