Why the infered type of this function is `string | undefined`? - Theo's Typesafe Cult