RafaelSalguero/CSharp2TS

Handle class fields

Closed this issue · 4 comments

Extension should handle fields conversions.

Maybe we should put this optional with disabled by default. Do class fields are serialized by default by Newtonsoft.Json?

Yes: https://dotnetfiddle.net/T4le5X#
Therefore, I don't think it should be disabled by default because it is actually sent in DTO by default. Anyway, since extension generates invalid typescript code when there are any fields, it should be fixed to handle this case in one way or another.
For example from code

public class Foo {
    public int Bar = 42;
    public int Baz;
}

this will be generated:

export interface Foo  {
    public int Bar = 42;
    public int Baz;
}

I agree, marking this as a bug since generates invalid code

Closed with commit c07489a and version 0.0.22