-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
ExpansionPanel doesn't support ref
in typescript description
#14295
Comments
I'm not sure what the public API is here. Our type declarations imply that you should assume that our components can't hold refs. They can be class components (can have a ref) or function components (can't have a ref). It is working at run-time because most of our components are class components. For all components I would recommend you do not rely on a ref prop since it is not documented at the moment. Right now the safest thing to do is to use the @oliviertassinari |
@eps1lon As you said, some component supports the |
How do you want to document this? It's currently not obvious what the public API concerning refs is. Should we make it implicit with our type declarations? If so are you ok with the current state that we disallow refs on all of our components? Explicit by adding it to the API section of each component? |
@eps1lon From a documentation perspective, we can use the following logic: But I think that it's simpler if people use
So, I'm tempted to say that the TypeScript definitions are correct. How do you want to handle the problem? |
This is fine by me. If we can narrow them down to function components i.e. no refs then we automatically resolve #14191 WRT to The issue is that we're relying on refs in our own codebase for |
Ref callback is successfully working for ExpansionPanel but ExpansionPanelProps not containing ref method declaration in https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/ExpansionPanel/ExpansionPanel.d.ts
Expected Behavior 🤔
No errors.
Current Behavior 😯
I see error:
Steps to Reproduce 🕹
Put code
and run linter.
The text was updated successfully, but these errors were encountered: