Make getKcContext mock return type less narrow

This commit is contained in:
Joseph Garrone
2024-06-05 23:22:00 +02:00
parent c7c9b19853
commit aa8dc1919f
3 changed files with 11 additions and 7 deletions

View File

@ -47,7 +47,9 @@ export function createGetKcContextMock<
>(params: {
pageId: PageId;
overrides?: DeepPartial<Extract<KcContext, { pageId: PageId }>>;
}): Extract<KcContext, { pageId: PageId }> {
// NOTE: We choose to have a return type less precise than Extract<KcContext, { pageId: PageId }> {
// because we want to be able to use the mock just as the real KcContext.
}): KcContext {
const { pageId, overrides } = params;
const kcContextMock = structuredCloneButFunctions(