3 ms·
> The OR doesn't indicate | in TypeScript, it indicates the result of the possible future type guard. Are you implying in your other comment (that HN won't let
by schwartzworld 4y ago
> The OR doesn't indicate | in TypeScript, it indicates the result of the possible future type guard.
Are you implying in your other comment (that HN won't let me reply to) that Typescript has an "OR" operator that is distinct from "|"? Can you link to documentation on that?
- HeavyFeather 4y ago"OR" was just my (bad) way to explain it. In plain English: if isInteger(x) is true, x is definitely a `number` if isInteger(x) is false, x is unknown/unaltered (it remains `typeof x`) Current type guards can't express "yes versus maybe", so isInteger cannot be a type guard at all.