diff --git a/typescript/packages/common-runner/src/cell.ts b/typescript/packages/common-runner/src/cell.ts index 106a405ef..800a82dd0 100644 --- a/typescript/packages/common-runner/src/cell.ts +++ b/typescript/packages/common-runner/src/cell.ts @@ -114,7 +114,9 @@ export interface Cell { sink(callback: (value: T) => Cancel | undefined | void): Cancel; key ? keyof S : keyof T>( valueKey: K, - ): T extends Cell ? Cell : Cell; + ): Cell< + T extends Cell ? S[K & keyof S] : T[K] extends never ? any : T[K] + >; setRaw(value: T): void; asSchema( schema?: JSONSchema, @@ -167,6 +169,28 @@ export interface Stream { [isStreamMarker]: true; } +export function getCell( + space: Space, + cause: any, + schema?: JSONSchema, + log?: ReactivityLog, +): Cell; +export function getCell( + space: Space, + cause: any, + schema: S, + log?: ReactivityLog, +): Cell>; +export function getCell( + space: Space, + cause: any, + schema?: JSONSchema, + log?: ReactivityLog, +): Cell { + const doc = getDoc(undefined as any, cause, space); + return createCell(doc, [], log, schema); +} + export function getCellFromEntityId( space: Space, entityId: EntityId,