Variable types
To set or update the list of available variables use the variables prop. Note however, that this prop will influence the typechecking in already written out variables, to have an autocompletion list please look at Variable Autocompletion page.
While creating the filters element:
ts
import { createDatabitFilters, integer, string } from "@databit/filters";
const filters = createDatabitFilters(rootEl, {
variables: {
'variable1': integer(),
'variable2': string(),
},
});To update:
ts
filters.updateProp('variables', {
'variable1': integer(),
'variable2': string(),
'variable3': string(),
});or
ts
filters.updateProps({
variables: {
'variable1': integer(),
'variable2': string(),
'variable3': string(),
},
});These are the available types: integer(), float(), string(), boolean()
You can set more types for a variable, for example for a variable to be able to ise both integers and floats:
ts
filters.updateProps({
variables: {
'litres_of_milk': [integer(), float()],
},
});