I have this code:
interface ISource extends IdModel {
source_type_id: number;
network_id: number;
company_connection_id: number;
feed_id: number;
connection_id: number;
feed_ids: number[];
name: string;
tag: string;
additional_data: ISourceData;
default_user_image?: File;
hasNewImage?: boolean;
next_update?: string;
post_field_overrides?: {
user_full_name?: string;
user_screen_name?: string;
url?: string;
network_id?: number;
};
}
save() {
//converting this to string because I am saving this in my database.
this.source.post_field_overrides = JSON.stringify(this.source.post_field_overrides);
}
If I don't convert that into string, that value that's being saved in my DB is [Object object].
If I also convert that into String, I am getting this error/warning:
TS2322: Type 'string' is not assignable to type '{ user_full_name?: string | undefined; user_screen_name?: string | undefined; url?: string | undefined; network_id?: number | undefined; } | undefined'.
Any help on this, please? Thanks in advance!
post_field_overrides?is neither string nor any... You should decide what you want it to be and write that I guess...