I hope someone knows what I am doing
# package-development
r
I hope someone knows what I am doing wrong. I've generated models using @hey-api/openapi-ts the type For this specific is export type DropDownSelectorModel = { selectedItem?: string | null; dropDownItems?: Array | null; }; when I want to change the selectedItem like below it compiles fine but in the console I get the following error Cannot assign to read only property 'selectedItem' of object '#' #onSeperatorSelect(event: UUISelectEvent) { var v = event.target.value as string; this.exportModel!.fieldSeperator!.selectedItem = v; } Is it because it's a type instead of a class and am I using the generated models in a wrong way? Think @Jacob Overgaard had the same issue last week in the Google Maps editor?
k
It think depends on what
exportModel
is but if thats something that has been passed as a property, then you need to either dispatch and event so the parent item can set the value or if its from a context, you would call a method on the context to update the underling "observable" property ?
s
Tip, highlighting code with triple backticks:
Copy code
js
export type DropDownSelectorModel = {
    selectedItem?: string | null;
    dropDownItems?: Array<(NameValue)> | null;
};
sorry, I don't have any answers to this specific question 🙈
r
Thanks Kevin that could be the case the ExportModel is set as observable in the context indeed and I did it directly ExportModel is a generated type as well by the way, just setting some properties on top of that to eventually post to a controller... Will see what happens when I update from context instead of the component itself
5 Views