我正在尝试将 File 转换为 Blob,但显然我什至不能将 File 作为 Blob 的子类。
我试过这样:<Blob>file和这个:file as Blob。错误总是一样的:
Type 'File' cannot be converted to type 'Blob'. Property 'size' is missing in type 'File'.
我究竟做错了什么?
以下显示根本没有错误。
declare const file: File;
const blob = file as Blob;
Run Code Online (Sandbox Code Playgroud)
确保您的 TypeScript 版本是最新的(2.3.2 是撰写本文时的最新版本)
你可以在 TypeScript Playground 中看到这个
| 归档时间: |
|
| 查看次数: |
6049 次 |
| 最近记录: |