bug(date-adapter): Misleading JSDoc for createDate returns type
- Lingua principale
- TypeScript
- Stelle
- 25k
- Fork
- 6.8k
- Merge medio
- 1g 8h
- PR unite (30g)
- 91
Descrizione
### 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
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia da components/src/material/core/datetime/date-adapter.ts intorno alla riga 110 e controlla lo JSDoc del metodo createDate insieme al tipo restituito dichiarato. Verifica il comportamento documentato per gli input non validi rispetto alla descrizione del metodo e alle implementazioni menzionate nell’issue. Il lavoro è completato quando lo JSDoc descrive accuratamente il tipo restituito e cosa accade quando l’input non è valido.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- angular, typescript
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Stato di attività
- Tranquilla
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 78/100