instanceof (and probably other) checks don't refine with direct boolean comparison
Aperta
bug
- Lingua principale
- Rust
- Stelle
- 22.3k
- Fork
- 1.9k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
`instanceof` always returns a boolean, depending on whether it's something is an instance of something or not.
works:
```js
class A {cool: () => {}}
class B {}
const a = new A
const what: A | B = a;
if (what instanceof A) {
what.cool();
}
```
doesn't:
```js
class A {cool: () => {}}
class B {}
const a = new A
const what: A | B = a;
if ((what instanceof A) === true) {
what.cool();
}
```
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.