Skip to content

Commit

Permalink
fix: accept readonly arrays in props types as this library won't modi…
Browse files Browse the repository at this point in the history
…fy its input
  • Loading branch information
pcorpet committed Dec 24, 2023
1 parent c36ab5b commit fefbba0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions typings/react-dropzone.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface FileError {

export interface FileRejection {
file: File;
errors: FileError[];
errors: readonly FileError[];
}

export type DropzoneOptions = Pick<React.HTMLProps<HTMLElement>, PropTypes> & {
Expand All @@ -51,7 +51,7 @@ export type DropzoneOptions = Pick<React.HTMLProps<HTMLElement>, PropTypes> & {
onFileDialogCancel?: () => void;
onFileDialogOpen?: () => void;
onError?: (err: Error) => void;
validator?: <T extends File>(file: T) => FileError | FileError[] | null;
validator?: <T extends File>(file: T) => FileError | readonly FileError[] | null;
useFsAccessApi?: boolean;
autoFocus?: boolean;
};
Expand All @@ -68,8 +68,8 @@ export type DropzoneState = DropzoneRef & {
isDragAccept: boolean;
isDragReject: boolean;
isFileDialogActive: boolean;
acceptedFiles: File[];
fileRejections: FileRejection[];
acceptedFiles: readonly File[];
fileRejections: readonly FileRejection[];
rootRef: React.RefObject<HTMLElement>;
inputRef: React.RefObject<HTMLInputElement>;
getRootProps: <T extends DropzoneRootProps>(props?: T) => T;
Expand All @@ -93,5 +93,5 @@ export interface DropzoneInputProps
type PropTypes = "multiple" | "onDragEnter" | "onDragOver" | "onDragLeave";

export interface Accept {
[key: string]: string[];
[key: string]: readonly string[];
}

0 comments on commit fefbba0

Please sign in to comment.