Skip to content

Commit

Permalink
fix: upload type
Browse files Browse the repository at this point in the history
  • Loading branch information
huangmingfu committed Feb 4, 2025
1 parent 18d3b83 commit a3d500b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/image-uploader/image-uploader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export type ImageUploaderProps = {
file: File,
files: File[]
) => Promise<File | null> | File | null
upload: (file: File) => Promise<ImageUploadItem>
upload?: (file: File) => Promise<ImageUploadItem>
onDelete?: (item: ImageUploadItem) => boolean | Promise<boolean> | void
preview?: boolean
showFailed?: boolean
Expand Down Expand Up @@ -199,7 +199,7 @@ export const ImageUploader = forwardRef<ImageUploaderRef, ImageUploaderProps>(
await Promise.all(
newTasks.map(async (currentTask, index) => {
try {
const result = await props.upload(currentTask.file)
const result = await props.upload!(currentTask.file)

Check warning on line 202 in src/components/image-uploader/image-uploader.tsx

View workflow job for this annotation

GitHub Actions / check

Forbidden non-null assertion
newVal[index] = result
setTasks(prev => {
return prev.map(task => {
Expand Down

0 comments on commit a3d500b

Please sign in to comment.