Skip to content

Typescript compilation issues #291

@arodidev

Description

@arodidev

I am getting some typescript issues that are a bit difficult to resolve when trying to override the components in the JSXParser components map prop. Sample code below:

<JSXParser
  components={{
    PieChart: (props: React.ComponentProps<typeof PieChart>) => (
      <ErrorBoundary FallbackComponent={ErrorFallback}>
        <PieChart
          {...(props as React.ComponentProps<typeof PieChart>)}
          container={
            CardComponent as React.ComponentType<ContainerComponentProps>
          }
        />
      </ErrorBoundary>
    ),    
  }}
  jsx={
    "<PieChart userOptions={{ dataLabels: { enabled: true }, stroke: { show: false } }} />"
  }
/>

I seem to be getting this error:

Type '(props: React.ComponentProps<typeof PieChart>) => JSX.Element' is not assignable to type 'ComponentType | ExoticComponent<{}>'

Is there a way to extend (or override) the types provided for the JSXParser component to fix these errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions