Why typescript type inference is behaving like this? - Theo's Typesafe Cult