zijianhuang / webapiclientgen

Strongly Typed Client API Generators generate strongly typed client APIs in C# .NET and in TypeScript for jQuery and Angular 2+ from ASP.NET Web API and .NET Core Web API
MIT License
167 stars 38 forks source link

Using Typescript Namespaces #6

Closed gravidThoughts closed 7 years ago

gravidThoughts commented 7 years ago

Hello!

First, thank you. My initial impression is that this library has a lot of potential.

I am curious, why do you output the client TypeScript using namespaces.

For a while now, this is advised against by the TypeScript handbook.

Thanks!

zijianhuang commented 7 years ago

I did study carefully TypeScript materials including respective chapters you had mentioned. It is for generated codes transformed from server codes.

  1. Have namespaces mapping.
  2. Have every client codes in one file.

As you can see from the demo projects included in this project, using such generated codes is more handy/convenient than non-namespace approaches. And I had also hinted some reasons at https://www.codeproject.com/Articles/1074039/Generate-Csharp-Client-API-for-ASP-NET-Web-API

Nevertheless, when writing applications codes, I use modules. And Angular enforces modules.