Open
Description
Let's take the following example:
export class I32Bounds {
public left: i32;
public top: i32;
public width: i32;
public height: i32;
constructor() {}
}
export function createI32Bounds(bounds: i32[]): I32Bounds {
let i32Bounds: I32Bounds = {
left: bounds[0],
top: bounds[1],
width: bounds[2],
height: bounds[3],
};
return i32Bounds;
}
Using this style gives a comfortable way to work with objects like in JS.
But it gets a bit more complex when you have nested objects. (one class per obj)
What would be amazing is if AS could create the required classes from a provided interface.
export interface I32Bounds {
left: i32;
top: i32;
width: i32;
height: i32;
nest: { a: i32 }
}
export function createI32Bounds(bounds: i32[]): I32Bounds {
let i32Bounds: I32Bounds = {
left: bounds[0],
top: bounds[1],
width: bounds[2],
height: bounds[3],
nest: { a: 12 }
};
return i32Bounds;
}
This would make working with objects a lot more comfortable.
If serialization would be possible on this (#292)
One could easily create objects within AS and pass them as a string to JS.