-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser
Description
Bug Report
Current behavior
Currently, Babel throws an unrecoverable syntax error whenever it finds a trailing comma after a rest parameter, however TypeScript allows such commas in ambient contexts (in declarations marked with declare
or in .d.ts
files).
Input Code
// in a .ts file
declare function foo(...args: any[],): any;
declare class Bar {
foo(...args: any[],): any
}
declare interface Baz {
foo(...args: any[],): any
}
declare type Q = (...args: any[],) => any
// in a .d.ts file
function foo(...args: any[],): any;
class Bar {
foo(...args: any[],): any
}
interface Baz {
foo(...args: any[],): any
}
type Q = (...args: any[],) => any
Expected behavior
No error
Environment
- Babel version(s): v7.13.14
Metadata
Metadata
Assignees
Labels
area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser