Forbes Lindesay
1 min readFeb 6, 2017

--

Thanks for spotting this, it would be an error. I meant the exact reverse. It’s now updated:

  • Passing a nullable string to something that expects a string => clearly an error
  • Passing a string to something that expects a nullable string => normally fine

Flow handles this fine for parameters:

acceptsString('foo');
function acceptsString(str: string) {
acceptsNullableString(str);
}
function acceptsNullableString(str: ?string) {
}

Flow handles this without any problems, and it works fine at runtime, but when it’s the property of an object, things are different (as I try and explain in the article).

Thanks for the correction.

--

--

Forbes Lindesay
Forbes Lindesay

Written by Forbes Lindesay

JavaScript enthusiast and maintainer of many open source projects.

Responses (1)