Skip to content

Commit

Permalink
chore(sdks/actor/runtime): make all config parameters optional recurs…
Browse files Browse the repository at this point in the history
…ively
  • Loading branch information
NathanFlurry committed Jan 28, 2025
1 parent d2eaad4 commit 10bae9c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sdks/actor/runtime/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { RecursivePartial } from "./utils";

export interface ActorConfig {
protocol: {
maxConnectionParametersSize: number;
Expand Down Expand Up @@ -30,7 +32,7 @@ export const DEFAULT_ACTOR_CONFIG: ActorConfig = {
};

export function mergeActorConfig(
partialConfig?: Partial<ActorConfig>,
partialConfig?: RecursivePartial<ActorConfig>,
): ActorConfig {
return {
protocol: {
Expand Down
11 changes: 11 additions & 0 deletions sdks/actor/runtime/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,14 @@ export class Lock<T> {
}
}
}

/**
* Like `Partial` but makes all sub-properties `Partial` too.
*/
export type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends (infer U)[]
? RecursivePartial<U>[]
: T[P] extends object | undefined
? RecursivePartial<T[P]>
: T[P];
};

0 comments on commit 10bae9c

Please sign in to comment.