I have defined an interface with various properties. I am looking to instantiate an object based on this interface, but I only want to partially initialize some of the properties. Is there a way to accomplish this? Thank you.
export interface Campaign {
id: string;
name: string;
createdOn: string;
lastUpdated: string;
createdBy: User;
type: CampaignType;
status: CampaignStatus;
startDate: string;
endDate: string;
budget: number;
description: string;
account: Account;
}
I am attempting to create an array of campaign objects like so:
let campaigns: Campaign[] = [
{ id: "1",
name: "test campaign"
}
];
However, I encounter the following error:
Type '{ id: string; name: string; }' is missing the following properties from type 'Campaign': createdOn, lastUpdated, createdBy, type, and 6 more.ts(2740)