Typescript dto enum generation issues

Hi,

I am having few issues with enum’s, for following enum

[Flags]
public enum DocumentContentDetails
{
None = 0,
IncludeImages = 1,
IncludeFile = 2,
IncludeImageProperties = 3,
IncludeAll = IncludeImages | IncludeFile | IncludeImageProperties
}

typescript was generated as

// @Flags()
enum DocumentContentDetails
{
None = 0,
IncludeImages = 1,
IncludeFile = 2,
IncludeAll = 3,
IncludeAll = 3,
}

First issue, it should have been declare enum DocumentContentDetails
Second issue, Include All is added twice

I’ve improved enum support to handle duplicate values and added declare enum for ambient type declarations in this commit.

Note: if you’re going to use enum flags you should be using powers of 2 so you can apply bitwise arithmetic on them, e.g:

[Flags]
public enum DocumentContentDetails
{
    None = 0,  
    IncludeImages = 1,           //= 1 << 0
    IncludeFile = 2,             //= 1 << 1
    IncludeImageProperties = 4,  //= 1 << 2 
    IncludeAll = IncludeImages | IncludeFile | IncludeImageProperties
}

As a value of 3 means IncludeImages | IncludeFile which is a duplicate and indistinguisable from IncludeImageProperties = 3.

This change is available from v5.0.3 that’s now available on MyGet.

Oh, my bad. Not sure how I missed that. Thanks for quickly adding.

Can you please include a reference of why it’s supposed to be "declare enum" in an ambient .d.ts delcaration? I’m getting errors as a result of this change.

VS Code reported that error when using TS dto’s. file won’t compile, but worked fine with "declare enum".