-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Cannot use layers with typescript #1322
Labels
📊 bar
@nivo/bar package
Comments
We are using string unions for the charts that have been converted to typescript, Pie, Sunburst. So when we get around to converting it, we will make this change. Feel free to make a PR sooner if you would like to make that change! |
mdesousa
pushed a commit
to mdesousa/nivo
that referenced
this issue
Dec 2, 2020
plouc
pushed a commit
that referenced
this issue
Dec 3, 2020
Fixed by #1323 |
ddavydov
pushed a commit
to netronixgroup/nivo
that referenced
this issue
Apr 8, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It appears that with typescript it is not possible to declare layers for the ResponsiveBar component. This is with version 0.65.1 of @nivo/bar.
If your try to use the default string array["grid", "axes", "bars", "markers", "legends", "annotations"] you get type errors (e.g. Type '"grid"' is not assignable to type 'Layer').
The typescript definition seems to be using an enum type (BarLayerType):
I tried importing BarLayerType and using enums, like this:
This looks ok in the vscode linter. However, when you start the react project you get an error: Attempted import error: 'BarLayerType' is not exported from '@nivo/bar'.
This is confusing since there is an "export" in the declaration file... but it's what happens.
I would like to recommend to change the BarLayerType to be a string union instead of an enum, like this:
The text was updated successfully, but these errors were encountered: