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

Typescript Definition File #84

Open
nolawnchairs opened this issue May 17, 2018 · 1 comment
Open

Typescript Definition File #84

nolawnchairs opened this issue May 17, 2018 · 1 comment

Comments

@nolawnchairs
Copy link

Can you please include a typescript definition file?

@maslade
Copy link

maslade commented Sep 14, 2023

I whipped this together for anyone looking for a quick hack:

declare module 'react-sortable' {
  export function sortable<ItemType, BaseProps = {}>( component: React.FC<BaseProps> )
  : React.FC<BaseProps & SortableProps<ItemType>>;
}

interface SortableProps<ItemType> {
  onSortItems: ( items: ItemType[] ) => void;
  items: ItemType[];
  sortId: number;
  key: number | string;
}

This goes into a file such as react-sortable.d.ts and should work from there.

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

No branches or pull requests

2 participants