Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.4.1
Description
When using arrays in JS, there's an irritating mixup about "what the array is". While it seems to be an JS array and the code works, the compiler talks about QVariantList, where the given method is not available.
Example:
function xyz() { const d = [1, 2, 3, 4, 5] const contained = d.includes(3) console.log(d, contained) } Component.onCompleted: { win.xyz() }
gets into
Warning: main.qml:12:29: Type is a list. You cannot access "includes" from here. const contained = d.includes(3) ^^^^^^^^ Error: main.qml:12:29: Could not compile function xyz: Type QVariantList of QVariantList does not have a property includes for calling const contained = d.includes(3) ^^^^^^^^
.
Maybe related to QTBUG-109204.