It seems that your example is almost correct, except for the fact that T should indicate an extension of HTMLElement, and then you must cast HTMLElement to type T within the constructor.
// cast T as type HTMLElement
class Elem<T extends HTMLElement> {
public element: T;
constructor(typeElement: string) {
// had to cast HTMLElement to type T....
// odd because T extends HTMLElement, but it works
this.element = <T>document.createElement(typeElement);
}
}
var e = new Elem('div');
e.element.innerHTML = 'generic class test';
document.body.appendChild(e.element);
You can witness its functionality in the playground