Skip to content

Commit

Permalink
fix(typings): changed cache doc typing to be `Partial<SanityDocument>…
Browse files Browse the repository at this point in the history
…`` (#469)
  • Loading branch information
stipsan authored Jan 10, 2024
1 parent c4085b3 commit 5483f74
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/csm/applySourceDocuments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function applySourceDocuments<Result = unknown>(
resultSourceMap: ContentSourceMap | undefined,
getCachedDocument: (
sourceDocument: ContentSourceMapDocuments[number],
) => SanityDocument | undefined,
) => Partial<SanityDocument> | null | undefined,
updateFn: ApplySourceDocumentsUpdateFunction = defaultUpdateFunction,
perspective: ClientPerspective = 'raw',
): Result {
Expand Down Expand Up @@ -63,7 +63,7 @@ export function applySourceDocuments<Result = unknown>(
return value
}

let cachedDocument: SanityDocument | undefined
let cachedDocument: Partial<SanityDocument> | null | undefined
if (perspective === 'previewDrafts') {
cachedDocument = getCachedDocument(
sourceDocument._id.startsWith(DRAFTS_PREFIX)
Expand Down
2 changes: 1 addition & 1 deletion src/csm/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export interface ResolveEditUrlOptions extends Omit<ResolveEditInfoOptions, 'res
export type ApplySourceDocumentsUpdateFunction = <T = unknown>(
changedValue: T,
context: {
cachedDocument: SanityDocument
cachedDocument: Partial<SanityDocument>
previousValue: T
sourceDocument: ContentSourceMapDocuments[number]
sourcePath: ContentSourceMapParsedPath
Expand Down

0 comments on commit 5483f74

Please sign in to comment.