facebook / facebook/flow

Bug: no error calling a function that adds a property to an inferred sealed object

Open
#6,713 1 comment 0 reactions 0 assignees View on GitHub
Typing: soundness
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

I'm able to call a function that accepts a map (`{[string]: string}`) with an inferred sealed object, and adds on a property. Link to try flow example. Thanks for any help!

```
const fn = (foo: {[string]: string}) => {
foo.cucumber = 'asdf';
}

const a = {a: 'a'};
a.banana = 'asdf'; // error, expected
fn(a); // no error, unexpected

const b: { a: string } = { a: 'a' };
fn(b); // error, expected
```

See try flow example:

https://flow.org/try/#0PTAEAEDMBsHsHcBQiDGsB2BnALqS7QBeUACkllgC5QBvAbRwCcBLdAcwF1qnW2BfAJREAfLUSg8FAHQoArnIC2AIwCmjIqADkAQ0wATSJoDciPsjRZc2jTW3Udms9pnzZytRp37DJkKAB6oGqMsIwANEEAHgAOKijYKnpSoHKKqurRIbGM2ACeKdrouKqg2np6iaDYsKCYKtrQlbBKAFZxuPDM2AAWsLK4waFS5hg4oErU9DzsXKXouXw2dlrajiZKLmkexF4Gxsj4JNoCiH6B6DWD4aCy6Cox7YnJqW7poJmw2Xml5ZXVtfVGnpQM02vFQJ0en0BowQoxhkA

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.