All Projects → reinforced → Reinforced.typings

reinforced / Reinforced.typings

Licence: mit
Converts C# classes to TypeScript interfaces (and many more) within project build. 0-dependency, minimal, gluten-free

Programming Languages

typescript
32286 projects
csharp
926 projects

Projects that are alternatives of or similar to Reinforced.typings

Protoc Gen Gotemplate
📂 generic protocol generator based on golang's text/template (grpc/protobuf)
Stars: ✭ 284 (-16.72%)
Mutual labels:  ast, code-generator
TraceHub
Centralized and distributed logging for Web applications and services, extending System.Diagnostics and Essential.Diagnostics, providing structured tracing and logging withou needing to change 1 line of your application codes
Stars: ✭ 22 (-93.55%)
Mutual labels:  asp-net, asp-net-mvc
PersianDataAnnotations
PersianDataAnnotations is ASP.NET Core MVC & ASP.NET MVC Custom Localization DataAnnotations (Localized MVC Errors) for Persian(Farsi) language - فارسی سازی خطاهای اعتبارسنجی توکار ام.وی.سی. و کور.ام.وی.سی. برای نمایش اعتبار سنجی سمت کلاینت
Stars: ✭ 38 (-88.86%)
Mutual labels:  asp-net, asp-net-mvc
React Aspnet Boilerplate
A starting point for building isomorphic React applications with ASP.NET Core, leveraging existing techniques.
Stars: ✭ 285 (-16.42%)
Mutual labels:  asp-net, asp-net-mvc
RazorHtmlMinifier.Mvc5
↘️ Trivial compile-time Razor HTML Minifier for ASP.NET MVC 5.
Stars: ✭ 31 (-90.91%)
Mutual labels:  asp-net, asp-net-mvc
DNZ.SEOChecker
SEO Checker and Recommander Plugin (like wordpress Yoast) for ASP.NET Core.
Stars: ✭ 18 (-94.72%)
Mutual labels:  asp-net, asp-net-mvc
elmah.io
ELMAH error logger for sending errors to elmah.io.
Stars: ✭ 31 (-90.91%)
Mutual labels:  asp-net, asp-net-mvc
Javaparser
Java 1-15 Parser and Abstract Syntax Tree for Java, including preview features to Java 13
Stars: ✭ 3,972 (+1064.81%)
Mutual labels:  ast, code-generator
Awesome-Nuget-Packages
📦 A collection of awesome and top .NET packages sorted by most popular needs.
Stars: ✭ 87 (-74.49%)
Mutual labels:  asp-net, asp-net-mvc
Cake-Shop
A sample Cake Shop Website built with ASP.NET Core (Multi-Page Application)
Stars: ✭ 44 (-87.1%)
Mutual labels:  asp-net, asp-net-mvc
ByteScout-SDK-SourceCode
ALL source code samples for ByteScout SDKs and Web API API products.
Stars: ✭ 24 (-92.96%)
Mutual labels:  asp-net, asp-net-mvc
MVC5Course
【ASP.NET MVC 5 開發實戰:從入門到進階】實作練習專案
Stars: ✭ 19 (-94.43%)
Mutual labels:  asp-net, asp-net-mvc
BlipBinding
ASP.NET MVC case study solution for PluralSight Guides. Demonstrates how to use default MVC model binding with hierarchical form data.
Stars: ✭ 29 (-91.5%)
Mutual labels:  asp-net, asp-net-mvc
WebApiToTypeScript
A tool for code generating TypeScript endpoints for your ASP.NET Web API controllers
Stars: ✭ 26 (-92.38%)
Mutual labels:  code-generator, asp-net
Astring
🌳 Tiny and fast JavaScript code generator from an ESTree-compliant AST.
Stars: ✭ 757 (+121.99%)
Mutual labels:  ast, code-generator
Uintra
A flexible and lightweight Umbraco based framework, for making an Intranet, Extranet or social platform based on known conventions.
Stars: ✭ 43 (-87.39%)
Mutual labels:  asp-net, asp-net-mvc
Recaptcha Net
reCAPTCHA for .NET library lets you easily use Google's reCAPTCHA in an ASP.NET Web Forms / MVC / ASP.NET Core application.
Stars: ✭ 116 (-65.98%)
Mutual labels:  asp-net, asp-net-mvc
Aspnetsaml
Very simple SAML 2.0 consumer module for ASP.NET/C#
Stars: ✭ 177 (-48.09%)
Mutual labels:  asp-net, asp-net-mvc
AspNetCore-Dynamic-Permission
Dynamic Permission Samples in ASP.NET Core and ASP.NET MVC 5.
Stars: ✭ 19 (-94.43%)
Mutual labels:  asp-net, asp-net-mvc
steamstatus
A quick and dirty POC website to view the status of Steam CM servers. Precursor to steamstat.us
Stars: ✭ 67 (-80.35%)
Mutual labels:  asp-net, asp-net-mvc

What is that?

You develop frontend applications with TypeScript and .NET Backend? You need Reinforced.Typings.

It 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. Moreover, it integrates with VisualStudio 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.

Check out documentation to discover numbers of useful features (type substitutions, modules, code generators, fluent configuration, multi-file export, JSDOC).

Reinforced.Typings is available on NuGet.

PM> Install-Package Reinforced.Typings

Find out detailed information in Reinforced.Typings wiki

News

🤘 Version 1.5.9 released

  • PR #188 - Support of .NET 5 ⭐️
  • PR #187 - Support of C#8 nullables
  • PR #183 - RtAsync and more efficient promises handling
  • build fixes

Support policy

Please 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 tag. I watch full list of questions and will answer ASAP. Make experience that you've got available for other users!

UPD: You can notify me about question by sending link via Twitter (@reinforced_sc) to get answer faster.

GitHub 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!

Best to be used for

Exporting ViewModels

C# TypeScript
namespace MyApp
{
    using Reinforced.Typings.Attributes;
[TsInterface]
public class Order
{
    public string ItemName { get; set; }
    public int Quantity { get; set; }
    public double Subtotal { get; set; }
    public bool IsPaid { get; set; }
    public string ClientName { get; set; }
    public string Address { get; set; }
}

[TsClass]
public class User
{
    public string FirstName { get; set; }
    public string Email { get; set; }
    public UserType Type { get; set; }
}

[TsEnum]
public enum UserType { One, Two }

}

module MyApp {
	export interface IOrder
	{
		ItemName: string;
		Quantity: number;
		Subtotal: number;
		IsPaid: boolean;
		ClientName: string;
		Address: string;
	}
	export class User
	{
		public FirstName: string;
		public Email: string;
		public Type: MyApp.UserType;
	}
	export enum UserType { 
		One = 0, 
		Two = 1, 
	}
}	
	

...even complex ViewModels

C# TypeScript
namespace MyApp
{
    using Reinforced.Typings.Attributes;
[TsInterface]
public class Page
{
    public List<Order> Orders { get; set; }

    public Dictionary<int, Order> 
                    Cache { get; set; }

    public string[] Tags { get; set; }

    public IEnumerable<object> 
                    Things { get; set; }
}

}

module MyApp {
	export interface IPage
	{
		Orders: MyApp.IOrder[];
		Cache: { [key:number]: MyApp.IOrder };
		Tags: string[];
		Things: any[];
	}
}	
	

Temporary disabling TypeScript compilation in your project

Now you will not stay powerless when generated typings fail your TypeScript build in project. See RtBypassTypeScriptCompilation configuration parameter.

Inheritance preservation

C# TypeScript
namespace MyApp
{
    using Reinforced.Typings.Attributes;
public interface INonExport
{
    string Boom { get; }
}

[TsInterface]
public class WithoutInterface
            : INonExport
{
    public string Boom { get; set; }
}

[TsInterface]
public interface IEntity
{
    int Id { get; set; }
}

[TsInterface]
public class User : IEntity
{
    public int Id { get; set; }

    public string Login { get; set; }
}

}

module MyApp {
	export interface IWithoutInterface
	{
		Boom: string;
	}
	export interface IEntity
	{
		Id: number;
	}
	export interface IUser extends MyApp.IEntity
	{
		Id: number;
		Login: string;
	}
}	
	

Use fluent configuration

Details can be found on the corresponding wiki page

C# TypeScript
namespace MyApp
{
    using Reinforced.Typings.Fluent;
    using System.Web.Mvc;
public class Configuration
{
    public static void 
        Configure(ConfigurationBuilder builder)
    {
        builder
        	.ExportAsInterface<SelectListItem>()
            .OverrideNamespace("MyApp")
            .WithPublicProperties();
    }
}

}

module MyApp {
	export interface ISelectListItem
	{
		Disabled: boolean;
		Group: any;
		Selected: boolean;
		Text: string;
		Value: string;
	}
}	
	
Reinforced.Typings.settings.xml: <RtConfigurationMethod>MyApp.Configuration.Configure</RtConfigurationMethod>

Generate any custom glue code

Read more here.

C# TypeScript
namespace MyApp
{
    using Reinforced.Typings.Fluent;
    using System.Web.Mvc;
[TsClass(CodeGeneratorType = typeof(AngularControllerGenerator)]
public class AngularController : Controller
{
    [AngularMethod(typeof(SampleResponseModel))]
    public ActionResult Save(Order order)
    {
        return Json(new {
            Message = "Success",
            Success = true
        });
    }
}

public class AngularMethodAttribute 
        : TsFunctionAttribute
{
    public AngularMethodAttribute(Type returnType)
    {
        StrongType = returnType;
        CodeGeneratorType = typeof 
         (AngularActionCallGenerator);
    }
}

public class AngularActionCallGenerator 
        : MethodCodeGenerator
{
    // too long - see sample
}

public class AngularControllerGenerator 
        : ClassCodeGenerator
{
    // too long - see sample
}

[TsInterface]
public class SampleResponseModel
{
    public string Message { get; set; }
    public bool Success { get; set; }    
}

}

module MyApp {
	export interface ISampleResponseModel
	{
		Message: string;
		Success: boolean;
	}
if (window['app']) {
    window['app'].factory('Api.AngularController', 
    ['$http', 
        ($http: angular.IHttpService) => new AngularController($http)]);
}

/** Result of AngularControllerGenerator activity */
export class AngularController
{
	constructor ($http: angular.IHttpService)
	{
		this.http = $http;
	}
	public Save(order: IOrder) : angular.IPromise&lt;ISampleResponseModel&gt;
	{
		var params = { 'order': order };
		return this.http.post('/Angular/Save', params)
		    .then((response) => { return response.data; });
	}
}        

}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].