MergedObject
is a container that can store multiple MyClass
instances as key-value pairs, where the key represents the variable name (e.g. Obj1
) and the value is the corresponding MyClass
instance. How can I define a type annotation for MergedObject
?
class MyClass {
a: string;
constructor(a: string) {
this.a = a
}
}
const Obj1 = new MyClass('one')
const Obj2 = new MyClass('two')
const MergedObject = {
Obj1,
Obj2
}