-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
Description
This was brought up in #33. Essentially offering a compact way to cast object properties. As an example say you have an object, possibly returned from another library, and want to cast the individual properties to different types:
const foo = { a: [0, 1, 2] };
const bar = foo:{ (a:uint8[]) }; // Returns a new object: { a:uint8[]:[0, 1, 2] }
or:
const foo = { a: 1, b: 1.234 };
const bar = foo:{ (a:uint8), (b:MyType): c }; // Returns new object: { a:uint8: 1, c:MyType: 1.234 }
This is kind of low priority and doesn't need to really be considered for the spec unless for some reason it couldn't be added later if it was necessary. I don't think it's overly useful, and I'm not convinced the syntax is right. More of a random idea.