- Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
Steps
use TS 3.3 (latest)
enable all strict checks
have code such as this:
interface Props { foo?: { bar: string; baz: string; } } function hello({foo}: Props) { const isFooPresent = foo !== undefined; let bar = isFooPresent ? foo.bar : ''; // Object is possibly 'undefined'. let baz = isFooPresent ? foo.baz : ''; // Object is possibly 'undefined'. // but follow code is safe. // let bar = foo !== undefined ? foo.bar : ''; // let baz = foo !== undefined ? foo.baz : ''; }
Using a const variable to store check result, an error when occur.
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created