Skip to content

Commit 21027b7

Browse files
committed
fix: eslint warning
1 parent 1d27366 commit 21027b7

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/AjaxUploader.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type {
1818
interface ParsedFileInfo {
1919
origin: RcFile;
2020
action: string;
21-
data: object;
21+
data: Record<string, unknown>;
2222
parsedFile: RcFile;
2323
}
2424

@@ -158,7 +158,7 @@ class AjaxUploader extends Component<UploadProps> {
158158

159159
// Get latest data
160160
const { data } = this.props;
161-
let mergedData: object;
161+
let mergedData: Record<string, unknown>;
162162
if (typeof data === 'function') {
163163
mergedData = await data(file);
164164
} else {

src/interface.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ export interface UploadProps
1414
action?: Action;
1515
method?: UploadRequestMethod;
1616
directory?: boolean;
17-
data?: object | ((file: RcFile | string | Blob) => object);
17+
data?: Record<string, unknown> | ((file: RcFile | string | Blob) => Record<string, unknown>);
1818
headers?: UploadRequestHeader;
1919
accept?: string;
2020
multiple?: boolean;
2121
onBatchStart?: (
2222
fileList: { file: RcFile; parsedFile: Exclude<BeforeUploadFileType, boolean> }[],
2323
) => void;
2424
onStart?: (file: RcFile) => void;
25-
onError?: (error: Error, ret: object, file: RcFile) => void;
26-
onSuccess?: (response: object, file: RcFile, xhr: object) => void;
25+
onError?: (error: Error, ret: Record<string, unknown>, file: RcFile) => void;
26+
onSuccess?: (response: Record<string, unknown>, file: RcFile, xhr: XMLHttpRequest) => void;
2727
onProgress?: (event: UploadProgressEvent, file: RcFile) => void;
2828
beforeUpload?: (
2929
file: RcFile,
@@ -57,7 +57,7 @@ export interface UploadRequestOption<T = any> {
5757
onProgress?: (event: UploadProgressEvent) => void;
5858
onError?: (event: UploadRequestError | ProgressEvent, body?: T) => void;
5959
onSuccess?: (body: T, xhr?: XMLHttpRequest) => void;
60-
data?: object;
60+
data?: Record<string, unknown>;
6161
filename?: string;
6262
file: Exclude<BeforeUploadFileType, File | boolean> | RcFile;
6363
withCredentials?: boolean;

src/request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default function upload(option: UploadRequestOption) {
5151
return;
5252
}
5353

54-
formData.append(key, option.data[key]);
54+
formData.append(key, value as string | Blob);
5555
});
5656
}
5757

0 commit comments

Comments
 (0)