-
-
Notifications
You must be signed in to change notification settings - Fork 635
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 define Component shape using typescript? #1630
Comments
This is related to issue: #1619 |
@Havunen So from my understanding for now we must do |
ping @Havunen |
Hmm, I was playing with this today and it seems there are some issues with the component children typings. I will investigate |
…ve automatic component children type support #1630
Hi @farooqkz There is now two new types If you are using class components you need to help typescript little bit by defining the prop same as set to the generic type of Component in lifecycle methods for example render. Note that when using The typed children support has also been improved in v8.1.0. You can mark the children prop optional if you want to allow leaving children empty. |
I created a new ticket #1635 |
I am defining a component whose shape must be something predefined. How can I use typescript to enforce this?
For example sometimes I want
children
to be a single VNode only and nothing else.The text was updated successfully, but these errors were encountered: