Use control flow analysis for type guards · Issue #2388 · Microsoft/TypeScript

TS 1.4 Type guard fails to narrow the union type when returning early. function foo(x: number | string) { if (typeof x === 'string') { return; } // x should now be a number ...