I have the following classes
class Foo {}
class A extends Foo {}
class B extends Foo {}
Now, I am looking to create an interface with a property named type
that should be of type class rather than an instance of a class.
interface Bar {
type : typeof XXXX; // Unsure about what to fill in here
value : string;
}
By doing this, I can instantiate the interface as follows
const x: Bar = {
type : Foo, // or any of its subclasses like A or B
value : 'test',
}
I specifically want a reference to the class Foo
, and not an instance of it. Therefore, something like this
{
type : new Foo(),
value : "test"
}
should not be considered valid.
I hope I have explained my issue clearly.