I am trying to import an React class called Vega-Lite
from a project called Voyager
.
Here's my code:
import * as React from 'react';
import {VegaLite} from 'datavoyager/build/components/vega-lite';
export interface Props {
spec: any;
logger: any;
}
export const View = ({spec, logger}: Props) => {
return(
<VegaLite spec={spec} logger={logger}/>
);
};
Here's my error:
[ts] JSX element type 'VegaLite' is not a constructor function for JSX elements. Property 'componentDidMount' is protected in type 'VegaLite' but public in type 'ElementClass'.
I know that in the class Vega-Lite
, the function componentDidMount()
is indeed protected
. But how do I fix this error?
PS: I've tried setting allowSyntheticDefaultImports
to true
in my tsconfig.json
, but the same error persists.
"allowSyntheticDefaultImports": true
intsconfig.json
? – Andrew