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?

1

1 Answer 1

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 } })
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.