Trailing commas in arguments list, imports and destructuring

Jussi Kalliokoski jussi.kalliokoski at
Wed Apr 22 15:15:35 UTC 2015

I just noticed that Babel support trailing commas in function arguments
lists, imports and destructuring as well:

Is this correct behavior? I'm not

FWIW as I already use trailing commas object and array literals for better
diffs, I really like this feature as it comes in handy especially in
function signatures where you define types (TypeScript/flow style
annotations), for example:

function sort <T> (
    array : Array<T>,
    compareFn : ((left: T, right: T) => number),
) : Array<T> {

as well as import statements for modules that declare constants:

import {
} from "./constants/COLORS";

not to mention "options object" style function signatures:

class Person {
    constructor ({
    }) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.birthDate = birthDate; = country; = city;
        this.zipCode = zipCode;

To me, the spec language as per Jason's HTML version looks like at least
for destructuring this is supported, but at least I can't read the spec to
allow trailing commas in function signatures. At least this doesn't seem to
be incorporated into the spec:

Is the proposal still on track for ES7 and am I correct in my reading of
the destructuring allowing trailing commas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list