You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know I am not supposed to use values of void, because one day they might be banned. But for time being I don't understand is it by design or by mistake that the isVoid guard works whereas isNonVoid doesn't in the example below:
functionisVoid<a>(value: void|a): value is void{returnundefined;}functionisNonVoid<a>(value: void|a) : value is a{returnundefined;}functionfoo<a>(value: void|a): void{if(isVoid(value)){// value is void}else{// value is a}}functionbaz<a>(value: void|a): void{if(isNonVoid(value)){// value is void | a}else{// value is {}}}
How come that seemingly identical guard implementation breaks apart entirely?