You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Good afternoon, first of all thanks for the library. I have a question about converting Tree like structures to Typescript.
Question - yes
Bug - yes? maybe
code for playback
publicinterfaceITree<T>{publiculongId{get;set;}publicIEnumerable<T> Children {get;set;}publicT?Parent{get;set;}publiculong?ParentId{get;set;}}publicclassNode:ITree<Node>{publiculongId{get;set;}publicIEnumerable<Node> Children {get;set;}=newList<Node>();publicNode?Parent{get;set;}publiculong?ParentId{get;set;}publicstringTitle{get;set;}=null!;}vartypeScript= CsToTs.Generator.GenerateTypeScript(typeof(Node));
at System.Linq.Enumerable.ToList[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.Collections.Generic.IEnumerable`1<System.__Canon>)
at CsToTs.TypeScript.Helper.GetInterfaces(System.Type, CsToTs.TypeScript.TypeScriptContext)
at CsToTs.TypeScript.Helper.PopulateTypeDefinition(System.Type, CsToTs.TypeScript.TypeScriptContext)
at CsToTs.TypeScript.Helper+<>c__DisplayClass7_0.<PopulateTypeDefinition>b__0(System.Type)
at System.Collections.Generic.List`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].ForEach(System.Action`1<System.__Canon>)
at CsToTs.TypeScript.Helper.PopulateTypeDefinition(System.Type, CsToTs.TypeScript.TypeScriptContext)
at CsToTs.TypeScript.Helper+<>c__DisplayClass8_0.<GetInterfaces>b__1(System.Type)
at System.Linq.Enumerable+WhereSelectEnumerableIterator`2[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Cultu
re=neutral, PublicKeyToken=7cec85d7bea7798e]].ToList()
I find workaround
// Skip ITree interface, when converting node classvartext= Generator.GenerateTypeScript(new TypeScriptOptions(){SkipTypePatterns=new[]{"ITree"},},typeof(Node));// Convert separately tree interfacevarskippedText= Generator.GenerateTypeScript(typeof(ITree<>));// Contatenate text + skippedText and Save
With this use, we lose inheritance from the interface, but I did not find another workaround. I would appreciate any help, thanks!
The text was updated successfully, but these errors were encountered:
Good afternoon, first of all thanks for the library. I have a question about converting Tree like structures to Typescript.
expect result
but got circular error
I find workaround
With this use, we lose inheritance from the interface, but I did not find another workaround. I would appreciate any help, thanks!
The text was updated successfully, but these errors were encountered: