Skip to content

Proposal: Allow trailing commas in function argument list #12306

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
streamich opened this issue Nov 16, 2016 · 4 comments
Closed

Proposal: Allow trailing commas in function argument list #12306

streamich opened this issue Nov 16, 2016 · 4 comments
Labels
Duplicate An existing issue was already created

Comments

@streamich
Copy link

streamich commented Nov 16, 2016

TypeScript allows trailing commas in object definitions:

var obj = {
    key: 'value',
};

Proposal: Allow trailing commas in function argument list:

someFunction(argument,);

Why? Trailing commas in object definitions are great for convenience when editing lists:

{
    key1: 'val1',
    key2: 'val2',
    key3: 'val3',
};

Same is with functions, consider usage of Virtual Hypertext functions:

return (
    h('div', null,
        h('span', null, 'span 1'),
        h('span', null, 'span 1'),
        h('span', null, 'span 1'),
    )
);
@RyanCavanaugh
Copy link
Member

#8942 ?

@RyanCavanaugh
Copy link
Member

What am I missing here? If you try this on the Playground it already works. http://www.typescriptlang.org/play/#src=console.log(1%2C%202%2C%20)%3B%0D%0A

@mhegazy mhegazy added the Working as Intended The behavior described is the intended behavior; this is not a bug label Nov 16, 2016
@RyanCavanaugh RyanCavanaugh added Duplicate An existing issue was already created and removed Working as Intended The behavior described is the intended behavior; this is not a bug labels Nov 17, 2016
@streamich
Copy link
Author

streamich commented Nov 18, 2016

I get this in v1.8:

TS1009:Trailing comma not allowed.

It works in v1.8 as well, but WebStorm highlights it as error and the whole folder tree containing that fail.

@aluanhaddad
Copy link
Contributor

That's because jetbrains uses their own language service. In IntelliJ IDEA there's a setting to use the type script language service instead. I would definitely suggest that you investigate and see if this option is available in Webstorm as well.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants