I'm struggling to instantiate a BehaviourSubject
I have a json
that needs to be mapped to this Typescript
class:
export class GetDataAPI {
'some-data':string;
constructor (public title:string,
public description:string,
public tags:Array<string>,
public someData:string
){
this['some-data'] = someData;
}
}
In my code, I've created a BehaviourSubject
as shown below:
private dataSubject: BehaviorSubject<GetDataAPI>;
However, when I try to initialize the BehaviourSubject
, I encounter a compilation error with this line of code:
this.dataSubject = new BehaviorSubject<GetDataAPI>({});
The error message reads:
error TS2345: Argument of type '{}' is not assignable to parameter of type 'GetDataAPI'.
Property ''some-data'' is missing in type '{}'.