Skip to content

Syntax error for TypeScript generics #425

@bajtos

Description

@bajtos

Describe the bug

Chroma seems to not understand TypeScript generics with multiple template arguments and/or template arguments using a generic type too.

Consider the following TypeScript code:

export class AuditingRepository<
  T extends Entity,
  ID,
  Relations extends object = {}
> extends DefaultCrudRepository<T, ID, Relations> {
}

Chroma v0.8.2 and Hugo v0.78.2 render the code with a comma (,) characters highlighted in red - perhaps suggesting an error?

chroma-typescript-bug

To Reproduce

Save the following text to bug.ts.

export class AuditingRepository<
  T extends Entity,
  ID,
  Relations extends object = {}
> extends DefaultCrudRepository<T, ID, Relations> {
}

Run chroma as follows:

chroma -s autumn --html --html-lines --html-lines-table --html-inline-styles bug.ts > bug.html

Open the produced HTML file in a Chromium-based browers. You should see the same output as on my screenshot posted above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions