You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Typescript: trailing comma in interface is not allowed #1858
lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.
It basically comes down to the trailing comma inside the closingDays array, after the object literal.
Typescript compiler is not happy with it. Don't know why. My guess is that it should be accepted like any other trailing commas but it's probably easier to fix prettier than typescript.
Thanks a lot for this awesome tool, I look forward to use it a lot more,
Cheers
The problem is not the interface, the problem is that tuple types are not allowed to have trailing commas.
Something to keep in mind: did you actually mean to write a tuple type, or did you mean to write {from: string, to: string}[] or Array<{from: string, to: string}>?
Great! For the record, this is probably a good argument against trailing commas in tuple types - while I think it makes sense for object literals and argument lists, I find it more questionable in this context. 😃
lang:typescriptIssues affecting TypeScript-specific constructs (not general JS issues)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.
Activity
fix(typescript): do not print trailing comma in TS tuple type, fixes p…
fix(typescript): do not print trailing comma in TS tuple type, fixes #…
vjeux commentedon Jun 2, 2017
cc @DanielRosenwasser, another place where typescript doesn't support trailing commas
DanielRosenwasser commentedon Jun 2, 2017
The problem is not the interface, the problem is that tuple types are not allowed to have trailing commas.
Something to keep in mind: did you actually mean to write a tuple type, or did you mean to write
{from: string, to: string}[]orArray<{from: string, to: string}>?dotlouis commentedon Jun 2, 2017
You are absolutely right, that's what I meant !
Thanks for the prompt answer !
vjeux commentedon Jun 2, 2017
I just published 1.4.1 which fixes it!
DanielRosenwasser commentedon Jun 2, 2017
Great! For the record, this is probably a good argument against trailing commas in tuple types - while I think it makes sense for object literals and argument lists, I find it more questionable in this context. 😃