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

Can not compile when use React.forwardRef #174

Closed
codebdy opened this issue Jan 14, 2021 · 1 comment · Fixed by #178
Closed

Can not compile when use React.forwardRef #174

codebdy opened this issue Jan 14, 2021 · 1 comment · Fixed by #178

Comments

@codebdy
Copy link

codebdy commented Jan 14, 2021

I have to use any type in TS:
image

@TroyAlford
Copy link
Owner

mmm - that sounds like a limitation of the TS typing. https://github.com/TroyAlford/react-jsx-parser/blob/develop/source/components/JsxParser.tsx#L20 declares components as:

components?: Record<string, Component | FunctionComponent>,

Looks like React.forwardRef() returns a React.ForwardRefExoticComponent<React.RefAttributes<unknown>>...

My guess is that I need to upgrade this to something like:

components?: Record<string, ComponentType | ExoticComponent>,

This should handle a wide variety of add'l exotics, like Memo exotics, Lazy exotics, etc.

Thanks for the report! I'll get this in as soon as I have time.

image

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

Successfully merging a pull request may close this issue.

2 participants