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

generateUniqueIdentifier type in Typescript can't handle setting the built-in method #571

Open
onilton opened this issue Sep 17, 2020 · 1 comment · May be fixed by #572
Open

generateUniqueIdentifier type in Typescript can't handle setting the built-in method #571

onilton opened this issue Sep 17, 2020 · 1 comment · May be fixed by #572

Comments

@onilton
Copy link

onilton commented Sep 17, 2020

...
    generateUniqueIdentifier: ((file: File, event: Event) => {
        var relativePath = file.webkitRelativePath||file.fileName||file.name; // Some confusion in different versions of Firefox
        var size = file.size;
        return(size + '-' + relativePath.replace(/[^0-9a-zA-Z_-]/img, ''));
      }) as () => string,
...

Returns:

Type '(file: File, event: Event) => string' is not assignable to type '() => string'.ts(2322)

This happens because:

  generateUniqueIdentifier?: () => string;

Also, File type won't handle the attributes webkitRelativePath file.relativePath or file.fileName

@onilton
Copy link
Author

onilton commented Sep 17, 2020

Possibly related #542

@onilton onilton linked a pull request Sep 17, 2020 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant