Open SafeerH opened 5 years ago
That's a great suggestion, feel free to do a PR! 🙏🏼
I had a problem like yours, my frontend project is angular and needed to export enum and classes, try my project, we can help each other.
https://github.com/svenheden/csharp-models-to-typescript/issues/38
Problem
I used to access my
enum
values (in a type-safe way) from my Angular view whenever I needed, by exposing it from my component as below.E.g.
Now I'm running into to a problem where I can't access my generated
enum
values from my Angular view as I used to do because of the generated enums are defined under a declared module.Solution
The solution for this problem would be to generate types (e.g. enums) under an exported module (instead of a declared module as the
declare
keyword will not generate any JS code and only being used by the TS compiler)So, it would be nice to have an option in the config file to choose between a declared module (e.g.
model.d.ts
) or an exported module (e.g.model.ts
) when generating types.