Function: buildProperty()
buildProperty<
T
,P
,M
>(property
):P
extendsStringProperty
?StringProperty
:P
extendsNumberProperty
?NumberProperty
:P
extendsBooleanProperty
?BooleanProperty
:P
extendsDateProperty
?DateProperty
:P
extendsGeopointProperty
?GeopointProperty
:P
extendsReferenceProperty
?ReferenceProperty
:P
extendsArrayProperty
?ArrayProperty
:P
extendsMapProperty
?MapProperty
:P
extendsPropertyBuilder
<T
,M
> ?PropertyBuilder
<T
,M
> :never
Identity function we use to defeat the type system of Typescript and preserve the property keys.
Type Parameters​
• T extends CMSType
= CMSType
• P extends StringProperty
| NumberProperty
| BooleanProperty
| DateProperty
| GeopointProperty
| ReferenceProperty
| MapProperty
<Record
<string
, any
>> | ArrayProperty
<CMSType
[], any
> | ArrayProperty
<CMSType
[] & Record
<string
, any
>, any
> | PropertyBuilder
<T
, Record
<string
, any
>> = PropertyOrBuilder
<T
>
• M extends Record
<string
, any
> = Record
<string
, any
>
Parameters​
• property: P
Returns​
P
extends StringProperty
? StringProperty
: P
extends NumberProperty
? NumberProperty
: P
extends BooleanProperty
? BooleanProperty
: P
extends DateProperty
? DateProperty
: P
extends GeopointProperty
? GeopointProperty
: P
extends ReferenceProperty
? ReferenceProperty
: P
extends ArrayProperty
? ArrayProperty
: P
extends MapProperty
? MapProperty
: P
extends PropertyBuilder
<T
, M
> ? PropertyBuilder
<T
, M
> : never