This is a really quick and simple test to see how TypeGen works with simple classes.
-
Clone this repo
-
Either use the devcontainer configuration or install the dependencies locally (see below)
-
Run the build command which is "Generate typescript types" from the command palette in vscode or by running:
dotnet build csharp-typegen-test.sln && dotnet typegen generate
-
Check the output in the
dist
folder
- .NET 8.0 SDK
- TypeGen - this can be installed with
dotnet tool install --global dotnet-typegen --version 5.0.1
- It looks like I could have used the
buildProject
setting in the tgconfig.json file to avoid having to run the build command first. But this allows for the build to be optional. - I chose to generate interfaces on the TypeScript side by using the
ExportTsInterface
attribute.ExportTsClass
is also available, but I prefer interfaces on the TypeScript side.