generated from Kentico/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KCL-11649 Install delivery-sdk and add proper types [WIP]
- Loading branch information
Vladislav Bulyukhin
committed
Jan 17, 2024
1 parent
dfbea27
commit a92bd3b
Showing
4 changed files
with
208 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Elements } from '@kontent-ai/delivery-sdk'; | ||
import { ElementType as DeliverElementType } from '@kontent-ai/delivery-sdk/dist/cjs/elements/element-type'; | ||
|
||
type DeliverElementDataTemplate<TElement, TType extends DeliverElementType> = { | ||
readonly type: TType; | ||
readonly data: Omit<TElement, 'type' | 'name'>; | ||
}; | ||
|
||
export type DeliverAssetElementData = DeliverElementDataTemplate<Elements.AssetsElement, DeliverElementType.Asset>; | ||
export type DeliverCustomElementData = DeliverElementDataTemplate< | ||
Elements.CustomElement<any>, | ||
DeliverElementType.Custom | ||
>; | ||
export type DeliverDatetimeElementData = DeliverElementDataTemplate< | ||
Elements.DateTimeElement, | ||
DeliverElementType.DateTime | ||
>; | ||
export type DeliverLinkedItemsElementData = DeliverElementDataTemplate< | ||
Elements.LinkedItemsElement, | ||
DeliverElementType.ModularContent | ||
>; | ||
export type DeliverMultipleChoiceElementData = DeliverElementDataTemplate< | ||
Elements.MultipleChoiceElement, | ||
DeliverElementType.MultipleChoice | ||
>; | ||
export type DeliverNumberElementData = DeliverElementDataTemplate<Elements.NumberElement, DeliverElementType.Number>; | ||
export type DeliverRichTextElementData = DeliverElementDataTemplate< | ||
Elements.RichTextElement, | ||
DeliverElementType.RichText | ||
>; | ||
export type DeliverTaxonomyElementData = DeliverElementDataTemplate< | ||
Elements.TaxonomyElement, | ||
DeliverElementType.Taxonomy | ||
>; | ||
export type DeliverTextElementData = DeliverElementDataTemplate<Elements.TextElement, DeliverElementType.Text>; | ||
export type DeliverUrlSlugElementData = DeliverElementDataTemplate<Elements.UrlSlugElement, DeliverElementType.UrlSlug>; | ||
|
||
export type DeliverElementData = | ||
| DeliverAssetElementData | ||
| DeliverCustomElementData | ||
| DeliverDatetimeElementData | ||
| DeliverLinkedItemsElementData | ||
| DeliverMultipleChoiceElementData | ||
| DeliverNumberElementData | ||
| DeliverRichTextElementData | ||
| DeliverTaxonomyElementData | ||
| DeliverTextElementData | ||
| DeliverUrlSlugElementData; |
Oops, something went wrong.