From 131126d14503280cbf277bd01b710e528c7eb9c2 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Tue, 28 Jan 2025 18:15:10 +0000 Subject: [PATCH 1/2] types(index): allow undefined for some optional properties --- types/index.d.ts | 4 ++-- types/index.test-d.ts | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 01c307e..b9d183e 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -30,8 +30,8 @@ declare namespace fastifyBasicAuth { ): void | Promise; authenticate?: boolean | { realm: string | ((req: FastifyRequest) => string) }; header?: string; - strictCredentials?: boolean; - utf8?: boolean; + strictCredentials?: boolean | undefined; + utf8?: boolean | undefined; } export const fastifyBasicAuth: FastifyBasicAuth diff --git a/types/index.test-d.ts b/types/index.test-d.ts index af291fe..663276e 100644 --- a/types/index.test-d.ts +++ b/types/index.test-d.ts @@ -79,6 +79,12 @@ app.register(fastifyBasicAuth, { utf8: true }) +app.register(fastifyBasicAuth, { + validate: () => {}, + strictCredentials: undefined, + utf8: undefined, +}) + expectAssignable(app.basicAuth) expectAssignable(app.basicAuth) expectAssignable(app.basicAuth) From 0ab987b88dbbc0cf4d55926de602e87de0919159 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Tue, 28 Jan 2025 18:17:22 +0000 Subject: [PATCH 2/2] chore: trailing comma --- types/index.test-d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.test-d.ts b/types/index.test-d.ts index 663276e..a04440c 100644 --- a/types/index.test-d.ts +++ b/types/index.test-d.ts @@ -82,7 +82,7 @@ app.register(fastifyBasicAuth, { app.register(fastifyBasicAuth, { validate: () => {}, strictCredentials: undefined, - utf8: undefined, + utf8: undefined }) expectAssignable(app.basicAuth)