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

fix: ensure proper readonly arrays for types #1280

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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[];
}