microsoft / microsoft/TypeScript
Wrong error message for testing `void` with `??`
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
🔎 Search Terms
nullish An expression of type 'void' cannot be tested for truthiness.
(there are many closed issues with these search term, but they are all from people confused by why this is an error in the first place)
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
https://www.typescriptlang.org/play?ts=5.3.3#code/CYUwxgNghgTiAEA3W8oC4kHsCWwDcAUAVPAPynwBmUEAziHkA
💻 Code
declare var a: void;
a ?? false;
🙁 Actual behavior
It reports "An expression of type 'void' cannot be tested for truthiness."
🙂 Expected behavior
The error message should not mention truthiness, since I'm not testing for truthiness. nullishness? :P
Additional information about the issue
No response
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza reproduciendo el problema en el TypeScript Playground enlazado usando el ejemplo proporcionado de void y ??. Sigue el diagnóstico que produce “An expression of type 'void' cannot be tested for truthiness”; la tarea estará terminada cuando el mensaje ya no haga referencia a truthiness al informar de este error de nullishness.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- compilers
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100