I can’t find a TypeScript to C# converter (that works). Does anyone know of one? Again, I need TypeScript to C#, NOT C# to Typescript.
This one looked promising but didn’t work for me: https://marketplace.visualstudio.com/items?itemName=Box-Of-Hats.ts-to-csharp
If that one works for you, please let me know how you did it!
The extension you linked doesn’t convert TS to C#. It takes a TS interface and uses it to generate a C# class based off an interface defined in TS. Frankly, I don’t see a use case for the tool myself but maybe someone else will.
What you’re asking for is called a transpiler (AKA source-to-source compiler) and I’m unaware of any that exist for compiling TS to C#. Frankly, I don’t any benefit to doing such a thing anyways. TypeScript’s primary advantage is the type system it provides for JS developers. Object Oriented languages such as C# and Java, already have much stronger and feature rich type systems. If you want to use C# or Java, then go straight to C# or Java.
I could see value in a C# to TS compiler if it was able to take advantage of C#’s type system and “magically” make it work within the limitations of TS/JS. Not so much the other way around.
What is the reason to convert typescript to C#?? Is it to quickly create POCO/DTO classes?
C# devs
null reference exceptions