Open jinliming2 opened 1 month ago
workaround can be to remove the space before =
workaround can be to remove the space before
=
@RedCMD Yes, but not all scenarios allow removing =
, for example:
const func = <T = string,>(args?: T): T[] => {
return args === undefined ? [] : [args];
};
const emptyStringArr = func();
const emptyNumberArr = func<number>();
but not all scenarios allow removing
=
@jinliming2 removing the space
, not the equals
however TS will auto format the space back in
caused by #jsx
being higher than #arrow-function
jsx-tag-in-expression
:
arrow-function
:
@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.const add = (a: number, b: number) => { return a + b; };