From 5483f744f4428007ca5c697e288390eef7865bc5 Mon Sep 17 00:00:00 2001 From: Cody Olsen <81981+stipsan@users.noreply.github.com> Date: Wed, 10 Jan 2024 15:33:22 +0100 Subject: [PATCH] fix(typings): changed cache doc typing to be `Partial`` (#469) --- src/csm/applySourceDocuments.ts | 4 ++-- src/csm/types.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/csm/applySourceDocuments.ts b/src/csm/applySourceDocuments.ts index d21391bd..e4072c79 100644 --- a/src/csm/applySourceDocuments.ts +++ b/src/csm/applySourceDocuments.ts @@ -25,7 +25,7 @@ export function applySourceDocuments( resultSourceMap: ContentSourceMap | undefined, getCachedDocument: ( sourceDocument: ContentSourceMapDocuments[number], - ) => SanityDocument | undefined, + ) => Partial | null | undefined, updateFn: ApplySourceDocumentsUpdateFunction = defaultUpdateFunction, perspective: ClientPerspective = 'raw', ): Result { @@ -63,7 +63,7 @@ export function applySourceDocuments( return value } - let cachedDocument: SanityDocument | undefined + let cachedDocument: Partial | null | undefined if (perspective === 'previewDrafts') { cachedDocument = getCachedDocument( sourceDocument._id.startsWith(DRAFTS_PREFIX) diff --git a/src/csm/types.ts b/src/csm/types.ts index b781aacc..8378c496 100644 --- a/src/csm/types.ts +++ b/src/csm/types.ts @@ -90,7 +90,7 @@ export interface ResolveEditUrlOptions extends Omit( changedValue: T, context: { - cachedDocument: SanityDocument + cachedDocument: Partial previousValue: T sourceDocument: ContentSourceMapDocuments[number] sourcePath: ContentSourceMapParsedPath