Closed AntonLie closed 1 month ago
Hi @AntonLie this is not a bug but intentional. The Design System guidelines state that only optional information should be shown as a toast and critical information like warnings and errors should be shown statically on the page (inline) as message toasts can disappear either after a short time or by another toast and the information would be lost without the user being able to see or react to it. That's why warnings and errors are not allowed by NxMessageToastContext.
'error' as NxMessageToastContext
works because under the hood the toast reuses our own nx-message component which accepts all contexts. The type in this case guides you what you are supposed to do. What you are doing is technically possible but from UX and design guidelines not wanted inside Allianz.
⚡ Reproduction As a developer, I want a message toast with an error context style.
Steps to reproduce:
NxMessageToastContext
with 'error'.Create a Message Toast. Add context NxMessageToastContext with the value 'error'. 📗 Expected Behavior
I expect the NxMessageToastContext to display with an error style.
I added the type to avoid errors like this:
I suggest adding the type:
📕 Actual Behavior Received the error: Type '"error"' is not assignable to type 'NxMessageToastContext | undefined'.
📦 Environment
Aquila/NDBX version: 17.1.2 Angular/CDK version: 17.0.0 Browser name & version: Google Chrome Version 129.0.6668.91 Operating System & version (desktop or mobile): Desktop