0

Pretty common scenario, I imagine, but I didn't find an obvious solution googling.

I have a client & server application, and what I'd like to do is configure the build of my server application so that it transpiles the POCOs into their typescript equivalents.

From there I can grab them and copy them manually into my client app.

I would guess there is something out there that can do this as part of the build, but what I have seen so far requires you to manually select and transpile whenever you deem it necessary.

Is there a tool that does something similar to what I'm interested in?

Chris
  • 679
  • 1
  • 11
  • 26
  • 1
    You could achieve this by adding the manual process of selecting and transpiling the C# class declarations to typescript to your pre or post build events like explained [here](https://learn.microsoft.com/en-us/visualstudio/ide/how-to-specify-build-events-csharp?view=vs-2019) – MindSwipe Jan 24 '20 at 13:27
  • 1
    Not sure if this does what you want, but have you looked at https://github.com/frhagn/Typewriter – Matt M Jan 24 '20 at 13:28
  • I'm reading about Typewriter now. I may give it a shot. – Chris Jan 24 '20 at 13:29
  • Another alternative is NSwag, which is a swagger and typescript dto generator util. – Martin Frøhlich Jan 24 '20 at 16:11
  • It's been answered here - https://stackoverflow.com/a/61491713/968003 – Alex Klaus Apr 28 '20 at 23:34

1 Answers1

0

There is a visual studio extension called TypeWritter, https://marketplace.visualstudio.com/items?itemName=frhagn.Typewriter

It will watch for your folder and files in c# (the pattern you define) and then your write some kind of code to tell how to convert that class to typescript file.

Then each time you change the file, typescript files will be generated and will be available in angular or ... to use.

Reza
  • 18,865
  • 13
  • 88
  • 163