Closed fairking closed 11 months ago
I was also thinking about empty constructor and then I found somewhere the following sintax:
const waldo = <Foo> {
bar: "Hello",
qux: 7
}
But it doesn't work in lambda expressions:
// there will be an error:
this.colDefs.filter(x => x.visible === true).map(x => <Foo> { name: x.colName, visible: x.visible }));
IMHO how constructor is generated by codegen is way too loose and I think we can improve that part to make it more strong.
check with validtionModel
?
check with
validtionModel
?
I have removed that part from the example to avoid confusion. I was referring to the constructor and the way how we can make it more strongly typed. ValidationModel would not contain all properties (optional are missing).
Thank you @Manweill for your hard work on the project. It is very useful for many devs.
In my case the codegen is generating the following class code:
When I create objects, it looses the strong type due to
constructor(data: undefined | any = {})
. The following code will be valid and won't throw any compiler errors:So if my class' property
name
changes totitle
I have no validation over whether there any issues across the entire project.Is there any idea how to force to use only strong type syntax?
For example if we change the
constructor(data: LookupItemVm = {})
the type check will complain if property has changed.Any other ideas?