facebook / facebook/flow

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

Open
#967 1 comment 0 reactions 0 assignees View on GitHub
linter
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.