You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But in typings I see that label is marked as AnnotationElementhere.
Idk, did I understand it correctly, but I believe it should be CoreLabelOptions or smth similar?
I believe typing checker or eslint passes successfully because lot's of properties have the same name. But if you try to replace the code in the example above to:
element.label.options.content="new label text";
you'll see an error since element.label.options is not type of AnnotationOptions
But maybe that's just things are mixed up in my head a bit 🙂
The text was updated successfully, but these errors were encountered:
@aafanasev-shell The label property is marked correctly as AnnotationElement because the "inner" labels of the annotations are sub-element, in other words a label annotation defined inside another annotation.
The AnnotationElement definition has got the options as AnnotationOptions which is the base type for the options for each annotation type.
To access to the label options, you should cast it to LabelAnnotationOptions:
Could agree with you 😉
Even if we will create a spefici annotation element for the label with CoreLabelOptions type fo roptions property, a casting could be needed because the annotation, which contains a label, doesn't have all options of all others.
I think in the future the plugin will be written in TS and probably this will change. I also agree with you that in new major version a review of the types would be needed, maybe introducing generics.
Hello again!
I saw lot's of usage of
EventContext.element
here and there in examples and tests.e.g. [here](https://github.com/chartjs/chartjs-plugin-annotation/blob/ebd5c6f9c2f56dcf1cf213aa7af2a9e93d38059f/test/fixtures/ellipse/label-dynamic.js#L34C1-L35C1:
But in typings I see that
label
is marked asAnnotationElement
here.Idk, did I understand it correctly, but I believe it should be CoreLabelOptions or smth similar?
I believe typing checker or eslint passes successfully because lot's of properties have the same name. But if you try to replace the code in the example above to:
you'll see an error since
element.label.options
is not type ofAnnotationOptions
But maybe that's just things are mixed up in my head a bit 🙂
The text was updated successfully, but these errors were encountered: