question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

got 'Property is always "undefined"' when it's not always "undefined"

See original GitHub issue
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"

}

try

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
trusktrcommented, Nov 11, 2020

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.

2reactions
trusktrcommented, Nov 8, 2020

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular ngOnInit the object property is always undefined ...
I have an angular project and currently I am trying to set a reactive form values on ngOnInit method. I get the data...
Read more >
7 Tips to Handle undefined in JavaScript - Dmitri Pavlutin
The short answer is that JavaScript interpreter returns undefined when accessing a variable or object property that is not yet initialized.
Read more >
undefined - JavaScript - MDN Web Docs - Mozilla
The global undefined property represents the primitive value undefined. It is one of JavaScript's primitive types.
Read more >
JavaScript undefined
The undefined is a primitive type that has a single value undefined . · Accessing an uninitialized variable returns undefined . · Accessing...
Read more >
Documentation - TypeScript 2.0
In strict null checking mode, the null and undefined values are not in the domain of every type and are only assignable to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found