Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve type denition of ChartData #98

Open
y-takey opened this issue Jul 24, 2023 · 2 comments
Open

Improve type denition of ChartData #98

y-takey opened this issue Jul 24, 2023 · 2 comments

Comments

@y-takey
Copy link
Owner

y-takey commented Jul 24, 2023

see chartjs/chartjs-plugin-datalabels#388 (comment)

y-takey added a commit that referenced this issue Sep 29, 2023
@frenzymind
Copy link

frenzymind commented Feb 15, 2024

Is this issue should fix this type error ?

when I use options: ChartOptions<'bar'> then I can not use plugin, I get error:

Type '{ id: string; beforeInit: (chart: Chart<keyof ChartTypeRegistry, (number | [number, number] | Point | BubbleDataPoint)[], unknown>, args: EmptyObject, options: PluginOptions) => void; beforeUpdate: (chart: Chart<...>, args: { ...; }, options: PluginOptions) => boolean | void; afterUpdate: (chart: Chart<...>, args: {...' is not assignable to type 'Plugin<"bar", AnyObject>[]'

I have to cast plugin type:

  public plugins: Plugin<'bar', AnyObject>[] = [
    ChartjsPluginStacked100 as Plugin<'bar', AnyObject>,
  ];

then it works.

@y-takey
Copy link
Owner Author

y-takey commented Feb 27, 2024

Hi @frenzymind ,
I apologize for the delayed response. Thank you for the report :)

Actually, I don't have a deep understanding of type definitions. If possible, could you make the necessary changes to the plugin's type definition and submit a pull request? That would be very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants