Reputation: 185
interface A {
(obj? : any) : any;
func1() : void;
func2() :void;
}
How do I write a class B that would implement A? How would I implement the parametrized constructor?
Upvotes: 2
Views: 70
Reputation: 844
An interface cannot, by definition, contain a constructor. You have to move it in your implemented class :
interface A {
func1(): void;
func2(): void;
}
class B implements A {
constructor(obj? : any) {
}
func1() {
}
func2() {
}
}
Upvotes: 1