From 2cb897238ca78cc59b29e0003bfc537a5192b622 Mon Sep 17 00:00:00 2001 From: ritschwumm Date: Tue, 11 Oct 2022 13:58:45 +0200 Subject: [PATCH] allow exactOptionalPropertyTypes in tsc 4.8.4 this leaves out the name property AddressObject instead of setting it to undefined. typescript 4.4 has a new check exactOptionalPropertyTypes which prevents accidentally confounding a missing property with a property which does exist, but has a value of undefined. for maximum type safety, i'd like to keep this enabled in my project - but if i do, tsc complains about emailjs being imprecise about its types. --- smtp/address.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smtp/address.ts b/smtp/address.ts index df79904..1784368 100644 --- a/smtp/address.ts +++ b/smtp/address.ts @@ -130,7 +130,7 @@ function convertAddressTokens(tokens: AddressToken[]) { // http://tools.ietf.org/html/rfc2822#appendix-A.1.3 if (isGroup) { addressObjects.push({ - name: texts.length === 0 ? undefined : texts.join(' '), + ...(texts.length === 0 ? {} : { name: texts.join(' ') }), group: groups.length > 0 ? addressparser(groups.join(',')) : [], }); } else {