Skip to content

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

Closed
@BasSchoutenTribe

Description

@BasSchoutenTribe

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions