Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toast and button severity is not properly typed "secondary" or "contrast" are missing and produce a TS error #6824

Closed
pascalbaetz opened this issue Jul 3, 2024 · 4 comments · Fixed by #6832, #6839, leoo1992/GeradorQRCode#80 or leoo1992/GeradorQRCode#85 · May be fixed by mtech-31-quemistry/quemistry_client_web#20
Assignees
Labels
good first issue *** Welcome to PrimeReact Family! *** Good issue! Typescript Issue or pull request is *only* related to TypeScript definition
Milestone

Comments

@pascalbaetz
Copy link
Contributor

pascalbaetz commented Jul 3, 2024

Describe the bug

You can not assign the severities "contrast" and "secondary" to a Toast Message with:
toast.current?.show({ severity: 'contrast', summary: 'Contrast', detail: 'Message Content', life: 3000 });
Screenshot 2024-07-03 at 17 59 40

It produces a Typescript error, that 'contrast' and 'secondary' can not be assigned due to a type missmatch.
I looked into the code and it looks like someone just forgot to update the ToastMessage type in:
components/lib/toast/toast.d.ts
The ToastMessageOptions just above is correct tho.

Even tho u get Typescript errors, it is working properly, so a simple type update should fix it.

Reproducer

https://stackblitz.com/edit/t3q925?file=src%2FApp.tsx

PrimeReact version

10.7.0

React version

17.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

I can assign all severities without a TS error.

@pascalbaetz pascalbaetz added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 3, 2024
@melloware melloware added Typescript Issue or pull request is *only* related to TypeScript definition good first issue *** Welcome to PrimeReact Family! *** Good issue! and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jul 3, 2024
@Rekl0w
Copy link
Contributor

Rekl0w commented Jul 4, 2024

PR submitted.

@pascalbaetz
Copy link
Contributor Author

There is a similar problem for the button severity. Maybe you could just fix it within this issue even tho it is already fixed and merged. Or should I open a separate one ?

@Rekl0w
Copy link
Contributor

Rekl0w commented Jul 4, 2024

I'll fix it here too. Can you please change the title with button component in it ?

@pascalbaetz pascalbaetz changed the title Toast severity is not properly typed "secondary" and "contrast" are missing and produce a TS error Toast and button severity is not properly typed "secondary" or "contrast" are missing and produce a TS error Jul 4, 2024
@Rekl0w
Copy link
Contributor

Rekl0w commented Jul 4, 2024

PR submitted. @melloware

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment