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

how to typify ref? #71

Open
cheechoo28 opened this issue Jun 26, 2023 · 3 comments
Open

how to typify ref? #71

cheechoo28 opened this issue Jun 26, 2023 · 3 comments

Comments

@cheechoo28
Copy link

In your demo I see this typing ref
image
What is the ComponentRef?
I don't understand how I can do typing :(

@sylvaindubus
Copy link
Owner

It's a React type, it's used to make a typed reference of PrismaZoom. In a few lines below, you can see that calling methods like zoomOut is completely understood by Typescript.

@cheechoo28
Copy link
Author

@sylvaindubus I have "typescript": "~5.1.3" and "react": "16.14.0" and I can't export ComponentRef from React.
I can't find anything about the ComponentRef in the React documentation

@sylvaindubus
Copy link
Owner

@cheechoo28 Well, I am using react 17.0.2 and it really exists, but I couldn't find any documentation around it either. :( Anyway, it's the only way I've found to correctly type this ref including bounded methods.

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

2 participants