lukehaas/RunJS

Bug: Generic breaks code highlights

Closed this issue ยท 7 comments

Hi,

Write a generic function break the code highlights, looks:

Grabacion.de.pantalla.2023-10-20.a.las.13.26.25.mov

The code:

export const isNumber = <T,>(value: T): value is NonNullable<T> =>
  value !== '' &&
  typeof value !== 'object' &&
  typeof value !== 'boolean' &&
  !Number.isNaN(Number(value));

SO:
Captura de pantalla 2023-10-20 a las 14 15 47
Version: 2.9.0
Config (is in spanish, I can't change the language of RunJS):
Captura de pantalla 2023-10-20 a las 14 13 43

Captura de pantalla 2023-10-20 a las 14 14 17

Captura de pantalla 2023-10-20 a las 14 14 29

Captura de pantalla 2023-10-20 a las 14 14 45

Captura de pantalla 2023-10-20 a las 14 14 58

Seems to work fine for me (2.9.0):
image

Mmm I am also in 2.9.0. I update the issue with my config.

@RodrigoTomeES turn off the react-preset when this is on; it thinks you're writing JSX.

@lukehaas one question, as you said if I disable react-preset it works well but why react preset should break generic in TS? I use it in my .tsx files in vscode

It works in VS Code due to the comma before the closing bracket <T,>. Unfortunately, this is not supported in Codemirror.

Reopening as I will try and get this supported.

@RodrigoTomeES this is now resolved in the latest version of RunJS - version 2.10.0