typescript instantiate generic type

Developer from somewhere

function buildObject<T>(type: { new(): T } ): T {
  return new type();
}