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

Types: Export DecimationAlgorithm as const #9046

Merged
merged 1 commit into from May 7, 2021
Merged

Conversation

kurkle
Copy link
Member

@kurkle kurkle commented May 7, 2021

Fix #8993

This only affects the typescript compiler output of a typescript project consuming these types.
With declare, the DecimationAlgorithm object is assumed to be found in chart.esm.js, and its not, because we only have that in the '.d.ts'.

As said in https://stackoverflow.com/a/50568865/10359775 the const enum is however replaced with the string values at compile time, so the end result does not try to use DecimationAlgorithm from the chart.esm.js, but uses the literal strings instead.

More information: https://www.typescriptlang.org/docs/handbook/enums.html#enums-at-runtime

@kurkle kurkle added type: bug type: types Typescript type changes labels May 7, 2021
@etimberg etimberg changed the title Types: Export DecinmationAlgorithm as const Types: Export DecimationAlgorithm as const May 7, 2021
@etimberg etimberg added this to the Version 3.3 milestone May 7, 2021
@etimberg etimberg merged commit 9a78770 into chartjs:master May 7, 2021
@kurkle kurkle deleted the const branch May 30, 2021 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug type: types Typescript type changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DecimationAlgorithm enum not found
2 participants