Enum and bool constants generate incorrect TypeScript code

Create issue
Issue #134 new
Mek created an issue

Hello, I am struggling with generation of TypeScript code from enum and boolean constants. Example in C#:

public const VatAmountSumMode DefaultVatAmountSumMode = VatAmountSumMode.RoundBeforeSum;
public const bool DefaultCustomerInvoiceSpecification = false;

generates this:

export const DefaultVatAmountSumMode: QicsUnity.Common.BusinessObjects.VatAmountSumMode = RoundBeforeSum;
export const DefaultCustomerInvoiceSpecification: boolean = False;

which is invalid TypeScript. The boolean field should be lowercase false. The enum field should be fully qualified or ordinal value used instead. Proposal for improvement: it would be also great if TypeLite automatically generated enum definition (the enum with list of its values) when constant of its type is exposed like this. Currently it is possible to do if I tell TypeLite to generate the enum definition explicitly.

Comments (1)

  1. Log in to comment