Why the need to redefine properties when implementing an interface in TypeScript?
问题 I'm getting into classes and interfaces. And I got one thing about it that annoys me, this is the first time I work with these kind of things so bear with me here.. Let's say I got this interface: // IFoo.d.ts export default interface IFoo { foo: string; bar: number; } When I implement it in a class I do the following: // FooModel.ts import IFoo from './IFoo'; export default class FooModel implements IFoo { foo: string; bar: number; constructor({ foo, bar }: IFoo = { foo: 'hello', bar: 1 }) {