diff --git a/packages/react-native/Libraries/StyleSheet/StyleSheet.d.ts b/packages/react-native/Libraries/StyleSheet/StyleSheet.d.ts index 6d9fda4dac2..17ab55d6bc9 100644 --- a/packages/react-native/Libraries/StyleSheet/StyleSheet.d.ts +++ b/packages/react-native/Libraries/StyleSheet/StyleSheet.d.ts @@ -14,7 +14,7 @@ export interface StyleSheetProperties { flatten(style: T): T; } -type Falsy = undefined | null | false; +type Falsy = undefined | null | false | ''; interface RecursiveArray extends Array | RecursiveArray> {} /** Keep a brand of 'T' so that calls to `StyleSheet.flatten` can take `RegisteredStyle` and return `T`. */ diff --git a/packages/react-native/types/__typetests__/index.tsx b/packages/react-native/types/__typetests__/index.tsx index 33a3a2bba74..80a615b036c 100644 --- a/packages/react-native/types/__typetests__/index.tsx +++ b/packages/react-native/types/__typetests__/index.tsx @@ -411,7 +411,9 @@ class CustomView extends React.Component { } } -class Welcome extends React.Component & {color: string}> { +class Welcome extends React.Component< + ElementProps & {color: string; bgColor?: null | undefined | string} +> { rootViewRef = React.useRef(null); customViewRef = React.useRef(null); @@ -436,12 +438,18 @@ class Welcome extends React.Component & {color: string}> { } render() { - const {color, ...props} = this.props; + const {color, bgColor, ...props} = this.props; return ( + style={[ + [styles.container], + undefined, + null, + false, + bgColor && {backgroundColor: bgColor}, + ]}> Welcome to React Native To get started, edit index.ios.js