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

Type Error On 'primereact/toast' #7023

Closed
permlap-phola opened this issue Aug 11, 2024 · 0 comments · Fixed by #7024 · May be fixed by leoo1992/GeradorQRCode#95
Closed

Type Error On 'primereact/toast' #7023

permlap-phola opened this issue Aug 11, 2024 · 0 comments · Fixed by #7024 · May be fixed by leoo1992/GeradorQRCode#95
Assignees
Labels
Typescript Issue or pull request is *only* related to TypeScript definition
Milestone

Comments

@permlap-phola
Copy link

permlap-phola commented Aug 11, 2024

Describe the bug

Typescript throw error

[{
	"resource": "****************************",
	"owner": "typescript",
	"code": "2322",
	"severity": 8,
	"message": "Type '(props: any) => ReactNode' is not assignable to type 'ReactNode'.",
	"source": "ts",
	"startLineNumber": 260,
	"startColumn": 16,
	"endLineNumber": 293,
	"endColumn": 23,
	"relatedInformation": [
		{
			"startLineNumber": 260,
			"startColumn": 16,
			"endLineNumber": 293,
			"endColumn": 23,
			"message": "Did you mean to call this expression?",
			"resource": "*******"
		}
	]
}]
toastBC.current.show({
                severity: 'success',
                summary: 'Can you send me the report?',
                sticky: true,
                content: (props) => ( //the type error happen on here when you want to pass props in the content//
                    <div className="flex flex-column align-items-left" style={{ flex: '1' }}>
                        <div className="flex align-items-center gap-2">
                            <Avatar image="/images/avatar/amyelsner.png" shape="circle" />
                            <span className="font-bold text-900">Amy Elsner</span>
                        </div>
                        <div className="font-medium text-lg my-3 text-900">{props.message.summary}</div>
                        <Button className="p-button-sm flex" label="Reply" severity="success" onClick={clear}></Button>
                    </div>
                )
            });

I have fixed on my development by changing ToastMessage type
content?: React.ReactNode | undefined; to content?: (props:any)=> React.ReactNode | undefined;

Reproducer

No response

System Information

"primereact": "^10.8.2",
"react": "^18",
"next": "13.4.19",
"typescript": "^5"

Steps to reproduce the behavior

No response

Expected behavior

No response

@permlap-phola permlap-phola added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Aug 11, 2024
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. Typescript Issue or pull request is *only* related to TypeScript definition and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: Bug Issue contains a defect related to a specific component. labels Aug 11, 2024
@melloware melloware added this to the 10.8.3 milestone Aug 11, 2024
melloware added a commit to melloware/primereact that referenced this issue Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typescript Issue or pull request is *only* related to TypeScript definition
Projects
None yet
2 participants