From df984ebb44f2fa73d67f8341220749aff7f74c5d Mon Sep 17 00:00:00 2001 From: Juan Pablo Canepa Date: Wed, 30 Jul 2025 16:45:13 -0400 Subject: [PATCH 1/2] Correct type of state object --- lib/types/server/options.d.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/types/server/options.d.ts b/lib/types/server/options.d.ts index 68408152a..5dc7e889e 100644 --- a/lib/types/server/options.d.ts +++ b/lib/types/server/options.d.ts @@ -7,6 +7,7 @@ import { PluginSpecificConfiguration } from '../plugin'; import { RouteOptions } from '../route'; import { CacheProvider, ServerOptionsCache } from './cache'; import { SameSitePolicy } from './state'; +import { ServerStateCookieOptions } from './state'; export interface ServerOptionsCompression { minBytes: number; @@ -208,16 +209,7 @@ export interface ServerOptions { * } * Sets the default configuration for every state (cookie) set explicitly via server.state() or implicitly (without definition) using the state configuration object. */ - // TODO I am not sure if I need to use all the server.state() definition (like the default value) OR only the options below. The v16 use "any" here. - // state?: ServerStateCookieOptions; - state?: { - strictHeader?: boolean | undefined; - ignoreErrors?: boolean | undefined; - isSecure?: boolean | undefined; - isHttpOnly?: boolean | undefined; - isSameSite?: SameSitePolicy | undefined; - encoding?: 'none' | 'base64' | 'base64json' | 'form' | 'iron' | undefined; - } | undefined; + state?: ServerStateCookieOptions | undefined; /** * @default none. From b9c677d556566b04ac2e4f1172a6548e0f43c1cd Mon Sep 17 00:00:00 2001 From: Juan Pablo Canepa Date: Wed, 30 Jul 2025 16:58:17 -0400 Subject: [PATCH 2/2] Factor imports --- lib/types/server/options.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/types/server/options.d.ts b/lib/types/server/options.d.ts index 5dc7e889e..5b7c9a7e3 100644 --- a/lib/types/server/options.d.ts +++ b/lib/types/server/options.d.ts @@ -6,8 +6,7 @@ import { MimosOptions } from '@hapi/mimos'; import { PluginSpecificConfiguration } from '../plugin'; import { RouteOptions } from '../route'; import { CacheProvider, ServerOptionsCache } from './cache'; -import { SameSitePolicy } from './state'; -import { ServerStateCookieOptions } from './state'; +import { SameSitePolicy, ServerStateCookieOptions } from './state'; export interface ServerOptionsCompression { minBytes: number;