I'm trying to use classes as input values to a registry method where the return value is a cached instance of that instance. However I do not find a way to make this type safe.
What I want is something like this:
class MyRegistry { getInstance<T, C extends Class<T>>(cls: C): T;}let x: MyThing = registry.getInstance(MyThing);
Is there a way to make this work? I'm aware there are ways to type out newables but I cannot find a way to make the return value concrete.