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

Add Generics to DropResult type #817

Closed
Mnigos opened this issue Aug 15, 2024 · 0 comments · Fixed by #818
Closed

Add Generics to DropResult type #817

Mnigos opened this issue Aug 15, 2024 · 0 comments · Fixed by #818

Comments

@Mnigos
Copy link
Contributor

Mnigos commented Aug 15, 2024

Description

Making DropResult a generic type to specify type of droppableId

Right now I have to assert the type.

  async function onDragEng({ source, destination, draggableId }: DropResult) {
    if (!destination) return

    if (destination.droppableId === source.droppableId) {
      reorderTasks(
        source.droppableId as BoardKey,
        source.index,
        destination.index
      )
    }
  }

I would like to specify type for droppableId in DropResult type argument

async function onDragEng({ source, destination, draggableId }: DropResult<BoardKey>) {
  if (!destination) return

  if (destination.droppableId === source.droppableId) {
    reorderTasks(
      source.droppableId,
      source.index,
      destination.index
    )
  }
}
Mnigos added a commit to Mnigos/dnd that referenced this issue Aug 15, 2024
Id should have type argument that accepts string literals

re hello-pangea#817
100terres pushed a commit that referenced this issue Sep 11, 2024
Id accepts string literals as a generic type.

re #817
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant