-
Notifications
You must be signed in to change notification settings - Fork 100
Fix flow types #54
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
Fix flow types #54
Conversation
|
Great! Could you type the Just type that it is a function that receives components and returns another component. The rest is impossible to type |
|
@renatorib I already said it's not typable. I can only make it any. |
|
I know it's impossible to type. But we can do it generically In typescript I think it's something like this: type ComposeRender = (...props: any[]) => ReactNode
type ComposeInput = ComponentType<any> | ReactElement<any>
declare function compose(...inputs: ComposeInput[]): ComponentType<{ render: ComposeRender }>
declare function compose(...inputs: ComposeInput[]): ComponentType<{ children: ComposeRender }> |
|
Well, any. Unsafe. But ok. |
|
Well, I guess it's better than nothing. 😅 |
|
@renatorib There is a problem. render or children are not optional. We can't omit them when create component. |
|
Humm. Got it. |
|
What do you mean? |
|
It's just a question. I don't know how overloading works. It's possible to solve this problem with overloads? |
|
Anyway. I'll merge this. I'll see what I can do with the compose in another PR. What do you think? |
|
We already use overload for each component. The first one works with children and the second one with render props. |
|
So we can't do this with compose too? |
|
The problem is not compose itself. The problem is components which can't be created without one prop and passed to compose. So nothing can be used with compose. |
|
Oh. Got it. Sorry. |
|
Compose requires them to be optional. But it's not type safe with regular use. So currently components require one of children or render to be passed. |
|
Can we release this and maybe discuss |
|
Alright! Thanks 😄 |
|
Friendly ping :) |
|
Would be good if you will let me publish such fixes. |
|
@TrySound published |
Would be good to release this fixes