Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Non-null and non-undefined type in Flow

Flow defines so called "Maybe types". I.e. ?string is similar to string | null | void (void is a type of value undefined).

Is there something like general type that can be of any value but null and undefined? Basically something like $Diff<$Diff<any, null>, void> if $Diff operator was able to operate on non-object types.

like image 830
czerny Avatar asked Mar 11 '23 06:03

czerny


1 Answers

There is no some "magic" type for this, but something like this should work: string | number | boolean | {} | []

like image 172
vkurchatkin Avatar answered Apr 01 '23 00:04

vkurchatkin