-
Notifications
You must be signed in to change notification settings - Fork 11
/
Property.ts
47 lines (41 loc) · 1.27 KB
/
Property.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import IContent from './Models/IContent';
import ContentLink from './Models/ContentLink';
/**
* Default untyped property definition
*/
export type Property<ValueType = any, ExpandedType = any> = {
propertyDataType: string;
value: ValueType;
expandedValue?: ExpandedType;
}
/**
* Strong typed property definition
*/
export type StringProperty = Property<string>
export type NumberProperty = Property<number>
export type BooleanProperty = Property<boolean>
export type ContentReferenceProperty = Property<ContentLink, IContent>
export type ContentReferenceListProperty = Property<ContentLink[], IContent[]>
export type ContentAreaProperty = Property<ContentAreaPropertyValue, IContent[]>
export type LinkListProperty = Property<LinkProperty[]>
// ****** CORE TYPES ****** //
export type LinkProperty = {
href: string;
title: string;
target: string;
text: string;
contentLink: ContentLink;
}
/**
* Definition of the ContentArea property value as used within the ContentDelivery API
*/
export type ContentAreaPropertyValue = ContentAreaPropertyItem[];
/**
* A single item within an ContentArea, as returned by the ContentDelivery API
*/
export type ContentAreaPropertyItem = {
contentLink: ContentLink
displayOption: string
tag: string
}
export default Property;