stackbuilders / stackbuilders/assertive-ts
Does it make sense to throw a type error if the value cannot be null for the `.toBeNull` helper?
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 37
- Fork
- 4
- Merge medio
- 7g 9m
- PR unite (30g)
- 2
Descrizione
Does it make sense to throw a type error if a value cannot be null for the .toBeNull helper? For example, in the following test I WOULD expect a type error if the type cannot be null:
it("cannot be null", () => {
const x: number = 1;
expect(x).toBeNull(); # Throw a type error here since `x` can only be a number?
});
I WOULD NOT expect a type error if the value can be null. For example, in this test:
it("cannot be null", () => {
const x: number | null = 1;
expect(x).toBeNull();
});
Let me know if that makes sense.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia esaminando l’helper .toBeNull e gli esempi TypeScript nell’issue. Per prima cosa è necessario decidere se i valori non nullable debbano produrre un errore di tipo, quindi definire e verificare il comportamento previsto per i valori nullable e non nullable.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- testing-qa
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 25/100