primevue icon indicating copy to clipboard operation
primevue copied to clipboard

FileUpload: Property 'objectURL' does not exist on type File ts(2339)

Open frederikheld opened this issue 1 year ago • 1 comments

Describe the bug

The official StackBlitz example for using FileUpload with a preview image in the #template slot uses file.objectURL as src for the img element.

If I use the same code with TypeScript, I get "Property 'objectURL' does not exist on type File ts(2339)"

What can I do about this? Is the type missing or is this just working by accident in JS?

Reproducer

https://stackblitz.com/edit/fv6yvr?file=src%2FApp.vue

PrimeVue version

3.48.1

Vue version

3.x

Language

TypeScript

Build / Runtime

TypeScript

Browser(s)

No response

Steps to reproduce the behavior

Can't reproduce in the PrimeVue TypeScript Issue Template as StackBlitz does not show such errors.

VSCode shows the error as curly red line with the explanation in the popup. Probably a missing type declaration in File.

Expected behavior

No response

frederikheld avatar Feb 18 '24 00:02 frederikheld

I just came across the same issue and found this bug report - by me. Lol :-D

The built-in type File indeed does not have a property objectURL: https://developer.mozilla.org/en-US/docs/Web/API/File

Is it some PrimeVue-internal type File that should be used here?

frederikheld avatar Feb 19 '24 10:02 frederikheld