Open aymather opened 4 years ago
It's true that a "group" does not have a "domain" associated with it. I don't think adding a property that doesn't exist will be good for TS users who want accurate types. However, I see that this is inconvenient because the return types of all the functions include ParsedMailbox | ParsedGroup
and then you have to handle the case of there being a group. I discussed this a bit here: https://github.com/jackbearheart/email-addresses/issues/41#issuecomment-437234965
I think the real solution is creating a parseOneMailbox
function with the return type ParsedMailbox | null
, because this is a very common use case.
I'd like to suggest adding the domain to the ParsedGroup return type because this basic example isn't working as expected.
It is telling me: