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

🤔 [ISSUE] - eazychart-[react | vue]- Color scale type safeguard #109

Open
marrouchi opened this issue Jan 29, 2023 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@marrouchi
Copy link
Contributor

marrouchi commented Jan 29, 2023

Description

We need a type safe-guard for the certain shapes that would be included under the color scale context provider. Shapes like Segments or Area do not support non ordinal scale. So we need to find a solution in the future on how to make the developer aware of that while coding recipes.

We already tried to use a type safe guard (instanceof / contructor.name) but it lead to some issues in deployments (see #107 root cause for this issue is well detailed here : https://www.dannyguo.com/blog/how-to-fix-instanceof-not-working-for-custom-errors-in-typescript

The OrdinalScale class extends the AstractScale class and when we perform an "instanceof", in storybook preview :

const scale = new ScaleOrdinal( ... );
console.log(scale instanceof ScaleOrdinal); // prints false
console.log(scale instanceof AbstractScale); // prints true 

This seems to be an issue if when the compilation target is ES3 or ES5, but the wierd thing is that the configured target we have is ESNEXT. "Storybook" relies on Babel and does not account apparently for that config.

We did remove the type safeguard for the moment so that we would think of a better way to handle this in the future : #108

@marrouchi marrouchi added the enhancement New feature or request label Jan 29, 2023
@marrouchi marrouchi changed the title 🤔 [ISSUE] - eazychart-[react | vue]- <title> 🤔 [ISSUE] - eazychart-[react | vue]- Color scale type safeguard Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant