flowtypenon-nullable

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.


Solution

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