How to convert a JavaScript string[] to Windows.Foundation.Collection.IIterable<string>?

44 views Asked by At

I'm working on a React Native Windows project, and am using the projected findAllDevicesAsync() method in Windows.Devices.Enumeration namespace. An overload of the function accepts an IIterable as an additional property, which I want to provide.

I have an array of properties defined in TypeScript:

const propertyKeys: string[] = [
    HOSTNAME_PROPERTY,
    SERVICENAME_PROPERTY,
    INSTANCENAME_PROPERTY,
    IPADDRESS_PROPERTY,
    PORTNUMBER_PROPERTY,
    TEXTATTRIBUTES_PROPERTY
    ];

When I pass this to the projected findAllAsync() method, I get the following error:

Argument of type 'string[]' is not assignable to parameter of type 'IIterable<string>'.
Property 'first' is missing in type 'string[]' but required in type 'IIterable<string>'

Docs for FindAllDevicesAPI

0

There are 0 answers