TIL:<T> Generic parsed as TSX tag

Screenshot 2024-02-16 at 13.37.58

Solutions (co)

  • change from .tsx to .ts add a comma: const f = <T,>(arg: T): T => {...}
  • extend this way: const foo = <T extends unknown>(x: T) => x;
  • or extend this way: const foo = <T extends {}>(x: T): T => x;

fixed:

Screenshot 2024-02-16 at 13.40.11