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

Allow dataset specific ChartMeta type extensions #9432

Merged
merged 1 commit into from Jul 19, 2021

Conversation

etimberg
Copy link
Member

Resolves #9422

@etimberg etimberg added the type: types Typescript type changes label Jul 18, 2021
@etimberg etimberg added this to the Version 3.5.0 milestone Jul 18, 2021

// A cast is required because the exact type of ChartMeta will vary with
// mixed charts
const meta = <ChartMeta<Element, Element, 'doughnut'>>chart.getDatasetMeta(0);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if the casting is acceptable here. It would be a lot simpler to cast if TType was the first parameter, but I wasn't sure that would be considered a breaking change or not

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally it should not need to be casted, because its not a mixed chart. I don't know if there is a way to type it so it would return the correct meta for the given dataset index.

@etimberg etimberg merged commit 8008488 into chartjs:master Jul 19, 2021
@etimberg etimberg deleted the chart-meta-type-upgrade branch July 19, 2021 17:33
kurkle pushed a commit to kurkle/chartjs-chart-sankey that referenced this pull request Sep 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: types Typescript type changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ChartMeta interface missing properties
2 participants