Converts C# classes to TypeScript interfaces (and many more) within project build. 0-dependency, minimal, gluten-free
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 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.
Check out documentation to discover numbers of useful features (type substitutions, modules, code generators, fluent configuration, multi-file export, JSDOC).
PM> Install-Package Reinforced.Typings
Find out detailed information in Reinforced.Typings wiki
Version 1.6.3 released
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!
C# | TypeScript | |
namespace MyApp
{
using Reinforced.Typings.Attributes;
|
⇨ |
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,
}
}
|
C# | TypeScript | |
namespace MyApp
{
using Reinforced.Typings.Attributes;
|
⇨ |
module MyApp {
export interface IPage
{
Orders: MyApp.IOrder[];
Cache: { [key:number]: MyApp.IOrder };
Tags: string[];
Things: any[];
}
}
|
Now you will not stay powerless when generated typings fail your TypeScript build in project. See RtBypassTypeScriptCompilation configuration parameter.
C# | TypeScript | |
namespace MyApp
{
using Reinforced.Typings.Attributes;
|
⇨ |
module MyApp {
export interface IWithoutInterface
{
Boom: string;
}
export interface IEntity
{
Id: number;
}
export interface IUser extends MyApp.IEntity
{
Id: number;
Login: string;
}
}
|
Details can be found on the corresponding wiki page
C# | TypeScript | |
namespace MyApp
{
using Reinforced.Typings.Fluent;
using System.Web.Mvc;
|
⇨ |
module MyApp {
export interface ISelectListItem
{
Disabled: boolean;
Group: any;
Selected: boolean;
Text: string;
Value: string;
}
}
|
Reinforced.Typings.settings.xml:
|
Read more here.
C# | TypeScript | |
namespace MyApp
{
using Reinforced.Typings.Fluent;
using System.Web.Mvc;
|
⇨ |
module MyApp {
export interface ISampleResponseModel
{
Message: string;
Success: boolean;
}
|