UNPKG

@sota1235/notion-sdk-js-helper

Version:

Helper utilities for using @notion/client

14 lines (13 loc) 789 B
import type { CodeBlockObjectResponse, CreatePageParameters, RichTextItemResponseCommon } from "@notionhq/client/build/src/api-endpoints.js"; export type Annotation = RichTextItemResponseCommon["annotations"]; export type AnnotationForRequest = Partial<Annotation>; export type BlockObjectRequest = Exclude<CreatePageParameters["children"], undefined>[0]; export type NotionBlock<T extends string> = Extract<BlockObjectRequest, { [key in T]: any; }>; export type Emoji = Extract<Exclude<NotionBlock<"callout">["callout"]["icon"], undefined>, { [key in "emoji"]: any; }>["emoji"]; export type RichTextForRequest = NotionBlock<"heading_1">["heading_1"]["rich_text"][0]; export type Language = CodeBlockObjectResponse["code"]["language"]; export type TextColor = Annotation["color"];