You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It's not possible to make a simple plain notification (in typescript) because useNotification requires type: "success" | "error" | "progress".
A plain notification would be needed when displaying a message or information.
It seems like the type restriction actually only is in the type definition.
Describe alternatives you've considered
Adding // @ts-expect-error type before the property makes it possible to override the value with any string. Omitting the type property or setting the type property to an empty string "" seems to make a simple plain notification. Setting the type to "warning" or "info" seems to work fine as well.
const{ open }=useNotification();open?.({message: "A plain notification",// @ts-expect-error typetype: ""})
Additional context
No response
Describe the thing to improve
Allow no or plain type as well as info and warning for notification options.
This can probably be done by extending the type of the type property to accept additional types, including no type.
It would be preferable if the type property also could be omitted to default to a plain notification.
Hey @klasjersevi thank you for the issue! Refine's notificationProvider designed to handle notifications shown by Refine's hooks and components and those were the types we use in Refine. It will probably be better to use the notification library directly without using useNotification when working with custom types and shapes. Still, I think this is something we can support. We can make types success, error and progress typed and also allow any string as type to allow passing custom types through useNotification 🤔 As a result, its one less thing to worry about on the user side and one more thing Refine handles automatically 🎉
I'll try to send another comment soon to have a bit more detail about the implementation and someone can pick it up and work on it 🚀 Let us know if you want to work on this 🙏
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Is your feature request related to a problem? Please describe.
It's not possible to make a simple plain notification (in typescript) because useNotification requires
type: "success" | "error" | "progress"
.A plain notification would be needed when displaying a message or information.
It seems like the type restriction actually only is in the type definition.
Describe alternatives you've considered
Adding
// @ts-expect-error type
before the property makes it possible to override the value with any string. Omitting thetype
property or setting thetype
property to an empty string""
seems to make a simple plain notification. Setting thetype
to"warning"
or"info"
seems to work fine as well.Additional context
No response
Describe the thing to improve
Allow no or plain type as well as info and warning for notification options.
This can probably be done by extending the type of the
type
property to accept additional types, including no type.It would be preferable if the
type
property also could be omitted to default to a plain notification.The text was updated successfully, but these errors were encountered: