instanceof (and probably other) checks don't refine with direct boolean comparison
Offen
bug
- Vorherrschende Sprache
- Rust
- Sterne
- 22.3k
- Forks
- 1.9k
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
`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();
}
```
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.