Created
October 26, 2018 18:02
-
-
Save birkir/d80922db0fbcfca957939cec4988fe69 to your computer and use it in GitHub Desktop.
Mocking prismic types
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
interface Document { | |
id: string; | |
uid?: string; | |
type: string; | |
href: string; | |
tags: string[]; | |
first_publication_date: string; | |
last_publication_date: string; | |
slugs: string[]; | |
linked_documents: Array<{ | |
id: string; | |
type: string; | |
slug: string; | |
lang: string; | |
}>; | |
lang: string; | |
alternate_languages: Array<{ | |
id: string; | |
uid: string; | |
type: string; | |
lang: string; | |
}>; | |
data: Data; | |
} | |
type Color = string; | |
type UID = string; | |
type Embed = { | |
html: string; | |
}; | |
type GeoPoint = { | |
latitude: number; | |
longitude: number; | |
}; | |
type ImageDimensions = { | |
width: number; | |
height: number; | |
}; | |
type Image = { | |
[key: string]: string | ImageDimensions | Image; | |
url: string; | |
alt: string; | |
copyright: string; | |
dimensions: ImageDimensions; | |
} | |
type KeyText = string; | |
type Link = { | |
id: string; | |
type: string; | |
slug: string; | |
lang: string; | |
target?: string; | |
link_type: string; | |
isBroken: boolean; | |
} | |
type RichTextNode = { | |
type: 'heading1' | 'heading2' | 'heading3' | 'heading4' | 'heading5' | 'heading6' | 'paragraph' | 'preformatted' | 'strong' | 'em' | 'listItem' | 'oListItem' | 'list' | 'oList'; | |
}; | |
type RichTextStandardNode = RichTextNode & { | |
spans: { | |
start: number; | |
end: number; | |
type: string; | |
data: Link; | |
} | |
}; | |
type RichTextImageNode = RichTextNode & Image & { | |
type: 'image'; | |
} | |
type RichTextEmbedNode = RichTextNode & { | |
html: string; | |
}; | |
type RichTextHyperLinkNode = RichTextNode & { | |
type: 'hyperlink' | |
} | |
type RichTextLabelNode = RichTextNode & { | |
type: 'label' | |
} | |
type RichTextSpanNode = RichTextNode & { | |
type: 'span' | |
} | |
type RichText = Array<RichTextStandardNode | RichTextImageNode | RichTextEmbedNode | RichTextHyperLinkNode | RichTextLabelNode | RichTextSpanNode>; | |
type BaseFields = Color | UID | KeyText | Date | Embed | GeoPoint | Link | Number | RichText; | |
type Groups = Array<BaseFields>; | |
type Fields = BaseFields | Groups; | |
interface Data { | |
[key: string]: Fields; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment