VisualizationSpec isn't an exported member from react-vega
neilenns opened this issue · 6 comments
I'm trying to get a basic create-react-app updated to show the simple bar chart from https://github.com/vega/react-vega/blob/master/packages/react-vega-demo/stories/ReactVegaLiteDemo.tsx. Unfortunately I'm hitting several errors when compiling.
The first is:
Module '"../node_modules/react-vega/lib"' has no exported member 'VisualizationSpec'.
My import line looks like this:
import { createClassFromSpec, VisualizationSpec } from "react-vega";
My package.json contains this:
"react-vega": "^7.4.0",
"vega": "^5.13.0",
"vega-lite": "^4.14.0"
To resolve this I had to add another import:
import { VisualizationSpec } from "vega-embed";
Thank you for reporting.
Seems like there is an issue with type re-exporting. From my quick check it seems more complicated to make the re-exporting work.
So what you are doing is the right way. (I was doing the same before trying to re-export the type from vega-embed
for convenience. Sorry for the confusion.
I'll update the documentation.
Great, thanks!
Actually I found a solution, so please try react-vega@7.4.1
. It should include VisualizationSpec
import { VisualizationSpec } from "react-vega";
Thanks! I keep forgetting to grab the latest and confirm for you. I will do so today!
Confirmed working!