Cannot call `this.state.quantities.flatMap` because property `flatMap` is missing in `Array` - flowtype

I'm using Array.prototype.flatMap, and it's working, but Flow is complaining:
Cannot call `this.state.quantities.flatMap` because property `flatMap` is missing in `Array`.```
Huh??? How do I fix this?

Array.prototype.flatMap was added to Flow in version 0.103.0. You'll need to update to that version or a newer one before you can typecheck flatMap.

Related

hibernate 5.4.2 UnwrapValidatedValue automatic

we upgraded from HV 4.x to HV 5.4.2 and now when we have interface like following
#NotNull
List<AccountInfo> getMultiClientAccountBalances(#NotNull ClientContext clientContext, #NotNull Optional<AccountFilter> accountFilter);
I'm getting error:
javax.validation.UnexpectedTypeException: HV000186: The constraint of type 'javax.validation.constraints.NotNull' defined on 'getMultiClientAccountBalances.arg1' has multiple matching constraint validators which is due to an additional value handler of type 'org.hibernate.validator.internal.engine.valuehandling.OptionalValueUnwrapper'. It is unclear which value needs validating. Clarify configuration via #UnwrapValidatedValue.
I know it can be fixed by adding #UnwrapValidatedValue to the field, but this must be added to every method what is a lot of work for me. Is there any simpler solution (besides upgrade to HV6.x)
Unfortunately I don't see how we could change this behavior in 5.4 without breaking other use cases.
And there is no easy way to disable the optional value handler as it's added unconditionally.
So I would say you have two solutions:
a search and replace of all #Constraint Optional to add the UnwrapValidatedValue option
or move to HV 6, where we totally reworked this feature and where, I think, it should work as you expect it. I know you didn't want this answer but it is what it is...
The issue with 1. is that we removed this annotation from HV (it was experimental) in favor of a standard feature included in Bean Validation so you will have to remove it when moving to 6.
I don't know your exact environment but HV 6 is highly compatible with the previous versions so it might work very well. Just be careful about the dependencies as we changed the groupId of the artifact from org.hibernate to org.hibernate.validator. Also be aware that you need to update the validation-api from 1.1 to 2.0.
6 is already very stable and if you have any issues with it, we will fix them right away.

#JMS\Exclude only if a property is empty

I am using JMS\Serializer in my project and I want to ignore one property only if the array in it is empty.
I tried something like :
#JMS\Exclude(if="count('$this->required') === 0")
or
#JMS\Exclude(if="empty('required')")
but got a syntax error.
Can anyone help me on this?
thank.
What you need was implemented recently and it is in release-1.7 so you might as well wait for it. It is called #SkipWhenEmpty
#SkipWhenEmpty This annotation can be defined on a property to
indicate that the property should not be serialized if the result will
be "empty".
This is the bug related it.
You need this one:
#JMS\Exclude(if="!object.required")

What is the RKUIManager?

I get an error with RKUIManager, or more precisely:
Could not invoke RKUIManager.manageChildren
It appears for example when I'm using firebase with React Native and try to set a reference in the constructor of a component with a prop. For ex:
messagesRef = FBRef.child("Messages").child(this.props.currentMeetingID)
If I change it to the following it works, and yes, I have checked if this.props.currentMeetingID is a legitimate value.
messagesRef = FBRef.child("Messages").child("123456789")
I can't seem to locate the problem nor reproduce it perfectly. I'm just trying to figure out if it's my machine or some kind of bug elsewhere.
Right now I'm just looking for info about what RKUIManager actually is.
If I nullcheck this.props.currentMeetingID I fix it, easy fix but nowhere to be found on the internet so I'll leave it here for anyone passing by. Probably me in a couple of weeks...

RobolectricGradleTestRunner vs RobolectricTestRunner.class

In roboelectric when you write your test class you have declare the #RunWith annotation of which there is RobolectricGradleTestRunner and RobolectricTestRunner.class. What is the difference and which one should we use ? Why is there 2 in the first place. If I use RobolectricTestRunner then it does not work for me it says some weird error like :
"java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity."
However this seems to go away if I use RobolectricGradleTestRunner.
RobolectricTestRunner was first and is for maven based projects.
RobolectricGradleTestRunner was for gradle based projects because some paths have changed.
Since robolectric 3.1.1 this is not more necessary and is now deprecated.
For more details see also http://robolectric.org/getting-started/

Can't access PFObject as dictionary

I am starting to use Parse and in the documentation it has examples to use the PFObject as an NSDitionary like this:
// Create the post
PFObject *myPost = [PFObject objectWithClassName:#"Post"];
myPost[#"title"] = #"I'm Hungry";
but i am getting a compiler error:
"Expected method to write dictionary element not found on object of type "PFObject"
But if I access the myPost PFObject like this, it works:
[myPost setObject:#"I'm Hungry" forKey:#"title"];
What is the problem?
I though that PFObject could be accesses as a dictionary?
thanks
I would check that you are using the latest version of the Parse SDK. This is new functionality and my guess is you haven't downloaded the SDK since this feature was introduced.
when i try your code at my side it gives me success message. I think you are using old parse library.
Thanks.
Downloading latest XCode should help. Subscript syntax is available from Xcode 4.4+

Resources