Skip to main content
Version: 2.0.0-alpha

Function: buildProperty

buildProperty<T, P, M>(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, M> ? PropertyBuilder<T, M> : 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 | DateProperty | GeopointProperty | ReferenceProperty | MapProperty<Record<string, any>> | ArrayProperty<CMSType[], any> | PropertyBuilder<T, Record<string, any>> = PropertyOrBuilder<T, Record<string, any>>
Mextends Record<string, any> = Record<string, 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, M> ? PropertyBuilder<T, M> : never

Defined in

lib/src/core/builders.ts:42

Need a hand?

We are happy to offer consulting services to help you get the most out of FireCMS.
Get in touch