'Typescript: Using nested generic class type

I am trying to use a nested class type generic. Let's say I have the following code:

class Base {
  property: string|undefined;
} 

class A extends Base {
  aProperty: string | undefined;
}

class B extends Base {
  aProperty: string | undefined;
}

function createFunc<T extends Base>(c: new () => T): T {
  return new c();
}

class GenericClass<T extends Base> {
  constructor() {
    // This doesn't work. But why?
    const typeProperty = createFunc(T);
  }
}
// This works however. Not using the nested generic
createFunc(Base)

Typescript Playground example

Does anyone know why this doesn't work? Is this a bug or intended behaviour and what would be a workaround?

I read about it here but it doesn't really explain why this shouldn't work. https://www.typescriptlang.org/docs/handbook/2/generics.html#using-class-types-in-generics



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source