Skip to content

Commit 5b35b66

Browse files
fix(AlertBadge): return type (#1881)
## 📝 Changes - Fixes the return type in `AlertBadge` causing type errors in consumers with the added React 19 support > In React 19, ReactNode was expanded to include bigint and Promise<AwaitedReactNode>. When a component returns children (typed as ReactNode) directly, TypeScript sees the return type as the full ReactNode union, which includes types that aren't assignable to what JSX expressions expect from a component. The consumer's React 18 types don't understand Promise or bigint as valid JSX return types, causing the mismatch.
1 parent 3f515b3 commit 5b35b66

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

.changeset/lazy-roses-talk.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@easypost/easy-ui": patch
3+
---
4+
5+
fix(AlertBadge): return type

easy-ui-react/src/AlertBadge/AlertBadge.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export type AlertBadgeProps = {
4444
show: boolean;
4545
};
4646

47-
export function AlertBadge(props: AlertBadgeProps) {
47+
export function AlertBadge(props: AlertBadgeProps): React.JSX.Element {
4848
const {
4949
accessibilityLabel = "Alert Badge",
5050
placement = DEFAULT_PLACEMENT,
@@ -61,7 +61,7 @@ export function AlertBadge(props: AlertBadgeProps) {
6161
);
6262

6363
if (!show) {
64-
return children;
64+
return <>{children}</>;
6565
}
6666

6767
return (

0 commit comments

Comments
 (0)