AdrianWilczynski / CSharpToTypeScript

Convert C# Models, ViewModels and DTOs into their TypeScript equivalents using webapps, CLI Tool or VSCode extension. Links: https://marketplace.visualstudio.com/items?itemName=adrianwilczynski.csharp-to-typescript - https://csharptotypescript.azurewebsites.net - https://adrianwilczynski.github.io/CSharpToTypeScript/ - https://www.nuget.org/packages/CSharpToTypeScript.CLITool/
MIT License
115 stars 32 forks source link

Nullable for non-primitive fields #24

Open antal-huck opened 3 years ago

antal-huck commented 3 years ago

Since non-primitives in C# are nullable, would it make sense if all the transformed non-primitive fields in the TypeScript interfaces also get nullable?

Example: Suppose we have a C# class ExampleClass with one field a of type NestedClass. Then the transformed TypeScript interface could automatically be:

export interface ExampleClass { a: NestedClass | null; }

instead of

export interface ExampleClass { a: NestedClass; }