Search
setAttributes
Use to rename or change the description of this variable:
setAttributes(attributes: UpdateVariableAttributes<typeof this>): Promise<typeof this | null
const updatedVariable = await variable.setAttributes({ name: "New Name" })
And to update other attributes too, but make sure to narrow using instanceof first, as to avoid potential bugs:
if (variable instanceof FileVariable) await variable.setAttributes({ allowedFileTypes: ["txt", "md"] })
Returns the updated variable on success, and null in the unlikely event of it being removed between getting it and calling this method.
Parameters
attributes:UpdateVariableAttributes<typeof this>
Returns
Promise<typeof this | null>