vercel / vercel/next-learn

Chapter 14: Type Error inside create-form and edit-form

Open
#732 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
4.8k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

Typescript is throwing type error for the message inside create-form and edit-form

app/ui/invoices/create-form.tsx - line 16
app/ui/invoices/edit-form.tsx - line 22

Screenshot (1)

Type '{ message: null; errors: {}; }' is not assignable to type '{ errors: { customerId?: string[] | undefined; amount?: string[] | undefined; status?: string[] | undefined; }; message: string; }'.
Types of property 'message' are incompatible.
Type 'null' is not assignable to type 'string'.

Purposed solution:
Initializing message as empty string instead of null

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported type errors in app/ui/invoices/create-form.tsx at line 16 and app/ui/invoices/edit-form.tsx at line 22. Inspect the message initialization and apply the proposed empty-string approach; done means both files no longer produce the reported TypeScript error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.