I'm using Vue 2 and Typescript and I've declared a type in my types.ts file:
export type SetupSliderType = {
name: SetupSliderEnum;
image: HTMLImageElement;
title: keyof I18nMessages;
component: Function;
}
This gives me no errors.
In my RegisterSetup.tsx file I've declared an Array of that type:
private slides: Array<SetupSliderType> = [
{
name: SetupSliderEnum.solutions,
image: <img src={solutions_logo}/>,
title: I18nMessages['account.register.side.subheading'],
component: this.renderSlideSolutions
},
]
The 'image' line in my Array block gives me this error:
Type 'VNode' is missing the following properties from type 'HTMLImageElement': align, alt, border, complete, and 309 more.ts(2740)
types.ts(13, 3): The expected type comes from property 'image' which is declared here on type 'SetupSliderType'
What is the right way to use the <img> element for this syntax or what am I doing wrong?
enum, it's just a type (more specifically, it's a type alias for an object type). You might want to rename thesteps.enum.tsfile (or move the type elsewhere).enumfile it was in mytypes.tsfile and I got mixed up because I also made anenumfile for it that's irrelevant to the question, so I just edited it, my bad. Thanks!