Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Syntax highlighter has a bug #61

Open
OmgImAlexis opened this issue May 1, 2021 · 5 comments
Open

Bug: Syntax highlighter has a bug #61

OmgImAlexis opened this issue May 1, 2021 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@OmgImAlexis
Copy link

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

  • Tool version: 0.6.0
  • OS: N/A
  • Node version: N/A
  • Browser (if applicable): [e.g. chrome, safari] N/A

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.

@OmgImAlexis OmgImAlexis added the help wanted Extra attention is needed label May 1, 2021
@alexcanessa
Copy link
Owner

alexcanessa commented May 11, 2021

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

@alexcanessa
Copy link
Owner

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
Copy link
Author

Related? codemirror/codemirror5#5774

@alexcanessa
Copy link
Owner

@OmgImAlexis yes seems to be the exact issue.

@OmgImAlexis
Copy link
Author

@alexcanessa should be fixed in codemirror/codemirror5@472b458 can you please update.

@alexcanessa alexcanessa added enhancement New feature or request and removed help wanted Extra attention is needed labels Dec 20, 2021
@alexcanessa alexcanessa added this to the v0.7.0 milestone Dec 20, 2021
@alexcanessa alexcanessa self-assigned this Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants