I am struggling with a situation involving the SampleData
class and its default property prop2
.
class SampleData {
prop1: string;
prop2: {} = {};
}
export default SampleData;
Every time I attempt to create a new instance of SampleData
without specifying prop2
, it triggers a compilation error.
The argument '{ prop1: string; }' is not compatible with the parameter expected for type 'SampleData'. The object '{ prop1: string; }' does not include the required properties message, data
class Test {
constructor() {
this.method1({ prop1: 'asdf' })
}
method1(data: SampleData) {
}
}