So I've been trying to pass created StyleSheet object as a function argument. This is working fine so far but as I'm using TypeScript I want to give that argument a proper type and that's were my pain begins. I've already tried to create StyleSheet with my Type but that's not a case as I want it to be completely universal.
const useStyles = (mainStyles, iosStyles?, androidStyles?) => { const [defaultStyles, setDefaultStyles] = useState(mainStyles) const [platformStyles, setPlatformStyles] = useState( Platform.OS === 'ios' ? iosStyles : androidStyles) if (!iosStyles && !androidStyles) { const mergedStyles = StyleSheet.create({ ...defaultStyles }) return mergedStyles } const mergedStyles = StyleSheet.create({ ...defaultStyles, ...platformStyles }) return mergedStyles }