Reputation: 60556
I am coming from Typescript and trying Flow Type right now.
In TypeScript i can do this.
interface x {
name: string;
}
let y = <x> {
name: "John Doe"
};
How can i do this with flow type?
On Flow - Announcing Typecasts i saw that flow's syntax for casts is e.g.
(myVar: myType)
but
let y = {
name: "John Doe"
}: x;
does not work.
Upvotes: 1
Views: 1458
Reputation: 221412
The parentheses are mandatory. Use
let y = ({
name: "John Doe"
}: x);
Upvotes: 7