From 46ff043a95c12b59fb99df0c38d33ee24358bcf6 Mon Sep 17 00:00:00 2001 From: James Wyatt Cready-Pyle Date: Fri, 11 Nov 2022 13:29:24 -0500 Subject: [PATCH] Allow partial oneof field in PartialMessage Fixes: #380 --- packages/runtime/src/message-type-contract.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/runtime/src/message-type-contract.ts b/packages/runtime/src/message-type-contract.ts index d4590101..b305fbf9 100644 --- a/packages/runtime/src/message-type-contract.ts +++ b/packages/runtime/src/message-type-contract.ts @@ -22,7 +22,7 @@ export type PartialMessage = { T extends (Date | Uint8Array | bigint | boolean | string | number) ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> - : T extends { oneofKind: string } ? T + : T extends { oneofKind: string & keyof T } ? { [k in T['oneofKind']]: { oneofKind: k } & { [p in k]: PartialField } }[T['oneofKind']] : T extends { oneofKind: undefined } ? T : T extends object ? PartialMessage : T ;