Skip to content

TypeScript "trailing comma not allowed" error in type parameters #1820

Closed

Description

@JamesHenry

Source:

export class BaseSingleLevelProfileTargeting <T extends ValidSingleLevelProfileNode> {

Prettier output:

export class BaseSingleLevelProfileTargeting<
	T extends ValidSingleLevelProfileNode,
> {

TypeScript (2.3.3) compiler when compiling the prettier output:

T extends ValidSingleLevelProfileNode,
                                     ~

(59,39): error TS1009: Trailing comma not allowed.

Strangely typescript playground does not seem to have a problem with it:
http://www.typescriptlang.org/play/#src=type%20ValidSingleLevelProfileNode%20%3D%20any%0D%0A%0D%0Aexport%20class%20BaseSingleLevelProfileTargeting%3C%0D%0A%20%20%20%20T%20extends%20ValidSingleLevelProfileNode%2C%0D%0A%3E%20%7B%20%7D

Although that is logging ts.version: 2.1.4-insiders.20161201 to the console, so perhaps the behaviour changed at some point between those two TypeScript versions?

@DanielRosenwasser do you know if that is the case?

Activity

  1. added
    lang:typescript
    on May 30, 2017
  2. vjeux commented on May 30, 2017

    @vjeux
    Contributor

    I'd love to get more context on the TS side around this. What versions are supported, what versions aren't...

  3. DanielRosenwasser commented on May 30, 2017

    @DanielRosenwasser

    Disallow it for now, though I just opened up microsoft/TypeScript#16152 for you.

  4. vjeux commented on May 30, 2017

    @vjeux
    Contributor

    Thanks for the quick reply, i'll do it this afternoon!

  5. added a commit that references this issue on May 31, 2017
    f5dd2cc
  6. added a commit that references this issue on May 31, 2017
    fa708d1
  7. added
    locked-due-to-inactivity
    on Jul 7, 2018
  8. locked as resolved and limited conversation to collaborators on Jul 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:typescriptlocked-due-to-inactivity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions