En esta página

No utilizar «void» en expresiones

qmllint denomina esta categoría de advertencia « [void] ».

No utilices expresiones «void»

¿Qué ha pasado?

Se ha utilizado una expresión «void» en JavaScript.

¿Por qué es incorrecto?

La expresión «void» se ha vuelto en gran medida redundante y puede oscurecer la lógica de parte del código al suprimir los valores devueltos. Además, está prohibida en muchos estilos de código por no ser clara y dificultar la lectura.

Ejemplo

import QtQuick

Item {
    function undef() {
        return void 0
    }

    function f() {
        return void someFunction()
    }
}

Para solucionar esta advertencia, elimina o sustituye el uso de «void»:

import QtQuick

Item {
    function undef() {
        return undefined
    }

    function f() {
        somefunction()
    }
}

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.