1

I am using a vue-select plugin and render function is used to create custom buttons for it. Documentation: https://vue-select.org/guide/components.html#deselect

I am using class based components with TypeScript enabled and I want to render those two elements.

Currently I use them like this:

Deselect: object = {
    render: (createElement: any) => createElement('i', { attrs: { class: 'ri-close-line' } }),
}

OpenIndicator: object = {
    render: (createElement: any) => createElement('i', { class: { 'ri-arrow-down-s-line': true } })
}

It is working fine but I don't want to use "any" types. What type is createElement?

Boussadjra Brahim
  • 82,684
  • 19
  • 144
  • 164
The50
  • 1,096
  • 2
  • 23
  • 47

1 Answers1

2

The right type is CreateElement imported from vue :

import  { CreateElement } from 'vue'


Deselect: object = {
    render: (createElement: CreateElement ) => createElement('i', { attrs: { class: 'ri-close-line' } }),
}

OpenIndicator: object = {
    render: (createElement: CreateElement ) => createElement('i', { class: { 'ri-arrow-down-s-line': true } })
}
Boussadjra Brahim
  • 82,684
  • 19
  • 144
  • 164