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] Incorrect Typescript typing for fileRenameFunction #21

Open
2 tasks done
mooalot opened this issue Feb 23, 2024 · 1 comment
Open
2 tasks done

[Bug] Incorrect Typescript typing for fileRenameFunction #21

mooalot opened this issue Feb 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mooalot
Copy link

mooalot commented Feb 23, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Have you updated FilePond and its plugins?

  • I have updated FilePond and its plugins

Describe the bug

Its not super detrimental and is easy to get around, but just thought I'd point it out. The fileRenameFunction is incorrectly typed as per the latest release of FilePond and FilePond Rename plugin.

Current
fileRenameFunction?: | undefined | null | ((options: { basename: string; extension: string; name: string; }) => string) | Promise<string>

What it probably should be
fileRenameFunction?: | undefined | null | ((options: { basename: string; extension: string; name: string; }) => string | Promise<string>);

Reproduction

I don't think its worth creating a sandbox. Steps to reproduce are:

  1. Download latest filepond-plugin-file-rename and filepond
  2. Make sure you're using typescript in your project
  3. Try to set the fileRenameFunction on the filepond options (this is the example in the docs):
    FilePond.setOptions({ fileRenameFunction: (file) => new Promise((resolve) => { resolve(window.prompt('Enter new filename', file.name)); }), });
  4. Voila it doesn't work with typescript

Environment

Typescript
@mooalot mooalot added the bug Something isn't working label Feb 23, 2024
@rikschennink rikschennink transferred this issue from pqina/filepond Feb 26, 2024
@rikschennink
Copy link
Collaborator

PR is welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants