fix: correctly type props

This commit is contained in:
madkarmaa 2025-05-09 12:02:08 +02:00
parent 485ac26c30
commit 9dc01dbfc4

View File

@ -11,9 +11,17 @@
type Props = {
children: Snippet;
level: 'info' | 'warning' | 'caution';
permanent?: boolean;
} & (
| {
permanent?: false;
onDismiss?: () => void;
};
}
| {
permanent: true;
onDismiss?: never; // permanent banner doesn't have a dismiss button
}
);
let { children, level = 'info', permanent = false, onDismiss }: Props = $props();
const icons = { info: Info, warning: Warning, caution: Caution };