Skip to content

Instantly share code, notes, and snippets.

@jonvuri
Created June 6, 2016 14:40
Show Gist options
  • Save jonvuri/90400fe4394f4064ec725ae0aec4f75c to your computer and use it in GitHub Desktop.
Save jonvuri/90400fe4394f4064ec725ae0aec4f75c to your computer and use it in GitHub Desktop.
Sealed object experiments with Flow
type Foo = {
prop: boolean,
prop2: boolean
};
type Bar = {
prop: boolean,
prop2: boolean,
[key: string]: void
}
// No error - why not?
var f: Foo = {
prop: true,
prop2: false,
otherProp: 3
}
// Does give an error for 'otherProp' as expected
var b: Bar = {
prop: true,
prop2: false,
otherProp: 3
}
// No error as expected
f.prop = false;
// Does give an error - why?
b.prop = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment