Skip to main content
Version: 2.0.0-alpha

Function: buildProperty

buildProperty<T, P>(property): 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> ? PropertyBuilder<T> : never

Identity function we use to defeat the type system of Typescript and preserve the property keys.

Type parameters

NameType
Textends CMSType = CMSType
Pextends StringProperty | NumberProperty | BooleanProperty | ReferenceProperty | GeopointProperty | DateProperty | MapProperty<{ [Key: string]: any; }> | ArrayProperty<CMSType[], any> | PropertyBuilder<T, any> = PropertyOrBuilder<T, any>

Parameters

NameType
propertyP

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> ? PropertyBuilder<T> : never

Defined in

lib/src/core/builders.ts:42