in typescript the type notice error: is not assignable to type 'IntrinsicAttributes

Open
#661 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
react, typescript
Domain
frontend

Research direction

Start with the ReactSortable usage and the TS2322 error shown in the issue, then inspect the relevant ReactSortable type definition to understand why children is rejected. Done means the reported TypeScript error is resolved for the shown usage; no repository file or test is named in the issue.

Written by the indexing model from the issue text.

Description

TS2322: Type '{ children: Element[]; list: TagItem[]; setList: Dispatch<SetStateAction<TagItem[]>>; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<ReactSortable> & Pick<Readonly<ReactSortableProps>, never> & InexactPartial<...> & InexactPartial<...>'.   Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<ReactSortable> & Pick<Readonly<ReactSortableProps>, never> & InexactPartial<...> & InexactPartial<...>'.

my code:

type TagItem = {
id: number,
name: string,
parent_id: number
}

  const [tags, setTags] = useState<TagItem[]>([])

  <ReactSortable list={tags} setList={setTags}>
   {
                tags.map(tag => <TagItem key={tag.id} tag={tag} />)
   }
 </ReactSortable>
Dominant language
JavaScript
Stars
9.3k
Forks
1k
Avg merge
3d 8h
Merged PRs (30d)
4

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.

More from react-grid-layout/react-draggable

All issues in react-grid-layout/react-draggable

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.