I'm a fan of Open Source and have a growing interest in serverless and edge computing. I'm not a big fan of spiders, but they're doing good work eating bugs. I also stream on Twitch.
The way that I interpreted this example from their homepage is that the type checker is assuming that n should be a Number since the function uses n * n which is fair, but then the function is called with the String and it says the error is in the function and I believe that the function definition should take precedence on which type is "right".
I'm a fan of Open Source and have a growing interest in serverless and edge computing. I'm not a big fan of spiders, but they're doing good work eating bugs. I also stream on Twitch.
I haven't used Flow, but I'm not following your comment. Do you mean that the coerced value
2
from"2"
should pass here?The way that I interpreted this example from their homepage is that the type checker is assuming that
n
should be aNumber
since the function usesn * n
which is fair, but then the function is called with theString
and it says the error is in the function and I believe that the function definition should take precedence on which type is "right".Maybe it's not clear on their site., The function definition takes precedence like you thought it should.
Here's the example on their site:
What they're showing here is that the type checker won't allow you to call the function with a string.