You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is there a better way to express this, without explicitly listing out every member of the interface?
interfaceFoo{a: string}// okclassBarimplementsFoo{constructor(publica: string){}}// Error: Class 'Baz' incorrectly implements interface 'Foo'.// Property 'a' is missing in type 'Baz'classBazimplementsFoo{constructor(a: Foo){Object.assign(this,a)}}
is there a better way to express this, without explicitly listing out every member of the interface?
demo: http://www.typescriptlang.org/Playground#src=interface%20Foo%20%7B%0A%09a%3A%20string%0A%7D%0A%0A%2F%2F%20ok%0Aclass%20Bar%20implements%20Foo%20%7B%0A%09constructor%20(public%20a%3A%20string)%20%7B%7D%0A%7D%0A%0A%2F%2F%20Error%3A%20Class%20'Baz'%20incorrectly%20implements%20interface%20'Foo'.%0A%2F%2F%20%20%20%20%20%20%20%20Property%20'a'%20is%20missing%20in%20type%20'Baz'%0Aclass%20Baz%20implements%20Foo%20%7B%0A%09constructor%20(a%3A%20Foo)%20%7B%0A%09%09Object.assign(this%2C%20a)%0A%09%7D%0A%7D
The text was updated successfully, but these errors were encountered: