fix(types): allow recursive array of styles#3189
fix(types): allow recursive array of styles#3189williamsjokvist wants to merge 4 commits intodiegomura:masterfrom
Conversation
|
d079cb4 to
368655e
Compare
diegomura
left a comment
There was a problem hiding this comment.
I find cumbersome to have StyleProp<Style | Style[]> repeated everywhere. Maybe we can just export StyleProp to be that instead of using generics?
|
For sure @diegomura, I think I thought different components had different style interfaces, like |
4968510 to
1d7424a
Compare
1d7424a to
79f1572
Compare
|
Hi, I have updated the PR, please have another look @diegomura Looks like there's already test coverage for this, it's only unsupported by the typing |
This eases the
styleparam typing for all components, allowing [Style[], undefined, Style] etc. to be passed. Which is a common pattern in e.g. React Native.Desired behavior:
Before this would give an error, despite the JS working fine.
To circumvent this, I've seen people do these cumbersome runtime checks, which is not necessary with vanilla JS:
In my own projects I've added this piece of module augmentation, which is the typing included in this PR: