Search code examples
typescriptimageinterface

In TypeScript, What is the type of 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?:   ??
}

Solution

  • 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