-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
The following code
'use strict';
// @flow
function sayHi(info: { name?: string }) {
return `Hi ${info.name ? info.name : ''}!`;
}
sayHi({});
sayHi({ name: 'foo' });
with the following configuration
[ignore]
[include]
[libs]
[lints]
all=warn
[options]
include_warnings=true
gives me the following warning with Flow v0.52.0:
» flow
Warning: index.js:6
6: return `Hi ${info.name ? info.name : ''}!`;
^^^^^^^^^ sketchy-null-string: Sketchy null check on string value. Perhaps you meant to check for null instead of for existence?
6: return `Hi ${info.name ? info.name : ''}!`;
^^^^^^^^^ Potentially null/undefined value.
6: return `Hi ${info.name ? info.name : ''}!`;
^^^^^^^^^ Potentially "" value.
Found 1 warning
Am I missing something? Flow seems to be confusing maybe type and optional property here doesn't it?