angular / angular/components

bug(date-adapter): Misleading JSDoc for createDate returns type

Abierto Apto para principiantes
#33,059 2 comentarios 0 reacciones 0 asignados Ver en GitHub
area: material/core gemini-triaged P3
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

(I don't know if it sould be a bug or docs-bug, because it's about JSDoc that not available in the material doc
website, so I couldn't join a link to the doc and create a docs-bug issue).

In the JSDoc of the DateAdapter createDate method, the returns tag indicates that :
@returns The new date, or null if invalid.
But the method returns type is just D, not D | null so it can't be null.
And in the different implementations of the date adapter, when the params are invalid, an error is throws, not a null return.

### Reproduction

This bug is more a docs-bug, but date-adapter JSDoc is not directly available from the doc website, so I couldn't join a link to create a docs-bug.
The components/src/material/core/datetime/date-adapter.ts, line 110

### Expected Behavior

the returns tag indicates that an error is throws when invalid

### Actual Behavior

the returns tag indicates that null is returned when invalid

### Environment

no specific env

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza en components/src/material/core/datetime/date-adapter.ts alrededor de la línea 110 e inspecciona el JSDoc del método createDate junto con su tipo de retorno declarado. Confirma el comportamiento documentado para entradas no válidas comparándolo con la descripción del método y las implementaciones mencionadas en el issue. La tarea está completada cuando el JSDoc describe correctamente el tipo de retorno y qué ocurre cuando la entrada no es válida.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
documentation
Tipo de issue
Documentación
Dificultad
1/5
Tiempo estimado
Menos de una hora
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
78/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.