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

New chart type statically typed not working #11065

Closed
nnkolev opened this issue Jan 16, 2023 · 3 comments
Closed

New chart type statically typed not working #11065

nnkolev opened this issue Jan 16, 2023 · 3 comments
Labels

Comments

@nnkolev
Copy link

nnkolev commented Jan 16, 2023

Expected behavior

Following the documentation on how to type new charts (https://www.chartjs.org/docs/latest/developers/charts.html#typescript-typings), once the new chart is registered in ChartTypeRegistry, the properties registered for that chart type should be accessible.

Current behavior

After the new chart type is registered in ChartTypeRegistry some of the properties declared do not exist when we try to access them. How could we extend the chartjs types by adding custom properties?

Reproducible sample

https://codesandbox.io/s/clever-gagarin-05wchy?file=/src/chartjs.d.ts

Optional extra steps/info to reproduce

No response

Possible solution

No response

Context

No response

chart.js version

4.1.2

Browser name and version

No response

Link to your project

No response

@LeeLenaleee LeeLenaleee added the type: types Typescript type changes label Jan 17, 2023
@LeeLenaleee
Copy link
Collaborator

Can you please describe which properties you expected to be available and are not, when I look at it it seems like all your custom props are working

@elPandaFriki
Copy link

@LeeLenaleee this is also happening to me. On @nnkolev example you can not see the issue as he does not access directly the isDAC property outside of the initial configuration, but here you have my link with a reproducible sample afterwards:
https://codesandbox.io/s/chartjs-typings-05wchy?file=/src/components/App/Component.tsx

As you can see, i also defined a custom property "isCursor" at my configuration and in the re-declaration at chartjs.d.ts, but ChartJS says it is not defined for cases outside of the ChartConfiguration type.

@LeeLenaleee
Copy link
Collaborator

Duplicate of #11064

@LeeLenaleee LeeLenaleee marked this as a duplicate of #11064 Jan 17, 2023
@LeeLenaleee LeeLenaleee closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants