[Vuejs]-Using Vue.js img element in Typescript Array

1👍

When you use JSX/TSX to create an element, you’re not creating a DOM element, you’re creating an object that will be used by Vue.js (or React or similar) later to create or update a DOM element. As the error message is telling you, the type of object in your case is VNode, so you’d use VNode instead of HTMLInputElement in your type:

export type SetupSliderType = {
    name: SetupSliderEnum;
    image: VNode; // <================
    title: keyof I18nMessages;
    component: Function;
}

If you actually wanted to create an HTMLInputElement, you could do that via document.createElement, but it would be very unusual when using a library like Vue.js or React or similar.

Leave a comment