3

I'm using TypeLITE for creating some Typescript enums from my C# code. The output is something like this:

namespace Test.BL.Enums {
    export enum DayShift {
        PreviousDay = -1,
        CurrentDay = 0,
        NextDay = 1
    }
}

I came to the understanding this contructs are called 'internal modules' (if i'm right).

So I import the namespace in some other file like:

import Enums = Test.BL.Enums;

In design time this doesn't give any errors, but when i'm building my Typescript using the awesome-typescript-loader with Webpack the enums are not included. And so I get an error on this when running the (Angular 2) application.

Is there a way to fix this problem? maybe disabling namespace generation in Typelite?

I also found this issue on github:

https://github.com/s-panferov/awesome-typescript-loader/issues/246

2
  • Have you tried updating your tsconfig to use preserveConstEnums? And have you tried ts-loader to see if there's a difference in behavior?
    – zeh
    Commented Mar 8, 2017 at 16:45
  • @Jensdc do you got any solution for your Problem? Commented May 20, 2017 at 21:10

0

Browse other questions tagged or ask your own question.