Skip to content

Unfortunate parse error for duplicated comma #20376

@ghost

Description

TypeScript Version: 2.7.0-dev.20171130

Code

declare function f(o: any): void;
const o = f({
    x: 0,,
});
o;

Expected behavior:

src/a.ts(3,10): error TS1136: Property assignment expected.

Actual behavior:

src/a.ts(3,10): error TS1136: Property assignment expected.
src/a.ts(4,1): error TS1135: Argument expression expected.
src/a.ts(4,2): error TS1128: Declaration or statement expected.
(and so on through the rest of the file)

It must be assuming I've moved on to the second argument of f despite not having closed the object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions