From 1752fdc0f573be4348e4e6e7e31bc53b00aa00c6 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Wed, 14 Dec 2022 14:59:05 -0800 Subject: [PATCH] Fix type for `StyleSheet.compose()` Summary: This was flagged when typechecking the existing examples. The current type enforces that both stylesheets overlap, meaning composed stylesheets with distinct props cause a typechecking error. This changes the signature so that each style can be different, and the intersection type of the two is returned. Changelog: [General][Fixed] - Fix type for `StyleSheet.compose()` Reviewed By: christophpurrer Differential Revision: D42008355 fbshipit-source-id: 238971a61b387c09be001d5df50fe3db70df566f --- Libraries/StyleSheet/StyleSheet.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Libraries/StyleSheet/StyleSheet.d.ts b/Libraries/StyleSheet/StyleSheet.d.ts index 95ad0dd767316e..b3325098207274 100644 --- a/Libraries/StyleSheet/StyleSheet.d.ts +++ b/Libraries/StyleSheet/StyleSheet.d.ts @@ -87,10 +87,10 @@ export namespace StyleSheet { * an array, saving allocations and maintaining reference equality for * PureComponent checks. */ - export function compose( + export function compose( style1: StyleProp | Array>, - style2: StyleProp | Array>, - ): StyleProp; + style2: StyleProp | Array>, + ): StyleProp; /** * WARNING: EXPERIMENTAL. Breaking changes will probably happen a lot and will