Next.js Discord

Discord Forum

Learning NextJS and stuck on Chapter 12

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Avatar
Transvaal lionOP
I'm seeing the following two error messages and don't know where I've gone wrong. Please help!

Type '{ amount: number; id: string; customer_id: string; status: "pending" | "paid"; } | undefined' is not assignable to type 'InvoiceForm'.
Type 'undefined' is not assignable to type 'InvoiceForm'.

The expected type comes from property 'invoice' which is declared here on type 'IntrinsicAttributes & { invoice: InvoiceForm; customers: CustomerField[]; }'

If it's useful, I could share my git repository?

13 Replies

Avatar
Dunker
Have you fixed, if not tell me I ll ask some questions
Avatar
Transvaal lionOP
Not fixed yet. I really don't know where to start. Happy to share the git repository.
Thank-you.
Avatar
Dunker
where are you seeing this error
I've written the above brief on what's going wrong!
Avatar
Dunker
So listen, i know how to fix the error
Actually it's basic async pitfall happens everytime, so you just need to check existence of invoice before passing to form
Open this page dashboard/invoices/[id]/edit/page.tsx
Then change this line to this
<Form invoice={invoice} customers={customers} />
{invoice && <Form invoice={invoice} customers={customers} />}
Then you are all set
Also I read your doc, and if you are okay I would like to help on this way
I also finished that learning project and deployed, tell me if you stuck anywhere
Avatar
Transvaal lionOP
Thank-you. I will try this and let you know how I get on. Really really appreciate your help.