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

[BUG] <Wrong type definition for onSuccess in Upload> #2666

Open
1 task done
Kros-ZERO opened this issue Jan 8, 2025 · 0 comments
Open
1 task done

[BUG] <Wrong type definition for onSuccess in Upload> #2666

Kros-ZERO opened this issue Jan 8, 2025 · 0 comments

Comments

@Kros-ZERO
Copy link

Kros-ZERO commented Jan 8, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Which Component

Upload

Semi Version

2.70.2

Current Behavior

The type of file in Upload is File
截屏2025-01-08 16 16 10

but it has an additional uid prop when I check in Chrome console
截屏2025-01-08 16 20 47

I found this uid helpful for developing, but it has a problem in code:

  const handleOnSuccess = (responseBody: ApiResponseType<FileType>, file: File, fileList: Array<FileItem>) => {
    const fileId = responseBody.data.id;
    const index = fileList.findIndex(fileItem => fileItem.uid === file.uid);
    fileList[index].uid = fileId.toString();
  };

Property 'uid' does not exist on type 'File'.ts(2339)

Expected Behavior

Maybe it should be modified as file: File & {uid: string}?

Environment

- OS: macOS 15.2 (24C101)
- browser: Chrome 131.0.6778.205 arm64
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