tpye error on `onChange`
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 201
- Avg merge
- 12m
- Merged PRs (30d)
- 1
Description
When provdigin a the setState Event handler for the onChange event, there is a type mismatch:
const [value, setValue] = useState("**Hello world!!!**");
<MDEditor value={value} onChange={setValue} />
Type 'Dispatch<SetStateAction<string>>' is not assignable to type '(value?: string | undefined, event?: ChangeEvent<HTMLTextAreaElement> | undefined, state?: ContextStore | undefined) => void'.
Types of parameters 'value' and 'value' are incompatible.
Type 'string | undefined' is not assignable to type 'SetStateAction<string>'.
Type 'undefined' is not assignable to type 'SetStateAction<string>'.ts(2322)
versions:
"@uiw/react-md-editor": "^4.0.1",
"typescript": "^4.9.5",
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the TypeScript error with the shown MDEditor and useState example, then inspect the MDEditor onChange type and the package's TypeScript definitions. Done means the example type-checks with the listed TypeScript and @uiw/react-md-editor versions without weakening the reported callback contract.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100