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

Contacts, photos property doesn't work with null value #737

Closed
cfjedimaster opened this issue Oct 21, 2016 · 10 comments
Closed

Contacts, photos property doesn't work with null value #737

cfjedimaster opened this issue Oct 21, 2016 · 10 comments

Comments

@cfjedimaster
Copy link

Given a contact instance, I'm not allowed to set the photos property to a new array to work with a contact that has no photos. So this,

        contact.photos = new Array();

doesn't validate in TypeScript. @mhartington thinks it may be an issue in the TS definition fie.

@cfjedimaster
Copy link
Author

A bit more info - basically the issue is that the TS file knows it is an array, but doesn't accept that it may be null too.

@cfjedimaster
Copy link
Author

So I removed readonly on the photos prop from the TS file and was able to get stuff working. :)

@keithdmoore
Copy link
Contributor

You can't just set it to '[]' ?

@cfjedimaster
Copy link
Author

Nope. You get an error. That goes away when readonly is removed.

@ihadeed
Copy link
Collaborator

ihadeed commented Oct 22, 2016

This should be fixed by #635

@cfjedimaster
Copy link
Author

Thanks. Any idea when this PR will get pulled in?

@ihadeed
Copy link
Collaborator

ihadeed commented Oct 22, 2016

@cfjedimaster The next goal is 2.2.5 with some bug fixes, then I will merge that PR along with #422 and publish 2.3.0. So it shouldn't take long.

@cfjedimaster
Copy link
Author

Ok, do you mind a dumb question? My code is doing this when a contact has no photos:

          var f = new ContactField('base64',s,true);

          contact.photos = [];
          contact.photos.push(f);

Will that work - specifically setting it to an empty array? I mean it works now with my hack (removing readonly), but your proper fix is a bit different.

@ihadeed
Copy link
Collaborator

ihadeed commented Dec 4, 2016

@cfjedimaster Should be fixed now! Please update to v2.2.10 and let me know if you're still having any issues.

@ihadeed ihadeed closed this as completed Dec 4, 2016
@cfjedimaster
Copy link
Author

Thanks!

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