chroma icon indicating copy to clipboard operation
chroma copied to clipboard

Syntax error for TypeScript generics

Open bajtos opened this issue 4 years ago • 0 comments

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.

bajtos avatar Nov 21 '20 18:11 bajtos