facebook / facebook/flow

Multiple properties with the same name doesn't trigger an error

Aperta
#967 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
linter
Lingua principale
Rust
Stelle
22.3k
Fork
1.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

This seems like a situation that Flow should give an error:

``` javascript
/* @flow */
//jshint ignore:start

class Foo {
a() {return 1}
a() {return 2}
}

var o = {
a: 5,
a: 6
};
```

If the multiple properties have different types, Flow does give an error at least:

``` javascript
/* @flow */
//jshint ignore:start

class Foo {
a(): number {return 1}
a(): string {return 'b'}
}
```

```
$ flow

/private/tmp/foo/index.js:5:23,23: number
This type is incompatible with
/private/tmp/foo/index.js:6:8,13: string

Found 1 error
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.