I'm using NSwag.CodeGeneration.TypeScript
in a .NET 6 application to generate a file with types for the front end in TypeScript.
This is my code:
var settings = new TypeScriptClientGeneratorSettings
{
GenerateClientClasses = false
};
settings.TypeScriptGeneratorSettings.TypeStyle = TypeScriptTypeStyle.Interface;
settings.TypeScriptGeneratorSettings.TypeScriptVersion = 3.5M;
settings.TypeScriptGeneratorSettings.DateTimeType = TypeScriptDateTimeType.String;
var generator = new TypeScriptClientGenerator(document, settings);
var code = generator.GenerateFile();
My problem is that every reference type is converted to a nullable, even if it isn't. No problems with nullable value types.
I tried using this:
settings.TypeScriptGeneratorSettings.MarkOptionalProperties = false;
But now all nullable properties (even value types) are not marked as nullables. Can I turn off marking reference types as nullables in the resulting TypeScript?