-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript
Description
TypeScript Version: 2.1.1
Code
interface StdoutValue {
stdout: string;
stderr?: undefined;
}
interface StderrValue {
stdout?: undefined;
stderr: string;
}
type StreamValue = StdoutValue | StderrValue;
const stream: Array<StreamValue> = [
{ stdout: 'foo' },
{ stderr: 'bar' }
];
console.log(stream.map(value => value.stderr === undefined ? value.stdout.toUpperCase() : value.stderr.toUpperCase()));
Expected behavior:
No error with strict null checks.
Actual behavior:
Thinks value.stdout
could be undefined
on last line, but this is not possible.
Metadata
Metadata
Assignees
Labels
CommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript