Doesn’t the example I linked given the answers you’re looking for? So given element
is a sequence flow element:
// get
const extensionElements = element.businessObject.get('extensionElements');
// [ ... ] do some stuff, e.g. adding properties
// set
modeling.updateProperties(element, { extensionElements: extensionElements });