Created
January 26, 2024 09:27
-
-
Save gn-bcampbell/e413d0a848e454fda877c97101384f7b to your computer and use it in GitHub Desktop.
Typscript types for Notion properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Post = { | |
object: string; | |
id: string; | |
created_time: Date; | |
last_edited_time: Date; | |
created_by: { | |
object: string; | |
id: string; | |
}; | |
last_edited_by: { | |
object: string; | |
id: string; | |
}; | |
cover: ImageBlock; | |
icon: { | |
type: string; | |
emoji: string; | |
}; | |
parent: { | |
type: string; | |
database_id: string; | |
}; | |
archived: boolean; | |
properties: { | |
Tags: { | |
id: string; | |
type: string; | |
multi_select: MultiSelect[]; | |
}; | |
Description: Text; | |
Created: { | |
id: string; | |
type: string; | |
created_time: Date; | |
}; | |
Name: Text; | |
}; | |
url: string; | |
public_url: string | null; | |
}; | |
type BlockObject = { | |
object: "block"; | |
id: string; | |
parent: { | |
type: "page_id"; | |
page_id: string; | |
}; | |
created_time: Date; | |
last_edited_time: Date; | |
created_by: { | |
object: "user"; | |
id: string; | |
}; | |
last_edited_by: { | |
object: "user"; | |
id: string; | |
}; | |
has_children: boolean; | |
archived: boolean; | |
type: string; | |
heading_1: Heading; | |
heading_2: Heading; | |
heading_3: Heading; | |
paragraph: Paragraph; | |
image: ImageBlock; | |
bulleted_list_item: BulletedListItem; | |
code: CodeBlock; | |
quote: QuoteBlock; | |
}; | |
type Text = { | |
id: string; | |
type: string; | |
rich_text: [RichText]; | |
title: [RichText]; | |
}; | |
type BlogPostProps = { | |
id: string; | |
post: Post; | |
blocks: [BlockObject]; | |
}; | |
type MultiSelect = { | |
id: string; | |
name: string; | |
color: string; | |
}; | |
type TextAnnotations = { | |
bold?: boolean; | |
italic?: boolean; | |
strikethrough?: boolean; | |
underline?: boolean; | |
code?: boolean; | |
color?: string; | |
}; | |
type RichText = { | |
type: string; | |
text: { | |
content: string; | |
link: null; | |
}; | |
plain_text: string; | |
href: string; | |
annotations: TextAnnotations; | |
}; | |
type RichTextArr = { | |
rich_text: [ | |
{ | |
type: string; | |
text: { | |
content: string; | |
link: null; | |
}; | |
plain_text: string; | |
href: string; | |
annotations: TextAnnotations; | |
} | |
]; | |
}; | |
type BulletedListItem = { | |
rich_text: [RichText]; | |
color: string; | |
}; | |
type Heading = { | |
rich_text: [RichText]; | |
color: string; | |
is_toggleable: boolean; | |
}; | |
type Paragraph = { | |
rich_text: [RichText]; | |
color: string; | |
}; | |
type CodeBlock = { | |
caption: []; | |
rich_text: [RichText]; | |
language: string; | |
}; | |
export const enum ImageEnum { | |
file = "file", | |
external = "external", | |
} | |
type ImageBlock = { | |
caption: [ | |
{ | |
type: string; | |
plain_text: string; | |
} | |
]; | |
type: ImageEnum; | |
file: { | |
url: string; | |
}; | |
external: { | |
url: string; | |
}; | |
}; | |
type QuoteBlock = { | |
rich_text: [RichText]; | |
color: string; | |
}; | |
export type { | |
Post, | |
BlockObject, | |
BlogPostProps, | |
RichText, | |
ImageBlock, | |
RichTextArr, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment