When looking at this particular guide, the implementation of attributeChangedCallback
is demonstrated as follows:
// attribute change
attributeChangedCallback(property, oldValue, newValue) {
if (oldValue === newValue) return;
this[ property ] = newValue;
}
My attempt to convert it to Typescript has resulted in the following code snippet:
// attribute change
attributeChangedCallback(property:keyof HelloWorldComponent, oldValue:any, newValue:any) {
if (oldValue === newValue) return;
this[ property ] = newValue;
}
}
Despite my efforts, I am now encountering the error messages shown below:
Cannot assign to 'ATTRIBUTE_NODE' because it is a read-only property.ts(2540)
Cannot assign to 'CDATA_SECTION_NODE' because it is a read-only property.ts(2540)
Cannot assign to 'COMMENT_NODE' because it is a read-only property.ts(2540)
Cannot assign to 'DOCUMENT_FRAGMENT_NODE' because it is a read-only property.ts(2540)
Cannot assign to 'DOCUMENT_NODE' because it is a read-only property.ts(2540)
Any insights or suggestions on how to address this issue?