Reputation: 2550
I'm trying to cast a File as a Blob but apparently I can't even File being a subclass of Blob.
I've tried it like this: <Blob>file
and this: file as Blob
.
And the error is always the same:
Type 'File' cannot be converted to type 'Blob'. Property 'size' is missing in type 'File'.
What am I doing wrong?
Upvotes: 2
Views: 7769
Reputation: 31863
The following displays no errors at all.
declare const file: File;
const blob = file as Blob;
Make sure your TypeScript version is up to date (2.3.2 is the latest as of this writing)
You can see this in action in the TypeScript Playground
Upvotes: 7