在TypeScript中,图像的类型是什么? [英] In TypeScript, What is the type of Image?

查看:925
本文介绍了在TypeScript中,图像的类型是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要声明一个还将包含图像的接口.我需要给它什么类型.

I'm declaring an interface which will contains image also. What type do i need to give to it.

export interface AdInterface {
    email: string;
    mobile: number;
    image?:   ??
}

推荐答案

如果您的图片属性包含...

If your image property contains ...

用作图片的 <img> 元素

image?: HTMLImageElement


图片的网址.

image?: String


来自文件的图像 <input> 元素


Image as file from <input> element

image?: File

这篇关于在TypeScript中,图像的类型是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆