facebook / facebook/flow

Errors on accessing indexed properties on object without prototype

Open
#8,030 0 comments 0 reactions 0 assignees View on GitHub
bug Typing: object model
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

Flow version: `0.105.2`

```js
type ObjMap = { [key: string]: string, __proto__: null };

const a: ObjMap = { toString: 'test', __proto__: null };
a.b
a.toString
a.hasOwnProperty
```

## Expected behavior

It should be possible to access all properties

## Actual behavior

```
5: a.toString
^ Cannot get `a.toString` because property `toString` is missing in `ObjMap` [1].
References:
3: const a: ObjMap = { toString: 'test', __proto__: null };
^ [1]
6: a.hasOwnProperty
^ Cannot get `a.hasOwnProperty` because property `hasOwnProperty` is missing in `ObjMap` [1].
References:
3: const a: ObjMap = { toString: 'test', __proto__: null };
^ [1]
```

* Link to Try-Flow or Github repo:
https://flow.org/try/#0C4TwDgpgBA8gRgKwLIEMxQLxQN5QNoDWEIAXFAM7ABOAlgHYDmAumZbYwDRQD63YVAe2ADeZOgFcANpKgBfANwAoRQGMBdSlBRl4yNJhxRhAZWr0GZAOTAIlS1178hI7mKkyFilADo4X7yZmjP4AFijkMADudAAKgpBUoEA

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.