Typescript Client - MakePropertiesOptional

I am using @servicestack/client@1.0.14

I have the following C# DTO:

public class UserDto
{
    public Guid? Id { get; set; }
    public string DisplayName { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Email { get; set; }
}

The following Typescript DTO is generated using the 'typescript-ref ’ command:

export class UserDto
{
    public id: string;
    public displayName: string;
    public firstName: string;
    public lastName: string;
    public email: string;
}

It ‘appears’ that my Typescript DTO properties are not made optional by default OR if I set ‘MakePropertiesOptional: True.’

Is there another setting I need to configure to ensure my DTO properties are made optional?

Additionally, certain built-in interfaces are in fact updated as expected. IHasSessionId => sessionId is updated based on the MakePropertiesOptional setting.

Thank you

Ok so the optional properties only applies for TypeScript ambient Interface Definitions i.e. /types/typescript.d.

Can I ask why you need them on concrete classes?

Quite frankly, I was unaware of the “types/typescript.d” option. I simply defaulted to the command line utilities.

Can we continue to use the command line utilities while generating the Interface Definitions rather than the concrete classes?

Thank you

Yeah you can use tsd-ref or typescriptd-ref to generate TypeScript interfaces.

That should solve my problem.

Thanks again