From 10bae9caa5278390769a2ac3b87b9af0c13b62a4 Mon Sep 17 00:00:00 2001 From: Nathan Flurry Date: Tue, 28 Jan 2025 08:31:35 -0800 Subject: [PATCH] chore(sdks/actor/runtime): make all config parameters optional recursively --- sdks/actor/runtime/src/config.ts | 4 +++- sdks/actor/runtime/src/utils.ts | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sdks/actor/runtime/src/config.ts b/sdks/actor/runtime/src/config.ts index 977d28834e..39b82bdb5d 100644 --- a/sdks/actor/runtime/src/config.ts +++ b/sdks/actor/runtime/src/config.ts @@ -1,3 +1,5 @@ +import type { RecursivePartial } from "./utils"; + export interface ActorConfig { protocol: { maxConnectionParametersSize: number; @@ -30,7 +32,7 @@ export const DEFAULT_ACTOR_CONFIG: ActorConfig = { }; export function mergeActorConfig( - partialConfig?: Partial, + partialConfig?: RecursivePartial, ): ActorConfig { return { protocol: { diff --git a/sdks/actor/runtime/src/utils.ts b/sdks/actor/runtime/src/utils.ts index 8237ceff51..2d1aa9ae08 100644 --- a/sdks/actor/runtime/src/utils.ts +++ b/sdks/actor/runtime/src/utils.ts @@ -73,3 +73,14 @@ export class Lock { } } } + +/** + * Like `Partial` but makes all sub-properties `Partial` too. + */ +export type RecursivePartial = { + [P in keyof T]?: T[P] extends (infer U)[] + ? RecursivePartial[] + : T[P] extends object | undefined + ? RecursivePartial + : T[P]; +};