Skip to content

Omit trailing undefineds from function invocations in JS output #6543

Closed
@cknitt

Description

@cknitt

It would be great if we could special case code generation so that trailing undefineds are omitted from function invocations.

Example: Consider the following bindings (uncurried mode):

type dateFormatOptions = {someOption?: bool}

@module("SomeModule")
external formatDate: (Date.t, ~options: dateFormatOptions=?) => string = "formatDate"

Now

let x = formatDate(Date.make())

will compile to

var x = SomeModule.formatDate(new Date(), undefined);

which works, but has an unnecessary undefined for the trailing optional parameter. It would be nice if that could be omitted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions