We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1cb1d62 commit 8302a46Copy full SHA for 8302a46
1 file changed
src/lib/components/layout/Flex.tsx
@@ -29,7 +29,7 @@ export type FlexProps = PositionProps &
29
borderColor?: 'light' | 'dark';
30
};
31
32
-type ButtonChild = ReactElement<ButtonProps>;
+type ButtonChild = ReactElement<ButtonProps> | null;
33
34
type PositionProps = Required<Pick<ButtonProps, 'top' | 'left'>>;
35
@@ -271,8 +271,8 @@ export const Flex = forwardRef(function FlexWithRef(
271
);
272
});
273
274
-const isValidChild = (child: ReactElement) =>
275
- child.type === Button || child.type === Flex;
+const isValidChild = (child: ReactElement | null): child is ReactElement =>
+ child !== null && (child.type === Button || child.type === Flex);
276
277
const directionMap: Record<
278
NonNullable<FlexProps['direction']>,
0 commit comments