sajad torkamani
type CompanyTypeCode = 'ltd' | 'plc' | 'sole-trader'

type EmailTemplates = {
  [Code in CompanyTypeCode]?: InvitationEmails
}

// Because we made the key of EmailTemplates optional, we don't have to define every value of the CompanyTypeCode union as a key
const emailTemplates: EmailTemplates = {
  ltd: LimitedCompanyEmail,
  plc: PublicCompanyEmail,
}

Tagged: TypeScript

Leave a comment

Your email address will not be published. Required fields are marked *