Skip to content

Commit 8f24748

Browse files
committed
docs: add @throws JSDoc to useAlertDismiss hook
1 parent 063ca7b commit 8f24748

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/core/src/components/alert.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ function Dismiss({ className, onDismiss, ...props }: DismissProps) {
142142
}
143143
Dismiss.displayName = "Alert.Dismiss";
144144

145+
/**
146+
* Returns the dismiss function for the nearest `Alert.Root`.
147+
* @throws {Error} if called outside an `Alert.Root` tree.
148+
*/
145149
export function useAlertDismiss() {
146150
const dismiss = React.useContext(AlertDismissContext);
147151
if (!dismiss) {

0 commit comments

Comments
 (0)