I would like to define a literal object that implements an interface. So I wrote something like this
interface MyInterface {
update: () => void;
}
class MyClass {
a: MyInterface = {
update: function(){},
func2: function(){}
}
}
But this gives me an error that type of a is not assignable to MyInterface.
Is there a way how to say a only implements the interface?