From e0b78cbc764b1905739329d6f542d6b6a9760757 Mon Sep 17 00:00:00 2001 From: Francisco Moretti Date: Fri, 31 Mar 2023 20:39:19 +0100 Subject: [PATCH] handle possible NotionCompatAPI without search --- examples/full/lib/notion.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/full/lib/notion.ts b/examples/full/lib/notion.ts index 4e3c84a0b..9ba5ce6aa 100644 --- a/examples/full/lib/notion.ts +++ b/examples/full/lib/notion.ts @@ -28,5 +28,11 @@ export async function getPage(pageId: string): Promise { } export async function search(params: SearchParams): Promise { - return notion.search(params) + if (notion instanceof NotionAPI) { + return notion.search(params) + } else { + console.error( + 'NotionCompatAPI does not have a search method. Use NotionAPI instead.' + ) + } }