alexcanessa / typescript-coverage-report

Node command tool to generate TypeScript coverage report
MIT License
489 stars 31 forks source link

Bug: Syntax highlighter has a bug #61

Open OmgImAlexis opened 3 years ago

OmgImAlexis commented 3 years ago

Describe the bug The syntax highlighter used has a bug with backticks.

To Reproduce Add the following to a file and run typescript-coverage-report. Open the html file and you'll see the highlighting breaks

/**
 * see #54
 */
export type Path<T, Key extends keyof T = keyof T> = Key extends string
 ? T[Key] extends Record<string, any>
   ?
       | `${Key}.${Path<T[Key], Exclude<keyof T[Key], keyof any[]>> & string}`
       | `${Key}.${Exclude<keyof T[Key], keyof any[]> & string}`
       | Key
   : never
 : never;

export type PathValue<T, P extends Path<T>> = P extends `${infer Key}.${infer Rest}`
 ? Key extends keyof T
   ? Rest extends Path<T[Key]>
     ? PathValue<T[Key], Rest>
     : never
   : never
 : P extends keyof T
 ? T[P]
 : never;

Expected behaviour It to not break.

Screenshots

Screen Shot 2021-05-01 at 10 59 28 pm

Environment

Additional context Same issue in all browsers leading me to believe it's an issue with the code on generation but I could be wrong.

alexcanessa commented 3 years ago

I think the ` causes problems to codemirror. I wonder if just upgrading the version fixes the problem.

alexcanessa commented 3 years ago

If I paste the same code in this codemirror playground I get the same. Even trying to upgrade to the latest version of codemirror.

OmgImAlexis commented 3 years ago

Related? https://github.com/codemirror/CodeMirror/issues/5774

alexcanessa commented 3 years ago

@OmgImAlexis yes seems to be the exact issue.

OmgImAlexis commented 2 years ago

@alexcanessa should be fixed in https://github.com/codemirror/CodeMirror/commit/472b458a31c2236a7088e4fb5d4bf3b04e8c91fa can you please update.