TypeScript Version: 3.8.3
Search Terms: Boolean type narrowing
Code
constx: {test: string}|null|undefined=something()// this worksif(!!x){console.log(x.test)}// this can not workif(Boolean(x)){console.log(x.test)}Expected behavior:
Expression inside the second if statement should work.
Actual behavior:
The second if statement gives the following error:
TS2533: Object is possibly 'null' or 'undefined'.
Related Issues: None
TypeScript Version: 3.8.3
Search Terms: Boolean type narrowing
Code
Expected behavior:
Expression inside the second if statement should work.
Actual behavior:
The second if statement gives the following error:
Related Issues: None