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?: ??
}
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 ...
Image used as <img>
element
image?: HTMLImageElement
URL to image.
image?: String
Image as file from <input>
element
image?: File
Most image when imported into server-side TypeScript are strings.
For example trying to reference File
or HTMLImageElement
on an imported image you will get this error:
TS2322: Type 'string' is not assignable to type 'HTMLImageElement'.
I recommend just using string. If you are having an import error for PNG images in TypeScript then take a look here.