-
Notifications
You must be signed in to change notification settings - Fork 130
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
Code Highlighting Broken for Generic Functions with Default Values in .tsx Files #1042
Comments
@RedCMD Yes, but not all scenarios allow removing const func = <T = string,>(args?: T): T[] => {
return args === undefined ? [] : [args];
};
const emptyStringArr = func();
const emptyNumberArr = func<number>(); |
@jinliming2 removing the space |
@RedCMD Yes, it seems that removing the space after the generic parameter can eliminate the error, but the lint rule will automatically format it and add the space back. I have to disable the lint rule for this line. |
Does this issue occur when all extensions are disabled?: Yes
Describe the bug
In VSCode, when writing a generic function with default values in a
.tsx
file, code highlighting is broken and colors are displayed incorrectly. The same code works fine in a.ts
file.To Reproduce
.tsx
file.Expected behavior
Code highlighting should work correctly and match the behavior in .ts files.
Screenshots
In
.tsx
file:Pay attention to the screenshot where the generic default parameter definitions, colons, and arrow function arrows are all highlighted in red, while the colors of keywords such as const, if, and return are incorrect.
In
.ts
file:The text was updated successfully, but these errors were encountered: