diff --git a/src/parser.ts b/src/parser.ts index 166c3d4132..cade050161 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -797,6 +797,7 @@ export class Parser extends DiagnosticEmitter { } } else { if (isSignature) { + if (tn.peek() == Token.CloseParen) break; // allow trailing comma this.error( DiagnosticCode.Identifier_expected, tn.range() diff --git a/tests/parser/function-type.ts b/tests/parser/function-type.ts index 4c9a385fe5..f547cdeefa 100644 --- a/tests/parser/function-type.ts +++ b/tests/parser/function-type.ts @@ -3,3 +3,4 @@ var b: (a: i32, b: i32) => void; var c: (a: i32, b: i32) => (a: i32, b: i32) => void; var d: (a: i32, a: i32) => void; // NOTE: duplicates in type signatures doesn't in TypeScript var e: (a) => void; // TS1110 +var f: (a: i32, b: i32,) => (a: i32, b: i32,) => void; diff --git a/tests/parser/function-type.ts.fixture.ts b/tests/parser/function-type.ts.fixture.ts index 061e00711d..e4e6aa7888 100644 --- a/tests/parser/function-type.ts.fixture.ts +++ b/tests/parser/function-type.ts.fixture.ts @@ -3,4 +3,5 @@ var b: (a: i32, b: i32) => void; var c: (a: i32, b: i32) => (a: i32, b: i32) => void; var d: (a: i32, a: i32) => void; var e: (a) => void; +var f: (a: i32, b: i32) => (a: i32, b: i32) => void; // ERROR 1110: "Type expected." in function-type.ts(5,10+0)