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

SortableContext and ArrayMove could accept ReadonlyArray #1508

Open
geoffreytools opened this issue Oct 22, 2024 · 0 comments
Open

SortableContext and ArrayMove could accept ReadonlyArray #1508

geoffreytools opened this issue Oct 22, 2024 · 0 comments

Comments

@geoffreytools
Copy link

Hi,

At current it is more difficult than it should to use ReadonlyArray. I spotted two places where the function signatures could change.

In SortableContext.tsx

export interface Props {
  children: React.ReactNode;
- items: (UniqueIdentifier | {id: UniqueIdentifier})[];
+ items: ReadonlyArray<UniqueIdentifier | {id: UniqueIdentifier}>;
  strategy?: SortingStrategy;
  id?: string;
  disabled?: boolean | Disabled;
}

In arrayMove.ts

- export function arrayMove<T>(array: T[], from: number, to: number): T[] {
+ export function arrayMove<T>(array: readonly T[], from: number, to: number): T[] {
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

1 participant