-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
TypeScript Version: 2.4.1-dev.20191120 (nightly)
TS2532
Object is possibly undefined
Narrow
Code
interface Version {
createdAt: string
}
const stuff = (version?: Version, createdAt?: string) => {
if (!(createdAt || version)) {
return null;
}
return createdAt || version.createdAt;
};Expected behavior:
version should be narrowed as defined.
Actual behavior:
version still considered possibly undefined.
(parameter) version: Version | undefined
Object is possibly 'undefined'.(2532)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed