Closed RudeySH closed 11 months ago
I will make it optional on some weekend breaking change was introduced due to https://github.com/Microsoft/TypeScript/pull/7140
as I would like to have strict null checks in frontend in same way as it is in c# with nullable enable
@RudeySH I added possibility to disable | null
on nullable types
by using DisableStrictNullGeneration
in settings
Template(Settings settings)
{
settings
.DisableStrictNullGeneration()
;
}
released in https://github.com/AdaskoTheBeAsT/Typewriter/releases/tag/v2.14.0
In Typewriter v2.12.0 (commit 9113fa1), a breaking change was introduced for nullable types. Type.Name is appended with " | null" by default now. I don't think this is good default behavior, unless it can be disabled somehow?
Consider this. There are at least 5 different ways of defining nullable, undefinable or optional properties in TypeScript:
In my projects, I almost always use the fourth option. In C#, I have configured my JSON serializers to prevent null-valued properties from being serialized, so my API never returns the null value.
Now I'm forced to add this to my template everywhere I use Type.Name:
Please consider reverting this breaking change, or at the very least make it configurable. It has already caused other issues: