How do I type this?
const { company }: CompanyType = data;
CodePudding user response:
You can type it like this:
const { company }: {company:CompanyType} = data;
This is equivalent to casting data
to {company:CompanyType}
, then destructure it.
const { company } = data as {company:CompanyType};