Skip to content

Commit

Permalink
allow to specify TData for update
Browse files Browse the repository at this point in the history
  • Loading branch information
fkhadra committed Nov 1, 2022
1 parent f33823d commit e8cac35
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/core/toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ toast.isActive = (id: Id) => {
return isToastActive;
};

toast.update = (toastId: Id, options: UpdateOptions = {}) => {
toast.update = <TData = unknown>(
toastId: Id,
options: UpdateOptions<TData> = {}
) => {
// if you call toast and toast.update directly nothing will be displayed
// this is why I defered the update
setTimeout(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ interface CommonOptions {
/**
* @deprecated
* ⚠️ Will be removed in the next major release. You can pass a react component with you handler instead.
*
*
* Fired when clicking inside toaster
*/
onClick?: (event: React.MouseEvent) => void;
Expand Down

0 comments on commit e8cac35

Please sign in to comment.