set this simple object:, { id: 'x', value: 1 }in TypeScript, if you try to do:
type foo = {
id: string,
v: number,
};
const bar: foo = { id: 'something', v: 1111 };
if (bar.xyz) {
console.log('xyz');
}
You will get an error message xyz does not exist on foo. How to get the same result in Flowjs ?
I tried the following, but flowjs does not throw any errors:
type foo = {|
id: string,
v: number,
|};
const bar: foo = { id: 'something', v: 1111 };
if (bar.xyz) {
console.log('xyz');
}
source
share