Typescript Determining type of generic. - Theo's Typesafe Cult