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

"'Vega' cannot be used as a JSX component." when react-vega used with react 19 #609

Open
JackWilb opened this issue Jan 17, 2025 · 0 comments

Comments

@JackWilb
Copy link

JackWilb commented Jan 17, 2025

Here's the error. It seems that the type for shouldComponentUpdate has changed to remove nextContext. Perhaps (hopefully 🤞🏻) this is as simple as updating react inside this package and fixing up the types. The component seems to function as expected even given this type issue.

'Vega' cannot be used as a JSX component.
  Its type 'typeof Vega' is not a valid JSX element type.
    Type 'typeof Vega' is not assignable to type 'new (props: any) => Component<any, any, any>'.
      Construct signature return types 'Vega' and 'Component<any, any, any>' are incompatible.
        The types of 'shouldComponentUpdate' are incompatible between these types.
          Type '((nextProps: Readonly<VegaProps>, nextState: Readonly<{}>, nextContext: any) => boolean) | undefined' is not assignable to type '((nextProps: Readonly<any>, nextState: Readonly<any>) => boolean) | undefined'.
            Type '(nextProps: Readonly<VegaProps>, nextState: Readonly<{}>, nextContext: any) => boolean' is not assignable to type '(nextProps: Readonly<any>, nextState: Readonly<any>) => boolean'.
              Target signature provides too few arguments. Expected 3 or more, but got 2.ts(2786)

react-vega: 7.4.0
react: 19.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant