What do you mean param Mixed?

What does this mixed option? what value a function can take isBelow?
the picture with the code
June 8th 19 at 17:19
1 answer
June 8th 19 at 17:21
Solution
The mixed type, i.e. it can accept a string and a number and array.
here's a picture - karley.Abshi commented on June 8th 19 at 17:30
,
For such an example?
if (typeof x === 'string') - Austen.Thompson53 commented on June 8th 19 at 17:33
no. you need to test just compare strings - karley.Abshi commented on June 8th 19 at 17:36
in what sense? - Austen.Thompson53 commented on June 8th 19 at 17:39
it gives me such validation isBelow waits for either a number or date. and I'm passing a string - karley.Abshi commented on June 8th 19 at 17:24
you have no example with check on line? - karley.Abshi commented on June 8th 19 at 17:27
well see how the above said mixed can take and string.
it turns out I can pass in isBelow strings and compare them - karley.Abshi commented on June 8th 19 at 17:42
and what's the problem?
if ( a === b) ... - Austen.Thompson53 commented on June 8th 19 at 17:45
and where you have a function isBelow? - karley.Abshi commented on June 8th 19 at 17:48
you asked the question "What do you mean param Mixed?". You gave the answer to this question.

Now you want someone done for you homework?
https://www.youtube.com/watch?v=-2F_x752Wx4 - Austen.Thompson53 commented on June 8th 19 at 17:51
why? I have homework to decide not necessary. I showed what is written in the documentation, and what error. I ask maybe someone worked with this function and knows the problem. You worked on? If Yes, tell me were you in your tests to pass to the function isBelow the line. - karley.Abshi commented on June 8th 19 at 17:54
supposedly do you want me to create a new question?))) supposedly it does. Yes, funny)) - karley.Abshi commented on June 8th 19 at 17:57
, bro, of course you put some kind of picture, but I'm not going to rewrite the code, sorry.
Initially I even open it would not, though I confess I could not resist and looked. Although to answer the question "What do you mean param Mixed?" is not required. And he already gave the answer. And correct. - Austen.Thompson53 commented on June 8th 19 at 18:00
if you are expecting a mixed type - you also need to check what type was passed to the function, right? otherwise you would be able to work? These checks are performed "manually" inside the function to check for all existing types also makes no sense, if you expect such as in your case: only 2 options for "number" or "date".
That's why you and error.
Add in there to, and the string passed, or convert to a number or date or change the mixed
function isBelow(data: string | number | date) {
//...
}

Wasn't it clear from the outset? - Leda15 commented on June 8th 19 at 18:03
here read
https://flow.org/en/docs/types/mixed/
https://flow.org/en/docs/lang/refinements/ - Leda15 commented on June 8th 19 at 18:06
well according to the documentation it is not clear that you can pass there and what's not.

if you expect a mixed type - you also need to check what type was passed to the function, right? otherwise you would be able to work? These checks are performed "manually" inside the function to check for all existing types also makes no sense, if you expect such as in your case: only 2 options for "number" or "date

Check does the developer of this library.
And throws me an error this function isBelow supposedly what she was expecting either a number or date. but this throw is not a lot of code, and code developer.
If I was a developer for such documentation I would have written as you say isBelow(data: number | date).
removed string. she doesn't accept string.

Add in there to, and the string passed, or convert to a number or date or change the mixed

Well in that case you will have to climb into someone else's code. not a very good practice.

Wasn't it clear from the outset?

Documentation mixed with not very clear what can be transferred and what is not.
Here's how to JSDoc

And the screenshot I sent with this expected during the operation of the code. but from the documentation.
I hope you understand me)) - karley.Abshi commented on June 8th 19 at 18:09
,
Well in that case you will have to climb into someone else's code. not a very good practice.

she did not worry, I always do. tembolee if that - to return back with Ctrl+Z )))
otherwise, why then was this question to create?)) - Leda15 commented on June 8th 19 at 18:12

Find more questions by tags JavaScript