WIA.Vector via Enumerator returns something which is not a number

When accessing the members of the WIA Vector object directly using the Vector's Item property, or using the default property, they are seen by JScript as numbers:

var v = new ActiveXObject('WIA.Vector');
v.SetFromString('This is a test', true, false);
for (var i = 1; i<= v.Count; i+=1) {

However, if I use an Enumerator to iterate through the Vector:

var enumerator = new Enumerator(v);
while (!enumerator.atEnd()) {

I get the following error:

enumerator.item() is not a number

typeof returns unknown:

WScript.Echo(typeof enumerator.item());

Presumably it's some sort of Automation type (as in this question) that only appears as a number, which is why typeof returns unknown.

How can I coerce this value to a "real" Javascript number?


The following code in VBA:

Dim v As New Vector, item As Variant
v.SetFromString "This is a test", True, False
For Each item In v
    Debug.Print TypeName(item)



So the question can be narrowed down to the Byte specific Automation type.