Contacts.find(["*"]) not found

Update the Cordova and ionic libraries and the contacts.find (["*"]) method stopped working. I have tried some forms but I have not obtained anything. help

An apology, I already solved it!

Contacts.find([‘displayName’])

https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-contacts/

Does this still work for you?

Having Contacts.find(["*"]) used to work before I update to RC 4.
Now I get the error

Argument of type 'string[]' is not assignable to parameter of type 'ContactFieldType[]'

I can see that I need to provide an array of ContactFieldTypes but I don’t have any idea of how to use it.
This is the declaration of ContentFieldType

declare type ContactFieldType = 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
1 Like

You can declare ContactFieldType like this.

let fields:ContactFieldType[] = ['addresses', 'birthday', 'categories', 'country', 'department', 'displayName', 'emails', 'familyName', 'formatted', 'givenName', 'honorificPrefix', 'honorificSuffix', 'id', 'ims', 'locality', 'middleName', 'name', 'nickname', 'note', 'organizations', 'phoneNumbers', 'photos', 'postalCode', 'region', 'streetAddress', 'title', 'urls'];

1 Like