Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected union of types in Contacts.ts - listContacts() #16

Open
ropinheiro opened this issue Aug 24, 2020 · 4 comments
Open

Expected union of types in Contacts.ts - listContacts() #16

ropinheiro opened this issue Aug 24, 2020 · 4 comments

Comments

@ropinheiro
Copy link

ropinheiro commented Aug 24, 2020

In Contacts.ts, in the body of the listContacts() function, line 51 has:

(inError: Error, inDocs: IContact[]) => { ...

This gives me an error, because this.db.find seems to expect the inError to be a union of Error and null.

For the error to disappear, I had to change my code to this:

(inError: Error | null, inDocs: IContact[]) => { ...

@ropinheiro
Copy link
Author

A similar problem occurs in the same file, for the deleteContact() function.

@jrepko
Copy link

jrepko commented Oct 29, 2020

this seems to fix #22 and #23 for me. i was having the same issues building on the cli on a mac

@FarzanKh
Copy link

FarzanKh commented Nov 6, 2020

Thank you

@FarzanKh
Copy link

FarzanKh commented Nov 7, 2020

Do you guys get these errors for addContact and deleteContact too?
And it seems just adding | null doesn't fix the issue.
https://ibb.co/8YMdTDk
https://ibb.co/1ZhYXfz
https://ibb.co/0yp6znX
https://ibb.co/BPWnhxC

Is your Typescript version same as mine?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants