primeng icon indicating copy to clipboard operation
primeng copied to clipboard

Add type to toast severity.

Open icenitipol opened this issue 7 months ago • 2 comments

Describe the bug

Currently, the severity option for toasts accepts any string value, which can lead to unintended styling issues when a value is misspelled (e.g., "sucess" instead of "success").

This pull request introduces a strict type for the severity option to enforce valid values and prevent such errors at compile time.

Pull Request Link

https://github.com/primefaces/primeng/pull/18390

Reason for not contributing a PR

  • [ ] Lack of time
  • [ ] Unsure how to implement the fix/feature
  • [ ] Difficulty understanding the codebase
  • [ ] Other

Other Reason

No response

Reproducer

https://stackblitz.com/edit/github-ewdbjc3a-oa5npoqh?file=src%2Fapp%2Fapp.component.ts

Environment

Windows 11 PC

Angular version

19.x.x

PrimeNG version

v19

Node version

22.x.x

Browser(s)

Chrome Latest

Steps to reproduce the behavior

Use MessageService to display a toast.

Call the add function with a ToastMessageOptions object.

Notice that the severity property accepts any string value, without validation or autocomplete.

Expected behavior

I expected the severity option to provide predefined values, rather than accepting any string, so that invalid options can't be used by mistake.

icenitipol avatar May 23 '25 07:05 icenitipol

This issue has been automatically marked as stale due to a lack of activity. If this issue is still relevant to you, please leave a comment so we can keep it open. We apologize for not being able to prioritize it sooner. If you have any new information or questions, please share them in your comment!

github-actions[bot] avatar Nov 20 '25 00:11 github-actions[bot]

Hello, any news in this implementation? This is actually a very good proposal

AIO1 avatar Dec 04 '25 18:12 AIO1