wrapping a generic function in typescript - Theo's Typesafe Cult