TemplatePropertiesBuilder
Declares the typed Properties of a Template.
Extended by
Section titled “Extended by”Properties
Section titled “Properties”properties
Section titled “properties”
readonlyproperties:Record<string,JsonPropertyBuilder|TemplatePropertyBuilder>
Declared Properties, keyed by Property key.
Methods
Section titled “Methods”addProperty()
Section titled “addProperty()”addProperty<
TType>(key,type,options?):TTypeextends keyofTemplatePropertyBuilderMap?TemplatePropertyBuilderMap[TType] :TemplatePropertyBuilder
Declares a Property of the given primitive, temporal, select or Zod type.
Type Parameters
Section titled “Type Parameters”TType extends ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>> | PropertyDefinitionType
Declared type, which selects the returned builder.
Parameters
Section titled “Parameters”string
Property key within the Template.
TType
Data type name or Zod type for the value.
options?
Section titled “options?”PropertyDefinitionOptions<TType>
Label and format options.
Returns
Section titled “Returns”TType extends keyof TemplatePropertyBuilderMap ? TemplatePropertyBuilderMap[TType] : TemplatePropertyBuilder
A select builder for select types, a JSON builder for schemas, otherwise a Property builder.
Remarks
Section titled “Remarks”A string type declares a typed Property; a Zod type declares a json Property whose values
that type parses. Property keys follow the resource key rules and may not be id or state. A
declaration does not guarantee the value is present or visible in every Item.
Throws
Section titled “Throws”When key is not a valid Property key.
Example
Section titled “Example”Declaring Properties of different types
location.addProperty('code', 'string', { label: 'Code' }).index();poll.addProperty('fields', zPropertyDefinition.array());const tier = workspace.addProperty('tier', 'single-select');tier.addOption('free', {});tier.addOption('team', {});
