got 'Property is always "undefined"' when it's not always "undefined"
type AA = {
a:? number,
b:? number,
c:? string,
}
const a: AA = {};
if(a.a !== undefined && a.b !== undefined && a.c !== undefined) {// error: Property is always "undefined"
}
Found a temporary solution. It doesn't fix the bug though. You can wrap the first condition in parentheses.
type AA = {
a:? number,
b:? number,
c:? string,
}
const a: AA = {};
if((a.a !== undefined && a.b !== undefined) && a.c !== undefined) {
}
This is better than ignoring bug with // @hegel-issue comment.
That's interesting (and sorry, off topic), the syntax c:? string, doesn't seem to be compatible with TS (not sure if that's a goal). In TS it is c?: string, (example).
@trusktr it's flow's syntax...
Do you guys like Flow better than TypeScript? (Just curious)
TypeScript seems to have higher usage, so if Hegel syntax is more aligned with TS, then easier for people to migrate to and adopt Hegel.
Oh, just fixed it, so it will work in the new Hegel version.