Problem with TypeLite with generics and Enums?

So, I have many .Net libraries / classes for which I would like to generate typescript definitions. typescript is great! I tried this with simple examples and it works great. The only problem I am facing is that the combination that I have does not work with it. Here's how it doesn't work:

[TsClass]
public class Bob<T>
{
    public MyTestEnum MyEnum { get; set; }
    public string TestString { get; set; }
    public string MyProperty { get; set; }
}

[TsEnum]
public enum MyTestEnum
{
    One,
    Two,
    Three
}

The problem is that I can not have a combination of generic <T>and Enumin the same place. For it to work, I need to take out either one of them.

This is the error he gives me on startup:

Error   17  Running transformation: System.NullReferenceException: Object reference not set to an instance of an object.
   at TypeLite.TsModelBuilder.AddEnum(TsEnum tsEnum) in C:\___PROJECTS___\TypeLITE\TypeLite\TsModelBuilder.cs:line 98
   at TypeLite.TsModelBuilder.Add(Type clrType, Boolean includeReferences) in C:\___PROJECTS___\TypeLITE\TypeLite\TsModelBuilder.cs:line 83
   at TypeLite.TsModelBuilder.Add(Assembly assembly) in C:\___PROJECTS___\TypeLITE\TypeLite\TsModelBuilder.cs:line 108
   at TypeLite.Net4.TypeScriptFluentExtensions.ForLoadedAssemblies(TypeScriptFluent ts) in C:\___PROJECTS___\TypeLITE\TypeLite.Net4\TypeScriptFluentExtensions.cs:line 16
   at Microsoft.VisualStudio.TextTemplatingBDE10CD05B2CB4C5419DB79DDF5BA5BA06D673F55FF952439E5971D4E1F394085E3B6D99DC6D1E992221FAC06D0692FFD83BE54FE5AF6A567A491DF31AE26472.GeneratedTextTransformation.TransformText() ..\Scripts\TypeLite.Net4.tt

The fact that I'm not doing anything with generics doesn't matter (I'm just trying to get it to work!)

, , , , ​​.

(, - ): https://bitbucket.org/LukasKabrt/typelite/issue/41/issue-with-generics-and-enums

+4
1
+2

Source: https://habr.com/ru/post/1542687/


All Articles