Skip to content

Discrepancy between doc and signature of GmailDomEmail.to() #793

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BasSchoutenTribe opened this issue Aug 20, 2024 · 1 comment
Closed

Comments

@BasSchoutenTribe
Copy link
Contributor

BasSchoutenTribe commented Aug 20, 2024

The documentation of GmailDomEmail.to() states that all parameters are optional, but the signature of the method does not reflect that

/**
       Get/Set who the email is showing as To
       Optionally receives an object containing email and/or name properties. If received updates the values in the DOM.
       Optionally receives an array of these objects if multiple recipients
       Returns an array of objects containing email & name of who is showing in the DOM as the email is to
    */
to(to_array: GmailDomEmailEntry | GmailDomEmailEntry[]): GmailDomEmailEntry[];

When using this in a Typescript environment I cannot

...
const gmail = new GmailFactory.Gmail(jquery) as Gmail;
...

 gmail.observe.on(
            'view_email',
            viewedEmail =>
            {
                viewedEmail.to().map( ...)    // This will raise a compile exception as its missing the mandatory parameters
            }

If I remove the cast to Gmail on the first line, then everything works fine as the viewedEmail is not seen as a GmailDomEmail type

@josteink
Copy link
Collaborator

Sounds like an error in the type-definition indeed. Thanks for looking into it.

If you can craft a PR which update the type-definitions, I'll get them reviewed, merged and released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants