Ability to create class definition by optional attribute or attribute property

Create issue
Issue #136 new
Peter Eichhorn created an issue

I like the way Typelite actually generate Interfaces for all my required classes.

Sometimes i require to create the class on client side, especialy when i send it to server. I do not want to always create an object and fill all the properties by hand like in issue #66

let obj: MyDto = {
   name: "Eric"

Also the performance can be worse when creating the object by hand. Take a look at Chrome V8 Performance Tips

Code optimization Because V8 creates a new hidden class for each property, hidden class creation should be kept to a minimum. To do this, try to avoid to add properties after the object creation and always initialize object members in the same order (to avoid the creation of different three of hidden classes).

Maybe you could extend the attribute [TsClass] with an optional property: GenerateClass

All the code could remain the same but when this is set, an addional .ts file will be created with the generated classes.

Comments (0)

  1. Log in to comment