{"id":13594913,"url":"https://github.com/reinforced/Reinforced.Typings","last_synced_at":"2025-04-09T10:32:21.863Z","repository":{"id":45563832,"uuid":"42371035","full_name":"reinforced/Reinforced.Typings","owner":"reinforced","description":"Converts C# classes to TypeScript interfaces (and many more) within project build. 0-dependency, minimal, gluten-free","archived":false,"fork":false,"pushed_at":"2024-11-15T10:31:26.000Z","size":19006,"stargazers_count":523,"open_issues_count":72,"forks_count":86,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-05T07:35:01.150Z","etag":null,"topics":["asp-net","asp-net-mvc","ast","code-generator","csharp","msbuild","mvc5","typescript"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reinforced.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-12T19:57:52.000Z","updated_at":"2025-04-02T22:20:38.000Z","dependencies_parsed_at":"2022-08-12T11:52:25.093Z","dependency_job_id":"b08264a3-768a-426a-93e8-58ee85c620c4","html_url":"https://github.com/reinforced/Reinforced.Typings","commit_stats":{"total_commits":356,"total_committers":30,"mean_commits":"11.866666666666667","dds":0.1573033707865169,"last_synced_commit":"2fee1e693af58f2d25cbc7e3e07c25c95a5e06f6"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reinforced%2FReinforced.Typings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reinforced%2FReinforced.Typings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reinforced%2FReinforced.Typings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reinforced%2FReinforced.Typings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reinforced","download_url":"https://codeload.github.com/reinforced/Reinforced.Typings/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248020593,"owners_count":21034459,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net","asp-net-mvc","ast","code-generator","csharp","msbuild","mvc5","typescript"],"created_at":"2024-08-01T16:01:40.825Z","updated_at":"2025-04-09T10:32:16.848Z","avatar_url":"https://github.com/reinforced.png","language":"C#","readme":"What is that?\n=================\nYou develop frontend applications with TypeScript and .NET Backend? You need Reinforced.Typings.\n\nIt converts .NET classes into TypeScript code. Suffering has ended - you don't need to write and maintain boring TypeScript glue code for your DTOs/ViewModels/APIs anymore - RT can generate it from C# app. \nMoreover, it integrates with MSBuild build process and (re)generates glue code every time you rebuild .NET backend. So you get immediately notified when backend's API/DTOs changed and frontend is broken.\n\nCheck out [documentation](https://github.com/reinforced/Reinforced.Typings/wiki) to discover numbers of useful features (type substitutions, modules, code generators, fluent configuration, multi-file export, JSDOC). \n\nReinforced.Typings is available on [NuGet](https://www.nuget.org/packages/Reinforced.Typings/).\n=================\n```sh\nPM\u003e Install-Package Reinforced.Typings\n```\n\n**Find out detailed information in Reinforced.Typings [wiki](https://github.com/reinforced/Reinforced.Typings/wiki)**\n\nNews\n=================\n\u003e Version **1.6.3** released\n\n- Support of .NET 8\n\nSupport policy\n=================\n\nPlease **do not** ask your questions in github issues anymore. Such format is not suitable for storing FAQ. If you have question - please go to StackOverflow and ask it there. Tag your question with [reinforced-typings](https://stackoverflow.com/questions/tagged/reinforced-typings) tag. I watch full list of questions and will answer ASAP. Make experience that you've got available for other users! \n\n**UPD**: You can notify me about question by sending link via Twitter ([@reinforced_sc](https://twitter.com/reinforced_sc)) to get answer faster.\n\nGitHub issues are for confirmed bugs/feature requests now. If you've found bug - please write and PR test if you can. If you have feature idea - please describe it from fluent/attribute configuration point of view. Describe how'd you gonna to configure RT for desired result. Thanks in advance!\n\nBest to be used for\n=================\n\nExporting ViewModels\n-----------------\n\u003ctable\u003e\n\u003ctr\u003e\u003ctd align=\"center\" width=\"48%\"\u003eC#\u003c/td\u003e\u003ctd\u003e\u003c/td\u003e\u003ctd align=\"center\"  width=\"48%\"\u003eTypeScript\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\n\t\u003ctd\u003e\n\u003cpre lang=\"csharp\"\u003e\nnamespace MyApp\n{\n    using Reinforced.Typings.Attributes;\n\n    [TsInterface]\n    public class Order\n    {\n        public string ItemName { get; set; }\n        public int Quantity { get; set; }\n        public double Subtotal { get; set; }\n        public bool IsPaid { get; set; }\n        public string ClientName { get; set; }\n        public string Address { get; set; }\n    }\n    \n    [TsClass]\n    public class User\n    {\n        public string FirstName { get; set; }\n        public string Email { get; set; }\n        public UserType Type { get; set; }\n    }\n\n    [TsEnum]\n    public enum UserType { One, Two }\n}\n\u003c/pre\u003e\n\u003c/td\u003e\n\t\u003ctd\u003e\u003ch1\u003e\u0026#8680;\u003c/h1\u003e\u003c/td\u003e\n\t\u003ctd\u003e\n\t\u003cpre lang=\"typescript\"\u003e\nmodule MyApp {\n\texport interface IOrder\n\t{\n\t\tItemName: string;\n\t\tQuantity: number;\n\t\tSubtotal: number;\n\t\tIsPaid: boolean;\n\t\tClientName: string;\n\t\tAddress: string;\n\t}\n\texport class User\n\t{\n\t\tpublic FirstName: string;\n\t\tpublic Email: string;\n\t\tpublic Type: MyApp.UserType;\n\t}\n\texport enum UserType { \n\t\tOne = 0, \n\t\tTwo = 1, \n\t}\n}\t\n\t\u003c/pre\u003e\n\t\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n...even complex ViewModels\n-------------\n\u003ctable\u003e\n\u003ctr\u003e\u003ctd align=\"center\" width=\"43%\"\u003eC#\u003c/td\u003e\u003ctd\u003e\u003c/td\u003e\u003ctd align=\"center\"  width=\"48%\"\u003eTypeScript\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\n\t\u003ctd\u003e\n\u003cpre lang=\"csharp\"\u003e\nnamespace MyApp\n{\n    using Reinforced.Typings.Attributes;\n\n    [TsInterface]\n    public class Page\n    {\n        public List\u003cOrder\u003e Orders { get; set; }\n\n        public Dictionary\u003cint, Order\u003e \n                        Cache { get; set; }\n\n        public string[] Tags { get; set; }\n\n        public IEnumerable\u003cobject\u003e \n                        Things { get; set; }\n    }\n}\n\u003c/pre\u003e\n\u003c/td\u003e\n\t\u003ctd\u003e\u003ch1\u003e\u0026#8680;\u003c/h1\u003e\u003c/td\u003e\n\t\u003ctd\u003e\n\t\u003cpre lang=\"typescript\"\u003e\nmodule MyApp {\n\texport interface IPage\n\t{\n\t\tOrders: MyApp.IOrder[];\n\t\tCache: { [key:number]: MyApp.IOrder };\n\t\tTags: string[];\n\t\tThings: any[];\n\t}\n}\t\n\t\u003c/pre\u003e\n\t\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\nTemporary disabling TypeScript compilation in your project\n-------------\nNow you will not stay powerless when generated typings fail your TypeScript build in project. See [RtBypassTypeScriptCompilation](https://github.com/reinforced/Reinforced.Typings/wiki/Reinforced.Typings.settings.xml#RtBypassTypeScriptCompilation) configuration parameter.\n\nInheritance preservation\n-------------\n\u003ctable\u003e\n\u003ctr\u003e\u003ctd align=\"center\" width=\"43%\"\u003eC#\u003c/td\u003e\u003ctd\u003e\u003c/td\u003e\u003ctd align=\"center\"  width=\"48%\"\u003eTypeScript\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\n\t\u003ctd\u003e\n\u003cpre lang=\"csharp\"\u003e\nnamespace MyApp\n{\n    using Reinforced.Typings.Attributes;\n\n    public interface INonExport\n    {\n        string Boom { get; }\n    }\n\n    [TsInterface]\n    public class WithoutInterface\n                : INonExport\n    {\n        public string Boom { get; set; }\n    }\n\n    [TsInterface]\n    public interface IEntity\n    {\n        int Id { get; set; }\n    }\n\n    [TsInterface]\n    public class User : IEntity\n    {\n        public int Id { get; set; }\n\n        public string Login { get; set; }\n    }\n}\n\u003c/pre\u003e\n\u003c/td\u003e\n\t\u003ctd\u003e\u003ch1\u003e\u0026#8680;\u003c/h1\u003e\u003c/td\u003e\n\t\u003ctd\u003e\n\t\u003cpre lang=\"typescript\"\u003e\nmodule MyApp {\n\texport interface IWithoutInterface\n\t{\n\t\tBoom: string;\n\t}\n\texport interface IEntity\n\t{\n\t\tId: number;\n\t}\n\texport interface IUser extends MyApp.IEntity\n\t{\n\t\tId: number;\n\t\tLogin: string;\n\t}\n}\t\n\t\u003c/pre\u003e\n\t\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\nUse fluent configuration\n-------------\nDetails can be found [on the corresponding wiki page](https://github.com/reinforced/Reinforced.Typings/wiki/Fluent-configuration)\n\u003ctable\u003e\n\u003ctr\u003e\u003ctd align=\"center\" width=\"43%\"\u003eC#\u003c/td\u003e\u003ctd\u003e\u003c/td\u003e\u003ctd align=\"center\"  width=\"48%\"\u003eTypeScript\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\n\t\u003ctd\u003e\n\u003cpre lang=\"csharp\"\u003e\nnamespace MyApp\n{\n    using Reinforced.Typings.Fluent;\n    using System.Web.Mvc;\n    \n    public class Configuration\n    {\n        public static void \n            Configure(ConfigurationBuilder builder)\n        {\n            builder\n            \t.ExportAsInterface\u003cSelectListItem\u003e()\n                .OverrideNamespace(\"MyApp\")\n                .WithPublicProperties();\n        }\n    }\n}\n\u003c/pre\u003e\n\u003c/td\u003e\n\t\u003ctd\u003e\u003ch1\u003e\u0026#8680;\u003c/h1\u003e\u003c/td\u003e\n\t\u003ctd\u003e\n\t\u003cpre lang=\"typescript\"\u003e\nmodule MyApp {\n\texport interface ISelectListItem\n\t{\n\t\tDisabled: boolean;\n\t\tGroup: any;\n\t\tSelected: boolean;\n\t\tText: string;\n\t\tValue: string;\n\t}\n}\t\n\t\u003c/pre\u003e\n\t\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\u003ctd align=\"center\" colspan=\"3\"\u003eReinforced.Typings.settings.xml: \u003ccode\u003e\u0026lt;RtConfigurationMethod\u0026gt;MyApp.Configuration.Configure\u0026lt;/RtConfigurationMethod\u0026gt;\u003c/code\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\nGenerate any custom glue code\n-------------\nRead more [here](https://github.com/reinforced/Reinforced.Typings/wiki#writing-custom-code-generators).\n\n\u003ctable\u003e\n\u003ctr\u003e\u003ctd align=\"center\" width=\"30%\"\u003eC#\u003c/td\u003e\u003ctd\u003e\u003c/td\u003e\u003ctd align=\"center\"  width=\"48%\"\u003eTypeScript\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\n\t\u003ctd\u003e\n\u003cpre lang=\"csharp\"\u003e\nnamespace MyApp\n{\n    using Reinforced.Typings.Fluent;\n    using System.Web.Mvc;\n    \n    [TsClass(CodeGeneratorType = typeof(AngularControllerGenerator)]\n    public class AngularController : Controller\n    {\n        [AngularMethod(typeof(SampleResponseModel))]\n        public ActionResult Save(Order order)\n        {\n            return Json(new {\n                Message = \"Success\",\n                Success = true\n            });\n        }\n    }\n    \n    public class AngularMethodAttribute \n            : TsFunctionAttribute\n    {\n        public AngularMethodAttribute(Type returnType)\n        {\n            StrongType = returnType;\n            CodeGeneratorType = typeof \n             (AngularActionCallGenerator);\n        }\n    }\n    \n    public class AngularActionCallGenerator \n            : MethodCodeGenerator\n    {\n        // too long - see sample\n    }\n    \n    public class AngularControllerGenerator \n            : ClassCodeGenerator\n    {\n        // too long - see sample\n    }\n    \n    [TsInterface]\n    public class SampleResponseModel\n    {\n        public string Message { get; set; }\n        public bool Success { get; set; }    \n    }\n}\n\u003c/pre\u003e\n\u003c/td\u003e\n\t\u003ctd\u003e\u003ch1\u003e\u0026#8680;\u003c/h1\u003e\u003c/td\u003e\n\t\u003ctd\u003e\n\t\u003cpre lang=\"typescript\"\u003e\nmodule MyApp {\n\texport interface ISampleResponseModel\n\t{\n\t\tMessage: string;\n\t\tSuccess: boolean;\n\t}\n    \n\tif (window['app']) {\n        window['app'].factory('Api.AngularController', \n        ['$http', \n            ($http: angular.IHttpService) =\u003e new AngularController($http)]);\n    }\n    \n\t/** Result of AngularControllerGenerator activity */\n\texport class AngularController\n\t{\n\t\tconstructor ($http: angular.IHttpService)\n\t\t{\n\t\t\tthis.http = $http;\n\t\t}\n\t\tpublic Save(order: IOrder) : angular.IPromise\u0026lt;ISampleResponseModel\u0026gt;\n\t\t{\n\t\t\tvar params = { 'order': order };\n\t\t\treturn this.http.post('/Angular/Save', params)\n\t\t\t    .then((response) =\u003e { return response.data; });\n\t\t}\n    }        \n}\t\n\t\u003c/pre\u003e\n\t\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n","funding_links":[],"categories":["C\\#","C#"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freinforced%2FReinforced.Typings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freinforced%2FReinforced.Typings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freinforced%2FReinforced.Typings/lists"}