-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to convert .NET classes to TypeScript? #76
Comments
I put some examples in this issue: #34 I do exactly this in the examples. The basic premise is understanding that the TS for SelectListItem has already been processed by NTypewriter and exists in a known location. Once you can work with that assumption, then you can recognize that the type of CreativeOptions is a complex type and requires an import for it. You then output the import. Now, for me, I am never exporting a .Net type in my API. I want more control over my api. I don't want .Net to change the definition of a class on me during an upgrade and then it forces a change to my api. c For my builtin classes, I use an attribute on those classes that I want exported, so I can use: If you didn't want to hard code the list of classes that need to be exported in your .nt script, you might be able to do two passes over the classes. |
I believe that question is mainly about how to get access to types defined outside of our source code, there is an option for that: |
Thank you both for the helpful responses! Enabling the The remaining problem is that when I include this in my .nt template:
For some reason, it is not detecting that my class is referencing a property that has the type |
Because of that line :
This is unfortunately by design, this function does not return types from |
We have some ViewModel classes in our C# code that have properties with types like
List<SelectListItem>
. How would we get .NET classes likeSelectListItem
rendered down to TS via NTypewriter, so the TS class generated from this ViewModel knows where to findSelectListItem
?Here is the property in our C# VM:
As it stands right now, NTypewriter generates the following TS for that property:
But of course, that type can't be found because it doesn't exist in our TS yet.
Same question applies to classes from other Nuget packages we install, such as Kendo. If a C# class property is of a type from Kendo's code, how do we get that down to our TS via NTypewriter? Has anyone else dealt with this issue and have any potential solutions?
Thank you!
The text was updated successfully, but these errors were encountered: