morenoh149 / react-native-contacts

React Native Contacts
MIT License
1.64k stars 560 forks source link

Typescript addContact definition seems incorrect #660

Closed mortocks closed 2 years ago

mortocks commented 2 years ago

Current addContact definition is

export function addContact(contact: Contact): Promise<void>;

however the following example returns the created contact when the promise resolves

const newPerson:Contact = {
  givenNames: 'Foo'
  ...
}

Contacts.addContact(newPerson).then((contact) => {
  console.log('contact', contact); // Logs the new record that was created
});

so my understanding is that the type definition should be

export function addContact(contact: Contact): Promise<Contact>;

(see getContactById definition for what I think is a correct example)

morenoh149 commented 2 years ago

feel free to improve the package.

github-actions[bot] commented 2 years ago

This issue is stale, please provide more information about the status